From cd7253920c5e597f6a8eefe813dd039bf1a5894b Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期日, 07 十二月 2025 13:44:08 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateDetailService.cs |   73 +++++++++++++++++++++++++++---------
 1 files changed, 54 insertions(+), 19 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateDetailService.cs"
index 16ac24f..cd2b75e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateDetailService.cs"
@@ -15,37 +15,72 @@
 {
     public class AllocateDetailService : ServiceBase<Dt_AllocateOrderDetail, IRepository<Dt_AllocateOrderDetail>>, IAllocateDetailService
     {
-        public AllocateDetailService(IRepository<Dt_AllocateOrderDetail> BaseDal) : base(BaseDal)
+        public readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
+        public AllocateDetailService(IRepository<Dt_AllocateOrderDetail> BaseDal, IRepository<Dt_AllocateOrder> allocateOrderRepository) : base(BaseDal)
         {
+            _allocateOrderRepository = allocateOrderRepository;
         }
 
         IRepository<Dt_AllocateOrderDetail> IAllocateDetailService.Repository => BaseDal;
 
-        public override PageGridData<Dt_AllocateOrderDetail> GetPageData(PageDataOptions options)
+        public override PageGridData<Dt_OutboundOrderDetail> GetDetailPage(PageDataOptions options)
         {
+            string wheres = ValidatePageOptions(options);
+            //鑾峰彇鎺掑簭瀛楁
+            Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
+            List<OrderByModel> orderByModels = new List<OrderByModel>();
+            foreach (var item in orderbyDic)
+            {
+                OrderByModel orderByModel = new()
+                {
+                    FieldName = item.Key,
+                    OrderByType = item.Value
+                };
+                orderByModels.Add(orderByModel);
+            }
 
-            ISugarQueryable<Dt_AllocateOrderDetail> sugarQueryable1 = BaseDal.Db.Queryable<Dt_AllocateOrderDetail>();
+
+            int totalCount = 0;
+            List<SearchParameters> searchParametersList = new List<SearchParameters>();
             if (!string.IsNullOrEmpty(options.Wheres))
             {
-
-                List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
-                int totalCount = 0;
-                if (searchParametersList.Count > 0)
+                try
                 {
-                    {
-                        SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_AllocateOrderDetail.OrderId).FirstLetterToLower());
-                        if (searchParameters != null)
-                        {
-                            sugarQueryable1 = sugarQueryable1.Where(x => x.OrderId == searchParameters.Value.ObjToInt());
-                            var dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount);
-                            return new PageGridData<Dt_AllocateOrderDetail>(totalCount, dataList);
-                        }
-                    }
-
-
+                    searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                    options.Filter = searchParametersList;
                 }
+                catch { }
             }
-            return new PageGridData<Dt_AllocateOrderDetail>();
+            //var data = BaseDal.Db.Queryable<Dt_AllocateOrderDetail>()
+            //    .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+            //    .OrderBy(orderByModels)
+            //    .ToPageList(options.Page, options.Rows, ref totalCount);
+            //Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == (int)options.Value);
+            //Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First();
+            //var details = _inboundOrderDetailRepository.QueryData(x => x.OrderId == _InboundOrder.Id );
+            //foreach (var item in data)
+            //{
+            //    var detail = details.Where(x => x.MaterielCode == item.MaterielCode).FirstOrDefault();
+            //    if (detail != null)
+            //    {
+            //        item.OrderQuantity = detail.OrderQuantity;
+            //        item.ReceiptQuantity = detail.ReceiptQuantity;
+            //        item.OverInQuantity = detail.OverInQuantity;
+            //        item.OrderDetailStatus = detail.OrderDetailStatus;
+            //    }
+            //}
+            //return new PageGridData<Dt_AllocateOrderDetail>(totalCount, data);
+
+            Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == options.Filter.FirstOrDefault().Value.ObjToInt());
+            Dt_OutboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First();
+
+            var data = BaseDal.Db.Queryable<Dt_OutboundOrderDetail>()
+                .WhereIF(!_InboundOrder.IsNullOrEmpty(), x => x.OrderId == _InboundOrder.Id)
+                .OrderBy(orderByModels)
+                .ToPageList(options.Page, options.Rows, ref totalCount);
+
+
+            return new PageGridData<Dt_OutboundOrderDetail>(totalCount, data);
         }
     }
 }

--
Gitblit v1.9.3