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.

478 lines
9.7 KiB

1 year ago
import {
getManagementPrecision,
getPrecisionStrategy,
1 year ago
getBalanceByFilter
} from '@/api/request2.js';
/**
*
获取管理精度查询策略参数
* @param {*}
*
*/
11 months ago
export function getPrecisionStrategyParams(detailSource) {
var itemList = []
detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var filterResult = itemList.filter(res => {
if (res.itemCode == item.itemCode &&
res.locationCode == detail.toLocationCode) {
return res
}
})
//去掉重复元素
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode
}
itemList.push(result)
}
11 months ago
}
})
})
return itemList;
}
/**
*
获取管理精度查询策略参数
* @param {*}
*
*/
11 months ago
export function getPrecisionStrategyParamsByLocation(detailSource, toLocationCode) {
var itemList = []
detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
detail.toLocationCode = toLocationCode;
var filterResult = itemList.filter(res => {
if (res.itemCode == item.itemCode &&
res.locationCode == detail.toLocationCode) {
return res
}
})
//去掉重复元素
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode
}
itemList.push(result)
}
}
})
})
return itemList;
}
/**
* "itemCode": [],
"locationCode":"INSPECT"
管理精度策略
* @param {*}
*
*/
export function getPrecisionStrategyList(itemList, callback) {
// let jsonParem = JSON.stringify(param)
let result = {
list: [],
success: true,
message: ''
};
getPrecisionStrategy(itemList).then(res => {
if (res.data == null) {
result.success = false
result.message = '未查询到管理精度信息'
} else {
result.list = res.data;
}
callback(result);
}).catch(error => {
result.success = false;
result.message = error;
callback(result);
})
}
1 year ago
/**
* "itemCode": [],
"locationCode":"INSPECT"
管理精度策略
* @param {*}
*
*/
export function getManagementPrecisions(itemCodes, locationCode, callback) {
// let jsonParem = JSON.stringify(param)
let result = {
list: [],
success: true,
message: ''
};
var params = {
itemCodes: itemCodes,
locationCode: locationCode
}
getManagementPrecision(params).then(res => {
if (res.data == null) {
result.success = false
result.message = '未查询到管理精度信息'
} else {
result.list = res.data;
}
callback(result);
}).catch(error => {
result.success = false;
result.message = error;
callback(result);
})
}
12 months ago
export function getBalanceByManagementPrecision(label, locationCode, fromInventoryStatuses, callback) {
1 year ago
let result = {
list: [],
success: true,
message: ''
};
let params = {
itemCodes: [label.itemCode],
locationCode: locationCode
};
// let jsonParem = JSON.stringify(param)
getManagementPrecision(params).then(res => {
let managementPrecision = res.data[0].ManagementPrecision;
switch (managementPrecision) {
case 'BY_PACKAGING':
12 months ago
byPacking(label, locationCode, fromInventoryStatuses, res => {
1 year ago
res.managementPrecision = managementPrecision;
callback(res);
});
break;
case 'BY_BATCH':
12 months ago
byBatch(label, locationCode, fromInventoryStatuses, res => {
1 year ago
res.managementPrecision = managementPrecision;
callback(res);
});
break;
case 'BY_QUANTITY':
12 months ago
byQuantity(label, locationCode, fromInventoryStatuses, res => {
1 year ago
res.managementPrecision = managementPrecision;
callback(res);
});
break;
case 'BY_UNIQUEID':
12 months ago
byUniqueId(label, fromInventoryStatuses, res => {
1 year ago
res.managementPrecision = managementPrecision;
callback(res);
});
break;
}
}).catch(error => {
let result = {
success: false,
message: error
};
callback(result);
})
}
/**
* @param {Object} label
* @param {Object} locationCode
* @param {Object} callback
*/
12 months ago
export function byPacking(label, locationCode, fromInventoryStatuses, callback) {
1 year ago
let result = {
success: true,
message: '',
data: {}
};
var filters = []
filters.push({
column: "packingNumber",
1 year ago
action: "==",
value: label.packingNumber
})
filters.push({
column: "itemCode",
1 year ago
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
filters.push({
column: "locationCode",
1 year ago
action: "==",
value: locationCode
})
12 months ago
if (fromInventoryStatuses != null && fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: fromInventoryStatuses
})
}
12 months ago
1 year ago
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
if (res.data == null) {
result.success = false;
result.message =
"按包装管理查询、未查询到物料号[" + label.itemCode + "]" +
"到箱码[" + label.packingNumber + "]" +
"批次[" + label.batch + "]" +
"库位[" + label.locationCode + "]的信息"
} else {
result.success = true;
result.data = res.data;
}
callback(result)
}).catch(err => {
result.success = false;
result.data = null;
result.message = err;
callback(result)
})
}
/**
* @param {Object} label
* @param {Object} locationCode
* @param {Object} callback
*/
12 months ago
export function byBatch(label, locationCode, fromInventoryStatuses, callback) {
1 year ago
var filters = []
filters.push({
column: "itemCode",
1 year ago
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
10 months ago
filters.push({
column: "packingNumber",
action: "==",
value: null
})
1 year ago
filters.push({
column: "locationCode",
1 year ago
action: "==",
value: locationCode
})
12 months ago
if (fromInventoryStatuses != null && fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: fromInventoryStatuses
})
}
1 year ago
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
let result = {
success: true,
message: '',
data: {}
};
getBalanceByFilter(params).then(res => {
if (res.data == null) {
result.success = false;
result.message =
"按批次管理查询、未查询到物料号[" + label.itemCode + "]" +
"批次[" + label.batch + "]" +
"库位[" + label.locationCode + "]的信息"
} else {
result.success = true;
result.data = res.data;
}
callback(result)
}).catch(err => {
result.success = false;
result.data = null;
result.message = err.message;
callback(result)
})
}
/**
* @param {Object} label
* @param {Object} locationCode
* @param {Object} callback
*/
12 months ago
export function byQuantity(label, locationCode, fromInventoryStatuses, callback) {
1 year ago
let result = {
success: true,
message: '',
data: {}
};
var filters = []
filters.push({
column: "itemCode",
1 year ago
action: "==",
value: label.itemCode
})
10 months ago
filters.push({
column: "packingNumber",
action: "==",
value: null
})
filters.push({
column: "batch",
action: "==",
value: null
})
1 year ago
filters.push({
column: "locationCode",
1 year ago
action: "==",
value: locationCode
})
12 months ago
if (fromInventoryStatuses != null && fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: fromInventoryStatuses
})
}
1 year ago
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
if (res.data == null) {
result.success = false;
result.message =
"按数量管理查询、未查询到物料号[" + label.itemCode + "]" +
"库位[" + label.locationCode + "]的信息"
} else {
result.success = true;
result.data = res.data;
}
callback(result)
}).catch(err => {
result.success = false;
result.data = null;
result.message = err.message;
callback(result)
})
}
/**
* @param {Object} label
* @param {Object} locationCode
* @param {Object} callback
*/
12 months ago
export function byUniqueId(label, locationCode, fromInventoryStatuses, callback) {
1 year ago
let param = {
packingNumber: label.packingNumber
};
let result = {
success: true,
message: '',
data: {}
};
var filters = []
filters.push({
column: "packingNumber",
1 year ago
action: "==",
value: label.packingNumber
})
12 months ago
if (fromInventoryStatuses != null && fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: fromInventoryStatuses
})
}
1 year ago
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
if (res.data == null) {
result.success = false;
result.message =
"按唯一码管理查询、未查询到箱码[" + label.packingNumber + "]" +
"的信息"
} else {
result.success = true;
result.data = res.data;
}
callback(result)
}).catch(err => {
result.success = false;
result.data = null;
result.message = err.message;
callback(result)
})
}
/**
* 查询指定库位下的库存
* @param {*} param
* @param {*} callback
*/
export function balanceByLocation(locationCode, callback) {
let result = {
success: true,
message: '',
data: {}
};
var filters = []
filters.push({
column: "locationCode",
1 year ago
action: "==",
value: locationCode
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
if (res.data == null) {
result.success = false;
result.message =
"按唯一码管理查询、未查询到库位[" + label.locationCode + "]" +
"的信息"
} else {
result.success = true;
result.data = res.data;
}
callback(result)
}).catch(err => {
result.success = false;
result.data = null;
result.message = err.message;
callback(result)
})
}