wangxinhui
12 小时以前 67348f250a1b7970059698002949a5e0a5f3c52f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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();
        }
    }
}