z8018
2025-12-16 4dbdd03f0476e219b1593dda302f478c15860fa6
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs
@@ -27,17 +27,15 @@
        private readonly IOutStockLockInfoService _outStockLockInfoService;
        private readonly ILocationInfoService _locationInfoService;
        private readonly IBasicService _basicService;
        private readonly IRecordService _recordService;
        private readonly IOutboundOrderService _outboundOrderService;
        private readonly ILocationStatusChangeRecordService _locationStatusChangeRecordService;
        private readonly ILogger<OutboundOrderDetailService> _logger;
        public OutboundOrderDetailService(IRepository<Dt_OutboundOrderDetail> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IBasicService basicService, IRecordService recordService, ILocationInfoService locationInfoService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IOutboundOrderService outboundOrderService, ILogger<OutboundOrderDetailService> logger) : base(BaseDal)
        public OutboundOrderDetailService(IRepository<Dt_OutboundOrderDetail> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IRecordService recordService, ILocationInfoService locationInfoService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IOutboundOrderService outboundOrderService, ILogger<OutboundOrderDetailService> logger) : base(BaseDal)
        {
            _unitOfWorkManage = unitOfWorkManage;
            _stockService = stockService;
            _outStockLockInfoService = outStockLockInfoService;
            _basicService = basicService;
            _recordService = recordService;
            _locationInfoService = locationInfoService;
            _locationStatusChangeRecordService = locationStatusChangeRecordService;
@@ -46,8 +44,6 @@
        }
        /// <summary>
        /// åˆ†é…å‡ºåº“库存  æŒ‰å…ˆè¿›å…ˆå‡ºåŽŸåˆ™åˆ†é…
        /// </summary>
        public (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>)
@@ -595,10 +591,56 @@
                        SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_InboundOrderDetail.OrderId).FirstLetterToLower());
                        if (searchParameters != null)
                        {
                            Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == searchParameters.Value.ObjToInt());
                            if (outboundOrder != null)
                            {
                                if (outboundOrder.IsBatch == 0)
                                {
                            sugarQueryable1 = sugarQueryable1.Where(x => x.OrderId == searchParameters.Value.ObjToInt());
                            var dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount);
                            return new PageGridData<Dt_OutboundOrderDetail>(totalCount, dataList);
                        }
                                else
                                {
                                    sugarQueryable1 = sugarQueryable1.Where(x => x.OrderId == searchParameters.Value.ObjToInt());
                                    sugarQueryable1.GroupBy(x => new { x.MaterielCode, x.MaterielName, x.BatchNo, x.SupplyCode, x.WarehouseCode }).Select(s => new Dt_OutboundOrderDetail
                                    {
                                        WarehouseCode = s.WarehouseCode,
                                        SupplyCode = s.SupplyCode,
                                        BatchNo = s.BatchNo,
                                        MaterielName = s.MaterielName,
                                        MaterielCode = s.MaterielCode,
                                        AllocatedQuantity = SqlFunc.AggregateSum(s.AllocatedQuantity),
                                        OrderQuantity = SqlFunc.AggregateSum(s.OrderQuantity),
                                        PickedQty = SqlFunc.AggregateSum(s.PickedQty),
                                        OverOutQuantity = SqlFunc.AggregateSum(s.OverOutQuantity),
                                        MoveQty = SqlFunc.AggregateSum(s.MoveQty),
                                        NoStockOutQty = SqlFunc.AggregateSum(s.NoStockOutQty),
                                        LockQuantity = SqlFunc.AggregateSum(s.LockQuantity),
                                        BarcodeMoveQty = SqlFunc.AggregateSum(s.BarcodeMoveQty),
                                        BarcodeQty =SqlFunc.AggregateMin( s.BarcodeQty),
                                        BarcodeUnit = SqlFunc.AggregateMin(s.BarcodeUnit),
                                        BatchAllocateStatus = SqlFunc.AggregateMin(s.BatchAllocateStatus),
                                        CreateDate = SqlFunc.AggregateMin(s.CreateDate),
                                        Creater = SqlFunc.AggregateMin(s.Creater),
                                        documentsNO = SqlFunc.AggregateMin(s.documentsNO),
                                        Id = SqlFunc.AggregateMin(s.Id),
                                        lineNo = SqlFunc.AggregateMin(s.lineNo),
                                        Modifier = SqlFunc.AggregateMin(s.Modifier),
                                        ModifyDate = SqlFunc.AggregateMin(s.ModifyDate),
                                        OrderDetailStatus = SqlFunc.AggregateMin(s.OrderDetailStatus),
                                        OrderId = SqlFunc.AggregateMin(s.OrderId),
                                        Remark = SqlFunc.AggregateMin(s.Remark),
                                        ReturnJsonData = SqlFunc.AggregateMin(s.ReturnJsonData),
                                        ReturnToMESStatus = SqlFunc.AggregateMin(s.ReturnToMESStatus),
                                        RowNo = SqlFunc.AggregateMin(s.RowNo),
                                        Unit = SqlFunc.AggregateMin(s.Unit)
                                    });
                                    var dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount);
                                    return new PageGridData<Dt_OutboundOrderDetail>(totalCount, dataList);
                                }
                            }
                        }
                    }