diff --git a/src/pages/issue/coms/comScanIssuePack.vue b/src/pages/issue/coms/comScanIssuePack.vue index a1f76bd6..059bd52e 100644 --- a/src/pages/issue/coms/comScanIssuePack.vue +++ b/src/pages/issue/coms/comScanIssuePack.vue @@ -10,12 +10,12 @@ - + @@ -147,7 +147,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() } } @@ -155,24 +155,24 @@ const showBalanceSelect = (items) => { balanceSelectRef.value.openPopup(items) } -const getFromLocationList = () => { - let list = [] - dataContent.value.forEach((location) => { - location.Items.forEach((item) => { - item.Locations.forEach((f) => { - const item = list.find((l) => l == f.fromLocationCode) - if (item == undefined) { - list.push(f.fromLocationCode) - } - }) - }) - }) - - // 去掉重复库位 - list = uniqueArray(list) - fromLocationCode.value = list[0] - return list -} +// const getFromLocationList = () => { +// let list = [] +// dataContent.value.forEach((location) => { +// location.Items.forEach((item) => { +// item.Locations.forEach((f) => { +// const item = list.find((l) => l == f.fromLocationCode) +// if (item == undefined) { +// list.push(f.fromLocationCode) +// } +// }) +// }) +// }) +// +// // 去掉重复库位 +// list = uniqueArray(list) +// fromLocationCode.value = list[0] +// return list +// } const fromLocationUpdate = (fromlocation) => { const location = fromLocationList.value.find((r) => r == fromlocation) @@ -183,12 +183,12 @@ const fromLocationUpdate = (fromlocation) => { } const onScanResult = (result) => { try { - if (fromLocationCode.value == '') { - showErrorMessage('请选择来源库位', (res) => { - toLocationCombox.value.onFocus() - }) - return - } + // if (fromLocationCode.value == '') { + // showErrorMessage('请选择来源库位', (res) => { + // toLocationCombox.value.onFocus() + // }) + // return + // } const packageInfoParams = result.package const { itemCode } = result.label const packingCode = result.label.packingNumber @@ -384,51 +384,7 @@ const onScan = (result) => { } } } -const onScanResult1 = (result) => { - try { - if (fromLocationCode.value == '') { - showErrorMessage('请选择来源库位', (res) => { - toLocationCombox.value.onFocus() - }) - return - } - label.value = result.package - // let packageInfo = 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 - } - // 查找库存信息 - proxy.$modal.loading('加载中') - getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value, (balanceRes) => { - if (balanceRes.success) { - if (balanceRes.data.list.length == 0) { - showErrorMessage(`在来源库位[${fromLocationCode.value}],未查找到该包装的库存记录`, (res) => { - packGetFocus() - }) - } else if (balanceRes.data.list.length == 1) { - const balance = balanceRes.data.list[0] - afterGetBalance(result.label, balance, packageInfo.value) - } else { - showBalanceSelect(balanceRes.data.list) - } - } else { - showErrorMessage(balanceRes.message) - } - uni.hideLoading() - }) - } catch (e) { - showErrorMessage(e.stack) - uni.hideLoading() - } -} const selectBalanceItem = (balance) => { afterGetBalance(label.value, balance, packageInfo.value) @@ -440,6 +396,7 @@ const afterGetBalance = (label, balance, packageInfo) => { const packingCode = label.packingNumber const lot = label.batch const item = toLocation.value.Items.find((r) => r.itemCode == itemCode) + fromLocationCode.value = balance.locationCode; const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value) if (fromLocation != undefined) { const batch = fromLocation.Batchs.find((r) => r.batch == lot) @@ -492,9 +449,11 @@ const afterGetBalance = (label, balance, packageInfo) => { }) } } else { - showErrorMessage(`未查找到推荐库位【${fromLocationCode.value}】的发料明细`, (res) => { - getfocus() - }) + let locaion = createLocationInfo(label, balance, packageInfo); + item.Locations.push(locaion); + // showErrorMessage(`未查找到推荐库位【${fromLocationCode.value}】的发料明细`, (res) => { + // getfocus() + // }) } } catch (e) { showErrorMessage(e.stack, (res) => { @@ -502,6 +461,20 @@ const afterGetBalance = (label, balance, packageInfo) => { }) } } +//增加实际扫描的明细 +const createLocationInfo = (label, balance, packageInfo)=> { + let location = { + fromLocationCode: balance.locationCode, + qty: balance.qty, + uom: balance.uom, + handleQty: 0, + Batchs: [] + } + let batch = createBatchInfo(label, balance, packageInfo); + batch.detail = balance; + location.Batchs.push(batch); + return location; +} const createBatchInfo = (data, balance, packageInfo) => { const batch = {