From 7335112fce4683b0280ba29826a3fc32c0567138 Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Tue, 26 Nov 2024 15:24:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E8=B4=A7=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/deliver/coms/comScanDeliverPack.vue | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/pages/deliver/coms/comScanDeliverPack.vue b/src/pages/deliver/coms/comScanDeliverPack.vue index 2684f598..58f3f36d 100644 --- a/src/pages/deliver/coms/comScanDeliverPack.vue +++ b/src/pages/deliver/coms/comScanDeliverPack.vue @@ -179,7 +179,8 @@ fontSize: "100rpx" }, bussinessCode: 'Issue', - toLocationAreaTypeList: [] + toLocationAreaTypeList: [], + itemInfo:null } }, created() { @@ -292,7 +293,7 @@ ) return; } else { - + this.itemInfo=item var params = { itemCode: result.package.itemCode, batch: result.label.batch, @@ -572,7 +573,7 @@ this.showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode + "】与推荐的库位不一致,是否要继续发货?", res => { if (res) { - let locaion = that.createLocationInfo(label, balance, packageInfo, item.qty); + let locaion = that.createLocationInfo(label, balance, packageInfo); if(locaion){ item.Locations.push(locaion); this.getfocus(); @@ -740,7 +741,7 @@ }, //增加不是任务中的库位,实际扫描的明细 - createLocationInfo(label, balance, packageInfo, itemCodeQty) { + createLocationInfo(label, balance, packageInfo) { let location = { fromLocationCode: balance.locationCode, qty: balance.qty, @@ -749,7 +750,7 @@ isNewAdd: true, Batchs: [] } - let batch = this.createBatchInfo(label, balance, packageInfo, itemCodeQty); + let batch = this.createBatchInfo(label, balance, packageInfo); if(batch){ batch.detail = balance; batch.detail.fromLocationCode = balance.locationCode; @@ -762,7 +763,7 @@ }, - createBatchInfo(data, balance, packageInfo, itemCodeQty) { + createBatchInfo(data, balance, packageInfo) { let batch = { isNewAdd: true, batch: data.batch, @@ -772,7 +773,7 @@ Records: [] } let record = this.creatRecord(data, balance, packageInfo); - if (!this.checkQty(batch, record,itemCodeQty)) { + if (!this.checkHandleQty(record)) { return; } @@ -897,14 +898,19 @@ }, - checkHandleQty(batch, record) { + checkHandleQty(record) { var isPassed = true; if (this.jobContent.allowBiggerQty == "FALSE") { - var tempHandleQty = 0 - batch.Records.forEach(res => { - tempHandleQty = calc.add(tempHandleQty, res.qty) + var scanQty=0 + var recommendQty =this.itemInfo.qty + this.itemInfo.Locations.forEach(location=>{ + location.Batchs.forEach(batch=>{ + batch.Records.forEach(record=>{ + scanQty= calc.add(scanQty, record.qty) + }) + }) }) - var vailQty = calc.sub(batch.qty, tempHandleQty) + var vailQty = calc.sub(recommendQty, scanQty) if (record.qty > vailQty) { this.showErrorMessage("扫描标签数量[" + record.qty + "]大于剩余推荐数量[" + vailQty + "]") isPassed = false;