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.

78 lines
2.0 KiB

10 months ago
import {
getBusinesstypeByCode
} from '@/api/request2.js';
import {
getDirectoryItemArray,
} from '@/common/directory.js';
export function createItemInfo(balance, pack) {
let item = {
itemCode: pack.itemCode,
itemName: pack.itemName,
stdPackQty: pack.stdPackQty,
stdPackUnit: pack.stdPackUnit,
qty: Number(balance.qty),
handleQty: 0,
uom: pack.uom,
10 months ago
subList: []
10 months ago
}
return item;
}
10 months ago
export function createDetailInfo(data, pack) {
data.scaned = true;
// data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus;
// data.inventoryStatus = data.inventoryStatus;
10 months ago
let detail = {};
Object.assign(detail, data)
detail.balanceQty = Number(detail.qty)
10 months ago
detail.stdPackQty = Number(pack.stdPackQty)
detail.stdPackUnit = pack.stdPackUnit
10 months ago
detail.package = pack;
10 months ago
return detail;
}
//计算实际数量
export function calcHandleQty(detailSource) {
for (let item of detailSource) {
item.qty = 0;
10 months ago
for (let detail of item.subList) {
10 months ago
if (detail != undefined && detail.scaned) {
item.qty = item.qty + Number(detail.qty)
}
}
}
}
export function getBusinessType(typeCode, callback) {
let result = {
success: true,
businessType: '',
fromlocationTypeList: '',
tolocationTypeList: '',
fromInventoryStatuses: '',
toInventoryStatuses: '',
10 months 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)
result.fromInventoryStatuses = res.data.list[0].outInventoryStatuses;
result.toInventoryStatuses = res.data.list[0].inInventoryStatuses;
10 months ago
callback(result)
} else {
result.success = false;
result.message = '业务类型[' + typeCode + ']获取失败';
callback(result)
}
}).catch(error => {
result.success = false;
result.message = error;
callback(result)
})
}