From 1413158ae9f0fc5ac7eb39deeab7d5cc09950ad1 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 01 二月 2024 10:57:51 +0800
Subject: [PATCH] 工序流转卡派工单删除方法,增加调用删除 前控制h_p_Sc_ProcExchSendWorkBill_BeforeDelCtrl 和删除 后控制h_p_Sc_ProcExchSendWorkBill_AfterDelCtrl 的存储过程。 工序委外派工单删除方法,增加 调用删除前控制h_p_WW_EntrustWorkOrderBill_BeforeDelCtrl 和删除后控制h_p_WW_EntrustWorkOrderBill_AfterDelCtrl 的存储过程。 工序进站接收单删除方法,增加调用删除前控制h_p_Sc_StationInBill_BeforeDelCtrl 和删除后控制h_p_Sc_StationInBill_AfterDelCtrl 的存储过程。 工序出站汇报单删除方法,增加调用删除前控制h_p_Sc_StationOutBill_BeforeDelCtrl 和删除后控制h_p_Sc_StationOutBill_AfterDelCtrl 的存储过程

---
 DAL/车间管理/ClsSc_StationOutBill.cs                       |   47 +++++++++++++++
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |   25 ++++++++
 DAL/车间管理/ClsSc_StationInBill.cs                        |   51 +++++++++++++++++
 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs  |   27 ++++++++
 4 files changed, 147 insertions(+), 3 deletions(-)

diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationInBill.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationInBill.cs"
index bda0d4d..8150985 100644
--- "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationInBill.cs"
+++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationInBill.cs"
@@ -971,6 +971,57 @@
 
         }
 
+        public bool DeleteBill(long HInterID, long HProcExchInterID, long HProcExchEntryID,string HBillNo,string procName,string user, ref string sReturn)
+        {
+            try
+            {
+                oCn.BeginTran();
+                //HBillSubType=2  鍒濆鍖栬繘绔�  鎶婃祦杞崱鍒濆鍖栨爣璁版敼涓�0
+                //DataSet Ds;
+                //Ds = oCn.RunProcReturn("select HBillSubType from Sc_StationInBillMain where HInterID=" + HInterID, "h_p_Sc_StationDelete");
+                //if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "2")
+                //{
+                //    oCn.RunProc("update Sc_ProcessExchangeBillsub set HCSHJZFlag=0 where HInterID=" + HProcExchInterID);
+                //}
+
+                //////
+                oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID.ToString() + ",-1");
+                //
+                //鍒犻櫎
+                oCn.RunProc("delete Sc_StationInBillMain   where HInterID=" + HInterID);
+                //鍥炲~娴佽浆鍗¤繘绔欐椂闂�
+                //oCn.RunProc("update Sc_ProcessExchangeBillsub set HRelBeginDate=null where HInterID=" + HProcExchInterID + " and HEntryID=" + HProcExchEntryID);
+
+                //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                string sql2 = "exec " + procName + " " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                DataSet ds = oCn.RunProcReturn(sql2, procName);
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+
+                    sReturn = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    oCn.RollBack();
+                    return false;
+                }
+                //==============================================================================================
+
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+
+        }
+
         public bool CheckCenterIDByUser(long HCenterID)
         {
             DataSet Ds;
diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationOutBill.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationOutBill.cs"
index 641fcc3..95dabfd 100644
--- "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationOutBill.cs"
+++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_StationOutBill.cs"
@@ -1061,6 +1061,53 @@
 
 
         }
+
+        public bool DeleteBill(long HInterID, long HProcExchInterID, long HProcExchEntryID, string HBillNo, string procName, string user, ref string sReturn)
+        {
+            try
+            {
+                oCn.BeginTran();
+                //鍒犻櫎鍏宠仈 
+                //
+                oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID.ToString() + ",-1");
+                //
+
+                oCn.RunProc("delete Sc_StationOutBillMain   where HInterID=" + HInterID);
+                oCn.RunProc("delete Sc_StationOutBillSub   where HInterID=" + HInterID);
+                //oCn.RunProc("delete Sc_StationOutBillSub_Item   where HInterID=" + HInterID);
+                //oCn.RunProc("update Sc_ProcessExchangeBillsub set HRelEndDate=null where HInterID=" + HProcExchInterID + " and HEntryID=" + HProcExchEntryID);
+
+                //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                string sql2 = "exec " + procName + " " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                DataSet ds = oCn.RunProcReturn(sql2, procName);
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+
+                    sReturn = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    oCn.RollBack();
+                    return false;
+                }
+                //==============================================================================================
+
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+
+
+        }
+
         public bool CheckCenterIDByUser(long HCenterID)
         {
             DataSet Ds;
diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
index 4d54aa5..6dbe67c 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -1386,8 +1386,31 @@
                         return objJsonResult;
                     }
 
-                   
-                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo))
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string HBillNo = oBill.omodel.HBillNo;
+                    string sql1 = "exec h_p_Sc_StationInBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + HDeleteMan + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationInBill_BeforeDelCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, HBillNo, "h_p_Sc_StationInBill_AfterDelCtrl", HDeleteMan, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index cbdddbd..75722a2 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -2185,7 +2185,30 @@
                         }
                     }
 
-                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo))
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string HBillNo = oBill.omodel.HBillNo;
+                    string sql1 = "exec h_p_Sc_StationOutBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + HDeleteMan + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationOutBill_BeforeDelCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, HBillNo, "h_p_Sc_StationOutBill_AfterDelCtrl", HDeleteMan, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;

--
Gitblit v1.9.1