From 1d521ea0a9dbb49ed018cb0c13455ebdf5c73206 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期三, 08 一月 2025 17:48:42 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CGGL/YF_PayMentBackBillController.cs |  213 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 212 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/YF_PayMentBackBillController.cs b/WebAPI/Controllers/CGGL/YF_PayMentBackBillController.cs
index 31a303d..c1b7a30 100644
--- a/WebAPI/Controllers/CGGL/YF_PayMentBackBillController.cs
+++ b/WebAPI/Controllers/CGGL/YF_PayMentBackBillController.cs
@@ -123,6 +123,26 @@
                 {
                     if (refSav == "Add")
                     {
+                        //淇濆瓨鍓嶆帶鍒�=========================================              
+                        ds = oCN.RunProcReturn("exec h_p_YF_PayMentBackBill_BeforeSaveCtrl  " + BillOld.omodel.HInterID, "h_p_YF_PayMentBackBill_BeforeSaveCtrl ");
+
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //=========================================================
                         //鍗曟嵁鍙锋槸鍚﹂噸澶�
                         if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                         {
@@ -219,12 +239,41 @@
                 }
 
 
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                int sYear = 0;
+                int sPeriod = 0;
+                DateTime HDate = DateTime.Now;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
 
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
                 if (refSav == "Add")
                 {
+                    //淇濆瓨鍚庢帶鍒�=========================================              
+                    ds = oCN.RunProcReturn("exec h_p_YF_PayMentBackBill_AfterSaveCtrl " + BillOld.omodel.HInterID, "h_p_YF_PayMentBackBill_AfterSaveCtrl");
+
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
@@ -333,6 +382,43 @@
                     return objJsonResult;
                 }
 
+                string HBillNo = "";
+                ds = oCN.RunProcReturn("select * from YF_PayMentBillMain where HInterID=" + HInterID, "YF_PayMentBillMain");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult; ;
+                }
+                else
+                {
+                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_YF_PayMentBackBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_YF_PayMentBackBill_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;
+                }
+                //==================================================================================  
+
                 if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
                 {
                     objJsonResult.code = "0";
@@ -351,12 +437,49 @@
                     return objJsonResult;
                 }
 
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                int sYear = 0;
+                int sPeriod = 0;
+                DateTime HDate = DateTime.Now;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
+
+                string sReturn = "";
                 oCN.BeginTran();
 
                 oCN.RunProc("delete from YF_PayMentBillMain where HInterID = " + HInterID);
-                oCN.RunProc("delete from YF_PayMentBillSub where HInterID= " + HInterID);
+                oCN.RunProc("delete from YF_PayMentBillMain where HInterID= " + HInterID);
 
                 oCN.Commit();
+
+                //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                string sql2 = "exec h_p_YF_PayMentBackBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_YF_PayMentBackBill_AfterDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==============================================================================================
+
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -388,6 +511,7 @@
         {
             string ModRightNameCheck = "YF_PayMentBackBill_Check";
             DBUtility.ClsPub.CurUserName = CurUserName;
+            string sql = "";
             try
             {
                 //瀹℃牳鏉冮檺
@@ -413,10 +537,40 @@
                 Int64 lngBillKey = 0;
                 lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
                 DAL.ClsYF_PayMentBackBill oBill = new DAL.ClsYF_PayMentBackBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+                string HBillNo = "";
 
                 //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
                 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
                 {
+                    //瀹℃牳鍓嶆帶鍒�
+                    sql = "exec h_p_YF_PayMentBackBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_YF_PayMentBackBill_BeforeCheckCtrl");
+                    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;
+                    }
+
+                    if (!BillOld.CheckBill(HInterID, HBillNo, "h_p_YF_PayMentBackBill_AfterCheckCtrl", CurUserName, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                     if (oBill.omodel.HCloseMan.Trim() != "")
                     {
                         objJsonResult.code = "0";
@@ -444,8 +598,43 @@
                             return objJsonResult;
                         }
                     }
+
                     if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
                     {
+                        //鍙嶅鏍稿墠鎺у埗
+                        sql = "exec h_p_YF_PayMentBackBill_BeforeUnCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
+                        ds = oCN.RunProcReturn(sql, "h_p_YF_PayMentBackBill_BeforeUnCheckCtrl");
+                        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;
+                        }
+
+                        if (BillOld.AbandonCheck(HInterID, HBillNo, "h_p_YF_PayMentBackBill_AfterUnCheckCtrl", CurUserName, ref ClsPub.sExeReturnInfo))
+                        {
+                            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                           
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                         if (oBill.omodel.HChecker.Trim() == "")
                         {
                             objJsonResult.code = "0";
@@ -469,6 +658,17 @@
                 //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
                 if (IsAudit == 0) //瀹℃牳鎻愪氦
                 {
+                    //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    DateTime HDate = DateTime.Now;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.Message = s;
+                        return objJsonResult;
+                    }
+
                     //瀹℃牳鎻愪氦
                     if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
@@ -489,6 +689,17 @@
                 }
                 if (IsAudit == 1) //鍙嶅鏍告彁浜�
                 {
+                    //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    DateTime HDate = DateTime.Now;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.Message = s;
+                        return objJsonResult;
+                    }
+
                     //鍙嶅鏍告彁浜bandonCheck
                     if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {

--
Gitblit v1.9.1