heshaofeng
9 天以前 b6a40a2d8fdcffb3accfc7e424c0726a87a59ddf
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs
@@ -72,6 +72,42 @@
            return new PageGridData<StockInfoDetailWithPalletDto> { Rows = dtoList, Total = lists.Total, Summary = lists.Summary  };
        }
        public PageGridData<StockDetailDtO> GetPageDataByMateriel(PageDataOptions options)
        {
            PageGridData<Dt_StockInfoDetail> lists = base.GetPageData(options);
            List<StockDetailDtO> dtoList = lists.Rows.GroupBy(detail => new { detail.MaterielCode, detail.BatchNo, detail.SupplyCode }).Select(group =>
            {
                var firstItem = group.First();
                return new StockDetailDtO
                {
                    Id = firstItem.Id,
                    StockId = firstItem.StockId,
                    MaterielCode = group.Key.MaterielCode,
                    MaterielName = firstItem.MaterielName,
                    OrderNo = firstItem.OrderNo,
                    BatchNo = group.Key.BatchNo,
                    ProductionDate = firstItem.ProductionDate,
                    EffectiveDate = firstItem.EffectiveDate,
                    SerialNumber = firstItem.SerialNumber,
                    // 鏍稿績锛氬褰撳墠鍒嗙粍鐨凷tockQuantity姹傚拰
                    StockQuantity = group.Sum(item => item.StockQuantity),
                    OutboundQuantity = firstItem.OutboundQuantity,
                    Status = firstItem.Status,
                    Unit = firstItem.Unit,
                    InboundOrderRowNo = firstItem.InboundOrderRowNo,
                    SupplyCode = group.Key.SupplyCode,
                    WarehouseCode = firstItem.WarehouseCode,
                    Barcode = firstItem.Barcode,
                    BusinessType = firstItem.BusinessType,
                    Remark = firstItem.Remark
                };
            }).ToList();
            return new PageGridData<StockDetailDtO> { Rows = dtoList, Total = lists.Total, Summary = lists.Summary };
        }
    }
 }