From 2a52411bca70c10b4a8fe08ce44c2b47ef8ecbf7 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期四, 09 五月 2024 09:51:17 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/项目管理/项目阶段/Gy_ProjectStageController.cs | 642 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 478 insertions(+), 164 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 ed36cb5..9bf78e5 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"); } //娣诲姞鍒楀悕 @@ -1032,25 +1032,49 @@ 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]["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.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; objJsonResult.data = null; return objJsonResult; } - } - //瀹℃牳鍗曟嵁 - if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } else @@ -1061,23 +1085,39 @@ 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.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; + //鍙嶅鏍稿崟鎹� + if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } @@ -1138,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 @@ -1167,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; + } } } @@ -1244,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"; @@ -1254,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 @@ -1273,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; + } } } @@ -1321,6 +1426,7 @@ public int HInterID; public string HBillNo; public string HDate; + public int HProjectID; public string HProNumber; public int HProjectStageID; public string HProjectStageName; @@ -1337,6 +1443,12 @@ public int HOrgID; public string HRemark; public string HMaker; + + public int HMainSourceInterID; + public int HMainSourceEntryID; + public string HMainSourceBillNo; + public string HMainSourceBillType; + public string HUpdater; public string HChecker; public string HMakerDate; @@ -1434,6 +1546,9 @@ objJsonResult.data = null; return objJsonResult; } + }else if (OperationType == 4) + { + } msg2 = "[" + msg2.ToString() + "]"; @@ -1448,6 +1563,7 @@ int HInterID = mainList[0].HInterID; string HBillNo = mainList[0].HBillNo; string HDate = mainList[0].HDate; + int HProjectID = mainList[0].HProjectID; string HProNumber = mainList[0].HProNumber; int HProjectStageID = mainList[0].HProjectStageID; string HStageNote = mainList[0].HStageNote; @@ -1461,11 +1577,17 @@ double HRate = mainList[0].HRate; int HOrgID = mainList[0].HOrgID; string HRemark = mainList[0].HRemark; + + int HMainSourceInterID = mainList[0].HMainSourceInterID; + int HMainSourceEntryID = mainList[0].HMainSourceEntryID; + string HMainSourceBillNo = mainList[0].HMainSourceBillNo; + string HMainSourceBillType = mainList[0].HMainSourceBillType; + string HMaker = mainList[0].HMaker; string HMakerDate = mainList[0].HMakerDate; string HUpdater = mainList[0].HUpdater; string HUpdaterDate = mainList[0].HUpdaterDate; - + if (OperationType == 2) { @@ -1486,7 +1608,7 @@ { 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) " + + ",HProjectID,HProNumber,HProjectStageID,HStageNote,HRelationGoods,HIsKey,HReportEmpID,HReportNote,HReportGoods,HReceiveEmp,HCopyEmp,HRate,HOrgID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType) " + "values(" + "" + HYear + "," + HPeriod + @@ -1499,7 +1621,8 @@ ",'" + HRemark + "','" + HMaker + "','" + HMakerDate + - "','" + HProNumber + + "'," + HProjectID + + ",'" + HProNumber + "'," + HProjectStageID + ",'" + HStageNote + "','" + HRelationGoods + @@ -1511,7 +1634,11 @@ "','" + HCopyEmp + "'," + HRate + "," + HOrgID + - ")"; + "," + HMainSourceInterID + + "," + HMainSourceEntryID + + ",'" + HMainSourceBillNo + + "','" + HMainSourceBillType + + "')"; //涓昏〃 oCN.RunProc(sql); @@ -1531,7 +1658,8 @@ ",HRemark = '" + HRemark + "',HUpdater = '" + HUpdater + "',HUpdateDate = '" + HUpdaterDate + - "',HProNumber = '" + HProNumber + + "',HProjectID = " + HProjectID + + ",HProNumber = '" + HProNumber + "',HProjectStageID = " + HProjectStageID + ",HStageNote = '" + HStageNote + "',HRelationGoods = '" + HRelationGoods + @@ -1543,7 +1671,11 @@ "',HCopyEmp = '" + HCopyEmp + "',HRate = " + HRate + ",HOrgID = " + HOrgID + - " where HInterID = " + HInterID; + ",HMainSourceInterID = " + HMainSourceInterID + + ",HMainSourceEntryID = " + HMainSourceEntryID + + ",HMainSourceBillNo = '" + HMainSourceBillNo + + "',HMainSourceBillType = '" + HMainSourceBillType + + "' where HInterID = " + HInterID; oCN.RunProc(sql); @@ -1552,9 +1684,49 @@ //璁板綍鏃ュ織 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" + + ",HProjectID,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 + + "'," + HProjectID + + ",'" + HProNumber + + "'," + HProjectStageID + + ",'" + HStageNote + + "','" + HRelationGoods + + "'," + HIsKey + + "," + HReportEmpID + + ",'" + HReportNote + + "','" + HReportGoods + + "','" + HReceiveEmp + + "','" + HCopyEmp + + "'," + HRate + + "," + HOrgID + + "," + HMainSourceInterID + + "," + HMainSourceEntryID + + ",'" + 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,HMainSourceInterID, HMainSourceEntryID, HMainSourceBillType, HMainSourceBillNo); if (objJsonResult.code == "0") { @@ -1582,36 +1754,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; @@ -1647,13 +1856,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"); } //娣诲姞鍒楀悕 @@ -1833,25 +2042,49 @@ 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]["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.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; objJsonResult.data = null; return objJsonResult; } - } - //瀹℃牳鍗曟嵁 - if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } else @@ -1862,23 +2095,39 @@ 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.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; + //鍙嶅鏍稿崟鎹� + if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } } @@ -1939,25 +2188,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 @@ -1968,23 +2242,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; + } } } @@ -2045,8 +2335,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"; @@ -2055,15 +2361,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 @@ -2074,23 +2380,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