From 67348f250a1b7970059698002949a5e0a5f3c52f Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期四, 14 八月 2025 08:51:04 +0800 Subject: [PATCH] 上传最新代码 --- 项目代码/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs | 57 +++++++-------------------------------------------------- 1 files changed, 7 insertions(+), 50 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..46200a8 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,47 +22,14 @@ 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) @@ -70,39 +37,29 @@ 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(); + var stockSort = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielCode == materielCode && x.BatchNo == lotNo).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(); + var stockSort = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielCode == materielCode).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