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 ++++++++++++++++++++++------------------
 1 files changed, 67 insertions(+), 54 deletions(-)

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