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.
389 lines
8.0 KiB
389 lines
8.0 KiB
1 year ago
|
|
||
|
|
||
|
let jobStatusList = [];
|
||
|
let itemStatusList =[];
|
||
|
let locationTypeList = [];
|
||
|
let uomList = [];
|
||
|
let inventoryStatusList = [];
|
||
|
let containerTypeList = [];
|
||
|
let packUnitList = [];
|
||
|
let requestStatusList = [];
|
||
|
let unplannedReceiptReasonList = [];
|
||
|
let unplannedIissueReason = [];
|
||
|
let scrapReasonList = [];
|
||
|
let inspectFailedReasonList = [];
|
||
|
let nextActionList = [];
|
||
|
let inspectTypeList = [];
|
||
|
|
||
|
|
||
|
// 获取业务类型字典项
|
||
|
export function getBusinessTypeDesc(type) {
|
||
|
if (type == "SupplierDeliver") {
|
||
|
return "供应商发货"
|
||
|
} else if (type = "PurchaseReceipt") {
|
||
|
return "采购收货";
|
||
|
} else if (type = "PurchaseReturn") {
|
||
|
return "采购退货";
|
||
|
} else if (type = "PurchasePutaway") {
|
||
|
return "采购上架";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//获取字典信息
|
||
|
export function clearCacheData() {
|
||
|
jobStatusList = [];
|
||
|
itemStatusList =[];
|
||
|
locationTypeList = [];
|
||
|
uomList = [];
|
||
|
inventoryStatusList = [];
|
||
|
containerTypeList = [];
|
||
|
packUnitList = [];
|
||
|
requestStatusList = [];
|
||
|
unplannedReceiptReasonList = [];
|
||
|
unplannedIissueReason = [];
|
||
|
scrapReasonList = [];
|
||
|
inspectFailedReasonList = [];
|
||
|
nextActionList = [];
|
||
|
inspectTypeList = [];
|
||
|
}
|
||
|
|
||
|
//获取字典信息
|
||
|
export function getDirectoryInfo(type) {
|
||
|
|
||
|
var result = [];
|
||
|
var list = uni.getStorageSync("dictionary")
|
||
|
if (list != undefined && list.length > 0) {
|
||
|
for (let item of list) {
|
||
|
if (item.type == type) {
|
||
|
result = item.subList
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return result
|
||
|
}
|
||
|
|
||
|
//将字典项转为数组
|
||
|
export function getDirectoryItemArray(data) {
|
||
|
var array = []
|
||
|
if (data == undefined || data == null || data == "") {
|
||
|
return array
|
||
|
}
|
||
|
|
||
|
if (data.indexOf(',') < 0) {
|
||
|
array.push(data)
|
||
|
} else {
|
||
|
var arrayItems = data.split(',')
|
||
|
arrayItems.forEach(res => {
|
||
|
array.push(res)
|
||
|
})
|
||
|
}
|
||
|
return array
|
||
|
}
|
||
|
|
||
|
//查询字典项是否在列表中
|
||
|
export function checkDirectoryItemExist(list, type) {
|
||
|
let exist = false;
|
||
|
if (list == null || list.length == 0) {
|
||
|
exist = true;
|
||
|
} else {
|
||
|
var temp = list.filter(res => {
|
||
|
if (res == type) {
|
||
|
return res
|
||
|
}
|
||
|
})
|
||
|
if (temp != undefined && temp.length > 0) {
|
||
|
exist = true
|
||
|
}
|
||
|
}
|
||
|
return exist
|
||
|
}
|
||
|
|
||
|
|
||
|
//获取任务状态
|
||
|
export function getJobStateInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (jobStatusList.length == 0) {
|
||
|
jobStatusList = getDirectoryInfo("job_status")
|
||
|
}
|
||
|
if (jobStatusList.length > 0) {
|
||
|
for (let item of jobStatusList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
//获取任务状态样式
|
||
|
export function getJobStateStyle(value) {
|
||
|
let item = getJobStateInfo(value);
|
||
|
if (item == null || item == '') {
|
||
|
return 'other'
|
||
|
} else {
|
||
|
if (item.remark == '') {
|
||
|
return 'other'
|
||
|
} else {
|
||
|
return item.remark;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//获取库位描述
|
||
|
export function getListLocationTypeDesc(lst) {
|
||
|
let desc = '';
|
||
|
lst.forEach(res => {
|
||
|
desc += getLocationTypeInfo(res).label + ","
|
||
|
})
|
||
|
desc = desc.slice(0, -1);
|
||
|
return desc;
|
||
|
}
|
||
|
|
||
|
//获取物品状态
|
||
|
export function getItemStateInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (itemStatusList.length == 0) {
|
||
|
itemStatusList = getDirectoryInfo("item_status")
|
||
|
}
|
||
|
if (itemStatusList.length > 0) {
|
||
|
for (let item of itemStatusList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
//获取库位类型
|
||
|
export function getLocationTypeInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (locationTypeList.length == 0) {
|
||
|
locationTypeList = getDirectoryInfo("location_type")
|
||
|
}
|
||
|
if (locationTypeList.length > 0) {
|
||
|
for (let item of locationTypeList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
//获取库位类型名称
|
||
|
export function getLocationTypeName(value) {
|
||
|
let location = getLocationTypeInfo(value);
|
||
|
|
||
|
return location == '' ? value : location.label;
|
||
|
}
|
||
|
|
||
|
//获取计量单位
|
||
|
export function getUnitInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (uomList.length == 0) {
|
||
|
uomList = getDirectoryInfo("uom")
|
||
|
}
|
||
|
if (uomList.length > 0) {
|
||
|
for (let item of uomList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
//获取包装单位
|
||
|
export function getStdPackUnitInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (packUnitList.length == 0) {
|
||
|
packUnitList = getDirectoryInfo("pack_unit")
|
||
|
}
|
||
|
if (packUnitList.length > 0) {
|
||
|
for (let item of packUnitList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
//获取申请状态
|
||
|
export function getRequestStateInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (requestStatusList.length == 0) {
|
||
|
requestStatusList = getDirectoryInfo("request_status")
|
||
|
}
|
||
|
if (requestStatusList.length > 0) {
|
||
|
for (let item of requestStatusList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
|
||
|
//获取库存状态
|
||
|
export function getInventoryStatusInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (inventoryStatusList.length == 0) {
|
||
|
inventoryStatusList = getDirectoryInfo("inventory_status")
|
||
|
}
|
||
|
if (inventoryStatusList.length > 0) {
|
||
|
for (let item of inventoryStatusList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
//获取库存样式
|
||
|
export function getInventoryStatusStyle(value) {
|
||
|
let item = getInventoryStatusInfo(value);
|
||
|
if (item == null || item == '') {
|
||
|
return 'other'
|
||
|
} else {
|
||
|
if (item.remark == '') {
|
||
|
return 'other'
|
||
|
} else {
|
||
|
return item.remark;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//获取库存样式
|
||
|
export function getInventoryStatusName(value) {
|
||
|
let item = getInventoryStatusInfo(value);
|
||
|
if (item == null || item == '') {
|
||
|
return value
|
||
|
} else {
|
||
|
if (item.label == '') {
|
||
|
return value
|
||
|
} else {
|
||
|
return item.label;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//获取状态描述
|
||
|
export function getInventoryStatusDesc(lst) {
|
||
|
let desc = '';
|
||
|
lst.forEach(res => {
|
||
|
desc += getInventoryStatusInfo(res).label + ","
|
||
|
})
|
||
|
desc = desc.slice(0, -1);
|
||
|
return desc;
|
||
|
}
|
||
|
|
||
|
//获取器具状态
|
||
|
export function getContainerStatusInfo(value) {
|
||
|
var resultInfo = "";
|
||
|
if (containerTypeList.length == 0) {
|
||
|
containerTypeList = getDirectoryInfo("container_type")
|
||
|
}
|
||
|
if (containerTypeList.length > 0) {
|
||
|
for (let item of containerTypeList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|
||
|
//获取计划外入库原因
|
||
|
export function getUnPlannedReceiptReasonList(value) {
|
||
|
if (unplannedReceiptReasonList.length == 0) {
|
||
|
unplannedReceiptReasonList = getDirectoryInfo("unplanned_receipt_reason")
|
||
|
}
|
||
|
unplannedReceiptReasonList.forEach(res => {
|
||
|
res.text = res.label;
|
||
|
res.value = res.code
|
||
|
})
|
||
|
return unplannedReceiptReasonList
|
||
|
}
|
||
|
|
||
|
//获取计划外出库原因
|
||
|
export function getUnPlannedIssuseReasonList(value) {
|
||
|
if (unplannedIssueReasonList.length == 0) {
|
||
|
unplannedIssueReasonList = getDirectoryInfo("unplanned_issue_reason")
|
||
|
}
|
||
|
unplannedIssueReasonList.forEach(res => {
|
||
|
res.text = res.label;
|
||
|
res.value = res.code
|
||
|
})
|
||
|
return unplannedIssueReasonList
|
||
|
}
|
||
|
|
||
|
//获取报废出库原因
|
||
|
export function getScarpReasonList(value) {
|
||
|
if (scrapReasonList.length == 0) {
|
||
|
scrapReasonList = getDirectoryInfo("scrap_reason")
|
||
|
}
|
||
|
scrapReasonList.forEach(res => {
|
||
|
res.text = res.label;
|
||
|
res.value = res.code
|
||
|
})
|
||
|
return scrapReasonList
|
||
|
}
|
||
|
|
||
|
//获取检验失败原因
|
||
|
export function getInspectFailedReasonList(value) {
|
||
|
if (inspectFailedReasonList.length == 0) {
|
||
|
inspectFailedReasonList = getDirectoryInfo("inspect_failed_reason")
|
||
|
}
|
||
|
inspectFailedReasonList.forEach(res => {
|
||
|
res.text = res.label;
|
||
|
res.value = res.value
|
||
|
})
|
||
|
return inspectFailedReasonList
|
||
|
}
|
||
|
|
||
|
//获取下一步动作
|
||
|
export function getNextActionList(value) {
|
||
|
if (nextActionList.length == 0) {
|
||
|
nextActionList = getDirectoryInfo("next_action")
|
||
|
}
|
||
|
nextActionList.forEach(res => {
|
||
|
res.text = res.label;
|
||
|
res.value = res.value
|
||
|
})
|
||
|
return nextActionList
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//获取检验类型
|
||
|
export function getInspectType(value) {
|
||
|
var resultInfo = "";
|
||
|
if (inspectTypeList.length == 0) {
|
||
|
inspectTypeList = getDirectoryInfo("inspect_type")
|
||
|
}
|
||
|
if (inspectTypeList.length > 0) {
|
||
|
for (let item of inspectTypeList) {
|
||
|
if (item.value == value) {
|
||
|
resultInfo = item.label
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return resultInfo
|
||
|
}
|
||
|
|