From 2aec0a99e559fb11b7046b148e5f357b3208cb66 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期五, 12 九月 2025 10:06:22 +0800 Subject: [PATCH] 推送最新代码 --- 项目代码/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs | 66 +++----------------------------- 1 files changed, 7 insertions(+), 59 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs" index 34d86d8..0ed53b1 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs" @@ -22,87 +22,35 @@ public StockInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) { } - - public List<StockViewDTO> GetAllStockViews() - { - ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>(); - ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>(); - - return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => new StockViewDTO - { - LocationCode = b.LocationCode, - Column = a.Column, - CreateDate = b.CreateDate, - Creater = b.Creater, - Depth = a.Depth, - EnalbeStatus = a.EnableStatus, - Layer = a.Layer, - LocationName = a.LocationName, - LocationStatus = a.LocationStatus, - LocationType = a.LocationType, - Modifier = b.Modifier, - ModifyDate = b.ModifyDate, - PalletCode = b.PalletCode, - StockRemark = b.Remark, - RoadwayNo = a.RoadwayNo, - Row = a.Row, - StockId = b.Id, - StockStatus = b.StockStatus, - Details = b.Details, - }).Includes(x => x.Details).ToList(); - } - public Dt_StockInfo GetStockInfo(string palletCode) { - return Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); + return Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).First(); } public List<Dt_StockInfo> GetStockInfos(string materielCode) { - return Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList(); - //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>(); - //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)); - //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).Includes(x => x.Details).ToList(); + return Db.Queryable<Dt_StockInfo>().Where(x => x.MaterielCode == materielCode).ToList(); } - public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, List<string> locationCodes) + public List<Dt_StockInfo> GetStockInfos(int materielId,decimal width, List<string> locationCodes) { - List<Dt_StockInfo> stockInfos = null; - if (!string.IsNullOrEmpty(lotNo)) - { - var stockSort = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode && v.BatchNo == lotNo)).ToList(); - stockInfos = stockSort.OrderBy(x=>x.Details.FirstOrDefault()?.EffectiveDate).ThenBy(x=>x.Details.Sum(v=>v.StockQuantity)).ToList(); - } - else - { - var stockSort = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList(); - stockInfos = stockSort.OrderBy(x => x.Details.FirstOrDefault()?.EffectiveDate).ThenBy(x => x.Details.Sum(v => v.StockQuantity)).ToList(); - } - + List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielId == materielId && x.MaterielWide==width && x.StockOutLength<=0).OrderBy(x=>x.CreateDate).ToList(); return stockInfos; - //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode)); - //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)); - //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList(); } public List<Dt_StockInfo> GetStockInfosByIds(List<int> ids) { - return Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).Includes(x => x.Details).ToList(); + return Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).ToList(); } public List<Dt_StockInfo> GetStockInfosByPalletCodes(List<string> palletCodes) { - return Db.Queryable<Dt_StockInfo>().Where(x => palletCodes.Contains(x.PalletCode)).Includes(x => x.Details).ToList(); + return Db.Queryable<Dt_StockInfo>().Where(x => palletCodes.Contains(x.PalletCode)).ToList(); } public List<Dt_StockInfo> GetStockInfosExclude(string materielCode, List<string> palletCodes) { - return Db.Queryable<Dt_StockInfo>().Where(x => !palletCodes.Contains(x.PalletCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList(); - } - - public bool UpdateDataWithDetail(Dt_StockInfo stockInfo) - { - return Db.UpdateNav(stockInfo).Include(x => x.Details).ExecuteCommand(); + return Db.Queryable<Dt_StockInfo>().Where(x => !palletCodes.Contains(x.PalletCode) && x.MaterielCode == materielCode).ToList(); } } } -- Gitblit v1.9.3