feat(wms):进一步优化入库单的后端实现(对齐 mes)
parent
0be2674277
commit
c865dfe488
|
|
@ -20,8 +20,10 @@ export interface ReceiptOrderVO {
|
||||||
details?: ReceiptOrderDetailVO[]
|
details?: ReceiptOrderDetailVO[]
|
||||||
createTime?: Date
|
createTime?: Date
|
||||||
creator?: string
|
creator?: string
|
||||||
|
creatorName?: string
|
||||||
updateTime?: Date
|
updateTime?: Date
|
||||||
updater?: string
|
updater?: string
|
||||||
|
updaterName?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// WMS 入库单 API
|
// WMS 入库单 API
|
||||||
|
|
@ -54,8 +56,13 @@ export const ReceiptOrderApi = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 完成入库
|
// 完成入库
|
||||||
completeReceiptOrder: async (data: ReceiptOrderVO) => {
|
completeReceiptOrder: async (id: number) => {
|
||||||
return await request.put({ url: '/wms/receipt-order/complete', data })
|
return await request.put({ url: '/wms/receipt-order/complete?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 作废入库单
|
||||||
|
cancelReceiptOrder: async (id: number) => {
|
||||||
|
return await request.put({ url: '/wms/receipt-order/cancel?id=' + id })
|
||||||
},
|
},
|
||||||
|
|
||||||
// 删除入库单
|
// 删除入库单
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ export enum DICT_TYPE {
|
||||||
// ========== WMS - 仓库管理模块 ==========
|
// ========== WMS - 仓库管理模块 ==========
|
||||||
WMS_MERCHANT_TYPE = 'merchant_type', // WMS 往来企业类型
|
WMS_MERCHANT_TYPE = 'merchant_type', // WMS 往来企业类型
|
||||||
WMS_INVENTORY_HISTORY_TYPE = 'wms_inventory_history_type', // WMS 库存记录类型
|
WMS_INVENTORY_HISTORY_TYPE = 'wms_inventory_history_type', // WMS 库存记录类型
|
||||||
WMS_RECEIPT_ORDER_STATUS = 'wms_receipt_order_status', // WMS 入库单状态
|
WMS_ORDER_STATUS = 'wms_order_status', // WMS 单据状态
|
||||||
WMS_RECEIPT_ORDER_TYPE = 'wms_receipt_order_type', // WMS 入库单类型
|
WMS_RECEIPT_ORDER_TYPE = 'wms_receipt_order_type', // WMS 入库单类型
|
||||||
|
|
||||||
// ========== AI - 人工智能模块 ==========
|
// ========== AI - 人工智能模块 ==========
|
||||||
|
|
|
||||||
|
|
@ -203,8 +203,8 @@
|
||||||
/>
|
/>
|
||||||
<el-table-column align="right" label="库存" min-width="120">
|
<el-table-column align="right" label="库存" min-width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div>剩余:{{ formatNumber(scope.row.remainQuantity, 2) }}</div>
|
<div>剩余:{{ formatQuantity(scope.row.remainQuantity) }}</div>
|
||||||
<div class="text-12px text-gray-500">原始:{{ formatNumber(scope.row.quantity, 2) }}</div>
|
<div class="text-12px text-gray-500">原始:{{ formatQuantity(scope.row.quantity) }}</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
|
@ -246,7 +246,7 @@ import { InventoryDetailApi, InventoryDetailVO } from '@/api/wms/inventory/detai
|
||||||
import WarehouseAreaSelect from '@/views/wms/md/warehouse/components/WarehouseAreaSelect.vue'
|
import WarehouseAreaSelect from '@/views/wms/md/warehouse/components/WarehouseAreaSelect.vue'
|
||||||
import WarehouseSelect from '@/views/wms/md/warehouse/components/WarehouseSelect.vue'
|
import WarehouseSelect from '@/views/wms/md/warehouse/components/WarehouseSelect.vue'
|
||||||
import { AREA_ENABLE, BATCH_ENABLE } from '@/views/wms/utils/config'
|
import { AREA_ENABLE, BATCH_ENABLE } from '@/views/wms/utils/config'
|
||||||
import { formatNumber } from '@/views/wms/utils/format'
|
import { formatQuantity } from '@/views/wms/utils/format'
|
||||||
|
|
||||||
/** WMS 库存明细 */
|
/** WMS 库存明细 */
|
||||||
defineOptions({ name: 'WmsInventoryDetail' })
|
defineOptions({ name: 'WmsInventoryDetail' })
|
||||||
|
|
|
||||||
|
|
@ -153,19 +153,19 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="!BATCH_ENABLE" align="right" label="操作前" min-width="110">
|
<el-table-column v-if="!BATCH_ENABLE" align="right" label="操作前" min-width="110">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatNumber(scope.row.beforeQuantity, 2) || '-' }}
|
{{ formatQuantity(scope.row.beforeQuantity) || '-' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="!BATCH_ENABLE" align="right" label="操作后" min-width="110">
|
<el-table-column v-if="!BATCH_ENABLE" align="right" label="操作后" min-width="110">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatNumber(scope.row.afterQuantity, 2) || '-' }}
|
{{ formatQuantity(scope.row.afterQuantity) || '-' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量/金额(元)" min-width="150">
|
<el-table-column label="数量/金额(元)" min-width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<span>数量:</span>
|
<span>数量:</span>
|
||||||
<span>{{ formatNumber(scope.row.quantity, 2) }}</span>
|
<span>{{ formatQuantity(scope.row.quantity) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="scope.row.amount || scope.row.amount === 0" class="flex justify-between">
|
<div v-if="scope.row.amount || scope.row.amount === 0" class="flex justify-between">
|
||||||
<span>金额:</span>
|
<span>金额:</span>
|
||||||
|
|
@ -216,7 +216,7 @@ import { InventoryHistoryApi, InventoryHistoryVO } from '@/api/wms/inventory/his
|
||||||
import WarehouseAreaSelect from '@/views/wms/md/warehouse/components/WarehouseAreaSelect.vue'
|
import WarehouseAreaSelect from '@/views/wms/md/warehouse/components/WarehouseAreaSelect.vue'
|
||||||
import WarehouseSelect from '@/views/wms/md/warehouse/components/WarehouseSelect.vue'
|
import WarehouseSelect from '@/views/wms/md/warehouse/components/WarehouseSelect.vue'
|
||||||
import { AREA_ENABLE, BATCH_ENABLE } from '@/views/wms/utils/config'
|
import { AREA_ENABLE, BATCH_ENABLE } from '@/views/wms/utils/config'
|
||||||
import { formatNumber, formatPrice } from '@/views/wms/utils/format'
|
import { formatPrice, formatQuantity } from '@/views/wms/utils/format'
|
||||||
|
|
||||||
/** WMS 库存流水 */
|
/** WMS 库存流水 */
|
||||||
defineOptions({ name: 'WmsInventoryHistory' })
|
defineOptions({ name: 'WmsInventoryHistory' })
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@
|
||||||
</template>
|
</template>
|
||||||
<el-table-column align="right" label="库存" min-width="130" prop="quantity">
|
<el-table-column align="right" label="库存" min-width="130" prop="quantity">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatNumber(scope.row.quantity, 2) }}
|
{{ formatQuantity(scope.row.quantity) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -187,7 +187,7 @@ import { InventoryApi, InventoryVO } from '@/api/wms/inventory'
|
||||||
import WarehouseAreaSelect from '@/views/wms/md/warehouse/components/WarehouseAreaSelect.vue'
|
import WarehouseAreaSelect from '@/views/wms/md/warehouse/components/WarehouseAreaSelect.vue'
|
||||||
import WarehouseSelect from '@/views/wms/md/warehouse/components/WarehouseSelect.vue'
|
import WarehouseSelect from '@/views/wms/md/warehouse/components/WarehouseSelect.vue'
|
||||||
import { AREA_ENABLE } from '@/views/wms/utils/config'
|
import { AREA_ENABLE } from '@/views/wms/utils/config'
|
||||||
import { formatNumber } from '@/views/wms/utils/format'
|
import { formatQuantity } from '@/views/wms/utils/format'
|
||||||
|
|
||||||
/** WMS 库存统计 */
|
/** WMS 库存统计 */
|
||||||
defineOptions({ name: 'WmsInventory' })
|
defineOptions({ name: 'WmsInventory' })
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
/** 单据状态枚举 */
|
||||||
|
export const OrderStatusEnum = {
|
||||||
|
PREPARE: 0, // 草稿
|
||||||
|
FINISHED: 4, // 已完成
|
||||||
|
CANCELED: 5 // 已作废
|
||||||
|
} as const
|
||||||
|
|
||||||
|
/** 往来企业类型枚举 */
|
||||||
|
export const MerchantTypeEnum = {
|
||||||
|
CUSTOMER: 1, // 客户
|
||||||
|
SUPPLIER: 2, // 供应商
|
||||||
|
CUSTOMER_SUPPLIER: 3 // 客户/供应商
|
||||||
|
} as const
|
||||||
|
|
||||||
|
/** 供应商类型的往来企业 */
|
||||||
|
export const SupplierMerchantTypeList = [
|
||||||
|
MerchantTypeEnum.SUPPLIER,
|
||||||
|
MerchantTypeEnum.CUSTOMER_SUPPLIER
|
||||||
|
]
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
import { isNullOrUnDef } from '@/utils/is'
|
import { isNullOrUnDef } from '@/utils/is'
|
||||||
|
|
||||||
|
type DecimalValue = number | string | null | undefined
|
||||||
|
|
||||||
|
/** 数量小数位 */
|
||||||
|
export const QUANTITY_PRECISION = 2
|
||||||
/** 金额小数位 */
|
/** 金额小数位 */
|
||||||
export const PRICE_PRECISION = 2
|
export const PRICE_PRECISION = 2
|
||||||
/** 重量小数位 */
|
/** 重量小数位 */
|
||||||
|
|
@ -11,39 +15,72 @@ export const WEIGHT_PRECISION = 3
|
||||||
/** 长宽高小数位 */
|
/** 长宽高小数位 */
|
||||||
export const DIMENSION_PRECISION = 1
|
export const DIMENSION_PRECISION = 1
|
||||||
|
|
||||||
export const formatNumber = (
|
const toFiniteDecimal = (value: DecimalValue) => {
|
||||||
value?: number | string | null,
|
|
||||||
digit: number = PRICE_PRECISION
|
|
||||||
) => {
|
|
||||||
if (isNullOrUnDef(value)) {
|
if (isNullOrUnDef(value)) {
|
||||||
return ''
|
return undefined
|
||||||
}
|
}
|
||||||
if (typeof value === 'string' && value.trim() === '') {
|
if (typeof value === 'string' && value.trim() === '') {
|
||||||
return ''
|
return undefined
|
||||||
}
|
}
|
||||||
const numberValue = typeof value === 'string' ? Number(value) : value
|
const decimalValue = typeof value === 'string' ? Number(value) : value
|
||||||
if (!Number.isFinite(numberValue)) {
|
if (!Number.isFinite(decimalValue)) {
|
||||||
return ''
|
return undefined
|
||||||
}
|
}
|
||||||
return numberValue.toFixed(digit)
|
return decimalValue
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 格式化金额,保留 2 位小数 */
|
const sumDecimal = <T>(list: T[], getter: (item: T) => DecimalValue) => {
|
||||||
|
return list.reduce((sum, item) => {
|
||||||
|
const decimalValue = toFiniteDecimal(getter(item))
|
||||||
|
return decimalValue === undefined ? sum : sum + decimalValue
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化数量 */
|
||||||
|
export const formatQuantity = (value?: number | string | null) => {
|
||||||
|
const decimalValue = toFiniteDecimal(value)
|
||||||
|
return decimalValue === undefined ? '' : decimalValue.toFixed(QUANTITY_PRECISION)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化金额 */
|
||||||
export const formatPrice = (value?: number | string | null) => {
|
export const formatPrice = (value?: number | string | null) => {
|
||||||
return formatNumber(value, PRICE_PRECISION)
|
const decimalValue = toFiniteDecimal(value)
|
||||||
|
return decimalValue === undefined ? '' : decimalValue.toFixed(PRICE_PRECISION)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 格式化重量,保留 3 位小数 */
|
/** 汇总数量 */
|
||||||
|
export const sumQuantity = <T>(list: T[], getter: (item: T) => DecimalValue) => {
|
||||||
|
return sumDecimal(list, getter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 汇总金额 */
|
||||||
|
export const sumPrice = <T>(list: T[], getter: (item: T) => DecimalValue) => {
|
||||||
|
return sumDecimal(list, getter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化汇总数量 */
|
||||||
|
export const formatSumQuantity = <T>(list: T[], getter: (item: T) => DecimalValue) => {
|
||||||
|
return formatQuantity(sumQuantity(list, getter))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化汇总金额 */
|
||||||
|
export const formatSumPrice = <T>(list: T[], getter: (item: T) => DecimalValue) => {
|
||||||
|
return formatPrice(sumPrice(list, getter))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化重量 */
|
||||||
export const formatWeight = (value?: number | string | null) => {
|
export const formatWeight = (value?: number | string | null) => {
|
||||||
return formatNumber(value, WEIGHT_PRECISION)
|
const decimalValue = toFiniteDecimal(value)
|
||||||
|
return decimalValue === undefined ? '' : decimalValue.toFixed(WEIGHT_PRECISION)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 格式化长宽高,保留 1 位小数 */
|
/** 格式化长宽高 */
|
||||||
export const formatDimension = (value?: number | string | null) => {
|
export const formatDimension = (value?: number | string | null) => {
|
||||||
return formatNumber(value, DIMENSION_PRECISION)
|
const decimalValue = toFiniteDecimal(value)
|
||||||
|
return decimalValue === undefined ? '' : decimalValue.toFixed(DIMENSION_PRECISION)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 格式化长宽高组合,保留 1 位小数 */
|
/** 格式化长宽高组合 */
|
||||||
export const formatDimensionText = (
|
export const formatDimensionText = (
|
||||||
length?: number | string | null,
|
length?: number | string | null,
|
||||||
width?: number | string | null,
|
width?: number | string | null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue