From e634cd5cdd8f9271e184b05b48a5bc3cac6f5291 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Thu, 5 Sep 2024 15:25:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B4=E6=8E=A5=E5=8F=91?= =?UTF-8?q?=E6=96=99=E5=92=8C=E5=8F=91=E6=96=99=E4=BB=BB=E5=8A=A1=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=B0=8F=E5=8C=85=E8=A3=852024/7/5=2013:43:09?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request2.js | 8 + src/mycomponents/scan/winComScanBalance.vue | 190 ++++++++++++++++++ src/pages/issue/coms/comScanIssuePack.vue | 146 +++++++++++++- src/pages/issue/job/issueDetail.vue | 1 + src/pages/issue/record/directIssue.vue | 177 +++++++++++++++- .../package/record/overPackageRecord.vue | 49 +++-- .../repleinsh/coms/comScanReplishPack.vue | 22 +- 7 files changed, 559 insertions(+), 34 deletions(-) create mode 100644 src/mycomponents/scan/winComScanBalance.vue diff --git a/src/api/request2.js b/src/api/request2.js index e96d1c4c..38e6cbb6 100644 --- a/src/api/request2.js +++ b/src/api/request2.js @@ -2590,4 +2590,12 @@ export function isCheckMesCode(code) { */ export function getJimuPutawayJobDetail(data) { return http.post("/wms/jimu-report/getPutawayJobDetailForPDA",data) +} + +/** + * 查询库位,后台自己查询管理模式 + * @param {*} + */ +export function getBalanceByParams(data) { + return http.post("/wms/balance/getBalanceListByPackage",data) } \ No newline at end of file diff --git a/src/mycomponents/scan/winComScanBalance.vue b/src/mycomponents/scan/winComScanBalance.vue new file mode 100644 index 00000000..9716a450 --- /dev/null +++ b/src/mycomponents/scan/winComScanBalance.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/src/pages/issue/coms/comScanIssuePack.vue b/src/pages/issue/coms/comScanIssuePack.vue index 06c0b56a..bd35cb0f 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 } from '@/api/request2.js' +import { getWorkShopLineStation, getBalanceByFilter } from '@/api/request2.js' import { calc } from '@/common/calc.js' @@ -141,7 +141,7 @@ const closeScanPopup = () => { const initData = () => { fromLocationList.value = [] if (dataContent.value != null) { - fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses) + fromInventoryStatuses.value = jobContent.value.outInventoryStatuses toLocation.value = dataContent.value[0] toLocationCode.value = dataContent.value[0].toLocationCode fromLocationList.value = getFromLocationList() @@ -176,7 +176,146 @@ const fromLocationUpdate = (fromlocation) => { showErrorMessage(`发料库位【${fromlocation}】不存在`) } } +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 + const lot = result.label.batch + const item = toLocation.value.Items.find((r) => r.itemCode == itemCode) + if (item == undefined) { + showErrorMessage(`未查找到物料【${itemCode}】的发料明细`, (res) => { + getfocus() + }) + return + } + // 查找库存信息 + 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() + }) + } catch (e) { + showErrorMessage(e.stack) + uni.hideLoading() + } +} + +const getBalance = (label, packageInfoParams, callback) => { + const filters = [] + + if (packageInfoParams.parentNumber) { + const packingNumber = `${packageInfoParams.parentNumber},${label.packingNumber}` + filters.push({ + column: 'packingNumber', + action: 'in', + value: packingNumber + }) + } else { + filters.push({ + column: 'packingNumber', + action: '==', + value: label.packingNumber + }) + } + + filters.push({ + column: 'itemCode', + action: '==', + value: label.itemCode + }) + filters.push({ + column: 'batch', + action: '==', + value: label.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 onScan = (result) => { if (toLocation.value && result.package.packUnit) { const item = toLocation.value.Items.find((r) => r.itemCode == result.package.itemCode) @@ -191,7 +330,7 @@ const onScan = (result) => { } } } -const onScanResult = (result) => { +const onScanResult1 = (result) => { try { if (fromLocationCode.value == '') { showErrorMessage('请选择来源库位', (res) => { @@ -330,6 +469,7 @@ const creatRecord = (label, balance, packageInfo) => { scaned: true, itemCode: label.itemCode, packingNumber: label.packingNumber, + parentPackingNumber: packageInfo.parentNumber, batch: label.batch, qty: Number(balance.qty), // qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), diff --git a/src/pages/issue/job/issueDetail.vue b/src/pages/issue/job/issueDetail.vue index 0c63f16b..c777289a 100644 --- a/src/pages/issue/job/issueDetail.vue +++ b/src/pages/issue/job/issueDetail.vue @@ -247,6 +247,7 @@ const setParams = () => { record.toPackingNumber = info.packingNumber record.toBatch = info.batch } + record.fromParentPackingNumber = r.parentPackingNumber subItem.recordList.push(record) }) subList.push(deepCopyData(subItem)) diff --git a/src/pages/issue/record/directIssue.vue b/src/pages/issue/record/directIssue.vue index b0b7804f..48d06fe0 100644 --- a/src/pages/issue/record/directIssue.vue +++ b/src/pages/issue/record/directIssue.vue @@ -37,15 +37,16 @@ - + + diff --git a/src/pages/package/record/overPackageRecord.vue b/src/pages/package/record/overPackageRecord.vue index 6b501166..1ea63ff5 100644 --- a/src/pages/package/record/overPackageRecord.vue +++ b/src/pages/package/record/overPackageRecord.vue @@ -1,7 +1,7 @@ @@ -62,10 +60,10 @@