black-goat-me
2023-05-17 0aba0d5e0e3ae3570ac9f26440e9763a20d3721d
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
    }
}