From f77e4196ad4870b713a0c51d874481a372c9201c Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 09 十二月 2022 13:36:56 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/BaseSet/Gy_MaterialController.cs | 97 +++++++++++++++++++++++++++++++++++------------- 1 files changed, 70 insertions(+), 27 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs index a800787..b638e39 100644 --- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs @@ -132,7 +132,6 @@ { DataSet ds; var _value = msg["msg"].ToString(); - cs(_value); string msg3 = _value.ToString(); string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg1 = sArray[0].ToString(); @@ -195,32 +194,22 @@ objJsonResult.data = 1; return objJsonResult; } - if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; - objJsonResult.data = 1; - return objJsonResult; - } + //if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + // objJsonResult.data = 1; + // return objJsonResult; + //} //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� ds = oCN.RunProcReturn("select * from Gy_Material where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Material"); - if (oItem.HNumber.Trim() == "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒"; - objJsonResult.data = 1; - return objJsonResult; - } //鏂板鏃跺垽鏂� + #region 鐖剁骇鏍¢獙鏂规硶锛坅pi璋冪敤鍏堟敞閲婃帀锛岋級 + /* if (oItem.HItemID == 0) { - if (ds == null || ds.Tables[0].Rows.Count == 0) - { - - } - else + if (ds == null || ds.Tables[0].Rows.Count > 0) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -276,6 +265,8 @@ } } } + */ + #endregion //寰楀埌鐭唬鐮� string sShortNumber; sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); @@ -293,13 +284,12 @@ oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇 oBill.oModel = oItem; } - //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; if (oBill.oModel.HItemID == 0) { - // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + //bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); bResult = oBill.AddNew(); } else @@ -334,7 +324,52 @@ } } - + [Route("Gy_Material/SaveGy_MaterialListApi")] + [HttpPost] + public object SaveGy_MaterialListApi([FromBody] JObject msg) + { + var _value = msg["model"].ToString(); + string msg3 = _value.ToString(); + string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg1 = sArray[0].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + try + { + DLL.ClsGy_Material_Ctl oBill = new DLL.ClsGy_Material_Ctl(); + List<Models.ClsGy_Material_Model> lsmain = new List<Models.ClsGy_Material_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Material(msg1); + oBill.oModel = lsmain[0]; + //淇濆瓨 + bool bResult = oBill.AddNewApi(); + if (bResult) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + 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; + } + } /// <summary> /// 鐗╂枡璁剧疆鍒犻櫎鍔熻兘 @@ -347,6 +382,16 @@ DataSet ds; try { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (user == "10000")//api鍚屾鏂瑰紡 + { + oCN.RunProc("delete from Gy_Material where HERPItemID=" + HItemID); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "* 鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + } //鍒犻櫎鏉冮檺 if (!DBUtility.ClsPub.Security_Log("Gy_Material_Delete", 1, false, user)) { @@ -356,8 +401,6 @@ objJsonResult.data = null; return objJsonResult; } - - SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (string.IsNullOrWhiteSpace(HItemID)) { objJsonResult.code = "0"; -- Gitblit v1.9.1