From e64578d5a5e827675052dac38214f4c893ed0cc2 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期五, 17 五月 2024 17:15:35 +0800 Subject: [PATCH] 采购管理,销售管理,仓库管理增加日期间隔 方案 --- WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs | 181 +++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 167 insertions(+), 14 deletions(-) diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs index 78e692b..d3f3486 100644 --- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs +++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs @@ -1,4 +1,5 @@ -锘縰sing Newtonsoft.Json; +锘縰sing DBUtility; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -98,9 +99,10 @@ return objJsonResult; } DLL.ClsSb_EquipMaintainRuleBill oBill = new DLL.ClsSb_EquipMaintainRuleBill(); - if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + ds = oCN.RunProcReturn("select * from Sb_EquipMaintainRuleBillMain where HItemID=" + HInterID, "Sb_EquipMaintainRuleBillMain"); + if (ds.Tables[0].Rows.Count > 0) { - if (oBill.omodel.HBillStatus > 1) + if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -108,7 +110,7 @@ objJsonResult.data = null; return objJsonResult; } - if (oBill.omodel.HChecker != ""&& oBill.omodel.HChecker != null) + if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -167,11 +169,11 @@ } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鑾峰彇淇濆吇椤圭洰缂栬緫鏁版嵁 - string sql = "select 淇濆吇椤圭洰ID,淇濆吇椤圭洰,淇濆吇閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜哄悕绉�,瀛愬娉�2 from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; - ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleList"); + string sql = "select 淇濆吇椤圭洰ID,淇濆吇椤圭洰,淇濆吇閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜哄悕绉�,瀛愬娉�2 from h_v_Sb_EquipMaintainRuleSub_Item where 1 = 1 " + Swhere + ""; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleSub_Item"); //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 - string sql1 = "select 閰嶄欢ID,閰嶄欢浠g爜,閰嶄欢鍚嶇О,鍗曚綅ID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅鍚嶇О,鐢ㄩ噺,鏍囧噯鐢ㄩ噺,瀛愬娉�1 from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; - ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleList"); + string sql1 = "select 閰嶄欢ID,閰嶄欢浠g爜,閰嶄欢鍚嶇О,鍗曚綅ID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅鍚嶇О,鐢ㄩ噺,鏍囧噯鐢ㄩ噺,瀛愬娉�1 from h_v_Sb_EquipMaintainRuleSub where 1 = 1 " + Swhere + ""; + ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleSub"); list.Add(ds.Tables[0]); list.Add(ds1.Tables[0]); @@ -199,9 +201,9 @@ if (string.IsNullOrEmpty(HID)) return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - var dataSet = oCN.RunProcReturn("select top 1 * from Sb_EquipMaintainRuleBillMain where HInterID= " + HID + " ", "Sb_EquipMaintainRuleBillMain"); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipMaintainRuleBillList where HInterID= " + HID + " ", "h_v_Sb_EquipMaintainRuleBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) - return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁″垝琛�" }; + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄤ繚鍏昏绋嬭〃" }; return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; } #endregion @@ -227,11 +229,11 @@ } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鑾峰彇淇濆吇椤圭洰缂栬緫鏁版嵁 - string sql = "select 淇濆吇椤圭洰ID HMaintainItemID,淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰 HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜哄悕绉� HManagerName,瀛愬娉�2 HRemark from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; - ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleList"); + string sql = "select 淇濆吇椤圭洰ID HMaintainItemID,淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰 HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜哄悕绉� HManagerName,瀛愬娉�2 HRemark from h_v_Sb_EquipMaintainRuleSub_Item where 1 = 1 " + Swhere + ""; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleSub_Item"); //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 - string sql1 = "select 閰嶄欢ID HMaterID,閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,璁¢噺鍗曚綅浠g爜 HUnitNumber,璁¢噺鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,瀛愬娉�1 HRemark from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; - ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleList"); + string sql1 = "select 閰嶄欢ID HMaterID,閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,璁¢噺鍗曚綅浠g爜 HUnitNumber,璁¢噺鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,瀛愬娉�1 HRemark from h_v_Sb_EquipMaintainRuleSub where 1 = 1 " + Swhere + ""; + ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleSub"); list.Add(ds.Tables[0]); list.Add(ds1.Tables[0]); @@ -399,5 +401,156 @@ } } #endregion + + #region 璁惧淇濆吇瑙勭▼鍗曞鏍�/鍙嶅鏍稿姛鑳� + [Route("Sb_EquipMaintainRuleBill/CheckSb_EquipMaintainRuleBill")] + [HttpGet] + public object CheckSb_EquipMaintainRuleBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + 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 + + #region 璁惧淇濆吇瑙勭▼鍗曞叧闂�/鍙嶅叧闂姛鑳� + [Route("Sb_EquipMaintainRuleBill/CloseSb_EquipMaintainRuleBill")] + [HttpGet] + public object CloseSb_EquipMaintainRuleBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_Close", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (!BillOld.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + 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 } } -- Gitblit v1.9.1