From 801ddd3be4d6bf8553cac870435bb5092eca6b60 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期一, 06 一月 2025 18:50:38 +0800 Subject: [PATCH] 更新前端代码 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 42 insertions(+), 5 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs" index 9ecf3fd..a843426 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs" @@ -1,7 +1,9 @@ 锘� +using HslCommunication.Secs.Types; using Microsoft.AspNetCore.Http; using SqlSugar; using System; +using System.Collections; using System.Collections.Generic; using System.Drawing.Printing; using System.Dynamic; @@ -35,7 +37,8 @@ public virtual PageGridData<StockViewDTO> GetPageData(PageDataOptions options) { - string where = options.ValidatePageOptions(typeof(StockViewDTO).GetProperties()); + + //string where = options.ValidatePageOptions(typeof(StockViewDTO).GetProperties()); //鑾峰彇鎺掑簭瀛楁 //Dictionary<string, OrderByType> orderbyDic = options.GetPageDataSort(typeof(StockViewDTO).GetProperties()); //List<OrderByModel> orderByModels = new List<OrderByModel>(); @@ -50,10 +53,11 @@ //} int totalCount = 0; - ISugarQueryable<Dt_StockInfo> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfo>(); + ISugarQueryable<Dt_StockInfo> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfo>().Includes(x=>x.Details); ISugarQueryable<Dt_LocationInfo> sugarQueryable = _dbBase.Queryable<Dt_LocationInfo>(); - List<StockViewDTO> list = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => a.LocationCode == b.LocationCode).WhereIF(!string.IsNullOrEmpty(where), where).Select((b, a) => new StockViewDTO + List<StockViewDTO> list = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => a.LocationCode == b.LocationCode).Select((b, a) + => new StockViewDTO { LocationCode = b.LocationCode, Column = a.Column, @@ -75,8 +79,41 @@ StockStatus = b.StockStatus, Details = b.Details, }).ToPageList(options.Page, options.Rows, ref totalCount); - - + list.ForEach(x => + { + x.MaterielCode = string.Join(",", x.Details.Select(x => x.MaterielCode).Distinct()); + x.BatchNo = string.Join(",", x.Details.Select(x => x.BatchNo).Distinct()); + } + ); + if (options.Wheres.IsNotEmptyOrNull()) + { + List<SearchParameters> searchParameters = options.Wheres.DeserializeObject<List<SearchParameters>>(); + foreach (var item in searchParameters) + { + switch (item.Name) + { + case "palletCode": + list = list.Where(x => x.PalletCode.Contains(item.Value)).ToList(); + break; + case "locationStatus": + List<int> locationStatus = item.Value.Split(",").Select(int.Parse).ToList(); + list = list.Where(x => locationStatus.Contains(x.LocationStatus)).ToList(); + break; + case "stockStatus": + List<int> stockStatus = item.Value.Split(",").Select(int.Parse).ToList(); + list = list.Where(x => stockStatus.Contains(x.StockStatus)).ToList(); + break; + case "materielCode": + list = list.Where(x => x.MaterielCode.Contains(item.Value)).ToList(); + break; + case "batchNo": + list=list.Where(x => x.BatchNo.Contains(item.Value)).ToList(); + break; + default: + break; + } + } + } return new PageGridData<StockViewDTO>(totalCount, list); } -- Gitblit v1.9.3