diff --git a/src/pages/issue/record/directIssue.vue b/src/pages/issue/record/directIssue.vue index bacd8b01..1d91190f 100644 --- a/src/pages/issue/record/directIssue.vue +++ b/src/pages/issue/record/directIssue.vue @@ -4,16 +4,12 @@ - - - 来源库位 : {{ fromLocationCode }} - - + - + @@ -37,6 +33,7 @@ + @@ -55,17 +52,12 @@ import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/director import { getBusinessType, createItemInfo, createDetailInfo, calcTreeHandleQty, calcHandleQty } from '@/common/record.js' import { getManagementPrecisions, getPrecisionStrategyList, getPrecisionStrategyParams } from '@/common/balance.js' - +import { Decimal } from 'decimal.js'; //引入 import winScanButton from '@/mycomponents/scan/winScanButton.vue' -import winScanPack from '@/mycomponents/scan/winScanPack.vue' -import requiredLocation from '@/mycomponents/location/requiredLocation.vue' import comBlankView from '@/mycomponents/common/comBlankView.vue' -import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' -import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' 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 balanceQuery from '@/mycomponents/query/balanceQuery.vue' import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() @@ -101,10 +93,12 @@ const workStationName = ref('') const rawLocationCode = ref('') const fgLocationCode = ref('') const managementList = ref([]) +const managementType = ref('') const resultData = ref({}) const balanceSelectRef = ref() const itemCode = ref('') const fromInventoryStatuses = ref('') +const refBalanceQuery = ref(null) onLoad((option) => { uni.setNavigationBarTitle({ title: option.title @@ -141,6 +135,9 @@ onLoad((option) => { onNavigationBarButtonTap((e) => { if (e.index === 0) { goHome() + }else if (e.index == 1) { + refBalanceQuery.value.showDrawer(); + closeScanPopup(); } }) const getBusinessType = ()=> { @@ -155,19 +152,29 @@ const getBusinessType = ()=> { } }); } -const getScanResult = (result)=> { - setData(result); +const getScanResult = async (result)=> { + await getManagementPrecisions([result.label.itemCode], result.balance.locationCode, res => { + if (res.success) { + managementList.value = res.list; + managementType.value = managementList.value && managementList.value[0] ? managementList.value[0].ManagementPrecision : '' + if(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){ + setDataBatch(result); + }else{ + 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; - } + // if (fromLocationCode.value && fromLocationCode.value != balance.locationCode) { + // showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this + // .fromLocationCode + "]没有库存余额") + // return; + // } let item = detailSource.value.find(res => { if (res.itemCode == balance.itemCode) { @@ -175,15 +182,17 @@ const setData = (result)=> { } }) if (item == undefined) { - if (itemCode.value != "" && itemCode.value != balance.itemCode) { - showErrorMessage("请扫描物料为【" + itemCode.value + "】的箱码") - return; - } + // if (itemCode.value != "" && itemCode.value != balance.itemCode) { + // showErrorMessage("请扫描物料为【" + itemCode.value + "】的箱码") + // return; + // } if (fromWarehouseCode.value == '') { fromWarehouseCode.value = balance.warehouseCode; } let itemp = createItemInfo(balance, pack); + itemp.containerNumber = "" let newDetail = createDetailInfo(balance, pack); // + newDetail.fromLocationCode = balance.locationCode newDetail.parentNumber = pack.parentNumber; newDetail.packingNumber = pack.number newDetail.packUnit = pack.packUnit; @@ -195,36 +204,224 @@ const setData = (result)=> { detailSource.value.push(itemp) itemCode.value = balance.itemCode; fromLocationCode.value = balance.locationCode + await this.getToLocationBalance(this.fromLocationCode,result) scanPopupGetFocus() } else { let detail = item.subList.find(r => { if (r.packingNumber == pack.number && r.batch == balance.batch && - r.locationCode == balance.locationCode && + r.fromLocationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { return r; } }) if (detail == undefined) { - let newDetail = createDetailInfo(balance, pack); - newDetail.parentNumber = pack.parentNumber; - newDetail.packingNumber = pack.number - newDetail.packUnit = pack.packUnit; - newDetail.packQty = pack.packQty; - if (balance.lableQty) { - newDetail.handleQty = balance.lableQty + //如果最开始扫父,在扫子,提示已经扫描父包装 + //如果扫子在扫父,提示扫描的是父包装,是否移除子包装,是移除子包装,显示父包装 + //扫描的是子包装, + if (pack.parentNumber) { + let checkData = item.subList.find(r => { + if (r.packingNumber == pack.parentNumber && + r.batch == balance.batch&& + r.fromLocationCode == balance.locationCode) { + return r; + } + }) + if (checkData) { + //提示已经扫描 + showErrorMessage("扫描箱码[" + pack.number + "]批次[" + balance.batch + + "]的父包装已经扫描") + console.log("父包装已经扫描") + } else { + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.fromLocationCode=balance.locationCode + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty + } + item.subList.push(newDetail); + } + } else { + //扫描的是父包装 + let checkData = item.subList.find(r => { + if (r.parentNumber == pack.number && + r.batch == balance.batch&& + r.fromLocationCode == balance.locationCode) { + return r; + } + }) + if (checkData) { + //是否移除 + comMessageRef.value.showQuestionMessage("箱码[" + checkData.parentNumber+"]" + "批次[" + balance + .batch + "]是父包装,是否移除子包装", res => { + if (res) { + item.subList = []; + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.fromLocationCode=balance.locationCode + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty + } + item.subList.push(newDetail); + } + }) + console.log("扫描的是父包装,是否移除子包装") + } else { + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty + } + item.subList.push(newDetail); + } } - item.subList.push(newDetail); this.scanPopupGetFocus() } else { if (detail.scaned == true) { - this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]已经在列表中") + this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") } } } calcHandleQty(this.detailSource); } +const setDataBatch = async (result)=>{ + let balance = result.balance; + let label = result.label; + let pack = result.package; + // if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) { + // this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this + // .fromLocationCode + "]没有库存余额") + // return; + // } + let item = detailSource.value.find(res => { + if (res.itemCode == balance.itemCode) { + return res + } + }) + if (item == undefined) { + if (fromWarehouseCode.value == '') { + fromWarehouseCode.value = balance.warehouseCode; + } + let itemp = createItemInfo(balance, pack); + itemp.containerNumber="" + let newDetail = createDetailInfo(balance, pack); // + newDetail.fromLocationCode=balance.locationCode + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.handleQty = 0 + itemp.subList.push(newDetail); + detailSource.value.push(itemp) + itemCode.value = balance.itemCode; + fromLocationCode.value = balance.locationCode + scanPopupGetFocus() + } else { + + let detail = item.subList.find(r => { + if (r.batch == balance.batch && + r.fromLocationCode == balance.locationCode && + r.inventoryStatus == balance.inventoryStatus) { + return r; + } + }) + if (detail == undefined) { + //如果最开始扫父,在扫子,提示已经扫描父包装 + //如果扫子在扫父,提示扫描的是父包装,是否移除子包装,是移除子包装,显示父包装 + //扫描的是子包装, + if (pack.parentNumber) { + let checkData = item.subList.find(r => { + if (r.packingNumber == pack.parentNumber && + r.batch == balance.batch&& + r.fromLocationCode == balance.locationCode) { + return r; + } + }) + if (checkData) { + //提示已经扫描 + showErrorMessage("扫描箱码[" + pack.number + "]批次[" + balance.batch + + "]的父包装已经扫描") + console.log("父包装已经扫描") + } else { + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.fromLocationCode=balance.locationCode + newDetail.handleQty = 0 + item.subList.push(newDetail); + } + } else { + //扫描的是父包装 + let checkData = item.subList.find(r => { + if (r.batch == balance.batch&& + r.fromLocationCode == balance.locationCode) { + return r; + } + }) + if (checkData) { + //是否移除 + comMessageRef.value.showQuestionMessage("批次[" + balance + .batch + "]是父包装,是否移除子包装", res => { + if (res) { + item.subList = []; + let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.fromLocationCode=balance.locationCode + newDetail.handleQty = 0 + item.subList.push(newDetail); + } + }) + console.log("扫描的是父包装,是否移除子包装") + } else { + let newDetail = createDetailInfo(balance, pack); + newDetail.fromLocationCode=balance.locationCode + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + newDetail.handleQty = 0 + item.subList.push(newDetail); + } + } + + scanPopupGetFocus() + } else { + if (detail.scaned == true) { + // this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") + } + } + } + // calcHandleQty(this.detailSource); + console.log(this.detailSource) + for (let item of this.detailSource) { + item.handleQty = new Decimal(0).toNumber(); + item.qty = new Decimal(0).toNumber(); + for (let detail of item.subList) { + if (detail != undefined) { + if (detail.scaned) { + item.handleQty = calc.add(result.label.qty, detail.handleQty) + detail.handleQty = calc.add(result.label.qty, detail.handleQty); + } + item.qty = calc.add(item.qty, detail.qty); + } + } + } +} // 获取推荐库位 const getRecommendLocation = (balance, pack, callback) => { proxy.$modal.loading('扫描中...') @@ -356,6 +553,10 @@ const scanPopupGetFocus = () => { } } const commit = () => { + if (positionInfo.value == '请选择生产线' || !positionInfo.value) { + showErrorMessage("请选择生产线") + return + } proxy.$modal.loading('提交中....') // 记录有目标库位,需要查询管理模式 console.log(444444, detailSource.value) @@ -372,7 +573,7 @@ const commit = () => { .then((res) => { uni.hideLoading() if (res.data) { - showCommitSuccessMessage(`提交成功
生成直接发料记录
${res.data}`) + showCommitSuccessMessage(`提交成功\n生成直接发料记录\n${res.data}`) } else { showErrorMessage(`提交失败[${res.msg}]`) } @@ -450,6 +651,7 @@ const showMessage = (message) => { const showErrorMessage = (message) => { comMessageRef.value.showErrorMessage(message, (res) => { if (res) { + scanPopupGetFocus() } }) } diff --git a/src/pages/issue/record/directIssue0816.vue b/src/pages/issue/record/directIssue0816.vue new file mode 100644 index 00000000..d1d4b493 --- /dev/null +++ b/src/pages/issue/record/directIssue0816.vue @@ -0,0 +1,645 @@ + + + + + \ No newline at end of file diff --git a/src/pages/issue/record/issueRecord.vue b/src/pages/issue/record/issueRecord.vue index 1451331e..e8bf8288 100644 --- a/src/pages/issue/record/issueRecord.vue +++ b/src/pages/issue/record/issueRecord.vue @@ -264,7 +264,7 @@ export default { item.subList.push(newDetail) calcHandleQty(this.detailSource) } else if (detail.scaned == true) { - this.showErrorMessage(`箱码[${detail.packingNumber}]批次[${balance.batch}]已经在列表中`) + this.showErrorMessage(`箱码[${detail.packingNumber}]批次[${balance.batch}]重复扫描`) } } }, @@ -393,7 +393,7 @@ export default { .then((res) => { uni.hideLoading() if (res.data) { - this.showCommitSuccessMessage(`提交成功
生成直接发料记录
${res.data}`) + this.showCommitSuccessMessage(`提交成功\n生成直接发料记录\n${res.data}`) } else { this.showErrorMessage(`提交失败[${res.msg}]`) } diff --git a/src/pages/issue/record/issueRecordV1.vue b/src/pages/issue/record/issueRecordV1.vue index 96b42863..e9edc221 100644 --- a/src/pages/issue/record/issueRecordV1.vue +++ b/src/pages/issue/record/issueRecordV1.vue @@ -301,7 +301,7 @@ const submitJob = () => { .then((res) => { uni.hideLoading() if (res.data) { - showCommitSuccessMessage(`提交成功
生成发料记录
${res.data}`) + showCommitSuccessMessage(`提交成功\n生成发料记录\n${res.data}`) } else { showErrorMessage(`提交失败:【${res.msg}】`) }