From 3a4ec86142f93894f78f7338652c214de2ff2828 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Mon, 6 Jan 2025 11:23:57 +0800 Subject: [PATCH] =?UTF-8?q?YT-1888PDA=E3=80=90=E9=87=87=E8=B4=AD=E9=80=80?= =?UTF-8?q?=E8=B4=A7=E4=BB=BB=E5=8A=A1=E3=80=91=EF=BC=8C=E7=8E=B0=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=90=8E=E7=9A=84=E9=A1=B5=E9=9D=A2=EF=BC=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E4=BF=AE=E6=94=B9=E3=80=82=E6=8E=A8=E8=8D=90=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=E6=98=AF=E4=BB=BB=E5=8A=A1=E4=B8=AD=E7=9A=84=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=EF=BC=8C=E5=A6=82=E6=9E=9C=E4=BB=BB=E5=8A=A1=E4=B8=AD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=89=B9=E6=AC=A1=EF=BC=8CPDA=E7=AB=AF?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E6=98=BE=E7=A4=BA=E3=80=82=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E7=AE=B1=E7=A0=81=E5=90=8E=EF=BC=8C=E9=9C=80=E8=A6=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AE=9E=E9=99=85=E6=89=AB=E6=8F=8F=E7=9A=84=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=EF=BC=8C=E5=A6=82=E6=9E=9C=E7=9B=B8=E5=90=8C=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=E8=BF=9B=E8=A1=8C=E4=BA=86=E9=87=8D=E5=A4=8D=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=EF=BC=8C=E5=88=99=E7=B4=AF=E5=8A=A0=E5=B7=B2=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E6=95=B0=E9=87=8F=EF=BC=9B=E5=A6=82=E6=9E=9C=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E4=BA=86=E4=B8=8D=E7=94=A8=E7=9A=84=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E5=86=8D=E6=98=BE=E7=A4=BA=E4=B8=80=E6=9D=A1?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E6=89=AB=E6=8F=8F=E7=9A=84=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/detail.js | 1 + .../detail/comRecommendDetailCard.vue | 11 +- src/mycomponents/recommend/recommend.vue | 6 +- .../purchaseReturn/job/returnDetailBatch.vue | 398 +++++++++++------- src/pages/purchaseReturn/job/returnJob.vue | 5 +- src/pages/unPlanned/job/issueJobDetail.vue | 198 ++++----- 6 files changed, 356 insertions(+), 263 deletions(-) diff --git a/src/common/detail.js b/src/common/detail.js index fdec3f45..bd53cc38 100644 --- a/src/common/detail.js +++ b/src/common/detail.js @@ -187,6 +187,7 @@ export function calcHandleNewQty(detailSource) { item.handleQty = new Decimal(0).toNumber(); // item.qty = new Decimal(0).toNumber(); for (let detail of item.subList) { + detail.handleQty = detail.handleQty || new Decimal(0).toNumber(); if (detail ) { if (!detail.isRecommend && detail.scaned) { item.handleQty = calc.add(item.handleQty, detail.handleQty); diff --git a/src/mycomponents/detail/comRecommendDetailCard.vue b/src/mycomponents/detail/comRecommendDetailCard.vue index a3b56d0b..038a11c6 100644 --- a/src/mycomponents/detail/comRecommendDetailCard.vue +++ b/src/mycomponents/detail/comRecommendDetailCard.vue @@ -18,7 +18,7 @@ 推
荐 - + @@ -27,12 +27,9 @@ 实
际 - - + - - @@ -109,6 +106,10 @@ type: Boolean, default: true }, + formLocationTitle: { + type: String, + default: '库位' + }, }, watch: { dataContent: { diff --git a/src/mycomponents/recommend/recommend.vue b/src/mycomponents/recommend/recommend.vue index 664d0e83..80b9d516 100644 --- a/src/mycomponents/recommend/recommend.vue +++ b/src/mycomponents/recommend/recommend.vue @@ -7,7 +7,7 @@ --> - + @@ -90,6 +90,10 @@ type: String, default: '库位' }, + formLocationTitle: { + type: String, + default: '来源库位' + }, }, watch: { diff --git a/src/pages/purchaseReturn/job/returnDetailBatch.vue b/src/pages/purchaseReturn/job/returnDetailBatch.vue index a891213e..8e7121ec 100644 --- a/src/pages/purchaseReturn/job/returnDetailBatch.vue +++ b/src/pages/purchaseReturn/job/returnDetailBatch.vue @@ -22,9 +22,13 @@ - - + + + + + + @@ -42,9 +46,8 @@ - - - + + @@ -70,14 +73,16 @@ getInventoryStatusName } from '@/common/directory.js'; - import { - getDataSource - } from '@/pages/issue/js/issue.js'; + // import { + // getDataSource + // } from '@/pages/issue/js/issue.js'; import { createRecordInfo, calcHandleQty, - getScanCount + getScanCount, + getDataSource, + calcHandleNewQty, } from '@/common/detail.js'; import { @@ -96,6 +101,7 @@ import comReturnDetailCardBatch from '@/pages/purchaseReturn/coms/comReturnDetailCardBatch.vue' import comScanReturnPack from '@/pages/purchaseReturn/coms/comScanReturnPack.vue' import comScanReturnPackBatch from '@/pages/purchaseReturn/coms/comScanReturnPackBatch.vue' + import comRecommendDetailCard from "@/mycomponents/detail/comRecommendDetailCard.vue" export default { name: 'returnDetail', @@ -107,7 +113,8 @@ jobTop, comScanReturnPack, comScanReturnPackBatch, - comReturnDetailCardBatch + comReturnDetailCardBatch, + comRecommendDetailCard }, data() { @@ -201,7 +208,7 @@ mask: true }); - getPurchasereturnJobDetail(that.id).then(res => { + getPurchasereturnJobDetail(that.id).then(async res => { uni.hideLoading(); if (res.data == null) { that.showMessage('未获取到详情'); @@ -211,28 +218,14 @@ that.jobStatus = res.data.status that.subList = res.data.subList; that.toLocationCode = that.jobContent.toLocationCode - that.detailSource = getDataSource(that.detailSource,that.subList); + that.subList.forEach(item=>{ + item.isRecommend = true + }) + that.detailSource = await getDataSource(that.subList) + console.log(222,that.detailSource) that.fromLocationCode =that.subList[0].fromLocationCode that.poNumber =that.subList[0].poNumber - //获取管理模式,封装参数 - var itemCodes = [] - res.data.subList.forEach(item => { - itemCodes.push(item.itemCode) - item.scaned = false - }) - getManagementPrecisions(itemCodes, that.fromLocationCode, ret => { - if (ret.success) { - this.managementList = ret.list; - this.managementType = this.managementList.some(item => item.ManagementPrecision == - 'BY_BATCH') ? 'BY_BATCH' : '' - if (this.managementType == 'BY_BATCH') { - that.detailSource = res.data - } else { - that.detailSource = getDataSource(that.detailSource, that.subList); - } - } - }) } else { that.showMessage('列表数据为0'); } @@ -254,109 +247,183 @@ // }) // }); }, - - updateData(record) { - - if(record){ - // let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); - // let item = requestLocation.Items.find(r => r.itemCode == record.itemCode); - // let itemHandleQty = 0; - // if (item != undefined) { - // item.Locations.forEach(l => { - // let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b - // .packingNumber == null || b.packingNumber == '') && b.batch == - // record.batch); - // let handleQty = 0; - // if (batch != undefined) { - // batch.Records.forEach(res => { - // handleQty = calc.add(handleQty, res.qty) - // }) - // batch.handleQty = handleQty; - // itemHandleQty = calc.add(itemHandleQty, handleQty) - // } - // }) - // item.handleQty=itemHandleQty; - // } - // this.$forceUpdate() - }else { - //计算扫描数量 - this.detailSource.forEach(detail => { - detail.Items.forEach(item => { - var taskQty =0; - item.taskQty =calc.add(taskQty,item.qty) - var totalQty =0; - item.Locations.forEach(lco => { - lco.Batchs.forEach(batch => { - batch.Records.forEach(record => { - if(record){ - var handleQty =record.qty?record.qty:0 - totalQty = calc.add(totalQty,handleQty) - } - - }) - }) - }) - //实际扫描的数量 - item.handleQty =totalQty - }) - }) +getScanResult(result, managementPrecision) { + console.log(33, result, managementPrecision) + if (managementPrecision == 'BY_QUANTITY') { + result.label.batch = '' + this.setDataBatch(result) + } else if (managementPrecision == 'BY_BATCH') { + this.setDataBatch(result) + } else { + this.setData(result) } - - // }, - - submit(){ - uni.showLoading({ - title: "提交中....", - mask: true - }); - var params = this.setParams() - console.log("提交参数", JSON.stringify(params)); - - if (params.subList.length == 0) { - uni.hideLoading() - this.$refs.comMessage.showConfirmMessageModal('请扫描箱码') - return - } - if(!this.checkCount()){ - uni.hideLoading() - return ; + setDataBatch(result) { + try { + var packingNumber = result.balance.packingNumber; + var batch = result.label.batch; + var qty = result.balance.qty; + var itemCode = result.balance.itemCode; + var locationCode = result.balance.locationCode; + var inventoryStatus = result.balance.inventoryStatus; + var detail = this.detailSource.find(r => r.itemCode == itemCode); + + console.log(999, detail.subList) + if (detail == undefined) { + this.showErrorMessage("物料号【" + itemCode + "】不在列表中") + } else { + var itemDetail = detail.subList.find(r => { + return r.batch == batch && + r.fromLocationCode == result.fromLocationCode && + r.isRecommend == false + }) + if (itemDetail == undefined) { + var newAdd = { + itemCode: itemCode, + packingNumber: packingNumber, + batch: batch, + handleQty: Number(result.label.qty), + qty: detail.qty, + fromLocationCode: locationCode, + inventoryStatus: inventoryStatus, + toInventoryStatus: inventoryStatus, + balance: result.balance, + isRecommend: false, + isNewAdd: "newAdd" + } + newAdd.balance.balanceQty = Number(result.balance.qty); + newAdd.balance.packQty = Number(result.package.packQty) + newAdd.balance.packUnit = result.package.packUnit + newAdd.scaned = true; + detail.subList.push(newAdd) + } else { + if (itemDetail.scaned) { + itemDetail.handleQty = calc.add(itemDetail.handleQty, Number(result.label.qty)); + // this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result + // .fromLocationCode + "】已经扫描") + }else{ + itemDetail.scaned = true; + itemDetail.handleQty= Number(result.label.qty) + } + } + this.calcHandleQty(); + } + } catch (e) { + this.showMessage(e.message) } - this.submitJob() }, - - checkCount(){ - let str="" - let commitHint="" - this.detailSource.subList.forEach(item => { - if (this.jobContent.allowPartialComplete == "FALSE") { - if (item.qty != item.handleQty) { - str += `物料号【${item.itemCode}】实际提交数量【${item.handleQty}】与任务数量【${item.qty}】不一致\n` - } + setData(result) { + try { + var packingNumber = result.balance.packingNumber; + var batch = result.balance.batch; + var qty = result.balance.qty; + var itemCode = result.balance.itemCode; + var locationCode = result.balance.locationCode; + var inventoryStatus = result.balance.inventoryStatus; + var detail = this.detailSource.find(r => r.itemCode == itemCode); + + if (detail == undefined) { + this.showErrorMessage("物料号【" + itemCode + "】不在列表中") } else { - //允许部分提交,提交的数量和任务数量不一致,提示 - if (item.qty != item.handleQty) { - commitHint += `物料号【${item.itemCode}】实际提交数量【${item.handleQty}】与任务数量【${item.qty}】不一致,是否提交?\n` + var itemDetail = detail.subList.find(r => { + return r.packingNumber == packingNumber && + r.batch == batch && + r.fromLocationCode == result.fromLocationCode && + r.isRecommend == false + }) + if (itemDetail == undefined) { + var newAdd = { + itemCode: itemCode, + packingNumber: packingNumber, + batch: batch, + handleQty: detail.qty < Number(result.balance.qty) ? detail.qty : Number(result.balance.qty), + qty: detail.qty, + fromLocationCode: locationCode, + inventoryStatus: inventoryStatus, + toInventoryStatus: inventoryStatus, + balance: result.balance, + isRecommend: false, + isNewAdd: "newAdd" + } + newAdd.balance.balanceQty = Number(result.balance.qty); + newAdd.balance.packQty = Number(result.package.packQty) + newAdd.balance.packUnit = result.package.packUnit + newAdd.scaned = true; + detail.subList.push(newAdd) + this.calcHandleQty(); + } else { + if (itemDetail.scaned) { + this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result + .fromLocationCode + "】已经扫描") + } } } - }) - if(str){ - str = '不允许提交\n' + str - this.showErrorMessage(str) + } catch (e) { + this.showMessage(e.message) } - - if(commitHint){ - this.showQuestionMessage(commitHint,res=>{ - if(res){ - this.submitJob() + }, + calcHandleQty() { + calcHandleNewQty(this.detailSource) + // this.continueScan() + this.$forceUpdate(); + }, + updateData() { + //删除新添加的 + for (var i = 0; i < this.detailSource.length; i++) { + var item = this.detailSource[i] + for (var j = 0; j < item.subList.length; j++) { + var sub = item.subList[j] + if (!sub.isRecommend && !sub.scaned) { + item.subList.splice(j, 1) } - }) + } } - if(str||commitHint){ - return false - }else { - return true + this.calcHandleQty(); + }, + submit(){ + this.checkCount() + // uni.showLoading({ + // title: "提交中....", + // mask: true + // }); + // var params = this.setParams() + // console.log("提交参数", JSON.stringify(params)); + + // if (params.subList.length == 0) { + // uni.hideLoading() + // this.$refs.comMessage.showConfirmMessageModal('请扫描箱码') + // return + // } + }, + + checkCount(){ + // 提交的数量和任务数量不一致提示 + let str = '' + let num = 0 + this.detailSource.forEach((item) => { + if (item.qty != item.handleQty) { + str += `物料号【${item.itemCode}】任务数量【${item.qty}】与实际提交数量【${item.handleQty}】不一致` } + item.subList.forEach((cur,key)=>{ + if(cur.isRecommend == false && cur.handleQty){ + num++ + } + }) + }) + if(!num){ + this.$refs.comMessage.showConfirmMessageModal('请扫描箱码') + return + } + if (str) { + str = str + '\n是否提交?' + this.$refs.comMessage.showQuestionMessage1(str, 'red', res => { + if (res) { + this.submitJob() + } + }); + } else { + this.submitJob() + } }, @@ -366,8 +433,10 @@ mask: true }); var itemCodes = [] - this.detailSource.subList.forEach(cur => { - itemCodes.push(cur.itemCode) + this.detailSource.forEach(item => { + item.subList.forEach(cur => { + itemCodes.push(cur.itemCode) + }) }) //获取管理模式,封装参数 getManagementPrecisions(itemCodes, this.fromLocationCode, res => { @@ -395,38 +464,35 @@ var subList = [] var createTime = getCurrDateTime(); var creator = this.$store.state.user.id - this.detailSource.subList.forEach(r => { - if (r.scaned) { - let subItem = { - ...r + this.detailSource.forEach(item => { + item.subList.forEach(detail => { + if (detail.scaned && !detail.isRecommend) { + detail.recordList = [] + let record = {}; + record.handleQty = detail.qty; + record.toContainerNumber = detail + .ContainerNumber; + record.inventoryStatus = detail + .inventoryStatus; + record.toLocationCode = item + .toLocationCode; + record.supplierCode =detail.supplierCode; + //使用在途库不改变管理模式 + var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, + record.packingNumber, detail.batch); + detail.toPackingNumber = info.packingNumber; + detail.packingNumber = info.packingNumber; + detail.fromPackingNumber = info.packingNumber; + record.toPackingNumber = info.packingNumber; + record.packingNumber = info.packingNumber; + record.fromPackingNumber = info.packingNumber; + record.fromBatch = detail.batch; + record.fromPackingNumber = detail.packingNumber + detail.recordList.push(record); + subList.push(deepCopyData(detail)) } - subItem.recordList = [] - let record = {}; - record.handleQty = r.qty; - record.toContainerNumber = r - .ContainerNumber; - record.inventoryStatus = r - .inventoryStatus; - record.toLocationCode = subItem - .toLocationCode; - record.supplierCode = r.supplierCode; - - //使用在途库不改变管理模式 - var info = getPackingNumberAndBatch(this.managementList, r.itemCode, - record.packingNumber, r.batch); - subItem.toPackingNumber = info.packingNumber; - subItem.packingNumber = info.packingNumber; - subItem.fromPackingNumber = info.packingNumber; - record.toPackingNumber = info.packingNumber; - record.packingNumber = info.packingNumber; - record.fromPackingNumber = info.packingNumber; - record.fromBatch = r.batch; - record.fromPackingNumber = r.packingNumber - subItem.recordList.push(record); - subList.push(deepCopyData(subItem)); - } + }) }) - this.jobContent.subList = subList this.jobContent.createTime = createTime; this.jobContent.creator = creator; @@ -434,7 +500,27 @@ }, openScanDetailPopup() { - this.$refs.comScanReturnPackBatch.openScanPopup(this.detailSource, this.jobContent); + let fromlocationCode = ''; + let fromlocationList = []; + console.log(this.detailSource) + for (var i = 0; i < this.detailSource.length; i++) { + let item = this.detailSource[i]; + item.subList.forEach(l => { + //重复的库位不往里面插入 + var location = fromlocationList.find(res => res == l.fromLocationCode) + if (location == undefined) { + fromlocationList.push(l.fromLocationCode); + } + //来源库位赋默认值 + if (fromlocationCode == '') { + if (!l.scaned) { + fromlocationCode = l.fromLocationCode; + } + } + }) + } + console.log(fromlocationCode, fromlocationList, this.jobContent) + this.$refs.scanPopup.openScanPopupForJob(fromlocationCode, fromlocationList, this.jobContent); }, scanPopupGetFocus() { diff --git a/src/pages/purchaseReturn/job/returnJob.vue b/src/pages/purchaseReturn/job/returnJob.vue index 86572ea5..db559076 100644 --- a/src/pages/purchaseReturn/job/returnJob.vue +++ b/src/pages/purchaseReturn/job/returnJob.vue @@ -190,9 +190,8 @@ getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => { if (ret.success) { this.managementList = ret.list; - this.managementType = this.managementList.some(cur => cur.ManagementPrecision == 'BY_BATCH') ? - 'BY_BATCH' : '' - if (this.managementType == 'BY_BATCH') { + this.managementType = this.managementList&& this.managementList[0]&& this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : '' + if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') { uni.navigateTo({ url: './returnDetailBatch?id=' + item.masterId + '&status=' + item.status+'&title='+this.title }); diff --git a/src/pages/unPlanned/job/issueJobDetail.vue b/src/pages/unPlanned/job/issueJobDetail.vue index bba58a3a..cc885f8c 100644 --- a/src/pages/unPlanned/job/issueJobDetail.vue +++ b/src/pages/unPlanned/job/issueJobDetail.vue @@ -8,7 +8,8 @@ 目的地 - {{jobContent.destination}} + {{jobContent.destination}} @@ -18,8 +19,8 @@ - + @@ -27,8 +28,7 @@ - + @@ -69,11 +69,11 @@ calcHandleNewQty, getScanCount } from '@/common/detail.js'; - + import { calc } from '@/common/calc' - + import { Decimal } from 'decimal.js'; //引入 @@ -181,10 +181,10 @@ that.jobContent = res.data; that.jobStatus = res.data.status that.subList = res.data.subList; - that.subList.forEach(item=>{ + that.subList.forEach(item => { item.isRecommend = true }) - that.detailSource = await getDataSource(that.subList) + that.detailSource = await getDataSource(that.subList) //获取管理模式,封装参数 var itemCodes = [] this.detailSource.forEach(item => { @@ -195,7 +195,8 @@ await getManagementPrecisions(itemCodes, that.fromLocationCode, res => { if (res.success) { this.managementList = res.list; - this.managementType = this.managementList&& this.managementList[0]&& this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING' + this.managementType = this.managementList && this.managementList[0] && this.managementList[0] + .ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING' } }) } else { @@ -228,11 +229,11 @@ updateData() { //删除新添加的 for (var i = 0; i < this.detailSource.length; i++) { - var item =this.detailSource[i] + var item = this.detailSource[i] for (var j = 0; j < item.subList.length; j++) { - var sub =item.subList[j] - if(!sub.isRecommend&&!sub.scaned){ - item.subList.splice(j,1) + var sub = item.subList[j] + if (!sub.isRecommend && !sub.scaned) { + item.subList.splice(j, 1) } } } @@ -243,18 +244,18 @@ this.$refs.detailInfoPopup.openPopup(item) }, - getScanResult(result,managementPrecision) { - console.log(33,result,managementPrecision) - if(managementPrecision == 'BY_QUANTITY'){ + getScanResult(result, managementPrecision) { + console.log(33, result, managementPrecision) + if (managementPrecision == 'BY_QUANTITY') { result.label.batch = '' this.setDataBatch(result) - }else if(managementPrecision == 'BY_BATCH' ){ + } else if (managementPrecision == 'BY_BATCH') { this.setDataBatch(result) - }else{ + } else { this.setData(result) } }, - setDataBatch(result){ + setDataBatch(result) { try { var packingNumber = result.balance.packingNumber; var batch = result.label.batch; @@ -263,29 +264,29 @@ var locationCode = result.balance.locationCode; var inventoryStatus = result.balance.inventoryStatus; var detail = this.detailSource.find(r => r.itemCode == itemCode); - - console.log(999,detail.subList) + + console.log(999, detail.subList) if (detail == undefined) { this.showErrorMessage("物料号【" + itemCode + "】不在列表中") } else { var itemDetail = detail.subList.find(r => { return r.batch == batch && - r.fromLocationCode == result.fromLocationCode&& - r.isRecommend==false + r.fromLocationCode == result.fromLocationCode && + r.isRecommend == false }) if (itemDetail == undefined) { var newAdd = { - itemCode:itemCode, - packingNumber:packingNumber, - batch:batch, - handleQty:Number(result.label.qty), - qty:detail.qty, - fromLocationCode:locationCode, - inventoryStatus:inventoryStatus, - toInventoryStatus:inventoryStatus, - balance:result.balance, - isRecommend:false, - isNewAdd:"newAdd" + itemCode: itemCode, + packingNumber: packingNumber, + batch: batch, + handleQty: Number(result.label.qty), + qty: detail.qty, + fromLocationCode: locationCode, + inventoryStatus: inventoryStatus, + toInventoryStatus: inventoryStatus, + balance: result.balance, + isRecommend: false, + isNewAdd: "newAdd" } newAdd.balance.balanceQty = Number(result.balance.qty); newAdd.balance.packQty = Number(result.package.packQty) @@ -294,89 +295,89 @@ detail.subList.push(newAdd) } else { if (itemDetail.scaned) { - itemDetail.handleQty = calc.add(itemDetail.handleQty ,Number(result.label.qty)); + itemDetail.handleQty = calc.add(itemDetail.handleQty, Number(result.label.qty)); // this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result // .fromLocationCode + "】已经扫描") - } + } } - this.calcHandleQty(); + this.calcHandleQty(); } } catch (e) { this.showMessage(e.message) } }, -setData(result){ - try { - var packingNumber = result.balance.packingNumber; - var batch = result.balance.batch; - var qty = result.balance.qty; - var itemCode = result.balance.itemCode; - var locationCode = result.balance.locationCode; - var inventoryStatus = result.balance.inventoryStatus; - var detail = this.detailSource.find(r => r.itemCode == itemCode); - - if (detail == undefined) { - this.showErrorMessage("物料号【" + itemCode + "】不在列表中") - } else { - var itemDetail = detail.subList.find(r => { - return r.packingNumber == packingNumber && - r.batch == batch && - r.fromLocationCode == result.fromLocationCode&& - r.isRecommend==false - }) - if (itemDetail == undefined) { - var newAdd = { - itemCode:itemCode, - packingNumber:packingNumber, - batch:batch, - handleQty:detail.qty r.itemCode == itemCode); + + if (detail == undefined) { + this.showErrorMessage("物料号【" + itemCode + "】不在列表中") } else { - if (itemDetail.scaned) { - this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result - .fromLocationCode + "】已经扫描") - } + var itemDetail = detail.subList.find(r => { + return r.packingNumber == packingNumber && + r.batch == batch && + r.fromLocationCode == result.fromLocationCode && + r.isRecommend == false + }) + if (itemDetail == undefined) { + var newAdd = { + itemCode: itemCode, + packingNumber: packingNumber, + batch: batch, + handleQty: detail.qty < Number(result.balance.qty) ? detail.qty : Number(result.balance.qty), + qty: detail.qty, + fromLocationCode: locationCode, + inventoryStatus: inventoryStatus, + toInventoryStatus: inventoryStatus, + balance: result.balance, + isRecommend: false, + isNewAdd: "newAdd" + } + newAdd.balance.balanceQty = Number(result.balance.qty); + newAdd.balance.packQty = Number(result.package.packQty) + newAdd.balance.packUnit = result.package.packUnit + newAdd.scaned = true; + detail.subList.push(newAdd) + this.calcHandleQty(); + } else { + if (itemDetail.scaned) { + this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result + .fromLocationCode + "】已经扫描") + } + } } + } catch (e) { + this.showMessage(e.message) } - } catch (e) { - this.showMessage(e.message) - } }, - + commit() { - var scanCount=0; + var scanCount = 0; this.detailSource.forEach((item) => { item.subList.forEach(cur => { - if(cur.scaned){ + if (cur.scaned) { scanCount++; } - + }) }) - if(scanCount==0){ + if (scanCount == 0) { this.showErrorMessage("扫描数为0,请先扫描") return; } - this.checkCount(); + this.checkCount(); // this.scanCount = getScanCount(this.jobContent.subList); // if (this.scanCount == 0) { // this.showErrorMessage("扫描数为0,请先扫描") // return; // } - + // // //扫描数量和任务数量相等,直接提交 // if (this.scanCount == this.subList.length) { // this.checkCount(); @@ -395,17 +396,17 @@ setData(result){ // } // } }, - - checkCount(){ + + checkCount() { // 提交的数量和任务数量不一致提示 let str = '' this.detailSource.forEach((item) => { - if(item.qty!=item.handleQty){ + if (item.qty != item.handleQty) { str += `物料号【${item.itemCode}】任务数量【${item.qty}】与实际提交数量【${item.handleQty}】不一致` } }) if (str) { - str = str+'\n是否提交?' + str = str + '\n是否提交?' this.$refs.comMessage.showQuestionMessage1(str, 'red', res => { if (res) { this.submitJob() @@ -444,7 +445,7 @@ setData(result){ uni.hideLoading() this.showErrorMessage(error) }) - } else { + } else { uni.hideLoading(); this.showErrorMessage(res.message); } @@ -458,11 +459,12 @@ setData(result){ this.detailSource.forEach(item => { item.subList.forEach(detail => { - if (detail.scaned&&!detail.isRecommend) { + if (detail.scaned && !detail.isRecommend) { detail.toPackingNumber = detail.packingNumber; detail.toContainerNumber = ''; detail.toBatch = detail.batch; - var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,detail.packingNumber, detail.batch); + var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, detail.packingNumber, + detail.batch); detail.toPackingNumber = info.packingNumber; detail.packingNumber = info.packingNumber; detail.fromPackingNumber = info.packingNumber;