From c4f47bbec99d71eba138745e7f16c03400d88ad1 Mon Sep 17 00:00:00 2001
From: pzy <2829717936@qq.com>
Date: 星期三, 18 九月 2024 10:15:53 +0800
Subject: [PATCH] 导入任务1

---
 WebAPI/DLL/工资管理/ClsPay_OtherBalBill.cs |  109 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 107 insertions(+), 2 deletions(-)

diff --git "a/WebAPI/DLL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_OtherBalBill.cs" "b/WebAPI/DLL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_OtherBalBill.cs"
index ef24bcd..3a5fe30 100644
--- "a/WebAPI/DLL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_OtherBalBill.cs"
+++ "b/WebAPI/DLL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_OtherBalBill.cs"
@@ -31,6 +31,87 @@
         }
 
         #endregion   鑷畾涔夋柟娉�
+
+
+        //淇濆瓨鍓嶆帶鍒�
+        public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
+        {
+            try
+            {
+                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_OtherBalBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_OtherBalBill_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_Pay_OtherBalBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_OtherBalBill_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 bool CheckStockQty(long HMaterID, long HWhID, string sBatchNo)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet Ds;
+                Ds = oCn.RunProcReturn("Select 鍗虫椂搴撳瓨 from h_v_KF_ICInventoryList Where HMaterID=" + HMaterID.ToString() + " and HWHID=" + HWhID.ToString() + " and 鎵规='" + sBatchNo + "'", "h_v_KF_ICInventoryList");
+                if (Ds.Tables[0].Rows.Count == 0)
+                {
+                    return false;
+                }
+                //鍒ゆ柇鏄惁璐熷簱瀛樻垨0搴撳瓨
+                if (DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0][0]) <= 0)
+                {
+                    return false;
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+
         //淇敼鍗曟嵁
         public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
         {
@@ -38,6 +119,12 @@
             {
                 //
                 oCn.BeginTran();
+                //淇濆瓨鍓嶆帶鍒�
+                if(!BeforeSave(lngBillKey, omodel.HBillNo,2, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
                 //鏇存柊涓昏〃
                 oCn.RunProc("UpDate Pay_OtherBalBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
@@ -72,7 +159,7 @@
                       ",HPriceRate,HSubsidyTotal,HDeuctTotal,HSubsidyID,HDeuctID" +
                       ",HPackQty,HPackPrice,HPackMoney,HPackMaterID,HSubsidyQty,HSubsidyMoney" +
                       ") values("
-                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + (oSub.HEntryCloseDate.ToShortDateString() == "1900/1/1" ? "NULL" : "'" + oSub.HEntryCloseDate.ToShortDateString() + "'") + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       "," + oSub.HMaterID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString()
                       + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HSqty.ToString() +
@@ -94,6 +181,12 @@
                 //        return false;
                 //    }
                 //}
+                //淇濆瓨鍚庢帶鍒�
+                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
                 sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -114,6 +207,12 @@
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCn.BeginTran();
+                //淇濆瓨鍓嶆帶鍒�
+                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
                 //涓昏〃
                 oCn.RunProc("Insert Into Pay_OtherBalBillMain   " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
@@ -136,7 +235,7 @@
                       ",HPriceRate,HSubsidyTotal,HDeuctTotal,HSubsidyID,HDeuctID" +
                       ",HPackQty,HPackPrice,HPackMoney,HPackMaterID,HSubsidyQty,HSubsidyMoney" +
                       ") values("
-                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + (oSub.HEntryCloseDate.ToShortDateString() == "1900/1/1" ? "NULL" : "'" + oSub.HEntryCloseDate.ToShortDateString() + "'")  + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       "," + oSub.HMaterID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString()
                       + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HSqty.ToString() +
@@ -159,6 +258,12 @@
                 //    }
                 //}
                 //
+                //淇濆瓨鍚庢帶鍒�
+                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;

--
Gitblit v1.9.1