From 82de67c48acaf472a6f8bb8b53f3f4feec9f5e54 Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期五, 17 十月 2025 10:42:18 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs |  117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 115 insertions(+), 2 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
index a5fb5d4..fe44422 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
@@ -98,6 +98,119 @@
         }
         #endregion
 
+        #region 宸ュ簭娲惧伐 鍒犻櫎锛堝瓙琛級鐢ㄤ簬鍙栨秷娲惧崟
+        [Route("Sc_ProcExchSendWorkBill/DelProcessSendWork_Sec")]
+        [HttpGet]
+        public object DelProcessSendWork_Sec(string HInterID, string HEntryID, string User)
+        {
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log_second("Cg_PODemandPlanConfigBill_Drop", 1, false, User))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                ds = oCN.RunProcReturn("select a.* from Sc_ProcExchSendWorkBillMain a left join Sc_ProcExchSendWorkBillSub b on b.HInterID= a.HInterID where 1=1 and a.HInterID=" + HInterID, "Sc_ProcExchSendWorkBillMain");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "1"&& ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                    string sql1 = "exec h_p_Sc_ProcExchSendWorkBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + User + "'";
+                    DataSet ds1 = oCN.RunProcReturn(sql1, "h_p_Sc_ProcExchSendWorkBill_BeforeDelCtrl");
+                    if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    if (ds.Tables[0].Rows.Count == 1)
+                    {
+                        oCN.RunProc($"delete from Sc_ProcExchSendWorkBillMain where HInterID={HInterID}");
+                    }
+                    oCN.RunProc($"delete from Sc_ProcExchSendWorkBillSub where HInterID={HInterID} and HEntryID={HEntryID}");
+
+                    //鍒犻櫎鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Sc_ProcExchSendWorkBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + User + "'";
+                    DataSet ds2 = oCN.RunProcReturn(sql2, "h_p_Sc_ProcExchSendWorkBill_AfterDelCtrl");
+                    if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================  
+
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
         #region 娲惧伐骞冲彴鏌ヨ宸ュ簭娴佽浆鍗℃暟鎹�
         [Route("Sc_ProcExchSendWorkBill/Sc_ProcessExchangeHEmpList")]
         [HttpGet]
@@ -280,7 +393,7 @@
         }
         #endregion
 
-        //#region 宸ュ簭娲惧伐鍗� 鍒犻櫎
+        #region 宸ュ簭娲惧伐鍗� 鍒犻櫎
         [Route("Sc_ProcExchSendWorkBill/DelProcessSendWork")]
         [HttpGet]
         public object DelProcessSendWork(string HInterID, string user)
@@ -368,7 +481,7 @@
                 return objJsonResult;
             }
         }
-        //#endregion
+        #endregion
 
         #region 宸ュ簭娲惧伐鍗曞鏍�/鍙嶅鏍稿姛鑳�
         [Route("Sc_ProcExchSendWorkBill/CheckSc_ProcExchSendWorkBill")]

--
Gitblit v1.9.1