From c42507edbe94f0c71044cf7c69d1b5698d194217 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期四, 31 十月 2024 09:40:34 +0800 Subject: [PATCH] 增加设备工艺参数点检表查询方法, --- WebAPI/Controllers/BLL/Xt_SystemParameterController.cs | 126 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 108 insertions(+), 18 deletions(-) diff --git a/WebAPI/Controllers/BLL/Xt_SystemParameterController.cs b/WebAPI/Controllers/BLL/Xt_SystemParameterController.cs index 43756c7..68ed2e3 100644 --- a/WebAPI/Controllers/BLL/Xt_SystemParameterController.cs +++ b/WebAPI/Controllers/BLL/Xt_SystemParameterController.cs @@ -1,4 +1,5 @@ -锘縰sing Newtonsoft.Json.Linq; +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; @@ -29,32 +30,43 @@ { try { + List<object> columnNameList = new List<object>(); if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_Xt_SystemParameterList " + sWhere, "h_v_Xt_SystemParameterList"); + ds = oCN.RunProcReturn("select * from h_v_Xt_SystemParameterList " + sWhere+ " order by hitemid desc", "h_v_Xt_SystemParameterList"); } else { string sql1 = "select * from h_v_Xt_SystemParameterList where 1 = 1 "; - string sql = sql1 + sWhere; + string sql = sql1 + sWhere+ " order by hitemid desc"; ds = oCN.RunProcReturn(sql, "h_v_IF_Proh_v_Xt_SystemParameterListpertyList"); } - if (ds == null || ds.Tables[0].Rows.Count == 0) + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; - objJsonResult.data = null; - return objJsonResult; + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 } - else - { - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "Sucess锛�"; - objJsonResult.data = ds.Tables[0]; - return objJsonResult; - } + + //if (ds.Tables[0].Rows.Count != 0 || ds != null) + //{ + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + //} + //else + //{ + //objJsonResult.code = "0"; + //objJsonResult.count = 0; + //objJsonResult.Message = "鏃犳暟鎹�"; + //objJsonResult.data = null; + //return objJsonResult; + //} } catch (Exception e) { @@ -66,8 +78,86 @@ } } + #region 绯荤粺鍙傛暟鏌ヨ 缂栬緫 + [Route("Xt_SystemParameter/Edit")] + [HttpPost] + public object Xt_SystemParameterEdit([FromBody] JObject msg) + { + DataSet ds; + var _value = msg["msg"].ToString(); + string msg3 = _value.ToString(); + string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg1 = sArray[0].ToString(); + string msg2 = sArray[1].ToString(); + //string msg_HUSEORGID = sArray[2].ToString(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); - // + try + { + DAL.ClsXt_SystemParameter_Ctl oBill = new DAL.ClsXt_SystemParameter_Ctl(); + List<Model.ClsXt_SystemParameter_Model> lsmain = new List<Model.ClsXt_SystemParameter_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Xt_SystemParameter(msg1); + IList list = lsmain; + //淇濆瓨 + oBill.oModel = lsmain[0]; + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HInterID == 0) + { + oBill.oModel.HInterID = DBUtility.ClsPub.CreateBillID("8003", ref DBUtility.ClsPub.sExeReturnInfo); + //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅 + while (true) + { + ds = oCN.RunProcReturn("select * from Xt_SystemParameter where HInterID = " + oBill.oModel.HInterID, "Xt_SystemParameter"); + if (ds != null && ds.Tables[0].Rows.Count > 0) + { + oBill.oModel.HInterID = DBUtility.ClsPub.CreateBillID("8003", ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + break; + } + } + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HInterID); + } + if (bResult) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + } } \ No newline at end of file -- Gitblit v1.9.1