From 94acd320ea22ea212290e493fb6211deda1b7eef Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期二, 20 九月 2022 01:07:22 +0800 Subject: [PATCH] 增加 工艺参数基础资料, 控制器、类文件(工艺参数,工艺参数单位,工艺参数对应表) --- WebAPI/Controllers/BaseSet/Gy_TechParamByProcController.cs | 415 ++++++++++++++++++ WebAPI/Models/TechParamByProc.cs | 23 + WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs | 441 +++++++++++++++++++ WebAPI/Models/TechnologyParameter.cs | 23 + WebAPI/Models/TechnologyParameterUnit.cs | 24 + WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs | 417 ++++++++++++++++++ 6 files changed, 1,343 insertions(+), 0 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_TechParamByProcController.cs b/WebAPI/Controllers/BaseSet/Gy_TechParamByProcController.cs new file mode 100644 index 0000000..c463718 --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_TechParamByProcController.cs @@ -0,0 +1,415 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; +using WebAPI.Service; + +namespace WebAPI.Controllers +{ + public class Gy_TechParamByProcController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + /// <summary> + /// 杩斿洖宸ヨ壓鍙傛暟瀵瑰簲琛ㄥ垪琛� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechParamByProc/list")] + [HttpGet] + public object list(string sWhere, string user, string Organization) + { + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechParamByProc", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + string sql1 = string.Format(@"select * from h_v_Gy_TechParamByProc where 1 = 1");//where 缁勭粐鍚嶇О='" + Organization + "' + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn(sql1 + sWhere + " order by HEntryID ", "h_v_Gy_TechParamByProc"); + } + else + { + string sql = sql1 + sWhere + " order by HEntryID"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_TechParamByProc"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + 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; + } + } + + /// <summary> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechParamByProc/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_Gy_TechParamByProcList where hmainid=" + HInterID, "h_v_Gy_TechParamByProcList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + 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; + } + } + + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechParamByProc/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg3 = _value.ToString(); + string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg1 = sArray[0].ToString(); + string msg2 = sArray[1].ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_Customer_Ctl oDept = new DAL.ClsGy_Customer_Ctl(); + DAL.ClsGy_Customer_View oDeptHlp = new DAL.ClsGy_Customer_View(); + + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_Add_Edit_", 1, false, msg2)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + List<TechParamByProc> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TechParamByProc>>(msg1); + + long HInterID = list[0].HInterID; + string HMaker = list[0].HMaker; + string HChecker = list[0].HChecker; + string HRemark = list[0].HRemark; + //long HStopflag = list[0].HStopflag; + long HMaterID = list[0].HMaterID; + long HProcID = list[0].HProcID; + long HTechParamID = list[0].HTechParamID; + long HTechParamUnitID = list[0].HTechParamUnitID; + string HStd = list[0].HStd; + long HDeptID = list[0].HDeptID; + DateTime HMakeDate = list[0].HMakeDate; + + //DateTime HDeleteDate = list[0].HDeleteDate; + + + if (!DBUtility.ClsPub.AllowNumber(HStd)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + //褰撳墠鏃堕棿 + var currentTime = DateTime.Now.ToString(); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert into Gy_TechParamByProc " + + " (HInterID,HMaker,HChecker,HRemark,HMaterID" + + ",HProcID,HTechParamID,HTechParamUnitID,HStd,HMakeDate" + + ",HDeptID) " + + " Values('" + HInterID + "','" + HChecker + "','" + HChecker + "','" + HRemark + "','" + HMaterID + "','" + HProcID + "','" + HTechParamID + "','" + HTechParamUnitID + "','" + HStd + "','" + currentTime + "','" + HDeptID + "')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + //oCN.RunProc("Update Gy_TechParamByProc set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + //oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechParamByProc/ModifyByID")] + [HttpPost] + public object ModifyByID([FromBody] JObject oMain) + { + try + { + DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl(); + DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View(); + + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<TechParamByProc> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TechParamByProc>>(msg2); + + long HInterID = list[0].HInterID; + string HMaker = list[0].HMaker; + string HChecker = list[0].HChecker; + string HRemark = list[0].HRemark; + //string HStopflag = list[0].HStopflag; + long HMaterID = list[0].HMaterID; + long HProcID = list[0].HProcID; + long HTechParamID = list[0].HTechParamID; + long HTechParamUnitID = list[0].HTechParamUnitID; + string HStd = list[0].HStd; + long HDeptID = list[0].HDeptID; + DateTime HMakeDate = list[0].HMakeDate; + + ////鍒ゆ柇鏉冮檺 + //if (!ClsPub.Security_Log("Gy_TechnologyParameter_Add_Edit_", 1, false, msg3)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + if (!DBUtility.ClsPub.AllowNumber(HStd)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //if (oDept.HavSameNumber(HItemID, HNumber)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "浠g爜閲嶅锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + if (HInterID == 0) + { + //褰撳墠鏃堕棿 + var currentTime = DateTime.Now.ToString(); + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert into Gy_TechParamByProc " + + " (HInterID,HMaker,HChecker,HRemark,HMaterID" + + ",HProcID,HTechParamID,HTechParamUnitID,HStd,HMakeDate" + + ",HDeptID) " + + " Values('" + HInterID + "','" + HChecker + "','" + HChecker + "','" + HRemark + "','" + HMaterID + "','" + HProcID + "','" + HTechParamID + "','" + HTechParamUnitID + "','" + HStd + "','" + currentTime + "','" + HDeptID + "')"); + + // Convert.ToString(HEndFlag ? 1 : 0); Convert.ToString(HStopflag ? 1 : 0);HUseFlag + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCN.RunProc("Update Gy_TechnologyParameter set HEndflag=0 where HEntryID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + } + else + { + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_TechParamByProc set " + + " HStd='" + HStd + "'" + + //",HName='" + HName + "'" + + //",HShortNumber='" + HShortNumber + "'" + + //",HHelpCode='" + HHelpCode + "'" + + //",HLevel='" + HLevel.ToString() + "'" + + //",HParentID='" + HParentID.ToString() + "'" + + //",HEndflag=" + Convert.ToString(HEndFlag ? 1 : 0) + + //",HStopflag=" + Convert.ToString(HStopflag ? 1 : 0) + + //",HUseFlag=" + Convert.ToString(HUseFlag ? 1 : 0) + + //",HMakeTime= getdate()" + + //",HMakeEmp='" + HMakeEmp + "'" + + /*",HRemark='" + HRemark + */"Where HEntryID='" + HInterID + "'", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Warehouse,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + //oCN.RunProc("Update Gy_TechParamByProc set HEndflag=0 where HEntryID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + } + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + //oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 宸ヨ壓鍙傛暟瀵瑰簲琛ㄥ垪琛ㄥ垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_TechParamByProc")] + [HttpGet] + public object DeltetGy_TechParamByProc(string HItemID, string user) + { + DataSet ds; + DataSet ds1; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("DeltetGy_TechnologyParameter", 1, false, user)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_TechParamByProc where HInterID=" + HItemID, "Gy_TechParamByProc"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + //if (HStopflag) + //{ + // oCN.RollBack();//鍥炴粴浜嬪姟 + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //ds1 = oCN.RunProcReturn("Select HItemID from Gy_TechParamByProc Where HParentID='" + HItemID + "'", "Gy_TechParamByProc"); + //if (ds1.Tables[0].Rows.Count != 0) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰锛屼笉鑳藉垹闄わ紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //string HUseFlag = Convert.ToString(ds.Tables[0].Rows[0]["HUseFlag"]); + //if (HUseFlag == "宸蹭娇鐢�") + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "姝ら」鐩凡浣跨敤锛屼笉鑳藉垹闄わ紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + oCN.RunProc("delete from Gy_TechParamByProc where HInterID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + 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; + } + } + + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs b/WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs new file mode 100644 index 0000000..2c3cf50 --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs @@ -0,0 +1,441 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; +using WebAPI.Service; + +namespace WebAPI.Controllers +{ + public class Gy_TechnologyController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + /// <summary> + /// 杩斿洖宸ヨ壓鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameter/list")] + [HttpGet] + public object list(string sWhere, string user, string Organization) + { + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + string sql1 = string.Format(@"select * from h_v_Gy_TechnologyParameter where 1 =1 ");//where 缁勭粐鍚嶇О='" + Organization + "' + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn(sql1 + sWhere + " order by HItemID ", "h_v_Gy_TechnologyParameter"); + } + else + { + string sql = sql1 + sWhere + " order by HItemID"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_TechnologyParameter"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + 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; + } + } + + /// <summary> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameter/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_Gy_TechnologyParameterList where HitemID=" + HInterID, "h_v_Gy_TechnologyParameterList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + 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; + } + } + + /// <summary> + /// 宸ヨ壓鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameter/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + string sql = string.Format(@"select HItemID,HNumber 宸ヨ壓鍙傛暟浠g爜,HName 宸ヨ壓鍙傛暟鍚嶇О,HRemark 澶囨敞,HUseFlag 浣跨敤鏍囪 from Gy_TechnologyParameter" + HInterID + "'"); + ds = oCN.RunProcReturn(sql, "Gy_TechnologyParameter"); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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; + } + } + + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameter/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg3 = _value.ToString(); + string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg1 = sArray[0].ToString(); + string msg2 = sArray[1].ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_Customer_Ctl oDept = new DAL.ClsGy_Customer_Ctl(); + DAL.ClsGy_Customer_View oDeptHlp = new DAL.ClsGy_Customer_View(); + + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_Add_Edit_", 1, false, msg2)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + List<TechnologyParameter> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TechnologyParameter>>(msg1); + + long HItemID = list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + long HLevel = list[0].HLevel; + string HEndFlag = list[0].HEndFlag; + string HStopflag = list[0].HStopflag; + string HRemark = list[0].HRemark; + string HHelpCode = list[0].HHelpCode; + string HUseFlag = list[0].HUseFlag; + DateTime HMakeTime = list[0].HMakeTime; + string HMakeEmp = list[0].HMakeEmp; + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + //褰撳墠鏃堕棿 + var currentTime = DateTime.Now.ToString(); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert into Gy_TechnologyParameter " + + " (HNumber,HName,HShortNumber,HParentID,HLevel" + + ",HEndFlag,HStopflag,HRemark,HHelpCode" + + ",HUseFlag,HMakeTime,HMakeEmp) " + + " Values('" + HNumber + "','" + HName + "','" + HShortNumber + "','" + HParentID + "','" + HLevel + + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + + "','" + HHelpCode + "','" + HUseFlag + "','" + currentTime + "','" + HMakeEmp + "')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCN.RunProc("Update Gy_TechnologyParameter set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameter/ModifyByID")] + [HttpPost] + public object ModifyByID([FromBody] JObject oMain) + { + try + { + DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl(); + DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View(); + + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<TechnologyParameter> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TechnologyParameter>>(msg2); + + long HItemID = list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + long HLevel = list[0].HLevel; + string HEndFlag = list[0].HEndFlag; + string HStopflag = list[0].HStopflag; + string HRemark = list[0].HRemark; + string HHelpCode = list[0].HHelpCode; + string HUseFlag = list[0].HUseFlag; + DateTime HMakeTime = list[0].HMakeTime; + string HMakeEmp = list[0].HMakeEmp; + + ////鍒ゆ柇鏉冮檺 + //if (!ClsPub.Security_Log("Gy_TechnologyParameter_Add_Edit_", 1, false, msg3)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //if (oDept.HavSameNumber(HItemID, HNumber)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "浠g爜閲嶅锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + if (HItemID == 0) + { + //褰撳墠鏃堕棿 + var currentTime = DateTime.Now.ToString(); + oCN.BeginTran(); + oCN.RunProc("Insert into Gy_TechnologyParameter " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID,HLevel" + + ",HEndFlag,HStopflag,HRemark,HUseFlag,HMakeTime,HMakeEmp) " + + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HParentID.ToString() + + "','" + HLevel.ToString() + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + "','" + HUseFlag + "','" + currentTime + "','" + HMakeEmp + "')", ref DBUtility.ClsPub.sExeReturnInfo); + // Convert.ToString(HEndFlag ? 1 : 0); Convert.ToString(HStopflag ? 1 : 0);HUseFlag + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCN.RunProc("Update Gy_TechnologyParameter set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + } + else + { + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_TechnologyParameter set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HLevel='" + HLevel.ToString() + "'" + + ",HParentID='" + HParentID.ToString() + "'" + + ",HEndflag='" + HEndFlag + "'" + + ",HStopflag='" + HStopflag + "'" + + ",HUseFlag='" + HUseFlag + "'" + + //",HMakeTime= getdate()" + + ",HMakeEmp='" + HMakeEmp + "'" + + ",HRemark='" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Warehouse,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_TechnologyParameter set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + } + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + //oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 宸ヨ壓鍙傛暟鍒楄〃鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_TechnologyParameter")] + [HttpGet] + public object DeltetGy_TechnologyParameter(string HItemID, string user) + { + DataSet ds; + DataSet ds1; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("DeltetGy_TechnologyParameter", 1, false, user)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_TechnologyParameter where HItemID=" + HItemID, "Gy_TechnologyParameter"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + //if (HStopflag) + //{ + // oCN.RollBack();//鍥炴粴浜嬪姟 + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + ds1 = oCN.RunProcReturn("Select HItemID from Gy_TechnologyParameter Where HParentID='" + HItemID + "'", "Gy_TechnologyParameter"); + if (ds1.Tables[0].Rows.Count != 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰锛屼笉鑳藉垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + string HUseFlag = Convert.ToString(ds.Tables[0].Rows[0]["HUseFlag"]); + if (HUseFlag == "宸蹭娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤锛屼笉鑳藉垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("delete from Gy_TechnologyParameter where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + 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; + } + } + + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs b/WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs new file mode 100644 index 0000000..84ed7ea --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs @@ -0,0 +1,417 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; +using WebAPI.Service; + +namespace WebAPI.Controllers +{ + public class Gy_TechnologyParUnitController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + /// <summary> + /// 杩斿洖宸ヨ壓鍙傛暟鍗曚綅鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameterUnit/list")] + [HttpGet] + public object list(string sWhere, string user, string Organization) + { + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameterUnit", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + string sql1 = string.Format(@"select * from h_v_Gy_TechnologyParameterUnit where 1 = 1");//where 缁勭粐鍚嶇О='" + Organization + "' + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn(sql1 + sWhere + " order by HItemID ", "h_v_Gy_TechnologyParameterUnit"); + } + else + { + string sql = sql1 + sWhere + " order by HItemID"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_TechnologyParameterUnit"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + 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; + } + } + + /// <summary> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameterUnit/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_Gy_TechnologyParameterUnitList where HitemID=" + HInterID, "h_v_Gy_TechnologyParameterUnitList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + 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; + } + } + + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameterUnit/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg3 = _value.ToString(); + string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg1 = sArray[0].ToString(); + string msg2 = sArray[1].ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_Customer_Ctl oDept = new DAL.ClsGy_Customer_Ctl(); + DAL.ClsGy_Customer_View oDeptHlp = new DAL.ClsGy_Customer_View(); + + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_Add_Edit_", 1, false, msg2)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + List<TechnologyParameterUnit> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TechnologyParameterUnit>>(msg1); + + long HItemID = list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + long HLevel = list[0].HLevel; + string HEndFlag = list[0].HEndFlag; + string HStopflag = list[0].HStopflag; + string HRemark = list[0].HRemark; + string HHelpCode = list[0].HHelpCode; + string HUseFlag = list[0].HUseFlag; + DateTime HMakeTime = list[0].HMakeTime; + string HMakeEmp = list[0].HMakeEmp; + + //DateTime HDeleteDate = list[0].HDeleteDate; + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + //褰撳墠鏃堕棿 + var currentTime = DateTime.Now.ToString(); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert into Gy_TechnologyParameterUnit " + + " (HNumber,HName,HShortNumber,HParentID,HLevel" + + ",HEndFlag,HStopflag,HRemark,HHelpCode" + + ",HUseFlag,HMakeTime,HMakeEmp) " + + " Values('" + HNumber + "','" + HName + "','" + HShortNumber + "','" + HParentID + "','" + HLevel + + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + + "','" + HHelpCode + "','" + HUseFlag + "','" + currentTime + "','" + HMakeEmp + "')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCN.RunProc("Update Gy_TechnologyParameterUnit set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameterUnit/ModifyByID")] + [HttpPost] + public object ModifyByID([FromBody] JObject oMain) + { + try + { + DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl(); + DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View(); + + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<TechnologyParameterUnit> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TechnologyParameterUnit>>(msg2); + + long HItemID = list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + long HLevel = list[0].HLevel; + string HEndFlag = list[0].HEndFlag; + string HStopflag = list[0].HStopflag; + string HRemark = list[0].HRemark; + string HHelpCode = list[0].HHelpCode; + string HUseFlag = list[0].HUseFlag; + DateTime HMakeTime = list[0].HMakeTime; + string HMakeEmp = list[0].HMakeEmp; + + ////鍒ゆ柇鏉冮檺 + //if (!ClsPub.Security_Log("Gy_TechnologyParameter_Add_Edit_", 1, false, msg3)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + //if (!DBUtility.ClsPub.AllowNumber(HNumber)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + //if (oDept.HavSameNumber(HItemID, HNumber)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "浠g爜閲嶅锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + if (HItemID == 0) + { + //褰撳墠鏃堕棿 + var currentTime = DateTime.Now.ToString(); + oCN.BeginTran(); + oCN.RunProc("Insert into Gy_TechnologyParameterUnit " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID,HLevel" + + ",HEndFlag,HStopflag,HRemark,HUseFlag,HMakeTime,HMakeEmp) " + + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HParentID.ToString() + + "','" + HLevel.ToString() + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + "','" + HUseFlag + "','" + currentTime + "','" + HMakeEmp + "')", ref DBUtility.ClsPub.sExeReturnInfo); + // Convert.ToString(HEndFlag ? 1 : 0); Convert.ToString(HStopflag ? 1 : 0);HUseFlag + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCN.RunProc("Update Gy_TechnologyParameterUnit set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + } + else + { + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_TechnologyParameterUnit set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HLevel='" + HLevel.ToString() + "'" + + ",HParentID='" + HParentID.ToString() + "'" + + ",HEndflag='" + HEndFlag + "'" + + ",HStopflag='" + HStopflag + "'" + + ",HUseFlag='" + HUseFlag + "'" + + //",HMakeTime= getdate()" + + ",HMakeEmp='" + HMakeEmp + "'" + + ",HRemark='" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Warehouse,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_TechnologyParameterUnit set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + } + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 宸ヨ壓鍙傛暟鍗曚綅鍒楄〃鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_TechnologyParameterUnit")] + [HttpGet] + public object DeltetGy_TechnologyParameterUnit(string HItemID, string user) + { + DataSet ds; + DataSet ds1; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("DeltetGy_TechnologyParameter", 1, false, user)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_TechnologyParameterUnit where HItemID=" + HItemID, "Gy_TechnologyParameterUnit"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + //if (HStopflag) + //{ + // oCN.RollBack();//鍥炴粴浜嬪姟 + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + ds1 = oCN.RunProcReturn("Select HItemID from Gy_TechnologyParameterUnit Where HParentID='" + HItemID + "'", "Gy_TechnologyParameterUnit"); + if (ds1.Tables[0].Rows.Count != 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰锛屼笉鑳藉垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + string HUseFlag = Convert.ToString(ds.Tables[0].Rows[0]["HUseFlag"]); + if (HUseFlag == "宸蹭娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤锛屼笉鑳藉垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("delete from Gy_TechnologyParameterUnit where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + 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; + } + } + + } +} \ No newline at end of file diff --git a/WebAPI/Models/TechParamByProc.cs b/WebAPI/Models/TechParamByProc.cs new file mode 100644 index 0000000..9c067ea --- /dev/null +++ b/WebAPI/Models/TechParamByProc.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class TechParamByProc + { + public long HInterID { get; set; } + public string HMaker { get; set; } + public string HChecker { get; set; } + public string HRemark { get; set; } + public string HStopflag { get; set; } + public long HMaterID { get; set; } + public int HProcID { get; set; } + public Int64 HTechParamID { get; set; } + public Int64 HTechParamUnitID { get; set; } + public string HStd { get; set; } + public Int64 HDeptID { get; set; } + public DateTime HMakeDate { get; set; } + } +} diff --git a/WebAPI/Models/TechnologyParameter.cs b/WebAPI/Models/TechnologyParameter.cs new file mode 100644 index 0000000..3afba5b --- /dev/null +++ b/WebAPI/Models/TechnologyParameter.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Web; + +namespace WebAPI.Models +{ + public class TechnologyParameter + { + public long HItemID { get; set; } + public string HNumber { get; set; } + public string HName { get; set; } + public string HShortNumber { get; set; } + public long HParentID { get; set; } + public long HLevel { get; set; } + public string HEndFlag { get; set; } + public string HStopflag { get; set; } + public string HRemark { get; set; } + public string HHelpCode { get; set; } + public string HUseFlag { get; set; } + public DateTime HMakeTime { get; set; } + public string HMakeEmp { get; set; } + + } +} diff --git a/WebAPI/Models/TechnologyParameterUnit.cs b/WebAPI/Models/TechnologyParameterUnit.cs new file mode 100644 index 0000000..1ea2225 --- /dev/null +++ b/WebAPI/Models/TechnologyParameterUnit.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class TechnologyParameterUnit + { + public long HItemID { get; set; } + public string HNumber { get; set; } + public string HName { get; set; } + public string HShortNumber { get; set; } + public long HParentID { get; set; } + public long HLevel { get; set; } + public string HEndFlag { get; set; } + public string HStopflag { get; set; } + public string HRemark { get; set; } + public string HHelpCode { get; set; } + public string HUseFlag { get; set; } + public DateTime HMakeTime { get; set; } + public string HMakeEmp { get; set; } + } +} \ No newline at end of file -- Gitblit v1.9.1