|
|
@ -82,6 +82,10 @@ |
|
|
|
getPrecisionStrategyParams |
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
Decimal |
|
|
|
} from 'decimal.js'; //引入 |
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|
|
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|
|
@ -184,8 +188,18 @@ |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
|
this.setData(result); |
|
|
|
async getScanResult(result) { |
|
|
|
await getManagementPrecisions([result.label.itemCode], result.balance.locationCode, res => { |
|
|
|
if (res.success) { |
|
|
|
this.managementList = res.list; |
|
|
|
this.managementType = this.managementList && this.managementList[0] ? this.managementList[0].ManagementPrecision : '' |
|
|
|
if(this.managementType == "BY_BATCH" ||this.managementType == "BY_QUANTITY" ){ |
|
|
|
this.setDataBatch(result); |
|
|
|
}else{ |
|
|
|
this.setData(result); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
async setData(result) { |
|
|
|
let balance = result.balance; |
|
|
@ -227,6 +241,7 @@ |
|
|
|
await this.getToLocationBalance(this.fromLocationCode,result) |
|
|
|
this.scanPopupGetFocus() |
|
|
|
} else { |
|
|
|
|
|
|
|
var detail = item.subList.find(r => { |
|
|
|
if (r.packingNumber == pack.number && |
|
|
|
r.batch == balance.batch && |
|
|
@ -315,6 +330,135 @@ |
|
|
|
} |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
}, |
|
|
|
async setDataBatch(result) { |
|
|
|
let balance = result.balance; |
|
|
|
let label = result.label; |
|
|
|
let pack = result.package; |
|
|
|
// if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) { |
|
|
|
// this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this |
|
|
|
// .fromLocationCode + "]没有库存余额") |
|
|
|
// return; |
|
|
|
// } |
|
|
|
var item = this.detailSource.find(res => { |
|
|
|
if (res.itemCode == balance.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
if (item == undefined) { |
|
|
|
if (this.fromWarehouseCode == '') { |
|
|
|
this.fromWarehouseCode = balance.warehouseCode; |
|
|
|
} |
|
|
|
var itemp = createItemInfo(balance, pack); |
|
|
|
itemp.containerNumber="" |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
newDetail.fromLocationCode=balance.locationCode |
|
|
|
|
|
|
|
newDetail.parentNumber = pack.parentNumber; |
|
|
|
newDetail.packingNumber = pack.number |
|
|
|
newDetail.packUnit = pack.packUnit; |
|
|
|
newDetail.packQty = pack.packQty; |
|
|
|
newDetail.handleQty = 0 |
|
|
|
itemp.subList.push(newDetail); |
|
|
|
this.detailSource.push(itemp) |
|
|
|
this.itemCode = balance.itemCode; |
|
|
|
this.fromLocationCode = balance.locationCode |
|
|
|
this.scanPopupGetFocus() |
|
|
|
} else { |
|
|
|
|
|
|
|
var detail = item.subList.find(r => { |
|
|
|
if (r.batch == balance.batch && |
|
|
|
r.fromLocationCode == balance.locationCode && |
|
|
|
r.inventoryStatus == balance.inventoryStatus) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (detail == undefined) { |
|
|
|
//如果最开始扫父,在扫子,提示已经扫描父包装 |
|
|
|
//如果扫子在扫父,提示扫描的是父包装,是否移除子包装,是移除子包装,显示父包装 |
|
|
|
//扫描的是子包装, |
|
|
|
if (pack.parentNumber) { |
|
|
|
var checkData = item.subList.find(r => { |
|
|
|
if (r.packingNumber == pack.parentNumber && |
|
|
|
r.batch == balance.batch&& |
|
|
|
r.fromLocationCode == balance.locationCode) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (checkData) { |
|
|
|
//提示已经扫描 |
|
|
|
this.showErrorMessage("扫描箱码[" + pack.number + "]批次[" + balance.batch + |
|
|
|
"]的父包装已经扫描") |
|
|
|
console.log("父包装已经扫描") |
|
|
|
} else { |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
newDetail.parentNumber = pack.parentNumber; |
|
|
|
newDetail.packingNumber = pack.number |
|
|
|
newDetail.packUnit = pack.packUnit; |
|
|
|
newDetail.packQty = pack.packQty; |
|
|
|
newDetail.fromLocationCode=balance.locationCode |
|
|
|
newDetail.handleQty = 0 |
|
|
|
item.subList.push(newDetail); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//扫描的是父包装 |
|
|
|
var checkData = item.subList.find(r => { |
|
|
|
if (r.batch == balance.batch&& |
|
|
|
r.fromLocationCode == balance.locationCode) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (checkData) { |
|
|
|
//是否移除 |
|
|
|
this.$refs.comMessage.showQuestionMessage("批次[" + balance |
|
|
|
.batch + "]是父包装,是否移除子包装", res => { |
|
|
|
if (res) { |
|
|
|
item.subList = []; |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
newDetail.parentNumber = pack.parentNumber; |
|
|
|
newDetail.packingNumber = pack.number |
|
|
|
newDetail.packUnit = pack.packUnit; |
|
|
|
newDetail.packQty = pack.packQty; |
|
|
|
newDetail.fromLocationCode=balance.locationCode |
|
|
|
newDetail.handleQty = 0 |
|
|
|
item.subList.push(newDetail); |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log("扫描的是父包装,是否移除子包装") |
|
|
|
} else { |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
newDetail.fromLocationCode=balance.locationCode |
|
|
|
newDetail.parentNumber = pack.parentNumber; |
|
|
|
newDetail.packingNumber = pack.number |
|
|
|
newDetail.packUnit = pack.packUnit; |
|
|
|
newDetail.packQty = pack.packQty; |
|
|
|
newDetail.handleQty = 0 |
|
|
|
item.subList.push(newDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
} else { |
|
|
|
if (detail.scaned == true) { |
|
|
|
// this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// calcHandleQty(this.detailSource); |
|
|
|
console.log(this.detailSource) |
|
|
|
for (let item of this.detailSource) { |
|
|
|
item.handleQty = new Decimal(0).toNumber(); |
|
|
|
item.qty = new Decimal(0).toNumber(); |
|
|
|
for (let detail of item.subList) { |
|
|
|
if (detail != undefined) { |
|
|
|
if (detail.scaned) { |
|
|
|
item.handleQty = calc.add(result.label.qty, detail.handleQty) |
|
|
|
detail.handleQty = calc.add(result.label.qty, detail.handleQty); |
|
|
|
} |
|
|
|
item.qty = calc.add(item.qty, detail.qty); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|