From c423a61ae9ee84f71a75ac793dac083fbd590eb1 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期三, 05 六月 2024 20:48:53 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs | 306 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 306 insertions(+), 0 deletions(-) diff --git a/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs index 95b6fba..546c3bd 100644 --- a/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs +++ b/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs @@ -282,5 +282,311 @@ } } #endregion + + #region [妯″叿瀵垮懡鑰楃敤鍗曞鏍搞�佸弽瀹℃牳] + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sc_MouldLifeUseBill/AuditSc_MouldLifeUseBillList")] + [HttpGet] + public object AuditSc_MouldLifeUseBillList(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "Sc_MouldLifeUseBill_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DAL.ClsSc_MouldLifeUseBill oBill = new DAL.ClsSc_MouldLifeUseBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran();//寮�濮嬩簨鐗� + + if (IsAudit == 0) //瀹℃牳鎻愪氦 + { + + //===============================Begin 瀹℃牳鍓嶆帶鍒� Begin=============================== + string sql = "exec h_p_Sc_MouldLifeUseBill_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 瀹℃牳鍓嶆帶鍒� End================================= + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + + //===============================Begin 瀹℃牳鍚庢帶鍒� Begin=============================== + string sql2 = "exec h_p_Sc_MouldLifeUseBill_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Sc_MouldLifeUseBill_AfterCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 瀹℃牳鍚庢帶鍒� End================================= + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //===============================Begin 鍙嶅鏍稿墠鎺у埗 Begin=============================== + string sql = "exec h_p_Sc_MouldLifeUseBill_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 鍙嶅鏍稿墠鎺у埗 End================================= + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + //===============================Begin 鍙嶅鏍稿悗鎺у埗 Begin=============================== + string sql2 = "exec h_p_Sc_MouldLifeUseBill_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Sc_MouldLifeUseBill_AfterUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:鍙嶅鏍稿悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 鍙嶅鏍稿悗鎺у埗 End================================= + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + 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> + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sc_MouldLifeUseReport/GetSc_MouldLifeUseReport")] + [HttpGet] + public object GetSc_MouldLifeUseReport(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + ////鏌ョ湅鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeUseReport_Query", 1, false, user)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + //鏌ヨ + if (sWhere == null || sWhere.Equals("")) + { + string sql = "exec h_p_Sc_MouldLifeUseReport ''"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseReport"); + } + else + { + string sql = "exec h_p_Sc_MouldLifeUseReport '" + sWhere + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseReport"); + } + + //娣诲姞鍒楀悕 + 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; + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1