From c40a5441db28295cffc9f3a9e41544fa89c03c97 Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期二, 13 五月 2025 15:31:19 +0800 Subject: [PATCH] 工种职员列表优化 --- WebAPI/Controllers/项目管理/工作周计划/PM_WorkTaskWeekBillController.cs | 322 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 297 insertions(+), 25 deletions(-) diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" index 0fab731..12e0a01 100644 --- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" +++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" @@ -9,7 +9,7 @@ using System.Net.Http; using System.Web.Http; using WebAPI.Models; - +using SyntacticSugar.constant; namespace WebAPI.Controllers { public class PM_WorkTaskWeekBillController : ApiController @@ -402,6 +402,62 @@ } #endregion + #region 宸ヤ綔鍛ㄨ鍒� 鍒嗛〉鍒楄〃 + [Route("PM_WorkTaskWeekBill/page")] + [HttpGet] + public object PM_WorkTaskWeekBillPage(string sWhere, string user, int page, int size) + { + DataSet ds; + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user)) + //{ + // objJsonResult.code = CodeConstant.FAIL; + // objJsonResult.count = CountConstant.FAIL; + // objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCn.RunProcReturn("exec h_p_PM_WorkTaskWeekBillList " + page + "," + size + ",''", "h_p_PM_ProjectBillList"); + } + else + { + sWhere = sWhere.Replace("'", "''"); + ds = oCn.RunProcReturn("exec h_p_PM_WorkTaskWeekBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_PM_ProjectBillList"); + } + + //娣诲姞鍒楀悕 + 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 = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "Sucess锛�"; + objJsonResult.list = columnNameList; + objJsonResult.data = ds.Tables[0]; + 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 宸ヤ綔鍛ㄨ鍒� 鍒犻櫎 /// <summary> ///鍙傛暟锛歴tring HInterID銆� @@ -550,8 +606,33 @@ //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� if (IsAudit == 0) //瀹℃牳鎻愪氦 { + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_PM_WorkTaskWeekBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql1, "h_p_PM_WorkTaskWeekBill_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; + } + //================================================================================== + //瀹℃牳鎻愪氦 - if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + if (oBill.CheckBill(lngBillKey, oBill.omodel.HBillNo, "h_p_PM_WorkTaskWeekBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; @@ -570,8 +651,32 @@ } if (IsAudit == 1) //鍙嶅鏍告彁浜� { + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_PM_WorkTaskWeekBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql1, "h_p_PM_WorkTaskWeekBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + 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; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck - if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + if (oBill.AbandonCheck(lngBillKey, oBill.omodel.HBillNo, "h_p_PM_WorkTaskWeekBill_AfterUnCheckCtrl", CurUserName , ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; @@ -938,6 +1043,62 @@ } #endregion + #region 宸ヤ綔鍛ㄦ�荤粨 鍒嗛〉鍒楄〃 + [Route("PM_WorkTaskWeekBill/PM_WorkReportWeekBillpage")] + [HttpGet] + public object PM_WorkReportWeekBillPage(string sWhere, string user, int page, int size) + { + DataSet ds; + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user)) + //{ + // objJsonResult.code = CodeConstant.FAIL; + // objJsonResult.count = CountConstant.FAIL; + // objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCn.RunProcReturn("exec h_p_PM_WorkReportWeekBillMainList " + page + "," + size + ",''", "h_p_PM_ProjectBillList"); + } + else + { + sWhere = sWhere.Replace("'", "''"); + ds = oCn.RunProcReturn("exec h_p_PM_WorkReportWeekBillMainList " + page + "," + size + ",'" + sWhere + "'", "h_p_PM_ProjectBillList"); + } + + //娣诲姞鍒楀悕 + 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 = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "Sucess锛�"; + objJsonResult.list = columnNameList; + objJsonResult.data = ds.Tables[0]; + 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("PM_WorkTaskWeekBill/PM_WorkReportWeekBillMainEditList")] [HttpGet] @@ -1195,12 +1356,13 @@ #region 宸ヤ綔鍛ㄦ�荤粨 瀹℃牳/鍙嶅鏍稿姛鑳� [Route("PM_WorkTaskWeekBill/CheckPM_WorkReportWeekBillMain")] [HttpGet] - public object CheckPM_WorkReportWeekBillMain(string HInterID, int IsAudit, string user) + public object CheckPM_WorkReportWeekBillMain(int HInterID, int IsAudit, string CurUserName) { + DBUtility.ClsPub.CurUserName = CurUserName; try { //瀹℃牳鏉冮檺 - if (!DBUtility.ClsPub.Security_Log_second("PM_WorkReportWeekBillMain_Check", 1, false, user)) + if (!DBUtility.ClsPub.Security_Log_second("PM_WorkReportWeekBillMain_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -1209,12 +1371,43 @@ return objJsonResult; } - var ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain where HInterID=" + HInterID, "PM_WorkReportWeekBillMain"); - if (ds.Tables[0].Rows.Count > 0) + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsPM_WorkReportWeekBillMain oBill = new DAL.ClsPM_WorkReportWeekBillMain(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + 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 (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -1225,7 +1418,7 @@ } if (IsAudit == 1) //鍙嶅鏍稿垽鏂� { - if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -1239,38 +1432,117 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } - oCn.BeginTran(); - if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� + if (IsAudit == 0) //瀹℃牳鎻愪氦 { - oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID); + oCn.BeginTran(); - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛"; - objJsonResult.data = null; + //璁板綍杩斿洖淇℃伅 + string msg = ""; + + + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_PM_WorkReportWeekBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql1, "h_p_PM_WorkReportWeekBill_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; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_PM_WorkReportWeekBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCn.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCn.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } - if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + if (IsAudit == 1) //鍙嶅鏍告彁浜� { - oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='',HCheckDate=null where HInterID=" + HInterID); - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅鏍告垚鍔�"; - objJsonResult.data = null; + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_PM_WorkReportWeekBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql1, "h_p_PM_WorkReportWeekBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + 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; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_PM_WorkReportWeekBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + 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.Commit(); - return objJsonResult; } catch (Exception e) { oCn.RollBack(); + objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); -- Gitblit v1.9.1