using Org.BouncyCastle.Crypto;
|
using SqlSugar;
|
using SqlSugar.Extensions;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_Common.LocationEnum;
|
using WIDESEA_Common.StockEnum;
|
using WIDESEA_Core.BaseRepository;
|
using WIDESEA_Core.Enums;
|
using WIDESEA_DTO.Stock;
|
using WIDESEA_IBasicRepository;
|
using WIDESEA_IStockRepository;
|
using WIDESEA_Model.Models;
|
|
namespace WIDESEA_StockRepository
|
{
|
public class StockInfoRepository : RepositoryBase<Dt_StockInfo>, IStockInfoRepository
|
{
|
public StockInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
|
{
|
}
|
public Dt_StockInfo GetStockInfo(string palletCode)
|
{
|
return Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).First();
|
}
|
|
public List<Dt_StockInfo> GetStockInfos(string materielCode)
|
{
|
return Db.Queryable<Dt_StockInfo>().Where(x => x.MaterielCode == materielCode).ToList();
|
}
|
|
public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, List<string> locationCodes)
|
{
|
List<Dt_StockInfo> stockInfos = null;
|
if (!string.IsNullOrEmpty(lotNo))
|
{
|
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) && x.MaterielCode == materielCode).ToList();
|
}
|
|
return stockInfos;
|
}
|
|
public List<Dt_StockInfo> GetStockInfosByIds(List<int> ids)
|
{
|
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)).ToList();
|
}
|
|
public List<Dt_StockInfo> GetStockInfosExclude(string materielCode, List<string> palletCodes)
|
{
|
return Db.Queryable<Dt_StockInfo>().Where(x => !palletCodes.Contains(x.PalletCode) && x.MaterielCode == materielCode).ToList();
|
}
|
}
|
}
|