From 7f26cd7c3e492062418cdc7dbe9d7ce14cbe5f05 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 26 六月 2024 11:47:37 +0800
Subject: [PATCH] 铺货修改

---
 CoreCms.Net.Repository/baifenbingfa/PuhuoRepository.cs |   54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/CoreCms.Net.Repository/baifenbingfa/PuhuoRepository.cs b/CoreCms.Net.Repository/baifenbingfa/PuhuoRepository.cs
index bc78e62..e159d1f 100644
--- a/CoreCms.Net.Repository/baifenbingfa/PuhuoRepository.cs
+++ b/CoreCms.Net.Repository/baifenbingfa/PuhuoRepository.cs
@@ -89,7 +89,9 @@
             oldModel.createBy = entity.createBy;
             oldModel.upDataBy = entity.upDataBy;
             oldModel.isdelete = entity.isdelete;
-            
+            oldModel.shoukuannums = entity.shoukuannums;
+            oldModel.shoukuanamount = entity.shoukuanamount;
+
             //浜嬬墿澶勭悊杩囩▼缁撴潫
             var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
             jm.code = bl ? 0 : 1;
@@ -196,7 +198,7 @@
                 goodsId = p.goodsId,
                 goodsName = p.goodsName,
                 productsId = p.productsId,
-                productsName = p.productsName,
+                productsName = p.productsName +" " + p.spesDesc,
                 spesDesc = p.spesDesc,
                 price = p.price,
                 nums = p.nums,
@@ -225,7 +227,7 @@
                 goodsId = p.goodsId,
                 goodsName = p.goodsName,
                 productsId = p.productsId,
-                productsName = p.productsName,
+                productsName = p.productsName + " " + p.spesDesc,
                 spesDesc = p.spesDesc,
                 price = p.price,
                 nums = p.nums,
@@ -238,6 +240,16 @@
                 
                 }).ToPageListAsync(pageIndex, pageSize, totalCount);
             }
+
+            foreach (var puhuo  in page)
+            {
+              var distribution = await  DbClient.Queryable<CoreCmsDistribution>().In(puhuo.distributionId).WithNoLockOrNot(blUseNoLock).WithCacheIF(false).SingleAsync();
+                if (distribution !=null)
+                {
+                    puhuo.schoolName = distribution.schoolName;
+                }
+            }
+
             var list = new PageList<Puhuo>(page, pageIndex, pageSize, totalCount);
             return list;
         }
@@ -259,7 +271,7 @@
         /// <param name="blUseNoLock">鏄惁浣跨敤WITH(NOLOCK)</param>
         /// <returns></returns>
         public async Task<IPageList<Puhuo>> QueryPageGroupAsync(Expression<Func<Puhuo, bool>> predicate,
-            Expression<Func<Puhuo, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+            Expression<Func<Puhuo, object>> orderByExpression, OrderByType orderByType, OtherData otherData, int pageIndex = 1,
             int pageSize = 20, bool blUseNoLock = false)
         {
             RefAsync<int> totalCount = 0;
@@ -267,7 +279,7 @@
             if (blUseNoLock)
             {
                 page = await DbClient.Queryable<Puhuo>()
-                .GroupBy(it => new {  it.CategoryId, it.CategoryName, it.goodsId, it.goodsName, it.productsId, it.productsName, it.price })
+                .GroupBy(it => new {  it.CategoryId, it.CategoryName, it.goodsId, it.goodsName, it.productsId, it.productsName, it.price ,it.spesDesc })
                 .WhereIF(predicate != null, predicate)
                 .Select(p => new Puhuo
                 {
@@ -278,7 +290,7 @@
                     goodsId = p.goodsId,
                     goodsName = p.goodsName,
                     productsId = p.productsId,
-                    productsName = p.productsName,
+                    productsName =  p.productsName + " " + p.spesDesc,
                     price = p.price,
                     tiaozhengnums =SqlFunc.AggregateCount(p.id),
                     nums =  SqlFunc.AggregateSum(p.nums),
@@ -289,6 +301,9 @@
                .MergeTable()//闇�瑕佸姞MergeTable鎵嶈兘鎺掑簭缁熻杩囩殑鍒�
                 .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
                 .With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
+
+
+               
             }
             else
             {
@@ -303,7 +318,7 @@
                      goodsId = p.goodsId,
                      goodsName = p.goodsName,
                      productsId = p.productsId,
-                     productsName = p.productsName,
+                     productsName = p.productsName + " " + p.spesDesc,
                      price = p.price,
                      tiaozhengnums = SqlFunc.AggregateCount(p.id),
                      nums = SqlFunc.AggregateSum(p.nums),
@@ -315,6 +330,31 @@
                  .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
                  .ToPageListAsync(pageIndex, pageSize, totalCount);
             }
+
+
+            var pagetotal = DbClient.Queryable<Puhuo>()
+               // .GroupBy(it => new { it.CategoryId, it.CategoryName, it.goodsId, it.goodsName, it.productsId, it.productsName, it.price })
+               .WhereIF(predicate != null, predicate)
+               .Select(p => new Puhuo
+               {
+                   tiaozhengnums = SqlFunc.AggregateCount(p.id),
+                   nums = SqlFunc.AggregateSum(p.nums),
+                   amount = SqlFunc.AggregateSum(p.amount),
+               })
+                 .First(); // 鎴栬�呬娇鐢� Single/FirstOrDefault 绛夋柟娉曡幏鍙栫粨鏋�
+              //.Select(p => new Puhuo
+              //{
+              //    tiaozhengnums = SqlFunc.AggregateCount(p.id),
+              //    nums = SqlFunc.AggregateSum(p.nums),
+              //    amount = SqlFunc.AggregateSum(p.amount),
+
+
+            //});
+
+            otherData.heji4 = pagetotal.nums;
+            otherData.heji5 = pagetotal.amount;
+            otherData.heji6 = pagetotal.tiaozhengnums;
+
             var list = new PageList<Puhuo>(page, pageIndex, pageSize, totalCount);
             return list;
         }

--
Gitblit v1.9.1