Procházet zdrojové kódy

update

reset-do-picking-order
CANCERYS\kw093 před 5 dny
rodič
revize
ad127b39ac
2 změnil soubory, kde provedl 16 přidání a 10 odebrání
  1. +14
    -10
      src/components/FinishedGoodSearch/GoodPickExecutionForm.tsx
  2. +2
    -0
      src/i18n/zh/pickOrder.json

+ 14
- 10
src/components/FinishedGoodSearch/GoodPickExecutionForm.tsx Zobrazit soubor

@@ -86,9 +86,9 @@ const PickExecutionForm: React.FC<PickExecutionFormProps> = ({
const [handlers, setHandlers] = useState<Array<{ id: number; name: string }>>(
[]
);
const calculateRemainingAvailableQty = useCallback((lot: LotPickData) => {
return lot.availableQty || 0;
return (lot.availableQty + lot.requiredQty ) || 0;
}, []);

const calculateRequiredQty = useCallback((lot: LotPickData) => {
@@ -189,7 +189,7 @@ const PickExecutionForm: React.FC<PickExecutionFormProps> = ({
}

// 2. Check actualPickQty cannot exceed available quantity
if (ap > availableQty) {
if (ap > maxActual) {
newErrors.actualPickQty = t("Actual pick qty cannot exceed available qty");
}

@@ -202,20 +202,22 @@ const PickExecutionForm: React.FC<PickExecutionFormProps> = ({
}

// 4. Total (actualPickQty + missQty + badItemQty + badPackageQty) cannot exceed lot available qty
if (total > availableQty) {
if (total > maxActual) {
const errorMsg = t(
"Total qty (actual pick + miss + bad) cannot exceed available qty: {available}",
{ available: availableQty }
{ available: maxActual }
);
newErrors.actualPickQty = errorMsg;
newErrors.missQty = errorMsg;
newErrors.badItemQty = errorMsg;
}

// 5. At least one field must have a value
if (ap === 0 && miss === 0 && totalBad === 0) {
newErrors.actualPickQty = t("Enter pick qty or issue qty");
if (selectedLot?.stockOutLineStatus === 'pending' && ap >0 && miss === 0 && totalBad === 0) {
newErrors.actualPickQty = t("if need just edit number, please scan the lot again");
}
// 5. At least one field must have a value
//if (ap === 0 && miss === 0 && totalBad === 0) {
// newErrors.actualPickQty = t("Enter pick qty or issue qty");
// }

setErrors(newErrors);
return Object.keys(newErrors).length === 0;
@@ -274,7 +276,9 @@ const PickExecutionForm: React.FC<PickExecutionFormProps> = ({

const remainingAvailableQty = calculateRemainingAvailableQty(selectedLot);
const requiredQty = calculateRequiredQty(selectedLot);

const availableQty = selectedLot?.availableQty || 0;
const maxActual = requiredQty + availableQty;
return (
<Dialog open={open} onClose={handleClose} maxWidth="sm" fullWidth>
<DialogTitle>


+ 2
- 0
src/i18n/zh/pickOrder.json Zobrazit soubor

@@ -17,6 +17,8 @@
"Select Remark": "選擇備註",
"Just Complete": "已完成",
"Skip": "跳過",
"if need just edit number, please scan the lot again": "如果需要只修改數量,請重新掃描批次。",
"Total qty (actual pick + miss + bad) cannot exceed available qty: {available}": "總數量(實際提料 + 遺失 + 不良)不能超過可用數量:{{available}}",
"Confirm Assignment": "確認分配",
"Required Date": "所需日期",
"Store": "位置",


Načítá se…
Zrušit
Uložit