From c3b14901031d985ef750027d4952264369a1d7b0 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 02 三月 2026 10:26:21 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/Cg_ContractTransportBillListController.cs |   52 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/WebAPI/Controllers/Cg_ContractTransportBillListController.cs b/WebAPI/Controllers/Cg_ContractTransportBillListController.cs
index f8bdfec..32e870e 100644
--- a/WebAPI/Controllers/Cg_ContractTransportBillListController.cs
+++ b/WebAPI/Controllers/Cg_ContractTransportBillListController.cs
@@ -90,6 +90,7 @@
         {
             try
             {
+                string s = "";
                 //鏌ョ湅鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Cg_ContractTransportBill_Delete", 1, false, user))
                 {
@@ -115,7 +116,7 @@
                 if (BillOld.ShowBill(Int64.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo))
                 {
                     //鍒犻櫎鍓嶆帶鍒�=========================================      
-                    string sql1 = "exec h_p_Cg_ContractTransportBill_BeforeDelCtrl  " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                    string sql1 = "exec h_p_Cg_ContractTransportBill_BeforeDelCtrl  " + BillOld.omodel.HInterID + ",'" + user + "'";
                     ds = oCN.RunProcReturn(sql1, "h_p_Cg_ContractTransportBill_BeforeDelCtrl");
                     if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                     {
@@ -135,38 +136,51 @@
                         return objJsonResult;
                     }
                     //==================================================================================  
-
+                    oCN.RunProc("delete from Cg_ContractTransportBillMain where HInterID = " + HInterID);
+                    oCN.RunProc("delete from Cg_ContractTransportBillSub where HInterID= " + HInterID);
                     //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
-                    if (!BillOld.DeleteBill(BillOld.omodel.HInterID, BillOld.omodel.HBillNo, "h_p_Cg_ContractTransportBill_AfterDelCtrl", user, ref ClsPub.sExeReturnInfo))
+                    //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                    string sql2 = "exec h_p_Cg_ContractTransportBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Cg_ContractTransportBill_AfterDelCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                     {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    else
-                    {
+                        s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
-                        objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                        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();
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
-
-                oCN.Commit();
-
-
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.Message = "鍒犻櫎鎴愬姛";
                 objJsonResult.data = null;
                 return objJsonResult;
             }
             catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "Exception锛�" + e.ToString();
@@ -342,12 +356,12 @@
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
-                if (refSav == "Add")
+                if (refSav == "Add"|| refSav=="1")
                 {
 
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
-                else if (refSav == "Update")
+                else if (refSav == "Update" || refSav == "3")
                 {
                     bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                 }

--
Gitblit v1.9.1