diff --git a/furniture-3d-system/src/app/intake/non-integrated/workspaces/ProductPricingWorkspace.test.tsx b/furniture-3d-system/src/app/intake/non-integrated/workspaces/ProductPricingWorkspace.test.tsx index afc2f9e7..58726e8a 100644 --- a/furniture-3d-system/src/app/intake/non-integrated/workspaces/ProductPricingWorkspace.test.tsx +++ b/furniture-3d-system/src/app/intake/non-integrated/workspaces/ProductPricingWorkspace.test.tsx @@ -42,16 +42,16 @@ describe("ProductPricingWorkspace", () => { { source: "draft_group_modular_sku" }, { source: "draft_group", skuCode: "MKH-001", componentDetails: [{ code: "CHILD-001", name: "子商品", quantity: "1", role: "", assetType: "" }] }, ])("does not flag combination-only rows as missing inventory: %j", (overrides) => { - const row = createPricingRow({ ...overrides, jstVirtualInventoryStatus: undefined, jstVirtualInventoryError: "" }); + const row = createPricingRow({ ...overrides, jstVirtualInventoryStatus: undefined, jstVirtualInventoryError: "", fixedVirtualInventoryStatus: undefined }); render(); expect(screen.getByText("仓库无需库存")).toHaveAttribute("title", "组合商品不单独推送库存,库存由子商品承担"); expect(screen.queryByText("仓库库存无记录")).not.toBeInTheDocument(); }); it("flags a system-entered normal SKU without a warehouse inventory record", () => { - render(); + render(); expect(screen.getByText("仓库库存无记录")).toBeInTheDocument(); - expect(screen.getByText("简尚库存已推")).toBeInTheDocument(); + expect(screen.queryByLabelText("简尚固定虚拟库存")).not.toBeInTheDocument(); }); it("locks only the cost controls of system-entered SKU rows", () => { @@ -109,7 +109,7 @@ describe("ProductPricingWorkspace", () => { expect(onUpdateRow).toHaveBeenCalledWith("sku-2", "costPrice", "67"); }); - it("shows warehouse failure and fixed inventory success independently", () => { + it("shows only fixed inventory success when warehouse inventory failed", () => { const row = createPricingRow(); render( @@ -133,10 +133,10 @@ describe("ProductPricingWorkspace", () => { "title", "固定虚拟库存已于 2026-08-10T09:00:01.000Z 推送", ); - expect(screen.getByText("仓库库存失败")).toHaveAttribute("title", "聚水潭未找到对应仓库"); + expect(screen.queryByLabelText("仓库虚拟库存")).not.toBeInTheDocument(); }); - it("shows a fixed virtual inventory configuration failure as skipped", () => { + it("hides the fixed configuration failure when warehouse inventory succeeded", () => { const row = createPricingRow({ jstVirtualInventoryStatus: "pushed", jstVirtualInventoryError: "", @@ -162,21 +162,30 @@ describe("ProductPricingWorkspace", () => { />, ); - expect(screen.getByText("简尚库存已跳过")).toHaveAttribute( - "title", - "code=100,未开通了分仓虚拟库存!", - ); - expect(screen.queryByText("库存重试中")).not.toBeInTheDocument(); - expect(screen.queryByText("库存已推")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("简尚固定虚拟库存")).not.toBeInTheDocument(); + expect(screen.queryByTitle("code=100,未开通了分仓虚拟库存!")).not.toBeInTheDocument(); expect(screen.getByText("仓库库存已推")).toBeInTheDocument(); }); + it("shows one warehouse success when both inventory channels succeeded", () => { + render(); + expect(screen.getByText("仓库库存已推")).toBeInTheDocument(); + expect(screen.queryByLabelText("简尚固定虚拟库存")).not.toBeInTheDocument(); + }); + + it("keeps the configuration reason visible when neither channel succeeded", () => { + render(); + expect(screen.getByText("仓库库存失败")).toBeInTheDocument(); + expect(screen.getByText("简尚库存已跳过")).toHaveAttribute("title", "code=100,未开通了分仓虚拟库存!"); + }); + it("shows an uncertain upstream result before fixed inventory status without exposing actions to read-only users", () => { const row = { ...createPricingRow(), jstVirtualInventoryStatus: "pending" as const, jstVirtualInventoryError: JST_VIRTUAL_INVENTORY_IN_FLIGHT_ERROR, jstVirtualInventorySoId: "VIRTUAL-001", + fixedVirtualInventoryStatus: "pending" as const, }; render( diff --git a/furniture-3d-system/src/app/intake/non-integrated/workspaces/product-pricing/ProductPricingInventoryStatuses.tsx b/furniture-3d-system/src/app/intake/non-integrated/workspaces/product-pricing/ProductPricingInventoryStatuses.tsx index 231e1bcc..a5774b70 100644 --- a/furniture-3d-system/src/app/intake/non-integrated/workspaces/product-pricing/ProductPricingInventoryStatuses.tsx +++ b/furniture-3d-system/src/app/intake/non-integrated/workspaces/product-pricing/ProductPricingInventoryStatuses.tsx @@ -64,10 +64,17 @@ function fixedStatus(row: ProductPricingDisplayRow) { } export function ProductPricingInventoryStatuses({ row }: { row: ProductPricingDisplayRow }) { + const warehouse = { key: 'warehouse', name: '仓库虚拟库存', meta: warehouseStatus(row) } + const fixed = { key: 'fixed', name: '简尚固定虚拟库存', meta: fixedStatus(row) } + const statuses = row.jstVirtualInventoryStatus === 'pushed' + ? [warehouse] + : row.fixedVirtualInventoryStatus === 'pushed' + ? [fixed] + : [warehouse, fixed] + return (
- {[{ key: 'warehouse', name: '仓库虚拟库存', meta: warehouseStatus(row) }, - { key: 'fixed', name: '简尚固定虚拟库存', meta: fixedStatus(row) }].map(({ key, name, meta }) => meta ? ( + {statuses.map(({ key, name, meta }) => meta ? ( {meta.label}