|
|
@ -312,9 +312,15 @@ |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
|
if(this.managementType == 'BY_BATCH'){ |
|
|
|
this.getScanResultAfterBatch(result) |
|
|
|
}else{ |
|
|
|
this.getScanResultAfter(result) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 包装扫码之后逻辑 |
|
|
|
getScanResultAfter(result){ |
|
|
|
try { |
|
|
|
var itemCode = result.label.itemCode; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
@ -359,7 +365,7 @@ |
|
|
|
if (itemDetail == undefined) { |
|
|
|
itemDetail = detail.subList.find(r => r.packingNumber == parentpackingNumber && r.batch == |
|
|
|
batch); |
|
|
|
|
|
|
|
|
|
|
|
if (itemDetail == undefined) { |
|
|
|
this.showMessage("箱码【" + packingNumber + "】、批次【" + batch + "】不在列表中") |
|
|
|
} else { |
|
|
@ -383,7 +389,7 @@ |
|
|
|
itemDetail.packList.sort(compareDesc('scanDate')); //按扫描信息排序 |
|
|
|
this.$forceUpdate() |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
//扫描的是外包装,将包装集合全部扫描 |
|
|
|
var scanedLength = 0; |
|
|
@ -408,7 +414,7 @@ |
|
|
|
pac.handleQty = Number(pac.qty); |
|
|
|
pac.toLocationCode = this.toLocationCode; |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
calcTreeHandleQty(this.detailSource); |
|
|
|
this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 |
|
|
|
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) { |
|
|
|
this.showErrorMessage(e.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//继续扫描 |
|
|
|
continueScan() { |
|
|
|
this.scanCount = getScanCount(this.subList); |
|
|
@ -439,10 +553,6 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
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') { |
|
|
|
this.toLocationCode = code; |
|
|
|
this.jobToLocationCode= code |
|
|
|