From 3fac13fb2f8d23d85178755826f0cb39f8d06093 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 11 八月 2025 16:52:10 +0800
Subject: [PATCH] 修复 APP 菜单编辑/读取接口 问题

---
 WebAPI/Controllers/WebAPIController.cs |  202 +++++++++++++++++++++++++-------------------------
 1 files changed, 102 insertions(+), 100 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 399f33c..b4c146c 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -21098,114 +21098,116 @@
         }
         #region [浠庢暟鎹簱鍔犺浇鑿滃崟 APP]
 
-        //public class AppMenuLoad
-        //{
-        //    public string HitemID { get; set; } // 涓婚敭
-        //    public string HPartentID { get; set; } = "0"; // 鐖惰妭鐐笽D
-        //    public string HEntryID { get; set; } // 鑿滃崟鑺傜偣id
-        //    public string HIndex { get; set; }
-        //    public string HName { get; set; }
-        //    public string HMenuName { get; set; }
-        //    public string HPicNum { get; set; }
-        //    public string HShowMode { get; set; }
-        //    public string HTranslationText_English { get; set; }
-        //    public string HTranslationText_Spain { get; set; }
-        //    public string HMaker { get; set; }
-        //    public List<MenuLoad> childMenus { get; set; }
-        //}
-        //[Route("Web/MenuList_APP")]
-        //[HttpGet]
-        //public object MenuList_APP(string HMaker, string HType)
-        //{
-        //    try {
-        //        DataSet ds = oCN.RunProcReturn("exec h_p_Gy_MenuDefineSet_APP_Get" +
-        //            "@HMaker = '" + HMaker + "'" +
-        //            "@HType = '" + HType + "'"
-        //            , "h_p_Gy_MenuDefineSet_APP_Get");
+        public class AppMenuLoad
+        {
+            public string HitemID { get; set; } // 涓婚敭
+            public string HPartentID { get; set; } = "0"; // 鐖惰妭鐐笽D
+            public string HEntryID { get; set; } // 鑿滃崟鑺傜偣id
+            public string HIndex { get; set; }
+            public string HName { get; set; }
+            public string HMenuName { get; set; }
+            public string HPicNum { get; set; }
+            public string HShowMode { get; set; }
+            public string HTranslationText_English { get; set; }
+            public string HTranslationText_Spain { get; set; }
+            public string HMaker { get; set; }
+            public List<MenuLoad> childMenus { get; set; }
+        }
+        [Route("Web/MenuList_APP")]
+        [HttpGet]
+        public object MenuList_APP(string HMaker, string HType, string HMenuListName)
+        {
+            try
+            {
+                DataSet ds = oCN.RunProcReturn("exec [h_p_Gy_MenuDefineSet_APP_Get] " +
+                    "@HMaker = N'" + HMaker + "'," +
+                    "@HType = N'" + HType + "'," + 
+                    "@HMenuListName = N'" + HMenuListName + "'"
+                    , "h_p_Gy_MenuDefineSet_APP_Get");
 
-        //        if((bool)ds.Tables[0].Rows[0]["returntype"] == true)
-        //        {
-        //            objJsonResult.code = "1";
-        //            objJsonResult.count = 1;
-        //            objJsonResult.Message = ds.Tables[0].Rows[0]["mesg"].ToString();
-        //            objJsonResult.data = ds.Tables[1];
-        //            return objJsonResult;
-        //        }
-        //        else
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = ds.Tables[0].Rows[0]["mesg"].ToString();
-        //            return objJsonResult;
-        //        }
+                if ((bool)ds.Tables[0].Rows[0]["returnType"] == true)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = ds.Tables[0].Rows[0]["mesg"].ToString();
+                    objJsonResult.data = ds.Tables[1];
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = ds.Tables[0].Rows[0]["mesg"].ToString();
+                    return objJsonResult;
+                }
 
-        //    }
-        //    catch(Exception e)
-        //    {
-        //        objJsonResult.code = "0";
-        //        objJsonResult.count = 0;
-        //        objJsonResult.Message = e.ToString();
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
-        //}
+        }
 
-        //[Route("Web/SetMenuList_APP")]
-        //[HttpPost]
-        //public object SetMenuList_APP([FromBody] JObject oMain)
-        //{
-        //    var _value = oMain["oMain"].ToString();
-        //    string msg1 = _value.ToString();
-        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-        //    try
-        //    {
-        //        string msg2 = sArray[0];
-        //        string user = sArray[1].ToString();
-        //        string MenuName = sArray[2].ToString();
-        //        string type = sArray[3].ToString();
+        [Route("Web/SetMenuList_APP")]
+        [HttpPost]
+        public object SetMenuList_APP([FromBody] JObject oMain)
+        {
+            var _value = oMain["oMain"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            try
+            {
+                string msg2 = sArray[0];
+                string user = sArray[1].ToString();
+                string MenuName = sArray[2].ToString();
+                string type = sArray[3].ToString();
 
-        //        if (String.Equals(type, "APP", StringComparison.InvariantCultureIgnoreCase))
-        //        {
-        //            oCN.BeginTran();
-        //            List<AppMenuLoad> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AppMenuLoad>>(msg2);
-        //            string sql1 = "delete from Gy_MenuDefineSet_APP where HMenuName = '" + MenuName + "' and HMaker = '" + user + "'";
-        //            oCN.RunProcReturn(sql1, "Gy_MenuDefineSet_APP");
-        //            list.ForEach(one =>
-        //            {
-        //                string sql2 = "insert into Gy_MenuDefineSet_APP( HEntryID, HIndex, HName, HMenuName, HPicNum, HShowMode, HMaker)" +
-        //               "Values('" + one.HEntryID + "','" + one.HIndex + "','" + one.HName + "','" + one.HName +
-        //               "','" + MenuName + "','" + one.HPicNum + "','" + one.HShowMode + "','" + user + "')";
-        //                oCN.RunProcReturn(sql2, "Gy_MenuDefineSet_APP");
-        //            });
+                if (String.Equals(type, "APP", StringComparison.InvariantCultureIgnoreCase))
+                {
+                    oCN.BeginTran();
+                    List<AppMenuLoad> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AppMenuLoad>>(msg2);
+                    string sql1 = "delete from Gy_MenuDefineSet_APP where HMenuName = '" + MenuName + "' and HMaker = '" + user + "'";
+                    oCN.RunProcReturn(sql1, "Gy_MenuDefineSet_APP");
+                    list.ForEach(one =>
+                    {
+                        string sql2 = "insert into Gy_MenuDefineSet_APP( HEntryID, HIndex, HName, HMenuName, HPicNum, HShowMode, HMaker)" +
+                       "Values('" + one.HEntryID + "','" + one.HIndex + "','" + one.HName + "','" + MenuName + "','" 
+                       + one.HPicNum + "','" + one.HShowMode + "','" + user + "')";
+                        oCN.RunProcReturn(sql2, "Gy_MenuDefineSet_APP");
+                    });
 
-        //            oCN.Commit();
+                    oCN.Commit();
 
-        //            objJsonResult.code = "1";
-        //            objJsonResult.count = 1;
-        //            objJsonResult.Message = "璁剧疆鎴愬姛锛�";
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //        }
-        //        else
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = "鏆備笉鏀寔璇ュ钩鍙拌缃嚜瀹氫箟鑿滃崟锛�";
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //        }
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "璁剧疆鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏆備笉鏀寔璇ュ钩鍙拌缃嚜瀹氫箟鑿滃崟锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        objJsonResult.code = "0";
-        //        objJsonResult.count = 0;
-        //        objJsonResult.Message = e.ToString();
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
-        //}
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         #endregion
 
 

--
Gitblit v1.9.1