|
@ -6,6 +6,10 @@ import { |
|
|
getDirectoryItemArray, |
|
|
getDirectoryItemArray, |
|
|
} from '@/common/directory.js'; |
|
|
} from '@/common/directory.js'; |
|
|
import { calc } from '@/common/calc' |
|
|
import { calc } from '@/common/calc' |
|
|
|
|
|
import { Decimal } from 'decimal.js';//引入
|
|
|
|
|
|
import { |
|
|
|
|
|
deepCopyData |
|
|
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
|
export function createItemInfo(balance, pack) { |
|
|
export function createItemInfo(balance, pack) { |
|
|
let item = { |
|
|
let item = { |
|
@ -13,25 +17,24 @@ export function createItemInfo(balance, pack) { |
|
|
itemName: pack.itemName, |
|
|
itemName: pack.itemName, |
|
|
stdPackQty: pack.stdPackQty, |
|
|
stdPackQty: pack.stdPackQty, |
|
|
stdPackUnit: pack.stdPackUnit, |
|
|
stdPackUnit: pack.stdPackUnit, |
|
|
qty: Number(balance.qty), |
|
|
qty: new Decimal(balance.qty).toNumber(), |
|
|
handleQty: 0, |
|
|
handleQty:new Decimal(0).toNumber(), |
|
|
uom: pack.uom, |
|
|
uom: pack.uom, |
|
|
subList: [] |
|
|
subList: [] |
|
|
} |
|
|
} |
|
|
return item; |
|
|
return item; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export function createDetailInfo(data, pack) { |
|
|
export function createDetailInfo(balance, pack) { |
|
|
data.scaned = true; |
|
|
balance.scaned = true; |
|
|
// data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus;
|
|
|
// data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus;
|
|
|
// data.inventoryStatus = data.inventoryStatus;
|
|
|
// data.inventoryStatus = data.inventoryStatus;
|
|
|
let detail = {}; |
|
|
let detail = deepCopyData(balance); |
|
|
Object.assign(detail, data) |
|
|
detail.balanceQty = new Decimal(detail.qty).toNumber() |
|
|
detail.balanceQty = Number(detail.qty) |
|
|
detail.qty = new Decimal(detail.qty).toNumber(); |
|
|
detail.qty = Number(detail.qty); |
|
|
detail.stdPackQty = new Decimal(pack.stdPackQty).toNumber() |
|
|
detail.stdPackQty = Number(pack.stdPackQty) |
|
|
|
|
|
detail.stdPackUnit = pack.stdPackUnit |
|
|
detail.stdPackUnit = pack.stdPackUnit |
|
|
detail.handleQty =0; |
|
|
detail.handleQty = new Decimal(detail.qty).toNumber() ; |
|
|
detail.package = pack; |
|
|
detail.package = pack; |
|
|
|
|
|
|
|
|
return detail; |
|
|
return detail; |
|
@ -40,10 +43,10 @@ export function createDetailInfo(data, pack) { |
|
|
//计算实际数量
|
|
|
//计算实际数量
|
|
|
export function calcHandleQty(detailSource) { |
|
|
export function calcHandleQty(detailSource) { |
|
|
for (let item of detailSource) { |
|
|
for (let item of detailSource) { |
|
|
item.qty = 0; |
|
|
item.handleQty = new Decimal(0).toNumber(); |
|
|
for (let detail of item.subList) { |
|
|
for (let detail of item.subList) { |
|
|
if (detail != undefined && detail.scaned) { |
|
|
if (detail != undefined && detail.scaned) { |
|
|
item.qty = calc.add(item.qty,detail.qty); |
|
|
item.handleQty = calc.add(item.handleQty,detail.handleQty); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|