From dbda463cdacc6c6101acdf9d58e22450a281b9b0 Mon Sep 17 00:00:00 2001
From: yzh <snbbt@21cn.com>
Date: 星期二, 07 六月 2022 23:11:04 +0800
Subject: [PATCH] 客户信息管理 停用客户信息管理

---
 web/web/GwOrder.ashx |  201 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 130 insertions(+), 71 deletions(-)

diff --git a/web/web/GwOrder.ashx b/web/web/GwOrder.ashx
index dbe8cc6..b1a5ef4 100644
--- a/web/web/GwOrder.ashx
+++ b/web/web/GwOrder.ashx
@@ -55,6 +55,8 @@
                 return this.Cancel(context);      //鍙栨秷    
             case "audit":
                 return this.Audit(context);      //璁㈠崟瀹℃牳
+            case "getOrderBySpId":
+                return this.GetOrderBySpId(context);      //璁㈠崟瀹℃牳
 
             default:
                 throw new Exception("Invalid Action=" + @string);
@@ -70,7 +72,7 @@
         string compay = context.GetString("compay");
         int flag = context.GetInt("flag");
         DateTime startDate = context.GetDateTime("startDate");
-        DateTime endDate = context.GetDateTime("endDate");
+        DateTime endDate = context.GetDateTime("endDate")==DateTime.Parse("0001-01-01 00:00:00")? DateTime.Now : context.GetDateTime("endDate");
 
         int recordCount = 0;
         int pageSize = context.GetInt("pageSize", 50);
@@ -79,66 +81,6 @@
         string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, "GWC");
 
         List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, compay, flag, startDate, endDate, pageSize, pageIndex, permissionsSQL, out recordCount);
-
-        string str1 = "";
-        if (list != null && list.Count > 0)
-        {
-
-            int num = 0;
-            foreach (GwOrder bean in list)
-            {
-                ++num;
-
-                str1 += "<tr><td>" + bean.OrderId + "</td>";
-                str1 = str1 + "<td>" + bean.SpId + "</td>";
-                str1 = str1 + "<td>" + bean.ClientId + "-" + bean.ClientName + "</td>";
-                str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>";
-                //str1 = str1 + "<td>" + bean.ComboId + "</td>";
-                str1 = str1 + "<td>" + bean.BasicNum + "</td>";
-                str1 = str1 + "<td>" + bean.GivingNum + "</td>";
-                str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000)));
-                str1 = str1 + "<td>" + bean.OrderNumTotal + "</td>";
-                str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000)));
-                str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000)));
-                str1 = str1 + "<td>" + bean.BeforeBalanceNum + "</td>";
-                str1 = str1 + "<td>" + bean.Creator + "</td>";
-                str1 = str1 + "<td>" + bean.CreateTime + "</td>";
-                str1 = str1 + "<td>" + StatusToName(bean.Status) + "</td>";
-                //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 += "</td>";
-                str1 += "</tr>";
-            }
-        }
-        else
-            str1 += "<tr><td colspan=\"15\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
-
-        return new JsonPageResult(true,  new
-        {
-            Table = str1.ToString(),
-            TotalCount = recordCount
-        });
-    }
-
-    //鍔犺浇寰呭鏍歌鍗曪紙寰呭鏍搞�佸鏍镐腑锛�
-    private JsonPageResult ListAudit(PageContext<SysUser> context)
-    {
-        string spId = context.GetString("spId");
-        string clientId = context.GetString("clientId");
-        string clientName = context.GetString("clientName");
-        int flag = context.GetInt("flag");
-        DateTime startDate = context.GetDateTime("startDate");
-        DateTime endDate = context.GetDateTime("endDate");
-
-        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, startDate, endDate, pageSize, pageIndex, permissionsSQL, out recordCount);
 
         string str1 = "";
         if (list != null && list.Count > 0)
@@ -162,6 +104,69 @@
                 str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000)));
                 str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000)));
                 str1 = str1 + "<td>" + bean.BeforeBalanceNum + "</td>";
+                str1 = str1 + "<td>" + bean.Auditor + "</td>";
+                str1 = str1 + "<td>" + bean.Creator + "</td>";
+                str1 = str1 + "<td>" + bean.CreateTime + "</td>";
+                str1 = str1 + "<td>" + StatusToName(bean.Status) + "</td>";
+                //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 += "</td>";
+                str1 += "</tr>";
+            }
+        }
+        else
+            str1 += "<tr><td colspan=\"16\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
+
+        return new JsonPageResult(true,  new
+        {
+            Table = str1.ToString(),
+            TotalCount = recordCount
+        });
+    }
+
+    //鍔犺浇寰呭鏍歌鍗曪紙寰呭鏍搞�佸鏍镐腑锛�
+    private JsonPageResult ListAudit(PageContext<SysUser> context)
+    {
+        string spId = context.GetString("spId");
+        string clientId = context.GetString("clientId");
+        string company = context.GetString("company");
+        int flag = context.GetInt("flag");
+        DateTime startDate = context.GetDateTime("startDate");
+        DateTime endDate = context.GetDateTime("endDate")==DateTime.Parse("0001-01-01 00:00:00")? DateTime.Now : context.GetDateTime("endDate");
+
+        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, pageSize, pageIndex, permissionsSQL, out recordCount);
+
+        string str1 = "";
+        if (list != null && list.Count > 0)
+        {
+
+            int num = 0;
+            foreach (GwOrder bean in list)
+            {
+                ++num;
+
+                //str1 += "<tr><td>" + bean.OrderId + "</td>";
+                str1 = str1 + "<tr><td>" + bean.SpId + "</td>";
+                str1 = str1 + "<td>" + bean.ClientId + "</td>";
+                str1 = str1 + "<td>" + bean.Company + "</td>";
+                str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>";
+                //str1 = str1 + "<td>" + bean.ComboId + "</td>";
+                str1 = str1 + "<td>" + bean.BasicNum + "</td>";
+                str1 = str1 + "<td>" + bean.GivingNum + "</td>";
+                str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000)));
+                str1 = str1 + "<td>" + bean.OrderNumTotal + "</td>";
+                str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000)));
+                str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000)));
+                str1 = str1 + "<td>" + bean.BeforeBalanceNum + "</td>";
+                str1 = str1 + "<td>" + bean.Auditor + "</td>";
                 str1 = str1 + "<td>" + bean.Creator + "</td>";
                 str1 = str1 + "<td>" + bean.CreateTime + "</td>";
                 str1 = str1 + "<td>" + StatusToName(bean.Status) + "</td>";
@@ -178,7 +183,7 @@
             }
         }
         else
-            str1 += "<tr><td colspan=\"15\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
+            str1 += "<tr><td colspan=\"16\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
 
         return new JsonPageResult(true,  new
         {
@@ -204,12 +209,12 @@
 
         string spId = context.GetString("spId");
         string clientId = context.GetString("clientId");
-        string clientName = context.GetString("clientName");
+        string company = context.GetString("company");
         int flag = context.GetInt("flag");
         //string startDate = context.GetString("startDate");
         //string endDate = context.GetString("endDate");
         DateTime startDate = context.GetDateTime("startDate");
-        DateTime endDate = context.GetDateTime("endDate");
+        DateTime endDate = context.GetDateTime("endDate")==DateTime.Parse("0001-01-01 00:00:00")? DateTime.Now : context.GetDateTime("endDate");
 
         int recordCount = 0;
         int pageSize = context.GetInt("pageSize", 50);
@@ -218,7 +223,7 @@
         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);
-        List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, startDate, endDate.AddDays(1.0), pageSize, pageIndex, permissionsSQL, out recordCount);
+        List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, company, flag, startDate, endDate.AddDays(1.0), pageSize, pageIndex, permissionsSQL, out recordCount);
 
         string str1 = "";
         if (list != null && list.Count > 0)
@@ -230,7 +235,7 @@
                 ++num;
 
                 //str1 += "<tr><td>" + bean.OrderId + "</td>";
-                str1 = str1 + "<td>" + bean.SpId + "</td>";
+                str1 = str1 + "<tr><td>" + bean.SpId + "</td>";
                 str1 = str1 + "<td>" + bean.ClientId + "</td>";
                 str1 = str1 + "<td>" + bean.Company + "</td>";
                 str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>";
@@ -242,6 +247,7 @@
                 str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000)));
                 str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000)));
                 str1 = str1 + "<td>" + bean.BeforeBalanceNum + "</td>";
+                str1 = str1 + "<td>" + bean.Auditor + "</td>";
                 str1 = str1 + "<td>" + bean.Creator + "</td>";
                 str1 = str1 + "<td>" + bean.CreateTime + "</td>";
                 str1 = str1 + "<td>" + StatusToName(bean.Status) + "</td>";
@@ -258,7 +264,7 @@
             }
         }
         else
-            str1 += "<tr><td colspan=\"15\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
+            str1 += "<tr><td colspan=\"16\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
 
         return new JsonPageResult(true,  new
         {
@@ -318,6 +324,11 @@
         string remark = context.GetString("remark");
         int status = context.GetInt("status");  //0-瀹℃牳涓嶉�氳繃锛�1-瀹℃牳閫氳繃
         string auditReason = context.GetString("auditReason");
+
+        if (status == 0 && string.IsNullOrEmpty(auditReason) )
+        {
+            throw new ArgumentException("璇疯緭鍏ヤ笉閫氳繃鍘熷洜锛�");
+        }
         DateTime createTime = DateTime.Now;
         string creator = context.OperatorID;
 
@@ -562,11 +573,11 @@
 
         if (string.IsNullOrEmpty(clientId))
         {
-            throw new ArgumentException("瀹㈡埛涓嶈兘涓虹┖锛�");
+            throw new ArgumentException("瀹㈡埛璐﹀彿涓嶈兘涓虹┖锛�");
         }
         if (string.IsNullOrEmpty(spId))
         {
-            throw new ArgumentException("璐﹀彿涓嶈兘涓虹┖锛�");
+            throw new ArgumentException("鐭俊璐﹀彿涓嶈兘涓虹┖锛�");
         }
 
         if (basicNum<=0 && givingNum <= 0 && payAmount <=0)
@@ -745,11 +756,11 @@
 
         if (string.IsNullOrEmpty(clientId))
         {
-            throw new ArgumentException("瀹㈡埛涓嶈兘涓虹┖锛�");
+            throw new ArgumentException("瀹㈡埛璐﹀彿涓嶈兘涓虹┖锛�");
         }
         if (string.IsNullOrEmpty(spId))
         {
-            throw new ArgumentException("璐﹀彿涓嶈兘涓虹┖锛�");
+            throw new ArgumentException("鐭俊璐﹀彿涓嶈兘涓虹┖锛�");
         }
 
         if (basicNum<=0 && givingNum <= 0)
@@ -787,6 +798,54 @@
         return new JsonPageResult(true, this._Dao.Get(context.GetString("orderId")));
     }
 
+    //鏍规嵁瀹㈡埛API璐﹀彿鑾峰彇鍏呭�煎垵濮嬩俊鎭�
+    private JsonPageResult GetOrderBySpId(PageContext<SysUser> context)
+    {
+        string spId = context.GetString("spId");
+            
+            if (!string.IsNullOrEmpty(spId))
+        {
+            GwSp  gwSp = new GwSpDao().Get(spId);
+            if(gwSp==null)
+            {
+                throw new ArgumentException("璐﹀彿涓嶅瓨鍦紒");
+
+            }
+            else if (gwSp.Status==0)
+            {
+                throw new ArgumentException("璐﹀彿鐘舵�佸凡鍋滅敤锛�");
+
+            }
+
+
+            GwClient gwClient = new GwClient();
+            using (GwClientDao gwClientDao = new GwClientDao())
+            {
+                gwClient = gwClientDao.Get(gwSp.ClientID);
+            }
+
+
+            GwOrder gwOrder = new GwOrder();
+                gwOrder.SpId = gwSp.SpID;
+                gwOrder.ClientId = gwSp.ClientID;
+                gwOrder.ProductId = gwSp.ProductId;
+                gwOrder.Price = gwSp.Price;
+                gwOrder.BasicNum = gwSp.BasicNum;  //鍩烘湰鏉℃暟
+                gwOrder.GivingNum = gwSp.GivingNum;
+                
+                gwOrder.Balance = long.Parse(gwClient.Balance.ToString() );    //浣欓
+                
+            return new JsonPageResult(true, gwOrder);
+        }
+        else
+        {
+             throw new ArgumentException("璇烽�夋嫨鐭俊璐﹀彿锛�");
+
+        }
+
+
+    }
+
     //鑾峰彇閫氶亾鍒楄〃
     private List<GwOp> OpList
     {

--
Gitblit v1.9.1