fix(入库列表): 恢复需加工标记字段
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

前端徽标/筛选已存在;后端补订单行加工方式/归属与未完工加工需求单判定,返回 needs_processing/processing_method。只读展示,不改入库门槛。
This commit is contained in:
Ubuntu
2026-10-27 21:33:21 +08:00
parent 5b101a3023
commit 70149fc7c0
2 changed files with 43 additions and 1 deletions
+18 -1
View File
@@ -194,7 +194,9 @@ export async function listInspectionsForManagement(
LEFT JOIN skus sk ON sk.sku_code = i.sku_code
LEFT JOIN suppliers sup ON sup.supplier_code = i.supplier_code
LEFT JOIN LATERAL (
SELECT oi2.item_name, oi2.category_code, oi2.unit, oi2.category_name
SELECT oi2.item_name, oi2.category_code, oi2.unit, oi2.category_name,
oi2.processing_method AS line_processing_method,
oi2.processing_owner AS line_processing_owner
FROM order_items oi2
WHERE oi2.order_code = i.order_code
AND (oi2.sku_code = i.sku_code OR i.sku_code IS NULL)
@@ -308,6 +310,19 @@ export async function listInspectionsForManagement(
demand_sheet.demand_material_qty,
demand_sheet.demand_net_weight,
demand_sheet.demand_loss_qty,
-- 入库列表「需加工」:订单行是仓内加工,或该订单+商品存在未完工加工需求单。
-- 前端 InspectionManagement 已有徽标/筛选,缺的只是后端这个只读字段。
(CASE
WHEN LOWER(TRIM(COALESCE(oi.line_processing_owner, ''))) IN
('warehouse', 'warehouse_processing', '仓内加工')
AND COALESCE(NULLIF(TRIM(oi.line_processing_method), ''), '原材料') <> '原材料'
THEN TRUE
WHEN demand_sheet.demand_material_qty IS NOT NULL
OR demand_sheet.demand_net_weight IS NOT NULL
THEN TRUE
ELSE FALSE
END) AS needs_processing,
oi.line_processing_method AS processing_method,
${LAST_INBOUND_ZONE_SELECT},
${inboundPriceSql} AS inbound_unit_price
${listFromSql}
@@ -330,6 +345,8 @@ export async function listInspectionsForManagement(
demand_material_qty: row.demand_material_qty == null ? null : Number(row.demand_material_qty),
demand_net_weight: row.demand_net_weight == null ? null : Number(row.demand_net_weight),
demand_loss_qty: row.demand_loss_qty == null ? null : Number(row.demand_loss_qty),
needs_processing: row.needs_processing === true,
processing_method: row.processing_method || null,
}));
return {
@@ -0,0 +1,25 @@
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const service = readFileSync(new URL('../src/services/inspectionQueryService.ts', import.meta.url), 'utf8');
const page = readFileSync(new URL('../../src/pages/inspection/InspectionManagement.tsx', import.meta.url), 'utf8');
describe('入库列表「需加工」徽标字段', () => {
it('后端 LATERAL 取订单行加工字段并返回 needs_processing', () => {
expect(service).toContain('oi2.processing_method AS line_processing_method');
expect(service).toContain('oi2.processing_owner AS line_processing_owner');
expect(service).toContain('AS needs_processing');
expect(service).toContain('AS processing_method');
expect(service).toContain("LOWER(TRIM(COALESCE(oi.line_processing_owner, ''))) IN");
expect(service).toContain('demand_sheet.demand_material_qty IS NOT NULL');
expect(service).toContain('demand_sheet.demand_net_weight IS NOT NULL');
expect(service).toContain('needs_processing: row.needs_processing === true');
});
it('前端徽标、筛选与三语文案已存在', () => {
expect(page).toContain('needs_processing: Boolean(item.needs_processing)');
expect(page).toContain('task.needs_processing');
expect(page).toContain("t('inspection.needProcess')");
expect(page).toContain("processingFilter === 'needs'");
});
});