Browse Source

修改发货数量校验

hella_online_20241128
lijuncheng 2 months ago
parent
commit
d82432296d
  1. 44
      src/pages/deliver/coms/comScanDeliverPack.vue

44
src/pages/deliver/coms/comScanDeliverPack.vue

@ -545,8 +545,9 @@
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => {
if (res) {
let batch = that.createBatchInfo(label, balance, packageInfo);
let batch = that.createBatchInfo(label, balance, packageInfo,fromLocation.qty);
//details
if(batch){
if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
@ -554,6 +555,8 @@
this.getfocus();
that.$emit("afterScan");
}
}
})
} else {
that.showErrorMessage('未查找到批次【' + lot + '】的发货明细',
@ -569,11 +572,14 @@
this.showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode +
"】与推荐的库位不一致,是否要继续发货?", res => {
if (res) {
let locaion = that.createLocationInfo(label, balance, packageInfo);
let locaion = that.createLocationInfo(label, balance, packageInfo, item.qty);
if(locaion){
item.Locations.push(locaion);
this.getfocus();
that.$emit("afterScan");
}
}
})
} else {
@ -734,7 +740,7 @@
},
//
createLocationInfo(label, balance, packageInfo) {
createLocationInfo(label, balance, packageInfo, itemCodeQty) {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
@ -743,15 +749,20 @@
isNewAdd: true,
Batchs: []
}
let batch = this.createBatchInfo(label, balance, packageInfo);
let batch = this.createBatchInfo(label, balance, packageInfo, itemCodeQty);
if(batch){
batch.detail = balance;
batch.detail.fromLocationCode = balance.locationCode;
location.Batchs.push(batch);
return location;
}else {
return null;
}
},
createBatchInfo(data, balance, packageInfo) {
createBatchInfo(data, balance, packageInfo, itemCodeQty) {
let batch = {
isNewAdd: true,
batch: data.batch,
@ -761,10 +772,30 @@
Records: []
}
let record = this.creatRecord(data, balance, packageInfo);
if (!this.checkQty(batch, record,itemCodeQty)) {
return;
}
batch.Records.push(record);
this.issueRecord.unshift(record)
return batch;
},
//
checkQty(batch,record,itemCodeQty){
var isPassed=true
if (this.jobContent.allowBiggerQty == "FALSE") {
var tempHandleQty = 0
batch.Records.forEach(res => {
tempHandleQty = calc.add(tempHandleQty, res.qty)
})
var vailQty = calc.sub(itemCodeQty, tempHandleQty)
if (record.qty > vailQty) {
this.showErrorMessage("扫描标签数量[" + record.qty + "]大于剩余推荐数量[" + vailQty + "]")
isPassed=false
}
}
return isPassed;
},
creatRecord(label, balance, packageInfo) {
balance.packQty = packageInfo.packQty
@ -881,8 +912,7 @@
}
return isPassed
}
,
},
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();

Loading…
Cancel
Save