From e6e148923bae1bb2e6699e97edeb16654fdddc44 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期二, 05 九月 2023 08:30:56 +0800 Subject: [PATCH] 客诉处理单:保存、物料选择、列表问题处理 --- WebAPI/Controllers/项目管理/项目阶段/Gy_ProjectStageController.cs | 737 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 534 insertions(+), 203 deletions(-) diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs" index 4ae9117..e2a1b2b 100644 --- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs" +++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs" @@ -106,7 +106,7 @@ { oCN.BeginTran(); string sql = "Insert into Gy_ProjectStage" + - " (HNumber,HName,HShortNumber,HParentID,HLevel,HEndFlag,HStopflag,HRemark,HHelpCode,HMakeEmp,HUSEORGID,HStageNote,HRelationGoods,HIsKey,HRate) " + + " (HNumber,HName,HShortNumber,HParentID,HLevel,HEndFlag,HStopflag,HRemark,HHelpCode,HMakeEmp,HCREATEORGID,HStageNote,HRelationGoods,HIsKey,HRate) " + " Values(" + "'" + HNumber + "'" + ",'" + HName + "'" + @@ -146,8 +146,8 @@ ",HHelpCode='" + HHelpCode + "'" + ",HMakeEmp='" + HMakeEmp + "'" + ",HModifyEmp = '" + HModifyEmp + "'" + - ",HModifyTime = getDate()" + - ",HUSEORGID=" + HUSEORGID + "" + + ",HModifyTime = getDate()" + + ",HCREATEORGID=" + HUSEORGID + "" + ",HStageNote='" + HStageNote + "'" + ",HRelationGoods='" + HRelationGoods + "'" + ",HIsKey=" + Convert.ToString(HIsKey ? 1 : 0) + "" + @@ -203,13 +203,13 @@ if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from Gy_ProjectStage order by HNumber ", "Gy_ProjectStage"); + ds = oCN.RunProcReturn("select * from h_v_Gy_ProjectStage order by 闃舵缂栫爜 desc", "h_v_Gy_ProjectStage"); } else { - string sql1 = "select * from Gy_ProjectStage where 1 = 1 "; - string sql = sql1 + sWhere + " order by HNumber "; - ds = oCN.RunProcReturn(sql, "Gy_ProjectStage"); + string sql1 = "select * from h_v_Gy_ProjectStage where 1 = 1 "; + string sql = sql1 + sWhere + " order by 闃舵缂栫爜 desc"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_ProjectStage"); } //娣诲姞鍒楀悕 @@ -846,13 +846,13 @@ if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from PM_ProjectStageBillMain order by HBillNo desc ", "PM_ProjectStageBillMain"); + ds = oCN.RunProcReturn("select * from h_v_PM_ProjectStageBill order by 鍗曟嵁鍙� desc", "h_v_PM_ProjectStageBill"); } else { - string sql1 = "select * from PM_ProjectStageBillMain where 1 = 1 "; - string sql = sql1 + sWhere + " order by HBillNo desc "; - ds = oCN.RunProcReturn(sql, "PM_ProjectStageBillMain"); + string sql1 = "select * from h_v_PM_ProjectStageBill where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_PM_ProjectStageBill"); } //娣诲姞鍒楀悕 @@ -998,26 +998,67 @@ /// <returns></returns> [Route("PM_ProjectStageBill/AuditPM_ProjectStageBill")] [HttpGet] - public object AuditPM_ProjectStageBill(int HInterID, int IsAudit, string CurUserName) + public object AuditPM_ProjectStageBill(string HInterID, int Type, string user) { try { - //瀹℃牳鏉冮檺 - if (!DBUtility.ClsPub.Security_Log_second("Pm_ProjectStageBill_Check", 1, false, CurUserName)) + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Pm_ProjectStageBill_Check", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; objJsonResult.data = null; return objJsonResult; } - var ds = oCN.RunProcReturn("select * from PM_ProjectStageBillMain where HInterID=" + HInterID, "PM_ProjectStageBillMain"); - if (ds.Tables[0].Rows.Count > 0) + if (string.IsNullOrWhiteSpace(HInterID)) { - if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "PM_ProjectStageBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) { - if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -1025,14 +1066,12 @@ objJsonResult.data = null; return objJsonResult; } - } - if (IsAudit == 1) //鍙嶅鏍稿垽鏂� - { - if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } @@ -1040,43 +1079,62 @@ } else { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; - objJsonResult.data = null; - return objJsonResult; + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅鏍稿崟鎹� + if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } } - oCN.BeginTran(); + oCN.Commit();//鎻愪氦浜嬪姟 - if (IsAudit == 0) //瀹℃牳鍒ゆ柇 - { - oCN.RunProc("update PM_ProjectStageBillMain set HChecker='" + CurUserName + "',HCheckDate=getdate() where HInterID=" + HInterID); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛"; - objJsonResult.data = null; - } - if (IsAudit == 1) //鍙嶅鏍稿垽鏂� - { - oCN.RunProc("update PM_ProjectStageBillMain set HChecker='',HCheckDate=null where HInterID=" + 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.Message = "鎵ц澶辫触锛�" + e.ToString(); objJsonResult.data = null; return objJsonResult; } @@ -1120,25 +1178,50 @@ DataSet ds; string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶉渶瑕佸啀鍏抽棴!"; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!"; objJsonResult.data = null; return objJsonResult; } - } - //鍏抽棴鍗曟嵁 - if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //鍏抽棴鍗曟嵁 + if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } else @@ -1149,23 +1232,39 @@ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插弽鍏抽棴!涓嶉渶瑕佸啀鍙嶅叧闂�!"; + objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!"; objJsonResult.data = null; return objJsonResult; } - } - //鍙嶅叧闂崟鎹� - if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //鍙嶅叧闂崟鎹� + if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } @@ -1226,8 +1325,24 @@ DataSet ds; string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") { objJsonResult.code = "0"; @@ -1236,15 +1351,15 @@ objJsonResult.data = null; return objJsonResult; } - } - //浣滃簾鍗曟嵁 - if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //浣滃簾鍗曟嵁 + if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } else @@ -1255,23 +1370,31 @@ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插弽浣滃簾!涓嶉渶瑕佸啀鍙嶄綔搴�!"; + objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!"; objJsonResult.data = null; return objJsonResult; } - } - //鍙嶄綔搴熷崟鎹� - if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //鍙嶄綔搴熷崟鎹� + if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } @@ -1303,7 +1426,10 @@ public int HInterID; public string HBillNo; public string HDate; + public int HProID; public string HProNumber; + public string HMainSourceBillNo; + public string HMainSourceBillType; public int HProjectStageID; public string HProjectStageName; public string HStageNote; @@ -1416,6 +1542,9 @@ objJsonResult.data = null; return objJsonResult; } + }else if (OperationType == 4) + { + } msg2 = "[" + msg2.ToString() + "]"; @@ -1430,7 +1559,10 @@ int HInterID = mainList[0].HInterID; string HBillNo = mainList[0].HBillNo; string HDate = mainList[0].HDate; + int HProID = mainList[0].HProID; string HProNumber = mainList[0].HProNumber; + string HMainSourceBillNo = mainList[0].HMainSourceBillNo; + string HMainSourceBillType = mainList[0].HMainSourceBillType; int HProjectStageID = mainList[0].HProjectStageID; string HStageNote = mainList[0].HStageNote; string HRelationGoods = mainList[0].HRelationGoods; @@ -1447,7 +1579,7 @@ string HMakerDate = mainList[0].HMakerDate; string HUpdater = mainList[0].HUpdater; string HUpdaterDate = mainList[0].HUpdaterDate; - + if (OperationType == 2) { @@ -1534,9 +1666,48 @@ //璁板綍鏃ュ織 LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼椤圭洰闃舵姹囨姤:" + HBillNo); oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼椤圭洰闃舵姹囨姤锛�" + HBillNo + "','LMES-椤圭洰闃舵姹囨姤妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo); + }else if(OperationType == 4 && ds.Tables[0].Rows.Count == 0 ) //涓嬫帹-鏂板 + { + string sql = "insert into PM_ProjectReportBillMain" + + "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HRemark,HMaker,HMakeDate" + + ",HProNumber,HProjectStageID,HStageNote,HRelationGoods,HIsKey,HReportEmpID,HReportNote,HReportGoods,HReceiveEmp,HCopyEmp,HRate,HOrgID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType,HMainSourceBillNo) " + + "values(" + + "" + HYear + + "," + HPeriod + + ",'" + HBillType + + "','" + HBillSubType + + "'," + HInterID + + ",'" + HDate + + "','" + HBillNo + + "'," + HBillStatus + + ",'" + HRemark + + "','" + HMaker + + "','" + HMakerDate + + "','" + HProNumber + + "'," + HProjectStageID + + ",'" + HStageNote + + "','" + HRelationGoods + + "'," + HIsKey + + "," + HReportEmpID + + ",'" + HReportNote + + "','" + HReportGoods + + "','" + HReceiveEmp + + "','" + HCopyEmp + + "'," + HRate + + "," + HOrgID + + "," + HProID + + "," + HProjectStageID + + ",'" + HMainSourceBillType + + "','" + HMainSourceBillNo + + "')"; + + //涓昏〃 + oCN.RunProc(sql); + LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板椤圭洰闃舵姹囨姤:" + HBillNo); + oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板椤圭洰闃舵姹囨姤锛�" + HBillNo + "','LMES-椤圭洰闃舵姹囨姤妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub_ProjectReportBill(msg3, HInterID, HBillNo, OperationType); + objJsonResult = AddBillSub_ProjectReportBill(msg3, HInterID, HBillNo, OperationType,HProID, HProjectStageID, HMainSourceBillType, HMainSourceBillNo); if (objJsonResult.code == "0") { @@ -1564,36 +1735,73 @@ } #endregion #region 娣诲姞椤圭洰闃舵娓呭崟 瀛愯〃 - public json AddBillSub_ProjectReportBill(string msg3, long HInterID, string HBillNo, int OperationType) + public json AddBillSub_ProjectReportBill(string msg3, long HInterID, string HBillNo, int OperationType, int HSourceInterID, int HSourceEntryID, string HSourceBillType, string HSourceBillNo) { List<PM_ProjectReportBill_Sub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM_ProjectReportBill_Sub>>(msg3); int i = 0; //浣滀负瀛愯〃鍐呯爜 - foreach (PM_ProjectReportBill_Sub oSub in DetailColl) + if(OperationType == 4) { - i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷 + foreach (PM_ProjectReportBill_Sub oSub in DetailColl) + { + i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷 - int HEntryID = i; - int HEmpID = oSub.HEmpID; - int HIsPM = oSub.HIsPM?1:0; - double HRate = oSub.HRate; - double HAvgMoney = oSub.HAvgMoney; - double HCountMoney = oSub.HCountMoney; - string HRemarkSub = oSub.HRemarkSub; - string sql = "insert into PM_ProjectReportBillSub" + - "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney) " + - "values(" + - "" + HInterID + - ",'" + HBillNo + - "'," + HEntryID + - ",'" + HRemarkSub + - "'," + HEmpID + - "," + HIsPM + - "," + HRate + - "," + HAvgMoney + - "," + HCountMoney + - ")"; - oCN.RunProc(sql); + int HEntryID = i; + int HEmpID = oSub.HEmpID; + int HIsPM = oSub.HIsPM ? 1 : 0; + double HRate = oSub.HRate; + double HAvgMoney = oSub.HAvgMoney; + double HCountMoney = oSub.HCountMoney; + string HRemarkSub = oSub.HRemarkSub; + string sql = "insert into PM_ProjectReportBillSub" + + "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo) " + + "values(" + + "" + HInterID + + ",'" + HBillNo + + "'," + HEntryID + + ",'" + HRemarkSub + + "'," + HEmpID + + "," + HIsPM + + "," + HRate + + "," + HAvgMoney + + "," + HCountMoney + + "," + HSourceInterID + + "," + HSourceEntryID + + ",'" + HSourceBillType + + "','" + HSourceBillNo + + "')"; + oCN.RunProc(sql); + } } + else + { + foreach (PM_ProjectReportBill_Sub oSub in DetailColl) + { + i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷 + + int HEntryID = i; + int HEmpID = oSub.HEmpID; + int HIsPM = oSub.HIsPM ? 1 : 0; + double HRate = oSub.HRate; + double HAvgMoney = oSub.HAvgMoney; + double HCountMoney = oSub.HCountMoney; + string HRemarkSub = oSub.HRemarkSub; + string sql = "insert into PM_ProjectReportBillSub" + + "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney) " + + "values(" + + "" + HInterID + + ",'" + HBillNo + + "'," + HEntryID + + ",'" + HRemarkSub + + "'," + HEmpID + + "," + HIsPM + + "," + HRate + + "," + HAvgMoney + + "," + HCountMoney + + ")"; + oCN.RunProc(sql); + } + } + objJsonResult.code = "1"; objJsonResult.count = 1; @@ -1629,13 +1837,13 @@ if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from PM_ProjectReportBillMain order by HBillNo desc ", "PM_ProjectReportBillMain"); + ds = oCN.RunProcReturn("select * from h_v_PM_ProjectReportBillList order by 鍗曟嵁鍙� desc ", "h_v_PM_ProjectReportBillList"); } else { - string sql1 = "select * from PM_ProjectReportBillMain where 1 = 1 "; - string sql = sql1 + sWhere + " order by HBillNo desc "; - ds = oCN.RunProcReturn(sql, "PM_ProjectReportBillMain"); + string sql1 = "select * from h_v_PM_ProjectReportBillList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc "; + ds = oCN.RunProcReturn(sql, "h_v_PM_ProjectReportBillList"); } //娣诲姞鍒楀悕 @@ -1781,26 +1989,67 @@ /// <returns></returns> [Route("PM_ProjectReportBill/AuditPM_ProjectReportBill")] [HttpGet] - public object AuditPM_ProjectReportBill(int HInterID, int IsAudit, string CurUserName) + public object AuditPM_ProjectReportBill(string HInterID, int Type, string user) { try { - //瀹℃牳鏉冮檺 - if (!DBUtility.ClsPub.Security_Log_second("Pm_ProjectReportBill_Check", 1, false, CurUserName)) + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Pm_ProjectReportBill_Check", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; objJsonResult.data = null; return objJsonResult; } - var ds = oCN.RunProcReturn("select * from PM_ProjectReportBillMain where HInterID=" + HInterID, "PM_ProjectReportBillMain"); - if (ds.Tables[0].Rows.Count > 0) + if (string.IsNullOrWhiteSpace(HInterID)) { - if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "PM_ProjectReportBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) { - if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -1808,14 +2057,12 @@ objJsonResult.data = null; return objJsonResult; } - } - if (IsAudit == 1) //鍙嶅鏍稿垽鏂� - { - if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } @@ -1823,43 +2070,62 @@ } else { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; - objJsonResult.data = null; - return objJsonResult; + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅鏍稿崟鎹� + if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } } - oCN.BeginTran(); + oCN.Commit();//鎻愪氦浜嬪姟 - if (IsAudit == 0) //瀹℃牳鍒ゆ柇 - { - oCN.RunProc("update PM_ProjectReportBillMain set HChecker='" + CurUserName + "',HCheckDate=getdate() where HInterID=" + HInterID); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛"; - objJsonResult.data = null; - } - if (IsAudit == 1) //鍙嶅鏍稿垽鏂� - { - oCN.RunProc("update PM_ProjectReportBillMain set HChecker='',HCheckDate=null where HInterID=" + 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.Message = "鎵ц澶辫触锛�" + e.ToString(); objJsonResult.data = null; return objJsonResult; } @@ -1903,25 +2169,50 @@ DataSet ds; string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶉渶瑕佸啀鍏抽棴!"; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!"; objJsonResult.data = null; return objJsonResult; } - } - //鍏抽棴鍗曟嵁 - if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //鍏抽棴鍗曟嵁 + if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } else @@ -1932,23 +2223,39 @@ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插弽鍏抽棴!涓嶉渶瑕佸啀鍙嶅叧闂�!"; + objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!"; objJsonResult.data = null; return objJsonResult; } - } - //鍙嶅叧闂崟鎹� - if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //鍙嶅叧闂崟鎹� + if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } @@ -2009,8 +2316,24 @@ DataSet ds; string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") { objJsonResult.code = "0"; @@ -2019,15 +2342,15 @@ objJsonResult.data = null; return objJsonResult; } - } - //浣滃簾鍗曟嵁 - if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //浣滃簾鍗曟嵁 + if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } else @@ -2038,23 +2361,31 @@ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插弽浣滃簾!涓嶉渶瑕佸啀鍙嶄綔搴�!"; + objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!"; objJsonResult.data = null; return objJsonResult; } - } - //鍙嶄綔搴熷崟鎹� - if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //鍙嶄綔搴熷崟鎹� + if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } -- Gitblit v1.9.1