From a863754ae652a0b49fc387f802a5656d8255ecdf Mon Sep 17 00:00:00 2001 From: WuYongJie Date: Wed, 5 Aug 2026 12:51:57 +0800 Subject: [PATCH] fix(product-progress): complete historical entered SPUs --- .../productProgressRows.test.ts | 49 +++++++++++++++++++ .../progress-dashboard/productProgressRows.ts | 9 ++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.test.ts b/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.test.ts index 7a10210d..a34e59c2 100644 --- a/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.test.ts +++ b/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.test.ts @@ -117,4 +117,53 @@ describe("product progress rows", () => { "2026-08-05T10:00:00.000Z", ); }); + + it("marks historical draft SPUs completed after every current SKU enters Jushuitan", () => { + const row = buildNonIntegratedProgressRow( + createProduct({ + projectStatus: "draft", + skuItems: [ + { id: "sku-first", barcode: "BARCODE-FIRST" }, + { id: "sku-last", barcode: "BARCODE-LAST" }, + ], + pricingRows: [ + { + skuId: "sku-first", + costPrice: "100", + productTag: "普通", + systemEnteredAt: "2026-08-04T09:00:00.000Z", + }, + { + skuId: "sku-last", + costPrice: "120", + productTag: "普通", + systemEnteredAt: "2026-08-05T10:00:00.000Z", + }, + ], + }), + ); + + expect(row.statusKey).toBe("done"); + expect(row.statusLabel).toBe("已完成"); + expect(row.endTime).toBe("2026-08-05T10:00:00.000Z"); + }); + + it("keeps rejected SPUs scrapped after every current SKU enters Jushuitan", () => { + const row = buildNonIntegratedProgressRow( + createProduct({ + projectStatus: "rejected", + skuItems: [{ id: "sku-entered", barcode: "BARCODE-ENTERED" }], + pricingRows: [ + { + skuId: "sku-entered", + costPrice: "100", + productTag: "普通", + systemEnteredAt: "2026-08-05T10:00:00.000Z", + }, + ], + }), + ); + + expect(row.statusKey).toBe("scrapped"); + }); }); diff --git a/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.ts b/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.ts index 59ed435a..b7935629 100644 --- a/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.ts +++ b/furniture-3d-system/src/app/intake/product-development/progress-dashboard/productProgressRows.ts @@ -167,12 +167,15 @@ function getNonIntegratedProgressStatus( >, ): ProductProgressStatus { if (product.projectStatus === "rejected") return "scrapped"; + + if (isNonIntegratedFlowCompleted(product, documentWorkspaceCountByCategory)) { + return "done"; + } + if (product.projectStatus === "revision") return "returned"; if (product.projectStatus === "draft") return "pending"; - return isNonIntegratedFlowCompleted(product, documentWorkspaceCountByCategory) - ? "done" - : "running"; + return "running"; } export function getProgressRowStatusDisplay(statusKey: ProductProgressStatus) {