Browse Source

YT-1131 物料隔离任务,提交校验多个物料部分提交

intex
lijuncheng 2 days ago
parent
commit
c1ac5ee906
  1. 80
      src/pages/inventoryMove/job/inventoryMoveDetail.vue

80
src/pages/inventoryMove/job/inventoryMoveDetail.vue

@ -14,8 +14,7 @@
<view class=""> <view class="">
<comInventoryDetailCard :dataContent="item" :settingParam="jobContent" @remove="updateData" <comInventoryDetailCard :dataContent="item" :settingParam="jobContent" @remove="updateData"
@updateData='updateData' :locationAreaTypeList="toLocationAreaTypeList" @updateData='updateData' :locationAreaTypeList="toLocationAreaTypeList"
:allowEditQty ="jobContent.allowModifyQty=='TRUE'?true:false" :allowEditQty="jobContent.allowModifyQty=='TRUE'?true:false" @openDetail="openDetail">
@openDetail="openDetail">
</comInventoryDetailCard> </comInventoryDetailCard>
</view> </view>
</view> </view>
@ -101,7 +100,7 @@
toLocationInfo: {}, toLocationInfo: {},
businessTypeInfo: {}, businessTypeInfo: {},
managementList: [], managementList: [],
managementType:'', managementType: '',
businessTypeCode: '', businessTypeCode: '',
toLocationCode: '', toLocationCode: '',
toInventoryStatus: '', toInventoryStatus: '',
@ -239,7 +238,7 @@
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes); that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes);
that.jobStatus = res.data.status that.jobStatus = res.data.status
that.subList = res.data.subList; that.subList = res.data.subList;
that.detailSource =await getDataSource(that.subList) that.detailSource = await getDataSource(that.subList)
// //
var itemCodes = [] var itemCodes = []
this.detailSource.forEach(item => { this.detailSource.forEach(item => {
@ -250,7 +249,8 @@
getManagementPrecisions(itemCodes, this.toLocationCode, res => { getManagementPrecisions(itemCodes, this.toLocationCode, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision == this.managementType = this.managementList.some(item => item
.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : '' 'BY_BATCH') ? 'BY_BATCH' : ''
} }
}) })
@ -313,17 +313,17 @@
}, },
getScanResult(result,managementPrecision) { getScanResult(result, managementPrecision) {
this.managementType = managementPrecision this.managementType = managementPrecision
if(managementPrecision == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY' ){ if (managementPrecision == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY') {
this.setDataBatch(result,managementPrecision) this.setDataBatch(result, managementPrecision)
}else{ } else {
this.setData(result,managementPrecision) this.setData(result, managementPrecision)
} }
}, },
setDataBatch(result,managementPrecision){ setDataBatch(result, managementPrecision) {
console.log(877,result.balance.qty) console.log(877, result.balance.qty)
try { try {
var packingNumber = result.label.packingNumber; var packingNumber = result.label.packingNumber;
var batch = result.label.batch; var batch = result.label.batch;
@ -334,22 +334,22 @@
this.showMessage("物料号【" + itemCode + "】不在列表中") this.showMessage("物料号【" + itemCode + "】不在列表中")
} else { } else {
var itemDetail = '' var itemDetail = ''
if(managementPrecision == 'BY_QUANTITY'){ if (managementPrecision == 'BY_QUANTITY') {
itemDetail = detail.subList.find(r => { itemDetail = detail.subList.find(r => {
return r.itemCode == result.label.itemCode return r.itemCode == result.label.itemCode
}) })
}else{ } else {
itemDetail = detail.subList.find(r => { itemDetail = detail.subList.find(r => {
return r.batch == batch return r.batch == batch
}) })
} }
if (itemDetail == undefined && managementPrecision != 'BY_QUANTITY') { if (itemDetail == undefined && managementPrecision != 'BY_QUANTITY') {
this.showErrorMessage( "批次[" + batch + "]不在列表中") this.showErrorMessage("批次[" + batch + "]不在列表中")
} else { } else {
if (itemDetail.scaned) { if (itemDetail.scaned) {
// this.showMessage("" + batch + "") // 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(); this.calcHandleQty();
} else { } else {
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus);
@ -398,7 +398,7 @@
} }
}, },
setData(result,managementPrecision){ setData(result, managementPrecision) {
try { try {
var packingNumber = result.label.packingNumber; var packingNumber = result.label.packingNumber;
var batch = result.label.batch; var batch = result.label.batch;
@ -409,18 +409,18 @@
this.showMessage("物料号【" + itemCode + "】不在列表中") this.showMessage("物料号【" + itemCode + "】不在列表中")
} else { } else {
var itemDetail = '' var itemDetail = ''
if(managementPrecision == 'BY_QUANTITY'){ if (managementPrecision == 'BY_QUANTITY') {
itemDetail = detail.subList.find(r => { itemDetail = detail.subList.find(r => {
return r.itemCode == result.label.itemCode return r.itemCode == result.label.itemCode
}) })
}else{ } else {
itemDetail = detail.subList.find(r => { itemDetail = detail.subList.find(r => {
return r.batch == batch return r.batch == batch
}) })
} }
if (itemDetail == undefined && managementPrecision != 'BY_QUANTITY') { if (itemDetail == undefined && managementPrecision != 'BY_QUANTITY') {
this.showErrorMessage( "批次[" + batch + "]不在列表中") this.showErrorMessage("批次[" + batch + "]不在列表中")
} else { } else {
if (itemDetail.scaned) { if (itemDetail.scaned) {
this.showMessage("批次【" + batch + "】已经扫描") this.showMessage("批次【" + batch + "】已经扫描")
@ -477,14 +477,16 @@
this.showErrorMessage("扫描数为0,请先扫描") this.showErrorMessage("扫描数为0,请先扫描")
return; return;
} }
// //
this.managementList = []; this.managementList = [];
var precisionStrategParams = this.setPrecisionStrategParams() var precisionStrategParams = this.setPrecisionStrategParams()
await getPrecisionStrategyList(precisionStrategParams, res => { await getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; 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
console.log(11,this.managementType) .managementList[0].ManagementPrecision ? this.managementList[0]
.ManagementPrecision : 'BY_PACKAGING'
console.log(11, this.managementType)
} else { } else {
uni.hideLoading(); uni.hideLoading();
this.showErrorMessage(res.message); this.showErrorMessage(res.message);
@ -493,18 +495,18 @@
// //
// //
if (this.scanCount == this.subList.length) { 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(); this.checkCountBatch();
}else{ } else {
this.checkCount(); this.checkCount();
} }
} else if (this.scanCount < this.subList.length) { } else if (this.scanCount < this.subList.length) {
// //
if (this.jobContent.allowPartialComplete == "TRUE") { 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(); this.checkCountBatch();
}else{ } else {
this.checkCount(); this.checkCount();
} }
} else { } else {
@ -545,14 +547,14 @@
this.submitJob() this.submitJob()
} }
}, },
checkCountBatch(){ checkCountBatch() {
// //
let str = '' let str = ''
let str1 = '' let str1 = ''
this.detailSource.forEach((item) => { this.detailSource.forEach((item) => {
item.subList.forEach(cur => { item.subList.forEach(cur => {
if(cur.scaned){ if (cur.scaned) {
if (cur.qty != cur.handleQty) { if (cur.qty != cur.handleQty) {
var tempHandleQty = 0 var tempHandleQty = 0
if (cur.handleQty) { if (cur.handleQty) {
@ -560,17 +562,22 @@
} else { } else {
tempHandleQty = 0 tempHandleQty = 0
} }
str += var batchHint = cur.batch ? `批次【${cur.batch}` : ``
`物料号【${item.itemCode}】批次【${cur.batch}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致\n` str += `物料号【${item.itemCode}` + `${batchHint}` +
if(cur.handleQty > cur.balance.balanceQty){ `提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致\n`
str1 += if (cur.handleQty > cur.balance.balanceQty) {
`物料号【${item.itemCode}】批次【${cur.batch}】提交数量【${ 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) this.$refs.comMessage.showConfirmWarningModal(str1)
return return
} }
@ -592,6 +599,7 @@
}); });
var params = this.setParams() var params = this.setParams()
console.log("提交" + JSON.stringify(params)) console.log("提交" + JSON.stringify(params))
return;
inventoryMoveSubmit(params).then(res => { inventoryMoveSubmit(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {

Loading…
Cancel
Save