获取任务类型列表

dev
cjy 2 months ago
parent f81d6818b8
commit 8692b2ba11

@ -311,7 +311,7 @@ namespace DS.Module.Core
/// <summary>
/// 退舱审核驳回
/// </summary>
[Description("退舱审核")]
[Description("退舱审核驳回")]
RETURN_CABIN_AUDIT_REJECTED = -402,
/// <summary>
/// 客户/供应商审核驳回

@ -63,5 +63,4 @@ public static class ConstUtil
return dicCode;
}
}

@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using Fasterflect;
using System.Collections.Concurrent;
using System.ComponentModel;
using System.Reflection;
@ -97,4 +98,41 @@ public static class EnumUtil
return enumDic;
}
/// <summary>
/// 取得枚举值数
/// </summary>
/// <param name="EnumObject">枚举对象</param>
/// <returns>枚举值数</returns>
public static int GetEnumValue(this System.Enum EnumObject)
{
int intValue = (int)System.Enum.Parse(EnumObject.GetType(), EnumObject.ToString(), true);
return intValue;
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
public static Dictionary<string, int> EnumToDictionary<T>()
{
if (!typeof(T).IsEnum)
{
throw new ArgumentException("T must be an enumerated type");
}
var enumDictionary = new Dictionary<string, int>();
Array enumValues = Enum.GetValues(typeof(T));
var enumNames = Enum.GetNames(typeof(T));
foreach (System.Enum value in enumValues)
{
enumDictionary.Add(EnumDescription(value), GetEnumValue(value));
}
//for (int i = 0; i < enumValues.Length; i++)
//{
// enumDictionary.Add(EnumDescription(enumNames[i]), (int)enumValues.GetValue(i));
//}
return enumDictionary;
}
}

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace DS.Module.PrintModule
{
/// <summary>
/// 注入打印服务
/// 注入大简云服务项目
/// </summary>
public static class DjyModuleInstall
{

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Sys.Dtos
{
/// <summary>
/// 任务类型返回常量
/// </summary>
public class TaskBaseTypeConstRes
{
/// <summary>
/// Key
/// </summary>
public string Key { get; set; }
/// <summary>
/// 值
/// </summary>
public string Value { get; set; }
}
}

@ -14,6 +14,12 @@ namespace DS.WMS.Core.Sys.Interface;
/// </summary>
public interface IClientCommonService
{
/// <summary>
/// 获取任务类型列表
/// </summary>
/// <returns></returns>
public Task<DataResult<List<TaskBaseTypeConstRes>>> GetTaskTypeConstList();
/// <summary>
/// 获取服务项目下拉数据
/// </summary>

@ -50,6 +50,27 @@ public class ClientCommonService : IClientCommonService
.WhereIF(!string.IsNullOrEmpty(queryKey), (d, t) => d.Name.Contains(queryKey));
}
/// <summary>
/// 获取任务类型常量列表
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<TaskBaseTypeConstRes>>> GetTaskTypeConstList()
{
var data = new List<TaskBaseTypeConstRes>();
var list = EnumUtil.EnumToDictionary<TaskBaseTypeEnum>()
.Select(x => (x.Key, x.Value))
.ToList();
foreach (var item in list)
{
data.Add(new TaskBaseTypeConstRes()
{
Key = item.Key,
Value = item.Value.ToString()
});
}
return await Task.FromResult(DataResult<List<TaskBaseTypeConstRes>>.Success(data));
}
/// <summary>
/// 获取服务项目下拉数据
/// </summary>

@ -28,6 +28,15 @@ public class ClientCommonController : ApiController
_invokeService = invokeService;
}
/// <summary>
/// 获取任务类型常量列表
/// </summary>
/// <returns></returns>
[HttpGet, Route("GetTaskTypeConstList")]
public async Task<DataResult<List<TaskBaseTypeConstRes>>> GetTaskTypeConstList()
{
return await _invokeService.GetTaskTypeConstList();
}
/// <summary>
/// 获取服务项目下拉数据
/// </summary>

Loading…
Cancel
Save