From c8ef15919b324525c6b61647e2a5e48aa249f3b4 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 15 七月 2024 08:03:38 +0800
Subject: [PATCH] 客户条码扫码记录:修改单据号 取消 只能 设置缓存列表中的单据号 的限制

---
 WebAPI/DLL/ClsSb_EquipConkBookBill.cs |   88 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/WebAPI/DLL/ClsSb_EquipConkBookBill.cs b/WebAPI/DLL/ClsSb_EquipConkBookBill.cs
index 25880c7..29ae33e 100644
--- a/WebAPI/DLL/ClsSb_EquipConkBookBill.cs
+++ b/WebAPI/DLL/ClsSb_EquipConkBookBill.cs
@@ -29,13 +29,74 @@
         }
 
         #endregion   鑷畾涔夋柟娉�
+
+        //淇濆瓨鍓嶆帶鍒�
+        public bool BeforeSave(Int64 HInterID, string HBillNo, string HBillNote, Int64 OperationType, ref string sReturn)
+        {
+            try
+            {
+                DataSet Ds = oCn.RunProcReturn("Exec h_p_Sb_EquipConkBookBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillNote + "'," + OperationType.ToString(), "h_p_Sb_EquipConkBookBill_BeforeSaveCtrl");
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                        return false;
+                    }
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+        //淇濆瓨鍚庢帶鍒�
+        public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
+        {
+            try
+            {
+                DataSet Ds = oCn.RunProcReturn("Exec h_p_Sb_EquipConkBookBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sb_EquipConkBookBill_AfterSaveCtrl");
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                        return false;
+                    }
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
         //淇敼鍗曟嵁
         public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
         {
             try
             {
-                //
                 oCn.BeginTran();
+                //淇濆瓨鍓嶆帶鍒�
+                string HBillNote = "";
+                if (!BeforeSave(lngBillKey, omodel.HBillNo, HBillNote, 2, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
                 //鏇存柊涓昏〃
                 oCn.RunProc("UpDate Sb_EquipConkBookBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
@@ -73,7 +134,13 @@
                      "," + oSub.HConkReasonID.ToString() + ",'" + oSub.HConkExplanation + "'," + oSub.HManagerID.ToString() + 
                      ") ");
                 }
-                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                //淇濆瓨鍚庢帶鍒�
+                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
+                sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�";
                 oCn.Commit();
                 return true;
             }
@@ -91,7 +158,14 @@
             {
                 //寰楀埌mainid
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
-                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+
+                //淇濆瓨鍓嶆帶鍒�
+                string HBillNote = "";
+                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, HBillNote, 1, ref sReturn))
+                {
+                    return false;
+                }
+
                 oCn.BeginTran();
                 //涓昏〃
                 oCn.RunProc("Insert Into Sb_EquipConkBookBillMain" +
@@ -118,7 +192,13 @@
                       "," + oSub.HConkReasonID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HConkExplanation + "'" +
                       ") ");
                 }
-                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                //淇濆瓨鍚庢帶鍒�
+                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
+                sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�";
                 oCn.Commit();
                 return true;
             }

--
Gitblit v1.9.1