From 009d236775fc259a2a3b0567dec3a886267761de Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期二, 30 一月 2024 16:39:40 +0800 Subject: [PATCH] 月度阶段计划保存,审核反审核,关闭反关闭,下推月度阶段计划数据查询 --- WebAPI/Controllers/项目管理/工作周计划/PM_WorkTaskWeekBillController.cs | 14 WebAPI/ListModels.cs | 22 + Model/项目管理/ClsPM_WorkPlanMonthBillMain.cs | 17 + Model/项目管理/ClsPM_WorkPlanMonthBillSub.cs | 16 + DAL/DAL.csproj | 1 Model/Model.csproj | 2 WebAPI/Controllers/项目管理/工程项目/PM_ProjectBillController.cs | 412 +++++++++++++++++++++++++++++++ DAL/ClsPM_WorkPlanMonthBillMain.cs | 285 +++++++++++++++++++++ WebAPI/WebAPI.csproj | 1 9 files changed, 763 insertions(+), 7 deletions(-) diff --git a/DAL/ClsPM_WorkPlanMonthBillMain.cs b/DAL/ClsPM_WorkPlanMonthBillMain.cs new file mode 100644 index 0000000..bfdfee9 --- /dev/null +++ b/DAL/ClsPM_WorkPlanMonthBillMain.cs @@ -0,0 +1,285 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsPM_WorkPlanMonthBillMain : DBUtility.ClsXt_BaseBill + { + public Model.ClsPM_WorkPlanMonthBillMain omodel = new Model.ClsPM_WorkPlanMonthBillMain(); + public List<Model.ClsPM_WorkPlanMonthBillSub> DetailColl = new List<Model.ClsPM_WorkPlanMonthBillSub>(); + + public ClsPM_WorkPlanMonthBillMain() + { + base.MvarItemKeySub = "PM_WorkPlanMonthBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey= "PM_WorkPlanMonthBillMain"; + base.MvarReportTitle="鏈堝害闃舵璁″垝"; + base.BillType="4758"; + base.HBillSubType = "4758"; + + } + + #region 鍥哄畾浠g爜 + #region 鏃犲弬鏋勯�犲嚱鏁� + ~ClsPM_WorkPlanMonthBillMain() + { + DetailColl = null; + } + #endregion + #endregion + + //#region 淇敼鍗曟嵁 + //public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + //{ + // try + // { + // oCn.BeginTran(); + // //鏇存柊涓昏〃 + // string mainSql = "update PM_WorkPlanMonthBillMain set " + + // " HBillNo = '" + omodel.HBillNo + + // "', HDate = '" + omodel.HDate + + // "', HYear = " + omodel.HYear + + // ", HPeriod = " + omodel.HPeriod + + // ", HRemark = '" + omodel.HRemark + + // "', HUpDater = '" + omodel.HUpDater + + // "', HUpDateDate = getdate()" + + // //=============================================================== + // ", HOrgID = " + omodel.HOrgID + + // ", HYear = " + omodel.HYear + + // ", HWeek = " + omodel.HWeek + + // ", HBeginDate = '" + omodel.HBeginDate + + // "', HEndDate = '" + omodel.HEndDate + + // "', HPlanEmpID = " + omodel.HReportEmpID + + // " where HInterID = " + omodel.HInterID; + + // //鍒犻櫎鍏宠仈 + // DeleteRelation(ref sReturn, lngBillKey); + // //鍒犻櫎瀛愯〃 + // DeleteBillSub(lngBillKey); + + // ////鎻掑叆瀛愯〃 + // //omodel.HInterID = lngBillKey; + // //foreach (Model.ClsPM_WorkTaskWeekBillSub oSub in DetailColl) + // //{ + // // string subSql = "insert into PM_WorkTaskWeekBillSub" + + // // "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // // ",HWeekDay,HSno,HProjectID,HProjectStageID,HTaskNote,HPlanTimes) " + + // // " values(" + + // // "" + omodel.HInterID.ToString() + + // // "," + oSub.HEntryID.ToString() + + // // ",'" + oSub.HCloseMan + + // // "','" + oSub.HEntryCloseDate + + // // "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + + // // ",'" + oSub.HRemark + + // // "'," + oSub.HSourceInterID + + // // "," + oSub.HSourceEntryID + + // // ",'" + oSub.HSourceBillNo + + // // "','" + oSub.HSourceBillType + + // // "'," + oSub.HRelationQty + + // // "," + oSub.HRelationMoney + + // // "," + oSub.HWeekDay + + // // "," + oSub.HSno + + // // "," + oSub.HProjectID + + // // "," + oSub.HProjectStageID + + // // ",'" + oSub.HTaskNote + + // // "'," + oSub.HPlanTimes + + // // ")"; + // // oCn.RunProc(subSql); + // //} + + // 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_WorkPlanMonthBillMain where HInterID = " + omodel.HInterID, "PM_WorkPlanMonthBillMain"); + 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_WorkPlanMonthBillMain" + + "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" + + ",HOrgID,HMonth,HBeginDate,HEndDate,HPlanEmpID) " + + "values(" + + "" + omodel.HYear.ToString() + + "," + omodel.HPeriod.ToString() + + ",'" + this.BillType + + "','" + this.HBillSubType + + "'," + omodel.HInterID + + ",'" + omodel.HDate + + "','" + omodel.HBillNo + + "','" + omodel.HRemark + + "','" + omodel.HMaker + + "','" + omodel.HMakeDate + + "'," + omodel.HOrgID + + "," + omodel.HMonth + + ",'" + omodel.HBeginDate + + "','" + omodel.HEndDate + + "','" + omodel.HPlanEmpID + + "')"; + + oCn.RunProc(mainSql); + + //鎻掑叆瀛愯〃 + foreach (Model.ClsPM_WorkPlanMonthBillSub oSub in DetailColl) + { + string subSql = "insert into PM_WorkPlanMonthBillSub" + + "" + + "" + + "" + + "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ",HProNumber,HProjectStageID,HRate,HAvgMoney,HCountMoney) " + + " values(" + + "" + omodel.HInterID.ToString() + + "," + oSub.HEntryID.ToString() + + "," + oSub.HSourceInterID + + "," + oSub.HSourceEntryID + + ",'" + oSub.HSourceBillNo + + "','" + oSub.HSourceBillType + + "','" + oSub.HProNumber + + "'," + oSub.HProjectStageID + + "," + oSub.HRate + + ",'" + oSub.HAvgMoney+ + "','" + oSub.HCountMoney + + "')"; + oCn.RunProc(subSql); + } + 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 be05d63..1e5e5ad 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_WorkPlanMonthBillMain.cs" /> <Compile Include="MES\ClsSc_SourceLineRepairBill.cs" /> <Compile Include="MES\ClsSc_MESMaterToSourceBill .cs" /> <Compile Include="浜轰簨绠$悊\ClsHR_EmpFosterBill.cs" /> diff --git a/Model/Model.csproj b/Model/Model.csproj index ab02a04..97c080f 100644 --- a/Model/Model.csproj +++ b/Model/Model.csproj @@ -968,8 +968,10 @@ <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_LadingBillSub.cs" /> <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_ShippingAdviceBillMain.cs" /> <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_ShippingAdviceBillSub.cs" /> + <Compile Include="椤圭洰绠$悊\ClsPM_WorkPlanMonthBillMain.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkReportWeekBillSub.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkReportWeekBillMain.cs" /> + <Compile Include="椤圭洰绠$悊\ClsPM_WorkPlanMonthBillSub.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkTaskWeekBillSub.cs" /> <Compile Include="椤圭洰绠$悊\ClsPM_WorkTaskWeekBillMain.cs" /> <Compile Include="椤圭洰绠$悊\ClsPro_DesignBlueRequestBillMain.cs" /> diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_WorkPlanMonthBillMain.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_WorkPlanMonthBillMain.cs" new file mode 100644 index 0000000..2fb78b5 --- /dev/null +++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_WorkPlanMonthBillMain.cs" @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsPM_WorkPlanMonthBillMain : DBUtility.ClsXt_BaseBillMain + { + public Int64 HOrgID; //int 组织 + //public Int64 HYear; //int 年份 + public Int64 HMonth; //int 月 + public string HBeginDate; //datetime 开始日期 + public string HEndDate; //datetime 结束日期 + public Int64 HPlanEmpID; //int 计划人 + + } +} diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_WorkPlanMonthBillSub.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_WorkPlanMonthBillSub.cs" new file mode 100644 index 0000000..df3951b --- /dev/null +++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_WorkPlanMonthBillSub.cs" @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsPM_WorkPlanMonthBillSub : DBUtility.ClsXt_BaseBillSub + { + public Int64 HProjectID; + public string HProNumber; + public Int64 HProjectStageID; + public decimal HRate; + public decimal HAvgMoney; + public decimal HCountMoney; + } +} diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" index 50485a6..52ce606 100644 --- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" +++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\345\221\250\350\256\241\345\210\222/PM_WorkTaskWeekBillController.cs" @@ -1096,7 +1096,7 @@ #region 宸ヤ綔鍛ㄦ�荤粨 瀹℃牳/鍙嶅鏍稿姛鑳� [Route("PM_WorkTaskWeekBill/CheckPM_WorkReportWeekBillMain")] [HttpGet] - public object CheckSc_ICMOReportBill(string HInterID, int IsAudit, string user) + public object CheckPM_WorkReportWeekBillMain(string HInterID, int IsAudit, string user) { try { @@ -1189,7 +1189,7 @@ { try { - //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + //鍒ゆ柇鏄惁鏈夊叧闂潈闄� if (!DBUtility.ClsPub.Security_Log("PM_WorkReportWeekBillMain_Close", 1, false, user)) { objJsonResult.code = "0"; @@ -1237,22 +1237,22 @@ oCn.BeginTran(); - if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 { - oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID); + oCn.RunProc("update PM_WorkReportWeekBillMain set HCloseMan='" + user + "',HCloseDate=getdate() where HInterID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.Message = "鍏抽棴鎴愬姛"; objJsonResult.data = null; } if (IsAudit == 1) //鍙嶅鏍稿垽鏂� { - oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='',HCheckDate=null where HInterID=" + HInterID); + oCn.RunProc("update PM_WorkReportWeekBillMain set HCloseMan='',HCloseDate=null where HInterID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.Message = "鍙嶅叧闂垚鍔�"; objJsonResult.data = null; } oCn.Commit(); 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 1510586..ce57fc1 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" @@ -22,6 +22,8 @@ public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); string user_LongShan = ""; string HName_LongShan = ""; + public DAL.ClsPM_WorkPlanMonthBillMain BillNew1 = new DAL.ClsPM_WorkPlanMonthBillMain(); //宸ヤ綔鍛ㄦ�荤粨瀵瑰簲鍗曟嵁绫� + public DAL.ClsPM_WorkPlanMonthBillMain BillOld1 = new DAL.ClsPM_WorkPlanMonthBillMain(); #region 宸ョ▼椤圭洰 鏂板/缂栬緫 #region 宸ョ▼椤圭洰 琛ㄥご鏁版嵁 @@ -1198,5 +1200,415 @@ } } #endregion + + #region 鏈堝害闃舵璁″垝淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨鏈堝害闃舵璁″垝 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("PM_ProjectBill/SavePM_WorkPlanMonthBillMain")] + [HttpPost] + public object SavePM_WorkPlanMonthBillMain([FromBody] JObject msg) + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); //瀛愯〃 + string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string user = sArray[3].ToString();//鐢ㄦ埛鍚� + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + //淇濆瓨鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("PM_WorkPlanMonthBillMain_Add", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + DAL.ClsPM_WorkPlanMonthBillMain oBill = new DAL.ClsPM_WorkPlanMonthBillMain(); + List<Model.ClsPM_WorkPlanMonthBillMain> lsmain = new List<Model.ClsPM_WorkPlanMonthBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_PM_WorkPlanMonthBillMain(msg2); + foreach (Model.ClsPM_WorkPlanMonthBillMain 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 = "4758"; + oItem.HBillSubType = "4758"; + + //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; + } + // 琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + List<Model.ClsPM_WorkPlanMonthBillSub> ls = new List<Model.ClsPM_WorkPlanMonthBillSub>(); + ls = oListModels.getObjectByJson_PM_WorkPlanMonthBillSub(msg3); + int i = 0; + foreach (Model.ClsPM_WorkPlanMonthBillSub oItemSub in ls) + { + i++; + oItemSub.HEntryID = i; + + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + + //oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + //oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + 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 鏈堝害闃舵璁″垝 瀹℃牳/鍙嶅鏍稿姛鑳� + [Route("PM_ProjectBill/CheckPM_WorkPlanMonthBillMain")] + [HttpGet] + public object CheckPM_WorkPlanMonthBillMain(string HInterID, int IsAudit, string user) + { + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("PM_WorkPlanMonthBillMain_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + var ds = oCN.RunProcReturn("select * from PM_WorkPlanMonthBillMain where HInterID=" + HInterID, "PM_WorkPlanMonthBillMain"); + 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_WorkPlanMonthBillMain 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_WorkPlanMonthBillMain 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_WorkPlanMonthBillMain")] + [HttpGet] + public object ClosePM_WorkPlanMonthBillMain(string HInterID, int IsAudit, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊叧闂潈闄� + if (!DBUtility.ClsPub.Security_Log("PM_WorkPlanMonthBillMain_Close", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + var ds = oCN.RunProcReturn("select * from PM_WorkPlanMonthBillMain where HInterID=" + HInterID, "PM_WorkPlanMonthBillMain"); + 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_WorkPlanMonthBillMain 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_WorkPlanMonthBillMain 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 sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("PM_ProjectBill/getPM_WorkPlanMonthBillMainList")] + [HttpGet] + public object getPM_WorkPlanMonthBillMainList(string HInterID,string HEntryID, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("PM_WorkPlanMonthBillMain_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鏍规嵁鎴戠殑椤圭洰涓� 涓诲瓙id 涓嬫帹鏉ヨ繘琛屾煡璇㈡暟鎹�,鐒跺悗鍥炴樉鍒伴〉闈� + string sql= @"select a.HInterID HSourceInterID ,b.HEntryID HSourceEntryID,a.HBillNo HSourceBillNo,a.HBillType HSourceBillType, a.HProNumber ,a.HProName 椤圭洰鍚嶇О ,c.HItemID HProjectStageID,c.HName 椤圭洰闃舵 , b.HStageNote 椤圭洰闃舵璇︾粏鍐呭, b.HPMGoodsID 鐩稿叧浜や粯鐗�, b.HIsKey 鏄惁閲岀▼纰�,b.HRate + from PM_ProjectBillMain a inner join PM_ProjectBillSub b on a.HInterID = b.HInterID left join gy_ProjectStage c on c.HItemID = b.HProjectStageID + where a.HInterID = '" + HInterID + "' and b.HEntryID = '"+ HEntryID + "'"; + ds = oCN.RunProcReturn(sql, "PM_ProjectBillMain"); + //娣诲姞鍒楀悕 + 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 + } } \ No newline at end of file diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs index b39b6f6..9a58cce 100644 --- a/WebAPI/ListModels.cs +++ b/WebAPI/ListModels.cs @@ -980,6 +980,28 @@ List<Model.ClsPM_WorkReportWeekBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_WorkReportWeekBillMain>>(jsonString); return list; } + /// <summary> + /// 澶勭悊鏂板鏈堝害闃舵璁″垝琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsPM_WorkPlanMonthBillMain> getObjectByJson_PM_WorkPlanMonthBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsPM_WorkPlanMonthBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_WorkPlanMonthBillMain>>(jsonString); + return list; + } + /// <summary> + /// 澶勭悊鏂板鏈堝害闃舵璁″垝瀛愯〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsPM_WorkPlanMonthBillSub> getObjectByJson_PM_WorkPlanMonthBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsPM_WorkPlanMonthBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_WorkPlanMonthBillSub>>(jsonString); + return list; + } /// <summary> /// 澶勭悊鏂板妯″叿淇濆吇璁板綍琛ㄤ富琛ㄧ殑json diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index 4d6539a..49f2e7e 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -617,6 +617,7 @@ <Compile Include="Controllers\椤圭洰绠$悊\宸ョ▼椤圭洰\PM_ProjectBillController.cs" /> <Compile Include="Controllers\椤圭洰绠$悊\鎶ヨ〃鍒嗘瀽\PM_ReportController.cs" /> <Compile Include="Controllers\椤圭洰绠$悊\椤圭洰闃舵\Gy_ProjectStageController.cs" /> + <Compile Include="DAL\PM_WorkPlanMonthBillMain.cs" /> <Compile Include="Dapper\SqlHelper.cs" /> <Compile Include="Dapper\SqlPools.cs" /> <Compile Include="DbUntil\DataFormatUntil.cs" /> -- Gitblit v1.9.1