diff --git a/src/mycomponents/scan/winComScanBalance.vue b/src/mycomponents/scan/winComScanBalance.vue index 148baaf9..04d835e2 100644 --- a/src/mycomponents/scan/winComScanBalance.vue +++ b/src/mycomponents/scan/winComScanBalance.vue @@ -131,7 +131,8 @@ } this.getItemCodeType(result.package.itemCode, callBack => { if(this.isCheckLocationBalance){ - this.getToLocationBalance(this.resultData) + // this.getToLocationBalance(this.resultData) + this.queryBalance(this.resultData); }else { this.queryBalance(this.resultData) } diff --git a/src/pages/productPutaway/record/productPutawayRecord.vue b/src/pages/productPutaway/record/productPutawayRecord.vue index adec98a1..9d78225b 100644 --- a/src/pages/productPutaway/record/productPutawayRecord.vue +++ b/src/pages/productPutaway/record/productPutawayRecord.vue @@ -50,7 +50,8 @@ import { productPutawayRecordSubmit, getrecommendLocationExpectin, - recommendLocationRemoveExpectin + recommendLocationRemoveExpectin, + getBalanceByFilter } from '@/api/request2.js'; import { goHome, @@ -58,7 +59,8 @@ deepCopyData } from '@/common/basic.js'; import { - getPrecisionStrategyList + getPrecisionStrategyList, + getManagementPrecisions } from '@/common/balance.js'; import { @@ -72,6 +74,10 @@ createDetailInfo, calcHandleQty } from '@/common/record.js'; + + import { + calc + } from '@/common/calc.js'; import winScanButton from '@/mycomponents/scan/winScanButton.vue' import requiredLocation from '@/mycomponents/location/requiredLocation.vue' @@ -152,7 +158,7 @@ this.setData(result); }, - setData(result) { + async setData(result) { let balance = result.balance; let label = result.label; let pack = result.package; @@ -179,12 +185,11 @@ this.detailSource.push(itemp) this.itemCode = balance.itemCode; this.fromLocationCode = balance.locationCode - this.getRecommendLocation(balance) - this.scanPopupGetFocus() + await this.getRecommendLocation(balance,result) + await this.scanPopupGetFocus() } else { var detail = item.subList.find(r => { - if (r.packingNumber == pack.number && - r.batch == balance.batch && + if (r.batch == balance.batch && r.fromLocationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { return r; @@ -265,14 +270,15 @@ this.scanPopupGetFocus() } else { if (detail.scaned == true) { - this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") + detail.handleQty = calc.add(detail.handleQty,result.label.qty) + // this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") } } } calcHandleQty(this.detailSource); }, - getRecommendLocation(balance) { + async getRecommendLocation(balance,result) { uni.showLoading({ title: '扫描中...', mask: true @@ -285,22 +291,88 @@ batch: balance.batch }; console.log(JSON.stringify(param)) - getrecommendLocationExpectin(param).then(result => { + await getrecommendLocationExpectin(param).then(async result1 => { uni.hideLoading(); let item = this.detailSource.find(res => { if (res.itemCode == balance.itemCode) { return res } }) - item.toLocationCode = result.data.code; - item.expectinNumber = result.data.expectinNumber; + item.toLocationCode = result1.data.code; + item.expectinNumber = result1.data.expectinNumber; + await this.getToLocationBalance(item.toLocationCode,result) this.$forceUpdate(); }).catch(error => { uni.hideLoading() this.showErrorMessage(error); }) }, + //查询到目标库位的库存余额 + async getToLocationBalance(toLocationCode,result) { + uni.showLoading({ + title: '查询中', + mask: true + }) + var filters = [] + if (result.package.parentNumber) { + var packingNumber = result.package.parentNumber + "," + result.package.number; + filters.push({ + column: "packingNumber", + action: "in", + value: packingNumber + }) + } else { + filters.push({ + column: "packingNumber", + action: "==", + value: result.package.number + }) + } + + filters.push({ + column: "itemCode", + action: "==", + value: result.package.itemCode + }) + filters.push({ + column: "batch", + action: "==", + value: result.package.batch + }) + + filters.push({ + column: "areaType", + action: "in", + value: this.toLocationAreaTypeList.join(',') + }) + + var params = { + filters: filters, + pageNo: 1, + pageSize: 100, + } + await getManagementPrecisions([result.package.itemCode], toLocationCode,async res => { + if (res.success) { + this.managementList = res.list; + this.managementType = this.managementList.some(item => item.ManagementPrecision == 'BY_BATCH') ? 'BY_BATCH' : '' + if(this.managementType == 'BY_BATCH'){ + uni.hideLoading() + }else{ + await getBalanceByFilter(params).then(res => { + uni.hideLoading() + if (res.data.list.length > 0) { + this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); + } + // callback(res.data) + }).catch(err => { + this.showErrorMessage(err.message); + }) + } + } + }) + + }, //移除推荐的预占用库位 removeRecommendLocation(lst) { let param = { @@ -348,6 +420,7 @@ openScanPopup() { if (this.businessType) { + this.toLocationAreaTypeList = getDirectoryItemArray(this.businessType.inAreaTypes) this.$refs.scanPopup.openScanPopup(this.businessType); } else { this.getBusinessType()