| @@ -31,7 +31,8 @@ import { | |||||
| updateSecondQrScanStatus, | updateSecondQrScanStatus, | ||||
| submitSecondScanQuantity, | submitSecondScanQuantity, | ||||
| recordSecondScanIssue, | recordSecondScanIssue, | ||||
| unAssignJobOrderPickOrder | |||||
| unAssignJobOrderPickOrder, | |||||
| fetchJobOrderLotsHierarchicalByPickOrderId | |||||
| } from "@/app/api/jo/actions"; | } from "@/app/api/jo/actions"; | ||||
| import { fetchNameList, NameList } from "@/app/api/user/actions"; | import { fetchNameList, NameList } from "@/app/api/user/actions"; | ||||
| import { | import { | ||||
| @@ -413,7 +414,7 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBack }) => { | |||||
| console.log(" fetchJobOrderData called with userId:", userIdToUse); | console.log(" fetchJobOrderData called with userId:", userIdToUse); | ||||
| if (!userIdToUse) { | if (!userIdToUse) { | ||||
| console.warn("⚠️ No userId available, skipping API call"); | |||||
| console.warn("No userId available, skipping API call"); | |||||
| setJobOrderData(null); | setJobOrderData(null); | ||||
| setCombinedLotData([]); | setCombinedLotData([]); | ||||
| setOriginalCombinedData([]); | setOriginalCombinedData([]); | ||||
| @@ -598,6 +599,7 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBack }) => { | |||||
| lot.itemId, | lot.itemId, | ||||
| { | { | ||||
| qty: submitQty, | qty: submitQty, | ||||
| userId: currentUserId !!, | |||||
| isMissing: false, | isMissing: false, | ||||
| isBad: false, | isBad: false, | ||||
| reason: undefined | reason: undefined | ||||
| @@ -609,7 +611,7 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBack }) => { | |||||
| const results = await Promise.all(submitPromises); | const results = await Promise.all(submitPromises); | ||||
| const successCount = results.filter(r => r.success).length; | const successCount = results.filter(r => r.success).length; | ||||
| console.log(` Batch submit completed: ${successCount}/${scannedLots.length} items submitted`); | console.log(` Batch submit completed: ${successCount}/${scannedLots.length} items submitted`); | ||||
| await fetchJobOrderData(); | await fetchJobOrderData(); | ||||
| @@ -692,10 +694,11 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBack }) => { | |||||
| const result = await updateSecondQrScanStatus( | const result = await updateSecondQrScanStatus( | ||||
| matchingLot.pickOrderId, | matchingLot.pickOrderId, | ||||
| matchingLot.itemId, | matchingLot.itemId, | ||||
| currentUserId || 0, | |||||
| currentUserId !!, | |||||
| matchingLot.requiredQty || 1 | matchingLot.requiredQty || 1 | ||||
| ); | ); | ||||
| console.log("result", result); | |||||
| console.log("currentUserId", currentUserId); | |||||
| if (result.code === "SUCCESS") { | if (result.code === "SUCCESS") { | ||||
| successCount++; | successCount++; | ||||
| setProcessedQrCodes(prev => new Set(prev).add(itemKey)); | setProcessedQrCodes(prev => new Set(prev).add(itemKey)); | ||||
| @@ -1305,7 +1308,7 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBack }) => { | |||||
| const submitQty = lot.requiredQty || lot.pickOrderLineRequiredQty; | const submitQty = lot.requiredQty || lot.pickOrderLineRequiredQty; | ||||
| handlePickQtyChange(lotKey, submitQty); | handlePickQtyChange(lotKey, submitQty); | ||||
| handleSubmitPickQtyWithQty(lot, submitQty); | handleSubmitPickQtyWithQty(lot, submitQty); | ||||
| updateSecondQrScanStatus(lot.pickOrderLineId, lot.lotId, currentUserId || 0, submitQty); | |||||
| updateSecondQrScanStatus(lot.pickOrderId, lot.itemId, currentUserId || 0, submitQty); | |||||
| }} | }} | ||||
| disabled={ | disabled={ | ||||
| //lot.matchStatus !== 'scanned' || | //lot.matchStatus !== 'scanned' || | ||||