From 60b1bdd10ca597195c48a12631ca7b24e5b87465 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期二, 19 三月 2024 14:18:58 +0800 Subject: [PATCH] 根据用户关联客户过滤数据,指定客户可以让所有用户看到 --- WebAPI/Controllers/XSGL/Kf_ICStockBackBillController.cs | 189 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 166 insertions(+), 23 deletions(-) diff --git a/WebAPI/Controllers/XSGL/Kf_ICStockBackBillController.cs b/WebAPI/Controllers/XSGL/Kf_ICStockBackBillController.cs index 2aa5bed..00449af 100644 --- a/WebAPI/Controllers/XSGL/Kf_ICStockBackBillController.cs +++ b/WebAPI/Controllers/XSGL/Kf_ICStockBackBillController.cs @@ -8,6 +8,7 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using System.Windows.Forms; namespace WebAPI.Controllers { @@ -57,14 +58,14 @@ ds = oCN.RunProcReturn(sql, "h_v_Kf_ICStockBackBillList_Query"); } - if (ds == null || ds.Tables[0].Rows.Count == 0) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鏈煡璇㈠埌鏁版嵁"; - objJsonResult.data = null; - return objJsonResult; - } + //if (ds == null || ds.Tables[0].Rows.Count == 0) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏈煡璇㈠埌鏁版嵁"; + // objJsonResult.data = null; + // return objJsonResult; + //} //娣诲姞鍒楀悕 foreach (DataColumn col in ds.Tables[0].Columns) @@ -322,11 +323,60 @@ return objJsonResult; } + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Kf_SellOutBackBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBackBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== oCN.BeginTran(); + //鍒犻櫎鍏宠仈 + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellBack_Delete " + HInterID); + //鍒犻櫎閿�鍞��璐у崟鏁版嵁 oCN.RunProc("delete from Kf_ICStockBillMain where HInterID = " + HInterID); oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'"); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_Kf_SellOutBackBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Kf_SellOutBackBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + s = ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== oCN.Commit(); @@ -338,6 +388,7 @@ } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -437,33 +488,123 @@ return objJsonResult; } - + //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� if (IsAudit == 0) //瀹℃牳鎻愪氦 { - //瀹℃牳鎻愪氦 - if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) - { - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛"; - objJsonResult.data = null; - return objJsonResult; - } - else + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Kf_SellOutBackBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBackBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; objJsonResult.data = null; return objJsonResult; } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + oCN.BeginTran(); + //澧炲姞鍏宠仈 + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellBack_Check " + oBill.omodel.HInterID + ",'" + CurUserName + "'"); + //鍐欏叆鏃ュ織 + string WorkList = "瀹℃牳鍗曟嵁锛屽崟鎹彿锛�" + oBill.omodel.HBillNo; + string SystemName = "LMES-閿�鍞��璐у崟妯″潡"; + oCN.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + + "(getdate(),'" + CurUserName + "','" + SystemInformation.ComputerName + "','" + WorkList + "','" + SystemName + "','','瀹℃牳')" + ); + + + //瀹℃牳鍚庢帶鍒�========================================= + string sql = "exec h_p_Kf_SellOutBackBill_AfterCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Kf_SellOutBackBill_AfterCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳杩囩▼涓嚭閿欙紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); + objJsonResult.data = null; + return objJsonResult; + } + //========================================= + + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + + + //if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBackBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + //{ + // objJsonResult.code = "1"; + // objJsonResult.count = 1; + // objJsonResult.Message = "瀹℃牳鎴愬姛"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //else + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + // objJsonResult.data = null; + // return objJsonResult; + //} } if (IsAudit == 1) //鍙嶅鏍告彁浜� { - //鍙嶅鏍告彁浜bandonCheck - if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_Kf_SellOutBackBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBackBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + oCN.BeginTran(); + //鍒犻櫎鍏宠仈 + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellBack_UnCheck " + HInterID + ",'" + CurUserName + "'"); + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBackBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鍙嶅鏍告垚鍔�"; @@ -472,6 +613,7 @@ } else { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; @@ -483,6 +625,7 @@ } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); -- Gitblit v1.9.1