From b62e0517155d184a5d14b6113490b7140d45a738 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期二, 27 六月 2023 14:24:56 +0800 Subject: [PATCH] 基础资料(工序、生产资源、生产班组、不良原因、故障原因):添加审核、反审核、禁用、反禁用按钮 --- WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs | 190 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 190 insertions(+), 0 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs index b8e1e66..3f4c02e 100644 --- a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs @@ -91,5 +91,195 @@ // + + #region 涓嶈壇鍘熷洜瀹℃牳銆佸弽瀹℃牳 + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Gy_BadReason/AuditGy_BadReason")] + [HttpGet] + public object AuditGy_BadReason(int HInterID, int IsAudit, string CurUserName) + { + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Check", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason"); + 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) //瀹℃牳鍒ゆ柇 + { + oCN.RunProc("update Gy_BadReason set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + oCN.RunProc("update Gy_BadReason set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); + + 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 涓嶈壇鍘熷洜绂佺敤銆佸弽绂佺敤 + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsStop">绂佺敤(0),鍙嶇鐢�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Gy_BadReason/StopGy_BadReason")] + [HttpGet] + public object StopGy_BadReason(int HInterID, int IsStop, string CurUserName) + { + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Stop", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason"); + 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) //绂佺敤鍒ゆ柇 + { + oCN.RunProc("update Gy_BadReason set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "绂佺敤鎴愬姛"; + objJsonResult.data = null; + } + if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂� + { + oCN.RunProc("update Gy_BadReason set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); + + 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