diff --git a/src/pages/issue/coms/comScanIssuePack.vue b/src/pages/issue/coms/comScanIssuePack.vue index b3be171d..830c4016 100644 --- a/src/pages/issue/coms/comScanIssuePack.vue +++ b/src/pages/issue/coms/comScanIssuePack.vue @@ -177,7 +177,8 @@ inputStyleObject: { fontSize: "100rpx" }, - bussinessCode: 'Issue' + bussinessCode: 'Issue', + toLocationAreaTypeList:[] } }, created() { @@ -232,6 +233,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(); } }, @@ -266,7 +268,7 @@ } }, - onScanResult(result) { + queryBalance(result) { try { let that = this; // if (that.fromLocationCode == '') { @@ -408,14 +410,73 @@ 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 => { + uni.hideLoading() + this.showErrorMessage(err.message); + }) + }, selectBalanceItem(balance) { this.afterGetBalance(this.label, balance, this.packageInfo);