From 60c33d122fed78adebb7cb9e85ab8dff3d7aa72a Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期四, 12 六月 2025 16:26:25 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs | 423 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 407 insertions(+), 16 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs b/WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs index 1f0c602..2255185 100644 --- a/WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_TechnologyParUnitController.cs @@ -221,8 +221,8 @@ { try { - DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl(); - DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View(); + //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(); @@ -233,7 +233,6 @@ //鍙嶅簭鍒楀寲 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; @@ -247,7 +246,12 @@ string HUseFlag = list[0].HUseFlag; DateTime HMakeTime = list[0].HMakeTime; string HMakeEmp = list[0].HMakeEmp; - + string HCheckTime = list[0].HCheckTime; + string HStopTime = list[0].HStopTime; + string HCheckEmp = list[0].HCheckEmp; + string HStopEmp = list[0].HCheckTime; + long HUSEORGID = list[0].HUSEORGID; + long HCREATEORGID = list[0].HCREATEORGID; ////鍒ゆ柇鏉冮檺 //if (!ClsPub.Security_Log("Gy_TechnologyParameter_Add_Edit_", 1, false, msg3)) //{ @@ -266,27 +270,28 @@ // 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) { + oCN.BeginTran(); + var ds2 = oCN.RunProcReturn("select HItemID from Gy_TechnologyParameterUnit where HNumber = N'" + HNumber + "'", "Gy_TechnologyParameterUnit"); + if(ds2.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } //褰撳墠鏃堕棿 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) " + + ",HEndFlag,HStopflag,HRemark,HUseFlag,HMakeTime,HMakeEmp, HUSEORGID, HCREATEORGID) " + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HParentID.ToString() + - "','" + HLevel.ToString() + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + "','" + HUseFlag + "','" + currentTime + "','" + HMakeEmp + "')", ref DBUtility.ClsPub.sExeReturnInfo); + "','" + HLevel.ToString() + "','" + HEndFlag + "','" + HStopflag + "','" + HRemark + "','" + HUseFlag + "','" + currentTime + + "','" + HMakeEmp +"','" + HUSEORGID + "','" + HCREATEORGID + "')", 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); @@ -424,5 +429,391 @@ } } + #region 宸ヨ壓鍙傛暟鍗曚綅 瀹℃牳銆佸弽瀹℃牳 + + [Route("Gy_TechnologyParameterUnit/AuditGy_TechnologyParameterUnit")] + [HttpGet] + public object AuditGy_TechnologyParameterUnit(int HInterID, int IsAudit, string CurUserName) + { + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameterUnit_Check", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from Gy_TechnologyParameterUnit where HItemID=" + HInterID, "Gy_TechnologyParameterUnit"); + 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_TechnologyParameterUnit_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_TechnologyParameterUnit 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_TechnologyParameterUnit_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_TechnologyParameterUnit set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); + + + //鍙嶅鏍稿悗鎺у埗========================================= + string sql2 = "exec h_p_Gy_TechnologyParameterUnit_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_TechnologyParameterUnit/StopGy_TechnologyParameterUnit")] + [HttpGet] + public object Gy_TechnologyParameterUnit(int HInterID, int IsStop, string CurUserName) + { + try + { + //绂佺敤鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameterUnit_Stop", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from Gy_TechnologyParameterUnit 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_TechnologyParameterUnit_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterUnit_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_TechnologyParameterUnit set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); + + + //绂佺敤鍚庢帶鍒�========================================= + string sql2 = "exec h_p_Gy_TechnologyParameterUnit_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterUnit_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_TechnologyParameterUnit_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterUnit_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_TechnologyParameterUnit set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); + + + //鍙嶇鐢ㄥ悗鎺у埗========================================= + string sql2 = "exec h_p_Gy_TechnologyParameterUnit_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterUnit_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