From b226315337c03a4081c6b9b014820390eb6c3122 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Tue, 29 Oct 2024 11:27:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=8F=91=E6=96=99=E6=9D=A5?= =?UTF-8?q?=E6=BA=90=E5=BA=93=E4=BD=8D=EF=BC=8C=E5=BA=93=E5=AD=98=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=89=B9=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/record.js | 19 +++- .../inventoryMove/coms/comMoveRecord.vue | 88 +++++++++++++++++-- src/pages/issue/record/directIssue.vue | 47 +++++----- 3 files changed, 124 insertions(+), 30 deletions(-) diff --git a/src/common/record.js b/src/common/record.js index 6cbcb38b..905b0501 100644 --- a/src/common/record.js +++ b/src/common/record.js @@ -79,7 +79,24 @@ export function calcHandleQty(detailSource) { } } } - +//添加数量 +export function calcHandleQtyAdd(detailSource,label) { + console.log(label.qty) + console.log(detailSource) + for (let item of detailSource) { + item.handleQty = item.handleQty || new Decimal(0).toNumber(); + item.qty = item.qty|| new Decimal(0).toNumber(); + item.handleQty = calc.add(item.handleQty, label.qty); + for (let detail of item.subList) { + if (detail != undefined) { + if (detail.scaned) { + detail.handleQty = calc.add(detail.handleQty, label.qty); + } + // 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/inventoryMove/coms/comMoveRecord.vue b/src/pages/inventoryMove/coms/comMoveRecord.vue index b0559bff..9fa42e5e 100644 --- a/src/pages/inventoryMove/coms/comMoveRecord.vue +++ b/src/pages/inventoryMove/coms/comMoveRecord.vue @@ -75,7 +75,8 @@ getBusinessType, createItemInfo, createDetailInfo, - calcHandleQty + calcHandleQty, + calcHandleQtyAdd } from '@/common/record.js'; export default { @@ -238,7 +239,14 @@ this.toLocationCode = code; this.toLocationInfo = location; }, - getScanResult(result) { + getScanResult(result,managementType) { + if(managementType == "BY_BATCH" ||managementType == "BY_QUANTITY" ){ + this.getScanResultAfterBatch(result) + }else{ + this.getScanResultAfter(result) + } + }, + getScanResultAfter(result){ var balance = result.balance; var pack = result.package; var item = this.detailSource.find(res => { @@ -249,11 +257,11 @@ if (item == undefined) { var itemp = createItemInfo(balance, pack); let newDetail = createDetailInfo(balance, pack); - + if (newDetail.packingNumber == '') { newDetail.packingNumber = pack.number; } - + if (this.businessTypeCode == "Move") { newDetail.toInventoryStatus = balance.inventoryStatus; } else { @@ -273,7 +281,7 @@ return r; } }) - + if (detail == undefined) { let newDetail = createDetailInfo(balance, pack); // newDetail.inventoryStatus = balance.inventoryStatus; @@ -282,7 +290,7 @@ } else { newDetail.toInventoryStatus = this.toInventoryStatus; } - + if (newDetail.packingNumber == '') { newDetail.packingNumber = pack.number; } @@ -297,7 +305,65 @@ } } calcHandleQty(this.detailSource); - + }, + getScanResultAfterBatch(result){ + var balance = result.balance; + this.balanceInfo = result.balance; + var pack = result.package; + var item = this.detailSource.find(res => { + if (res.itemCode == balance.itemCode) { + return res + } + }) + if (item == undefined) { + var itemp = createItemInfo(balance, pack); + let newDetail = createDetailInfo(balance, pack); + + if (newDetail.packingNumber == '') { + newDetail.packingNumber = pack.number; + } + + if (this.businessTypeCode == "Move") { + newDetail.toInventoryStatus = balance.inventoryStatus; + } else { + newDetail.toInventoryStatus = this.toInventoryStatus; + } + newDetail.toLocationCode = this.toLocationCode; + newDetail.fromLocationCode = result.fromLocationCode + newDetail.handleQty = 0 + itemp.subList.push(newDetail); + this.detailSource.push(itemp) + } else { + var detail = item.subList.find(r => { + if (r.batch == pack.batch && + r.fromLocationCode == balance.locationCode && + r.toInventoryStatus == balance.inventoryStatus && + r.scaned == true) { + return r; + } + }) + + if (detail == undefined) { + let newDetail = createDetailInfo(balance, pack); + // newDetail.inventoryStatus = balance.inventoryStatus; + if (this.businessTypeCode == "Move") { + newDetail.toInventoryStatus = balance.inventoryStatus; + } else { + newDetail.toInventoryStatus = this.toInventoryStatus; + } + + if (newDetail.packingNumber == '') { + newDetail.packingNumber = pack.number; + } + newDetail.handleQty = 0 + newDetail.toLocationCode = this.toLocationCode; + newDetail.fromLocationCode = result.fromLocationCode + item.subList.push(newDetail); + } else { + + } + } + calcHandleQtyAdd(this.detailSource,result.label); }, showErrorMessage(message) { if (this.$refs.scanPopup) { @@ -407,7 +473,9 @@ }); return; } - console.log("提交" + JSON.stringify(params)) + // if(this.balanceInfo) + console.log("提交" ,params) + inventoryMoveRecordSubmit(params).then(res => { uni.hideLoading() if (res.data) { @@ -457,6 +525,8 @@ var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch); var submitItem = deepCopyData(detail) + console.log(233,submitItem) + console.log(244,info) submitItem.itemCode = detail.itemCode; submitItem.itemName = detail.package.itemName; submitItem.itemDesc1 = detail.package.itemDesc1; @@ -467,7 +537,7 @@ submitItem.fromPackingNumber = info.packingNumber; submitItem.toPackingNumber = info.packingNumber; - + submitItem.packingNumber = info.packingNumber; submitItem.fromContainerNumber = detail.containerNumber; submitItem.toContainerNumber = detail.containerNumber diff --git a/src/pages/issue/record/directIssue.vue b/src/pages/issue/record/directIssue.vue index 40032258..92624f75 100644 --- a/src/pages/issue/record/directIssue.vue +++ b/src/pages/issue/record/directIssue.vue @@ -39,9 +39,13 @@ - - - + + + + + @@ -188,18 +192,12 @@ }); }, - async getScanResult(result) { - await getManagementPrecisions([result.label.itemCode], result.balance.locationCode, res => { - if (res.success) { - this.managementList = res.list; - this.managementType = this.managementList && this.managementList[0] ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING' - if(this.managementType == "BY_BATCH" ||this.managementType == "BY_QUANTITY" ){ - this.setDataBatch(result); - }else{ - this.setData(result); - } - } - }) + async getScanResult(result,managementType) { + if(managementType == "BY_BATCH" ||managementType == "BY_QUANTITY" ){ + this.setDataBatch(result); + }else{ + this.setData(result); + } }, async setData(result) { let balance = result.balance; @@ -541,7 +539,12 @@ openScanPopup() { if (this.businessType) { - this.$refs.scanPopup.openScanPopup(this.businessType); + // this.$refs.scanFromLocationCode.openScanPopup(); + if (this.fromLocationCode == "") { + this.showFromLocationPopup(); + return + } + this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); } else { this.getBusinessType() } @@ -549,13 +552,13 @@ showFromLocationPopup() { this.$nextTick(() => { - this.$refs.scanLocationCode.openScanPopup(); + this.$refs.scanFromLocationCode.openScanPopup(); }) }, closeScanPopup() { - if (this.$refs.scanPopup != undefined) { - this.$refs.scanPopup.closeScanPopup(); + if (this.$refs.scanFromLocationCode != undefined) { + this.$refs.scanFromLocationCode.closeScanPopup(); } }, @@ -705,7 +708,11 @@ this.$forceUpdate(); }, - +getFromLocation(location) { + this.fromLocationCode = location.code; + this.fromLocationInfo = location; + this.openScanPopup(); + }, clearData() { this.fromLocationInfo = {}; this.fromLocationCode = '';