From e14ee61328c6f46bd86b498b55773a4ffc8cbba7 Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Mon, 26 Aug 2024 18:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E5=88=92=E5=A4=96?= =?UTF-8?q?=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/detail.js | 22 ++++++++ src/pages/unPlanned/job/issueJobDetail.vue | 64 ++++++---------------- 2 files changed, 39 insertions(+), 47 deletions(-) diff --git a/src/common/detail.js b/src/common/detail.js index b6ed44a3..3224c1cc 100644 --- a/src/common/detail.js +++ b/src/common/detail.js @@ -116,6 +116,28 @@ export function calcHandleQty(detailSource) { } } +//计算推荐和扫描的不是用一个的数量 +export function calcHandleNewQty(detailSource) { + for (let item of detailSource) { + item.handleQty = new Decimal(0).toNumber(); + item.qty = new Decimal(0).toNumber(); + for (let detail of item.subList) { + if (detail ) { + if (!detail.isRecommend && detail.scaned) { + item.handleQty = calc.add(item.handleQty, detail.handleQty); + } + if (!detail.isRecommend ) { + item.qty = calc.add(item.qty, detail.qty); + } + + } + } + } +} + + + + export function calcTreeHandleQty(detailSource) { for (let item of detailSource) { item.handleQty = new Decimal(0).toNumber(); diff --git a/src/pages/unPlanned/job/issueJobDetail.vue b/src/pages/unPlanned/job/issueJobDetail.vue index 047c6134..3f4867fb 100644 --- a/src/pages/unPlanned/job/issueJobDetail.vue +++ b/src/pages/unPlanned/job/issueJobDetail.vue @@ -60,9 +60,17 @@ import { getDataSource, createRecordInfo, - calcHandleQty, + calcHandleNewQty, getScanCount } from '@/common/detail.js'; + + import { + calc + } from '@/common/calc' + + import { + Decimal + } from 'decimal.js'; //引入 import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" @@ -192,7 +200,7 @@ }, calcHandleQty() { - calcHandleQty(this.detailSource) + calcHandleNewQty(this.detailSource) // this.continueScan() this.$forceUpdate(); }, @@ -203,7 +211,7 @@ var item =this.detailSource[i] for (var j = 0; j < item.subList.length; j++) { var sub =item.subList[j] - if(sub.isRecommend&&!sub.scaned){ + if(!sub.isRecommend&&!sub.scaned){ item.subList.splice(j,1) } } @@ -239,8 +247,8 @@ itemCode:itemCode, packingNumber:packingNumber, batch:batch, - handleQty:Number(result.balance.qty), - qty:qty, + handleQty:detail.qty { - if (res) { - itemDetail.scaned = true; - itemDetail.handleQty = Number(result.balance.qty); - itemDetail.toInventoryStatus = result.balance.inventoryStatus; - itemDetail.balance = result.balance; - itemDetail.balance.balanceQty = Number(result.balance.qty); - itemDetail.balance.packQty = Number(result.package.packQty) - itemDetail.balance.packUnit = result.package.packUnit - this.calcHandleQty(); - } else { - this.scanPopupGetFocus(); - } - }); - } else { - this.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + - itemStatus + - ']不一致,不允许转移!', res => { - this.scanPopupGetFocus(); - }); - } - - } else { - itemDetail.scaned = true; - itemDetail.handleQty = Number(result.balance.qty); - itemDetail.toInventoryStatus = result.balance.inventoryStatus; - itemDetail.balance = result.balance; - itemDetail.balance.balanceQty = Number(result.balance.qty); - itemDetail.balance.packQty = Number(result.package.packQty) - itemDetail.balance.packUnit = result.package.packUnit - this.calcHandleQty(); - } - } + } } } } catch (e) { @@ -349,7 +319,7 @@ let str = '' this.detailSource.forEach((item) => { item.subList.forEach(cur => { - if(cur.scaned){ + if(!cur.isRecommend&&cur.scaned){ if (cur.qty != cur.handleQty) { var tempHandleQty =0 if(cur.handleQty){ @@ -357,7 +327,7 @@ }else { tempHandleQty =0 } - str += `包装号【${cur.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致` + str += `物料号【${cur.itemCode}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致` } }