From ac5f44c92c76215833e3e22990903d0b70e1cd15 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 17:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=8F=91=E6=96=99=E4=B8=8D?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E6=9D=A5=E6=BA=90=E5=BA=93=E4=BD=8D=202024/8?= =?UTF-8?q?/8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../record/recordComDetailCard.vue | 7 +- src/pages/issue/record/directIssue.vue | 299 ++------ src/pages/issue/record/directIssue2.vue | 718 ++++++++++++++++++ 3 files changed, 807 insertions(+), 217 deletions(-) create mode 100644 src/pages/issue/record/directIssue2.vue diff --git a/src/mycomponents/record/recordComDetailCard.vue b/src/mycomponents/record/recordComDetailCard.vue index 7e71892b..be1e5786 100644 --- a/src/mycomponents/record/recordComDetailCard.vue +++ b/src/mycomponents/record/recordComDetailCard.vue @@ -7,7 +7,7 @@ - + @@ -57,7 +57,10 @@ const props = defineProps({ type: Boolean, default: true }, - + isShowParentToLocation: { + type: Boolean, + default: true + }, isShowBalanceQty: { type: Boolean, default: false diff --git a/src/pages/issue/record/directIssue.vue b/src/pages/issue/record/directIssue.vue index eb5ebad4..bacd8b01 100644 --- a/src/pages/issue/record/directIssue.vue +++ b/src/pages/issue/record/directIssue.vue @@ -1,7 +1,7 @@ @@ -67,6 +65,7 @@ import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.v import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' +import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() @@ -104,22 +103,24 @@ const fgLocationCode = ref('') const managementList = ref([]) const resultData = ref({}) const balanceSelectRef = ref() - +const itemCode = ref('') +const fromInventoryStatuses = ref('') onLoad((option) => { uni.setNavigationBarTitle({ title: option.title }) clearData() - getBusinessType(businessTypeCode.value, (res) => { - if (res.success) { - businessType.value = res.businessType - fromLocationAreaTypeList.value = res.fromLocationAreaTypeList - toLocationAreaTypeList.value = res.toLocationAreaTypeList - showFromLocationPopup() - } else { - showErrorMessage(res.message) - } - }) + getBusinessType() + // getBusinessType(businessTypeCode.value, (res) => { + // if (res.success) { + // businessType.value = res.businessType + // fromLocationAreaTypeList.value = res.fromLocationAreaTypeList + // toLocationAreaTypeList.value = res.toLocationAreaTypeList + // showFromLocationPopup() + // } else { + // showErrorMessage(res.message) + // } + // }) // if (this.positionList.length == 0) { getWorkShopLineStation() @@ -135,218 +136,95 @@ onLoad((option) => { }) // } }) + // 返回首页 onNavigationBarButtonTap((e) => { if (e.index === 0) { goHome() } }) -const getBalance = (label, packageInfo, callback) => { - const filters = [] - - if (packageInfo.parentNumber) { - const packingNumber = `${packageInfo.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 getScanResult = (result) => { - resultData.value = result - const packageInfo = result.package - getBalance(result.label, packageInfo, (balances) => { - // 扫描的是外包装 - 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] - result.balance = balance - afterGetBalance(result) - } else { - showBalanceSelect(newBalances) - } - } +const getBusinessType = ()=> { + getBusinessType(businessTypeCode.value, res => { + if (res.success) { + businessType.value = res.businessType; + fromInventoryStatuses.value = getDirectoryItemArray(res.fromInventoryStatuses); + fromLocationAreaTypeList.value = res.fromLocationAreaTypeList + openScanPopup(); } else { - // 扫描的是小包装 - if (balances.list.length == 0) { - showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else { - // 小包装库存 - const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.number) - // 外包装库存 - const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.parentNumber && r.locationCode == fromLocationCode.value) - - // 小包装没有库存, - if (subPackitems.length == 0) { - // 外包装有库存,出库后剩余库存未转换为出库包装规格 - - if (subParentPackitems.length > 0) { - if (subParentPackitems.length == 1) { - const balance = subParentPackitems[0] - balance.qty = packageInfo.qty - result.balance = balance - afterGetBalance(result) - } else { - showBalanceSelect(subParentPackitems) - } - } else { - showErrorMessage(`按外包装【${packageInfo.parentNumber}】和子包装【${packageInfo.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(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) - }else { - afterGetBalance(result) - } - } - } - } + showErrorMessage(res.message) } - }) + }); } - -const showBalanceSelect = (items) => { - balanceSelectRef.value.openPopup(items) +const getScanResult = (result)=> { + setData(result); } +const setData = (result)=> { + let balance = result.balance; + let label = result.label; + let pack = result.package; + + if (fromLocationCode.value && fromLocationCode.value != balance.locationCode) { + showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this + .fromLocationCode + "]没有库存余额") + return; + } -const selectBalanceItem = (balance) => { - resultData.value.balance = balance - afterGetBalance(resultData.value) -} -const afterGetBalance = (result) => { - const { balance } = result - const { label } = result - const pack = result.package - const { packUnit } = pack - const { packQty } = pack - const item = detailSource.value.find((res) => { + let item = detailSource.value.find(res => { if (res.itemCode == balance.itemCode) { return res } }) - if (fromWarehouseCode.value == '') { - fromWarehouseCode.value = balance.warehouseCode - } if (item == undefined) { - const itemp = createItemInfo(balance, pack) - const newDetail = createDetailInfo(balance, pack) - newDetail.parentNumber = pack.parentNumber + if (itemCode.value != "" && itemCode.value != balance.itemCode) { + showErrorMessage("请扫描物料为【" + itemCode.value + "】的箱码") + return; + } + if (fromWarehouseCode.value == '') { + fromWarehouseCode.value = balance.warehouseCode; + } + let itemp = createItemInfo(balance, pack); + let newDetail = createDetailInfo(balance, pack); // + newDetail.parentNumber = pack.parentNumber; newDetail.packingNumber = pack.number - newDetail.packUnit = packUnit || '' - newDetail.packQty = packQty || '' - itemp.subList.push(newDetail) + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty + } + itemp.subList.push(newDetail); detailSource.value.push(itemp) - calcHandleQty(detailSource.value) + itemCode.value = balance.itemCode; + fromLocationCode.value = balance.locationCode + scanPopupGetFocus() } else { - const detail = item.subList.find((r) => { - if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { - return r + let detail = item.subList.find(r => { + if (r.packingNumber == pack.number && + r.batch == balance.batch && + r.locationCode == balance.locationCode && + r.inventoryStatus == balance.inventoryStatus) { + return r; } }) if (detail == undefined) { - const newDetail = createDetailInfo(balance, pack) - newDetail.parentNumber = pack.parentNumber + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; newDetail.packingNumber = pack.number - newDetail.packUnit = packUnit - newDetail.packQty = packQty - item.subList.push(newDetail) - calcHandleQty(detailSource.value) - } else if (detail.scaned == true) { - showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) - } - } -} -const getScanResult1 = (result) => { - const { balance } = result - const { label } = result - const pack = result.package - const { packUnit } = pack - const { packQty } = pack - const item = detailSource.value.find((res) => { - if (res.itemCode == balance.itemCode) { - return res - } - }) - if (fromWarehouseCode.value == '') { - fromWarehouseCode.value = balance.warehouseCode - } - if (item == undefined) { - const itemp = createItemInfo(balance, pack) - const newDetail = createDetailInfo(balance, pack) // - newDetail.packUnit = packUnit - newDetail.packQty = packQty - itemp.subList.push(newDetail) - detailSource.value.push(itemp) - calcHandleQty(detailSource.value) - } else { - const detail = item.subList.find((r) => { - if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { - return r + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty + } + item.subList.push(newDetail); + this.scanPopupGetFocus() + } else { + if (detail.scaned == true) { + this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]已经在列表中") } - }) - if (detail == undefined) { - const newDetail = createDetailInfo(balance, pack) - newDetail.packUnit = packUnit - newDetail.packQty = packQty - item.subList.push(newDetail) - calcHandleQty(detailSource.value) - } else if (detail.scaned == true) { - showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) } } + calcHandleQty(this.detailSource); } + // 获取推荐库位 const getRecommendLocation = (balance, pack, callback) => { proxy.$modal.loading('扫描中...') @@ -456,11 +334,11 @@ const removePack = () => { } const openScanPopup = () => { - if (fromLocationCode.value == '') { - showFromLocationPopup() - return + if (businessType.value == '') { + scanPopup.value.openScanPopup(this.businessType); + }else { + getBusinessType() } - scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value) } const showFromLocationPopup = () => { nextTick(() => { @@ -595,16 +473,6 @@ const getFromLocationCode = (location, code) => { fromLocationCode.value = code openScanPopup() } -const getToLocationCode = (location, code) => { - if (fromLocationCode.value == code) { - uni.showToast({ - title: `来源库位[${fromLocationCode.value}]不能与目标库位[${code}]一致`, - duration: 2000 - }) - return - } - toLocationCode.value = code -} const showCommitSuccessMessage = (hint) => { comMessageRef.value.showScanMessage(hint, (res) => { @@ -628,6 +496,7 @@ const clearData = () => { toWarehouseCode.value = '' detailSource.value = [] positionInfo.value = '请选择生产线' + itemCode.value = '' } diff --git a/src/pages/issue/record/directIssue2.vue b/src/pages/issue/record/directIssue2.vue new file mode 100644 index 00000000..f66a01c0 --- /dev/null +++ b/src/pages/issue/record/directIssue2.vue @@ -0,0 +1,718 @@ + + + + + \ No newline at end of file