From 0aba0d5e0e3ae3570ac9f26440e9763a20d3721d Mon Sep 17 00:00:00 2001
From: black-goat-me <226547893@qq.com>
Date: 星期三, 17 五月 2023 09:23:12 +0800
Subject: [PATCH] 按钮隐藏功能

---
 WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs |  115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 113 insertions(+), 2 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
index f18ccfb..02e2fa0 100644
--- a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
+++ b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
@@ -56,7 +56,7 @@
             public string HSortFlag;
             public string HSelTotal;
             public string HColumnWidth;
-          
+
         }
         public class grdAlignmentSub
         {
@@ -123,7 +123,7 @@
                     ")  values('" + user + "','" + HModName + "','" + HGridString + "'," + (omdelMian.HFixCols == "" ? "0" : omdelMian.HFixCols) +
                     "," + (omdelMian.HFontSize == "" ? "0" : omdelMian.HFontSize) + ",0" +
                     ",0,'" + omdelMian.HSortFlag + "','" + omdelMian.HSelTotal + "'" +
-                    ","+ (omdelMian.HColumnWidth == "" ? "0" : omdelMian.HColumnWidth) + ")");
+                    "," + (omdelMian.HColumnWidth == "" ? "0" : omdelMian.HColumnWidth) + ")");
 
 
                 objJsonResult.code = "1";
@@ -143,5 +143,116 @@
         }
 
         #endregion
+
+
+        #region 鎸夐挳璁剧疆 鍒楄〃
+        [Route("Xt_ModuleButtonSet_WMES/moduleButtonSetWMESList")]
+        [HttpGet]
+        public object moduleButtonSetWMESList(string HModName, string HBillType)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from  Xt_ModuleButtonSet where HModuleName='" + HModName + "' and HBillType='" + HBillType + "'", "Xt_ModuleButtonSet");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = ds.Tables[0].Rows.Count;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎸夐挳璁剧疆  娣诲姞/淇敼
+        public class moduleButtonSet
+        {
+            public string BtnName;
+            public bool IsHide;
+        }
+
+        [Route("Xt_ModuleButtonSet_WMES/AddModuleButtonSetWMES")]
+        [HttpPost]
+        public object AddModuleButtonSetWMES([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            oCN.BeginTran();
+            //淇濆瓨涓昏〃
+            objJsonResult = AddButtonMain(msg1);
+            if (objJsonResult.code == "0")
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = objJsonResult.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            oCN.Commit();
+            objJsonResult.code = "1";
+            objJsonResult.count = 1;
+            objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+            objJsonResult.data = null;
+            return objJsonResult;
+        }
+
+        public json AddButtonMain(string msg1)
+        {
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string sTableData = sArray[0].ToString();
+            string HButtonIDList = sArray[1].ToString();
+            string HButtonNameList = sArray[2].ToString();
+            string HOrderList = sArray[3].ToString();
+            string HModuleName = sArray[4].ToString();
+            string HBillType = sArray[5].ToString();
+
+            try
+            {
+                List<moduleButtonSet> button = Newtonsoft.Json.JsonConvert.DeserializeObject<List<moduleButtonSet>>(sTableData);
+                List<string> HButtonIDLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(HButtonIDList);
+                List<string> HButtonNameLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(HButtonNameList);
+                List<int> HOrderLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(HOrderList);
+
+                oCN.RunProc("delete from Xt_ModuleButtonSet where HModuleName= '" + HModuleName + "' and HBillType='" + HBillType + "'");
+                for (int i = 0; i < button.Count; i++)
+                {
+                    int HHideFlag = 0;
+                    int HEditFlag = 1;
+                    string HButtonID = HButtonIDLists[i].ToString();
+                    string HButtonName = HButtonNameLists[i].ToString();
+                    int HOrder = HOrderLists[i];
+                    if (button[i].IsHide)
+                    {
+                        HHideFlag = 1;
+                    }
+                    string sql = "exec h_p_Xt_ModuleButtonSet '" + HBillType + "','" + HModuleName + "','" + HButtonID + "','" + HButtonName + "'," + HOrder + "," + HHideFlag + "," + HEditFlag;
+                    oCN.RunProc(sql);
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = null;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1