From 6bd0d63edace62af469ddb690783b27e11443614 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 15 十一月 2023 19:29:31 +0800
Subject: [PATCH] 销售订单变更单:审核时需要检验源单是否为审核状态,不是则审核失败

---
 WebAPI/Controllers/XSGL/Xs_CusRatingChangeBillController.cs |   72 +++++++++++++++++++++++++++++++++++-
 1 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_CusRatingChangeBillController.cs b/WebAPI/Controllers/XSGL/Xs_CusRatingChangeBillController.cs
index d286cb6..a971c59 100644
--- a/WebAPI/Controllers/XSGL/Xs_CusRatingChangeBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_CusRatingChangeBillController.cs
@@ -48,12 +48,12 @@
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_Xs_CusRatingChangeBillList_Query order by 鍗曟嵁鍙� ", "h_v_Xs_CusRatingChangeBillList_Query");
+                    ds = oCN.RunProcReturn("select * from h_v_Xs_CusRatingChangeBillList_Query order by 鍗曟嵁鍙� desc", "h_v_Xs_CusRatingChangeBillList_Query");
                 }
                 else
                 {
                     string sql1 = "select * from h_v_Xs_CusRatingChangeBillList_Query where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
                     ds = oCN.RunProcReturn(sql, "h_v_Xs_CusRatingChangeBillList_Query");
                 }
 
@@ -311,6 +311,8 @@
         {
             try
             {
+                string s = "";
+
                 //鏌ョ湅鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Xs_CusRatingChangeBill_Drop", 1, false, user))
                 {
@@ -327,6 +329,24 @@
                     objJsonResult.count = 0;
                     objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
                     objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                //鍒ゆ柇鏄惁鍙紪杈�
+                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�";
+                    objJsonResult.data = 1;
                     return objJsonResult;
                 }
 
@@ -448,9 +468,18 @@
                 //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
                 if (IsAudit == 0) //瀹℃牳鎻愪氦
                 {
+                    
+                    
                     //瀹℃牳鎻愪氦
                     if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
+
+                        //鍙嶅啓瀹㈡埛淇$敤棰濆害
+                        oCN.BeginTran();
+                        string sql = "exec h_p_Xs_CusRatingChangeBill_ReWriteCustomerCredit " + oBill.omodel.HCusID + "," + oBill.omodel.HNewRating + ",'" + CurUserName + "'";
+                        oCN.RunProc(sql);
+                        oCN.Commit();
+
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
                         objJsonResult.Message = "瀹℃牳鎴愬姛";
@@ -780,5 +809,44 @@
             }
         }
         #endregion
+
+        #region 鏍规嵁瀹㈡埛鍐呯爜鑾峰彇瀹㈡埛浣欓涓庡鎴蜂俊鐢ㄩ搴�
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xs_CusRatingChangeBill/getCustomerBalance")]
+        [HttpGet]
+        public object getCustomerBalance(Int64 HCusID)
+        {
+            try
+            {
+                string sql = "exec h_p_Gy_Customer_CrediControl " + HCusID;
+                ds = oCN.RunProcReturn(sql, "h_p_Gy_Customer_CrediControl");
+                if(ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "Exception锛佹湭鑾峰彇鍒板搴斿鎴风殑淇℃伅锛侊紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1