From 89873b7d156f21e7aa71b3f004a11ced2e7a7d4e Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期五, 29 十一月 2024 09:28:55 +0800 Subject: [PATCH] 日计划导入限制 --- WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs | 463 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 391 insertions(+), 72 deletions(-) diff --git a/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs b/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs index 29bec74..27001aa 100644 --- a/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs +++ b/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs @@ -1,6 +1,7 @@ 锘縰sing System; using System.Collections.Generic; using System.Data; +using Pub_Class; using System.Linq; using System.Web; using System.Web.Http; @@ -12,42 +13,53 @@ { public DBUtility.ClsPub.Enum_BillStatus BillStatus; - + public DAL.ClsKf_POStockInBackBill BillOld = new DAL.ClsKf_POStockInBackBill(); private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; #region 閲囪喘閫�鏂欏崟 鏌ヨ鍒楄〃 [Route("Cg_PurchaseReturn/list")] [HttpGet] - public object list(string sWhere) + public object list(string sWhere,string user) { try { - if (sWhere == null || sWhere.Equals("")) - { - ds = oCN.RunProcReturn("select * from h_v_Kf_PurchaseReturnList " + sWhere, "h_v_Kf_PurchaseReturnList"); - } - else - { - string sql = "select * from h_v_Kf_PurchaseReturnList where 1 = 1 " + sWhere; - ds = oCN.RunProcReturn(sql, "h_v_Kf_PurchaseReturnList"); - } - if (ds == null || ds.Tables[0].Rows.Count == 0) + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + if (!DBUtility.ClsPub.Security_Log("Cg_PurchaseReturnBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objJsonResult.Message = "鏃犳潈闄愭煡璇�!"; objJsonResult.data = null; return objJsonResult; } + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Kf_PurchaseReturnList order by hmainid desc", "h_v_Kf_PurchaseReturnList"); + } else { - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "Sucess锛�"; - objJsonResult.data = ds.Tables[0]; - return objJsonResult; + string sql = "select * from h_v_Kf_PurchaseReturnList where 1 = 1 " + sWhere+ " order by hmainid desc"; + ds = oCN.RunProcReturn(sql, "h_v_Kf_PurchaseReturnList"); } + + //if (ds.Tables[0].Rows.Count != 0 || ds != null) + //{ + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + //} + //else + //{ + //objJsonResult.code = "0"; + //objJsonResult.count = 0; + //objJsonResult.Message = "鏃犳暟鎹�"; + //objJsonResult.data = null; + //return objJsonResult; + //} } catch (Exception e) { @@ -64,79 +76,386 @@ [HttpGet] public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName) { - //flag=1 瀹℃牳锛� flag=2 鍙嶅鏍� - //缂栬緫鏉冮檺 - //if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldProdMoveBill_Check", 1, true, CurUserName)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "鏃犲鏍告潈闄愶紒"; - // objJsonResult.data = null; - // return objJsonResult; - //} - - Int64 lngBillKey = 0; - lngBillKey = DBUtility.ClsPub.isLong(HInterID); - if (lngBillKey == 0) + + try { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�"; - objJsonResult.data = null; - return objJsonResult; - } - DLL.ClsKf_SellOutBackBill oBill = new DLL.ClsKf_SellOutBackBill(); - if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) - { - if (IsAudit == 1) + //flag=1 瀹℃牳锛� flag=2 鍙嶅鏍� + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Cg_PurchaseReturnBill_Check", 1, false, CurUserName)) { - if (oBill.omodel.HBillStatus == 2) + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲鏍告潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + if (lngBillKey == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + DLL.ClsKf_SellOutBackBill oBill = new DLL.ClsKf_SellOutBackBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HCloseMan != "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "褰撳墠鍗曟嵁宸插鏍革紝鏃犻渶鍐嶆瀹℃牳"; + objJsonResult.Message = "褰撳墠鍗曟嵁宸插叧闂�,涓嶈兘瀹℃牳"; objJsonResult.data = null; return objJsonResult; } + + if (oBill.omodel.HDeleteMan != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠鍗曟嵁宸蹭綔搴�,涓嶈兘瀹℃牳"; + objJsonResult.data = null; + return objJsonResult; + } + + if (IsAudit == 1) + { + if (oBill.omodel.HBillStatus == 2) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠鍗曟嵁宸插鏍革紝鏃犻渶鍐嶆瀹℃牳"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + string HCheckDate = DateTime.Now.Date.ToString(); + oCN.RunProc(" Update Kf_ICStockBillMain set HChecker='" + CurUserName + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='1239' and HInterID=" + HInterID); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } else { - string HCheckDate = DateTime.Now.Date.ToString(); - oCN.RunProc(" Update Kf_ICStockBillMain set HChecker='" + CurUserName + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='1239' and HInterID=" + HInterID); - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; - objJsonResult.data = 1; - return objJsonResult; + if (oBill.omodel.HBillStatus == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠鍗曟嵁鏈鏍革紝鏃犻渶鍙嶅鏍�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + string HCheckDate = DateTime.Now.Date.ToString(); + oCN.RunProc(" Update Kf_ICStockBillMain set HChecker=' ',HCheckDate=null,HBillStatus=1 Where HBillType='1239' and HInterID=" + HInterID); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔燂紒"; + objJsonResult.data = 1; + return objJsonResult; + } } } else { - if (oBill.omodel.HBillStatus == 1) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "褰撳墠鍗曟嵁鏈鏍革紝鏃犻渶鍙嶅鏍�"; - objJsonResult.data = null; - return objJsonResult; - } - else - { - string HCheckDate = DateTime.Now.Date.ToString(); - oCN.RunProc(" Update Kf_ICStockBillMain set HChecker=' ',HCheckDate=null,HBillStatus=1 Where HBillType='1239' and HInterID=" + HInterID); - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅鏍告垚鍔燂紒"; - objJsonResult.data = 1; - return objJsonResult; - } + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈壘鍒�"; + objJsonResult.data = null; + return objJsonResult; } - } - else + catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鏈壘鍒�"; + objJsonResult.Message = "瀹℃牳澶辫触鎴栧弽瀹℃牳澶辫触 " + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閲囪喘閫�鏂欏崟 鍏抽棴/鍙嶅叧闂姛鑳� + [Route("Cg_PurchaseReturn/CloseCg_PurchaseReturn")] + [HttpGet] + public object CloseCg_PurchaseReturn(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Cg_PurchaseReturnBill_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; + BillOld.MvarItemKey = "Kf_ICStockBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴 + 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.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 + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + 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.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; + } + } + } + + 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("Cg_PurchaseReturn/DropCg_PurchaseReturn")] + [HttpGet] + public object DropCg_PurchaseReturn(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈変綔搴熸潈闄� + if (!DBUtility.ClsPub.Security_Log("Cg_PurchaseReturnBill_Drop", 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; + BillOld.MvarItemKey = "Kf_ICStockBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 浣滃簾 2 鍙嶄綔搴� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾 + 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"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!"; + 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 + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + 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.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; + } + } + } + + 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; } -- Gitblit v1.9.1