From 733c975cd8647f6d006736f1863bad731e32e6fb Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期日, 26 十月 2025 17:15:52 +0800
Subject: [PATCH] 上传最新代码,ERP接口,MES接口优化,WMS业务优化等
---
项目代码/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs | 77 +++++++++-----------------------------
1 files changed, 18 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..6b58c69 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,46 @@
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> GetStockInfos(string materielCode, decimal width, List<string> locationCodes)
+ {
+ List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielCode.StartsWith(materielCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.MaterielWide == width && x.StockOutLength <= 0 && x.StockLength > 0).OrderBy(x => x.CreateDate).ToList();
+ return stockInfos;
+ }
+
+ public List<Dt_StockInfo> GetStockInfos(string materielCode, List<string> locationCodes)
+ {
+ List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielCode == materielCode && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.StockOutLength <= 0 && x.StockLength > 0).OrderBy(x => x.CreateDate).ToList();
+ return stockInfos;
}
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