|
|
|
@@ -150,6 +150,20 @@ function hasPendingActiveRowForStockInLine( |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/** Any pending active SOL for this item (e.g. scan different location, same lot no → auto-switch). */ |
|
|
|
function hasPendingActiveRowForItem( |
|
|
|
indexes: { activeLotsByItemId: Map<number, any[]> }, |
|
|
|
itemId: number, |
|
|
|
processedByItemId: ProcessedStockOutLinesByItemId, |
|
|
|
): boolean { |
|
|
|
const activeLots = indexes.activeLotsByItemId.get(itemId) ?? []; |
|
|
|
return activeLots.some( |
|
|
|
(lot) => |
|
|
|
isLotRowPending(lot) && |
|
|
|
!isStockOutLineAlreadyProcessed(processedByItemId, itemId, lot.stockOutLineId), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
function findExactActiveMatchForStockInLine( |
|
|
|
stockInLineLots: any[], |
|
|
|
scannedItemId: number, |
|
|
|
@@ -1560,14 +1574,18 @@ const fetchAllCombinedLotData = useCallback(async (userId?: number, pickOrderIdO |
|
|
|
const scannedItemId = qrData.itemId; |
|
|
|
const scannedStockInLineId = qrData.stockInLineId; |
|
|
|
|
|
|
|
if ( |
|
|
|
!hasPendingActiveRowForStockInLine( |
|
|
|
indexes, |
|
|
|
scannedItemId, |
|
|
|
scannedStockInLineId, |
|
|
|
processedQrCombinations, |
|
|
|
) |
|
|
|
) { |
|
|
|
const hasPendingOnScannedSil = hasPendingActiveRowForStockInLine( |
|
|
|
indexes, |
|
|
|
scannedItemId, |
|
|
|
scannedStockInLineId, |
|
|
|
processedQrCombinations, |
|
|
|
); |
|
|
|
const hasPendingOnItem = hasPendingActiveRowForItem( |
|
|
|
indexes, |
|
|
|
scannedItemId, |
|
|
|
processedQrCombinations, |
|
|
|
); |
|
|
|
if (!hasPendingOnScannedSil && !hasPendingOnItem) { |
|
|
|
console.log( |
|
|
|
` [SKIP] No pending stock-out line left for itemId=${scannedItemId}, stockInLineId=${scannedStockInLineId}`, |
|
|
|
); |
|
|
|
|