From fc17c9eef5812660ece6b951708b442db7bfdf3b Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 17 三月 2025 19:23:18 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs |  112 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 81 insertions(+), 31 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
index 246eaae..c7e73f0 100644
--- a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
+++ b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
@@ -23,7 +23,7 @@
 
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-        DataSet ds;
+        DataSet ds;       
 
         #region 鍏朵粬搴旀敹鍗曞垪琛� 鏌ヨ
         /// <summary>
@@ -93,9 +93,10 @@
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();                             //琛ㄥご鏁版嵁
-            string refSav = sArray[1].ToString();                           //鎿嶄綔鏂瑰紡
-            string msg4 = sArray[2].ToString();                             //鐢ㄦ埛
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString(); //瀛愯〃
+            string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string msg4 = sArray[3].ToString();//鐢ㄦ埛鍚�
 
             DBUtility.ClsPub.CurUserName = msg4;
 
@@ -187,6 +188,36 @@
                     }
                     oBill.omodel = oItem;
                 }
+                // 琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                List<Model.ClsYS_ReceiveOtherBillSub> ls = new List<Model.ClsYS_ReceiveOtherBillSub>();
+                ls = oListModels.getObjectByJson_YS_ReceiveOtherBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsYS_ReceiveOtherBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+
+                   
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                    
+                    oBill.DetailColl.Add(oItemSub);
+
+                }
+
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                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;
+                }
 
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
@@ -239,7 +270,11 @@
         {
             try
             {
-                ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveOtherBillMainList where hmainid=" + HInterID, "h_v_YS_ReceiveOtherBillMainList");
+                List<DataTable> tableList = new List<DataTable>();
+
+                ds = oCN.RunProcReturn("exec h_p_YS_ReceiveOtherBillMain_Edit  " + HInterID, "h_p_YS_ReceiveOtherBillMain_Edit");
+                tableList.Add(ds.Tables[0]);
+                tableList.Add(ds.Tables[1]);
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -253,7 +288,7 @@
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "Sucess锛�";
-                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.data = tableList;
                     return objJsonResult;
                 }
             }
@@ -318,9 +353,17 @@
                     return objJsonResult;
                 }
                 //鍒ゆ柇鏄惁鏄垱寤虹姸鎬佽繘琛屽垹闄�
-                if (BillOld.omodel.HBillStatus.ToString() == "1")
+                if (int.Parse(BillOld.omodel.HBillStatus.ToString()) <= 1)
                 {
-
+                    //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                    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 sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
@@ -499,34 +542,31 @@
                 //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
                 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;
+                    }
+
                     oCN.BeginTran();
 
                     //璁板綍杩斿洖淇℃伅
                     string msg = "";
 
-                    if(oBill.omodel.HMainSourceInterID != 0)
+                    string sql = "exec h_p_YS_ReceiveOtherBill_CheckCrediControl " + oBill.omodel.HInterID;
+                    ds = oCN.RunProcReturn(sql, "h_p_YS_ReceiveOtherBill_CheckCrediControl");
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
                     {
-                        //妫�楠屾簮鍗曟槸鍚﹀瓨鍦ㄥ強鍗曟嵁鐘舵��
-                        string sql = "select * from YS_ReceiveOtherBillMain where HInterID = " + oBill.omodel.HMainSourceInterID;
-                        ds = oCN.RunProcReturn(sql, "YS_ReceiveOtherBillMain");
-                        if (ds == null || ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曚笉瀛樺湪!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曟湭澶勪簬宸插鏍哥姸鎬�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        
-                     
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
                     }
 
                     //瀹℃牳鍓嶆帶鍒�=========================================      
@@ -577,7 +617,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;
+                    }
+
                     //鍙嶅鏍稿墠鎺у埗=========================================        
                     string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                     ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeUnCheckCtrl");

--
Gitblit v1.9.1