From de29536b850296edd72f3e70011f8437c23c2586 Mon Sep 17 00:00:00 2001
From: cwjbxqmz <1134865194@qq.com>
Date: 星期日, 04 二月 2024 13:36:33 +0800
Subject: [PATCH] 采购订单、收料通知单、采购退料单、退料通知单、采购入库单、付款单、应付退款单删除前后控制的添加

---
 WebAPI/Controllers/CGGL/Kf_POStockInBackBillController.cs |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBackBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBackBillController.cs
index dd1b723..e33d9a0 100644
--- a/WebAPI/Controllers/CGGL/Kf_POStockInBackBillController.cs
+++ b/WebAPI/Controllers/CGGL/Kf_POStockInBackBillController.cs
@@ -384,7 +384,7 @@
         /// <returns></returns>
         [Route("Kf_POStockInBackBill/DeltetKf_POStockInBackBill")]
         [HttpGet]
-        public object DeleteKf_POStockInBackBill(string Hmainid, string HsupId, string HQty, string HSourceInterID, string HSourceEntryID, string user)
+        public object DeleteKf_POStockInBackBill(string Hmainid, string HsupId,string user)
         {
             DataSet ds;
             DataSet dss;
@@ -412,8 +412,9 @@
                 }
                 oCN.BeginTran();//寮�濮嬩簨鍔�
                 ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain a inner join Kf_ICStockBillSub b on a.HInterID=b.HInterID where a.HInterID= '" + Hmainid + "'", "Kf_ICStockBillMain");
-                dss = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain");
+                dss = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain '" + user + " '", "h_p_Cg_POInStockBillMain");
                 var sReturn = "";
+                string HBillNo = "";
                 if (DBUtility.ClsPub.isLong(dss.Tables[0].Rows[0]["HBack"]) != 0)
                 {
                     sReturn = DBUtility.ClsPub.isStrNull(dss.Tables[0].Rows[0]["HBackRemark"]).ToString();
@@ -432,6 +433,30 @@
                     objJsonResult.data = null;
                     return objJsonResult; ;
                 }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Kf_POStockInBackBill_BeforeDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBackBill_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;
+                }
+                //==================================================================================      
+
+
                 if (ds.Tables[0].Rows.Count == 1)
                 {
                     oCN.RunProc("delete Kf_ICStockBillSub where HInterID=" + Hmainid);
@@ -442,6 +467,34 @@
                     oCN.RunProc($"delete Kf_ICStockBillSub where HInterID={ Hmainid}and HEntryID={HsupId}");
                 }
                 oCN.Commit();//鎻愪氦浜嬪姟
+
+
+                //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                string sql2 = "exec h_p_Kf_POStockInBackBill_AfterDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_Kf_POStockInBackBill_AfterDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==============================================================================================
+
+
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";

--
Gitblit v1.9.1