From 98374b342e54c1bd4ab0b8e54bc0827401f1c06c Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Wed, 10 Jul 2024 15:14:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B4=E6=8E=A5=E8=A1=A5?= =?UTF-8?q?=E6=96=99=E6=9F=A5=E8=AF=A2=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../record/directRepleinshRecord.vue | 201 +++++------------- 1 file changed, 59 insertions(+), 142 deletions(-) diff --git a/src/pages/repleinsh/record/directRepleinshRecord.vue b/src/pages/repleinsh/record/directRepleinshRecord.vue index 4054b102..023d70ee 100644 --- a/src/pages/repleinsh/record/directRepleinshRecord.vue +++ b/src/pages/repleinsh/record/directRepleinshRecord.vue @@ -2,11 +2,11 @@ - + - + 来源库位 : {{fromLocationCode}} @@ -40,12 +40,9 @@ - - + + - - @@ -94,7 +91,7 @@ import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' - import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' + import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' export default { components: { @@ -105,7 +102,7 @@ winScanLocation, winScanPackAndLocation, recordComDetailCard, - balanceSelect + winComScanBalance }, data() { return { @@ -123,21 +120,13 @@ fromWarehouseCode: '', //来源仓库 businessTypeCode: "Repleinment", toLocationCode:"", - resultData:{} + resultData:{}, + itemCode:"" }; }, onLoad(option) { this.clear(); - getBusinessType(this.businessTypeCode, res => { - if (res.success) { - this.businessType = res.businessType; - this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; - this.toLocationAreaTypeList = res.toLocationAreaTypeList; - this.showFromLocationPopup(); - } else { - this.showErrorMessage(res.message) - } - }); + this.getBusinessType() }, //返回首页 onNavigationBarButtonTap(e) { @@ -153,6 +142,18 @@ mounted() {}, methods: { + getBusinessType(){ + getBusinessType(this.businessTypeCode, res => { + if (res.success) { + this.businessType=res.businessType; + this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses); + this.fromLocationAreaTypeList = res.fromLocationAreaTypeList + this.openScanPopup(); + } else { + this.showErrorMessage(res.message) + } + }); + }, getBalance(label, packageInfo, callback) { var filters = [] @@ -201,122 +202,47 @@ this.showErrorMessage(err.message); }) }, - getScanResult(result) { - this.resultData=result; - let packageInfo = result.package; - this.getBalance(result.label, packageInfo, balances =>{ - - //扫描的是外包装 - let s = ''; - if (!result.package.parentNumber) { - if (balances.list.length == 0) { - this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else { - let newBalances = balances.list.filter(b => b.locationCode == this - .fromLocationCode); - if (newBalances.length == 0) { - this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else if (newBalances.length == 1) { - let balance = newBalances[0]; - result.balance=balance; - this.afterGetBalance(result); - } else { - this.showBalanceSelect(newBalances); - } - } - } else { - //扫描的是小包装 - if (balances.list.length == 0) { - this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else { - //小包装库存 - let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo - .number) - //外包装库存 - let subParentPackitems = balances.list.filter(r => r.packingNumber == - packageInfo - .parentNumber&&r.locationCode==this.fromLocationCode) - - - //小包装没有库存, - if (subPackitems.length == 0) { - //外包装有库存,出库后剩余库存未转换为出库包装规格 - - if (subParentPackitems.length > 0) { - if(subParentPackitems.length==1){ - let balance = subParentPackitems[0]; - balance.qty=packageInfo.qty; - result.balance =balance; - this.afterGetBalance(result); - }else { - this.showBalanceSelect(subParentPackitems); - } - - } else { - this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' + - packageInfo.number + '】都未查找到库存余额') - } - } else { - var locationCode = this.fromLocationCode - if(balances.list==1){ - locationCode=balances.list[0].locationCode - }else { - var manyBlances = balances.list.filter(r=>r.locationCode!=this.fromLocationCode) - if(manyBlances.length>0){ - locationCode = manyBlances[0].locationCode; - } - } - this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' + - locationCode + - '】已经有库存余额,请重新扫描') - } - - - } - } - - }) - - }, - - showBalanceSelect(items) { - this.$refs.balanceSelect.openPopup(items); - }, - selectBalanceItem(balance) { - this.resultData.balance =balance; - this.afterGetBalance(this.resultData); + getScanResult(result) { + this.setData(result); }, - afterGetBalance(result){ + setData(result) { let balance = result.balance; let label = result.label; let pack = result.package; - let packUnit = pack.packUnit; - let packQty =pack.packQty + if(this.fromLocationCode&&this.fromLocationCode!=balance.locationCode){ + this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位["+this.fromLocationCode+"]没有库存余额") + return; + } + var item = this.detailSource.find(res => { if (res.itemCode == balance.itemCode) { return res } }) - if (this.fromWarehouseCode == '') { - this.fromWarehouseCode = balance.warehouseCode; - } if (item == undefined) { - + if (this.itemCode != "" && this.itemCode != balance.itemCode) { + this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码") + return; + } + if (this.fromWarehouseCode == '') { + this.fromWarehouseCode = balance.warehouseCode; + } var itemp = createItemInfo(balance, pack); let newDetail = createDetailInfo(balance, pack); // newDetail.parentNumber =pack.parentNumber; newDetail.packingNumber =pack.number - newDetail.packUnit =packUnit; - newDetail.packQty=packQty; + newDetail.packUnit =pack.packUnit; + newDetail.packQty=pack.packQty; itemp.subList.push(newDetail); this.detailSource.push(itemp) - calcHandleQty(this.detailSource); - + this.itemCode = balance.itemCode; + this.fromLocationCode =balance.locationCode + this.scanPopupGetFocus() } else { var detail = item.subList.find(r => { - if (r.packingNumber == pack.number && + if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { @@ -324,20 +250,23 @@ } }) if (detail == undefined) { - let newDetail = createDetailInfo(balance, pack); - newDetail.parentNumber =pack.parentNumber; - newDetail.packingNumber =pack.number - newDetail.packUnit =packUnit; - newDetail.packQty=packQty; - item.subList.push(newDetail); - calcHandleQty(this.detailSource); + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber =pack.parentNumber; + newDetail.packingNumber =pack.number + newDetail.packUnit =pack.packUnit; + newDetail.packQty=pack.packQty; + item.subList.push(newDetail); + this.scanPopupGetFocus() } else { if (detail.scaned == true) { - this.showErrorMessage("箱码[" + detail.packingNumber + "]批次[" + balance.batch + "]已经在列表中") + this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") } } } + calcHandleQty(this.detailSource); }, + + showErrorMessage(message) { this.$refs.comMessage.showErrorMessage(message, res => { @@ -374,27 +303,22 @@ }, 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.scanLocationCode.openScanPopup(); - }) - }, closeScanPopup() { - if (this.$refs.scanPopup != undefined) { + if (this.$refs.scanPopup) { this.$refs.scanPopup.closeScanPopup(); } }, scanPopupGetFocus() { - if (this.$refs.scanPopup != undefined) { + if (this.$refs.scanPopup) { this.$refs.scanPopup.getfocus(); } }, @@ -522,13 +446,6 @@ closeScanMessage() { this.scanPopupGetFocus(); }, - getLocation(location, code) { - this.getFromLocationCode(location, code) - }, - getFromLocationCode(location, code) { - this.fromLocationCode = code; - this.openScanPopup(); - }, getToLocationCode(location, code) { if (this.fromLocationCode == code) { uni.showToast({