using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Text; 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, IBllLabelBoxNoServer { private static readonly SqlSugarScope Db = DataContext.Db; public BllLabelBoxNoServer() : base(Db) { } //获取标签箱码信息 public List GetLabelBoxList(LabelBoxVm model, out int count) { try { Expression> item = Expressionable.Create() .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((a, b) => a.CreateUser == b.Id) .LeftJoin((a, b, c) => a.UpdateUser == c.Id) .Select((a, b, c) => new BllLabelBoxNo() { 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); } } } }