1
yangle
2023-05-19 8c0f02a6bfab6e36102fd3e045cb4691959f6054
WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
@@ -174,8 +174,19 @@
        #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")]
@@ -213,6 +224,7 @@
            string HOrderList = sArray[3].ToString();
            string HModuleName = sArray[4].ToString();
            string HBillType = sArray[5].ToString();
            string NoEditList = sArray[6].ToString();
            try
            {
@@ -220,21 +232,47 @@
                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 + "'");
                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)
                    for(int j = 0; j < HButtonIDLists.Count; j++)
                    {
                        HHideFlag = 1;
                        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;
                            }
                            string sql = "exec h_p_Xt_ModuleButtonSet '" + HBillType + "','" + HModuleName + "','" + HButtonID + "','" + HButtonName + "'," + HOrder + "," + HHideFlag + "," + HEditFlag;
                            oCN.RunProc(sql);
                        }
                    }
                    string sql = "exec h_p_Xt_ModuleButtonSet '" + HBillType + "','" + HModuleName + "','" + HButtonID + "','" + HButtonName + "'," + HOrder + "," + HHideFlag + "," + HEditFlag;
                    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;
                            oCN.RunProc(sql);
                        }
                    }
                }
                objJsonResult.code = "1";