diff --git a/src/pages/issue/coms/comScanIssuePack.vue b/src/pages/issue/coms/comScanIssuePack.vue index eae32028..b552cf0a 100644 --- a/src/pages/issue/coms/comScanIssuePack.vue +++ b/src/pages/issue/coms/comScanIssuePack.vue @@ -60,7 +60,7 @@ import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import { getDetailOption, getDetailEditRemoveOption } from '@/common/array.js' -import { getWorkShopLineStation, getBalanceByFilter } from '@/api/request2.js' +import { getWorkShopLineStation, getBalanceByFilter,getBalanceByParams } from '@/api/request2.js' import { uniqueArray } from '@/common/basic.js' import { calc } from '@/common/calc.js' @@ -99,6 +99,7 @@ const label = ref({}) const inputStyleObject = ref({ fontSize: '100rpx' }) +const bussinessCode = ref('Issue') const toLocationCombox = ref() const comscansimulate = ref() const comMessageRef = ref() @@ -155,7 +156,7 @@ const showBalanceSelect = (items) => { } const getFromLocationList = () => { - const list = [] + let list = [] dataContent.value.forEach((location) => { location.Items.forEach((item) => { item.Locations.forEach((f) => { @@ -198,78 +199,116 @@ const onScanResult = (result) => { getfocus() }) return + }else { + queryBalance(result) } - // 查找库存信息 - uni.showLoading({ - title: '加载中', - mask: true - }) - - getBalance(result.label, packageInfoParams, (balances) => { - packageInfo.value = packageInfoParams - // 扫描的是外包装 - const s = '' - if (!result.package.parentNumber) { - if (balances.list.length == 0) { - showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else { - const newBalances = balances.list.filter((b) => b.locationCode == fromLocationCode.value) - if (newBalances.length == 0) { - showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else if (newBalances.length == 1) { - const balance = newBalances[0] - afterGetBalance(result.label, balance, packageInfoParams) - } else { - showBalanceSelect(newBalances) - } - } - } else { - // 扫描的是小包装 - if (balances.list.length == 0) { - showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else { - // 小包装库存 - const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number) - // 外包装库存 - const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value) - - // 小包装没有库存, - if (subPackitems.length == 0) { - // 外包装有库存,出库后剩余库存未转换为出库包装规格 - - if (subParentPackitems.length > 0) { - if (subParentPackitems.length == 1) { - const balance = subParentPackitems[0] - balance.qty = packageInfoParams.qty - afterGetBalance(result.label, balance, packageInfo) - } else { - showBalanceSelect(subParentPackitems) - } - } else { - showErrorMessage(`按外包装【${packageInfoParams.parentNumber}】和子包装【${packageInfoParams.number}】都未查找到库存余额`) - } - } else { - let locationCode = fromLocationCode.value - if (balances.list == 1) { - locationCode = balances.list[0].locationCode - } else { - const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value) - if (manyBlances.length > 0) { - locationCode = manyBlances[0].locationCode - } - } - showErrorMessage(`该包装【${packageInfoParams.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) - } - } - } - uni.hideLoading() - }) + // getBalance(result.label, packageInfoParams, (balances) => { + // packageInfo.value = packageInfoParams + // // 扫描的是外包装 + // const s = '' + // if (!result.package.parentNumber) { + // if (balances.list.length == 0) { + // showErrorMessage('未查找到该包装的库存信息,请重新扫描') + // } else { + // const newBalances = balances.list.filter((b) => b.locationCode == fromLocationCode.value) + // if (newBalances.length == 0) { + // showErrorMessage('未查找到该包装的库存信息,请重新扫描') + // } else if (newBalances.length == 1) { + // const balance = newBalances[0] + // afterGetBalance(result.label, balance, packageInfoParams) + // } else { + // showBalanceSelect(newBalances) + // } + // } + // } else { + // // 扫描的是小包装 + // if (balances.list.length == 0) { + // showErrorMessage('未查找到该包装的库存信息,请重新扫描') + // } else { + // // 小包装库存 + // const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number) + // // 外包装库存 + // const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value) + // + // // 小包装没有库存, + // if (subPackitems.length == 0) { + // // 外包装有库存,出库后剩余库存未转换为出库包装规格 + // + // if (subParentPackitems.length > 0) { + // if (subParentPackitems.length == 1) { + // const balance = subParentPackitems[0] + // balance.qty = packageInfoParams.qty + // afterGetBalance(result.label, balance, packageInfo) + // } else { + // showBalanceSelect(subParentPackitems) + // } + // } else { + // showErrorMessage(`按外包装【${packageInfoParams.parentNumber}】和子包装【${packageInfoParams.number}】都未查找到库存余额`) + // } + // } else { + // let locationCode = fromLocationCode.value + // if (balances.list == 1) { + // locationCode = balances.list[0].locationCode + // } else { + // const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value) + // if (manyBlances.length > 0) { + // locationCode = manyBlances[0].locationCode + // } + // } + // showErrorMessage(`该包装【${packageInfoParams.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) + // } + // } + // } + // uni.hideLoading() + // }) } catch (e) { showErrorMessage(e.stack) uni.hideLoading() } } - +const queryBalance = (result)=>{ + var params = { + itemCode: result.package.itemCode, + batch: result.label.batch, + packingNumber: result.label.packingNumber, + parentPackingNumber: result.package.parentNumber, + inventoryStatus: jobContent.value.outInventoryStatuses.split(','), + areaType:jobContent.value.fromAreaTypes.split(','), + bussinessCode:jobContent.value.businessType + } + uni.showLoading({ + title: '查询中', + mask: true + }) + getBalanceByParams(params).then(res => { + if (res.data.length == 0) { + var status = getInventoryStatusDesc(params.inventoryStatus) + var areaType = getListLocationAreaTypeDesc(params.areaType) + var hint = + "按物料号 [" + params.itemCode + "]
" + + "包装号 [" + params.packingNumber + "]
" + + "批次 [" + params.batch + "]
" + + "状态 [" + status + "]
" + + "库区 [" + areaType + "]
" + + "未查找到库存余额" + this.showErrorMessage(hint) + } else if (res.data.length == 1) { + + result.balance = res.data[0] + if (result.label.packingNumber != result.balance.packingNumber) { + result.balance.lableQty = result.label.qty + } + this.afterGetBalance(result.label, result.balance, result.package); + } else { + //多条记录 + this.$refs.balanceSelect.openPopup(res.data); + } + uni.hideLoading() + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) +} const getBalance = (label, packageInfoParams, callback) => { const filters = [] diff --git a/src/pages/issue/job/issueDetail.vue b/src/pages/issue/job/issueDetail.vue index 5d882afc..d9a1c097 100644 --- a/src/pages/issue/job/issueDetail.vue +++ b/src/pages/issue/job/issueDetail.vue @@ -20,6 +20,7 @@ --> + @@ -56,6 +57,7 @@ import winScanButton from '@/mycomponents/scan/winScanButton.vue' import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' import jobTop from '@/mycomponents/job/jobTop.vue' import workStation from '@/mycomponents/workStation/workStation.vue' +import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() diff --git a/src/pages/issue/job/issueJob.vue b/src/pages/issue/job/issueJob.vue index b7ae5303..0838c4af 100644 --- a/src/pages/issue/job/issueJob.vue +++ b/src/pages/issue/job/issueJob.vue @@ -13,7 +13,8 @@ - + + @@ -26,7 +27,9 @@ import { cancleTakeIssueJob, getIssueJobList, getIssueJobByProductionline, close import { goHome, updateTitle } from '@/common/basic.js' import { getDetailOption, getDetailGiveupOption, getDetailCloseOption } from '@/common/array.js' - +import { + getBusinessType +} from '@/common/record.js'; import comEmptyView from '@/mycomponents/common/comEmptyView.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue' import comIssueJobCard from '@/pages/issue/coms/comIssueJobCard.vue' @@ -36,7 +39,7 @@ import jobInfoPopup from '@/pages/issue/coms/jobInfoPopup.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPackJob from '@/mycomponents/scan/winScanPackJob.vue' import jobListView from '@/mycomponents/jobList/jobList.vue' - +import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() @@ -65,6 +68,10 @@ const jobInfoPopupRef = ref() const jobListPopupRef = ref() const scanPopup = ref() const jobListRef = ref() +const businessTypeCode = ref('Issue') +const businessType = ref(null) +const fromInventoryStatuses = ref() +const fromLocationAreaTypeList = ref([]) onShow(() => { nextTick(() => { getList('refresh', fromLocation.value, productionLine.value) @@ -106,6 +113,18 @@ onNavigationBarButtonTap((e) => { filter.value.openFilter() } }) +const getBusinessTypeFunc = ()=> { + getBusinessType(businessTypeCode.value, res => { + if (res.success) { + businessType.value = res.businessType; + fromInventoryStatuses.value = res.fromInventoryStatuses.split(','); + fromLocationAreaTypeList.value = res.fromLocationAreaTypeList + // this.openScanPopup(); + } else { + showErrorMessage(res.message) + } + }); +} const getIssueJobByProductionline1 = () => { getIssueJobByProductionline().then((res) => { console.log('生产线', res) @@ -372,67 +391,81 @@ const showMessage = (message) => { } const openScanPopup = () => { scanPopup.value.openScanPopup() + if (businessType.value == null) { + getBusinessTypeFunc() + } else { + scanPopup.value.openScanPopup(businessType.value); + } } const getScanResult = (result) => { - if (!result.label.batch) { - showMessage('批次为空') - return - } - if (!result.label.itemCode) { - showMessage('物料号为空') - return - } - try { - const filters = [ - { - column: 'status', - action: 'in', - value: '1,2' - }, - { - column: 'batch', - action: '==', - value: result.label.batch - }, - { - column: 'itemCode', - action: '==', - value: result.label.itemCode - } - ] - getIssueJobList({ - filters, - pageNo: 1, - pageSize: 1000, - sort: 'createTime', - by: 'asc' - }) - .then((res) => { - scanMessage.value = result.scanMessage - const resultList = res.data.list - if (resultList.length > 0) { - resultList.forEach((item) => { - item.title = item.number - item.selected = false - }) - const list = [] - resultList.forEach((item) => { - if (!list.find((subItem) => subItem.title == item.title)) { - list.push(item) - } - }) - if (list.length > 0) { - selectItem(list[0]) - } - } else { - showMessage(`物料号[${result.label.itemCode}]批次[${result.label.batch}]` + '未查找到任务
' + `扫描[${result.scanMessage}]`) + let balance = result.balance; + if (balance != null) { + scanMessage.value = "" + if (!result.label.batch) { + showMessage('批次为空') + return + } + if (!result.label.itemCode) { + showMessage('物料号为空') + return + } + try { + const filters = [ + { + column: 'status', + action: 'in', + value: '1,2' + }, + { + column: 'batch', + action: '==', + value: result.label.batch + }, + { + column: 'itemCode', + action: '==', + value: result.label.itemCode + }, + { + column: "fromLocationCode", + action: "==", + value: balance.locationCode } + ] + getIssueJobList({ + filters, + pageNo: 1, + pageSize: 1000, + sort: 'createTime', + by: 'asc' }) - .catch((error) => { - showMessage(`${error}
扫描[${result.scanMessage}]`) - }) - } catch (e) { - showMessage(e.message) + .then((res) => { + scanMessage.value = result.scanMessage + const resultList = res.data.list + if (resultList.length > 0) { + resultList.forEach((item) => { + item.title = item.number + item.selected = false + }) + const list = [] + resultList.forEach((item) => { + if (!list.find((subItem) => subItem.title == item.title)) { + list.push(item) + } + }) + if (list.length > 0) { + selectItem(list[0]) + } + } else { + showMessage(`物料号[${result.label.itemCode}]批次[${result.label.batch}]` + '未查找到任务
' + `扫描[${result.scanMessage}]`) + } + }) + .catch((error) => { + showMessage(`${error}
扫描[${result.scanMessage}]`) + }) + } catch (e) { + showMessage(e.message) + } } } diff --git a/src/pages/repleinsh/job/repleinshJob.vue b/src/pages/repleinsh/job/repleinshJob.vue index 97c8dd09..828c18a0 100644 --- a/src/pages/repleinsh/job/repleinshJob.vue +++ b/src/pages/repleinsh/job/repleinshJob.vue @@ -415,7 +415,7 @@ const getBusinessTypeFunc = ()=> { getBusinessType(this.businessTypeCode, res => { if (res.success) { this.businessType = res.businessType; - this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses); + this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses).split(','); this.fromLocationAreaTypeList = res.fromLocationAreaTypeList // this.openScanPopup(); } else {