feat(分拣批次卡): 补显效期,解释「为何先出这批」
- 背景:本系统 FIFO = **效期优先**(ORDER BY expiry_date ASC NULLS LAST, created_at ASC),不是先入库先出;界面原先不显示效期,用户无法理解排序
- 后端 listPickingOutboundBatches 增返 expiry_date
- Web 批次编辑行 + 小程序批次卡补显「效期 {expiry}」;rowMeta 三语同步
- 不改排序口径(库存冻结面);只多显示一个字段
- 验证:两端 tsc + 小程序 node --check 通过;前端全量仍基线(3 文件/4 例)
This commit is contained in:
@@ -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),
|
||||
}));
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
<view wx:for="{{editor.rows}}" wx:key="batch_id" class="batch-row">
|
||||
<view class="batch-row-info">
|
||||
<text class="batch-row-no">{{item.batch_no}}</text>
|
||||
<text class="batch-row-meta">{{item.storage_zone || '未设区域'}} · 入库 {{item.inbound_date || '—'}} · 可用 {{item.available_qty}}</text>
|
||||
<text class="batch-row-meta">{{item.storage_zone || '未设区域'}} · 入库 {{item.inbound_date || '—'}} · 效期 {{item.expiry_date || '—'}} · 可用 {{item.available_qty}}</text>
|
||||
</view>
|
||||
<input
|
||||
class="batch-input"
|
||||
|
||||
@@ -1099,7 +1099,7 @@ export async function listPickingOutboundBatches(input: {
|
||||
branchFilter = `AND branch_code = $${params.length}`;
|
||||
}
|
||||
const batchRes = await pool.query(
|
||||
`SELECT id, batch_no, available_qty, storage_zone, created_at, production_date
|
||||
`SELECT id, batch_no, available_qty, storage_zone, created_at, production_date, expiry_date
|
||||
FROM inventory
|
||||
WHERE sku_code = $1 AND 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);
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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': '确定',
|
||||
|
||||
@@ -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),
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -1167,6 +1167,8 @@ export interface PickingOutboundBatches {
|
||||
storage_zone: string | null;
|
||||
inbound_date: string | null;
|
||||
production_date: string | null;
|
||||
/** 效期(分拣批次的**第一排序键**:效期优先);展示出来才能解释“为何先出这批” */
|
||||
expiry_date: string | null;
|
||||
}>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user