From 5eab59df8cb1be036c7351457594794fc1cc28fb Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Wed, 16 Sep 2026 11:40:51 +0800 Subject: [PATCH] inventory search fix --- src/app/api/settings/item/index.ts | 3 +++ src/app/api/stockAdjustment/actions.ts | 1 + src/components/InventorySearch/InventoryLotLineTable.tsx | 6 +++++- src/components/InventorySearch/InventorySearch.tsx | 6 ++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/api/settings/item/index.ts b/src/app/api/settings/item/index.ts index e85933e0..f23c1145 100644 --- a/src/app/api/settings/item/index.ts +++ b/src/app/api/settings/item/index.ts @@ -66,6 +66,9 @@ export type ItemsResult = { latestMarketUnitPrice?: number; latestMupUpdatedDate?: string; purchaseUnit?: string; + uomId?: number; + uom?: string; + uomDesc?: string; }; export type Result = { diff --git a/src/app/api/stockAdjustment/actions.ts b/src/app/api/stockAdjustment/actions.ts index c42e0c09..f7742248 100644 --- a/src/app/api/stockAdjustment/actions.ts +++ b/src/app/api/stockAdjustment/actions.ts @@ -16,6 +16,7 @@ export interface StockAdjustmentLineRequest { expiryDate: string; warehouseId: number; uom?: string | null; + uomId?: number | null; remarks?: string | null; } diff --git a/src/components/InventorySearch/InventoryLotLineTable.tsx b/src/components/InventorySearch/InventoryLotLineTable.tsx index 237112dc..c3a886a5 100644 --- a/src/components/InventorySearch/InventoryLotLineTable.tsx +++ b/src/components/InventorySearch/InventoryLotLineTable.tsx @@ -44,6 +44,7 @@ type AdjustmentEntry = InventoryLotLineResult & { isNew?: boolean; isOpeningInventory?: boolean; remarks?: string; + uomId?: number; }; @@ -61,7 +62,7 @@ interface Props { onStockAdjustmentSuccess?: () => void | Promise; } -/** FP-MTMS Version Checklist | Functions Ref. No. 3 | v1.0.8 | 2026-09-10 */ +/** FP-MTMS Version Checklist | Functions Ref. No. 3 | v1.0.9 | 2026-09-16 */ const InventoryLotLineTable: React.FC = ({ inventoryLotLines, pagingController, setPagingController, totalCount, inventory, filterLotNo, @@ -157,6 +158,7 @@ const prevAdjustmentModalOpenRef = useRef(false); adjustedQty: line.availableQty ?? 0, originalQty: line.availableQty ?? 0, remarks: '', + uomId: inventory.stockUomId ?? inventory.uomId, })); setAdjustmentEntries(initial); originalAdjustmentLinesRef.current = initial; @@ -276,6 +278,7 @@ const prevAdjustmentModalOpenRef = useRef(false); expiryDate, warehouseId: line.warehouse?.id ?? 0, uom: line.uom ?? null, + uomId: line.uomId ?? null, remarks: line.remarks?.trim() || null, }; }, []); @@ -345,6 +348,7 @@ const prevAdjustmentModalOpenRef = useRef(false); status: 'available', availableQty: addEntryForm.qty, uom: inventory.uomUdfudesc || inventory.uomShortDesc || inventory.uomCode, + uomId: inventory.stockUomId ?? inventory.uomId, qtyPerSmallestUnit: inventory.qtyPerSmallestUnit ?? 1, baseUom: inventory.baseUom || '', stockInLineId: 0, diff --git a/src/components/InventorySearch/InventorySearch.tsx b/src/components/InventorySearch/InventorySearch.tsx index 170f051e..8e908e23 100644 --- a/src/components/InventorySearch/InventorySearch.tsx +++ b/src/components/InventorySearch/InventorySearch.tsx @@ -62,6 +62,7 @@ type ItemLookupRow = { type?: string; uom?: string; uomDesc?: string; + uomId?: number; purchaseUnit?: string; }; @@ -83,7 +84,7 @@ const inventoryPageRowKey = (row: InventoryResult, byLocation: boolean) => ? `${row.itemId}-${row.uomId ?? row.stockUomId ?? row.uomUdfudesc ?? ''}` : String(row.id); -/** FP-MTMS Version Checklist | Functions Ref. No. 18 | v1.0.4 | 2026-09-10 */ +/** FP-MTMS Version Checklist | Functions Ref. No. 18 | v1.0.5 | 2026-09-16 */ const InventorySearch: React.FC = ({ inventories, printerCombo, @@ -108,10 +109,11 @@ const InventorySearch: React.FC = ({ onHoldQty: 0, unavailableQty: 0, availableQty: 0, + uomId: item.uomId != null ? Number(item.uomId) : undefined, uomCode: item.uom || uom, uomUdfudesc: uom, uomShortDesc: item.uom || uom, - stockUomId: undefined, + stockUomId: item.uomId != null ? Number(item.uomId) : undefined, qtyPerSmallestUnit: 1, baseUom: uom, price: 0,