| | |
| | | // æå»ºæ¥è¯¢æ¡ä»¶ |
| | | var stockQuery = Db.Queryable<Dt_StockInfo>() |
| | | .Where(x => locationCodes.Contains(x.LocationCode)) |
| | | .Where(x => x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ || x.StockStatus == (int)StockStatusEmun.è¿æ) |
| | | .Where(x => x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ) |
| | | .Includes(x => x.Details); |
| | | |
| | | // æ§è¡æ¥è¯¢å¹¶æå
è¿å
åºæåº |
| | |
| | | |
| | | if (relevantDetails.Any()) |
| | | { |
| | | var firstDetail = relevantDetails.First(); |
| | | var useableQuantity = relevantDetails.Sum(d => d.StockQuantity - d.OutboundQuantity); |
| | | |
| | | result.Add(new StockSelectViewDTO |
| | | foreach (var item in relevantDetails) |
| | | { |
| | | LocationCode = stock.LocationCode, |
| | | MaterielCode = firstDetail.MaterielCode, |
| | | MaterielName = firstDetail.MaterielName, |
| | | BatchNo = orderDetail.BatchNo, |
| | | SupplyCode = orderDetail.SupplyCode, |
| | | Barcode = firstDetail.Barcode, |
| | | PalletCode = stock.PalletCode, |
| | | UseableQuantity = useableQuantity, |
| | | StockCreateDate = stock.CreateDate, |
| | | StockId = stock.Id, |
| | | OrderDetailId = orderDetail.Id // å
³èå°å
·ä½çåºåºåæç» |
| | | }); |
| | | result.Add(new StockSelectViewDTO |
| | | { |
| | | LocationCode = stock.LocationCode, |
| | | MaterielCode = item.MaterielCode, |
| | | MaterielName = item.MaterielName, |
| | | BatchNo = item.BatchNo, |
| | | SupplyCode = item.SupplyCode, |
| | | Barcode = item.Barcode, |
| | | PalletCode = stock.PalletCode, |
| | | UseableQuantity = item.StockQuantity, |
| | | StockCreateDate = stock.CreateDate, |
| | | StockId = item.Id, |
| | | StockStatus = item.Status, |
| | | OrderDetailId = orderDetail.Id // å
³èå°å
·ä½çåºåºåæç» |
| | | }); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public override PageGridData<Dt_StockInfo> GetPageData(PageDataOptions options) |
| | | { |
| | | string wheres = ValidatePageOptions(options); |
| | | //è·åæåºå段 |
| | | Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); |
| | | ISugarQueryable<Dt_StockInfo> sugarQueryable = Db.Queryable<Dt_StockInfo>(); |
| | | |
| | | ValidatePageOptions(options, ref sugarQueryable); |
| | | |
| | | List<OrderByModel> orderByModels = new List<OrderByModel>(); |
| | | foreach (var item in orderbyDic) |
| | | |
| | | if (OrderByParameters != null) |
| | | { |
| | | OrderByModel orderByModel = new() |
| | | foreach (var item in OrderByParameters) |
| | | { |
| | | FieldName = item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | orderByModels.Add(orderByModel); |
| | | OrderByModel orderByModel = new OrderByModel() |
| | | { |
| | | FieldName = item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | orderByModels.Add(orderByModel); |
| | | } |
| | | } |
| | | ISugarQueryable<Dt_StockInfo> sugarQueryable1 = BaseDal.Db.Queryable<Dt_StockInfo>(); |
| | | if (EnableWebOrderBy) |
| | | { |
| | | //è·åæåºå段 |
| | | Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); |
| | | |
| | | int totalCount = 0; |
| | | List<SearchParameters> searchParametersList = new List<SearchParameters>(); |
| | | |
| | | var data = sugarQueryable1 |
| | | .WhereIF(!wheres.IsNullOrEmpty(), wheres) |
| | | .Where(x => !string.IsNullOrEmpty(x.LocationCode)) |
| | | .OrderBy(orderByModels) |
| | | .ToPageList(options.Page, options.Rows, ref totalCount); |
| | | foreach (var item in orderbyDic) |
| | | { |
| | | OrderByModel orderByModel = new OrderByModel() |
| | | { |
| | | FieldName = item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | orderByModels.Add(orderByModel); |
| | | } |
| | | } |
| | | |
| | | return new PageGridData<Dt_StockInfo>(totalCount, data); |
| | | int total = 0; |
| | | PageGridData<Dt_StockInfo> pageGridData = new PageGridData<Dt_StockInfo>(); |
| | | sugarQueryable = sugarQueryable.OrderBy(orderByModels); |
| | | pageGridData.Rows = sugarQueryable.ToPageList(options.Page, options.Rows, ref total); |
| | | pageGridData.Total = total; |
| | | |
| | | return pageGridData; |
| | | } |
| | | } |
| | | } |