From 2933180780af075b8ec8b032ed5e3ce15aba0359 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期二, 27 五月 2025 14:33:44 +0800 Subject: [PATCH] 器具分类:列表数据 改为 从 h_v_Gy_MouldType取 --- WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 169 insertions(+), 5 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs b/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs index 8a8054d..ae7e411 100644 --- a/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs @@ -48,7 +48,12 @@ objJsonResult.data = null; return objJsonResult; } - ds = oCN.RunProcReturn("select HItemID,HParentID,HNumber,HName,HLevel, case when HEndFlag<>0 then 'Y'else ' 'end HEndFlag,case when HStopFlag <> 0 then 'Y'else ' 'end HStopFlag, HRemark, HUseFlag from Gy_MouldType where 1=1 " + sWhere+ " order by HNumber", "Gy_MouldType"); + //ds = oCN.RunProcReturn("select HItemID,HParentID,HNumber,HName,HLevel, case when HEndFlag<>0 then 'Y'else ' 'end HEndFlag,case when HStopFlag <> 0 then 'Y'else ' 'end HStopFlag, HRemark, HUseFlag from Gy_MouldType where 1=1 " + sWhere+ " order by HNumber", "Gy_MouldType"); + + string sql = "select * from h_v_Gy_MouldType where 1=1 " + sWhere + " order by 鍣ㄥ叿鍒嗙被浠g爜,鍣ㄥ叿鍒嗙被鍚嶇О,鎵�灞炵埗绾у垎绫诲悕绉�,鍒涘缓浜�,瀹℃牳浜�,澶囨敞,缁勭粐,绂佺敤鏍囪"; + + ds = oCN.RunProcReturn(sql, "h_v_Gy_MouldType"); + foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; @@ -150,6 +155,25 @@ objJsonResult.data = null; return objJsonResult; } + + DataSet ds_check_1 = oCN.RunProcReturn("select * from Gy_MouldType where HItemID =" + HItemID, "Gy_MouldType"); + if (ds_check_1.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛氭暟鎹笉瀛樺湪"; + objJsonResult.data = null; + return objJsonResult; + } + else if (ds_check_1.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛氬綋鍓嶆暟鎹凡瀹℃牳锛屼笉鍙垹闄�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDeptHlp.GetInfoByID(HItemID)) { if (oDept.HavChildCodes(HItemID)) @@ -243,6 +267,17 @@ bool HStopflag = list[0].HStopflag; string HUseFlag = list[0].HUseFlag; bool HEndFlag = list[0].HEndFlag; + long HUSEORGID = list[0].HUSEORGID; + + DataSet ds_check = oCN.RunProcReturn("select * from Gy_MouldType where HNumber = '" + HNumber + "' and HUSEORGID = " + HUSEORGID, "Gy_MouldType"); + if (ds_check.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏂板澶辫触锛氬綋鍓嶇粍缁囦笅浠g爜銆�" + HNumber + "銆戝凡瀛樺湪锛岃淇敼浠g爜鍚庨噸鏂颁繚瀛�"; + objJsonResult.data = null; + return objJsonResult; + } //鍒ゆ柇鏉冮檺 if (!DBUtility.ClsPub.Security_Log(msg4, 1, false, msg3)) @@ -270,9 +305,9 @@ //涓昏〃 oCN.RunProc("Insert into Gy_MouldType " + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + - ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime) " + + ",HLevel,HEndFlag,HStopflag,HRemark,HMakeEmp,HMakeTime,HUSEORGID) " + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID + - "," + HLevel+ "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo); + "," + HLevel+ "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + msg3 + "',getdate()," + HUSEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo); //淇敼涓婄骇涓洪潪鏈骇浠g爜 oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCN.Commit(); @@ -328,6 +363,35 @@ string HRemark = list[0].HRemark; bool HStopflag = list[0].HStopflag; string HUseFlag = list[0].HUseFlag; + long HUSEORGID = list[0].HUSEORGID; + + DataSet ds_check = oCN.RunProcReturn("select * from Gy_MouldType where HNumber = '" + HNumber + "' and HUSEORGID = " + HUSEORGID + " and HItemID <>" + HItemID,"Gy_MouldType"); + if (ds_check.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇敼澶辫触锛氬綋鍓嶇粍缁囦笅浠g爜銆�" + HNumber + "銆戝凡瀛樺湪锛岃淇敼浠g爜鍚庨噸鏂颁繚瀛�"; + objJsonResult.data = null; + return objJsonResult; + } + + DataSet ds_check_1 = oCN.RunProcReturn("select * from Gy_MouldType where HItemID =" + HItemID, "Gy_MouldType"); + if (ds_check_1.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇敼澶辫触锛氭暟鎹笉瀛樺湪"; + objJsonResult.data = null; + return objJsonResult; + } + else if(ds_check_1.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇敼澶辫触锛氬綋鍓嶆暟鎹凡瀹℃牳锛屼笉鍙慨鏀�"; + objJsonResult.data = null; + return objJsonResult; + } //鍒ゆ柇鏉冮檺 if (!DBUtility.ClsPub.Security_Log(msg5, 1, false, msg4)) @@ -369,7 +433,11 @@ ",HHelpCode='" + HHelpCode + "'" + ",HParentID=" + HParentID + ",HStopflag='" + HStopflag + "'" + - ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + ",HRemark= '" + HRemark + "' " + + ",HModifyEmp='" + msg4 + "' " + + ",HModifyTime=getdate() " + + ",HUSEORGID=" + HUSEORGID + " " + + " Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); //淇敼瀛愰」鐩唬鐮� //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); //灏嗕笂绾� 涓洪潪鏈骇 @@ -406,7 +474,8 @@ { try { - ds = oCN.RunProcReturn("select * from Gy_MouldType where HItemID=" + HInterID, "Gy_MouldType"); + string sql = "select a.*,b.HName HParentName from Gy_MouldType as a left join Gy_MouldType as b on a.HParentID = b.HItemID where a.HItemID=" + HInterID; + ds = oCN.RunProcReturn(sql, "Gy_MouldType"); objJsonResult.code = "1"; objJsonResult.count = 1; @@ -556,6 +625,101 @@ } #endregion + #region 鍣ㄥ叿鍒嗙被 绂佺敤銆佸弽绂佺敤 + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsStop">绂佺敤(0),鍙嶇鐢�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Gy_MouldType/StopGy_MouldType")] + [HttpGet] + public object StopGy_MouldType(int HInterID, int IsStop, string CurUserName) + { + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_MouldType_Stop", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from Gy_MouldType where HItemID=" + HInterID, "Gy_MouldType"); + 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_MouldType 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_MouldType 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 + #region 鍣ㄥ叿鍒嗙被 鏂囦欢瀵煎叆淇濆瓨 #region 鍣ㄥ叿鍒嗙被 鏂囦欢涓婁紶 [Route("Gy_MouldType/Gy_MouldType_Excel")] -- Gitblit v1.9.1