|
|
@ -5,7 +5,7 @@ |
|
|
|
<view class="header_job_top"> |
|
|
|
<jobTopAsn :dataContent="jobContent"></jobTopAsn> |
|
|
|
</view> |
|
|
|
<view v-if="operation=='receipt'" class="uni-flex uni-row " |
|
|
|
<view v-if="operation=='receipt' && (managementList == 'BY_BATCH' || managementType == 'BY_QUANTITY')" class="uni-flex uni-row " |
|
|
|
style=";margin-top: 10rpx; margin-left: 10rpx; text-align: right;"> |
|
|
|
<view class="font_default" style="display: block; "> |
|
|
|
整单收货 |
|
|
@ -32,7 +32,7 @@ |
|
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|
|
|
<view class=""> |
|
|
|
<!-- 管理精度是批次 --> |
|
|
|
<comReceiptDetailCardBacth :dataContent="item" :index="index" :settingParam="jobContent" |
|
|
|
<comReceiptDetailCardBacth ref='comReceiptDetailCardBacthRef' :dataContent="item" :index="index" :settingParam="jobContent" |
|
|
|
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList' |
|
|
|
v-if="managementType == 'BY_BATCH' || managementType =='BY_QUANTITY'"> |
|
|
|
</comReceiptDetailCardBacth> |
|
|
@ -178,8 +178,10 @@ |
|
|
|
reasonText: "", |
|
|
|
packingNumberList:[], |
|
|
|
source_type:'', |
|
|
|
idValue:0 |
|
|
|
// printDeafult: {}, //默认打印机 |
|
|
|
// templateDeafult: {} //默认的模板 |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
@ -319,11 +321,8 @@ |
|
|
|
}, |
|
|
|
getScanResult(result) { |
|
|
|
this.balanceInfo = result.balance |
|
|
|
console.log(this.managementType) |
|
|
|
if(this.managementType == 'BY_BATCH'){ |
|
|
|
if(this.managementType == 'BY_BATCH'||this.managementType == 'BY_QUANTITY'){ |
|
|
|
this.getScanResultAfterBatch(result) |
|
|
|
}else if(this.managementType == 'BY_QUANTITY' ){ |
|
|
|
this.getScanResultAfterQuantity(result) |
|
|
|
}else{ |
|
|
|
this.getScanResultAfter(result) |
|
|
|
} |
|
|
@ -439,6 +438,7 @@ |
|
|
|
}, |
|
|
|
// 批次扫码之后逻辑 |
|
|
|
getScanResultAfterBatch(result){ |
|
|
|
console.log(222,result) |
|
|
|
try { |
|
|
|
var itemCode = result.label.itemCode; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
@ -469,7 +469,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (result.label.labelType == "PurchaseLabel") { |
|
|
|
debugger |
|
|
|
// debugger |
|
|
|
var packingNumber = result.package.number; |
|
|
|
var parentpackingNumber = result.package.parentNumber; |
|
|
|
var batch = result.label.batch; |
|
|
@ -479,218 +479,84 @@ |
|
|
|
this.showMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
|
//物料在列表中 |
|
|
|
var itemDetail = detail.subList.find(r => r.batch == |
|
|
|
const batchDetailList = detail.subList.filter(r => r.batch == |
|
|
|
batch); |
|
|
|
if (itemDetail == undefined) { |
|
|
|
itemDetail = detail.subList.find(r => r.batch == |
|
|
|
batch); |
|
|
|
|
|
|
|
if (itemDetail == undefined) { |
|
|
|
this.showMessage("批次【" + batch + "】不在列表中") |
|
|
|
} else { |
|
|
|
var pack = itemDetail.packList.find(p => |
|
|
|
p.batch == batch) |
|
|
|
if (pack == undefined) { |
|
|
|
if (!batchDetailList || batchDetailList && batchDetailList.length == 0) { |
|
|
|
this.showMessage("批次【" + batch + "】不在列表中") |
|
|
|
} else { |
|
|
|
let isScan = false |
|
|
|
if(packingNumber){ |
|
|
|
isScan = this.packList.some(item=>item == packingNumber) |
|
|
|
}else{ |
|
|
|
isScan = false |
|
|
|
// 箱码是否已经扫描 |
|
|
|
var isHavePackingNumber =this.packingNumberList.find(r => r.packingNumber == packingNumber); |
|
|
|
if(isHavePackingNumber){ |
|
|
|
this.showMessage("箱码【" + packingNumber + "】已经扫描"); |
|
|
|
return |
|
|
|
} |
|
|
|
if (isScan) { |
|
|
|
pack.scanDate = new Date(); |
|
|
|
// this.showMessage("箱码【" + packingNumber + "】已经扫描"); |
|
|
|
for(let i = 0 ; i <batchDetailList.length;i++){ |
|
|
|
// 记录已经扫描箱码的总数量 |
|
|
|
let packAllHandleQty = new Decimal(0).toNumber() |
|
|
|
batchDetailList[i].packList.forEach(pack=>{ |
|
|
|
pack.handleQty =pack.handleQty? pack.handleQty :0 |
|
|
|
packAllHandleQty = calc.add(packAllHandleQty,pack.handleQty) |
|
|
|
}) |
|
|
|
// 批次任务数量减去当前扫描总箱码数量的差为该批次还有多少任务数量没有扫 |
|
|
|
let handleQtySub = calc.sub(parseFloat(batchDetailList[i].qty),parseFloat(packAllHandleQty)) |
|
|
|
let pack = {} |
|
|
|
pack.packingNumber =packingNumber |
|
|
|
pack.packQty = result.package.packQty |
|
|
|
pack.packUnit = result.package.packUnit |
|
|
|
pack.qty = batchDetailList[i].qty |
|
|
|
|
|
|
|
pack.handleQty = calc.add(pack.handleQty,result.label.qty) |
|
|
|
} else { |
|
|
|
this.packList.push(packingNumber) |
|
|
|
pack.packList.push(packingNumber) |
|
|
|
pack.scaned = true |
|
|
|
pack.scanDate = new Date(); |
|
|
|
pack.handleQty = Number(result.label.qty); |
|
|
|
pack.toLocationCode = this.toLocationCode; |
|
|
|
pack.labelQty = Number(result.label.qty); |
|
|
|
} |
|
|
|
} |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
itemDetail.packList.sort(compareDesc('scanDate')); //按扫描信息排序 |
|
|
|
this.$forceUpdate() |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
//扫描的是外包装,将包装集合全部扫描 |
|
|
|
var scanedLength = 0; |
|
|
|
itemDetail.packList.forEach(res => { |
|
|
|
if (res.scaned) { |
|
|
|
scanedLength++; |
|
|
|
pack.labelQty = Number(qty); |
|
|
|
pack.scaned = true; |
|
|
|
// 当前批次剩余可以扫进的数量大于当前扫描的标签数量的时候直接插入当前的批次 |
|
|
|
if(handleQtySub >= parseFloat(qty)){ |
|
|
|
pack.handleQty = Number(qty); |
|
|
|
batchDetailList[i].packList.push(pack) |
|
|
|
batchDetailList[i].scaned = true |
|
|
|
const isHave = this.packingNumberList.find(item=>item.packingNumber == packingNumber) |
|
|
|
if(!isHave){ |
|
|
|
this.packingNumberList.push(pack) |
|
|
|
} |
|
|
|
}) |
|
|
|
let isScan = false |
|
|
|
if(packingNumber){ |
|
|
|
isScan = this.packingNumberList.some(item=>item == packingNumber) |
|
|
|
calcTreeHandleQty(this.detailSource); |
|
|
|
break |
|
|
|
}else{ |
|
|
|
isScan = false |
|
|
|
} |
|
|
|
if (isScan) { |
|
|
|
itemDetail.scanDate = new Date(); |
|
|
|
// this.showMessage("箱码【" + packingNumber + "】已经扫描") |
|
|
|
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty) |
|
|
|
} else { |
|
|
|
this.packingNumberList.push(packingNumber) |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.scanDate = new Date(); |
|
|
|
itemDetail.handleQty =itemDetail.handleQty ?itemDetail.handleQty:0 |
|
|
|
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty) |
|
|
|
console.log(itemDetail.handleQty) |
|
|
|
itemDetail.toLocationCode = this.toLocationCode; |
|
|
|
itemDetail.labelQty = Number(result.label.qty); |
|
|
|
itemDetail.packList.forEach(pac => { |
|
|
|
pac.scaned = true |
|
|
|
pac.scanDate = new Date(); |
|
|
|
pac.handleQty = calc.add(pac.handleQty,result.label.qty); |
|
|
|
pac.toLocationCode = this.toLocationCode; |
|
|
|
}) |
|
|
|
detail.handleQty = itemDetail.handleQty |
|
|
|
this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 |
|
|
|
this.continueScan() |
|
|
|
this.$forceUpdate() |
|
|
|
// 如果扫描的数量大于每行的任务剩余扫进去的数量 |
|
|
|
if(handleQtySub != 0){ |
|
|
|
// 如果是最后一行所有数量直接放入最后一行 |
|
|
|
if(batchDetailList.length-1 == i){ |
|
|
|
pack.handleQty = qty; |
|
|
|
}else{ |
|
|
|
// 不是最后一行取当前批次剩余可以扫进的数量 |
|
|
|
pack.handleQty = handleQtySub; |
|
|
|
} |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
batchDetailList[i].packList.push(pack) |
|
|
|
batchDetailList[i].scaned = true |
|
|
|
qty = calc.sub(parseFloat(qty),parseFloat(handleQtySub)) |
|
|
|
// 如果箱码没有被扫过直接插入记录箱码的列表,扫过了不计入 |
|
|
|
const isHave = this.packingNumberList.find(item=>item.packingNumber == packingNumber) |
|
|
|
if(!isHave){ |
|
|
|
this.packingNumberList.push(pack) |
|
|
|
} |
|
|
|
calcTreeHandleQty(this.detailSource); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
this.showErrorMessage(e.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 数量扫码之后逻辑 |
|
|
|
getScanResultAfterQuantity(result){ |
|
|
|
try { |
|
|
|
var itemCode = result.label.itemCode; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
|
if (detail == undefined) { |
|
|
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
detail.scaned = true; |
|
|
|
if (result.label.labelType == "ContainerLabel") { |
|
|
|
var containerNumber = result.label.container; |
|
|
|
var itemDetail = detail.subList.filter(r => r.containerNumber == containerNumber); |
|
|
|
if (itemDetail.length == 0) { |
|
|
|
this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】不在列表中") |
|
|
|
} else { |
|
|
|
if (itemDetail[0].scaned) { |
|
|
|
this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】已经扫描") |
|
|
|
} else { |
|
|
|
itemDetail.forEach(item => { |
|
|
|
item.scaned = true; |
|
|
|
itemDetail.scanDate = new Date(); |
|
|
|
item.handleQty = calc.add(item.handleQty,result.label.qty) |
|
|
|
item.toLocationCode = this.toLocationCode; |
|
|
|
console.log(8777,this.detailSource) |
|
|
|
|
|
|
|
setTimeout(()=>{ |
|
|
|
this.$refs.comReceiptDetailCardBacthRef.forEach(item=>{ |
|
|
|
item.resizeCollapse() |
|
|
|
|
|
|
|
item.$refs.packageListRef.$refs.collapse2.forEach(cur=>{ |
|
|
|
cur.resize() |
|
|
|
}) |
|
|
|
// calcHandleQty(this.detailSource); |
|
|
|
this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 |
|
|
|
this.continueScan() |
|
|
|
this.$forceUpdate() |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (result.label.labelType == "PurchaseLabel") { |
|
|
|
var packingNumber = result.package.number; |
|
|
|
var parentpackingNumber = result.package.parentNumber; |
|
|
|
var batch = result.label.batch; |
|
|
|
var qty = result.label.qty; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
|
console.log(8989,this.detailSource) |
|
|
|
if (detail == undefined) { |
|
|
|
this.showMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
|
//物料在列表中 |
|
|
|
// var itemDetail = detail.subList.find(r => r.batch == |
|
|
|
// batch); |
|
|
|
// if (itemDetail == undefined) { |
|
|
|
// itemDetail = detail.subList.find(r => r.batch == |
|
|
|
// batch); |
|
|
|
|
|
|
|
// if (itemDetail == undefined) { |
|
|
|
// this.showMessage("批次【" + batch + "】不在列表中") |
|
|
|
// } else { |
|
|
|
// var pack = itemDetail.packList.find(p => |
|
|
|
// p.batch == batch) |
|
|
|
// if (pack == undefined) { |
|
|
|
// this.showMessage("批次【" + batch + "】不在列表中") |
|
|
|
// } else { |
|
|
|
let isScan = false |
|
|
|
const itemDetail = detail.subList[0] |
|
|
|
let pack = detail.subList[0] && detail.subList[0].length>0 ?detail.subList[0] : {} |
|
|
|
if(packingNumber){ |
|
|
|
isScan = this.packingNumberList.some(item=>item == packingNumber) |
|
|
|
}else{ |
|
|
|
isScan = false |
|
|
|
} |
|
|
|
if (isScan) { |
|
|
|
detail.subList[0].scanDate = new Date(); |
|
|
|
// this.showMessage("箱码【" + packingNumber + "】已经扫描"); |
|
|
|
}) |
|
|
|
},500) |
|
|
|
|
|
|
|
detail.subList[0].handleQty = calc.add(detail.subList[0].handleQty,result.label.qty) |
|
|
|
} else { |
|
|
|
this.packingNumberList.push(packingNumber) |
|
|
|
detail.subList[0].scaned = true |
|
|
|
detail.subList[0].scanDate = new Date(); |
|
|
|
detail.subList[0].handleQty = Number(result.label.qty); |
|
|
|
detail.subList[0].toLocationCode = this.toLocationCode; |
|
|
|
detail.subList[0].labelQty = Number(result.label.qty); |
|
|
|
} |
|
|
|
// } |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
this.continueScan() |
|
|
|
// itemDetail.packList[0] = detail.subList[0]; //按扫描信息排序 |
|
|
|
this.$forceUpdate() |
|
|
|
// } |
|
|
|
|
|
|
|
// } else { |
|
|
|
// //扫描的是外包装,将包装集合全部扫描 |
|
|
|
// var scanedLength = 0; |
|
|
|
// itemDetail.packList.forEach(res => { |
|
|
|
// if (res.scaned) { |
|
|
|
// scanedLength++; |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// debugger |
|
|
|
// let isScan = false |
|
|
|
// if(packingNumber){ |
|
|
|
// isScan = this.packingNumberList.some(item=>item == packingNumber) |
|
|
|
// }else{ |
|
|
|
// isScan = false |
|
|
|
// } |
|
|
|
// if (isScan) { |
|
|
|
// itemDetail.scanDate = new Date(); |
|
|
|
// // this.showMessage("箱码【" + packingNumber + "】已经扫描") |
|
|
|
// itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty) |
|
|
|
// } else { |
|
|
|
// this.packingNumberList.push(packingNumber) |
|
|
|
// itemDetail.scaned = true; |
|
|
|
// itemDetail.scanDate = new Date(); |
|
|
|
// itemDetail.handleQty =itemDetail.handleQty ?itemDetail.handleQty:0 |
|
|
|
// itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty) |
|
|
|
// console.log(itemDetail.handleQty) |
|
|
|
// itemDetail.toLocationCode = this.toLocationCode; |
|
|
|
// itemDetail.labelQty = Number(result.label.qty); |
|
|
|
// itemDetail.packList.forEach(pac => { |
|
|
|
// pac.scaned = true |
|
|
|
// pac.scanDate = new Date(); |
|
|
|
// pac.handleQty = calc.add(pac.handleQty,result.label.qty); |
|
|
|
// pac.toLocationCode = this.toLocationCode; |
|
|
|
// }) |
|
|
|
// detail.handleQty = itemDetail.handleQty |
|
|
|
// this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 |
|
|
|
// this.continueScan() |
|
|
|
// this.$forceUpdate() |
|
|
|
// } |
|
|
|
// calcHandleQty(this.detailSource); |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -708,12 +574,20 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
updateData() { |
|
|
|
updateData(ele,index) { |
|
|
|
// if(this.managementType == 'BY_BATCH'){ |
|
|
|
// }else{ |
|
|
|
// calcTreeHandleQty(this.detailSource) |
|
|
|
// } |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
if(ele){ |
|
|
|
ele.packList.splice(index,1) |
|
|
|
if(ele.packList.length == 0){ |
|
|
|
ele.scaned = false |
|
|
|
} |
|
|
|
this.packingNumberList.splice(index,1) |
|
|
|
} |
|
|
|
|
|
|
|
calcTreeHandleQty(this.detailSource); |
|
|
|
}, |
|
|
|
|
|
|
|
scanLocationCode(location, code) { |
|
|
@ -737,6 +611,8 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
commit() { |
|
|
|
this.scanCount = getScanCount(this.detailSource); |
|
|
|
console.log(this.scanCount ) |
|
|
|
if (this.scanCount == 0) { |
|
|
|
this.showErrorMessage("扫描数为0,请先扫描") |
|
|
|
return; |
|
|
@ -794,9 +670,35 @@ |
|
|
|
//按批次的校验 |
|
|
|
checkBatch(){ |
|
|
|
//扫描数量和任务数量相等,直接提交 |
|
|
|
const scanCount1 = this.detailSource |
|
|
|
const current = this.detailSource.find(item=> item.handleQty<item.qty) |
|
|
|
if(current){ |
|
|
|
let str = '' |
|
|
|
let str1 = '' |
|
|
|
var scanCount=0; |
|
|
|
this.detailSource.forEach((item) => { |
|
|
|
item.subList.forEach(cur=>{ |
|
|
|
if(cur.scaned){ |
|
|
|
scanCount++; |
|
|
|
if(parseFloat(cur.qty)>parseFloat(cur.handleQty)){ |
|
|
|
str += `物料号【${item.itemCode}】批次【${cur.batch}】实际提交数量【${cur.handleQty}】不可以小于任务数量【${cur.qty}】\n` |
|
|
|
} |
|
|
|
if(parseFloat(cur.qty)<parseFloat(cur.handleQty)){ |
|
|
|
str1 += `物料号【${item.itemCode}】批次【${cur.batch}】实际提交数量【${cur.handleQty}】不可以大于任务数量【${cur.qty}】\n` |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
if(this.jobContent.allowBiggerQty == "FALSE"){ |
|
|
|
if(str1){ |
|
|
|
this.$refs.comMessage.showErrorMessage(str1); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.jobContent.allowSmallerQty == "FALSE"){ |
|
|
|
if(str){ |
|
|
|
this.$refs.comMessage.showErrorMessage(str); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.scanCount < this.subList.length){ |
|
|
|
//扫描数量小于任务数量,判断是否允许部分提交 |
|
|
|
if (this.jobContent.allowPartialComplete == "TRUE") { |
|
|
|
//提交 |
|
|
@ -854,7 +756,6 @@ |
|
|
|
var params = this.setParams(); |
|
|
|
let that = this |
|
|
|
console.log(877,params) |
|
|
|
// return; |
|
|
|
purchaseReceiptJobSubmit(params).then(res => { |
|
|
|
|
|
|
|
if (res.data) { |
|
|
@ -868,6 +769,7 @@ |
|
|
|
}) |
|
|
|
}else if(!isCheckPrint1 && !isCheckPrint){ |
|
|
|
this.showCommitSuccessMessage("提交成功\n生成采购收货记录\n" + res.data.number) |
|
|
|
uni.hideLoading() |
|
|
|
}else if(that.source_type!='TOOL'&&that.source_type!='Develop'){ |
|
|
|
// if (res.data == '打印任务已发送,等待打印机处理!') { |
|
|
|
// this.showCommitSuccessMessage(res.data) |
|
|
@ -977,13 +879,15 @@ console.log(8787,this.detailSource) |
|
|
|
pack.handleQty = 0 |
|
|
|
} |
|
|
|
}) |
|
|
|
detail.toLocationCode = this.toLocationCode ? this.toLocationCode :this.jobToLocationCode |
|
|
|
let obj = {...detail} |
|
|
|
obj.packList = [] |
|
|
|
obj.toLocationCode = this.toLocationCode ? this.toLocationCode :this.jobToLocationCode |
|
|
|
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,detail.packingNumber, detail.batch); |
|
|
|
detail.toPackingNumber = info.packingNumber; |
|
|
|
detail.packingNumber = info.packingNumber; |
|
|
|
detail.formPackingNumber = info.packingNumber; |
|
|
|
detail.toBatch = info.batch; |
|
|
|
subList.push(detail) |
|
|
|
obj.toPackingNumber = info.packingNumber; |
|
|
|
obj.packingNumber = info.packingNumber; |
|
|
|
obj.formPackingNumber = info.packingNumber; |
|
|
|
obj.toBatch = info.batch; |
|
|
|
subList.push(obj) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.jobContent.subList = subList |
|
|
@ -1093,7 +997,8 @@ console.log(8787,this.detailSource) |
|
|
|
}, |
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
this.$refs.scanPopup.openScanPopup(this.jobToLocationCode); |
|
|
|
// 第一个参数是库位查精度,第二个参数是判断是否走包装信息接口 |
|
|
|
this.$refs.scanPopup.openScanPopup(this.jobToLocationCode,true); |
|
|
|
}, |
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
|