From c67d2c1635a42e03a134110206f9ca9e2213f082 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期三, 21 二月 2024 17:24:31 +0800 Subject: [PATCH] 项目需求及问题清单 增修删查,审核反审核,关闭反关闭,需求 被下推 为 工作任务 时, 这个工作任务 点击 开始时,更新 这个 需求清单的 状态为 已开始,需求 对应的 工作任务 的 任务汇报 完成 ,反写 需求清单的 状态为 完成 --- Model/项目管理/ClsPM_CustomerTaskBillMain.cs | 26 + WebAPI/ListModels.cs | 12 DAL/DAL.csproj | 1 Model/Model.csproj | 2 WebAPI/Controllers/项目管理/工程项目/PM_ProjectBillController.cs | 562 +++++++++++++++++++++++++++++++++++ Model/项目管理/ClsPM_CustomerTaskBillSub.cs | 11 DAL/ClsPM_CustomerTaskBillMain.cs | 246 +++++++++++++++ WebAPI/Controllers/项目管理/工作任务/PM_WorkTaskBillController.cs | 69 ++- 8 files changed, 904 insertions(+), 25 deletions(-) diff --git a/DAL/ClsPM_CustomerTaskBillMain.cs b/DAL/ClsPM_CustomerTaskBillMain.cs new file mode 100644 index 0000000..860a8b7 --- /dev/null +++ b/DAL/ClsPM_CustomerTaskBillMain.cs @@ -0,0 +1,246 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsPM_CustomerTaskBillMain : DBUtility.ClsXt_BaseBill + { + public Model.ClsPM_CustomerTaskBillMain omodel = new Model.ClsPM_CustomerTaskBillMain(); + public List<Model.ClsPM_CustomerTaskBillSub> DetailColl = new List<Model.ClsPM_CustomerTaskBillSub>(); + + public ClsPM_CustomerTaskBillMain() + { + base.MvarItemKeySub = "PM_CustomerTaskBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey= "PM_CustomerTaskBillMain"; + base.MvarReportTitle="椤圭洰闇�姹傚強闂娓呭崟"; + base.BillType="4759"; + base.HBillSubType = "4759"; + + } + + #region 鍥哄畾浠g爜 + #region 鏃犲弬鏋勯�犲嚱鏁� + ~ClsPM_CustomerTaskBillMain() + { + DetailColl = null; + } + #endregion + #endregion + + //#region 淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + oCn.BeginTran(); + //鏇存柊涓昏〃 + string mainSql = "update PM_CustomerTaskBillMain set " + + " HBillNo = '" + omodel.HBillNo + + "', HRemark = '" + omodel.HRemark + + "', HProNumber = '" + omodel.HProNumber + + "', HProjectID = '" + omodel.HProjectID + + "', HProjectStageID = " + omodel.HProjectStageID + + ", HCusID = " + omodel.HCusID + + ", HName = '" + omodel.HName + + "', HTaskNote = '" + omodel.HTaskNote + + "', HType= '" + omodel.HType + + "', HSendEmp = '" + omodel.HSendEmp + + "', HReceiveEmp = '" + omodel.HReceiveEmp + + "', HCopyEmp ='" + omodel.HCopyEmp + + "', HLastDate = '" + omodel.HLastDate + + "', HOrderLevID = " + omodel.HOrderLevID + + ", HTaskStatus = '" + omodel.HTaskStatus + + "', HUpDater = '" + omodel.HUpDater + + "', HUpDateDate = getdate()" + + //=============================================================== + + " where HInterID = " + omodel.HInterID; + oCn.RunProc(mainSql); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + + + sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + //#endregion + + #region 鏂板鍗曟嵁 + public override bool AddBill(ref string sReturn) + { + try + { + DataSet ds; + + + oCn.BeginTran(); + + //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅 + while (true) + { + ds = oCn.RunProcReturn("select * from PM_CustomerTaskBillMain where HInterID = " + omodel.HInterID, "PM_CustomerTaskBillMain"); + if(ds!=null && ds.Tables[0].Rows.Count > 0) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + break; + } + } + + //鎻掑叆涓昏〃 + string mainSql = "insert into PM_CustomerTaskBillMain" + + "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" + + ",HProjectID,HProNumber,HProjectStageID,HCusID,HName,HTaskNote,HType,HSendEmp,HReceiveEmp,HCopyEmp,HLastDate,HOrderLevID,HTaskStatus) " + + "values(" + + "" + (omodel.HYear.ToString() != "0" ? omodel.HYear.ToString() : DateTime.Now.Year.ToString()) + + "," + omodel.HPeriod.ToString() + + ",'" + this.BillType + + "','" + this.HBillSubType + + "'," + omodel.HInterID + + ",'" + omodel.HDate + + "','" + omodel.HBillNo + + "','" + omodel.HRemark + + "','" + omodel.HMaker + + "','" + omodel.HMakeDate + + "','" + omodel.HProjectID + + "','" + omodel.HProNumber + + "'," + omodel.HProjectStageID + + ",'" + omodel.HCusID + + "','" + omodel.HName + + "','" + omodel.HTaskNote + + "','" + omodel.HType + + "','" + omodel.HSendEmp + + "','" + omodel.HReceiveEmp + + "','" + omodel.HCopyEmp + + "','" + omodel.HLastDate + + "','" + omodel.HOrderLevID + + "','" + omodel.HTaskStatus + + "')"; + + oCn.RunProc(mainSql); + + + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + #endregion + + #region 鏄剧ず鍗曟嵁 + //public override bool ShowBill(Int64 lngBillKey, ref string sReturn) + //{ + // try + // { + // //鏌ヨ涓昏〃 + // DataSet Ds ; + // Ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain Where HInterID = " + lngBillKey.ToString(), "PM_WorkReportWeekBillMain"); + // if(Ds.Tables[0].Rows.Count==0) + // { + // sReturn = "鍗曟嵁鏈壘鍒帮紒"; + // return false; + // } + + // //鍥哄畾璧嬪��=========================================== + // omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + // omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + // omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + // omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + // omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + // omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + // omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + // omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + // omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); + // omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); + // omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); + // omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); + // omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim(); + // omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); + // omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim(); + // omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim(); + // omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); + // omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim(); + // omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); + // omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim(); + // omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + // omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + // omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + // omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + // omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + // //======================================================== + + // omodel.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]); + // omodel.HWeek = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWeek"]); + // omodel.HBeginDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBeginDate"]); + // omodel.HEndDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEndDate"]); + // omodel.HPlanEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanEmpID"]); + + // // + + // //寰幆 + // DataSet DsSub ; + // DsSub = oCn.RunProcReturn("select * from PM_WorkTaskWeekBillSub where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "PM_WorkTaskWeekBillSub"); + // DetailColl.Clear();//娓呯┖ + // for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + // { + // Model.ClsPM_WorkTaskWeekBillSub oSub = new Model.ClsPM_WorkTaskWeekBillSub(); + // // 鍥哄畾璧嬪��=============================================== + // oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + // oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + // oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); + // oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); + // oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); + // oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); + // oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); + // oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); + // oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + // oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + // oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); + // oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); + // //=================================================== + // oSub.HWeekDay = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWeekDay"]); + // oSub.HSno = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSno"]); + // oSub.HProjectID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectID"]); + // oSub.HProjectStageID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectStageID"]); + // oSub.HTaskNote = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HTaskNote"]); + // oSub.HPlanTimes = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPlanTimes"]); + + // DetailColl.Add(oSub); + // } + // sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + // return true; + // } + // catch (Exception e) + // { + // sReturn = e.Message; + // throw (e); + // } + //} + #endregion + + } + +} diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj index 38ea8ac..63bf723 100644 --- a/DAL/DAL.csproj +++ b/DAL/DAL.csproj @@ -80,6 +80,7 @@ <Compile Include="ClsPay_EarlyLateErrBill.cs" /> <Compile Include="ClsPay_RewardPunishBill.cs" /> <Compile Include="ClsPay_WorkErrTimesBill.cs" /> + <Compile Include="ClsPM_CustomerTaskBillMain.cs" /> <Compile Include="ClsPM_WorkPlanMonthBillMain.cs" /> <Compile Include="MES\ClsSc_SourceLineRepairBill.cs" /> <Compile Include="MES\ClsSc_MESMaterToSourceBill .cs" /> diff --git a/Model/Model.csproj b/Model/Model.csproj index be6a97f..182389c 100644 --- a/Model/Model.csproj +++ b/Model/Model.csproj @@ -973,7 +973,9 @@ <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_LadingBillSub.cs" /> <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_ShippingAdviceBillMain.cs" /> <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_ShippingAdviceBillSub.cs" /> + <Compile Include="椤圭洰绠$悊\ClsPM_CustomerTaskBillMain.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkPlanMonthBillMain.cs" /> + <Compile Include="椤圭洰绠$悊\ClsPM_CustomerTaskBillSub.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkReportWeekBillSub.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkReportWeekBillMain.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkPlanMonthBillSub.cs" /> diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_CustomerTaskBillMain.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_CustomerTaskBillMain.cs" new file mode 100644 index 0000000..1dc9698 --- /dev/null +++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_CustomerTaskBillMain.cs" @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsPM_CustomerTaskBillMain: DBUtility.ClsXt_BaseBillMain + { + + public Int64 HProjectID; //int 项目内码 + public string HProNumber;// varchar(50) //项目代码 + public string HProjectStageID;// varchar(50) 项目阶段 + public Int64 HCusID;// int //客户 + public string HName;// varchar(100) //需求名称 + public string HTaskNote;//varchar(600) //需求描述(富文本) + public string HType;// varchar(30) //需求类型(标准功能、交付实施、二次开发、其他) + public string HSendEmp;// varchar(50) //客户提出人(手工输入) + public string HReceiveEmp;// varchar(20) //接收人 + public string HCopyEmp;// varchar(200) //抄送人 + public DateTime HLastDate;// datetime //要求完成日期 + public Int64 HOrderLevID;// int --订单等级 + public Int64 HHasten;// int // --催促次数 + public string HTaskStatus;// varchar(10) --需求状态(未开始,进行中,已结束) + + } +} diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_CustomerTaskBillSub.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_CustomerTaskBillSub.cs" new file mode 100644 index 0000000..fe91003 --- /dev/null +++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_CustomerTaskBillSub.cs" @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsPM_CustomerTaskBillSub : DBUtility.ClsXt_BaseBillSub + { + + } +} diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs" index f63d04c..75d10cd 100644 --- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs" +++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs" @@ -1083,7 +1083,7 @@ BillOld.MvarItemKey = "PM_WorkTaskBillMain"; oCN.BeginTran();//寮�濮嬩簨鍔� - //Type 0 寮�濮嬩换鍔� 1 鎾ら攢浠诲姟 + //Type 0 寮�濮嬩换鍔� 1 鎾ら攢浠诲姟 2缁撴潫浠诲姟 if (Type == 0) { //鍒ゆ柇鍗曟嵁鏄惁瀛樺湪 @@ -1100,8 +1100,20 @@ } if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { - string sql1= "update PM_WorkTaskBillMain set HTaskStatus='杩涜涓�' where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql1, "PM_WorkTaskBillMain"); + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HMainSourceBillType"])== "4759") + { + var lInterID = ds.Tables[0].Rows[0]["HMainSourceInterID"]; + string sql1 = "update PM_WorkTaskBillMain set HTaskStatus='宸插紑濮�' where HinterID = " + HInterID; + oCN.RunProc(sql1); + string sql2 = "update PM_CustomerTaskBillMain set HTaskStatus='宸插紑濮�' where HinterID = " + lInterID; + oCN.RunProc(sql2); + } + else + { + string sql2 = "update PM_WorkTaskBillMain set HTaskStatus='宸插紑濮�' where HinterID = " + HInterID; + oCN.RunProc(sql2); + } + } } @@ -1121,31 +1133,13 @@ } if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { + var lInterID = ds.Tables[0].Rows[0]["HMainSourceInterID"]; string sql1 = "update PM_WorkTaskBillMain set HTaskStatus='鏈紑濮�' where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql1, "PM_WorkTaskBillMain"); + oCN.RunProc(sql1); + string sql2 = "update PM_CustomerTaskBillMain set HTaskStatus='鏈紑濮�' where HinterID = " + lInterID; + oCN.RunProc(sql2); } } - else if (Type == 2) - { - //鍒ゆ柇鍗曟嵁鏄惁瀛樺湪 - DataSet ds; - string sql = "select * from PM_WorkTaskBillMain where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql, "PM_WorkTaskBillMain"); - 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) - { - string sql1 = "update PM_WorkTaskBillMain set HTaskStatus='宸茬粨鏉�' where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql1, "PM_WorkTaskBillMain"); - } - } - oCN.Commit();//鎻愪氦浜嬪姟 objJsonResult.code = "0"; @@ -1157,6 +1151,7 @@ } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); @@ -1530,6 +1525,30 @@ string HSourceBillType = oSub.HSourceBillType; bool HFinishFlag = oSub.HFinishFlag; + if (HFinishFlag==true) + { + //鍒ゆ柇鍗曟嵁鏄惁瀛樺湪 + DataSet ds; + string sqls = "select * from PM_WorkTaskBillMain where HinterID = " + HSourceInterID; + ds = oCN.RunProcReturn(sqls, "PM_WorkTaskBillMain"); + 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) + { + var lInterID = ds.Tables[0].Rows[0]["HMainSourceInterID"]; + string sql1 = "update PM_WorkTaskBillMain set HTaskStatus='宸插畬鎴�' where HinterID = " + HSourceInterID; + oCN.RunProc(sql1); + string sql2 = "update PM_CustomerTaskBillMain set HTaskStatus='宸插畬鎴�' where HinterID = " + lInterID; + oCN.RunProc(sql2); + } + } + string sql = "insert into PM_WorkTaskReportBillSub" + "(HInterID,HBillNo_bak,HEntryID,HRemark,HProjectID,HProNumber,HProjectStageID,HName,HTaskNote,HType,HRelTimes,HReportNote,HAdv,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HFinishFlag) " + "values(" + diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" index 5dd1c04..a626d3e 100644 --- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" +++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" @@ -1775,5 +1775,567 @@ } #endregion + #region 椤圭洰闇�姹傚強闂娓呭崟 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨椤圭洰闇�姹傚強闂娓呭崟 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("PM_ProjectBill/SavePM_CustomerTaskBillMain")] + [HttpPost] + public object SavePM_CustomerTaskBillMain([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string refSav = sArray[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string user = sArray[2].ToString();//鐢ㄦ埛鍚� + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + //淇濆瓨鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("PM_CustomerTaskBillMain_Add", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + DAL.ClsPM_CustomerTaskBillMain oBill = new DAL.ClsPM_CustomerTaskBillMain(); + List<Model.ClsPM_CustomerTaskBillMain> lsmain = new List<Model.ClsPM_CustomerTaskBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_PM_CustomerTaskBillMain(msg2); + foreach (Model.ClsPM_CustomerTaskBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (refSav == "Update") + { + if (BillOld1.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld1.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "4759"; + oItem.HBillSubType = "4759"; + + + + //oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (refSav == "Add") + { + + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else if (refSav == "Update") + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = false; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region 椤圭洰闇�姹傚強闂娓呭崟鍒楄〃 鏌ヨ + /// <summary> + /// 杩斿洖椤圭洰闃舵鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("PM_ProjectBill/getPM_CustomerTaskBillMainList")] + [HttpGet] + public object getPM_CustomerTaskBillMainList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("PM_CustomerTaskBillMain_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + objJsonResult.data = null; + return objJsonResult; + } + + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_PM_CustomerTaskBillMainList order by 鍗曟嵁鍙� desc", "h_v_PM_CustomerTaskBillMainList"); + } + else + { + string sql1 = "select * from h_v_PM_CustomerTaskBillMainList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_PM_CustomerTaskBillMainList"); + } + + //娣诲姞鍒楀悕 + 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 + + #region 椤圭洰闇�姹傚強闂娓呭崟鍒楄〃 鑾峰彇缂栬緫鍒楄〃鏁版嵁 + [Route("PM_ProjectBill/PM_CustomerTaskBillMainEditList")] + [HttpGet] + public object PM_CustomerTaskBillMainEditList(string HInterID, string User) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("PM_CustomerTaskBillMain_Edit", 1, false, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (HInterID == null || HInterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from h_v_PM_CustomerTaskBillMainList where HInterID =" + HInterID, "h_v_PM_CustomerTaskBillMainList"); + //娣诲姞鍒楀悕 + 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 = "鏌ヨ鎴愬姛锛�"; + 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 + + #region 椤圭洰闇�姹傚強闂娓呭崟鍒楄〃 瀹℃牳/鍙嶅鏍稿姛鑳� + [Route("PM_ProjectBill/CheckPM_CustomerTaskBillMain")] + [HttpGet] + public object CheckPM_CustomerTaskBillMain(string HInterID, int IsAudit, string user) + { + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("PM_CustomerTaskBillMain_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from PM_CustomerTaskBillMain where HInterID=" + HInterID, "PM_CustomerTaskBillMain "); + if (ds.Tables[0].Rows.Count > 0) + { + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran(); + + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + oCN.RunProc("update PM_CustomerTaskBillMain set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + oCN.RunProc("update PM_CustomerTaskBillMain 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.data = null; + return objJsonResult; + } + + } + #endregion + + #region 椤圭洰闇�姹傚強闂娓呭崟鍒楄〃 鍏抽棴/鍙嶅叧闂姛鑳� + [Route("PM_ProjectBill/ClosePM_CustomerTaskBillMain")] + [HttpGet] + public object ClosePM_CustomerTaskBillMain(string HInterID, int IsAudit, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊叧闂潈闄� + if (!DBUtility.ClsPub.Security_Log("PM_CustomerTaskBillMain_Close", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + var ds = oCN.RunProcReturn("select * from PM_CustomerTaskBillMain where HInterID=" + HInterID, "PM_CustomerTaskBillMain "); + if (ds.Tables[0].Rows.Count > 0) + { + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 + { + if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂垽鏂� + { + if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran(); + + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 + { + oCN.RunProc("update PM_CustomerTaskBillMain set HCloseMan='" + user + "',HCloseDate=getdate() where HInterID=" + HInterID); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴鎴愬姛"; + objJsonResult.data = null; + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + oCN.RunProc("update PM_CustomerTaskBillMain set HCloseMan='',HCloseDate=null where HInterID=" + HInterID); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂垚鍔�"; + objJsonResult.data = null; + } + oCN.Commit(); + + return objJsonResult; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 椤圭洰闇�姹傚強闂娓呭崟鍒楄〃 鍒犻櫎 + /// <summary> + ///鍙傛暟锛歴tring HInterID銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("PM_ProjectBill/PM_CustomerTaskBillMainDelete")] + [HttpGet] + public object PM_CustomerTaskBillMainDelete(string HInterID, string user) + { + try + { + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("PM_CustomerTaskBillMain_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (HInterID == null || HInterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran(); + + oCN.RunProc("delete from PM_CustomerTaskBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from PM_CustomerTaskBillSub where HInterID='" + HInterID + "'"); + + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 椤圭洰闇�姹傚強闂娓呭崟鍒楄〃 鍌績娆℃暟鍔熻兘 + [Route("PM_ProjectBill/UpdateHHasten")] + [HttpGet] + public object UpdateHHasten(string HInterID, int HHasten, string user) + { + try + { + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "PM_CustomerTaskBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + DataSet ds; + string sql = "select * from PM_CustomerTaskBillMain where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, "PM_CustomerTaskBillMain"); + 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) + { + string sql1 = "update PM_CustomerTaskBillMain set HHasten='" + HHasten + "' where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql1, "PM_CustomerTaskBillMain"); + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + 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 diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs index 4b4448b..210371c 100644 --- a/WebAPI/ListModels.cs +++ b/WebAPI/ListModels.cs @@ -1034,6 +1034,18 @@ } /// <summary> + /// 澶勭悊鏂板椤圭洰闇�姹傚強闂娓呭崟琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsPM_CustomerTaskBillMain> getObjectByJson_PM_CustomerTaskBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsPM_CustomerTaskBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_CustomerTaskBillMain>>(jsonString); + return list; + } + + /// <summary> /// 澶勭悊鏂板妯″叿淇濆吇璁板綍琛ㄤ富琛ㄧ殑json /// </summary> /// <param name="jsonString"></param> -- Gitblit v1.9.1