From dcecb039035f4b2e82e31c39b74db9402444c536 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 08 四月 2025 21:35:39 +0800
Subject: [PATCH] 代码更新,优化等内容

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index 3b27aa4..cf79150 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -7,9 +7,11 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Dynamic;
 using System.Globalization;
 using System.Linq;
 using System.Linq.Expressions;
+using System.Reflection;
 using System.Reflection.Metadata;
 using System.Text;
 using System.Threading.Tasks;
@@ -73,6 +75,39 @@
             _invokeERPService = invokeERPService;
             _warehouseService = warehouseService;
             _palletTypeInfoRepository = palletTypeInfoRepository;
+        }
+        public override object GetDetailPage(PageDataOptions pageData)
+        {
+            Type t = typeof(Dt_InboundOrder);
+
+            if (pageData.Value == null) return new PageGridData<object>(total: 0, null);
+            string keyName = t.GetKeyName();
+            ////鐢熸垚鏌ヨ鏉′欢
+            //Expression<Func<TEntity, bool>> whereExpression = keyName.CreateExpression<TEntity>(pageData.Value, LinqExpressionType.Equal);
+            int totalCount = 0;
+            PropertyInfo propertyInfo = t.GetProperties().FirstOrDefault(x => x.GetCustomAttribute<Navigate>() != null);
+            if (propertyInfo != null)
+            {
+                Type detailType = propertyInfo.PropertyType.GetGenericArguments()[0];
+                Navigate navigate = propertyInfo.GetCustomAttribute<Navigate>();
+                List<Dt_InboundOrderDetail> list = BaseDal.Db.Queryable<Dt_InboundOrderDetail>().Where(navigate.GetName(), "=", pageData.Value).ToPageList(pageData.Page, pageData.Rows, ref totalCount);
+                decimal sum = 0;
+                list.ForEach(x =>
+                {
+                    sum += Convert.ToDecimal(x.OrderQuantity);
+                });
+                PageGridData<Dt_InboundOrderDetail> pageGridData = new PageGridData<Dt_InboundOrderDetail>()
+                {
+                    Total= totalCount,
+                    Rows=list,
+                    Summary=new
+                    {
+                        OrderQuantity = Math.Round(sum, 3),
+                    }
+                };
+                return pageGridData;
+            }
+            return new PageGridData<object>(total: 0, null);
         }
         /// <summary>
         /// 鍏朵粬鍏ュ簱鍗曟帴鏀�(璋冩嫈鍏ヤ粨,瀹緵鍥炴敹,鐗╂枡閿�鍞��璐�)
@@ -240,11 +275,11 @@
                 List<Dt_InboundOrder> dt_ReceiveOrders = new List<Dt_InboundOrder>();
                 if (string.IsNullOrEmpty(orderNo))
                 {
-                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5);
+                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).Includes(x=>x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10);
                 }
                 else
                 {
-                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5);
+                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10);
                 }
 
                 content.OK(data: dt_ReceiveOrders);

--
Gitblit v1.9.3