From 2bf053827c10f3b9d74f9fae8c956a0f2266997f Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 25 十二月 2023 09:34:07 +0800
Subject: [PATCH] Security_Log_second方法无法判断角色权限问题解决; Security_Log方法判断角色权限时对于id最大的一个权限的判断无法判断问题解决。 信用额度申请单、特批申请单、销售订单变更单、应收退款单、收款单:增加查询权限判断。 工艺路线查询:增加查询权限判断。 生产班组、生产资源:增加查询权限判断

---
 WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs |  228 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 222 insertions(+), 6 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
index 98c011a..8f4ae94 100644
--- a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
+++ b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
@@ -27,7 +27,21 @@
         {
             try
             {
+
                 ds = oCN.RunProcReturn("select * from  Xt_grdAlignment_WMES where HModName='" + HModName + "' and HUserName='" + user + "'", "Xt_grdAlignment_WMES");
+
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    ds = oCN.RunProcReturn("select * from  Xt_grdAlignment_WMES where HModName='" + HModName + "' and (HUserName='admin' or HUserName='Admin')", "Xt_grdAlignment_WMES");
+
+                    if (ds.Tables[0].Rows.Count == 0) {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "Sucess锛�";
+                        objJsonResult.data = ds.Tables[0];
+                        return objJsonResult;
+                    }
+                }
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -55,13 +69,15 @@
             public string HTextHeight;
             public string HSortFlag;
             public string HSelTotal;
-          
+            public string HColumnWidth;
+
         }
         public class grdAlignmentSub
         {
             public string ColumnName;
             public bool IsHide;
             public string Alignment;
+            public string ColumnWidth;
         }
 
         [Route("Xt_grdAlignment_WMES/AddgrdAlignmentWMES")]
@@ -108,17 +124,20 @@
                 var HGridString = "";
                 for (int i = 0; i < omdelsub.Count; i++)
                 {
-                    HGridString += $"{(i+1)}|{(omdelsub[i].IsHide == true ? 1 : 0)}|{omdelsub[i].Alignment},";
+                    var width = omdelsub[i].ColumnWidth;
+                    if (string.IsNullOrEmpty(width) || DBUtility.ClsPub.isLong(width) == 0)
+                        width = "120";
+                    HGridString += $"{(i + 1)}|{(omdelsub[i].IsHide == true ? 1 : 0)}|{omdelsub[i].Alignment}|{width},";
                 }
                 HGridString = HGridString.Substring(0, HGridString.Length - 1);
 
                 oCN.RunProc("Delete from Xt_grdAlignment_WMES where HUserName='" + user + "' and HModName='" + HModName + "' ");
                 oCN.RunProc("insert into Xt_grdAlignment_WMES (HUserName,HModName,HGridString,HFixCols" +
-                    ",HFontSize,HHeadTextHeight,HTextHeight,HSortFlag,HSelTotal" +
+                    ",HFontSize,HHeadTextHeight,HTextHeight,HSortFlag,HSelTotal,HColumnWidth" +
                     ")  values('" + user + "','" + HModName + "','" + HGridString + "'," + (omdelMian.HFixCols == "" ? "0" : omdelMian.HFixCols) +
-                    "," + (omdelMian.HFontSize == "" ? "0" : omdelMian.HFontSize) + "," + (omdelMian.HHeadTextHeight == "" ? "0" : omdelMian.HHeadTextHeight) +
-                    "," + (omdelMian.HTextHeight == "" ? "0" : omdelMian.HTextHeight) + ",'" + omdelMian.HSortFlag + "','" + omdelMian.HSelTotal + "'" +
-                    ")");
+                    "," + (omdelMian.HFontSize == "" ? "0" : omdelMian.HFontSize) + ",0" +
+                    ",0,'" + omdelMian.HSortFlag + "','" + omdelMian.HSelTotal + "'" +
+                    "," + (omdelMian.HColumnWidth == "" ? "0" : omdelMian.HColumnWidth) + ")");
 
 
                 objJsonResult.code = "1";
@@ -138,5 +157,202 @@
         }
 
         #endregion
+
+        #region 闅愯棌鍒楄缃�  鍒犻櫎
+        [Route("Xt_grdAlignment_WMES/DelgrdAlignmentWMES")]
+        [HttpGet]
+        public object DelgrdAlignmentWMES(string HModName, string user)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from  Xt_grdAlignment_WMES where HModName='" + HModName + "' and HUserName='" + user + "'", "Xt_grdAlignment_WMES");
+
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝や汉鏃犳ā鍧楁暟鎹�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from Xt_grdAlignment_WMES where HModName='" + HModName + "' and HUserName='" + user + "'");
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                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;
+            }
+        }
+        #endregion
+
+
+        #region 鎸夐挳璁剧疆 鍒楄〃
+        [Route("Xt_ModuleButtonSet_WMES/moduleButtonSetWMESList")]
+        [HttpGet]
+        public object moduleButtonSetWMESList(string HModName, string HBillType, string HUserName)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from  Xt_ModuleButtonSet where HModuleName='" + HModName + "' and HBillType='" + HBillType + "' and HUserName='" + HUserName + "'", "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 BtnID;
+            public string BtnName;
+            public bool IsHide;
+        }
+        public class noEditList
+        {
+            public string HBillType;
+            public string HModuleName;
+            public string HButtonID;
+            public string HButtonName;
+            public int HOrder;
+            public bool HHideFlag;
+            public bool HEditFlag;
+        }
+
+        [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();
+            string NoEditList = sArray[6].ToString();
+            string HUserName = sArray[7].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);
+                List<noEditList> noEditLists= Newtonsoft.Json.JsonConvert.DeserializeObject<List<noEditList>>(NoEditList);
+
+                //鎻掑叆鍙紪杈戞寜閽殑淇℃伅璁板綍
+                oCN.RunProc("delete from Xt_ModuleButtonSet where HModuleName= '" + HModuleName + "' and HBillType='" + HBillType + "' and HUserName= '" + HUserName + "'");
+                for (int i = 0; i < button.Count; i++)
+                {
+                    for(int j = 0; j < HButtonIDLists.Count; j++) 
+                    {
+                        if (button[i].BtnID == HButtonIDLists[j])
+                        {
+                            int HHideFlag = 0;
+                            int HEditFlag = 1;
+                            string HButtonID = HButtonIDLists[j].ToString();
+                            string HButtonName = HButtonNameLists[j].ToString();
+                            int HOrder = HOrderLists[j];
+                            if (button[i].IsHide)
+                            {
+                                HHideFlag = 1;
+                            }
+                            if(button[i].BtnID== "HideButton")                                 //鐢ㄦ埛杩涜绗竴娆¤缃椂锛岃缃� 鎸夐挳璁剧疆 鎸夐挳涓轰笉鍙紪杈戜笖涓嶉殣钘�
+                            {
+                                HEditFlag = 0;
+                                HHideFlag = 0;
+                            }
+                            string sql = "exec h_p_Xt_ModuleButtonSet '" + HBillType + "','" + HModuleName + "','" + HButtonID + "','" + HButtonName + "'," + HOrder + "," + HHideFlag + "," + HEditFlag + ",'" + HUserName + "'";
+                            oCN.RunProc(sql);
+                        }
+                    }
+                }
+
+                //閲嶆柊鎻掑叆涓嶅彲缂栬緫鎸夐挳鐨勪俊鎭褰�
+                for (int i = 0; i < noEditLists.Count; i++)
+                {
+                    for (int j = 0; j < HButtonIDLists.Count; j++)
+                    {
+                        if (noEditLists[i].HButtonID == HButtonIDLists[j])
+                        {
+                            int HHideFlag = noEditLists[i].HHideFlag?1:0;
+                            int HEditFlag = 0;
+                            string HButtonID = noEditLists[i].HButtonID;
+                            string HButtonName = noEditLists[i].HButtonName;
+                            int HOrder = HOrderLists[j];
+                            string sql = "exec h_p_Xt_ModuleButtonSet '" + HBillType + "','" + HModuleName + "','" + HButtonID + "','" + HButtonName + "'," + HOrder + "," + HHideFlag + "," + HEditFlag + ",'" + HUserName + "'";
+                            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