merge: complete product progress after SKU entry
This commit is contained in:
commit
024be4307a
@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user