From ee6b82936b52250e46b57fcf12484a6f40c4dc50 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期二, 02 十二月 2025 15:06:18 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs |   74 +++++++++++++++++++++++++++++++++++-
 1 files changed, 71 insertions(+), 3 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/AllocateService.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/AllocateService.cs"
index dabfebd..2a28e3e 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/AllocateService.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/AllocateService.cs"
@@ -5,7 +5,9 @@
 using SqlSugar.Extensions;
 using System;
 using System.Collections.Generic;
+using System.Dynamic;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common.AllocateEnum;
@@ -16,6 +18,7 @@
 using WIDESEA_Core.CodeConfigEnum;
 using WIDESEA_Core.DB;
 using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
 using WIDESEA_Core.Seed;
 using WIDESEA_IAllocateService;
 using WIDESEA_IInboundService;
@@ -34,6 +37,8 @@
         public readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
         public readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository;
 
+        public readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
+
         private readonly ILogger<AllocateService> _logger;
         public AllocateService(IRepository<Dt_AllocateOrder> BaseDal,
             IUnitOfWorkManage unitOfWorkManage,
@@ -41,6 +46,7 @@
             IOutboundService outboundService,
             IRepository<Dt_AllocateOrder> allocateOrderRepository,
             IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository,
+            IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository,
             ILogger<AllocateService> logger) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
@@ -49,6 +55,7 @@
             _allocateOrderRepository = allocateOrderRepository;
             _allocateOrderDetailRepository = allocateOrderDetailRepository;
             _logger = logger;
+            _inboundOrderDetailRepository = inboundOrderDetailRepository;
         }
 
         public IRepository<Dt_AllocateOrder> Repository => BaseDal;
@@ -99,7 +106,7 @@
             {
                 if (businessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�)
                 {
-                    allocateOrder.OrderType = InOrderTypeEnum.AllocatInbound.ObjToInt();
+                    allocateOrder.OrderType = (int)InOrderTypeEnum.AllocatInbound;
                     var inboundOrders = ConvertToInboundOrders(allocateOrder);
                     await _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
                 }
@@ -107,11 +114,11 @@
                 {
                     if (businessType == BusinessTypeEnum.鏅轰粨璋冨閮ㄤ粨搴�)
                     {
-                        allocateOrder.OrderType = InOrderTypeEnum.AllocatOutbound.ObjToInt();
+                        allocateOrder.OrderType = (int)InOrderTypeEnum.AllocatOutbound;
                     }
                     else if (businessType == BusinessTypeEnum.鏅轰粨璋冩櫤浠�)
                     {
-                        allocateOrder.OrderType = InOrderTypeEnum.InternalAllocat.ObjToInt();
+                        allocateOrder.OrderType = (int)InOrderTypeEnum.InternalAllocat;
                     }
 
                     var outboundOrders = ConvertToOutboundOrders(allocateOrder);
@@ -431,5 +438,66 @@
                 return code;
             }
         }
+
+        public override PageGridData<Dt_InboundOrderDetail> 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);
+            }
+
+
+            int totalCount = 0;
+            List<SearchParameters> searchParametersList = new List<SearchParameters>();
+            if (!string.IsNullOrEmpty(options.Wheres))
+            {
+                try
+                {
+                    searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                    options.Filter = searchParametersList;
+                }
+                catch { }
+            }
+            //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 == (int)options.Value);
+            Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First();
+
+            var data = BaseDal.Db.Queryable<Dt_InboundOrderDetail>()
+                .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+                .WhereIF(!_InboundOrder.IsNullOrEmpty(), x => x.OrderId == _InboundOrder.Id)
+                .OrderBy(orderByModels)
+                .ToPageList(options.Page, options.Rows, ref totalCount);
+
+
+            return new PageGridData<Dt_InboundOrderDetail>(totalCount, data);
+        }
     }
 }

--
Gitblit v1.9.3