From c45802fb767c69eec8bfc4613d79fc71a6a19443 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Mon, 26 Jan 2026 20:32:55 +0800 Subject: [PATCH] test --- .../DashboardPage/DashboardPage.tsx | 4 +- .../GoodPickExecutiondetail.tsx | 50 +++++++------------ 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/components/DashboardPage/DashboardPage.tsx b/src/components/DashboardPage/DashboardPage.tsx index c14faf2..f43d035 100644 --- a/src/components/DashboardPage/DashboardPage.tsx +++ b/src/components/DashboardPage/DashboardPage.tsx @@ -74,7 +74,8 @@ const DashboardPage: React.FC = ({ return ( - + \ + {/* @@ -123,6 +124,7 @@ const DashboardPage: React.FC = ({ + */} {/* Hidden: Progress chart - not in use currently */} {/* diff --git a/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx b/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx index 3dab329..5403780 100644 --- a/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx +++ b/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx @@ -609,54 +609,42 @@ const [isConfirmingLot, setIsConfirmingLot] = useState(false); console.log(`⏱️ [HANDLE LOT MISMATCH START]`); console.log("Lot mismatch detected:", { expectedLot, scannedLot }); - // Check if we need to fetch scanned lot info - const needsFetch = !scannedLot.lotNo && scannedLot.stockInLineId; + // ✅ Open modal immediately - we already have stockInLineId and itemId for matching + const updateStartTime = performance.now(); + setExpectedLotData(expectedLot); + setScannedLotData({ + ...scannedLot, + lotNo: scannedLot.lotNo || null, // Will be fetched in background if null + }); + setLotConfirmationOpen(true); // ✅ Open modal immediately + const updateTime = performance.now() - updateStartTime; + console.log(`⏱️ [HANDLE LOT MISMATCH] Modal opened immediately: ${updateTime.toFixed(2)}ms`); - if (needsFetch) { - console.log(`⏱️ [HANDLE LOT MISMATCH] Need to fetch lot info for stockInLineId: ${scannedLot.stockInLineId}`); + // ✅ Fetch lotNo in background ONLY for display purposes (matching is already done by stockInLineId + itemId) + if (!scannedLot.lotNo && scannedLot.stockInLineId) { + console.log(`⏱️ [HANDLE LOT MISMATCH] Fetching lotNo in background for display (stockInLineId: ${scannedLot.stockInLineId})`); const fetchStartTime = performance.now(); fetchStockInLineInfo(scannedLot.stockInLineId) .then((stockInLineInfo) => { const fetchTime = performance.now() - fetchStartTime; console.log(`⏱️ [HANDLE LOT MISMATCH] fetchStockInLineInfo time: ${fetchTime.toFixed(2)}ms (${(fetchTime / 1000).toFixed(3)}s)`); - console.log("Stock in line info:", stockInLineInfo); - const updateStartTime = performance.now(); - setExpectedLotData(expectedLot); - setScannedLotData({ - ...scannedLot, + // ✅ Update the modal with fetched lotNo (modal is already open) + setScannedLotData((prev: any) => ({ + ...prev, lotNo: stockInLineInfo.lotNo || null, - }); - setLotConfirmationOpen(true); - const updateTime = performance.now() - updateStartTime; - console.log(`⏱️ [HANDLE LOT MISMATCH] State update time: ${updateTime.toFixed(2)}ms`); + })); const totalTime = performance.now() - mismatchStartTime; - console.log(`⏱️ [HANDLE LOT MISMATCH END] Total time: ${totalTime.toFixed(2)}ms (${(totalTime / 1000).toFixed(3)}s)`); - console.log(`📊 Breakdown: fetch=${fetchTime.toFixed(2)}ms, update=${updateTime.toFixed(2)}ms`); + console.log(`⏱️ [HANDLE LOT MISMATCH] Background fetch completed: ${totalTime.toFixed(2)}ms`); }) .catch((error) => { const fetchTime = performance.now() - fetchStartTime; console.error(`❌ [HANDLE LOT MISMATCH] fetchStockInLineInfo failed after ${fetchTime.toFixed(2)}ms:`, error); - - // Still open modal with partial data - setExpectedLotData(expectedLot); - setScannedLotData(scannedLot); - setLotConfirmationOpen(true); - - const totalTime = performance.now() - mismatchStartTime; - console.log(`⏱️ [HANDLE LOT MISMATCH END] Total time (with error): ${totalTime.toFixed(2)}ms`); + // Modal stays open, lotNo will show as "Loading..." or "Unknown" }); } else { - // No fetch needed, open modal immediately - const updateStartTime = performance.now(); - setExpectedLotData(expectedLot); - setScannedLotData(scannedLot); - setLotConfirmationOpen(true); - const updateTime = performance.now() - updateStartTime; - console.log(`⏱️ [HANDLE LOT MISMATCH] State update time (no fetch): ${updateTime.toFixed(2)}ms`); - const totalTime = performance.now() - mismatchStartTime; console.log(`⏱️ [HANDLE LOT MISMATCH END] Total time: ${totalTime.toFixed(2)}ms`); }