Demo
2024-01-31 8bf389f813e01a4fdcbd03739b365055543f8b37
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using Model.ModelDto.BllAsnDto;
using Model.ModelVm.BllAsnVm;
using SqlSugar;
using WMS.DAL;
using WMS.Entity.BllAsnEntity;
using WMS.Entity.Context;
using WMS.Entity.SysEntity;
using WMS.IBLL.IBllAsnServer;
 
namespace WMS.BLL.BllAsnServer
{
    public class BllLabelBoxNoServer : DbHelper<BllLabelBoxNo>, IBllLabelBoxNoServer
    {
        private static readonly SqlSugarScope Db = DataContext.Db;
 
        public BllLabelBoxNoServer() : base(Db)
        {
        }
 
        //获取标签箱码信息
        public List<LabelBoxDto> GetLabelBoxList(LabelBoxVm model, out int count)
        {
            try
            {
                Expression<Func<BllLabelBoxNo, bool>> item = Expressionable.Create<BllLabelBoxNo>()
                    .AndIF(!string.IsNullOrWhiteSpace(model.AsnNo), it => it.ASNNo.Contains(model.AsnNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(model.BoxNo), it => it.BoxNo.Contains(model.BoxNo.Trim()))
                    //.AndIF(!string.IsNullOrWhiteSpace(model.StartTime), it => it.CreateTime >= Convert.ToDateTime(model.StartTime))
                    //.AndIF(!string.IsNullOrWhiteSpace(model.EndTime), it => it.CreateTime <= Convert.ToDateTime(model.EndTime).AddDays(1))
                    .And(it => it.IsDel == "0")
                    .ToExpression();
                var total = 0;
                var data = GetAllWhereAsync(item)
                    .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id)
                    .LeftJoin<SysUserInfor>((a, b, c) => a.UpdateUser == c.Id)
                    .Select((a, b, c) => new LabelBoxDto()
                    {
                        Id = a.Id,
                        AsnNo = a.ASNNo,
                        AsnDetailNo = a.ASNDetailNo,
                        BoxNo = a.BoxNo,
                        ParentBoxNo = a.ParentBoxNo,
                        Qty = a.Qty,
                        SkuNo = a.SkuNo,
                        SkuName = a.SkuName,
                        LotNo = a.LotNo,
                        LotText = a.LotText,
                        SupplierName = a.SupplierName,
                        SupplierLot = a.SupplierLot,
                        ProductionTime = a.ProductionTime,
                        ExpirationTime = a.ExpirationTime,
                        InspectTime = a.InspectTime,
                        CompleteTime = a.CompleteTime,
                        IsUse = a.IsUse,
                        Level = a.Level,
                        QtyCount = a.QtyCount,
                        QtyOrd = a.QtyOrd,
                        UDF1 = a.UDF1,
                        UDF2 = a.UDF2,
                        UDF3 = a.UDF3,
                        UDF4 = a.UDF4,
                        UDF5 = a.UDF5,
 
                        CreateUserName = b.RealName,
                        UpdateUserName = c.RealName,
                        CreateTime = a.CreateTime,
                        UpdateTime = a.UpdateTime
 
                    }).OrderByDescending(a => a.CreateTime).OrderBy(a => a.BoxNo).ToOffsetPage(model.Page, model.Limit, ref total);
                count = total;
                return data;
            }
            catch (Exception e)
            { 
                throw new Exception(e.Message);
            }
        }
    }
}