Browse Source

YT-481箱码仓库扫码提示

intex_online20241111
zhang_li 1 month ago
parent
commit
0fc875139a
  1. 132
      src/pages/purchaseReceipt/job/receiptDetail.vue

132
src/pages/purchaseReceipt/job/receiptDetail.vue

@ -312,9 +312,15 @@
this.showErrorMessage(error) this.showErrorMessage(error)
}) })
}, },
getScanResult(result) { getScanResult(result) {
if(this.managementType == 'BY_BATCH'){
this.getScanResultAfterBatch(result)
}else{
this.getScanResultAfter(result)
}
},
//
getScanResultAfter(result){
try { try {
var itemCode = result.label.itemCode; var itemCode = result.label.itemCode;
var detail = this.detailSource.find(r => r.itemCode == itemCode); var detail = this.detailSource.find(r => r.itemCode == itemCode);
@ -359,7 +365,7 @@
if (itemDetail == undefined) { if (itemDetail == undefined) {
itemDetail = detail.subList.find(r => r.packingNumber == parentpackingNumber && r.batch == itemDetail = detail.subList.find(r => r.packingNumber == parentpackingNumber && r.batch ==
batch); batch);
if (itemDetail == undefined) { if (itemDetail == undefined) {
this.showMessage("箱码【" + packingNumber + "】、批次【" + batch + "】不在列表中") this.showMessage("箱码【" + packingNumber + "】、批次【" + batch + "】不在列表中")
} else { } else {
@ -383,7 +389,7 @@
itemDetail.packList.sort(compareDesc('scanDate')); // itemDetail.packList.sort(compareDesc('scanDate')); //
this.$forceUpdate() this.$forceUpdate()
} }
} else { } else {
//, //,
var scanedLength = 0; var scanedLength = 0;
@ -408,7 +414,7 @@
pac.handleQty = Number(pac.qty); pac.handleQty = Number(pac.qty);
pac.toLocationCode = this.toLocationCode; pac.toLocationCode = this.toLocationCode;
}) })
calcTreeHandleQty(this.detailSource); calcTreeHandleQty(this.detailSource);
this.detailSource[0].subList.sort(compareDesc('scanDate')); // this.detailSource[0].subList.sort(compareDesc('scanDate')); //
this.continueScan() this.continueScan()
@ -417,12 +423,120 @@
} }
} }
} }
} catch (e) {
this.showErrorMessage(e.message)
}
},
//
getScanResultAfterBatch(result){
try {
var itemCode = result.label.itemCode;
var detail = this.detailSource.find(r => r.itemCode == itemCode);
detail.scaned = true;
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
return;
}
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 = item.qty;
item.toLocationCode = this.toLocationCode;
})
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);
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 {
if (pack.scaned) {
pack.scanDate = new Date();
this.showMessage("批次【" + batch + "】已经扫描");
} else {
pack.scaned = true
pack.scanDate = new Date();
pack.handleQty = Number(result.label.qty);
pack.toLocationCode = this.toLocationCode;
pack.labelQty = Number(result.label.qty);
}
}
calcTreeHandleQty(this.detailSource);
itemDetail.packList.sort(compareDesc('scanDate')); //
this.$forceUpdate()
}
} else {
//,
var scanedLength = 0;
itemDetail.packList.forEach(res => {
if (res.scaned) {
scanedLength++;
}
})
if (itemDetail.scaned && scanedLength == itemDetail
.packList.length) {
itemDetail.scanDate = new Date();
this.showMessage("批次【" + batch + "】已经扫描")
} else {
itemDetail.scaned = true;
itemDetail.scanDate = new Date();
itemDetail.handleQty = Number(result.label.qty);
itemDetail.toLocationCode = this.toLocationCode;
itemDetail.labelQty = Number(result.label.qty);
itemDetail.packList.forEach(pac => {
pac.scaned = true
pac.scanDate = new Date();
pac.handleQty = Number(pac.qty);
pac.toLocationCode = this.toLocationCode;
})
calcTreeHandleQty(this.detailSource);
this.detailSource[0].subList.sort(compareDesc('scanDate')); //
this.continueScan()
this.$forceUpdate()
}
}
}
}
} catch (e) { } catch (e) {
this.showErrorMessage(e.message) this.showErrorMessage(e.message)
} }
}, },
// //
continueScan() { continueScan() {
this.scanCount = getScanCount(this.subList); this.scanCount = getScanCount(this.subList);
@ -439,10 +553,6 @@
}, },
scanLocationCode(location, code) { scanLocationCode(location, code) {
console.log(222,location)
console.log(333,code)
console.log(444,this.jobContent)
console.log(444,this.jobToLocationCode)
if (this.jobContent.allowModifyLocation == 'TRUE') { if (this.jobContent.allowModifyLocation == 'TRUE') {
this.toLocationCode = code; this.toLocationCode = code;
this.jobToLocationCode= code this.jobToLocationCode= code

Loading…
Cancel
Save