From 1d521ea0a9dbb49ed018cb0c13455ebdf5c73206 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期三, 08 一月 2025 17:48:42 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/CGGL/Cg_PayableBillController.cs | 364 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 359 insertions(+), 5 deletions(-) diff --git a/WebAPI/Controllers/CGGL/Cg_PayableBillController.cs b/WebAPI/Controllers/CGGL/Cg_PayableBillController.cs index cca61bc..eb29396 100644 --- a/WebAPI/Controllers/CGGL/Cg_PayableBillController.cs +++ b/WebAPI/Controllers/CGGL/Cg_PayableBillController.cs @@ -8,6 +8,7 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using SyntacticSugar.constant; namespace WebAPI.Controllers { @@ -23,6 +24,63 @@ private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; + + #region 搴斾粯鍗曞垎椤靛垪琛� + [Route("Cg_PayableBill/page")] + [HttpGet] + public object Cg_PayableBillPage(string sWhere, string user, int page, int size) + { + DataSet ds; + json res = new json(); + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBillList", 1, false, user)) + //{ + // objJsonResult.code = CodeConstant.FAIL; + // objJsonResult.count = CountConstant.FAIL; + // objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + sWhere = sWhere.Replace("'", "''"); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("exec h_p_Cg_PayableBillList " + page + "," + size + ",''", "h_p_Cg_PayableBillList"); + } + else + { + ds = oCN.RunProcReturn("exec h_p_Cg_PayableBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Cg_PayableBillList"); + } + + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + + res.code = CodeConstant.SUCCEED; + res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + res.Message = "Sucess锛�"; + res.list = columnNameList; + res.data = ds.Tables[0]; + return res; + } + catch (Exception e) + { + res.code = CodeConstant.FAIL; + res.count = CountConstant.FAIL; + res.Message = "Exception锛�" + e.ToString(); + res.data = null; + return res; + } + } + #endregion + #region 搴斾粯鍗曞垪琛� 鏌ヨ /// <summary> @@ -1116,7 +1174,7 @@ [HttpGet] public object AuditCg_PayableBill_Flow(int HInterID, int IsAudit, string CurUserName, string CurUserID) { - //string ModRightNameCheck = "Cg_POOrderBill_Check"; + //string ModRightNameCheck = "Cg_PayableBill_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { @@ -1221,8 +1279,8 @@ { #region 瀹℃牳鍓嶇殑鐩稿叧鍒ゆ柇 //瀹℃牳鍓嶆帶鍒�========================================= - //string sql1 = "exec h_p_Cg_POOrderBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; - //ds = oCN.RunProcReturn(sql1, "h_p_Cg_POOrderBill_BeforeCheckCtrl"); + //string sql1 = "exec h_p_Cg_PayableBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + //ds = oCN.RunProcReturn(sql1, "h_p_Cg_PayableBill_BeforeCheckCtrl"); //if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) //{ // objJsonResult.code = "0"; @@ -1327,7 +1385,7 @@ oCN.RunProc(sql04); //鏇存柊鍗曟嵁鐨勫崟鎹姸鎬� - if (oBill.CheckBill(oCN, oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POOrderBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + if (oBill.CheckBill(oCN, oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_PayableBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; @@ -1350,7 +1408,7 @@ { #region 鍙嶅鏍稿墠鐨勭浉鍏冲垽鏂� //鍙嶅鏍稿墠鎺у埗========================================= - //DataSet ds = oCN.RunProcReturn("Exec h_p_Cg_POOrderBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Cg_POOrderBill_BeforeUnCheckCtrl"); + //DataSet ds = oCN.RunProcReturn("Exec h_p_Cg_PayableBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Cg_PayableBill_BeforeUnCheckCtrl"); //if (ds == null) //{ // objJsonResult.code = "0"; @@ -1550,5 +1608,301 @@ } #endregion + #region 搴斾粯鍗曟煡璇㈠垪琛� + [Route("Cg_PayableBill/QueryList")] + [HttpGet] + public object QueryList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + + //if (!DBUtility.ClsPub.Security_Log("Cg_PayableBillQuery", 1, false, user)) + //{ + // objJsonResult.code = CodeConstant.FAIL; + // objJsonResult.count = CountConstant.FAIL; + // objJsonResult.Message = "鏃犳潈闄愭煡鐪�!"; + // objJsonResult.data = null; + // return objJsonResult; + //} + string sql = "select * from h_v_Cg_PayableBillQuery where 1 = 1 "; + + if (sWhere == "" || sWhere == null) + { + ds = oCN.RunProcReturn("select * from h_v_Cg_PayableBillQuery order by hmainid desc", "h_v_Cg_PayableBillQuery"); + } + else + { + ds = oCN.RunProcReturn(sql + sWhere + " order by hmainid desc", "h_v_Cg_PayableBillQuery"); + } + + + + 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 = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 搴斾粯鍗曟煡璇㈠瓙鍒楄〃 + [Route("Cg_PayableBill/QuerySubList")] + [HttpGet] + public object QuerySubList(string hmainid, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + + //if (!DBUtility.ClsPub.Security_Log("Cg_PayableBillQuery", 1, false, user)) + //{ + // objJsonResult.code = CodeConstant.FAIL; + // objJsonResult.count = CountConstant.FAIL; + // objJsonResult.Message = "鏃犳潈闄愭煡鐪�!"; + // objJsonResult.data = null; + // return objJsonResult; + //} + string sql = "select * from h_v_Cg_PayableBillQuerySub where hmainid = " + hmainid; + + ds = oCN.RunProcReturn(sql + " order by hsubid ASC", "h_v_Cg_PayableBillQuerySub"); + + + 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 = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 搴斾粯鍗曢渶瑕佹垜瀹℃壒娴佸鎵圭殑 + [Route("Cg_PayableBill/NeedChecklist")] + [HttpGet] + public object NeedChecklist(string user, string userid) + { + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + + //if (!DBUtility.ClsPub.Security_Log("Cg_PayableBillQuery", 1, false, user)) + //{ + // objJsonResult.code = CodeConstant.FAIL; + // objJsonResult.count = CountConstant.FAIL; + // objJsonResult.Message = "鏃犳潈闄愭煡鐪�!"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //鎼滅储闇�瑕佸鏍哥殑 + string sql = "select * from h_v_Cg_PayableBillQuery_NeedCheck where HCheckUserID = '" + userid + "' ORDER BY hmainid DESC,hsubid ASC"; + ds = oCN.RunProcReturn(sql, "h_v_Cg_PayableBillQuery_NeedCheck"); + 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 = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #region 搴斾粯鍗曞凡缁忓鎵规祦瀹℃壒鐨� + [Route("Cg_PayableBill/Checkedlist")] + [HttpGet] + public object Checkedlist(string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + + //if (!DBUtility.ClsPub.Security_Log("Cg_PayableBillQuery", 1, false, user)) + //{ + // objJsonResult.code = CodeConstant.FAIL; + // objJsonResult.count = CountConstant.FAIL; + // objJsonResult.Message = "鏃犳潈闄愭煡鐪�!"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //鎼滅储闇�瑕佸鏍哥殑 + string sql = "select TOP 1000 * from h_v_Cg_PayableBillQuery_Checked where 椤圭洰瀹℃牳浜� = '" + user + "'" + + " ORDER BY hmainid DESC,hsubid ASC"; + ds = oCN.RunProcReturn(sql, "h_v_Cg_PayableBillList_Query"); + 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 = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #region 搴斾粯鍗� 鎵归噺澶氱骇瀹℃牳 + [Route("Cg_PayableBill/CheckAllFlow")] + [HttpGet] + public object CheckAll(string HInterIDS, int IsAudit, string CurUserName, string CurUserID) + { + try + { + //澶勭悊瀛楃涓� + if (!string.IsNullOrEmpty(HInterIDS)) + { + int[] idArray = Array.ConvertAll(HInterIDS.Split(','), int.Parse); + // 澶勭悊idArray... + for (int i = 0; i < idArray.Length; i++) + { + objJsonResult = (json)AuditCg_PayableBill_Flow(idArray[i], IsAudit, CurUserName, CurUserID);//瀹℃牳鎵ц + if (objJsonResult.count == 0) + { + objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�"; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨姝g‘琛�"; + objJsonResult.data = null; + return objJsonResult; + } + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + 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("Cg_PayableBill/RejectAllCheckFlow")] + [HttpGet] + public object RejectAllCheckFlow(string HInterIDS, string CurUserID) + { + try + { + //澶勭悊瀛楃涓� + if (!string.IsNullOrEmpty(HInterIDS)) + { + int[] idArray = Array.ConvertAll(HInterIDS.Split(','), int.Parse); + // 澶勭悊idArray... + for (int i = 0; i < idArray.Length; i++) + { + objJsonResult = (json)RejectCheckFlow_POOrderBill(idArray[i].ToString(), CurUserID);//瀹℃牳鎵ц + if (objJsonResult.count == 0) + { + objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�"; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨姝g‘琛�"; + objJsonResult.data = null; + return objJsonResult; + } + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + 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