| @@ -291,16 +291,20 @@ const LotLabelPrintModal: React.FC<LotLabelPrintModalProps> = ({ | |||||
| const list = (analysis.sameItemLots ?? []).filter( | const list = (analysis.sameItemLots ?? []).filter( | ||||
| (x) => Number(x.availableQty) > 0 && !!String(x.lotNo || "").trim(), | (x) => Number(x.availableQty) > 0 && !!String(x.lotNo || "").trim(), | ||||
| ); | ); | ||||
| const scannedLot = analysis.scanned?.inventoryLotLineId | |||||
| const scannedLotLineId = analysis.scanned?.inventoryLotLineId; | |||||
| const scannedRow = scannedLotLineId | |||||
| ? list.find((x) => x.inventoryLotLineId === scannedLotLineId) | |||||
| : undefined; | |||||
| const scannedLot = scannedLotLineId | |||||
| ? { | ? { | ||||
| lotNo: analysis.scanned.lotNo, | lotNo: analysis.scanned.lotNo, | ||||
| inventoryLotLineId: analysis.scanned.inventoryLotLineId, | |||||
| availableQty: (list.find( | |||||
| (x) => x.inventoryLotLineId === analysis.scanned.inventoryLotLineId, | |||||
| )?.availableQty ?? 0) as number, | |||||
| uom: (list.find( | |||||
| (x) => x.inventoryLotLineId === analysis.scanned.inventoryLotLineId, | |||||
| )?.uom ?? "") as string, | |||||
| inventoryLotLineId: scannedLotLineId, | |||||
| availableQty: (scannedRow?.availableQty ?? 0) as number, | |||||
| uom: (scannedRow?.uom ?? "") as string, | |||||
| warehouseCode: | |||||
| analysis.scanned.warehouseCode ?? scannedRow?.warehouseCode, | |||||
| warehouseName: | |||||
| analysis.scanned.warehouseName ?? scannedRow?.warehouseName, | |||||
| _scanned: true as const, | _scanned: true as const, | ||||
| } | } | ||||
| : null; | : null; | ||||
| @@ -308,7 +312,7 @@ const LotLabelPrintModal: React.FC<LotLabelPrintModalProps> = ({ | |||||
| const merged = [ | const merged = [ | ||||
| ...(scannedLot ? [scannedLot] : []), | ...(scannedLot ? [scannedLot] : []), | ||||
| ...list | ...list | ||||
| .filter((x) => x.inventoryLotLineId !== scannedLot?.inventoryLotLineId) | |||||
| .filter((x) => x.inventoryLotLineId !== scannedLotLineId) | |||||
| .map((x) => ({ ...x, _scanned: false as const })), | .map((x) => ({ ...x, _scanned: false as const })), | ||||
| ]; | ]; | ||||