|
|
@ -79,6 +79,10 @@ |
|
|
|
calcHandleQty, |
|
|
|
getScanCount |
|
|
|
} from '@/common/detail.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
calc |
|
|
|
} from '@/common/calc' |
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|
|
@ -246,7 +250,7 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
this.$refs.scanPopup.openScanPopup(); |
|
|
|
this.$refs.scanPopup.openScanPopup( this.fromLocationCode ); |
|
|
|
}, |
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
@ -254,13 +258,59 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
|
console.log(result) |
|
|
|
this.managementType ==result.managementType |
|
|
|
if(result.managementType == "BY_BATCH" || result.managementType == "BY_QUANTITY" ){ |
|
|
|
this.setDataBatch(result) |
|
|
|
}else{ |
|
|
|
this.setData(result) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
setDataBatch(result){ |
|
|
|
try { |
|
|
|
var packingNumber = result.package.number; |
|
|
|
var batch = result.label.batch; |
|
|
|
var qty = result.label.qty; |
|
|
|
var itemCode = result.label.itemCode; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
|
|
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
|
console.log(366,batch) |
|
|
|
console.log(366,detail.subList) |
|
|
|
var itemDetail = detail.subList.find(r => { |
|
|
|
return r.batch == batch |
|
|
|
}) |
|
|
|
if (itemDetail == undefined) { |
|
|
|
this.showErrorMessage( "批次[" + batch + "]不在列表中") |
|
|
|
} else { |
|
|
|
if (itemDetail.scaned) { |
|
|
|
// this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描") |
|
|
|
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty) |
|
|
|
} else { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.handleQty = Number(result.label.qty) |
|
|
|
itemDetail.packQty = Number(result.package.packQty) |
|
|
|
itemDetail.packUnit = result.package.packUnit |
|
|
|
this.calcHandleQty(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
this.showMessage(e.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
setData(result){ |
|
|
|
try { |
|
|
|
var packingNumber = result.package.number; |
|
|
|
var batch = result.label.batch; |
|
|
|
var qty = result.label.qty; |
|
|
|
var itemCode = result.label.itemCode; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
@ -279,7 +329,7 @@ |
|
|
|
itemDetail.packQty = Number(result.package.packQty) |
|
|
|
itemDetail.packUnit = result.package.packUnit |
|
|
|
this.calcHandleQty(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -287,7 +337,6 @@ |
|
|
|
this.showMessage(e.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
scanLocationCode(location, code) { |
|
|
|
this.toLocationCode = code |
|
|
|
this.detailSource.forEach(item => { |
|
|
@ -310,12 +359,20 @@ |
|
|
|
|
|
|
|
// //扫描数量和任务数量相等,直接提交 |
|
|
|
if (this.scanCount == this.subList.length) { |
|
|
|
this.checkCount(); |
|
|
|
if(this.managementType == "BY_BATCH" || this.managementType == "BY_QUANTITY" ){ |
|
|
|
this.checkCountBatch() |
|
|
|
}else{ |
|
|
|
this.checkCount(); |
|
|
|
} |
|
|
|
} else if (this.scanCount < this.subList.length) { |
|
|
|
//扫描数量小于任务数量,判断是否允许部分提交 |
|
|
|
if (this.jobContent.allowPartialComplete == "TRUE") { |
|
|
|
//提交 |
|
|
|
this.checkCount(); |
|
|
|
if(this.managementType == "BY_BATCH" || this.managementType == "BY_QUANTITY" ){ |
|
|
|
this.checkCountBatch() |
|
|
|
}else{ |
|
|
|
this.checkCount(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//不允许部分提交,提示 |
|
|
|
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { |
|
|
@ -354,7 +411,51 @@ |
|
|
|
this.submitJob() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
checkCountBatch(){ |
|
|
|
// 提交的数量和任务数量不一致提示 |
|
|
|
let str = '' |
|
|
|
let str1 = '' |
|
|
|
let str2 = '' |
|
|
|
this.detailSource.forEach((item) => { |
|
|
|
item.subList.forEach(cur => { |
|
|
|
if (cur.qty != cur.handleQty) { |
|
|
|
var tempHandleQty =0 |
|
|
|
if(cur.handleQty){ |
|
|
|
tempHandleQty=cur.handleQty |
|
|
|
}else { |
|
|
|
tempHandleQty =0 |
|
|
|
} |
|
|
|
str += `批次【${cur.batch}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致` |
|
|
|
} |
|
|
|
if(cur.handleQty > cur.qty){ |
|
|
|
str1 = `批次【${cur.batch}】提交数量【${ cur.handleQty}】不可以大于推荐数量【${cur.qty}】` |
|
|
|
} |
|
|
|
if(cur.handleQty < cur.qty){ |
|
|
|
str2 = `批次【${cur.batch}】提交数量【${ cur.handleQty}】不可以小于推荐数量【${cur.qty}】` |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.jobContent.allowBiggerQty = 'FALSE' |
|
|
|
if(this.jobContent.allowBiggerQty == 'FALSE' &&str1){ |
|
|
|
this.$refs.comMessage.showConfirmWarningModal(str1) |
|
|
|
return |
|
|
|
} |
|
|
|
if(this.jobContent.allowSmallerQty == 'FALSE' && str2){ |
|
|
|
this.$refs.comMessage.showConfirmWarningModal(str2) |
|
|
|
return |
|
|
|
} |
|
|
|
if (str) { |
|
|
|
str = '任务明细未全部完成,是否提交?\n'+str |
|
|
|
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => { |
|
|
|
if (res) { |
|
|
|
this.submitJob() |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.submitJob() |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
submitJob() { |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
@ -370,6 +471,7 @@ |
|
|
|
this.managementList = res.list; |
|
|
|
var params = this.setParams() |
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
|
|
customerReturnJobSubmit(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|