feat(库存报告): 手动匹配批次展示入库时间(替代生产日期),仍按入库时间倒序
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s

This commit is contained in:
Ubuntu
2026-10-20 22:08:28 +08:00
parent 004cc7f337
commit dee4ee2e3c
3 changed files with 11 additions and 2 deletions
@@ -138,6 +138,7 @@ export interface BatchReportCandidate {
sku_name: string | null;
batch_no: string | null;
production_date: string | null;
inbound_at?: string | null;
available_qty: number | null;
unit: string | null;
spec: string | null;
@@ -159,6 +160,7 @@ export interface BatchReportConfirmedMatch {
product_name: string | null;
batch_no: string | null;
production_date: string | null;
inbound_at?: string | null;
match_source: 'auto' | 'manual';
confirmed_at: string | null;
}
@@ -186,6 +188,7 @@ type CandidateRow = {
sku_name: string | null;
batch_no: string | null;
production_date: string | null;
inbound_at?: string | null;
available_qty: number | null;
unit: string | null;
spec: string | null;
@@ -206,6 +209,7 @@ async function loadCandidateRows(
}
const result = await pool.query(
`SELECT i.id AS inventory_id, i.sku_code, i.batch_no, i.production_date,
to_char(i.created_at, 'YYYY-MM-DD') AS inbound_at,
i.available_qty, i.storage_zone,
COALESCE(i.origin, '') AS batch_origin,
s.sku_name, s.unit, s.spec, s.origin AS sku_origin
@@ -223,6 +227,8 @@ async function loadCandidateRows(
sku_name: row.sku_name == null ? null : String(row.sku_name),
batch_no: row.batch_no == null ? null : String(row.batch_no),
production_date: toDateOnly(row.production_date),
/** 入库时间(2026-10-20 开发者:列表展示入库时间,不再展示生产日期) */
inbound_at: row.inbound_at == null ? null : String(row.inbound_at),
available_qty: row.available_qty == null ? null : Number(row.available_qty),
unit: row.unit == null ? null : String(row.unit),
spec: row.spec == null ? null : String(row.spec),
@@ -286,6 +286,7 @@ type ManualPickRow = {
sku_code?: string;
sku_name?: string;
production_date?: string;
inbound_at?: string | null;
available_qty?: number;
unit?: string;
storage_zone?: string;
@@ -374,7 +375,7 @@ const ManualBatchPicker: React.FC<{
{t('inventory.batchReport.candidateBatch')}: {r.batch_no || '—'}
</span>
<span className="app-foreground-muted">
{r.production_date ? String(r.production_date).slice(0, 10) : '—'}
{r.inbound_at || (r.production_date ? String(r.production_date).slice(0, 10) : '—')}
</span>
<span className="app-foreground-muted">
{r.available_qty ?? '—'} {r.unit || ''}
@@ -474,7 +475,7 @@ const ReportCard: React.FC<{
{t('inventory.batchReport.candidateBatch')}: {c.batch_no || '—'}
</span>
<span className="app-foreground-muted">
{c.production_date || '—'}
{c.inbound_at || c.production_date || '—'}
</span>
<span className="app-foreground-muted">
{c.available_qty ?? '—'} {c.unit || ''}
+2
View File
@@ -3930,6 +3930,8 @@ export interface InventoryBatchReportCandidate {
sku_name: string | null;
batch_no: string | null;
production_date: string | null;
/** 入库时间(列表展示用;2026-10-20 起展示入库时间而非生产日期) */
inbound_at?: string | null;
available_qty: number | null;
unit: string | null;
spec: string | null;