From a2f948006c6c7e918ba4f2e66d477cc2d5017a75 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期三, 10 十二月 2025 21:49:58 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs |  307 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 255 insertions(+), 52 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 c8ccfc4..89a2938 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"
@@ -1,18 +1,16 @@
-锘縰sing SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+锘縰sing Microsoft.Extensions.Logging;
+using SqlSugar;
 using WIDESEA_Common.AllocateEnum;
+using WIDESEA_Common.OrderEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 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_IBasicService;
 using WIDESEA_IInboundService;
 using WIDESEA_IOutboundService;
 using WIDESEA_Model.Models;
@@ -28,32 +26,42 @@
         public readonly IOutboundService _outboundService;
         public readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
         public readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository;
+        private readonly IMaterielInfoService _materielInfoService;
+        public readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
+
+        private readonly ILogger<AllocateService> _logger;
         public AllocateService(IRepository<Dt_AllocateOrder> BaseDal,
             IUnitOfWorkManage unitOfWorkManage,
             IInboundService inboundService,
             IOutboundService outboundService,
             IRepository<Dt_AllocateOrder> allocateOrderRepository,
-            IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository) : base(BaseDal)
+            IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository,
+            IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository,
+            ILogger<AllocateService> logger,
+            IMaterielInfoService materielInfoService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _inboundService = inboundService;
             _outboundService = outboundService;
             _allocateOrderRepository = allocateOrderRepository;
             _allocateOrderDetailRepository = allocateOrderDetailRepository;
+            _logger = logger;
+            _inboundOrderDetailRepository = inboundOrderDetailRepository;
+            _materielInfoService = materielInfoService;
         }
 
         public IRepository<Dt_AllocateOrder> Repository => BaseDal;
 
 
-        public WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType)
+        public async Task<WebResponseContent> ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType)
         {
             try
             {
                 return operateType switch
                 {
-                    1 => AddInboundOrder(allocateOrder),
-                    2 => UpdateInboundOrder(allocateOrder),
-                    3 => DeleteInboundOrder(allocateOrder),
+                    1 => await AddAllocateOrder(allocateOrder),
+                    2 => await UpdateAllocateOrder(allocateOrder),
+                    3 => await DeleteAllocateOrder(allocateOrder),
 
                     _ => WebResponseContent.Instance.OK(),
                 };
@@ -64,42 +72,68 @@
             }
         }
 
-        public WebResponseContent AddInboundOrder(Dt_AllocateOrder allocateOrder)
+        public async Task<WebResponseContent> AddAllocateOrder(Dt_AllocateOrder allocateOrder)
         {
             try
             {
                 if (BaseDal.QueryFirst(x => x.UpperOrderNo == allocateOrder.UpperOrderNo) != null)
                 {
-                    return WebResponseContent.Instance.Error($"璋冩嫧鍗曞彿閲嶅");
+                    return WebResponseContent.Instance.Error($"{allocateOrder.UpperOrderNo}璋冩嫧鍗曞彿閲嶅");
                 }
                 allocateOrder.OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.AllocateOrderCodeRule));
-                Db.InsertNav(allocateOrder).Include(x => x.Details).ExecuteCommand();
-                if (Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType))
+                var materielCodes = allocateOrder.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+                foreach (var item in allocateOrder.Details)
                 {
-                    if (businessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�)
+                    if (materielInfos.Any())
                     {
-                        var inboundOrders = ConvertToInboundOrders(allocateOrder);
-                        _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
-                    }
-                    else if (businessType == BusinessTypeEnum.鏅轰粨璋冨閮ㄤ粨搴�)
-                    {
-                        var outboundOrders = ConvertToOutboundOrders(allocateOrder);
-                        _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1);
-                    }
-                    else
-                    {
-                        // 澶勭悊鏈畾涔夌殑鏋氫妇鍊硷紙濡傛湭鏉ユ柊澧炰絾鏈疄鐜扮殑绫诲瀷锛�
-                        throw new NotSupportedException($"涓嶆敮鎸佺殑涓氬姟绫诲瀷鏋氫妇鍊�: {businessType}");
+                        item.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
                     }
                 }
+                Db.InsertNav(allocateOrder).Include(x => x.Details).ExecuteCommand();
+                await AddInOutData(allocateOrder);
                 return WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
             {
+                _logger.LogInformation("AllocateService AddAllocateOrder  err:  " + ex.Message);
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-        public WebResponseContent UpdateInboundOrder(Dt_AllocateOrder model)
+
+        private async Task AddInOutData(Dt_AllocateOrder allocateOrder)
+        {
+            if (Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType))
+            {
+                if (businessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�)
+                {
+                    allocateOrder.OrderType = (int)InOrderTypeEnum.AllocatInbound;
+                    var inboundOrders = ConvertToInboundOrders(allocateOrder);
+                    await _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
+                }
+                else if (businessType == BusinessTypeEnum.鏅轰粨璋冨閮ㄤ粨搴� || businessType == BusinessTypeEnum.鏅轰粨璋冩櫤浠�)
+                {
+                    if (businessType == BusinessTypeEnum.鏅轰粨璋冨閮ㄤ粨搴�)
+                    {
+                        allocateOrder.OrderType = (int)InOrderTypeEnum.AllocatOutbound;
+                    }
+                    else if (businessType == BusinessTypeEnum.鏅轰粨璋冩櫤浠�)
+                    {
+                        allocateOrder.OrderType = (int)InOrderTypeEnum.InternalAllocat;
+                    }
+
+                    var outboundOrders = ConvertToOutboundOrders(allocateOrder);
+                    await _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1);
+                }
+                else
+                {
+                    // 澶勭悊鏈畾涔夌殑鏋氫妇鍊硷紙濡傛湭鏉ユ柊澧炰絾鏈疄鐜扮殑绫诲瀷锛�
+                    throw new NotSupportedException($"涓嶆敮鎸佺殑涓氬姟绫诲瀷鏋氫妇鍊�: {businessType}");
+                }
+            }
+        }
+
+        public async Task<WebResponseContent> UpdateAllocateOrder(Dt_AllocateOrder model)
         {
             try
             {
@@ -115,13 +149,13 @@
                 List<Dt_AllocateOrderDetail> allocateOrderDetails = new List<Dt_AllocateOrderDetail>();
                 List<Dt_AllocateOrderDetail> updateAllocateOrderDetails = new List<Dt_AllocateOrderDetail>();
                 List<int> detailIds = new List<int>();
+
+                var materielCodes = allocateOrder.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+                
                 foreach (var item in model.Details)
                 {
-                    if (string.IsNullOrEmpty(item.Barcode))
-                    {
-
-                    }
-                    else
+                    if (!string.IsNullOrEmpty(item.Barcode))
                     {
                         Dt_AllocateOrderDetail? allocateOrderDetail = allocateOrder.Details.FirstOrDefault(x => x.Barcode == item.Barcode);
                         if (allocateOrderDetail == null)
@@ -139,6 +173,10 @@
                                 BarcodeQty = (decimal)item.BarcodeQty,
                                 OrderQuantity = item.OrderQuantity
                             };
+                            if (materielInfos.Any())
+                            {
+                                allocateOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                            }
                             allocateOrderDetails.Add(allocateOrderDetail);
                         }
                         else
@@ -152,7 +190,10 @@
                             allocateOrderDetail.BarcodeUnit = item.BarcodeUnit;
                             allocateOrderDetail.BarcodeQty = item.BarcodeQty;
                             allocateOrderDetail.OrderQuantity = item.OrderQuantity;
-
+                            if (materielInfos.Any())
+                            {
+                                allocateOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                            }
 
                             updateAllocateOrderDetails.Add(allocateOrderDetail);
                             detailIds.Add(allocateOrderDetail.Id);
@@ -170,13 +211,18 @@
                 _unitOfWorkManage.BeginTran();
                 foreach (var item in deletePurchaseOrderDetails)
                 {
-                    _allocateOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.鑷姩鍒犻櫎);
+                    // _allocateOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.鑷姩鍒犻櫎);
+                    _allocateOrderDetailRepository.DeleteData(item);
                 }
 
                 _allocateOrderDetailRepository.UpdateData(updateAllocateOrderDetails);
                 _allocateOrderDetailRepository.AddData(allocateOrderDetails);
 
                 BaseDal.UpdateData(allocateOrder);
+
+                DeleteInOutData(model.UpperOrderNo, allocateOrder);
+                await AddInOutData(allocateOrder);
+
                 _unitOfWorkManage.CommitTran();
 
 
@@ -185,11 +231,12 @@
             catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
+                _logger.LogInformation("AllocateService UpdateAllocateOrder  err:  " + ex.Message);
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
 
-        public WebResponseContent DeleteInboundOrder(Dt_AllocateOrder model)
+        public async Task<WebResponseContent> DeleteAllocateOrder(Dt_AllocateOrder model)
         {
             try
             {
@@ -202,7 +249,7 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒拌皟鎷ㄥ崟鏄庣粏淇℃伅");
                 }
-                //Db.DeleteNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+                //Db.DeleteNav(Allocate).Include(x => x.Details).ExecuteCommand();
                 _unitOfWorkManage.BeginTran();
                 // BaseDal.DeleteAndMoveIntoHty(allocateOrder, OperateTypeEnum.鑷姩鍒犻櫎);
                 foreach (var item in allocateOrder.Details)
@@ -211,18 +258,47 @@
                     _allocateOrderDetailRepository.DeleteData(item);
                 }
                 BaseDal.DeleteData(allocateOrder);
+
+                DeleteInOutData(model.UpperOrderNo, allocateOrder);
+
                 _unitOfWorkManage.CommitTran();
                 return WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
+                _logger.LogInformation("AllocateService DeleteAllocateOrder  err:  " + ex.Message);
                 return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+
+        private void DeleteInOutData(string upperOrderNo, Dt_AllocateOrder allocateOrder)
+        {
+            if (Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType))
+            {
+                if (businessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�)
+                {
+                    _inboundService.InbounOrderService.Db.Deleteable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == upperOrderNo).ExecuteCommand();
+
+                    _inboundService.InboundOrderDetailService.Db.Deleteable<Dt_InboundOrderDetail>()
+                     .Where(p => SqlFunc.Subqueryable<Dt_InboundOrder>().Where(s => s.Id == p.OrderId && s.UpperOrderNo == upperOrderNo).Any()).ExecuteCommand();
+                }
+                else if (businessType == BusinessTypeEnum.鏅轰粨璋冨閮ㄤ粨搴� || businessType == BusinessTypeEnum.鏅轰粨璋冩櫤浠�)
+                {
+                    _outboundService.OutboundOrderService.Db.Deleteable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == upperOrderNo).ExecuteCommand();
+                    _outboundService.OutboundOrderDetailService.Db.Deleteable<Dt_OutboundOrderDetail>()
+                     .Where(p => SqlFunc.Subqueryable<Dt_OutboundOrder>().Where(s => s.Id == p.OrderId && s.UpperOrderNo == upperOrderNo).Any()).ExecuteCommand();
+                }
             }
         }
 
         public List<Dt_InboundOrder> ConvertToInboundOrders(Dt_AllocateOrder allocateOrder)
         {
+            var distinctDetails = allocateOrder.Details
+                .GroupBy(d => d.Barcode)
+                .Select(g => g.First())
+                .ToList();
+
             return new List<Dt_InboundOrder>()
             {
                 new Dt_InboundOrder(){
@@ -230,16 +306,16 @@
                    InboundOrderNo=allocateOrder.OrderNo,
                    UpperOrderNo=allocateOrder.UpperOrderNo,
                    SupplierId=allocateOrder.SupplierId,
-                   OrderType=allocateOrder.OrderType,
+                   OrderType= allocateOrder.OrderType ,
                    OrderStatus=allocateOrder.OrderStatus,
                    CreateType=allocateOrder.CreateType,
                    BusinessType=allocateOrder.BusinessType,
                    IsBatch=allocateOrder.IsBatch,
                    FactoryArea=allocateOrder.FactoryArea,
                    Remark=allocateOrder.Remark,
-                   Details=allocateOrder.Details.Select(detail=>new Dt_InboundOrderDetail
+                   Details=distinctDetails.Select(detail=>new Dt_InboundOrderDetail
                    {
-                       OrderId= detail.OrderId,
+                       OrderId= 0,
                        MaterielCode=detail.MaterielCode,
                        MaterielName="",
                        BatchNo=detail.BatchNo,
@@ -249,7 +325,8 @@
                        OrderDetailStatus=detail.OrderDetailStatus,
                        Unit=detail.Unit,
                        RowNo=0,
-                       SupplyCode="",
+                       lineNo=detail.LineNo,
+                       SupplyCode=detail.SupplyCode,
                        WarehouseCode=detail.WarehouseCode,
                        Barcode=detail.Barcode,
                        OutBoxbarcodes="",
@@ -262,6 +339,18 @@
 
         public Dt_OutboundOrder ConvertToOutboundOrders(Dt_AllocateOrder allocateOrder)
         {
+
+            var distinctDetails = allocateOrder.Details
+            .GroupBy(d => string.IsNullOrEmpty(d.Barcode)
+                ? $"{d.MaterielCode}_{d.BatchNo}_{d.SupplyCode}_{d.WarehouseCode}"
+                : d.Barcode)
+            .Select(g => new
+            {
+                Detail = g.First(),
+                //姹囨�诲垎缁勫唴鐨勬暟閲�
+                Qty = g.Sum(x => x.BarcodeQty ?? x.OrderQuantity)
+            }).ToList();
+
             return new Dt_OutboundOrder()
             {
                 WarehouseId = allocateOrder.WarehouseId,
@@ -276,20 +365,23 @@
                 Remark = allocateOrder.Remark,
                 DepartmentCode = "",
                 DepartmentName = "",
-                Details = allocateOrder.Details.Select(detail => new Dt_OutboundOrderDetail
+                Details = distinctDetails.Select(item => new Dt_OutboundOrderDetail
                 {
-                    OrderId = detail.OrderId,
-                    MaterielCode = detail.MaterielCode,
+                    OrderId = 0,
+                    MaterielCode = item.Detail.MaterielCode,
                     MaterielName = "",
-                    BatchNo = detail.BatchNo,
-                    OrderQuantity = detail.OrderQuantity,
+                    BatchNo = item.Detail.BatchNo,
+                    OrderQuantity = item.Detail.OrderQuantity,
+                    BarcodeQty =  item.Detail.BarcodeQty??0,
+                    BarcodeUnit = item.Detail.BarcodeUnit??"",
                     LockQuantity = 0,
+                    lineNo = item.Detail.LineNo,
                     OverOutQuantity = 0,
-                    OrderDetailStatus = detail.OrderDetailStatus,
-                    Unit = detail.Unit,
+                    OrderDetailStatus = item.Detail.OrderDetailStatus,
+                    Unit = item.Detail.Unit,
                     RowNo = 0,
-                    SupplyCode = "",
-                    WarehouseCode = detail.WarehouseCode,
+                    SupplyCode = item.Detail.SupplyCode,
+                    WarehouseCode = item.Detail.WarehouseCode,
 
                 }).ToList()
             };
@@ -354,5 +446,116 @@
                 return code;
             }
         }
+
+        public override PageGridData<Dt_AllocateOrder> GetPageData(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_AllocateOrder>()
+                .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+                .OrderBy(orderByModels)
+                .ToPageList(options.Page, options.Rows, ref totalCount);
+            
+            foreach (var item in data)
+            {
+                Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == item.UpperOrderNo).First();
+                Dt_OutboundOrder OutboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == item.UpperOrderNo).First();
+                if (_InboundOrder != null)
+                {
+                    item.OrderStatus = _InboundOrder.OrderStatus;
+                    item.OrderType = _InboundOrder.OrderType;
+                }else if (OutboundOrder!=null)
+                {
+                    item.OrderStatus = OutboundOrder.OrderStatus;
+                    item.OrderType = OutboundOrder.OrderType;
+                }
+            }
+            return new PageGridData<Dt_AllocateOrder>(totalCount, data);
+        }
+
+        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 Id = _InboundOrder == null ? 0 : _InboundOrder.Id;
+            var data = BaseDal.Db.Queryable<Dt_InboundOrderDetail>()
+                .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+                .Where( x => x.OrderId == Id)
+                .OrderBy(orderByModels)
+                .ToPageList(options.Page, options.Rows, ref totalCount);
+
+
+            return new PageGridData<Dt_InboundOrderDetail>(totalCount, data);
+        }
     }
 }

--
Gitblit v1.9.3