From 94f7436534dd9909840283221c8bdcf62b10c9b1 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期三, 06 三月 2024 17:31:37 +0800
Subject: [PATCH] 优化其他应收单,发货通知单编辑功能完善

---
 WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs |  121 ++++++++++++++++++++++------------------
 WebAPI/Controllers/WebAPIController.cs                   |   26 +++++++-
 WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs   |   10 ++-
 3 files changed, 97 insertions(+), 60 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index abc503b..c89afbd 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -8109,14 +8109,34 @@
                     return objJsonResult;
                 }
                 oCN.BeginTran();//寮�濮嬩簨鍔�
+                
                 ds = oCN.RunProcReturn("select * from Gy_ProjectMoney where HItemID=" + HItemID, "Gy_ProjectMoney");
-                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
                     objJsonResult.data = null;
-                    return objJsonResult; ;
+                    return objJsonResult;
                 }
 
 
diff --git a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
index 50923f1..92ff4de 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
@@ -128,7 +128,7 @@
         /// <returns></returns>
         [Route("Xs_SeOutStockBill/DeltetSeOutStockBill")]
         [HttpGet]
-        public object DeltetSeOutStockBill(string HInterID,string user)
+        public object DeltetSeOutStockBill(string HInterID, string HsupId, string HQty, string HSourceInterID, string HSourceEntryID, string user)
         {
             try
             {
@@ -144,6 +144,8 @@
 
                 oCN.BeginTran();
                 var ds = oCN.RunProcReturn("select * from Xs_SeOutStockBillMain where HInterID=" + HInterID, "Xs_SeOutStockBillMain");
+                
+                var dss = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain_Delete");
                 //鍒犻櫎鍓嶆帶鍒�
                 DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeDelCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeDelCtrl");
                 if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
@@ -371,7 +373,7 @@
                     oCN.RunProc("delete from Xs_SeOutStockBillSub where HInterID='" + HInterID + "'");
                 }
                 //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub(msg3, HInterID, OperationType);
+                objJsonResult = AddBillSub(msg3, HInterID, OperationType,user);
 
 
                 //淇濆瓨鍚庢帶鍒�=========================================
@@ -420,7 +422,7 @@
             }
         }
 
-        public json AddBillSub(string msg3, long HInterID, int OperationType)
+        public json AddBillSub(string msg3, long HInterID, int OperationType,string user)
         {
             List<ClsXs_SeOutStockBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillSub>>(msg3);
 
@@ -484,6 +486,8 @@
                 ,{oSub.HAuxPropID},'{oSub.HBatchNO}','{oSub.HMTONo}',{oSub.HERPInterID},{oSub.HERPEntryID})";
 
                 oCN.RunProc(sql);
+
+                ds = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain");
             }
 
             objJsonResult.code = "1";
diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
index 414620a..246eaae 100644
--- a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
+++ b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
@@ -308,7 +308,7 @@
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
-                //鍒ゆ柇鏄惁鍙紪杈�
+                //鍒ゆ柇鏄惁鍙垹闄�
                 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                 {
                     objJsonResult.code = "0";
@@ -317,68 +317,81 @@
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
-
-                //鍒犻櫎鍓嶆帶鍒�=========================================      
-                string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
-                ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeDelCtrl");
-                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                //鍒ゆ柇鏄惁鏄垱寤虹姸鎬佽繘琛屽垹闄�
+                if (BillOld.omodel.HBillStatus.ToString() == "1")
                 {
-                    objJsonResult.code = "0";
+
+
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_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("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID);
+                    oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID);
+
+                    //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                    string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_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();
+
+                    objJsonResult.code = "1";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
-                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                else
                 {
                     objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
-                    objJsonResult.data = null;
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹笉鏄垱寤虹姸鎬侊紝涓嶅厑璁稿垹闄わ紒";
+                    objJsonResult.data = 1;
                     return objJsonResult;
                 }
-                //==================================================================================  
-
-
-
-                oCN.BeginTran();
-
-                oCN.RunProc("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID);
-                oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID);
-
-                //鍒犻櫎鍚庢帶鍒�==================================================================================      
-                string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
-                ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_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();
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鍒犻櫎鎴愬姛";
-                objJsonResult.data = null;
-                return objJsonResult;
             }
             catch (Exception e)
             {

--
Gitblit v1.9.1