wxw
11 小时以前 89bef2fb48857f3b5c6170b388347d8529ca6297
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 Model.ModelDto.LogDto;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WMS.DAL;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
using WMS.Entity.LogEntity;
using WMS.Entity.SysEntity;
using WMS.IBLL.IBllCheckServer;
using WMS.IBLL.ILogServer;
 
namespace WMS.BLL.LogServer
{
    public class LogWorkShopServer : DbHelper<LogWorkShop>, ILogWorkShopServer
    {
        private static readonly SqlSugarScope Db = DataContext.Db;
        public LogWorkShopServer() : base(Db)
        {
        }
 
        public List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo,string lotNo,string skuNo,string skuName,string boxNo,int page, int limit, out int count)
        {
            try
            {
                Expression<Func<LogWorkShop, bool>> item = Expressionable.Create<LogWorkShop>()
                    .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type)
                    .AndIF(!string.IsNullOrWhiteSpace(palletNo), it => it.PalletNo.Contains(palletNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(lotNo), it => it.LotNo.Contains(lotNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(skuNo), it => it.SkuNo.Contains(skuNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(skuName), it => it.SkuName.Contains(skuName.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(boxNo), it => it.BoxNo.Contains(boxNo.Trim()))
                    .ToExpression();//注意 这一句 不能少
 
                var total = 0;
                var data = GetAllWhereAsync(item)
                    .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id)
                    .Select((a, b) => new LogWorkShopDto()
                    {
                        PalletNo = a.PalletNo,
                        SkuNo = a.SkuNo,
                        SkuName = a.SkuName,
                        LotNo = a.LotNo,
                        Qty = a.Qty,
                        Type = a.Type,
                        BoxNo = a.BoxNo,
                        CreateUserName = b.RealName,
                        CreateTime = a.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
                    })
                    .OrderByDescending(a => a.CreateTime)
                    .ToOffsetPage(page, limit, ref total);
                count = total;
                
                return data;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
    }
}