feat(wms): 持久化出入库移库明细行金额并补全库存流水金额展示
parent
2ffbcbd71f
commit
fa570c2637
|
|
@ -16,6 +16,7 @@ export interface InventoryHistoryVO {
|
|||
beforeQuantity?: number
|
||||
afterQuantity?: number
|
||||
price?: number
|
||||
totalPrice?: number
|
||||
remark?: string
|
||||
orderId?: number
|
||||
orderNo?: string
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@
|
|||
{{ formatQuantity(scope.row.afterQuantity) || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量/单价(元)" min-width="150">
|
||||
<el-table-column label="数量/金额(元)" min-width="150">
|
||||
<template #default="scope">
|
||||
<div class="flex justify-between">
|
||||
<span>数量:</span>
|
||||
|
|
@ -154,6 +154,10 @@
|
|||
<span>单价:</span>
|
||||
<span>{{ formatPrice(scope.row.price) }}</span>
|
||||
</div>
|
||||
<div v-if="scope.row.totalPrice || scope.row.totalPrice === 0" class="flex justify-between">
|
||||
<span>金额:</span>
|
||||
<span>{{ formatPrice(scope.row.totalPrice) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
|
|
|||
|
|
@ -104,9 +104,10 @@ const detailRows = computed<DetailRow[]>(() =>
|
|||
(detailData.value.details || []).map((detail) => ({
|
||||
...detail,
|
||||
totalPrice:
|
||||
detail.price != null && detail.quantity
|
||||
detail.totalPrice ??
|
||||
(detail.price != null && detail.quantity
|
||||
? Number(detail.price) * Number(detail.quantity)
|
||||
: undefined
|
||||
: undefined)
|
||||
}))
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ const buildSubmitData = () => {
|
|||
} = formData.value
|
||||
return {
|
||||
...order,
|
||||
details: (details || []).map(({ totalPrice: _rowTotalPrice, ...detail }) => detail)
|
||||
details: details || []
|
||||
} as MovementOrderVO
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,144 @@
|
|||
<!-- WMS 移库单打印 -->
|
||||
<template>
|
||||
<div class="hidden">
|
||||
<button ref="printButtonRef" v-print="printObj" type="button"></button>
|
||||
<div id="wmsMovementOrderPrint" class="color-#303133">
|
||||
<div class="relative mb-8px">
|
||||
<h2 class="text-center">移库单</h2>
|
||||
<div v-if="printData.no" class="absolute right-0 top-0">
|
||||
<Barcode
|
||||
:content="printData.no"
|
||||
:display-value="false"
|
||||
:format="BarcodeFormatEnum.CODE39"
|
||||
:height="40"
|
||||
:width="180"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-12px grid grid-cols-3 gap-x-24px gap-y-8px text-14px">
|
||||
<div>移库单号:{{ printData.no || '-' }}</div>
|
||||
<div>来源仓库:{{ printData.sourceWarehouseName || '-' }}</div>
|
||||
<div>目标仓库:{{ printData.targetWarehouseName || '-' }}</div>
|
||||
<div>移库状态:{{ getDictLabel(DICT_TYPE.WMS_ORDER_STATUS, printData.status) || '-' }}</div>
|
||||
<div>单据日期:{{ formatNullableDate(printData.orderTime, 'YYYY-MM-DD') }}</div>
|
||||
<div>总数量:{{ formatQuantity(printData.totalQuantity) || '-' }}</div>
|
||||
<div>总金额:{{ formatPrice(printData.totalPrice) || '-' }}</div>
|
||||
<div class="col-span-3 grid grid-cols-2 gap-x-24px">
|
||||
<div>
|
||||
创建:{{ formatNullableDate(printData.createTime) }} /
|
||||
{{ printData.creatorName || printData.creator || '-' }}
|
||||
</div>
|
||||
<div>
|
||||
更新:{{ formatNullableDate(printData.updateTime) }} /
|
||||
{{ printData.updaterName || printData.updater || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-3">备注:{{ printData.remark || '-' }}</div>
|
||||
</div>
|
||||
<table class="w-full border-collapse text-13px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-left">商品信息</th>
|
||||
<th class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-left">规格信息</th>
|
||||
<th class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-left">数量</th>
|
||||
<th class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-left">单价(元)</th>
|
||||
<th class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-left">金额(元)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="detail in printRows" :key="detail.id">
|
||||
<td class="border border-solid border-#dcdfe6 p-8px">
|
||||
<div>{{ detail.itemName || '-' }}</div>
|
||||
<div v-if="detail.itemCode" class="text-12px">编号:{{ detail.itemCode }}</div>
|
||||
</td>
|
||||
<td class="border border-solid border-#dcdfe6 p-8px">
|
||||
<div>{{ detail.skuName || '-' }}</div>
|
||||
<div v-if="detail.skuCode" class="text-12px">编号:{{ detail.skuCode }}</div>
|
||||
</td>
|
||||
<td class="border border-solid border-#dcdfe6 p-8px text-right">
|
||||
{{ formatQuantity(detail.quantity) || '-' }}
|
||||
</td>
|
||||
<td class="border border-solid border-#dcdfe6 p-8px text-right">
|
||||
{{ formatPrice(detail.price) || '-' }}
|
||||
</td>
|
||||
<td class="border border-solid border-#dcdfe6 p-8px text-right">
|
||||
{{ formatPrice(detail.totalPrice) || '-' }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="printRows.length">
|
||||
<td class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px" colspan="2">合计</td>
|
||||
<td class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-right">
|
||||
{{ formatSumQuantity(printRows, (detail) => detail.quantity) }}
|
||||
</td>
|
||||
<td class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-right">
|
||||
{{ formatSumPrice(printRows, (detail) => detail.price) }}
|
||||
</td>
|
||||
<td class="border border-solid border-#dcdfe6 bg-#f5f7fa p-8px text-right">
|
||||
{{ formatSumPrice(printRows, (detail) => detail.totalPrice) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!printRows.length">
|
||||
<td
|
||||
class="border border-solid border-#dcdfe6 p-8px text-center"
|
||||
:colspan="tableColumnCount"
|
||||
>
|
||||
暂无明细
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { formatNullableDate } from '@/utils/formatTime'
|
||||
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
||||
import { MovementOrderApi, MovementOrderVO } from '@/api/wms/order/movement'
|
||||
import { MovementOrderDetailVO } from '@/api/wms/order/movement/detail'
|
||||
import {
|
||||
formatPrice,
|
||||
formatQuantity,
|
||||
formatSumPrice,
|
||||
formatSumQuantity
|
||||
} from '@/views/wms/utils/format'
|
||||
import Barcode from '@/views/mes/wm/barcode/components/Barcode.vue'
|
||||
import { BarcodeFormatEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
/** WMS 移库单打印 */
|
||||
defineOptions({ name: 'WmsMovementOrderPrint' })
|
||||
|
||||
const printData = ref<MovementOrderVO>({}) // 打印数据
|
||||
const printButtonRef = ref<HTMLButtonElement>() // 打印按钮
|
||||
const tableColumnCount = 5
|
||||
const printObj = ref({
|
||||
id: 'wmsMovementOrderPrint',
|
||||
popTitle: ' ',
|
||||
extraCss: '/print.css',
|
||||
extraHead: '',
|
||||
zIndex: 20003
|
||||
})
|
||||
|
||||
interface PrintRow extends MovementOrderDetailVO {
|
||||
totalPrice?: number
|
||||
}
|
||||
|
||||
const printRows = computed<PrintRow[]>(() =>
|
||||
(printData.value.details || []).map((detail) => ({
|
||||
...detail,
|
||||
totalPrice:
|
||||
detail.totalPrice ??
|
||||
(detail.price != null && detail.quantity
|
||||
? Number((Number(detail.price) * Number(detail.quantity)).toFixed(2))
|
||||
: undefined)
|
||||
}))
|
||||
)
|
||||
|
||||
/** 打印移库单 */
|
||||
const print = async (id: number) => {
|
||||
printData.value = await MovementOrderApi.getMovementOrder(id)
|
||||
await nextTick()
|
||||
printButtonRef.value?.click()
|
||||
}
|
||||
defineExpose({ print })
|
||||
</script>
|
||||
|
|
@ -499,6 +499,9 @@ const resetQuery = () => {
|
|||
|
||||
/** 计算明细金额 */
|
||||
const getDetailTotalPrice = (detail: MovementOrderDetailVO) => {
|
||||
if (detail.totalPrice !== undefined && detail.totalPrice !== null) {
|
||||
return detail.totalPrice
|
||||
}
|
||||
if (!detail.quantity || detail.price === undefined || detail.price === null) {
|
||||
return undefined
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,9 +121,10 @@ const detailRows = computed<DetailRow[]>(() =>
|
|||
(detailData.value.details || []).map((detail) => ({
|
||||
...detail,
|
||||
totalPrice:
|
||||
detail.price != null && detail.quantity
|
||||
detail.totalPrice ??
|
||||
(detail.price != null && detail.quantity
|
||||
? Number(detail.price) * Number(detail.quantity)
|
||||
: undefined
|
||||
: undefined)
|
||||
}))
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ const buildSubmitData = () => {
|
|||
} = formData.value
|
||||
return {
|
||||
...order,
|
||||
details: (details || []).map(({ totalPrice: _rowTotalPrice, ...detail }) => detail)
|
||||
details: details || []
|
||||
} as ReceiptOrderVO
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,10 @@ const printRows = computed<PrintRow[]>(() =>
|
|||
(printData.value.details || []).map((detail) => ({
|
||||
...detail,
|
||||
totalPrice:
|
||||
detail.price != null && detail.quantity
|
||||
detail.totalPrice ??
|
||||
(detail.price != null && detail.quantity
|
||||
? Number((Number(detail.price) * Number(detail.quantity)).toFixed(2))
|
||||
: undefined
|
||||
: undefined)
|
||||
}))
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -547,6 +547,9 @@ const handleWarehouseChange = () => {
|
|||
|
||||
/** 计算明细金额 */
|
||||
const getDetailTotalPrice = (detail: ReceiptOrderDetailVO) => {
|
||||
if (detail.totalPrice !== undefined && detail.totalPrice !== null) {
|
||||
return detail.totalPrice
|
||||
}
|
||||
if (!detail.quantity || detail.price === undefined || detail.price === null) {
|
||||
return undefined
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,9 +121,10 @@ const detailRows = computed<DetailRow[]>(() =>
|
|||
(detailData.value.details || []).map((detail) => ({
|
||||
...detail,
|
||||
totalPrice:
|
||||
detail.price != null && detail.quantity
|
||||
detail.totalPrice ??
|
||||
(detail.price != null && detail.quantity
|
||||
? Number(detail.price) * Number(detail.quantity)
|
||||
: undefined
|
||||
: undefined)
|
||||
}))
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ const buildSubmitData = () => {
|
|||
} = formData.value
|
||||
return {
|
||||
...order,
|
||||
details: (details || []).map(({ totalPrice: _rowTotalPrice, ...detail }) => detail)
|
||||
details: details || []
|
||||
} as ShipmentOrderVO
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,10 @@ const printRows = computed<PrintRow[]>(() =>
|
|||
(printData.value.details || []).map((detail) => ({
|
||||
...detail,
|
||||
totalPrice:
|
||||
detail.price != null && detail.quantity
|
||||
detail.totalPrice ??
|
||||
(detail.price != null && detail.quantity
|
||||
? Number((Number(detail.price) * Number(detail.quantity)).toFixed(2))
|
||||
: undefined
|
||||
: undefined)
|
||||
}))
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -547,6 +547,9 @@ const handleWarehouseChange = () => {
|
|||
|
||||
/** 计算明细金额 */
|
||||
const getDetailTotalPrice = (detail: ShipmentOrderDetailVO) => {
|
||||
if (detail.totalPrice !== undefined && detail.totalPrice !== null) {
|
||||
return detail.totalPrice
|
||||
}
|
||||
if (!detail.quantity || detail.price === undefined || detail.price === null) {
|
||||
return undefined
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue