From c052583025ff87735d2120dc63aeee7ea5e5524e Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期三, 23 十一月 2022 09:25:11 +0800
Subject: [PATCH] 多项优化

---
 web/web/GwOrder.ashx |   75 ++++++++++++++++++++-----------------
 1 files changed, 41 insertions(+), 34 deletions(-)

diff --git a/web/web/GwOrder.ashx b/web/web/GwOrder.ashx
index a5f34f1..e774479 100644
--- a/web/web/GwOrder.ashx
+++ b/web/web/GwOrder.ashx
@@ -22,8 +22,8 @@
     private List<GwOp> _OpList;
     private List<GwOpGroup> _GroupList;
     private List<GwProduct> _ProductList;   //浜у搧鍙婁骇鍝佸垎绫�
-    //private List<GwProduct> _ProductClassList;  //浜у搧鍒嗙被
-    
+                                            //private List<GwProduct> _ProductClassList;  //浜у搧鍒嗙被
+
     private int _userId = -1;
     private string _userType = "";
     private string _account = "";
@@ -77,7 +77,7 @@
         int recordCount = 0;
         int pageSize = context.GetInt("pageSize", 50);
         int pageIndex = context.GetInt("pageIndex", 1);
-            
+
         string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, "GWC");
 
         List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, compay, flag, startDate, endDate.AddDays(1.0), pageSize, pageIndex, permissionsSQL, out recordCount);
@@ -91,8 +91,8 @@
             {
                 ++num;
 
-                //str1 += "<tr><td>" + bean.OrderId + "</td>";
-                str1 = str1 + "<tr><td>" + bean.SpId + "</td>";
+                str1 += "<tr><td>" + bean.OrderId + "</td>";
+                str1 = str1 + "<td>" + bean.SpId + "</td>";
                 str1 = str1 + "<td>" + bean.ClientId + "</td>";
                 str1 = str1 + "<td>" + bean.Company + "</td>";
                 str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>";
@@ -111,7 +111,7 @@
                 //str1 = str1 + "<td>" + bean.Remark + "</td>";
 
                 str1 += "<td  class=\"text-right\">";
-                str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-detail btn  btn-success btn-xs\"><i class=\"fa fa-search\"></i>&nbsp;鏌ョ湅</a> ", (object) bean.OrderId);
+                str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-detail btn btn-success btn-xs\"><i class=\"fa fa-search\"></i>&nbsp;鏌ョ湅</a> ", (object) bean.OrderId);
                 str1 += "</td>";
                 str1 += "</tr>";
             }
@@ -139,7 +139,7 @@
         int recordCount = 0;
         int pageSize = context.GetInt("pageSize", 50);
         int pageIndex = context.GetInt("pageIndex", 1);
-            
+
         string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, "GWC");
 
         List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, company, flag, startDate, endDate.AddDays(1.0), pageSize, pageIndex, permissionsSQL, out recordCount);
@@ -153,8 +153,8 @@
             {
                 ++num;
 
-                //str1 += "<tr><td>" + bean.OrderId + "</td>";
-                str1 = str1 + "<tr><td>" + bean.SpId + "</td>";
+                str1 += "<tr><td>" + bean.OrderId + "</td>";
+                str1 = str1 + "<td>" + bean.SpId + "</td>";
                 str1 = str1 + "<td>" + bean.ClientId + "</td>";
                 str1 = str1 + "<td>" + bean.Company + "</td>";
                 str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>";
@@ -173,8 +173,8 @@
                 //str1 = str1 + "<td>" + bean.Remark + "</td>";
 
                 str1 += "<td  class=\"text-right\">";
-                str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-detail btn  btn-success btn-xs\"><i class=\"fa fa-search\"></i>&nbsp;鏌ョ湅</a> ", (object) bean.OrderId);
-                str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-audit btn  btn-success btn-xs\"><i class=\"fa fa-search\"></i>&nbsp;瀹℃牳</a> ", (object) bean.OrderId);
+                str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-detail btn  btn-info btn-xs\"><i class=\"fa fa-search\"></i>&nbsp;鏌ョ湅</a> ", (object) bean.OrderId);
+                str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" style=\"margin-top:10px; \" class=\"action-modal-audit btn  btn-success btn-xs\"><i class=\"fa fa-edit\"></i>&nbsp;瀹℃牳</a> ", (object) bean.OrderId);
                 if(bean.Status == 0) {
                     str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-cancel btn  btn-success btn-xs\"><i class=\"fa fa-search\"></i>&nbsp;鍙栨秷</a> ", (object) bean.OrderId);
                 }
@@ -219,7 +219,7 @@
         int recordCount = 0;
         int pageSize = context.GetInt("pageSize", 50);
         int pageIndex = context.GetInt("pageIndex", 1);
-            
+
         string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, "GWC");
 
         //List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate).AddDays(1.0), pageSize, pageIndex, out recordCount);
@@ -234,8 +234,8 @@
             {
                 ++num;
 
-                //str1 += "<tr><td>" + bean.OrderId + "</td>";
-                str1 = str1 + "<tr><td>" + bean.SpId + "</td>";
+                str1 += "<tr><td>" + bean.OrderId + "</td>";
+                str1 = str1 + "<td>" + bean.SpId + "</td>";
                 str1 = str1 + "<td>" + bean.ClientId + "</td>";
                 str1 = str1 + "<td>" + bean.Company + "</td>";
                 str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>";
@@ -316,7 +316,7 @@
         Int64 basicNum = context.GetInt64("basicNum");
         Int64 givingNum = context.GetInt64("givingNum");
         string clientId = "";
-        Int64 payAmount = 0;
+        Int64 payAmount = 0;//閲戦
         Int64 tmpPayAmount = Math.Max((int) (context.GetDecimal("payAmount", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 0);
         payAmount = tmpPayAmount;
         //double price = context.GetDecimal(price);
@@ -325,7 +325,7 @@
         int status = context.GetInt("status");  //0-瀹℃牳涓嶉�氳繃锛�1-瀹℃牳閫氳繃
         string auditReason = context.GetString("auditReason");
 
-        if (status == 0 && string.IsNullOrEmpty(auditReason) )
+        if (status == 0 && string.IsNullOrEmpty(auditReason))
         {
             throw new ArgumentException("璇疯緭鍏ヤ笉閫氳繃鍘熷洜锛�");
         }
@@ -425,7 +425,6 @@
                 nextSort = nowSort + 1;
                 //鑾峰彇瀹℃牳娴佺▼鐨勭涓�鐜妭娴佺▼浠g爜
                 nextFlowCode = getNextFlowCode(flowGroup, nextSort);
-
             }
 
         }
@@ -461,7 +460,7 @@
             Int64 topUpAmountTotal = 0;
             if (string.IsNullOrEmpty(nextFlowCode))
             {
-                orderStatus = 2;                    
+                orderStatus = 2;
 
                 //鑾峰彇璐﹀彿淇℃伅
                 GwSp gwSp = _GwSpDao.Get(spId);
@@ -496,7 +495,7 @@
                     //gwClient.Balance = ((balance + payAmount) - num * basicNum) ;   //鍏呭�间綑棰�:鍗曚綅锛堝帢锛�
                     //gwClient.Top_up_Amount_Total = topUpAmountTotal + payAmount;    //鍏呭�奸噾棰�:鍗曚綅锛堝帢锛�
                     //gwClient.ClientID = clientId;
-                    
+
                     //鏇存柊瀹㈡埛鍏呭�兼暟鎹�
                     _GwClientDao.UpdateClientAmount(payAmount-( num * basicNum), payAmount, clientId );
                 }
@@ -587,7 +586,7 @@
 
         //鑾峰彇璐﹀彿淇℃伅
         GwSp gwSp = _GwSpDao.Get(spId);
-        int balance = 0;
+        Int64 balance = 0;
         if (gwSp == null)
         {
             throw new ArgumentException("璐﹀彿涓嶅瓨鍦紒");
@@ -600,7 +599,7 @@
 
         //鑾峰彇瀹㈡埛淇℃伅
         GwClient gwClient = _GwClientDao.Get(gwSp.ClientID);
-        balance =  int.Parse(gwClient.Balance.ToString() );
+        balance =  Int64.Parse(gwClient.Balance.ToString() );
 
         //涓�1-棰勪粯璐�
         //if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum)
@@ -671,6 +670,12 @@
 
         productId = gwSp.ProductId;
         price = gwSp.Price;
+
+
+        if (string.IsNullOrEmpty(gwSp.ProductId))
+        {
+            throw new ArgumentException("浜у搧閰嶇疆涓嶅厑璁镐负绌猴紒璇峰厛閰嶇疆璐﹀彿鎵�鍏宠仈浜у搧锛�");
+        }
 
         orderNumTotal = basicNum + givingNum;
         orderAmountTotal = basicNum * price;
@@ -795,15 +800,17 @@
     //鏍规嵁涓婚敭鑾峰彇浜у搧鎴栦骇鍝佸垎绫讳俊鎭�
     private JsonPageResult Get(PageContext<SysUser> context)
     {
-        return new JsonPageResult(true, this._Dao.Get(context.GetString("orderId")));
+        GwOrder gwOrder = _Dao.Get(context.GetString("orderId"));
+
+        return new JsonPageResult(true,gwOrder);
     }
 
     //鏍规嵁瀹㈡埛API璐﹀彿鑾峰彇鍏呭�煎垵濮嬩俊鎭�
     private JsonPageResult GetOrderBySpId(PageContext<SysUser> context)
     {
         string spId = context.GetString("spId");
-            
-            if (!string.IsNullOrEmpty(spId))
+
+        if (!string.IsNullOrEmpty(spId))
         {
             GwSp  gwSp = new GwSpDao().Get(spId);
             if(gwSp==null)
@@ -817,7 +824,7 @@
 
             }
 
-            
+
             GwOrder gwOrder = new GwOrder();
 
             GwClient gwClient = new GwClient();
@@ -828,19 +835,19 @@
                 gwOrder.Balance = long.Parse(gwClient.Balance.ToString() );    //浣欓
             }
 
-                gwOrder.SpId = gwSp.SpID;
-                gwOrder.ClientId = gwSp.ClientID;
-                gwOrder.ProductId = gwSp.ProductId;
-                gwOrder.ProductName = gwSp.ProductName;
-                gwOrder.Price = gwSp.Price;
-                gwOrder.BasicNum = gwSp.BasicNum;  //鍩烘湰鏉℃暟
-                gwOrder.GivingNum = gwSp.GivingNum;                
-                
+            gwOrder.SpId = gwSp.SpID;
+            gwOrder.ClientId = gwSp.ClientID;
+            gwOrder.ProductId = gwSp.ProductId;
+            gwOrder.ProductName = gwSp.ProductName;
+            gwOrder.Price = gwSp.Price;
+            gwOrder.BasicNum = gwSp.BasicNum;  //鍩烘湰鏉℃暟
+            gwOrder.GivingNum = gwSp.GivingNum;
+
             return new JsonPageResult(true, gwOrder);
         }
         else
         {
-             throw new ArgumentException("璇烽�夋嫨鐭俊璐﹀彿锛�");
+            throw new ArgumentException("璇烽�夋嫨鐭俊璐﹀彿锛�");
 
         }
 

--
Gitblit v1.9.1