From 14ae0e21c8660dbb3ac20a5b0d9db9b6dde3cfb9 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 25 三月 2026 17:07:00 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/WebAPIController.cs |  185 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 182 insertions(+), 3 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 19f9edd..6a78309 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -340,6 +340,7 @@
         /// <returns></returns>
         [Route("Web/GetUser")]
         [HttpGet]
+        [AllowAnonymous]
         public object GetUser(string UserName, string PassWord, string HOrgName)
         {
             try
@@ -384,11 +385,23 @@
                     }
                 }
 
+                if (!oSystemParameter.ShowBill(ref DBUtility.ClsPub.sErrInfo))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鐧诲綍寮傚父锛乀oken 鐢熸垚寮傚父锛屾棤娉曡幏鍙栧叕鍙镐俊鎭紒";
+                }
+
+                string tokenStr = Utility.JWTHelper.GenerateToken(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
+
+
                 objjson.code = "0";
                 objjson.count = 1;
                 objjson.Message = "[0000-1-073]鐧诲綍鎴愬姛锛�";
                 objjson.data = ds.Tables[0];
-                return objjson;
+                JObject jobjJsonResult = JObject.FromObject(objjson);
+                jobjJsonResult["token"] = tokenStr;
+                return jobjJsonResult;
 
             }
             catch (Exception e)
@@ -2619,6 +2632,7 @@
         /// <returns></returns>
         [Route("Web/GetDataBases")]
         [HttpGet]
+        [AllowAnonymous]
         public object GetDataBases()
         {
             try
@@ -18965,6 +18979,7 @@
         /// <returns></returns>
         [Route("Web/GetOrganizations")]
         [HttpGet]
+        [AllowAnonymous]
         public object GetOrganizations()
         {
             try
@@ -18997,6 +19012,7 @@
         /// <returns></returns>
         [Route("Web/BaseInfo")]
         [HttpGet]
+        [AllowAnonymous]
         public object GetBaseInfo()
         {
             try
@@ -21765,6 +21781,8 @@
             public string HTranslationText_English { get; set; }
             public string HTranslationText_Spain { get; set; }
             public List<MenuLoad> childMenus { get; set; }
+            public DateTime HMakeDate { get; set; }
+            public string HMaker { get; set; }
         }
 
         [Route("Web/MenuList")]
@@ -21871,6 +21889,163 @@
         }
 
         #endregion
+
+        #region 鏋勫缓璺敱宓屽瀵硅薄
+        [Route("Web/MenuList_1")]
+        [HttpGet]
+        public object MenuList_1(string HMakeName, string HType)
+        {
+            try
+            {
+                string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json");
+                string directory = Path.GetDirectoryName(filePath);
+                if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+                {
+                    Directory.CreateDirectory(directory);
+                }
+                DateTime lastWriteTime = File.GetLastWriteTime(filePath);
+                lastWriteTime = new DateTime(lastWriteTime.Year, lastWriteTime.Month, lastWriteTime.Day, lastWriteTime.Hour, 0, 0);
+                DataSet ds = oCN.RunProcReturn($"select top 1 HMakeDate from Gy_Menu_1_build ORDER BY HMakeDate desc  ", "Gy_Menu_1_build");
+
+                DateTime dbTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["HMakeDate"]);
+                dbTime = new DateTime(dbTime.Year, dbTime.Month, dbTime.Day, dbTime.Hour, 0, 0);
+                
+                if (dbTime> lastWriteTime)
+                {
+                    List<MenuLoad> mu = new List<MenuLoad>();                       //浠ョ埗瀛愮骇缁撴瀯瀛樻斁鑿滃崟娓呭崟淇℃伅
+                    SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();            //鏁版嵁搴撴搷浣滃伐鍏�
+                    string sql = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain  from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' order by HPosition";
+                    ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet");        //鏌ヨ褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鑿滃崟鏁版嵁
+                    if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夎缃繃鑷畾涔変俊鎭紝鑻ヨ褰曟暟涓�0锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅
+                    {
+                        string sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName=" +
+                            "(select   top 1 c.GroupName  from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId  " +
+                            "left join System_UserGroup c on b.GroupId = c.GroupID  where a.Czymc ='" + HMakeName + "' order by len(c.GroupName ))";
+                        ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");        //鏌ヨ鐢ㄦ埛缁戝畾鐨勮鑹� 鏄惁璁剧疆鑿滃崟淇℃伅 鍙栬鑹插悕绉版渶鐭殑涓�涓�
+                        if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+                        {
+                            sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain  from Gy_MenuDefineSet where HMakeName = 'admin' and HType = '" + HType + "' order by HPosition";
+                            ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");   //鏌ヨadmin 鏄惁璁剧疆鑿滃崟淇℃伅
+                            if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+                            {
+                                sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1_build where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID  ";
+                                ds = oCn.RunProcReturn(sql, "Gy_Menu_1_build");
+                            }
+
+                        }
+                    }
+
+                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)       //灏嗚彍鍗曠殑鏍硅妭鐐逛繚瀛樺埌鍒楄〃menu涓�
+                    {
+                        if (ds.Tables[0].Rows[i]["HPartentID"].ToString() == "0" || ds.Tables[0].Rows[i]["HitemID"].ToString() == ds.Tables[0].Rows[i]["HPartentID"].ToString())  //鍒ゆ柇鏄惁鏈�澶栧眰鏍硅妭鐐�
+                        {
+                            MenuLoad tbj = new MenuLoad();
+                            tbj.HitemID = ds.Tables[0].Rows[i]["HitemID"].ToString();
+                            tbj.HNumber = ds.Tables[0].Rows[i]["HNumber"].ToString();
+                            tbj.HName = ds.Tables[0].Rows[i]["HName"].ToString();
+                            tbj.HPartentID = ds.Tables[0].Rows[i]["HPartentID"].ToString();
+                            tbj.HLevel = int.Parse(ds.Tables[0].Rows[i]["HLevel"].ToString());
+                            tbj.Hurl = ds.Tables[0].Rows[i]["Hurl"].ToString();
+                            tbj.HShowMode = ds.Tables[0].Rows[i]["HShowMode"].ToString();
+                            tbj.HTranslationText_English = ds.Tables[0].Rows[i]["HTranslationText_English"].ToString();
+                            tbj.HTranslationText_Spain = ds.Tables[0].Rows[i]["HTranslationText_Spain"].ToString();
+                            if (ds.Tables[0].Rows[i]["HPicNum"] != null)
+                            {
+                                tbj.HPicNum = ds.Tables[0].Rows[i]["HPicNum"].ToString();
+                            }
+                            mu.Add(tbj);
+                        }
+                    }
+                    diguiLoad(ds.Tables[0], mu);                //浣跨敤閫掑綊锛屽皢闇�瑕佸姞杞界殑鏁版嵁浠ョ埗瀛愮骇鐨勭粨鏋勫瓨鏀惧湪mu涓�
+
+
+                    objJsonResult.code = "1";//淇″彿鍙傛暟
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+                    objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(mu);
+                    return objJsonResult;
+                }
+                else
+                {
+                    string josncontext = File.ReadAllText(filePath);
+                    objJsonResult.code = "2";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+                    objJsonResult.data = josncontext;
+                    return objJsonResult;
+                }
+                
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ澶辫触锛�";
+                objJsonResult.data = e.ToString();
+                return objJsonResult;
+            }
+        }
+
+        public class RequestDto
+        {
+            public string content { get; set; }
+        }
+        [Route("Web/buildRouteObj")]
+        [HttpPost]
+        public object buildRouteObj([FromBody] RequestDto request)
+        {
+            string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json");
+            try
+            {
+                string jsonContent = request.content;
+                if (string.IsNullOrEmpty(jsonContent))
+                {
+                    
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "JSON 鍐呭涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(filePath))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏂囦欢璺緞涓嶈兘涓虹┖銆傦紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                string directory = Path.GetDirectoryName(filePath);
+                if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+                {
+                    Directory.CreateDirectory(directory);
+                }
+                string contentToWrite = jsonContent;
+
+                File.WriteAllText(filePath, contentToWrite);
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏂囦欢淇濆瓨鎴愬姛锛岃矾寰勪负"+filePath;
+                objJsonResult.data = null;
+                LogService.Write($"璺緞涓簕filePath}");
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                LogService.Write("Exception锛�" + e.ToString());
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
 
 
         #region [鑿滃崟鐩綍鑷畾涔塢
@@ -23746,11 +23921,15 @@
                 foreach (var param in rawParams)
                 {
                     bool isMatched = false;
-                    // 閬嶅巻鎵�鏈夊伐鑹哄垎绫伙紝鍒ゆ柇鍙傛暟鍚嶆槸鍚﹀寘鍚鍒嗙被鍚嶇О
+                    // 閬嶅巻鎵�鏈夊伐鑹哄垎绫伙紝鍒ゆ柇鍙傛暟鍚嶆槸浠ヨ鍒嗙被鍚嶇О寮�澶�
                     foreach (string category in categoryNames)
                     {
-                        if (param.TechParamName.Contains(category))
+                        if (param.TechParamName.StartsWith(category))
                         {
+                            if(param.TechParamName.Length != category.Length)
+                            {
+                                param.TechParamName = param.TechParamName.Substring(category.Length);
+                            }
                             groupedParams[category].Add(param);
                             isMatched = true;
                             break; // 鍖归厤鍒扮涓�涓垎绫诲悗鍋滄锛堥伩鍏嶉噸澶嶅尮閰嶏級

--
Gitblit v1.9.1