diff --git a/src/api/stock/pickingShortage.ts b/src/api/stock/pickingShortage.ts new file mode 100644 index 00000000..3931e765 --- /dev/null +++ b/src/api/stock/pickingShortage.ts @@ -0,0 +1,33 @@ +import request from '@/utils/request' + +const v = '1.0' + +/** + * 分拣缺货补货需求计算(仓库级别) + * 自动从用户上下文获取仓库,查询所有未完成储位分配的订单, + * 计算每个SKU在分拣区与存货区的库存量、订单需求量、分拣区缺口及建议补货量。 + * @param pagination 分页参数 { page, pageSize } + * @param order 排序参数,如 { field: 'shortage', direction: 'desc' } + */ +export function getReplenishmentDemand( + pagination?: { page: number; pageSize: number }, + order?: { field: string; direction: string } | null +) { + const data: Record = { + pagination: pagination || { page: 1, pageSize: 50 }, + } + if (order) { + data.order = order + } + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.management.replenishmentDemand', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/router/map.ts b/src/router/map.ts index ba312bf0..38b39aaf 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -16,6 +16,7 @@ export const componentMap: Record = { 'stock/index': () => import('@/views/stock/stock/index.vue'), 'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'), 'stock/combo_stock/index': () => import('@/views/stock/combo_stock/index.vue'), + 'stock/pickingShortage/index': () => import('@/views/stock/pickingShortage/index.vue'), 'storage/receiving': () => import('@/views/storage/receiving/index.vue'), 'storage/report': () => import('@/views/storage/report/index.vue'), 'storage/entry': () => import('@/views/storage/entry/index.vue'), diff --git a/src/views/order/orderManagement/exceptionOrder.vue b/src/views/order/orderManagement/exceptionOrder.vue index a58697c9..7a35cd5c 100644 --- a/src/views/order/orderManagement/exceptionOrder.vue +++ b/src/views/order/orderManagement/exceptionOrder.vue @@ -24,6 +24,17 @@ :layout-key="toolbarLayoutKey" @action="handleToolbarButtonClick" /> + + + + @@ -292,6 +292,7 @@ function normalizeToWhere(condition: any) { } const mapType = (type: string, value: any) => { + if (type === 'datetimerange') return 'datetimerange' if (type === 'daterange' || Array.isArray(value)) return 'daterange' if (type === 'number' || typeof value === 'number') return 'number' if (type === 'boolean' || typeof value === 'boolean') return 'boolean' @@ -305,7 +306,7 @@ function normalizeToWhere(condition: any) { if (c && typeof c === 'object' && !Array.isArray(c)) { if ('operator' in c || 'value' in c || 'type' in c) { return { - operator: c.operator || (Array.isArray(c.value) ? 'in' : (fieldType === 'daterange' ? 'between' : 'eq')), + operator: c.operator || (Array.isArray(c.value) ? 'in' : (fieldType === 'daterange' || fieldType === 'datetimerange' ? 'between' : 'eq')), value: c.value, type: c.type || mapType(fieldType, c.value) } @@ -314,7 +315,7 @@ function normalizeToWhere(condition: any) { if (c === null || c === undefined || c === '' || (Array.isArray(c) && c.length === 0)) return null - const simpleOp = fieldType === 'daterange' ? 'between' : 'eq' + const simpleOp = (fieldType === 'daterange' || fieldType === 'datetimerange') ? 'between' : 'eq' const simpleType = mapType(fieldType, c) return { operator: simpleOp, value: c, type: simpleType } } @@ -391,9 +392,6 @@ async function loadData() { // 优先使用由 ScanBox 提交并经过规范化的条件(包含 operator 等信息) const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {}) - // 固定条件:订单状态只显示待入库或部分入库(始终强制) - where.order_status = { operator: 'in', value: ['PENDING', 'PARTIAL', 'PARTIAL_RECEIVED'], type: 'select' } - const params: StorageEntryListParams = { pagination: { page: pagination.currentPage,