From e6a1a1f0e575dd4f3ee2cb9e6ce1bc9ed9ee61b3 Mon Sep 17 00:00:00 2001 From: zzr99 <1940172413@qq.com> Date: 星期四, 25 十一月 2021 19:08:55 +0800 Subject: [PATCH] 设备Bug修复 --- WebAPI/ListModels.cs | 21 ++++ WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user | 34 +++--- WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs | 120 +++++++++++++++++++++++ WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs | 2 WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs | 106 +++++++++++++++++++++ 5 files changed, 260 insertions(+), 23 deletions(-) diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs index 0f5157b..6de8763 100644 --- a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs +++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs @@ -1,4 +1,5 @@ -锘縰sing System; +锘縰sing Newtonsoft.Json.Linq; +using System; using System.Collections.Generic; using System.Data; using System.Linq; @@ -154,7 +155,7 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { - ds = oCN.RunProcReturn("select 鐐规椤圭洰ID,鐐规椤圭洰,鐐规閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜�,瀛愬娉� from h_v_Sb_EquipDotCheckRuleList", "h_v_Sb_EquipDotCheckRuleList"); + ds = oCN.RunProcReturn("select 鐐规椤圭洰ID HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,瀛愬娉� HRemark from h_v_Sb_EquipDotCheckRuleList", "h_v_Sb_EquipDotCheckRuleList"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; @@ -162,7 +163,7 @@ } else { - string sql1 = "select 鐐规椤圭洰ID,鐐规椤圭洰,鐐规閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜�,瀛愬娉� from h_v_Sb_EquipDotCheckRuleList where 1 = 1 "; + string sql1 = "select 鐐规椤圭洰ID HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,瀛愬娉� HRemark from h_v_Sb_EquipDotCheckRuleList where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleList"); objJsonResult.code = "0"; @@ -181,5 +182,118 @@ return objJsonResult; } #endregion + + #region 璁惧鐐规瑙勭▼鍗� 淇濆瓨/缂栬緫 + /// <summary> + /// 璁惧鐐规瑙勭▼鍗� 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EquipDotCheckRuleBill/SaveEquipDotCheckRuleBill")] + [HttpPost] + public object SaveEquipDotCheckRuleBill([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSb_EquipDotCheckRuleBill oBill = new DLL.ClsSb_EquipDotCheckRuleBill(); + List<Models.ClsSb_EquipDotCheckRuleBillMain> lsmain = new List<Models.ClsSb_EquipDotCheckRuleBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EquipDotCheckRuleBillMain(msg2); + foreach (Models.ClsSb_EquipDotCheckRuleBillMain oItem in lsmain) + { + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3913"; + oItem.HBillSubType = "3913"; + DBUtility.ClsPub.CurUserName = UserName; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + + 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 + //msg2 = msg2.Replace("'", "鈥�"); + List<Models.ClsSb_EquipDotCheckRuleBillSub> ls = new List<Models.ClsSb_EquipDotCheckRuleBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipDotCheckRuleBillSub(msg3); + int i = 0; + foreach (Models.ClsSb_EquipDotCheckRuleBillSub 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; //鍏宠仈鏁伴噺 + + oBill.DetailColl_Mater.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + 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 } } diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs index 03df50f..6ef21b0 100644 --- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs +++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs @@ -310,7 +310,7 @@ return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; } #endregion - #region[璁惧淇濆吇璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + #region[璁惧淇濆吇璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] [Route("Sb_EquipMaintainPlanBill/Sb_EquipMaintainPlanBillListProjectDetai")] [HttpGet] public object Sb_EquipMaintainPlanBillListProjectDetai(string sqlWhere) diff --git a/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs b/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs index 8d0e535..d72eaef 100644 --- a/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs +++ b/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs @@ -20,6 +20,110 @@ base.MvarReportTitle = "璁惧鐐规瑙勭▼"; base.BillType = "3913"; } - + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipDotCheckRuleBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HBeginDate='" + omodel.HBeginDate + "'" + + ",HEndDate='" + omodel.HEndDate + "'" + + ",HCycleUnit='" + omodel.HCycleUnit+ "'" + + ",HCheckCycle='" + omodel.HCheckCycle + "'" + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + oCn.RunProc("Delete From Sb_EquipDotCheckRuleBillSub where HInterID=" + lngBillKey.ToString()); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Models.ClsSb_EquipDotCheckRuleBillSub oSub in DetailColl_Mater) + { + oCn.RunProc("Insert into Sb_EquipDotCheckRuleBillSub " + + " (HInterID,HEntryID," + + "HCloseMan,HEntryCloseDate,HCloseType,HRemark," + + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + + "HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim," + + "HManagerID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ",'" + oSub.HDotCheckItemID + "','" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + + "'," + oSub.HManagerID.ToString() + + ") "); + } + sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + //鏂板鍗曟嵁 + public override bool AddBill(ref string sReturn) + { + try + { + //寰楀埌mainid + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipDotCheckRuleBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HBeginDate,HEndDate,HCycleUnit,HCheckCycle,HExplanation,HInnerBillNo" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'," + + "'" + omodel.HBeginDate + "','" + omodel.HEndDate + "','" + omodel.HCycleUnit+ "','" + omodel.HCheckCycle + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Models.ClsSb_EquipDotCheckRuleBillSub oSub in DetailColl_Mater) + { + oCn.RunProc("Insert into Sb_EquipDotCheckRuleBillSub " + + " (HInterID,HEntryID," + + "HCloseMan,HEntryCloseDate,HCloseType,HRemark," + + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + + "HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim," + + "HManagerID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ",'" + oSub.HDotCheckItemID + "','" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + + "'," + oSub.HManagerID.ToString() + + ") "); + } + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + //鏄剧ず鍗曟嵁 } } \ No newline at end of file diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs index f11da88..6f75c24 100644 --- a/WebAPI/ListModels.cs +++ b/WebAPI/ListModels.cs @@ -999,7 +999,7 @@ return list; } /// <summary> - ///璁惧鐐规璁板綍琛� 涓昏〃 + ///璁惧鐐规璁板綍琛� 涓昏〃 ///ClsSb_EquipDotCheckBillMain public List<Model.ClsSb_EquipDotCheckBillMain> getObjectByJson_Sb_EquipDotCheckBillMain(string jsonString) { @@ -1007,6 +1007,25 @@ List<Model.ClsSb_EquipDotCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipDotCheckBillMain>>(jsonString); return list; } + + ///璁惧鐐规瑙勭▼琛� 涓昏〃 Models.ClsSb_EquipDotCheckRuleBillMain + ///ClsSb_EquipDotCheckBillMain + public List<Models.ClsSb_EquipDotCheckRuleBillMain> getObjectByJson_Sb_EquipDotCheckRuleBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipDotCheckRuleBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipDotCheckRuleBillMain>>(jsonString); + return list; + } + + ///璁惧鐐规瑙勭▼琛� 瀛愯〃 Models.ClsSb_EquipDotCheckRuleBillMain + ///ClsSb_EquipDotCheckBillMain + public List<Models.ClsSb_EquipDotCheckRuleBillSub> getObjectByJson_Sb_EquipDotCheckRuleBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipDotCheckRuleBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipDotCheckRuleBillSub>>(jsonString); + return list; + } + ///璁惧鐐规璁板綍琛� 瀛愯〃 ///ClsSb_EquipDotCheckBillSub public List<Model.ClsSb_EquipDotCheckBillSub> getObjectByJson_Sb_EquipDotCheckBillSub(string jsonString) diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user index 2497608..ff9e2c9 100644 --- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -18,25 +18,25 @@ <publishTime>02/22/2013 08:43:40</publishTime> </File> <File Include="bin/BLL.dll"> - <publishTime>11/24/2021 19:23:01</publishTime> + <publishTime>11/25/2021 19:03:26</publishTime> </File> <File Include="bin/BLL.pdb"> - <publishTime>11/24/2021 19:23:01</publishTime> + <publishTime>11/25/2021 19:03:26</publishTime> </File> <File Include="bin/DAL.dll"> - <publishTime>11/24/2021 19:22:59</publishTime> + <publishTime>11/25/2021 19:03:24</publishTime> </File> <File Include="bin/DAL.pdb"> - <publishTime>11/24/2021 19:22:59</publishTime> + <publishTime>11/25/2021 19:03:24</publishTime> </File> <File Include="bin/Dapper.dll"> <publishTime>07/22/2016 14:52:40</publishTime> </File> <File Include="bin/DBUtility.dll"> - <publishTime>11/24/2021 19:22:55</publishTime> + <publishTime>11/25/2021 19:03:20</publishTime> </File> <File Include="bin/DBUtility.pdb"> - <publishTime>11/24/2021 19:22:55</publishTime> + <publishTime>11/25/2021 19:03:20</publishTime> </File> <File Include="bin/Interop.gregn6Lib.dll"> <publishTime>08/25/2021 10:28:25</publishTime> @@ -60,10 +60,10 @@ <publishTime>07/25/2012 11:48:56</publishTime> </File> <File Include="bin/Model.dll"> - <publishTime>11/24/2021 19:22:55</publishTime> + <publishTime>11/25/2021 19:03:21</publishTime> </File> <File Include="bin/Model.pdb"> - <publishTime>11/24/2021 19:22:55</publishTime> + <publishTime>11/25/2021 19:03:21</publishTime> </File> <File Include="bin/Models/ClsSc_MouldScrapOutBillMain.cs"> <publishTime>08/16/2021 17:23:15</publishTime> @@ -72,22 +72,22 @@ <publishTime>08/03/2014 20:33:56</publishTime> </File> <File Include="bin/Pub_Class.dll"> - <publishTime>11/24/2021 19:22:52</publishTime> + <publishTime>11/25/2021 19:03:18</publishTime> </File> <File Include="bin/Pub_Class.pdb"> - <publishTime>11/24/2021 19:22:52</publishTime> + <publishTime>11/25/2021 19:03:18</publishTime> </File> <File Include="bin/Pub_Control.dll"> - <publishTime>11/24/2021 19:22:53</publishTime> + <publishTime>11/25/2021 19:03:19</publishTime> </File> <File Include="bin/Pub_Control.pdb"> - <publishTime>11/24/2021 19:22:53</publishTime> + <publishTime>11/25/2021 19:03:19</publishTime> </File> <File Include="bin/SQLHelper.dll"> - <publishTime>11/24/2021 19:22:54</publishTime> + <publishTime>11/25/2021 19:03:19</publishTime> </File> <File Include="bin/SQLHelper.pdb"> - <publishTime>11/24/2021 19:22:54</publishTime> + <publishTime>11/25/2021 19:03:19</publishTime> </File> <File Include="bin/stdole.dll"> <publishTime>05/09/2021 13:35:37</publishTime> @@ -189,10 +189,10 @@ <publishTime>11/24/2014 11:18:48</publishTime> </File> <File Include="bin/WebAPI.dll"> - <publishTime>11/24/2021 19:23:04</publishTime> + <publishTime>11/25/2021 19:03:29</publishTime> </File> <File Include="bin/WebAPI.pdb"> - <publishTime>11/24/2021 19:23:04</publishTime> + <publishTime>11/25/2021 19:03:29</publishTime> </File> <File Include="bin/WebGrease.dll"> <publishTime>07/17/2013 17:03:52</publishTime> @@ -363,7 +363,7 @@ <publishTime>08/06/2021 22:57:28</publishTime> </File> <File Include="Web.config"> - <publishTime>11/24/2021 19:23:17</publishTime> + <publishTime>11/25/2021 19:03:39</publishTime> </File> </ItemGroup> </Project> \ No newline at end of file -- Gitblit v1.9.1