wangxinhui
9 天以前 2aec0a99e559fb11b7046b148e5f357b3208cb66
项目代码/WMS/WMSServices/WIDESEA_SystemService/Sys_DictionaryService.cs
@@ -35,16 +35,14 @@
        private readonly IUnitOfWorkManage _unitOfWorkManage;
        private readonly ICacheService _cacheService;
        private readonly IBasicRepository _basicRepository;
        private readonly ISupplierInfoRepository _supplierInfoRepository;
        private readonly ISys_RoleDataPermissionRepository _roleDataPermissionRepository;
        public Sys_DictionaryService(ISys_DictionaryRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, IBasicRepository basicRepository, ISys_RoleDataPermissionRepository roleDataPermissionRepository, ISupplierInfoRepository supplierInfoRepository) : base(BaseDal)
        public Sys_DictionaryService(ISys_DictionaryRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, IBasicRepository basicRepository, ISys_RoleDataPermissionRepository roleDataPermissionRepository) : base(BaseDal)
        {
            _unitOfWorkManage = unitOfWorkManage;
            _cacheService = cacheService;
            _basicRepository = basicRepository;
            _roleDataPermissionRepository = roleDataPermissionRepository;
            _supplierInfoRepository = supplierInfoRepository;
        }
        public ISys_DictionaryRepository Repository => BaseDal;
@@ -111,22 +109,6 @@
                }
                vueDictionaryDTOs.AddRange(selectDics);
            }
            //object GetSourceData(string dicNo, string dbSql, object data)
            //{
            //    if (string.IsNullOrEmpty(dbSql))
            //    {
            //        return data;
            //    }
            //    return BaseDal.QueryObjectDataBySql(dbSql, null);
            //}
            //List<VueDictionaryDTO> vueDictionaryDTOs = dicConfig.Select(item => new VueDictionaryDTO
            //{
            //    DicNo = item.dicNo,
            //    Config = item.config,
            //    Data = GetSourceData(item.dicNo, item.dbSql, item.list)
            //}).ToList();
            try
            {
                List<string> dicList = dicNos.ToList();
@@ -194,23 +176,6 @@
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "suppliers":
                        {
                            List<object> data = new List<object>();
                            {
                                List<Dt_SupplierInfo> supplierInfos = _supplierInfoRepository.QueryData();
                                int index = 0;
                                foreach (var item in supplierInfos)
                                {
                                    data.Add(new { key = item.SupplierCode, value = item.SupplierCode });
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "materials":
                        {
                            {
@@ -228,54 +193,6 @@
                                result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                            }
                        }
                        break;
                    case "returnStatus":
                        {
                            List<object> data = new List<object>();
                            Type type = typeof(ReturnOrderStatusEnum);
                            List<int> enums = Enum.GetValues(typeof(ReturnOrderStatusEnum)).Cast<int>().ToList();
                            int index = 0;
                            foreach (var item in enums)
                            {
                                FieldInfo? fieldInfo = typeof(ReturnOrderStatusEnum).GetField(((ReturnOrderStatusEnum)item).ToString());
                                DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                if (description != null)
                                {
                                    data.Add(new { key = item.ToString(), value = description.Description });
                                }
                                else
                                {
                                    data.Add(new { key = item.ToString(), value = item.ToString() });
                                }
                                index++;
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "returnType":
                        {
                            List<object> data = new List<object>();
                            Type type = typeof(ReturnOrderTypeEnum);
                            List<int> enums = Enum.GetValues(typeof(ReturnOrderTypeEnum)).Cast<int>().ToList();
                            int index = 0;
                            foreach (var item in enums)
                            {
                                FieldInfo? fieldInfo = typeof(ReturnOrderTypeEnum).GetField(((ReturnOrderTypeEnum)item).ToString());
                                DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                if (description != null)
                                {
                                    data.Add(new { key = item.ToString(), value = description.Description });
                                }
                                else
                                {
                                    data.Add(new { key = item.ToString(), value = item.ToString() });
                                }
                                index++;
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "taskType":
@@ -350,112 +267,6 @@
                                    data.Add(new { key = item.ToString(), value = item.ToString() });
                                }
                                index++;
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "outLockStockStatusEnum":
                        {
                            List<object> data = new List<object>();
                            Type type = typeof(OutLockStockStatusEnum);
                            List<int> enums = Enum.GetValues(typeof(OutLockStockStatusEnum)).Cast<int>().ToList();
                            int index = 0;
                            foreach (var item in enums)
                            {
                                FieldInfo? fieldInfo = typeof(OutLockStockStatusEnum).GetField(((OutLockStockStatusEnum)item).ToString());
                                DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                if (description != null)
                                {
                                    data.Add(new { key = item.ToString(), value = description.Description });
                                }
                                else
                                {
                                    data.Add(new { key = item.ToString(), value = item.ToString() });
                                }
                                index++;
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "inOrderType":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(InOrderTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(InOrderTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(InOrderTypeEnum).GetField(((InOrderTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "outOrderType":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(OutOrderTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(OutOrderTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(OutOrderTypeEnum).GetField(((OutOrderTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "orderDetailStatusEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(OrderDetailStatusEnum);
                                List<int> enums = Enum.GetValues(typeof(OrderDetailStatusEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(OrderDetailStatusEnum).GetField(((OrderDetailStatusEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
@@ -600,26 +411,6 @@
                        {
                            List<object> data = new List<object>();
                            //{
                            //    Type type = typeof(TaskTypeEnum);
                            //    List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).Cast<int>().ToList();
                            //    int index = 0;
                            //    foreach (var item in enums)
                            //    {
                            //        FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString());
                            //        DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                            //        if (description != null)
                            //        {
                            //            data.Add(new { key = item.ToString(), value = description.Description });
                            //        }
                            //        else
                            //        {
                            //            data.Add(new { key = item.ToString(), value = item.ToString() });
                            //        }
                            //        index++;
                            //    }
                            //}
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
@@ -647,25 +438,6 @@
                                }
                            }
                            //{
                            //    Type type = typeof(TaskStatusEnum);
                            //    List<int> enums = Enum.GetValues(typeof(TaskStatusEnum)).Cast<int>().ToList();
                            //    int index = 0;
                            //    foreach (var item in enums)
                            //    {
                            //        FieldInfo? fieldInfo = typeof(TaskStatusEnum).GetField(((TaskStatusEnum)item).ToString());
                            //        DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                            //        if (description != null)
                            //        {
                            //            data.Add(new { key = item.ToString(), value = description.Description });
                            //        }
                            //        else
                            //        {
                            //            data.Add(new { key = item.ToString(), value = item.ToString() });
                            //        }
                            //        index++;
                            //    }
                            //}
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
@@ -712,57 +484,6 @@
                                    data.Add(new { key = item.ToString(), value = item.ToString() });
                                }
                                index++;
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "outStockStatus":
                        {
                            List<object> data = new List<object>();
                            Type type = typeof(OutLockStockStatusEnum);
                            List<int> enums = Enum.GetValues(typeof(OutLockStockStatusEnum)).Cast<int>().ToList();
                            int index = 0;
                            foreach (var item in enums)
                            {
                                FieldInfo? fieldInfo = typeof(OutLockStockStatusEnum).GetField(((OutLockStockStatusEnum)item).ToString());
                                DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                if (description != null)
                                {
                                    data.Add(new { key = item.ToString(), value = description.Description });
                                }
                                else
                                {
                                    data.Add(new { key = item.ToString(), value = item.ToString() });
                                }
                                index++;
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "receiveOrderTypeEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(ReceiveOrderTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(ReceiveOrderTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(ReceiveOrderTypeEnum).GetField(((ReceiveOrderTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
@@ -833,87 +554,6 @@
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "receiveStatus":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(ReceiveOrderStatusEnum);
                                List<int> enums = Enum.GetValues(typeof(ReceiveOrderStatusEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(ReceiveOrderStatusEnum).GetField(((ReceiveOrderStatusEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "purchaseType":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(PurchaseOrderTypeEnum);
                                List<string> enums = Enum.GetValues(typeof(PurchaseOrderTypeEnum)).Cast<string>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    //FieldInfo? fieldInfo = typeof(PurchaseOrderTypeEnum).GetField(((PurchaseOrderTypeEnum)item).ToString());
                                    //DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    //if (description != null)
                                    //{
                                    //    data.Add(new { key = item.ToString(), value = description.Description });
                                    //}
                                    //else
                                    //{
                                    //    data.Add(new { key = item.ToString(), value = item.ToString() });
                                    //}
                                    //index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "purchaseOrderStatus":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(PurchaseOrderStatusEnum);
                                List<int> enums = Enum.GetValues(typeof(PurchaseOrderStatusEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(PurchaseOrderStatusEnum).GetField(((PurchaseOrderStatusEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "printStatus":
                        {
                            List<object> data = new List<object>();
@@ -925,87 +565,6 @@
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(PrintStatusEnum).GetField(((PrintStatusEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "checkOrderStatusEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(CheckOrderStatusEnum);
                                List<int> enums = Enum.GetValues(typeof(CheckOrderStatusEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(CheckOrderStatusEnum).GetField(((CheckOrderStatusEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "checkAcceptEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(CheckAcceptEnum);
                                List<string> enumNames = Enum.GetNames(typeof(CheckAcceptEnum)).ToList();
                                int index = 0;
                                foreach (var item in enumNames)
                                {
                                    FieldInfo? fieldInfo = typeof(CheckAcceptEnum).GetField((item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "checkUploadEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(CheckUploadEnum);
                                List<int> enums = Enum.GetValues(typeof(CheckUploadEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(CheckUploadEnum).GetField(((CheckUploadEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
@@ -1049,33 +608,6 @@
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "materielSourceTypeEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(MaterielSourceTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(MaterielSourceTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(MaterielSourceTypeEnum).GetField(((MaterielSourceTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "materielTypeEnum":
                        {
                            List<object> data = new List<object>();
@@ -1103,17 +635,70 @@
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "customerOutRuleEnum":
                    case "materielUnitEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(CustomerOutRuleEnum);
                                List<int> enums = Enum.GetValues(typeof(CustomerOutRuleEnum)).Cast<int>().ToList();
                                Type type = typeof(MaterielUnitEnum);
                                List<string> enumNames = Enum.GetNames(typeof(MaterielUnitEnum)).ToList();
                                int index = 0;
                                foreach (var item in enumNames)
                                {
                                    FieldInfo? fieldInfo = typeof(MaterielUnitEnum).GetField((item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "agvStationAreaEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(AGVStationAreaEnum);
                                List<int> enums = Enum.GetValues(typeof(AGVStationAreaEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(CustomerOutRuleEnum).GetField(((CustomerOutRuleEnum)item).ToString());
                                    FieldInfo? fieldInfo = typeof(AGVStationAreaEnum).GetField(((AGVStationAreaEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "materielInvOrgEnum":
                        {
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(MaterielInvOrgEnum);
                                List<int> enums = Enum.GetValues(typeof(MaterielInvOrgEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(MaterielInvOrgEnum).GetField(((MaterielInvOrgEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {