Przeglądaj źródła

Merge branch 'feature-dgy-BUG修复' into feature-dgy-后台测试

# Conflicts:
#	wwwroot/layuiadmin/modules_main/LeaderReserveRecord_Admin.js
DuGuYang 3 lat temu
rodzic
commit
c6737dead3

+ 113 - 0
Areas/Admin/Controllers/MainServer/OrdersController.cs

@@ -1276,6 +1276,119 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        #region 快捷导出Excel
+        public IActionResult QuickExportExcel(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string QuickExportExcelDo(string UserIdMakerCode, string UserIdRealName, string PayModeSelect, string StoreIdStoreNo, string StoreIdStoreName, string RefundStatusSelect, string DeliveryTypeSelect, string SendStatusSelect, string ProductIdSelect, string StoreTypeSelect, string StoreUserIdMakerCode, string StoreUserIdRealName, string PayStatusSelect, string CreateDateData, string SendDateData, string PayDateData)
+        {
+
+            string SqlString = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                SqlString += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                SqlString += " and UserId in (select UserId from UserForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //支付方式
+            if (!string.IsNullOrEmpty(PayModeSelect))
+            {
+                SqlString += " and PayMode=" + PayModeSelect;
+            }
+            //仓库编号
+            if (!string.IsNullOrEmpty(StoreIdStoreNo))
+            {
+                SqlString += " and StoreId in (select StoreId from StoreHouseForStoreNo where StoreNo='" + StoreIdStoreNo + "')";
+            }
+            //仓库名称
+            if (!string.IsNullOrEmpty(StoreIdStoreName))
+            {
+                SqlString += " and StoreId in (select StoreId from StoreHouseForStoreName where StoreName='" + StoreIdStoreName + "')";
+            }
+            //退款状态
+            if (!string.IsNullOrEmpty(RefundStatusSelect))
+            {
+                SqlString += " and RefundStatus=" + RefundStatusSelect;
+            }
+            //提货类型
+            if (!string.IsNullOrEmpty(DeliveryTypeSelect))
+            {
+                SqlString += " and DeliveryType=" + DeliveryTypeSelect;
+            }
+            //发货状态
+            if (!string.IsNullOrEmpty(SendStatusSelect))
+            {
+                SqlString += " and SendStatus=" + SendStatusSelect;
+            }
+            //商品名称
+            if (!string.IsNullOrEmpty(ProductIdSelect))
+            {
+                SqlString += " and ProductId=" + ProductIdSelect;
+            }
+            //仓库类型
+            if (!string.IsNullOrEmpty(StoreTypeSelect))
+            {
+                SqlString += " and StoreType=" + StoreTypeSelect;
+            }
+            //仓库归属创客编号
+            if (!string.IsNullOrEmpty(StoreUserIdMakerCode))
+            {
+                SqlString += " and StoreUserId in (select StoreUserId from UserForMakerCode where MakerCode='" + StoreUserIdMakerCode + "')";
+            }
+            //仓库归属创客真实姓名
+            if (!string.IsNullOrEmpty(StoreUserIdRealName))
+            {
+                SqlString += " and StoreUserId in (select StoreUserId from UserForRealName where RealName='" + StoreUserIdRealName + "')";
+            }
+            //支付状态
+            if (!string.IsNullOrEmpty(PayStatusSelect))
+            {
+                SqlString += " and PayStatus=" + PayStatusSelect;
+            }
+            //支付时间
+            if (!string.IsNullOrEmpty(PayDateData))
+            {
+                string[] datelist = PayDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                SqlString += " and PayDate>='" + start + " 00:00:00' and PayDate<='" + end + " 23:59:59'";
+            }
+            //下单时间
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                SqlString += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+            //发货时间
+            if (!string.IsNullOrEmpty(SendDateData))
+            {
+                string[] datelist = SendDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                SqlString += " and SendDate>='" + start + " 00:00:00' and SendDate<='" + end + " 23:59:59'";
+            }
+            var Sql = "SELECT c.MakerCode '创客编号',c.RealName '创客姓名',DATE_FORMAT(c.CreateDate,'%Y-%m-%d %H:%i:%s') '创建时间',c.Remark '变动类型',c.Type1Num '电签兑换券张数',c.Type2Num '大POS兑换券张数',d.LeaderBalanceAmount '可提现余额',c.ChangeAmt '使用额度',c.BeforeAmt '使用前剩余额度',c.AfterAmt '使用后剩余额度' FROM(SELECT a.*,b.MakerCode,b.RealName FROM(SELECT Id,UserId,CreateDate,ChangeAmt,BeforeAmt,AfterAmt,Remark,REPLACE (JSON_EXTRACT (SeoTitle, '$[0].Num'),'\\\"','') AS 'Type1Num', REPLACE (JSON_EXTRACT (SeoTitle, '$[1].Num'),'\\\"','') AS 'Type2Num' FROM LeaderReserveRecord WHERE 1=1 " + SqlString + ") a LEFT JOIN Users b ON a.UserId=b.Id) c LEFT JOIN UserAccount d ON c.UserId=d.Id";
+            var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
+            var FileName = "盟主储蓄金变动记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
+            RedisDbconn.Instance.AddList("ExportQueue", SendData);
+            return "success";
+        }
+        #endregion
+
+
         #region 查询直推奖励100
 
         public Dictionary<string, string> Prize100(int Id)

+ 122 - 60
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -1454,7 +1454,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 仓库列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult StatDo(string CreateDateData, int page = 1, int limit = 30)
+        public JsonResult StatDo(string MakerCode, string StoreNo, string CreateDateData, int page = 1, int limit = 30)
         {
             OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
             string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
@@ -1475,6 +1475,15 @@ namespace MySystem.Areas.Admin.Controllers
 
                 return Json(nodata);
             }
+            var condtion = "";
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condtion += "and MakerCode='" + MakerCode + "'";
+            }
+            if (!string.IsNullOrEmpty(StoreNo))
+            {
+                condtion += "and StoreNo='" + StoreNo + "'";
+            }
             string minId = "0";
             string maxId = "0";
             string minPosId = "0";
@@ -1505,33 +1514,35 @@ namespace MySystem.Areas.Admin.Controllers
                     }
                 }
             }
-            DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
-            if (startPosDt.Rows.Count > 0)
-            {
-                minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
-                if (minPosId == "0")
-                {
-                    startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
-                    if (startPosDt.Rows.Count > 0)
-                    {
-                        minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
-                    }
-                }
-            }
-            DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
-            if (endPosDt.Rows.Count > 0)
-            {
-                maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
-                if (maxPosId == "0")
-                {
-                    endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
-                    if (endPosDt.Rows.Count > 0)
-                    {
-                        maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
-                    }
-                }
-            }
-            DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.RealName,u.Mobile,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2,(select count(Id) from PosMachinesTwo where Id>=" + minPosId + " and Id<=" + maxPosId + " and ActivationState=1 and ActivationTime>='" + sCreateDate + "' and ActivationTime<='" + eCreateDate + "' and StoreId=s.Id) as c3 from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id) tb where c1>0 or c2>0 or c3>0");
+            // DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
+            // if (startPosDt.Rows.Count > 0)
+            // {
+            //     minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
+            //     if (minPosId == "0")
+            //     {
+            //         startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
+            //         if (startPosDt.Rows.Count > 0)
+            //         {
+            //             minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
+            //         }
+            //     }
+            // }
+            // DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
+            // if (endPosDt.Rows.Count > 0)
+            // {
+            //     maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
+            //     if (maxPosId == "0")
+            //     {
+            //         endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
+            //         if (endPosDt.Rows.Count > 0)
+            //         {
+            //             maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
+            //         }
+            //     }
+            // }
+            // DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.RealName,u.Mobile,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2,(select count(Id) from PosMachinesTwo where Id>=" + minPosId + " and Id<=" + maxPosId + " and ActivationState=1 and ActivationTime>='" + sCreateDate + "' and ActivationTime<='" + eCreateDate + "' and StoreId=s.Id) as c3 from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id) tb where (c1>0 or c2>0 or c3>0) " + condtion);
+
+            DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.MakerCode,u.RealName,u.Mobile,s.ManageMobile,s.Address,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1, (select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2, (select ActCount from KxsStatServer.StoreAct202211 where StoreId=s.Id) as c3, ua.FixedAmount, ua.ValidAmount, ua.TempAmount, (select sum(PromissAmount) from StoreHouseAmountPromiss where ToUserId=s.UserId and `Status`=1) as PromissAmount from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id left join UserAccount ua on s.UserId=ua.Id) tb where (c1>0 or c2>0 or c3>0)" + condtion + "");
 
             int recordcount = list.Rows.Count;
             List<Dictionary<string, object>> diclist = new List<Dictionary<string, object>>();
@@ -1567,7 +1578,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult StatExportExcel(string CreateDateData)
+        public JsonResult StatExportExcel(string MakerCode, string StoreNo, string CreateDateData)
         {
             OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
             string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
@@ -1590,7 +1601,7 @@ namespace MySystem.Areas.Admin.Controllers
                 NoDataReturnFields.Add("Mobile", "仓库所属人手机号");
                 NoDataReturnFields.Add("RealName", "仓库所属人名称");
                 NoDataReturnFields.Add("MakerCode", "仓库所属人编码");
-                NoDataReturnFields.Add("ManageMakerCode", "仓库管理员编码");
+                // NoDataReturnFields.Add("ManageMakerCode", "仓库管理员编码");
                 NoDataReturnFields.Add("Name", "品牌");
                 NoDataReturnFields.Add("LaveNum", "当前库存");
                 NoDataReturnFields.Add("c1", "出库(调拨)量");
@@ -1599,6 +1610,16 @@ namespace MySystem.Areas.Admin.Controllers
                 nodata.Add("Fields", NoDataReturnFields);
                 return Json(nodata);
             }
+
+            var condtion = "";
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condtion += "and MakerCode='" + MakerCode + "'";
+            }
+            if (!string.IsNullOrEmpty(StoreNo))
+            {
+                condtion += "and StoreNo='" + StoreNo + "'";
+            }
             string minId = "0";
             string maxId = "0";
             string minPosId = "0";
@@ -1629,34 +1650,7 @@ namespace MySystem.Areas.Admin.Controllers
                     }
                 }
             }
-            DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
-            if (startPosDt.Rows.Count > 0)
-            {
-                minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
-                if (minPosId == "0")
-                {
-                    startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
-                    if (startPosDt.Rows.Count > 0)
-                    {
-                        minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
-                    }
-                }
-            }
-            DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
-            if (endPosDt.Rows.Count > 0)
-            {
-                maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
-                if (maxPosId == "0")
-                {
-                    endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
-                    if (endPosDt.Rows.Count > 0)
-                    {
-                        maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
-                    }
-                }
-            }
-            DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.RealName,u.Mobile,u.MakerCode,(select MakerCode from Users where Id=s.ManageUserId) as ManageMakerCode,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2,(select count(Id) from PosMachinesTwo where Id>=" + minPosId + " and Id<=" + maxPosId + " and ActivationState=1 and ActivationTime>='" + sCreateDate + "' and ActivationTime<='" + eCreateDate + "' and StoreId=s.Id) as c3 from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id) tb where c1>0 or c2>0 or c3>0");
-
+            DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.MakerCode,u.RealName,u.Mobile,s.ManageMobile,s.Address,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1, (select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2, (select ActCount from KxsStatServer.StoreAct202211 where StoreId=s.Id) as c3, ua.FixedAmount, ua.ValidAmount, ua.TempAmount, (select sum(PromissAmount) from StoreHouseAmountPromiss where ToUserId=s.UserId and `Status`=1) as PromissAmount from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id left join UserAccount ua on s.UserId=ua.Id) tb where (c1>0 or c2>0 or c3>0)" + condtion + "");
             int recordcount = list.Rows.Count;
             List<Dictionary<string, object>> diclist = new List<Dictionary<string, object>>();
             foreach (DataRow sub in list.Rows)
@@ -1667,7 +1661,7 @@ namespace MySystem.Areas.Admin.Controllers
                 row.Add("Mobile", sub["Mobile"].ToString());
                 row.Add("RealName", sub["RealName"].ToString());
                 row.Add("MakerCode", sub["MakerCode"].ToString());
-                row.Add("ManageMakerCode", sub["ManageMakerCode"].ToString());
+                // row.Add("ManageMakerCode", sub["ManageMakerCode"].ToString());
                 row.Add("Name", sub["Name"].ToString());
                 row.Add("LaveNum", sub["LaveNum"].ToString());
                 row.Add("c1", sub["c1"].ToString());
@@ -1686,7 +1680,7 @@ namespace MySystem.Areas.Admin.Controllers
             ReturnFields.Add("Mobile", "仓库所属人手机号");
             ReturnFields.Add("RealName", "仓库所属人名称");
             ReturnFields.Add("MakerCode", "仓库所属人编码");
-            ReturnFields.Add("ManageMakerCode", "仓库管理员编码");
+            // ReturnFields.Add("ManageMakerCode", "仓库管理员编码");
             ReturnFields.Add("Name", "品牌");
             ReturnFields.Add("LaveNum", "当前库存");
             ReturnFields.Add("c1", "出库(调拨)量");
@@ -1700,6 +1694,74 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        #region 快捷导出Excel
+        public IActionResult StatQuickExportExcel(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string StatQuickExportExcelDo(string MakerCode, string StoreNo, string CreateDateData)
+        {
+
+            string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
+            string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                sCreateDate = datelist[0] + " 00:00:00";
+                eCreateDate = datelist[1] + " 23:59:59";
+            }
+            var condtion = "";
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condtion += "and MakerCode='" + MakerCode + "'";
+            }
+            if (!string.IsNullOrEmpty(StoreNo))
+            {
+                condtion += "and StoreNo='" + StoreNo + "'";
+            }
+            string minId = "0";
+            string maxId = "0";
+            DataTable startDt = OtherMySqlConn.dtable("select min(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
+            if (startDt.Rows.Count > 0)
+            {
+                minId = function.CheckInt(startDt.Rows[0][0].ToString());
+                if (minId == "0")
+                {
+                    startDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
+                    if (startDt.Rows.Count > 0)
+                    {
+                        minId = function.CheckInt(startDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
+            if (endDt.Rows.Count > 0)
+            {
+                maxId = function.CheckInt(endDt.Rows[0][0].ToString());
+                if (minId == "0")
+                {
+                    endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
+                    if (endDt.Rows.Count > 0)
+                    {
+                        maxId = function.CheckInt(endDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            var Sql = "select * from (select s.StoreName '仓库名称',s.StoreNo '仓库编号',u.MakerCode '仓库所属人编码',u.RealName '仓库所属人名称',u.Mobile '仓库所属人手机号',s.ManageMobile '仓库管理员手机号',s.Address '地址',k.Name '品牌',s.LaveNum '当前库存',(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1 '出库(调拨)量', (select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2 '出货(发货到创客)量', (select ActCount from KxsStatServer.StoreAct202211 where StoreId=s.Id) as c3 '激活量', ua.FixedAmount '固定额度', ua.ValidAmount '可用额度', ua.TempAmount '临时额度', (select sum(PromissAmount) from StoreHouseAmountPromiss where ToUserId=s.UserId and `Status`=1) as PromissAmount '担保额度' from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id left join UserAccount ua on s.UserId=ua.Id) tb where (c1>0 or c2>0 or c3>0)" + condtion + "";
+            var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
+            var FileName = "仓库统计管理记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
+            RedisDbconn.Instance.AddList("ExportQueue", SendData);
+            return "success";
+        }
+        #endregion
+
+
         #region 同步数据
 
         /// <summary>

+ 79 - 0
Areas/Admin/Controllers/MainServer/UserAccountRecordController.cs

@@ -649,5 +649,84 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+        #region 快捷导出Excel
+        public IActionResult QuickExportExcel(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string QuickExportExcelDo(int ChangeType, int ProductType, string TransRecordNo, string MakerCode, string RealName, string CreateDateData)
+        {
+
+            string SqlString = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                SqlString += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                SqlString += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+            }
+            if (ChangeType > 0)
+            {
+                if (ChangeType == 1)
+                {
+                    SqlString += " and (ChangeType=" + ChangeType + " or (ChangeType in(112,1) and ProductType=101))";
+                }
+                else if (ChangeType == 30)
+                {
+                    SqlString += " and ChangeType=31 and Remark='开机抢红包活动'";
+                }
+                else if (ChangeType == 31)
+                {
+                    SqlString += " and (ChangeType=" + ChangeType + " and (Remark!='开机抢红包活动' or Remark IS NULL))";
+                }
+                else
+                {
+                    SqlString += " and ChangeType=" + ChangeType;
+                }
+            }
+            if (ProductType > 0)
+            {
+                SqlString += " and ProductType=" + ProductType;
+            }
+            if (!string.IsNullOrEmpty(TransRecordNo))
+            {
+                SqlString += " and TransRecordNo='" + TransRecordNo + "'";
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                var start = Convert.ToDateTime(Convert.ToDateTime(datelist[0]).ToString("yyyy-MM-dd"));
+                var end = Convert.ToDateTime(Convert.ToDateTime(datelist[1]).ToString("yyyy-MM-dd") + " 23:59:59");
+                var check = db.UserAccountRecord.Any(m => m.CreateDate >= start);
+                var checks = db.UserAccountRecord.Any(m => m.CreateDate <= end);
+                if (check)
+                {
+                    var sId = db.UserAccountRecord.Where(m => m.CreateDate >= start).Min(m => m.Id);
+                    SqlString += "  and Id >=" + sId;
+                }
+                if (checks)
+                {
+                    var eId = db.UserAccountRecord.Where(m => m.CreateDate <= end).Max(m => m.Id);
+                    SqlString += " and Id <=" + eId;
+                }
+            }
+            var Sql = "SELECT c.MakerCode '创客编号',c.RealName '创客姓名',DATE_FORMAT(c.CreateDate,'%Y-%m-%d %H:%i:%s') '创建时间',c.Remark '变动类型',c.Type1Num '电签兑换券张数',c.Type2Num '大POS兑换券张数',d.LeaderBalanceAmount '可提现余额',c.ChangeAmt '使用额度',c.BeforeAmt '使用前剩余额度',c.AfterAmt '使用后剩余额度' FROM(SELECT a.*,b.MakerCode,b.RealName FROM(SELECT Id,UserId,CreateDate,ChangeAmt,BeforeAmt,AfterAmt,Remark,REPLACE (JSON_EXTRACT (SeoTitle, '$[0].Num'),'\\\"','') AS 'Type1Num', REPLACE (JSON_EXTRACT (SeoTitle, '$[1].Num'),'\\\"','') AS 'Type2Num' FROM LeaderReserveRecord WHERE 1=1 " + SqlString + ") a LEFT JOIN Users b ON a.UserId=b.Id) c LEFT JOIN UserAccount d ON c.UserId=d.Id";
+            var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
+            var FileName = "盟主储蓄金变动记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
+            RedisDbconn.Instance.AddList("ExportQueue", SendData);
+            return "success";
+        }
+        #endregion
+
     }
 }

+ 23 - 25
Areas/Admin/Views/MainServer/StoreHouse/Stat.cshtml

@@ -3,64 +3,60 @@
     string right = ViewBag.right as string;
     string MakerCode = ViewBag.MakerCode as string;
 
-    
+
 }
 <!DOCTYPE html>
 <html>
+
 <head>
     <meta charset="utf-8">
     <title>仓库</title>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <meta name="viewport"
+        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
     <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
     <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
     <script src="/admin/js/jquery-1.10.1.min.js"></script>
     <style>
-        .layui-input-inline{
+        .layui-input-inline {
             width: 175px !important;
         }
-        .layui-form-label{
+
+        .layui-form-label {
             width: 128px !important;
         }
-        .layui-inline{
+
+        .layui-inline {
             margin-right: 0px !important;
         }
-        .w100{
+
+        .w100 {
             width: 100px !important;
         }
-        .ml50{
+
+        .ml50 {
             margin-left: 50px !important;
         }
     </style>
 </head>
+
 <body>
     <div class="layui-fluid">
         <div class="layui-card">
             <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                 <div class="layui-form-item">
                     <div class="layui-inline">
-                            <label class="layui-form-label">创客编号</label>
-                            <div class="layui-input-inline">
-                                <input class="layui-input" type="text" name="MakerCode" value="@MakerCode" autocomplete="off">
-                            </div>
-                        </div>
-                        <div class="layui-inline">
-                            <label class="layui-form-label">创客名称</label>
-                            <div class="layui-input-inline">
-                                <input class="layui-input" type="text" name="RealName" autocomplete="off">
-                            </div>
-                        </div>
-                    <div class="layui-inline">
-                        <label class="layui-form-label">仓库编号</label>
+                        <label class="layui-form-label">创客编号</label>
                         <div class="layui-input-inline">
-                            <input class="layui-input" type="text" name="StoreNo" placeholder="" autocomplete="off">
+                            <input class="layui-input" type="text" name="MakerCode" value="@MakerCode"
+                                autocomplete="off">
                         </div>
                     </div>
                     <div class="layui-inline">
-                        <label class="layui-form-label">仓库名称</label>
+                        <label class="layui-form-label">仓库编号</label>
                         <div class="layui-input-inline">
-                            <input class="layui-input" type="text" name="StoreName" placeholder="" autocomplete="off">
+                            <input class="layui-input" type="text" name="StoreNo" placeholder="" autocomplete="off">
                         </div>
                     </div>
                     <div class="layui-inline">
@@ -83,8 +79,9 @@
 
             <div class="layui-card-body">
                 <div style="padding-bottom: 10px;">
-                    <button class="layui-btn" data-type="ExportExcel"><i class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出</button>
-                </div>                
+                    <button class="layui-btn" data-type="ExportExcel"><i
+                            class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出</button>
+                </div>
                 <table id="LAY-list-manage" lay-filter="LAY-list-manage"></table>
             </div>
         </div>
@@ -96,4 +93,5 @@
         var MakerCode = '@MakerCode';
     </script>
 </body>
+
 </html>

+ 1 - 1
wwwroot/layuiadmin/modules_main/LeaderReserveRecord_Admin.js

@@ -354,7 +354,7 @@ layui.config({
                         layer.close(index); //关闭弹层
                         if (data == "success") {
                             layer.close(indexs); //关闭弹层
-                            layer.msg('导出成功,请在我的下载中点击下载', {
+                            layer.msg('导出成功,请到我的下载中点击下载文件', {
                                 time: 1000
                             }, function () {
                                 window.location.reload();

+ 35 - 10
wwwroot/layuiadmin/modules_main/StoreHouseStat_Admin.js

@@ -555,16 +555,41 @@ layui.config({
             $(".layuiadmin-card-header-auto select").each(function (i) {
                 userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
             });
-            $.ajax({
-                type: "GET",
-                url: "/Admin/StoreHouse/StatExportExcel?r=" + Math.random(1),
-                data: userdata,
-                dataType: "json",
-                success: function (data) {
-                    data.Obj.unshift(data.Fields);
-                    excel.exportExcel(data.Obj, data.Info, 'xlsx');
-                    layer.close(loadindex);
-                }
+            // $.ajax({
+            //     type: "GET",
+            //     url: "/Admin/StoreHouse/StatExportExcel?r=" + Math.random(1),
+            //     data: userdata,
+            //     dataType: "json",
+            //     success: function (data) {
+            //         data.Obj.unshift(data.Fields);
+            //         excel.exportExcel(data.Obj, data.Info, 'xlsx');
+            //         layer.close(loadindex);
+            //     }
+            // });
+            var index = layer.confirm('确定导出吗?', function (index) {
+                var indexs = layer.load(1, {
+                    shade: [0.5, '#000']
+                });
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/StoreHouse/StatQuickExportExcelDo?r=" + Math.random(1),
+                    data: userdata,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index); //关闭弹层
+                        if (data == "success") {
+                            layer.close(indexs); //关闭弹层
+                            layer.msg('导出成功,请到我的下载中点击下载文件', {
+                                time: 1000
+                            }, function () {
+                                window.location.reload();
+                            });
+                        } else {
+                            layer.close(indexs); //关闭弹层
+                            layer.msg(data);
+                        }
+                    }
+                });
             });
         },
         Open: function () {