From f02c7cbe27d7da079f057b464e2b179f1dc17b08 Mon Sep 17 00:00:00 2001 From: yxj <yxj@hz-kingdee.com> Date: 星期二, 18 三月 2025 09:26:16 +0800 Subject: [PATCH] 新增提料运算(根据欠料单进行计算)调用方法 --- WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs | 687 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 634 insertions(+), 53 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs b/WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs index 4845425..7964e88 100644 --- a/WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_TechnologyController.cs @@ -33,7 +33,7 @@ { List<object> columnNameList = new List<object>(); //缂栬緫鏉冮檺 - if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter", 1, false, user)) + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -78,9 +78,62 @@ } /// <summary> - /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + /// 杩斿洖宸ヨ壓鍒楄〃 ///鍙傛暟锛歴tring sql銆� ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_TechnologyParameter/list1")] + [HttpGet] + public object list1(string sWhere, string user, string Organization) + { + try + { + List<object> columnNameList = new List<object>(); + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere); + + string HEquipNumber = dic["HEquipNumber"].ToString();//璁惧 + string HProcName = dic["HProcName"].ToString(); + string HMaterName = dic["HMaterName"].ToString(); + + ds = oCN.RunProcReturn("exec h_p_Gy_TechnologyParameterList '" + HEquipNumber + "','" + HProcName + "','" + HMaterName + "','" + 2 + "'", "h_p_Gy_TechnologyParameterList"); + + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + ///宸ヨ壓鍙傛暟 淇敼鏌ヨ /// </summary> [Route("Gy_TechnologyParameter/cx")] [HttpGet] @@ -165,18 +218,18 @@ //鍙嶅簭鍒楀寲 msg1 = "[" + msg1.ToString() + "]"; - DAL.ClsGy_Customer_Ctl oDept = new DAL.ClsGy_Customer_Ctl(); - DAL.ClsGy_Customer_View oDeptHlp = new DAL.ClsGy_Customer_View(); + DAL.ClsGy_TechnologyParameter_Ctl oDept = new DAL.ClsGy_TechnologyParameter_Ctl(); + DAL.ClsGy_TechnologyParameter_View oDeptHlp = new DAL.ClsGy_TechnologyParameter_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; - //} + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_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); @@ -213,7 +266,7 @@ ",HUseFlag,HMakeTime,HMakeEmp) " + " Values('" + HNumber + "','" + HName + "','" + HShortNumber + "','" + HParentID + "','" + HLevel + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + - "','" + HHelpCode + "','" + HUseFlag + "','" + currentTime + "','" + HMakeEmp + "')"); + "','" + HHelpCode + "','" + HUseFlag + "',getdate(),'" + HMakeEmp + "')"); //淇敼涓婄骇涓洪潪鏈骇浠g爜 oCN.RunProc("Update Gy_TechnologyParameter set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCN.Commit(); @@ -245,8 +298,6 @@ { 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(); @@ -271,16 +322,18 @@ string HUseFlag = list[0].HUseFlag; DateTime HMakeTime = list[0].HMakeTime; string HMakeEmp = list[0].HMakeEmp; + long HUSEORGID = list[0].HUSEORGID; + long HCREATEORGID = list[0].HCREATEORGID; - ////鍒ゆ柇鏉冮檺 - //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 (!ClsPub.Security_Log("Gy_TechnologyParameter_Edit", 1, false, msg3)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } if (!DBUtility.ClsPub.AllowNumber(HNumber)) { @@ -303,23 +356,98 @@ //淇濆瓨瀹屾瘯鍚庡鐞� if (HItemID == 0) { - //褰撳墠鏃堕棿 - var currentTime = DateTime.Now.ToString(); oCN.BeginTran(); + + //淇濆瓨鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_TechnologyParameter_BeforeSaveCtrl " + HMakeEmp + ",'" + 1 + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameter_BeforeSaveCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + 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); + " (HNumber,HName,HHelpCode,HShortNumber,HParentID,HLevel" + + ",HEndFlag,HStopflag,HRemark,HUseFlag,HMakeTime,HMakeEmp,HUSEORGID,HCREATEORGID) " + + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HParentID.ToString() + + "','" + HLevel.ToString() + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + "','" + HUseFlag + "',getdate(),'" + HMakeEmp + "','" + HUSEORGID + "','" + HCREATEORGID + "')", 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); + + + //淇濆瓨鍚庢帶鍒�========================================= + string sql2 = "exec h_p_Gy_TechnologyParameter_AfterSaveCtrl " + HMakeEmp + ",'" + 1 + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameter_AfterSaveCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜锛氫繚瀛樺悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + oCN.Commit(); } else { //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); + + //淇濆瓨鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_TechnologyParameter_BeforeSaveCtrl " + HMakeEmp + ",'" + 2 + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameter_BeforeSaveCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + //涓昏〃 oCN.RunProc("Update Gy_TechnologyParameter set " + " HNumber='" + HNumber + "'" + @@ -331,20 +459,43 @@ ",HEndflag='" + HEndFlag + "'" + ",HStopflag='" + HStopflag + "'" + ",HUseFlag='" + HUseFlag + "'" + - //",HMakeTime= getdate()" + - ",HMakeEmp='" + HMakeEmp + "'" + + ",HModifyTime= getdate()" + + ",HModifyEmp='" + 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); - // + + //淇濆瓨鍚庢帶鍒�========================================= + string sql2 = "exec h_p_Gy_TechnologyParameter_AfterSaveCtrl " + HMakeEmp + ",'" + 2 + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameter_AfterSaveCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜锛氫繚瀛樺悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + oCN.Commit(); } objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; - //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); objJsonResult.data = 1; return objJsonResult; } @@ -372,14 +523,14 @@ try { //鍒犻櫎鏉冮檺 - //if (!DBUtility.ClsPub.Security_Log("DeltetGy_TechnologyParameter", 1, false, user)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; - // objJsonResult.data = null; - // return objJsonResult; - //} + if (!DBUtility.ClsPub.Security_Log("Gy_TechnologyParameter_Delete", 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)) @@ -399,17 +550,7 @@ 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) { @@ -429,7 +570,60 @@ return objJsonResult; } + + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_TechnologyParameter_BeforeDelCtrl " + HItemID + ",'" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameter_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + oCN.RunProc("delete from Gy_TechnologyParameter where HItemID=" + HItemID); + + + //鍒犻櫎鍚庢帶鍒�========================================= + string sql2 = "exec h_p_Gy_TechnologyParameter_AfterDelCtrl " + HItemID + ",'" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameter_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜锛氬垹闄ゅ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + oCN.Commit();//鎻愪氦浜嬪姟 objJsonResult.code = "0"; objJsonResult.count = 1; @@ -448,5 +642,392 @@ } } + + #region 宸ヨ壓鍙傛暟 瀹℃牳銆佸弽瀹℃牳 + + [Route("Gy_TechnologyParameter/AuditGy_TechnologyParameter")] + [HttpGet] + public object AuditGy_TechnologyParameter(int HInterID, int IsAudit, string CurUserName) + { + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_Check", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from Gy_TechnologyParameter where HItemID=" + HInterID, "Gy_TechnologyParameter"); + if (ds.Tables[0].Rows.Count > 0) + { + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran(); + + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_TechnologyParameter_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameter_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + + oCN.RunProc("update Gy_TechnologyParameter set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); + + + //瀹℃牳鍚庢帶鍒�========================================= + string sql2 = "exec h_p_Gy_TechnologyParameter_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameter_AfterCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_Gy_TechnologyParameter_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameter_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + + + oCN.RunProc("update Gy_TechnologyParameter set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); + + + //鍙嶅鏍稿悗鎺у埗========================================= + string sql2 = "exec h_p_Gy_TechnologyParameter_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameter_AfterCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + } + oCN.Commit(); + + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヨ壓鍙傛暟 绂佺敤銆佸弽绂佺敤 + + [Route("Gy_TechnologyParameter/StopGy_TechnologyParameter")] + [HttpGet] + public object StopGy_TechnologyParameter(int HInterID, int IsStop, string CurUserName) + { + try + { + //绂佺敤鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameter_Close", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from Gy_TechnologyParameter where HItemID=" + HInterID, "Gy_Material"); + if (ds.Tables[0].Rows.Count > 0) + { + if (IsStop == 0) //绂佺敤鍒ゆ柇 + { + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘鍐嶆绂佺敤锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂� + { + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鐢�!涓嶉渶瑕佸弽绂佺敤!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran(); + + if (IsStop == 0) //绂佺敤鍒ゆ柇 + { + + //绂佺敤鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_TechnologyParameter_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameter_BeforeStopCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "绂佺敤澶辫触!鍘熷洜:绂佺敤鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "绂佺敤澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + + oCN.RunProc("update Gy_TechnologyParameter set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); + + + //绂佺敤鍚庢帶鍒�========================================= + string sql2 = "exec h_p_Gy_TechnologyParameter_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameter_AfterStopCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "绂佺敤澶辫触!鍘熷洜:绂佺敤鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "绂佺敤澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "绂佺敤鎴愬姛"; + objJsonResult.data = null; + } + if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂� + { + //鍙嶇鐢ㄥ墠鎺у埗========================================= + string sql1 = "exec h_p_Gy_TechnologyParameter_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameter_BeforeUnStopCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶇鐢ㄥけ璐�!鍘熷洜:鍙嶇鐢ㄥ墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶇鐢ㄥけ璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + + oCN.RunProc("update Gy_TechnologyParameter set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); + + + //鍙嶇鐢ㄥ悗鎺у埗========================================= + string sql2 = "exec h_p_Gy_TechnologyParameter_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameter_AfterUnStopCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶇鐢ㄥけ璐�!鍘熷洜:鍙嶇鐢ㄥ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶇鐢ㄥけ璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶇鐢ㄦ垚鍔�"; + objJsonResult.data = null; + } + oCN.Commit(); + + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绂佺敤澶辫触鎴栬�呭弽绂佺敤澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + } } \ No newline at end of file -- Gitblit v1.9.1