From f07efc5e5f18517cd3d7d772dc8be55319c4804b Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期五, 12 十二月 2025 09:44:02 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_DictionaryController.cs |   95 ++++++++++++++++++++++++-----------------------
 1 files changed, 48 insertions(+), 47 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_DictionaryController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_DictionaryController.cs"
index a236b2e..53f60cb 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_DictionaryController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_DictionaryController.cs"
@@ -24,58 +24,59 @@
     public IActionResult GetVueDictionary([FromBody] string[] dicNos)
     {
         List<VueDictionaryDTO> vueDictionaryDTOs = Service.GetVueDictionary(dicNos);
-        //try
-        //{
-        //    List<string> cacheDicNos = new List<string>();
-        //    foreach (string n in dicNos)
-        //    {
-        //        string str = _cacheService.Get(n);
-        //        if (!string.IsNullOrEmpty(str))
-        //        {
-        //            VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str);
+        try
+        {
+            List<string> cacheDicNos = new List<string>();
+            foreach (string n in dicNos)
+            {
+                string str = _cacheService.Get(n);
+                if (!string.IsNullOrEmpty(str))
+                {
+                    VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str);
 
-        //            if (vueDictionary != null)
-        //            {
-        //                vueDictionaryDTOs.Add(vueDictionary);
-        //                cacheDicNos.Add(n);
-        //            }
-        //        }
-        //    }
-        //    List<string> dicList = dicNos.ToList();
-        //    if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0)
-        //    {
-        //        string str = AppSettings.Configuration["dics"];
-        //        if (!string.IsNullOrEmpty(str))
-        //        {
-        //            List<string> cusDics = new List<string>();
+                    if (vueDictionary != null)
+                    {
+                        vueDictionaryDTOs.Add(vueDictionary);
+                        cacheDicNos.Add(n);
+                    }
+                }
+            }
+            List<string> dicList = dicNos.ToList();
+            if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0)
+            {
+                string str = AppSettings.Configuration["dics"];
+                if (!string.IsNullOrEmpty(str))
+                {
+                    List<string> cusDics = new List<string>();
 
-        //            List<string> dics = str.Split(",").ToList();
+                    List<string> dics = str.Split(",").ToList();
 
-        //            foreach (var item in dics)
-        //            {
-        //                dicList.Remove(item);
-        //                cusDics.Add(item);
-        //            }
+                    foreach (var item in dics)
+                    {
+                        dicList.Remove(item);
+                        cusDics.Add(item);
+                    }
 
-        //            foreach (var item in cusDics)
-        //            {
-        //                VueDictionaryDTO vueDictionaryDTO = GetVueDictionary(item.Trim());
-        //                if (vueDictionaryDTO != null)
-        //                {
-        //                    vueDictionaryDTOs.Add(vueDictionaryDTO);
-        //                    if (!_cacheService.Exists(item) && vueDictionaryDTO.SaveCache)
-        //                    {
-        //                        _cacheService.Add(item, vueDictionaryDTO.Serialize());
-        //                    }
-        //                }
-        //            }
-        //        }
-        //    }
-        //}
-        //catch
-        //{
+                    foreach (var item in cusDics)
+                    {
+                        VueDictionaryDTO vueDictionaryDTO = GetVueDictionary(item.Trim());
+                        if (vueDictionaryDTO != null)
+                        {
+                            vueDictionaryDTOs.Add(vueDictionaryDTO);
+                            if (!_cacheService.Exists(item) && vueDictionaryDTO.SaveCache)
+                            {
+                                _cacheService.Add(item, vueDictionaryDTO.Serialize());
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        catch
+        {
 
-        //}
+        }
+        vueDictionaryDTOs = vueDictionaryDTOs.DistinctBy(d => d.DicNo).ToList();
         return Json(vueDictionaryDTOs);
     }
     private VueDictionaryDTO GetVueDictionary(string key)

--
Gitblit v1.9.3