diff --git a/src/common/detail.js b/src/common/detail.js index 3171ca38..ad26df7b 100644 --- a/src/common/detail.js +++ b/src/common/detail.js @@ -155,7 +155,25 @@ export function calcHandleQty(detailSource) { } } } - +//计算计划外入库实际数量和任务数量 +export function calcHandleQtyPlanOut(detailSource) { + console.log(999,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 != undefined) { + if (detail.scaned) { + item.handleQty = calc.add(item.handleQty, detail.handleQty); + } + console.log(detail.isRecommend) + if(detail.isRecommend){ + item.qty = calc.add(item.qty, detail.qty); + } + } + } + } +} //计算推荐和扫描的不是用一个的数量 export function calcHandleNewQty(detailSource) { for (let item of detailSource) { diff --git a/src/pages/unPlanned/job/receiptJobDetail.vue b/src/pages/unPlanned/job/receiptJobDetail.vue index 7bfddc96..0d5c7806 100644 --- a/src/pages/unPlanned/job/receiptJobDetail.vue +++ b/src/pages/unPlanned/job/receiptJobDetail.vue @@ -68,7 +68,8 @@ getDataSource, createRecordInfo, calcHandleQty, - getScanCount + getScanCount, + calcHandleQtyPlanOut } from '@/common/detail.js'; import { @@ -242,7 +243,7 @@ } } } - calcHandleQty(this.detailSource); + calcHandleQtyPlanOut(this.detailSource); this.$forceUpdate() }, @@ -289,7 +290,7 @@ batch:batch, handleQty:Number(result.label.qty), qty:detail.qty, - toLocationCode:locationCode, + // toLocationCode:locationCode, // inventoryStatus:inventoryStatus, // toInventoryStatus:inventoryStatus, balance:{}, @@ -308,20 +309,14 @@ } else { itemDetail.scaned = true; itemDetail.handleQty = Number(result.label.qty); - itemDetail.toLocationCode = this.toLocationCode ? this.toLocationCode : itemDetail - .toLocationCode; + // itemDetail.toLocationCode = this.toLocationCode ? this.toLocationCode : itemDetail + // .toLocationCode; itemDetail.packQty = result.package.packQty itemDetail.labelQty = Number(result.label.qty); this.continueScan() } } - let array = [] - this.detailSource.forEach((item=>{ - let obj = {...item} - obj.subList=item.subList.filter(cur=>cur.isRecommend == true) - array.push(obj) - })) - calcHandleQty(array); + calcHandleQtyPlanOut(this.detailSource); } } catch (e) { @@ -352,7 +347,7 @@ .toLocationCode; itemDetail.packQty = result.package.packQty itemDetail.labelQty = Number(result.label.qty); - calcHandleQty(this.detailSource); + calcHandleQtyPlanOut(this.detailSource); this.continueScan() } }