From 944073e0aab1b2f1823c88c2b5a6fdc8bc1bc34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BF=97=E5=9B=BD?= <854933521@qq.com> Date: Mon, 28 Oct 2024 15:01:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A5=E6=96=99=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=9A=84=E6=8E=A8=E8=8D=90=202024/8/7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repleinsh/coms/comRepleishDetailCard.vue | 3 +- .../repleinsh/coms/comScanReplishPack.vue | 386 +++++++++++------- src/pages/repleinsh/job/repleinshDetail.vue | 2 +- src/pages/repleinsh/job/repleinshJob.vue | 2 +- 4 files changed, 238 insertions(+), 155 deletions(-) diff --git a/src/pages/repleinsh/coms/comRepleishDetailCard.vue b/src/pages/repleinsh/coms/comRepleishDetailCard.vue index c09cbb0e..edd3a1d1 100644 --- a/src/pages/repleinsh/coms/comRepleishDetailCard.vue +++ b/src/pages/repleinsh/coms/comRepleishDetailCard.vue @@ -26,7 +26,8 @@ 外包装 {{ record.parentPackingNumber }} --> - + + diff --git a/src/pages/repleinsh/coms/comScanReplishPack.vue b/src/pages/repleinsh/coms/comScanReplishPack.vue index 363a270a..e4de0f38 100644 --- a/src/pages/repleinsh/coms/comScanReplishPack.vue +++ b/src/pages/repleinsh/coms/comScanReplishPack.vue @@ -8,12 +8,12 @@ 关闭 - - 来源库位 - - - - + + + + + + @@ -56,13 +56,13 @@ import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import { getDetailOption, getDetailEditRemoveOption, getDetailGiveupOption } from '@/common/array.js' -import { getWorkShopLineStation, getBalanceByFilter } from '@/api/request2.js' +import { getWorkShopLineStation, getBalanceByFilter, getBalanceByParams } from '@/api/request2.js' import { calc } from '@/common/calc.js' import { uniqueArray } from '@/common/basic.js' import { getBalanceByManagementPrecision } from '@/common/balance.js' -import { getDirectoryItemArray } from '../../../common/directory.js' +import { getDirectoryItemArray,getInventoryStatusDesc,getListLocationAreaTypeDesc } from '../../../common/directory.js' import { getLabelInfo } from '@/common/label.js' const props = defineProps({ @@ -137,7 +137,7 @@ const initData = () => { fromInventoryStatuses.value = jobContent.value.outInventoryStatuses toLocation.value = dataContent.value[0] toLocationCode.value = dataContent.value[0].toLocationCode - fromLocationList.value = getFromLocationList() + // fromLocationList.value = getFromLocationList() } } @@ -145,27 +145,27 @@ const showBalanceSelect = (items) => { balanceSelectRef.value.openPopup(items) } -const getFromLocationList = () => { - const list = [] - const location = dataContent.value.find((r) => r.toLocationCode == toLocationCode.value) - if (location != undefined) { - location.Items.forEach((item) => { - item.Locations.forEach((f) => { - list.push(f.fromLocationCode) - }) - }) - // 去掉重复库位 - list = uniqueArray(list) - fromLocationCode.value = list[0] - return list - } - comMessageRef.value.showErrorMessages(`需求库位【${toLocationCode.value}】不存在`, (res) => { - if (res) { - scanMsg.value = '' - getfocus() - } - }) -} +// const getFromLocationList = () => { +// let list = [] +// const location = dataContent.value.find((r) => r.toLocationCode == toLocationCode.value) +// if (location != undefined) { +// location.Items.forEach((item) => { +// item.Locations.forEach((f) => { +// list.push(f.fromLocationCode) +// }) +// }) +// // 去掉重复库位 +// list = uniqueArray(list) +// fromLocationCode.value = list[0] +// return list +// } +// comMessageRef.value.showErrorMessages(`需求库位【${toLocationCode.value}】不存在`, (res) => { +// if (res) { +// scanMsg.value = '' +// getfocus() +// } +// }) +// } const fromLocationUpdate = (fromlocation) => { const location = fromLocationList.value.find((r) => r == fromlocation) @@ -174,15 +174,41 @@ const fromLocationUpdate = (fromlocation) => { showErrorMessage(`发料库位【${fromlocation}】不存在`) } } - -const onScan = (result) => { - try { - if (fromLocationCode.value == '') { - showErrorMessage('请选择来源库位', (res) => { - toLocationCombox.value.onFocus() - }) +const onScan = (result)=> { + if (!result.package) { + this.showErrorMessage('扫描数据错误[' + result.label.code + "]", + res => { + getfocus(); + } + ) + return; + } + if (toLocation.value && result.package.packUnit) { + let item = toLocation.value.Items.find(r => r.itemCode == result.package.itemCode); + if (!item) { + showErrorMessage('扫描物料代码不属于该任务'); return } + if (result.package.packUnit !== item.packUnit) { + comMessageRef.value.showQuestionMessage( + `扫描物料包装【${result.package.packUnit}】与任务推荐包装规格【${item.packUnit}】不一致.是否要继续发料?`, res => { + if (res) { + onScanResult(result) + } + }); + } else { + onScanResult(result) + } + } +} +const onScanResult = (result) => { + try { + // if (fromLocationCode.value == '') { + // showErrorMessage('请选择来源库位', (res) => { + // toLocationCombox.value.onFocus() + // }) + // return + // } const packageInfoParams = result.package const { itemCode } = result.label const packingCode = result.label.packingNumber @@ -194,129 +220,168 @@ const onScan = (result) => { }) return } + + 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: '加载中', + title: '查询中', mask: true }) - - getBalance(result.label, packageInfoParams, (balances) => { - packageInfo.value = packageInfoParams - // 扫描的是外包装 - const s = '' - if (!result.package.parentNumber) { - if (balances.list.length == 0) { - showErrorMessage('未查找到该包装的库存信息,请重新扫描') + getBalanceByParams(params).then(res => { + if (res.data.length == 0) { + let status = getInventoryStatusDesc(params.inventoryStatus) + let areaType = getListLocationAreaTypeDesc(params.areaType) + let hint = + "按物料号 [" + params.itemCode + "]
" + + "包装号 [" + params.packingNumber + "]
" + + "批次 [" + params.batch + "]
" + + "状态 [" + status + "]
" + + "库区 [" + areaType + "]
" + + "未查找到库存余额" + showErrorMessage(hint) + } else if (res.data.length == 1) { + result.balance = res.data[0] + + if (result.label.packingNumber != result.balance.packingNumber) { + result.balance.handleQty = Number(result.label.qty) } else { - const newBalances = balances.list.filter((b) => b.locationCode == that.fromLocationCode) - if (newBalances.length == 0) { - showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else if (newBalances.length == 1) { - const balance1 = newBalances[0] - afterGetBalance(result.label, balance1, packageInfoParams) - } else { - showBalanceSelect(newBalances) - } + result.balance.handleQty = Number(result.balance.qty) } + afterGetBalance(result.label, result.balance, result.package); } 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, packageInfoParams) - } 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}】已经有库存余额,请重新扫描`) - } - } + //多条记录 + balanceSelectRef.value.openPopup(res.data); } uni.hideLoading() + }).catch(error => { + uni.hideLoading() + showErrorMessage(error) }) + // 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 == that.fromLocationCode) + // if (newBalances.length == 0) { + // showErrorMessage('未查找到该包装的库存信息,请重新扫描') + // } else if (newBalances.length == 1) { + // const balance1 = newBalances[0] + // afterGetBalance(result.label, balance1, 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, packageInfoParams) + // } 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 getBalance = (labelParams, packageInfo, callback) => { - const filters = [] - if (packageInfo.parentNumber) { - const packingNumber = `${packageInfo.parentNumber},${labelParams.packingNumber}` - filters.push({ - column: 'packingNumber', - action: 'in', - value: packingNumber - }) - } else { - filters.push({ - column: 'packingNumber', - action: '==', - value: labelParams.packingNumber - }) - } - filters.push({ - column: 'packingNumber', - action: '==', - value: labelParams.packingNumber - }) - filters.push({ - column: 'itemCode', - action: '==', - value: labelParams.itemCode - }) - filters.push({ - column: 'batch', - action: '==', - value: labelParams.batch - }) - - if (fromInventoryStatuses.value != null && fromInventoryStatuses.value != '') { - filters.push({ - column: 'inventoryStatus', - action: 'in', - value: fromInventoryStatuses.value - }) - } - - const params = { - filters, - pageNo: 1, - pageSize: 100 - } - getBalanceByFilter(params) - .then((res) => { - callback(res.data) - }) - .catch((err) => { - showErrorMessage(err.message) - }) -} +// const getBalance = (labelParams, packageInfo, callback) => { +// const filters = [] +// if (packageInfo.parentNumber) { +// const packingNumber = `${packageInfo.parentNumber},${labelParams.packingNumber}` +// filters.push({ +// column: 'packingNumber', +// action: 'in', +// value: packingNumber +// }) +// } else { +// filters.push({ +// column: 'packingNumber', +// action: '==', +// value: labelParams.packingNumber +// }) +// } +// filters.push({ +// column: 'packingNumber', +// action: '==', +// value: labelParams.packingNumber +// }) +// filters.push({ +// column: 'itemCode', +// action: '==', +// value: labelParams.itemCode +// }) +// filters.push({ +// column: 'batch', +// action: '==', +// value: labelParams.batch +// }) +// +// if (fromInventoryStatuses.value != null && fromInventoryStatuses.value != '') { +// filters.push({ +// column: 'inventoryStatus', +// action: 'in', +// value: fromInventoryStatuses.value +// }) +// } +// +// const params = { +// filters, +// pageNo: 1, +// pageSize: 100 +// } +// getBalanceByFilter(params) +// .then((res) => { +// callback(res.data) +// }) +// .catch((err) => { +// showErrorMessage(err.message) +// }) +// } const selectBalanceItem = (balanceParams) => { afterGetBalance(label.value, balanceParams, packageInfo.value) @@ -328,7 +393,9 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => { const packingCode = labelParams.packingNumber const lot = labelParams.batch const item = toLocation.value.Items.find((r) => r.itemCode == itemCode) + fromLocationCode.value = balanceParams.locationCode; const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value) + //如果库存余额中的库位与任务推荐的不一致 if (fromLocation != undefined) { const batch = fromLocation.Batchs.find((r) => r.batch == lot) if (batch != undefined) { @@ -377,9 +444,11 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => { }) } } else { - showErrorMessage(`未查找到推荐库位【${fromLocationCode.value}】的发料明细`, (res) => { - getfocus() - }) + let locaion = createLocationInfo(labelParams, balanceParams, packageInfo); + item.Locations.push(locaion); + // showErrorMessage(`未查找到推荐库位【${fromLocationCode.value}】的发料明细`, (res) => { + // getfocus() + // }) } } catch (e) { showErrorMessage(e.stack, (res) => { @@ -387,7 +456,20 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => { }) } } - +//增加实际扫描的明细 +const createLocationInfo = (labelParams, balanceParams, packageInfo)=> { + let location = { + fromLocationCode: balanceParams.locationCode, + qty: balanceParams.qty, + uom: balanceParams.uom, + handleQty: 0, + Batchs: [] + } + let batch = createBatchInfo(labelParams, balanceParams, packageInfo); + batch.detail = balanceParams; + location.Batchs.push(batch); + return location; +} const createBatchInfo = (labelParams, balanceParams, packageInfo) => { const batch = { batch: labelParams.batch, @@ -396,11 +478,11 @@ const createBatchInfo = (labelParams, balanceParams, packageInfo) => { Records: [] } let record = {} - if (balanceParams == null) { - record = creatRecordByBalance(labelParams, packageInfo) + if (balanceParams != null) { + record = creatRecordByBalance(balanceParams, packageInfo) batch.handleQty = Number(labelParams.qty) } else { - record = creatRecordByLabel(balanceParams, packageInfo) + record = creatRecordByLabel(labelParams, packageInfo) batch.handleQty = Number(balanceParams.qty) } batch.Records.push(record) diff --git a/src/pages/repleinsh/job/repleinshDetail.vue b/src/pages/repleinsh/job/repleinshDetail.vue index e2c29367..529f06f2 100644 --- a/src/pages/repleinsh/job/repleinshDetail.vue +++ b/src/pages/repleinsh/job/repleinshDetail.vue @@ -241,7 +241,7 @@ const setSubmitParamsAndSubmit = () => { const submitJob = () => { proxy.$modal.loading('提交中....') const params = setParams() - + return; repleinshJobSubmit(params) .then((res) => { uni.hideLoading() diff --git a/src/pages/repleinsh/job/repleinshJob.vue b/src/pages/repleinsh/job/repleinshJob.vue index 139252a4..ff3684a7 100644 --- a/src/pages/repleinsh/job/repleinshJob.vue +++ b/src/pages/repleinsh/job/repleinshJob.vue @@ -496,7 +496,7 @@ const getScanResult = (result) => { selectItem(list[0]) } } else { - showMessage(`物料号[${result.label.itemCode}]批次[${result.label.batch}]未查找到任务
` + `扫描[${result.scanMessage}]`) + showMessage(`按来源库位[${balance.locationCode}]批次[${result.label.batch}]物料号[${result.label.itemCode}]未查找到任务
` + `扫描[${result.scanMessage}]`) } }) .catch((error) => {