Browse Source

test

MergeProblem1
CANCERYS\kw093 1 week ago
parent
commit
c45802fb76
2 changed files with 22 additions and 32 deletions
  1. +3
    -1
      src/components/DashboardPage/DashboardPage.tsx
  2. +19
    -31
      src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx

+ 3
- 1
src/components/DashboardPage/DashboardPage.tsx View File

@@ -74,7 +74,8 @@ const DashboardPage: React.FC<Props> = ({
return ( return (
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid item xs={12}>
<Grid item xs={12}>\
{/*
<Card> <Card>
<CardHeader /> <CardHeader />
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
@@ -123,6 +124,7 @@ const DashboardPage: React.FC<Props> = ({
</TabPanel> </TabPanel>
</CardContent> </CardContent>
</Card> </Card>
*/}
</Grid> </Grid>
{/* Hidden: Progress chart - not in use currently */} {/* Hidden: Progress chart - not in use currently */}
{/* <Grid item xs={12}> {/* <Grid item xs={12}>


+ 19
- 31
src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx View File

@@ -609,54 +609,42 @@ const [isConfirmingLot, setIsConfirmingLot] = useState(false);
console.log(`⏱️ [HANDLE LOT MISMATCH START]`); console.log(`⏱️ [HANDLE LOT MISMATCH START]`);
console.log("Lot mismatch detected:", { expectedLot, scannedLot }); 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(); const fetchStartTime = performance.now();
fetchStockInLineInfo(scannedLot.stockInLineId) fetchStockInLineInfo(scannedLot.stockInLineId)
.then((stockInLineInfo) => { .then((stockInLineInfo) => {
const fetchTime = performance.now() - fetchStartTime; const fetchTime = performance.now() - fetchStartTime;
console.log(`⏱️ [HANDLE LOT MISMATCH] fetchStockInLineInfo time: ${fetchTime.toFixed(2)}ms (${(fetchTime / 1000).toFixed(3)}s)`); 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, 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; 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) => { .catch((error) => {
const fetchTime = performance.now() - fetchStartTime; const fetchTime = performance.now() - fetchStartTime;
console.error(`❌ [HANDLE LOT MISMATCH] fetchStockInLineInfo failed after ${fetchTime.toFixed(2)}ms:`, error); 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 { } 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; const totalTime = performance.now() - mismatchStartTime;
console.log(`⏱️ [HANDLE LOT MISMATCH END] Total time: ${totalTime.toFixed(2)}ms`); console.log(`⏱️ [HANDLE LOT MISMATCH END] Total time: ${totalTime.toFixed(2)}ms`);
} }


Loading…
Cancel
Save