| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.HttpContextUser; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IStockService; |
| | |
| | | |
| | | public PageGridData<StockInfoDetailWithPalletDto> GetPageData2(PageDataOptions options) |
| | | { |
| | | PageGridData<Dt_StockInfoDetail> lists = base.GetPageData (options); |
| | | string wheres = ValidatePageOptions(options); |
| | | |
| | | List<int> stockIds = lists.Rows.Select(detail => detail.StockId).Distinct().ToList(); |
| | | var stocks= _stockinfoRepository.QueryData(x => stockIds.Contains(x.Id)).ToList(); |
| | | |
| | | var sugarQueryable = Db.Queryable<Dt_StockInfoDetail>().InnerJoin<Dt_StockInfo>((detail, item) => detail.StockId == item.Id); |
| | | |
| | | List<StockInfoDetailWithPalletDto> dtoList = lists.Rows |
| | | .Select(detail => new StockInfoDetailWithPalletDto |
| | | Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); |
| | | List<OrderByModel> orderByModels = new List<OrderByModel>(); |
| | | foreach (var item in orderbyDic) |
| | | { |
| | | if (item.Key.ToLower() == "id") |
| | | { |
| | | |
| | | Id = detail.Id, |
| | | StockId = detail.StockId, |
| | | MaterielCode = detail.MaterielCode, |
| | | MaterielName = detail.MaterielName, |
| | | OrderNo = detail.OrderNo, |
| | | BatchNo = detail.BatchNo, |
| | | ProductionDate = detail.ProductionDate, |
| | | EffectiveDate = detail.EffectiveDate, |
| | | SerialNumber = detail.SerialNumber, |
| | | StockQuantity = detail.StockQuantity, |
| | | OutboundQuantity = detail.OutboundQuantity, |
| | | Status = detail.Status, |
| | | Unit = detail.Unit, |
| | | InboundOrderRowNo = detail.InboundOrderRowNo, |
| | | SupplyCode = detail.SupplyCode, |
| | | WarehouseCode = detail.WarehouseCode, |
| | | Barcode = detail.Barcode, |
| | | BusinessType = detail.BusinessType, |
| | | Remark = detail.Remark, |
| | | Creater = detail.Creater, |
| | | CreateDate = detail.CreateDate, |
| | | Modifier = detail.Modifier, |
| | | ModifyDate = detail.ModifyDate, |
| | | PalletCode= stocks |
| | | .FirstOrDefault(stock => stock.Id == detail.StockId)? |
| | | .PalletCode ?? "æ æçç¼å·" |
| | | }) |
| | | .ToList(); |
| | | OrderByModel orderByModel = new() |
| | | { |
| | | FieldName = "detail."+item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | OrderByModel orderByModel = new() |
| | | { |
| | | FieldName = item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | } |
| | | //orderByModels.Add(orderByModel); |
| | | } |
| | | int totalCount = 0; |
| | | List<SearchParameters> searchParametersList = new List<SearchParameters>(); |
| | | |
| | | return new PageGridData<StockInfoDetailWithPalletDto> { Rows = dtoList, Total = lists.Total, Summary = lists.Summary }; |
| | | |
| | | if (!string.IsNullOrEmpty(options.Wheres)) |
| | | { |
| | | try |
| | | { |
| | | searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); |
| | | if (searchParametersList != null && searchParametersList.Any()) |
| | | { |
| | | foreach (var param in searchParametersList) |
| | | { |
| | | // å¹é
æçç¼å·æ¥è¯¢æ¡ä»¶ï¼å°ååæ®µåï¼ |
| | | if (param.Name.Equals(nameof(Dt_StockInfo.PalletCode).FirstLetterToLower(), StringComparison.OrdinalIgnoreCase) |
| | | && !string.IsNullOrEmpty(param.Value?.ToString())) |
| | | { |
| | | sugarQueryable = sugarQueryable.Where((detail, item) => item.PalletCode.Contains(param.Value)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | } |
| | | |
| | | var data = sugarQueryable |
| | | .WhereIF(!wheres.IsNullOrEmpty(), wheres) |
| | | .OrderBy(orderByModels) |
| | | .Select((detail, item) => new StockInfoDetailWithPalletDto |
| | | { |
| | | Id = detail.Id, |
| | | StockId = detail.StockId, |
| | | MaterielCode = detail.MaterielCode, |
| | | MaterielName = detail.MaterielName, |
| | | OrderNo = detail.OrderNo, |
| | | BatchNo = detail.BatchNo, |
| | | ProductionDate = detail.ProductionDate, |
| | | EffectiveDate = detail.EffectiveDate, |
| | | SerialNumber = detail.SerialNumber, |
| | | StockQuantity = detail.StockQuantity, |
| | | OutboundQuantity = detail.OutboundQuantity, |
| | | Status = detail.Status, |
| | | Unit = detail.Unit, |
| | | InboundOrderRowNo = detail.InboundOrderRowNo, |
| | | SupplyCode = detail.SupplyCode, |
| | | WarehouseCode = detail.WarehouseCode, |
| | | Barcode = detail.Barcode, |
| | | BusinessType = detail.BusinessType, |
| | | Remark = detail.Remark, |
| | | Creater = detail.Creater, |
| | | CreateDate = detail.CreateDate, |
| | | Modifier = detail.Modifier, |
| | | ModifyDate = detail.ModifyDate, |
| | | PalletCode = item.PalletCode |
| | | }) |
| | | .ToPageList(options.Page, options.Rows, ref totalCount); |
| | | |
| | | |
| | | return new PageGridData<StockInfoDetailWithPalletDto>(totalCount, data); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |