From b59443539af543264e2e4e010bec19a64c0f4019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E5=A4=A9?= Date: Mon, 12 Oct 2026 16:28:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=88=86=E6=8B=A3=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E5=8D=A1):=20=E8=A1=A5=E6=98=BE=E6=95=88=E6=9C=9F=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E9=87=8A=E3=80=8C=E4=B8=BA=E4=BD=95=E5=85=88=E5=87=BA?= =?UTF-8?q?=E8=BF=99=E6=89=B9=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 背景:本系统 FIFO = **效期优先**(ORDER BY expiry_date ASC NULLS LAST, created_at ASC),不是先入库先出;界面原先不显示效期,用户无法理解排序 - 后端 listPickingOutboundBatches 增返 expiry_date - Web 批次编辑行 + 小程序批次卡补显「效期 {expiry}」;rowMeta 三语同步 - 不改排序口径(库存冻结面);只多显示一个字段 - 验证:两端 tsc + 小程序 node --check 通过;前端全量仍基线(3 文件/4 例) --- miniprogram/components/picking-panel/index.js | 3 +++ miniprogram/components/picking-panel/index.wxml | 2 +- server/src/services/pickingService.ts | 4 +++- src/i18n/locales/en/picking.ts | 2 +- src/i18n/locales/id/picking.ts | 2 +- src/i18n/locales/zh-CN/picking.ts | 2 +- src/pages/picking/PickingManagement.tsx | 4 ++++ src/utils/workflowApi.ts | 2 ++ 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/miniprogram/components/picking-panel/index.js b/miniprogram/components/picking-panel/index.js index e0c23aa..3763630 100644 --- a/miniprogram/components/picking-panel/index.js +++ b/miniprogram/components/picking-panel/index.js @@ -576,6 +576,7 @@ Component({ storage_zone: b.storage_zone || '', inbound_date: b.inbound_date || '', production_date: b.production_date || '', + expiry_date: b.expiry_date || '', })); const need = resolveItemNeed(item); const serverPlan = normalizeSavedPlan(item.outbound_batches) || []; @@ -718,6 +719,7 @@ Component({ batch_no: String(b.batch_no), storage_zone: b.storage_zone || '', inbound_date: b.inbound_date || '', + expiry_date: b.expiry_date || '', available_qty: Number(b.available_qty) || 0, qty: formatBatchQty(qtyByNo.get(String(b.batch_no)) || 0), })); @@ -765,6 +767,7 @@ Component({ batch_no: String(b.batch_no), storage_zone: b.storage_zone || '', inbound_date: b.inbound_date || '', + expiry_date: b.expiry_date || '', available_qty: Number(b.available_qty) || 0, qty: formatBatchQty(qtyByNo.get(String(b.batch_no)) || 0), })); diff --git a/miniprogram/components/picking-panel/index.wxml b/miniprogram/components/picking-panel/index.wxml index d621984..458b896 100644 --- a/miniprogram/components/picking-panel/index.wxml +++ b/miniprogram/components/picking-panel/index.wxml @@ -189,7 +189,7 @@ {{item.batch_no}} - {{item.storage_zone || '未设区域'}} · 入库 {{item.inbound_date || '—'}} · 可用 {{item.available_qty}} + {{item.storage_zone || '未设区域'}} · 入库 {{item.inbound_date || '—'}} · 效期 {{item.expiry_date || '—'}} · 可用 {{item.available_qty}} 0 ${branchFilter} ORDER BY expiry_date ASC NULLS LAST, created_at ASC`, @@ -1112,6 +1112,8 @@ export async function listPickingOutboundBatches(input: { storage_zone: r.storage_zone == null ? null : String(r.storage_zone), inbound_date: toDateOnlyLocal(r.created_at), production_date: toDateOnlyLocal(r.production_date), + // 排序就用它(效期优先,NULLS LAST);展示出来才能解释"为什么先出这批" + expiry_date: toDateOnlyLocal(r.expiry_date), })); const totalAvailable = batches.reduce((s, b) => s + b.available_qty, 0); const claimable = await getClaimableStockQty(pool, skuCode, branchCode, orderCode || undefined); diff --git a/src/i18n/locales/en/picking.ts b/src/i18n/locales/en/picking.ts index 60bd923..0903b3c 100644 --- a/src/i18n/locales/en/picking.ts +++ b/src/i18n/locales/en/picking.ts @@ -41,7 +41,7 @@ export const picking: MessageDict = { 'batch.noZone': 'No zone', 'batch.shortfall': 'Insufficient stock, short by {qty}', 'batch.summary': 'Need {need}{unit} · Claimable {claimable}', - 'batch.rowMeta': '{zone} · Inbound {date} · Available {qty}', + 'batch.rowMeta': '{zone} · Inbound {date} · Expiry {expiry} · Available {qty}', 'batch.total': 'Total {total} / need {need}', 'batch.resetFifo': 'Reset to FIFO', 'batch.apply': 'Apply', diff --git a/src/i18n/locales/id/picking.ts b/src/i18n/locales/id/picking.ts index 6225c37..7165532 100644 --- a/src/i18n/locales/id/picking.ts +++ b/src/i18n/locales/id/picking.ts @@ -41,7 +41,7 @@ export const picking: MessageDict = { 'batch.noZone': 'Tanpa zona', 'batch.shortfall': 'Stok kurang, kurang {qty}', 'batch.summary': 'Butuh {need}{unit} · Dapat diklaim {claimable}', - 'batch.rowMeta': '{zone} · Masuk {date} · Tersedia {qty}', + 'batch.rowMeta': '{zone} · Masuk {date} · Kedaluwarsa {expiry} · Tersedia {qty}', 'batch.total': 'Total {total} / butuh {need}', 'batch.resetFifo': 'Atur ke FIFO', 'batch.apply': 'Terapkan', diff --git a/src/i18n/locales/zh-CN/picking.ts b/src/i18n/locales/zh-CN/picking.ts index fb773ad..3af2b33 100644 --- a/src/i18n/locales/zh-CN/picking.ts +++ b/src/i18n/locales/zh-CN/picking.ts @@ -41,7 +41,7 @@ export const picking: MessageDict = { 'batch.noZone': '未设区域', 'batch.shortfall': '库存不足,还缺 {qty}', 'batch.summary': '需 {need}{unit} · 可扣 {claimable}', - 'batch.rowMeta': '{zone} · 入库 {date} · 可用 {qty}', + 'batch.rowMeta': '{zone} · 入库 {date} · 效期 {expiry} · 可用 {qty}', 'batch.total': '合计 {total} / 需 {need}', 'batch.resetFifo': '按先进先出', 'batch.apply': '确定', diff --git a/src/pages/picking/PickingManagement.tsx b/src/pages/picking/PickingManagement.tsx index 92be563..80e9f8c 100644 --- a/src/pages/picking/PickingManagement.tsx +++ b/src/pages/picking/PickingManagement.tsx @@ -160,6 +160,7 @@ type BatchEditorRow = { batch_no: string; storage_zone: string; inbound_date: string; + expiry_date: string; available_qty: number; qty: string; }; @@ -1059,6 +1060,7 @@ function assigneeLabel(user: PickingAssignee, roleLabel: (code: string) => strin batch_no: String(b.batch_no), storage_zone: b.storage_zone || '', inbound_date: b.inbound_date || '', + expiry_date: b.expiry_date || '', available_qty: Number(b.available_qty) || 0, qty: String(qtyByNo.get(String(b.batch_no)) ?? 0), })) @@ -1078,6 +1080,7 @@ function assigneeLabel(user: PickingAssignee, roleLabel: (code: string) => strin batch_no: String(b.batch_no), storage_zone: b.storage_zone || '', inbound_date: b.inbound_date || '', + expiry_date: b.expiry_date || '', available_qty: Number(b.available_qty) || 0, qty: String(qtyByNo.get(String(b.batch_no)) ?? 0), })) @@ -2690,6 +2693,7 @@ function assigneeLabel(user: PickingAssignee, roleLabel: (code: string) => strin {t('picking.batch.rowMeta', { zone: row.storage_zone || t('picking.batch.noZone'), date: row.inbound_date || '—', + expiry: row.expiry_date || '—', qty: formatQty(row.available_qty), })} diff --git a/src/utils/workflowApi.ts b/src/utils/workflowApi.ts index 1296536..f530a33 100644 --- a/src/utils/workflowApi.ts +++ b/src/utils/workflowApi.ts @@ -1167,6 +1167,8 @@ export interface PickingOutboundBatches { storage_zone: string | null; inbound_date: string | null; production_date: string | null; + /** 效期(分拣批次的**第一排序键**:效期优先);展示出来才能解释“为何先出这批” */ + expiry_date: string | null; }>; }