diff --git a/src/pages/issue/coms/comScanIssuePack.vue b/src/pages/issue/coms/comScanIssuePack.vue index 25ae3e06..c9c664dc 100644 --- a/src/pages/issue/coms/comScanIssuePack.vue +++ b/src/pages/issue/coms/comScanIssuePack.vue @@ -107,6 +107,7 @@ const detailOptions = ref([]) const comscan = ref() const balanceSelectRef = ref() const balanceQtyEditRef = ref() +const toLocationAreaTypeList = ref([]) onMounted(() => { detailOptions.value = getDetailOption() scanOptions.value = getDetailEditRemoveOption() @@ -148,6 +149,7 @@ const initData = () => { fromInventoryStatuses.value = jobContent.value.outInventoryStatuses toLocation.value = dataContent.value[0] toLocationCode.value = dataContent.value[0].toLocationCode + toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes) // fromLocationList.value = getFromLocationList() } } @@ -182,7 +184,7 @@ const fromLocationUpdate = (fromlocation) => { showErrorMessage(`发料库位【${fromlocation}】不存在`) } } -const onScanResult = (result) => { +const queryBalance = (result) => { try { // if (fromLocationCode.value == '') { // showErrorMessage('请选择来源库位', (res) => { @@ -318,15 +320,72 @@ const onScan = (result) => { if (result.package.packUnit !== item.packUnit) { comMessageRef.value.showQuestionMessage(`扫描物料包装【${result.package.packUnit}】与任务推荐包装规格【${item.packUnit}】不一致.是否要继续发料?`, (res) => { if (res) { - onScanResult(result) + getToLocationBalance(result) } }) } else { - onScanResult(result) + getToLocationBalance(result) } } } +//查询到目标库位的库存余额 +const getToLocationBalance = (result)=> { + uni.showLoading({ + title: '查询中', + mask: true + }) + let filters = [] + if (result.package.parentNumber) { + let 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: toLocationAreaTypeList.value.join(',') + }) + + + let params = { + filters: filters, + pageNo: 1, + pageSize: 100, + } + getBalanceByFilter(params).then(res => { + uni.hideLoading() + if (res.data.list.length > 0) { + showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); + } else { + queryBalance(result); + } + // callback(res.data) + }).catch(err => { + uni.hideLoading() + showErrorMessage(err.message); + }) +} const selectBalanceItem = (balance) => { afterGetBalance(label.value, balance, packageInfo.value)