@@ -194,9 +194,7 @@ 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,
|
||||
oi2.processing_method AS line_processing_method,
|
||||
oi2.processing_owner AS line_processing_owner
|
||||
SELECT oi2.item_name, oi2.category_code, oi2.unit, oi2.category_name
|
||||
FROM order_items oi2
|
||||
WHERE oi2.order_code = i.order_code
|
||||
AND (oi2.sku_code = i.sku_code OR i.sku_code IS NULL)
|
||||
@@ -310,19 +308,6 @@ 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}
|
||||
@@ -345,8 +330,6 @@ 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 {
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
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'");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user