diff --git a/src/pages/inventoryMove/job/inventoryMoveDetail.vue b/src/pages/inventoryMove/job/inventoryMoveDetail.vue index 9a17e858..6cf1e19c 100644 --- a/src/pages/inventoryMove/job/inventoryMoveDetail.vue +++ b/src/pages/inventoryMove/job/inventoryMoveDetail.vue @@ -14,8 +14,7 @@ + :allowEditQty="jobContent.allowModifyQty=='TRUE'?true:false" @openDetail="openDetail"> @@ -71,7 +70,7 @@ import { calc } from '@/common/calc.js'; - + import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPack from '@/mycomponents/scan/winScanPack.vue' @@ -101,7 +100,7 @@ toLocationInfo: {}, businessTypeInfo: {}, managementList: [], - managementType:'', + managementType: '', businessTypeCode: '', toLocationCode: '', toInventoryStatus: '', @@ -239,7 +238,7 @@ that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes); that.jobStatus = res.data.status that.subList = res.data.subList; - that.detailSource =await getDataSource(that.subList) + that.detailSource = await getDataSource(that.subList) //获取管理模式,封装参数 var itemCodes = [] this.detailSource.forEach(item => { @@ -250,7 +249,8 @@ getManagementPrecisions(itemCodes, this.toLocationCode, res => { if (res.success) { this.managementList = res.list; - this.managementType = this.managementList.some(item => item.ManagementPrecision == + this.managementType = this.managementList.some(item => item + .ManagementPrecision == 'BY_BATCH') ? 'BY_BATCH' : '' } }) @@ -313,17 +313,17 @@ }, - getScanResult(result,managementPrecision) { - this.managementType = managementPrecision - if(managementPrecision == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY' ){ - this.setDataBatch(result,managementPrecision) - }else{ - this.setData(result,managementPrecision) + getScanResult(result, managementPrecision) { + this.managementType = managementPrecision + if (managementPrecision == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY') { + this.setDataBatch(result, managementPrecision) + } else { + this.setData(result, managementPrecision) } - + }, - setDataBatch(result,managementPrecision){ - console.log(877,result.balance.qty) + setDataBatch(result, managementPrecision) { + console.log(877, result.balance.qty) try { var packingNumber = result.label.packingNumber; var batch = result.label.batch; @@ -334,22 +334,22 @@ this.showMessage("物料号【" + itemCode + "】不在列表中") } else { var itemDetail = '' - if(managementPrecision == 'BY_QUANTITY'){ + if (managementPrecision == 'BY_QUANTITY') { itemDetail = detail.subList.find(r => { return r.itemCode == result.label.itemCode }) - }else{ + } else { itemDetail = detail.subList.find(r => { return r.batch == batch }) } - + if (itemDetail == undefined && managementPrecision != 'BY_QUANTITY') { - this.showErrorMessage( "批次[" + batch + "]不在列表中") + this.showErrorMessage("批次[" + batch + "]不在列表中") } else { if (itemDetail.scaned) { // this.showMessage("批次【" + batch + "】已经扫描") - itemDetail.handleQty =calc.add(itemDetail.handleQty,Number(result.label.qty)); + itemDetail.handleQty = calc.add(itemDetail.handleQty, Number(result.label.qty)); this.calcHandleQty(); } else { let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); @@ -397,8 +397,8 @@ this.showErrorMessage(e.message); } }, - - setData(result,managementPrecision){ + + setData(result, managementPrecision) { try { var packingNumber = result.label.packingNumber; var batch = result.label.batch; @@ -409,18 +409,18 @@ this.showMessage("物料号【" + itemCode + "】不在列表中") } else { var itemDetail = '' - if(managementPrecision == 'BY_QUANTITY'){ + if (managementPrecision == 'BY_QUANTITY') { itemDetail = detail.subList.find(r => { return r.itemCode == result.label.itemCode }) - }else{ + } else { itemDetail = detail.subList.find(r => { return r.batch == batch }) } - + if (itemDetail == undefined && managementPrecision != 'BY_QUANTITY') { - this.showErrorMessage( "批次[" + batch + "]不在列表中") + this.showErrorMessage("批次[" + batch + "]不在列表中") } else { if (itemDetail.scaned) { this.showMessage("批次【" + batch + "】已经扫描") @@ -477,14 +477,16 @@ this.showErrorMessage("扫描数为0,请先扫描") return; } -//查询管理模式 + //查询管理模式 this.managementList = []; var precisionStrategParams = this.setPrecisionStrategParams() await getPrecisionStrategyList(precisionStrategParams, 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' - console.log(11,this.managementType) + this.managementType = this.managementList && this.managementList[0] && this + .managementList[0].ManagementPrecision ? this.managementList[0] + .ManagementPrecision : 'BY_PACKAGING' + console.log(11, this.managementType) } else { uni.hideLoading(); this.showErrorMessage(res.message); @@ -493,18 +495,18 @@ //允许部分提交 //扫描数量和任务数量相等,直接提交 if (this.scanCount == this.subList.length) { - if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){ + if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') { this.checkCountBatch(); - }else{ + } else { this.checkCount(); } } else if (this.scanCount < this.subList.length) { //扫描数量小于任务数量,判断是否允许部分提交 if (this.jobContent.allowPartialComplete == "TRUE") { //提交 - if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY' ){ + if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') { this.checkCountBatch(); - }else{ + } else { this.checkCount(); } } else { @@ -545,14 +547,14 @@ this.submitJob() } }, - checkCountBatch(){ + checkCountBatch() { // 提交的数量和任务数量不一致提示 let str = '' let str1 = '' this.detailSource.forEach((item) => { item.subList.forEach(cur => { - - if(cur.scaned){ + + if (cur.scaned) { if (cur.qty != cur.handleQty) { var tempHandleQty = 0 if (cur.handleQty) { @@ -560,17 +562,22 @@ } else { tempHandleQty = 0 } - str += - `物料号【${item.itemCode}】批次【${cur.batch}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致\n` - if(cur.handleQty > cur.balance.balanceQty){ - str1 += - `物料号【${item.itemCode}】批次【${cur.batch}】提交数量【${ cur.handleQty}】不可以大于库存数量【${cur.balance.balanceQty}】` + var batchHint = cur.batch ? `批次【${cur.batch}】` : `` + str += `物料号【${item.itemCode}】` + `${batchHint}` + + `提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致\n` + if (cur.handleQty > cur.balance.balanceQty) { + str1 += `物料号【${item.itemCode}】` + `${batchHint}` + + `提交数量【${ cur.handleQty}】不可以大于库存数量【${cur.balance.balanceQty}】` } } + } else { + var batchHint = cur.batch ? `批次【${cur.batch}】` : `` + str += `物料号【${item.itemCode}】` + `${batchHint}` + + `提交数量【0】与任务物料数量【${cur.qty}】不一致\n` } }) }) - if(str1){ + if (str1) { this.$refs.comMessage.showConfirmWarningModal(str1) return } @@ -592,6 +599,7 @@ }); var params = this.setParams() console.log("提交" + JSON.stringify(params)) + return; inventoryMoveSubmit(params).then(res => { uni.hideLoading() if (res.data) {