You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.6 KiB
92 lines
2.6 KiB
1 year ago
|
import {
|
||
|
getBusinesstypeByCode
|
||
|
} from '@/api/request2.js';
|
||
|
|
||
|
import {
|
||
|
getDirectoryItemArray,
|
||
|
} from '@/common/directory.js';
|
||
1 year ago
|
import { calc } from '@/common/calc'
|
||
1 year ago
|
import { Decimal } from 'decimal.js';//引入
|
||
|
import {
|
||
|
deepCopyData
|
||
|
} from '@/common/basic.js';
|
||
1 year ago
|
|
||
|
export function createItemInfo(balance, pack) {
|
||
|
let item = {
|
||
|
itemCode: pack.itemCode,
|
||
|
itemName: pack.itemName,
|
||
|
stdPackQty: pack.stdPackQty,
|
||
|
stdPackUnit: pack.stdPackUnit,
|
||
1 year ago
|
qty: new Decimal(balance.qty).toNumber(),
|
||
|
handleQty:new Decimal(0).toNumber(),
|
||
1 year ago
|
uom: pack.uom,
|
||
1 year ago
|
subList: []
|
||
1 year ago
|
}
|
||
|
return item;
|
||
|
}
|
||
1 year ago
|
|
||
1 year ago
|
export function createDetailInfo(balance, pack) {
|
||
|
balance.scaned = true;
|
||
1 year ago
|
// data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus;
|
||
1 year ago
|
// data.inventoryStatus = data.inventoryStatus;
|
||
1 year ago
|
let detail = deepCopyData(balance);
|
||
|
detail.balanceQty = new Decimal(detail.qty).toNumber()
|
||
|
detail.qty = new Decimal(detail.qty).toNumber();
|
||
|
detail.stdPackQty = new Decimal(pack.stdPackQty).toNumber()
|
||
1 year ago
|
detail.stdPackUnit = pack.stdPackUnit
|
||
1 year ago
|
detail.handleQty = new Decimal(detail.qty).toNumber() ;
|
||
1 year ago
|
detail.package = pack;
|
||
1 year ago
|
|
||
1 year ago
|
return detail;
|
||
|
}
|
||
|
|
||
|
//计算实际数量
|
||
|
export function calcHandleQty(detailSource) {
|
||
|
for (let item of detailSource) {
|
||
1 year ago
|
item.handleQty = new Decimal(0).toNumber();
|
||
1 year ago
|
item.qty = new Decimal(0).toNumber();
|
||
1 year ago
|
for (let detail of item.subList) {
|
||
1 year ago
|
if(detail!=undefined){
|
||
|
if(detail.scaned){
|
||
|
item.handleQty = calc.add(item.handleQty,detail.handleQty);
|
||
|
}
|
||
|
item.qty = calc.add(item.qty,detail.qty);
|
||
1 year ago
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export function getBusinessType(typeCode, callback) {
|
||
|
let result = {
|
||
|
success: true,
|
||
|
businessType: '',
|
||
|
fromlocationTypeList: '',
|
||
|
tolocationTypeList: '',
|
||
1 year ago
|
itemCodeTypeList:"",
|
||
|
useOnTheWay:"FALSE",
|
||
1 year ago
|
fromInventoryStatuses: '',
|
||
|
toInventoryStatuses: '',
|
||
1 year ago
|
message: ''
|
||
|
};
|
||
|
getBusinesstypeByCode(typeCode).then(res => {
|
||
|
if (res.data.total > 0) {
|
||
|
result.businessType = res.data.list[0];
|
||
|
result.fromlocationTypeList = getDirectoryItemArray(res.data.list[0].outLocationTypes)
|
||
|
result.tolocationTypeList = getDirectoryItemArray(res.data.list[0].inLocationTypes)
|
||
1 year ago
|
result.itemCodeTypeList = getDirectoryItemArray(res.data.list[0].itemTypes)
|
||
1 year ago
|
result.fromInventoryStatuses = res.data.list[0].outInventoryStatuses;
|
||
|
result.toInventoryStatuses = res.data.list[0].inInventoryStatuses;
|
||
1 year ago
|
result.useOnTheWay =res.data.list[0].useOnTheWay
|
||
1 year ago
|
callback(result)
|
||
|
} else {
|
||
|
result.success = false;
|
||
|
result.message = '业务类型[' + typeCode + ']获取失败';
|
||
|
callback(result)
|
||
|
}
|
||
|
}).catch(error => {
|
||
|
result.success = false;
|
||
|
result.message = error;
|
||
|
callback(result)
|
||
|
})
|
||
|
}
|