From 6f0159b49e2ffd298fd45b0151799f06a29ef8e0 Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Mon, 10 Feb 2025 15:47:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=BB=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inventoryMove/coms/comMoveRecord.vue | 192 +++++++++++++----- .../inventoryMove/coms/comMoveRecordCard.vue | 12 +- 2 files changed, 149 insertions(+), 55 deletions(-) diff --git a/src/pages/inventoryMove/coms/comMoveRecord.vue b/src/pages/inventoryMove/coms/comMoveRecord.vue index b0559bff..042d8160 100644 --- a/src/pages/inventoryMove/coms/comMoveRecord.vue +++ b/src/pages/inventoryMove/coms/comMoveRecord.vue @@ -1,7 +1,7 @@ @@ -49,6 +48,7 @@ import comBlankView from '@/mycomponents/common/comBlankView.vue' import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" + import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' import { getInventoryStatusName @@ -70,6 +70,10 @@ getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js'; + + import { + Decimal + } from 'decimal.js'; //引入 import { getBusinessType, @@ -87,6 +91,7 @@ comBlankView, winScanLocation, winScanPackAndLocation, + winComScanBalance }, props: { // fromInventoryStatus: { @@ -130,7 +135,6 @@ detailSource: [], //绑定在页面上的数据源 title: "", dataContent: {}, - fromLocationAreaTypeList: [], toLocationAreaTypeList: [], isShowEditLocation: false } @@ -140,9 +144,8 @@ getBusinessType(this.businessTypeCode, res => { if (res.success) { this.businessType = res.businessType; - this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; this.toLocationAreaTypeList = res.toLocationAreaTypeList; - this.showFromLocationPopup(); + this.openScanPopup(); } else { this.showErrorMessage(res.message) } @@ -218,29 +221,26 @@ }, openScanPopup() { - if (this.fromLocationCode == "") { - this.showFromLocationPopup(); - return + if (this.businessType) { + this.$refs.scanPopup.openScanPopup(this.businessType); + } else { + this.getBusinessType() } - this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); }, showFromLocationPopup() { this.$nextTick(() => { this.$refs.scanFromLocationCode.openScanPopup(); }) }, - getFromLocation(location) { - this.fromLocationCode = location.code; - this.fromLocationInfo = location; - this.openScanPopup(); - }, getToLocation(location, code) { this.toLocationCode = code; this.toLocationInfo = location; }, getScanResult(result) { - var balance = result.balance; - var pack = result.package; + let balance = result.balance; + let label = result.label; + let pack = result.package; + var item = this.detailSource.find(res => { if (res.itemCode == balance.itemCode) { return res @@ -248,66 +248,142 @@ }) if (item == undefined) { var itemp = createItemInfo(balance, pack); - let newDetail = createDetailInfo(balance, pack); - - if (newDetail.packingNumber == '') { - newDetail.packingNumber = pack.number; + // itemp.containerNumber="" + let newDetail = createDetailInfo(balance, pack); // + newDetail.fromLocationCode = balance.locationCode + + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + if (balance.lableQty) { + newDetail.handleQty = new Decimal(0).toNumber( balance.lableQty) } - if (this.businessTypeCode == "Move") { newDetail.toInventoryStatus = balance.inventoryStatus; } else { newDetail.toInventoryStatus = this.toInventoryStatus; } + newDetail.toLocationCode = this.toLocationCode; - newDetail.fromLocationCode = result.fromLocationCode itemp.subList.push(newDetail); this.detailSource.push(itemp) + this.scanPopupGetFocus() } else { var detail = item.subList.find(r => { if (r.packingNumber == pack.number && - r.batch == pack.batch && + r.batch == balance.batch && r.fromLocationCode == balance.locationCode && - r.toInventoryStatus == balance.inventoryStatus && - r.scaned == true) { + r.inventoryStatus == balance.inventoryStatus) { return r; } }) - if (detail == undefined) { - let newDetail = createDetailInfo(balance, pack); - // newDetail.inventoryStatus = balance.inventoryStatus; - if (this.businessTypeCode == "Move") { - newDetail.toInventoryStatus = balance.inventoryStatus; + //如果最开始扫父,在扫子,提示已经扫描父包装 + //如果扫子在扫父,提示扫描的是父包装,是否移除子包装,是移除子包装,显示父包装 + //扫描的是子包装, + if (pack.parentNumber) { + var checkData = item.subList.find(r => { + if (r.packingNumber == pack.parentNumber && + r.batch == balance.batch && + r.fromLocationCode == balance.locationCode) { + return r; + } + }) + if (checkData) { + //提示已经扫描 + this.showErrorMessage("扫描箱码[" + pack.number + "]批次[" + balance.batch + + "]的父包装已经扫描") + console.log("父包装已经扫描") + } else { + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.fromLocationCode = balance.locationCode + if (balance.lableQty) { + newDetail.handleQty = new Decimal(0).toNumber( balance.lableQty) + } + if (this.businessTypeCode == "Move") { + newDetail.toInventoryStatus = balance.inventoryStatus; + } else { + newDetail.toInventoryStatus = this.toInventoryStatus; + } + newDetail.toLocationCode = this.toLocationCode; + item.subList.push(newDetail); + } } else { - newDetail.toInventoryStatus = this.toInventoryStatus; + //扫描的是父包装 + var checkData = item.subList.find(r => { + if (r.parentNumber == pack.number && + r.batch == balance.batch && + r.fromLocationCode == balance.locationCode) { + return r; + } + }) + if (checkData) { + //是否移除 + this.$refs.comMessage.showQuestionMessage("箱码[" + checkData.parentNumber + "]" + "批次[" + + balance + .batch + "]是父包装,是否移除子包装", res => { + if (res) { + item.subList = []; + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.fromLocationCode = balance.locationCode + if (balance.lableQty) { + newDetail.handleQty = new Decimal(0).toNumber( balance.lableQty) + } + if (this.businessTypeCode == "Move") { + newDetail.toInventoryStatus = balance.inventoryStatus; + } else { + newDetail.toInventoryStatus = this.toInventoryStatus; + } + newDetail.toLocationCode = this.toLocationCode; + item.subList.push(newDetail); + calcHandleQty(this.detailSource); + } + }) + console.log("扫描的是父包装,是否移除子包装") + } else { + let newDetail = createDetailInfo(balance, pack); + newDetail.fromLocationCode = balance.locationCode + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + if (balance.lableQty) { + newDetail.handleQty = new Decimal(0).toNumber( balance.lableQty) + } + if (this.businessTypeCode == "Move") { + newDetail.toInventoryStatus = balance.inventoryStatus; + } else { + newDetail.toInventoryStatus = this.toInventoryStatus; + } + newDetail.toLocationCode = this.toLocationCode; + item.subList.push(newDetail); + } } - if (newDetail.packingNumber == '') { - newDetail.packingNumber = pack.number; - } - newDetail.toLocationCode = this.toLocationCode; - newDetail.fromLocationCode = result.fromLocationCode - item.subList.push(newDetail); + this.scanPopupGetFocus() } else { - this.showErrorMessage("包装[" + detail.packingNumber + "]\n" + - "批次[" + detail.batch + "]\n" + "库位[" + detail.fromLocationCode + "]\n" + - "库存状态[" + getInventoryStatusName(detail.toInventoryStatus) + "]\n" + - "重复扫描") + if (detail.scaned == true) { + this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") + } } } calcHandleQty(this.detailSource); - }, + showErrorMessage(message) { - if (this.$refs.scanPopup) { - this.$refs.scanPopup.packLoseFocus() - } + this.scanPopupLoseFocus() this.$refs.comMessage.showErrorMessage(message, res => { if (res) { - if (this.$refs.scanPopup) { - this.$refs.scanPopup.packGetFocus() - } + this.scanPopupGetFocus() } }); }, @@ -388,6 +464,18 @@ }, + scanPopupGetFocus() { + if (this.$refs.scanPopup != undefined) { + this.$refs.scanPopup.getfocus(); + } + }, + + scanPopupLoseFocus() { + if (this.$refs.scanPopup != undefined) { + this.$refs.scanPopup.losefocus(); + } + }, + submit() { //目标库位和状态都一致时不可以提交 var params = this.setParams() @@ -407,7 +495,6 @@ }); return; } - console.log("提交" + JSON.stringify(params)) inventoryMoveRecordSubmit(params).then(res => { uni.hideLoading() if (res.data) { @@ -476,6 +563,7 @@ submitItem.fromLocationCode = detail.fromLocationCode; submitItem.toLocationCode = detail.toLocationCode; + submitItem.parentNumber =detail.parentNumber submitItem.package = null; submitItem.Records = null; diff --git a/src/pages/inventoryMove/coms/comMoveRecordCard.vue b/src/pages/inventoryMove/coms/comMoveRecordCard.vue index 8c0449b2..a21f0370 100644 --- a/src/pages/inventoryMove/coms/comMoveRecordCard.vue +++ b/src/pages/inventoryMove/coms/comMoveRecordCard.vue @@ -16,9 +16,13 @@ - + + + + + @@ -43,6 +47,7 @@ import balanceMove from '@/mycomponents/balance/balanceMove.vue' import comMovebalance from '@/pages/inventoryMove/coms/comMovebalance.vue' import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' + import pack from '@/mycomponents/balance/pack.vue' import { getDetailOption, @@ -58,6 +63,7 @@ balanceQtyEdit, balanceMove, comMovebalance, + pack }, props: { dataContent: {