647556386
6 天以前 f29f358f589f5b1c2589c07b65845650be7aafef
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs
@@ -24,6 +24,7 @@
using WIDESEA_DTO.System;
using WIDESEA_ISystemService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Basic;
namespace WIDESEA_SystemService
{
@@ -211,9 +212,66 @@
            {
                switch (key)
                {
                    default:
                        return result;
                    case "warehouses":
                        {
                            List<object> data = new List<object>();
                            {
                                List<Dt_WarehouseArea> warehouses = BaseDal.Db.Queryable<Dt_WarehouseArea>().ToList();
                                int index = 0;
                                foreach (var item in warehouses)
                                {
                                    data.Add(new { key = item.Code, value = item.Name });
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "locationTypes":
                        {
                            List<object> data = new List<object>();
                            {
                                List<Dt_LocationType> warehouses = BaseDal.Db.Queryable<Dt_LocationType>().ToList();
                                int index = 0;
                                foreach (var item in warehouses)
                                {
                                    data.Add(new { key = item.LocationType, value = item.LocationTypeDesc });
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "stockStatusEmun":
                        {
                            List<object> data = new List<object>();
                            Type type = typeof(StockStatusEmun);
                            List<int> enums = Enum.GetValues(typeof(StockStatusEmun)).Cast<int>().ToList();
                            int index = 0;
                            foreach (var item in enums)
                            {
                                FieldInfo? fieldInfo = typeof(StockStatusEmun).GetField(((StockStatusEmun)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;
                }
                return result;
            }
            catch (Exception ex)
            {