Browse Source

修改发货数量校验

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

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

@ -493,21 +493,21 @@
that.fromLocationCode = balance.locationCode; that.fromLocationCode = balance.locationCode;
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode);
// //
if (fromLocation){ if (fromLocation) {
// //
// if(fromLocation.isNewAdd){ // if(fromLocation.isNewAdd){
// }else { // }else {
// // // //
// } // }
let batch = fromLocation.Batchs.find(r => r.batch == lot); let batch = fromLocation.Batchs.find(r => r.batch == lot);
if (batch != undefined) { if (batch != undefined) {
if (batch.Records == undefined) { if (batch.Records == undefined) {
batch.Records = []; batch.Records = [];
} }
let record = batch.Records.find(r => r.packingNumber == packingCode); let record = batch.Records.find(r => r.packingNumber == packingCode);
if (record == undefined) { if (record == undefined) {
// //
@ -531,7 +531,7 @@
} else { } else {
that.addRecord(batch, label, balance, packageInfo) that.addRecord(batch, label, balance, packageInfo)
} }
} else { } else {
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱',
res => { res => {
@ -539,20 +539,23 @@
} }
) )
} }
} else { } else {
if (this.jobContent.allowModifyBatch == "TRUE") { if (this.jobContent.allowModifyBatch == "TRUE") {
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot + this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => { '】的发货明细,是否要继续发货?', res => {
if (res) { if (res) {
let batch = that.createBatchInfo(label, balance, packageInfo); let batch = that.createBatchInfo(label, balance, packageInfo,fromLocation.qty);
//details //details
if (fromLocation.Batchs.length > 0) { if(batch){
batch.detail = fromLocation.Batchs[0].detail; if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
fromLocation.Batchs.unshift(batch);
this.getfocus();
that.$emit("afterScan");
} }
fromLocation.Batchs.unshift(batch);
this.getfocus();
that.$emit("afterScan");
} }
}) })
} else { } else {
@ -562,26 +565,29 @@
}); });
} }
} }
}else { } else {
// //
if (this.jobContent.allowModifyLocation == "TRUE") { if (this.jobContent.allowModifyLocation == "TRUE") {
this.showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode + this.showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode +
"】与推荐的库位不一致,是否要继续发货?", res => { "】与推荐的库位不一致,是否要继续发货?", res => {
if (res) { if (res) {
let locaion = that.createLocationInfo(label, balance, packageInfo); let locaion = that.createLocationInfo(label, balance, packageInfo, item.qty);
item.Locations.push(locaion); if(locaion){
this.getfocus(); item.Locations.push(locaion);
that.$emit("afterScan"); this.getfocus();
that.$emit("afterScan");
}
} }
}) })
} else { } else {
this.showErrorMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode + this.showErrorMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode +
"】与推荐的库位不一致,不允许继续发货?") "】与推荐的库位不一致,不允许继续发货?")
} }
} }
// if (fromLocation && !fromLocation.isNewAdd) { // if (fromLocation && !fromLocation.isNewAdd) {
// let batch = fromLocation.Batchs.find(r => r.batch == lot); // let batch = fromLocation.Batchs.find(r => r.batch == lot);
// if (batch != undefined) { // if (batch != undefined) {
@ -734,7 +740,7 @@
}, },
// //
createLocationInfo(label, balance, packageInfo) { createLocationInfo(label, balance, packageInfo, itemCodeQty) {
let location = { let location = {
fromLocationCode: balance.locationCode, fromLocationCode: balance.locationCode,
qty: balance.qty, qty: balance.qty,
@ -743,15 +749,20 @@
isNewAdd: true, isNewAdd: true,
Batchs: [] Batchs: []
} }
let batch = this.createBatchInfo(label, balance, packageInfo); let batch = this.createBatchInfo(label, balance, packageInfo, itemCodeQty);
batch.detail = balance; if(batch){
batch.detail.fromLocationCode = balance.locationCode; batch.detail = balance;
location.Batchs.push(batch); batch.detail.fromLocationCode = balance.locationCode;
return location; location.Batchs.push(batch);
return location;
}else {
return null;
}
}, },
createBatchInfo(data, balance, packageInfo) { createBatchInfo(data, balance, packageInfo, itemCodeQty) {
let batch = { let batch = {
isNewAdd: true, isNewAdd: true,
batch: data.batch, batch: data.batch,
@ -761,10 +772,30 @@
Records: [] Records: []
} }
let record = this.creatRecord(data, balance, packageInfo); let record = this.creatRecord(data, balance, packageInfo);
if (!this.checkQty(batch, record,itemCodeQty)) {
return;
}
batch.Records.push(record); batch.Records.push(record);
this.issueRecord.unshift(record) this.issueRecord.unshift(record)
return batch; 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) { creatRecord(label, balance, packageInfo) {
balance.packQty = packageInfo.packQty balance.packQty = packageInfo.packQty
@ -814,7 +845,7 @@
"]的父包装已经扫描") "]的父包装已经扫描")
} else { } else {
let record = this.creatRecord(label, balance, packageInfo); let record = this.creatRecord(label, balance, packageInfo);
if(!this.checkHandleQty(batch,record)){ if (!this.checkHandleQty(batch, record)) {
return; return;
} }
batch.Records.push(record); batch.Records.push(record);
@ -839,7 +870,7 @@
if (res) { if (res) {
batch.Records = []; batch.Records = [];
let record = this.creatRecord(label, balance, packageInfo); let record = this.creatRecord(label, balance, packageInfo);
if(!this.checkHandleQty(batch,record)){ if (!this.checkHandleQty(batch, record)) {
return; return;
} }
batch.Records.push(record); batch.Records.push(record);
@ -852,7 +883,7 @@
console.log("扫描的是父包装,是否移除子包装") console.log("扫描的是父包装,是否移除子包装")
} else { } else {
let record = this.creatRecord(label, balance, packageInfo); let record = this.creatRecord(label, balance, packageInfo);
if(!this.checkHandleQty(batch,record)){ if (!this.checkHandleQty(batch, record)) {
return; return;
} }
batch.Records.push(record); batch.Records.push(record);
@ -865,24 +896,23 @@
} }
}, },
checkHandleQty(batch,record){ checkHandleQty(batch, record) {
var isPassed=true; var isPassed = true;
if(this.jobContent.allowBiggerQty=="FALSE"){ if (this.jobContent.allowBiggerQty == "FALSE") {
var tempHandleQty=0 var tempHandleQty = 0
batch.Records.forEach(res => { batch.Records.forEach(res => {
tempHandleQty = calc.add(tempHandleQty, res.qty) tempHandleQty = calc.add(tempHandleQty, res.qty)
}) })
var vailQty =calc.sub(batch.qty,tempHandleQty) var vailQty = calc.sub(batch.qty, tempHandleQty)
if( record.qty>vailQty){ if (record.qty > vailQty) {
this.showErrorMessage("扫描标签数量["+record.qty+"]大于剩余推荐数量["+vailQty+"]") this.showErrorMessage("扫描标签数量[" + record.qty + "]大于剩余推荐数量[" + vailQty + "]")
isPassed=false; isPassed = false;
} }
} }
return isPassed return isPassed
} },
,
getfocus() { getfocus() {
if (this.$refs.comscan != undefined) { if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus(); this.$refs.comscan.getfocus();

Loading…
Cancel
Save