|
|
@@ -714,10 +714,18 @@ const LotTable: React.FC<LotTableProps> = ({ |
|
|
{t("Scan")} |
|
|
{t("Scan")} |
|
|
</Button> |
|
|
</Button> |
|
|
) : ( |
|
|
) : ( |
|
|
// ✅ 当有 stockOutLineId 时,显示 TextField + Pick Form 按钮 |
|
|
|
|
|
<Stack direction="row" spacing={1} alignItems="center"> |
|
|
|
|
|
{/* ✅ 恢复 TextField 用于正常数量输入 */} |
|
|
|
|
|
<TextField |
|
|
|
|
|
|
|
|
<Stack |
|
|
|
|
|
direction="row" |
|
|
|
|
|
spacing={1} |
|
|
|
|
|
alignItems="center" |
|
|
|
|
|
justifyContent="center" // ✅ 添加水平居中 |
|
|
|
|
|
sx={{ |
|
|
|
|
|
width: '100%', // ✅ 确保占满整个单元格宽度 |
|
|
|
|
|
minHeight: '40px' // ✅ 设置最小高度确保垂直居中 |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
{/* ✅ 恢复 TextField 用于正常数量输入 */} |
|
|
|
|
|
<TextField |
|
|
type="number" |
|
|
type="number" |
|
|
size="small" |
|
|
size="small" |
|
|
value={pickQtyData[selectedRowId!]?.[lot.lotId] || ''} |
|
|
value={pickQtyData[selectedRowId!]?.[lot.lotId] || ''} |
|
|
@@ -725,21 +733,6 @@ const LotTable: React.FC<LotTableProps> = ({ |
|
|
if (selectedRowId) { |
|
|
if (selectedRowId) { |
|
|
const inputValue = parseFloat(e.target.value) || 0; |
|
|
const inputValue = parseFloat(e.target.value) || 0; |
|
|
const maxAllowed = Math.min(calculateRemainingAvailableQty(lot), calculateRemainingRequiredQty(lot)); |
|
|
const maxAllowed = Math.min(calculateRemainingAvailableQty(lot), calculateRemainingRequiredQty(lot)); |
|
|
{/* |
|
|
|
|
|
// ✅ Validate input |
|
|
|
|
|
if (inputValue > maxAllowed) { |
|
|
|
|
|
// Set validation error for this lot |
|
|
|
|
|
setValidationErrors(prev => ({ ...prev, [`lot_${lot.lotId}`]: `${t('Input quantity cannot exceed')} ${maxAllowed}` })); |
|
|
|
|
|
return; |
|
|
|
|
|
} else { |
|
|
|
|
|
// Clear validation error if valid |
|
|
|
|
|
setValidationErrors(prev => { |
|
|
|
|
|
const newErrors = { ...prev }; |
|
|
|
|
|
delete newErrors[`lot_${lot.lotId}`]; |
|
|
|
|
|
return newErrors; |
|
|
|
|
|
}); |
|
|
|
|
|
*/} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onPickQtyChange(selectedRowId, lot.lotId, inputValue); |
|
|
onPickQtyChange(selectedRowId, lot.lotId, inputValue); |
|
|
} |
|
|
} |
|
|
@@ -751,8 +744,8 @@ const LotTable: React.FC<LotTableProps> = ({ |
|
|
selectedLotRowId !== `row_${index}` || |
|
|
selectedLotRowId !== `row_${index}` || |
|
|
lot.stockOutLineStatus === 'completed' |
|
|
lot.stockOutLineStatus === 'completed' |
|
|
} |
|
|
} |
|
|
error={!!validationErrors[`lot_${lot.lotId}`]} // ✅ Show red border when error |
|
|
|
|
|
helperText={validationErrors[`lot_${lot.lotId}`]} // ✅ Show red error text below |
|
|
|
|
|
|
|
|
error={!!validationErrors[`lot_${lot.lotId}`]} |
|
|
|
|
|
helperText={validationErrors[`lot_${lot.lotId}`]} |
|
|
inputProps={{ |
|
|
inputProps={{ |
|
|
min: 0, |
|
|
min: 0, |
|
|
max: calculateRemainingRequiredQty(lot), |
|
|
max: calculateRemainingRequiredQty(lot), |
|
|
@@ -768,32 +761,32 @@ const LotTable: React.FC<LotTableProps> = ({ |
|
|
} |
|
|
} |
|
|
}} |
|
|
}} |
|
|
placeholder="0" |
|
|
placeholder="0" |
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
{/* ✅ 添加 Pick Form 按钮用于问题情况 */} |
|
|
|
|
|
<Button |
|
|
|
|
|
variant="outlined" |
|
|
|
|
|
size="small" |
|
|
|
|
|
onClick={() => handlePickExecutionForm(lot)} |
|
|
|
|
|
disabled={ |
|
|
|
|
|
(lot.lotAvailability === 'expired' || |
|
|
|
|
|
lot.lotAvailability === 'status_unavailable' || |
|
|
|
|
|
lot.lotAvailability === 'rejected') || |
|
|
|
|
|
selectedLotRowId !== `row_${index}` |
|
|
|
|
|
} |
|
|
|
|
|
sx={{ |
|
|
|
|
|
fontSize: '0.7rem', |
|
|
|
|
|
py: 0.5, |
|
|
|
|
|
minHeight: '28px', |
|
|
|
|
|
minWidth: '60px', |
|
|
|
|
|
borderColor: 'warning.main', |
|
|
|
|
|
color: 'warning.main' |
|
|
|
|
|
}} |
|
|
|
|
|
title="Report missing or bad items" |
|
|
|
|
|
> |
|
|
|
|
|
{t("Issue")} |
|
|
|
|
|
</Button> |
|
|
|
|
|
</Stack> |
|
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
{/* ✅ 添加 Pick Form 按钮用于问题情况 */} |
|
|
|
|
|
<Button |
|
|
|
|
|
variant="outlined" |
|
|
|
|
|
size="small" |
|
|
|
|
|
onClick={() => handlePickExecutionForm(lot)} |
|
|
|
|
|
disabled={ |
|
|
|
|
|
(lot.lotAvailability === 'expired' || |
|
|
|
|
|
lot.lotAvailability === 'status_unavailable' || |
|
|
|
|
|
lot.lotAvailability === 'rejected') || |
|
|
|
|
|
selectedLotRowId !== `row_${index}` |
|
|
|
|
|
} |
|
|
|
|
|
sx={{ |
|
|
|
|
|
fontSize: '0.7rem', |
|
|
|
|
|
py: 0.5, |
|
|
|
|
|
minHeight: '28px', |
|
|
|
|
|
minWidth: '60px', |
|
|
|
|
|
borderColor: 'warning.main', |
|
|
|
|
|
color: 'warning.main' |
|
|
|
|
|
}} |
|
|
|
|
|
title="Report missing or bad items" |
|
|
|
|
|
> |
|
|
|
|
|
{t("Issue")} |
|
|
|
|
|
</Button> |
|
|
|
|
|
</Stack> |
|
|
)} |
|
|
)} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
{/*<TableCell align="right">{lot.availableQty.toLocaleString()}</TableCell>*/} |
|
|
{/*<TableCell align="right">{lot.availableQty.toLocaleString()}</TableCell>*/} |
|
|
|