|
|
|
@@ -1686,6 +1686,11 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBackToList }) => { |
|
|
|
|
|
|
|
if (completionResponse.code === "SUCCESS") { |
|
|
|
console.log(` Pick order ${lot.pickOrderConsoCode} completed successfully!`); |
|
|
|
setTimeout(() => { |
|
|
|
if (onBackToList) { |
|
|
|
onBackToList(); |
|
|
|
} |
|
|
|
}, 1500); |
|
|
|
} else if (completionResponse.message === "not completed") { |
|
|
|
console.log(`⏳ Pick order not completed yet, more lines remaining`); |
|
|
|
} else { |
|
|
|
@@ -1756,6 +1761,11 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBackToList }) => { |
|
|
|
|
|
|
|
if (completionResponse.code === "SUCCESS") { |
|
|
|
console.log(` Pick order ${lot.pickOrderConsoCode} completed successfully!`); |
|
|
|
setTimeout(() => { |
|
|
|
if (onBackToList) { |
|
|
|
onBackToList(); |
|
|
|
} |
|
|
|
}, 1500); |
|
|
|
} else if (completionResponse.message === "not completed") { |
|
|
|
console.log(`⏳ Pick order not completed yet, more lines remaining`); |
|
|
|
} else { |
|
|
|
@@ -2229,10 +2239,10 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBackToList }) => { |
|
|
|
<TableRow |
|
|
|
key={`${lot.pickOrderLineId}-${lot.lotId}`} |
|
|
|
sx={{ |
|
|
|
backgroundColor: lot.lotAvailability === 'rejected' ? 'grey.100' : 'inherit', |
|
|
|
opacity: lot.lotAvailability === 'rejected' ? 0.6 : 1, |
|
|
|
// backgroundColor: lot.lotAvailability === 'rejected' ? 'grey.100' : 'inherit', |
|
|
|
//opacity: lot.lotAvailability === 'rejected' ? 0.6 : 1, |
|
|
|
'& .MuiTableCell-root': { |
|
|
|
color: lot.lotAvailability === 'rejected' ? 'text.disabled' : 'inherit' |
|
|
|
// color: lot.lotAvailability === 'rejected' ? 'text.disabled' : 'inherit' |
|
|
|
} |
|
|
|
}} |
|
|
|
> |
|
|
|
@@ -2253,8 +2263,8 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBackToList }) => { |
|
|
|
<Box> |
|
|
|
<Typography |
|
|
|
sx={{ |
|
|
|
color: lot.lotAvailability === 'rejected' ? 'text.disabled' : 'inherit', |
|
|
|
opacity: lot.lotAvailability === 'rejected' ? 0.6 : 1 |
|
|
|
// color: lot.lotAvailability === 'rejected' ? 'text.disabled' : 'inherit', |
|
|
|
//opacity: lot.lotAvailability === 'rejected' ? 0.6 : 1 |
|
|
|
}} |
|
|
|
> |
|
|
|
{lot.lotNo} |
|
|
|
@@ -2269,98 +2279,141 @@ const JobPickExecution: React.FC<Props> = ({ filterArgs, onBackToList }) => { |
|
|
|
</TableCell> |
|
|
|
|
|
|
|
<TableCell align="center"> |
|
|
|
{lot.stockOutLineStatus?.toLowerCase() !== 'pending' ? ( |
|
|
|
<Box sx={{ |
|
|
|
display: 'flex', |
|
|
|
justifyContent: 'center', |
|
|
|
alignItems: 'center', |
|
|
|
width: '100%', |
|
|
|
height: '100%' |
|
|
|
}}> |
|
|
|
<Checkbox |
|
|
|
checked={lot.stockOutLineStatus?.toLowerCase() !== 'pending'} |
|
|
|
disabled={true} |
|
|
|
readOnly={true} |
|
|
|
size="large" |
|
|
|
sx={{ |
|
|
|
color: lot.stockOutLineStatus?.toLowerCase() !== 'pending' ? 'success.main' : 'grey.400', |
|
|
|
'&.Mui-checked': { |
|
|
|
color: 'success.main', |
|
|
|
}, |
|
|
|
transform: 'scale(1.3)', |
|
|
|
'& .MuiSvgIcon-root': { |
|
|
|
fontSize: '1.5rem', |
|
|
|
} |
|
|
|
}} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
) : null} |
|
|
|
</TableCell> |
|
|
|
|
|
|
|
<TableCell align="center"> |
|
|
|
<Box sx={{ display: 'flex', justifyContent: 'center' }}> |
|
|
|
<Stack direction="row" spacing={1} alignItems="center"> |
|
|
|
<Button |
|
|
|
variant="contained" |
|
|
|
onClick={() => { |
|
|
|
const lotKey = `${lot.pickOrderLineId}-${lot.lotId}`; |
|
|
|
const submitQty = lot.requiredQty || lot.pickOrderLineRequiredQty; |
|
|
|
// Submit with default lot required pick qty |
|
|
|
|
|
|
|
handlePickQtyChange(lotKey, submitQty); |
|
|
|
handleSubmitPickQtyWithQty(lot, submitQty); |
|
|
|
updateHandledBy(lot.pickOrderId, lot.itemId); |
|
|
|
}} |
|
|
|
disabled={ |
|
|
|
(lot.lotAvailability === 'expired' || |
|
|
|
lot.lotAvailability === 'status_unavailable' || |
|
|
|
lot.lotAvailability === 'rejected') || |
|
|
|
lot.stockOutLineStatus === 'completed' || |
|
|
|
lot.stockOutLineStatus === 'pending' // Disable when QR scan not passed |
|
|
|
} |
|
|
|
sx={{ |
|
|
|
fontSize: '0.75rem', |
|
|
|
py: 0.5, |
|
|
|
minHeight: '28px', |
|
|
|
minWidth: '70px' |
|
|
|
}} |
|
|
|
> |
|
|
|
{t("Submit")} |
|
|
|
</Button> |
|
|
|
|
|
|
|
<Button |
|
|
|
variant="outlined" |
|
|
|
size="small" |
|
|
|
onClick={() => handlePickExecutionForm(lot)} |
|
|
|
disabled={ |
|
|
|
// ✅ align with GoodPickExecutiondetail: Edit only disabled when completed |
|
|
|
lot.stockOutLineStatus === 'completed' |
|
|
|
} |
|
|
|
sx={{ |
|
|
|
fontSize: '0.7rem', |
|
|
|
py: 0.5, |
|
|
|
minHeight: '28px', |
|
|
|
minWidth: '60px', |
|
|
|
borderColor: 'warning.main', |
|
|
|
color: 'warning.main' |
|
|
|
}} |
|
|
|
title="Report missing or bad items" |
|
|
|
> |
|
|
|
{t("Edit")} |
|
|
|
</Button> |
|
|
|
<Button |
|
|
|
variant="outlined" |
|
|
|
size="small" |
|
|
|
// ✅ align with GoodPickExecutiondetail: Just Complete submits requiredQty (not 0) |
|
|
|
onClick={() => handleSubmitPickQtyWithQty(lot, lot.requiredQty || lot.pickOrderLineRequiredQty || 0)} |
|
|
|
disabled={lot.stockOutLineStatus === 'completed'} |
|
|
|
sx={{ fontSize: '0.7rem', py: 0.5, minHeight: '28px', minWidth: '90px' }} |
|
|
|
> |
|
|
|
{t("Just Complete")} |
|
|
|
</Button> |
|
|
|
</Stack> |
|
|
|
</Box> |
|
|
|
</TableCell> |
|
|
|
{(() => { |
|
|
|
const status = lot.stockOutLineStatus?.toLowerCase(); |
|
|
|
const isRejected = status === 'rejected' || lot.lotAvailability === 'rejected'; |
|
|
|
const isNoLot = !lot.lotNo; |
|
|
|
|
|
|
|
// ✅ rejected lot:显示红色勾选(已扫描但被拒绝) |
|
|
|
if (isRejected && !isNoLot) { |
|
|
|
return ( |
|
|
|
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}> |
|
|
|
<Checkbox |
|
|
|
checked={true} |
|
|
|
disabled={true} |
|
|
|
readOnly={true} |
|
|
|
size="large" |
|
|
|
sx={{ |
|
|
|
color: 'error.main', |
|
|
|
'&.Mui-checked': { color: 'error.main' }, |
|
|
|
transform: 'scale(1.3)', |
|
|
|
}} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// ✅ 正常 lot:已扫描(checked/partially_completed/completed) |
|
|
|
if (!isNoLot && status !== 'pending' && status !== 'rejected') { |
|
|
|
return ( |
|
|
|
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}> |
|
|
|
<Checkbox |
|
|
|
checked={true} |
|
|
|
disabled={true} |
|
|
|
readOnly={true} |
|
|
|
size="large" |
|
|
|
sx={{ |
|
|
|
color: 'success.main', |
|
|
|
'&.Mui-checked': { color: 'success.main' }, |
|
|
|
transform: 'scale(1.3)', |
|
|
|
}} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
})()} |
|
|
|
</TableCell> |
|
|
|
|
|
|
|
<TableCell align="center"> |
|
|
|
<Box sx={{ display: 'flex', justifyContent: 'center' }}> |
|
|
|
{(() => { |
|
|
|
const status = lot.stockOutLineStatus?.toLowerCase(); |
|
|
|
const isRejected = status === 'rejected' || lot.lotAvailability === 'rejected'; |
|
|
|
const isNoLot = !lot.lotNo; |
|
|
|
|
|
|
|
// ✅ rejected lot:显示提示文本(换行显示) |
|
|
|
if (isRejected && !isNoLot) { |
|
|
|
return ( |
|
|
|
<Typography |
|
|
|
variant="body2" |
|
|
|
color="error.main" |
|
|
|
sx={{ |
|
|
|
textAlign: 'center', |
|
|
|
whiteSpace: 'normal', |
|
|
|
wordBreak: 'break-word', |
|
|
|
maxWidth: '200px', |
|
|
|
lineHeight: 1.5 |
|
|
|
}} |
|
|
|
> |
|
|
|
{t("This lot is rejected, please scan another lot.")} |
|
|
|
</Typography> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 正常 lot:显示按钮 |
|
|
|
return ( |
|
|
|
<Stack direction="row" spacing={1} alignItems="center"> |
|
|
|
<Button |
|
|
|
variant="contained" |
|
|
|
onClick={() => { |
|
|
|
const lotKey = `${lot.pickOrderLineId}-${lot.lotId}`; |
|
|
|
const submitQty = lot.requiredQty || lot.pickOrderLineRequiredQty; |
|
|
|
handlePickQtyChange(lotKey, submitQty); |
|
|
|
handleSubmitPickQtyWithQty(lot, submitQty); |
|
|
|
updateHandledBy(lot.pickOrderId, lot.itemId); |
|
|
|
}} |
|
|
|
disabled={ |
|
|
|
(lot.lotAvailability === 'expired' || |
|
|
|
lot.lotAvailability === 'status_unavailable' || |
|
|
|
lot.lotAvailability === 'rejected') || |
|
|
|
lot.stockOutLineStatus === 'completed' || |
|
|
|
lot.stockOutLineStatus === 'pending' |
|
|
|
} |
|
|
|
sx={{ |
|
|
|
fontSize: '0.75rem', |
|
|
|
py: 0.5, |
|
|
|
minHeight: '28px', |
|
|
|
minWidth: '70px' |
|
|
|
}} |
|
|
|
> |
|
|
|
{t("Submit")} |
|
|
|
</Button> |
|
|
|
|
|
|
|
<Button |
|
|
|
variant="outlined" |
|
|
|
size="small" |
|
|
|
onClick={() => handlePickExecutionForm(lot)} |
|
|
|
disabled={ |
|
|
|
lot.stockOutLineStatus === 'completed' |
|
|
|
} |
|
|
|
sx={{ |
|
|
|
fontSize: '0.7rem', |
|
|
|
py: 0.5, |
|
|
|
minHeight: '28px', |
|
|
|
minWidth: '60px', |
|
|
|
borderColor: 'warning.main', |
|
|
|
color: 'warning.main' |
|
|
|
}} |
|
|
|
title="Report missing or bad items" |
|
|
|
> |
|
|
|
{t("Edit")} |
|
|
|
</Button> |
|
|
|
<Button |
|
|
|
variant="outlined" |
|
|
|
size="small" |
|
|
|
onClick={() => handleSubmitPickQtyWithQty(lot, lot.requiredQty || lot.pickOrderLineRequiredQty || 0)} |
|
|
|
disabled={lot.stockOutLineStatus === 'completed'} |
|
|
|
sx={{ fontSize: '0.7rem', py: 0.5, minHeight: '28px', minWidth: '90px' }} |
|
|
|
> |
|
|
|
{t("Just Complete")} |
|
|
|
</Button> |
|
|
|
</Stack> |
|
|
|
); |
|
|
|
})()} |
|
|
|
</Box> |
|
|
|
</TableCell> |
|
|
|
</TableRow> |
|
|
|
)) |
|
|
|
)} |
|
|
|
|