diff --git a/src/pages/repleinsh/coms/comScanReplishPack.vue b/src/pages/repleinsh/coms/comScanReplishPack.vue index b65006d4..58a21ce1 100644 --- a/src/pages/repleinsh/coms/comScanReplishPack.vue +++ b/src/pages/repleinsh/coms/comScanReplishPack.vue @@ -84,7 +84,7 @@ import { getWorkShopLineStation, getBalanceByFilter, - getBalanceByParams + getBalanceByParams, } from '@/api/request2.js'; import { @@ -142,7 +142,9 @@ defaultValueList: [], label: {}, fromInventoryStatuses: "", - packageInfo: {} + packageInfo: {}, + toLocationAreaTypeList:[] + } }, created() { @@ -194,6 +196,7 @@ that.fromInventoryStatuses = this.jobContent.outInventoryStatuses that.toLocation = that.dataContent[0]; that.toLocationCode = that.dataContent[0].toLocationCode; + that.toLocationAreaTypeList=getDirectoryItemArray(this.jobContent.toAreaTypes) // that.fromLocationList = that.getFromLocationList(); } }, @@ -250,16 +253,74 @@ this.$refs.comMessage.showQuestionMessage( `扫描物料包装【${result.package.packUnit}】与任务推荐包装规格【${item.packUnit}】不一致.是否要继续发料?`, res => { if (res) { - this.onScanResult(result) + this.getToLocationBalance(result) } }); } else { - this.onScanResult(result) + this.getToLocationBalance(result) } } }, + + //查询到目标库位的库存余额 + getToLocationBalance(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, + } + getBalanceByFilter(params).then(res => { + uni.hideLoading() + if (res.data.list.length > 0) { + this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); + } else { + this.queryBalance(result); + } + // callback(res.data) + }).catch(err => { + this.showErrorMessage(err.message); + }) + }, - onScanResult(result) { + queryBalance(result) { try { let that = this; // if (that.fromLocationCode == '') {