1
Zhang-Hong-Lin
2025-04-16 5f0b4758bed03060fd70b282d7fe56fa02d2f6d0
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs
@@ -23,6 +23,7 @@
using WIDESEAWCS_QuartzJob.DeviceEnum;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Common.LocationEnum;
using WIDESEAWCS_Common.StockEnum;
namespace WIDESEAWCS_WCSServer.Controllers.System
{
@@ -172,6 +173,54 @@
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                    case "mateType":
                        {
                            List<object> data = new List<object>();
                            Type type = typeof(MateTypeEnum);
                            List<int> enums = Enum.GetValues(type).Cast<int>().ToList();
                            int index = 0;
                            foreach (var item in enums)
                            {
                                FieldInfo? fieldInfo = type.GetField(((MateTypeEnum)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 "stock":
                        {
                            List<object> data = new List<object>();
                            Type type = typeof(stockEnum);
                            List<int> enums = Enum.GetValues(type).Cast<int>().ToList();
                            int index = 0;
                            foreach (var item in enums)
                            {
                                FieldInfo? fieldInfo = type.GetField(((stockEnum)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":
                        {
                            List<object> data = new List<object>();