hwh
2024-07-15 9c247fc802c8a9b48dae041bf5de53defaa68a39
Wms/WMS.BLL/BllSoServer/WaveMageServer.cs
@@ -3,8 +3,10 @@
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Model.InterFaceModel;
using Model.ModelDto.BllSoDto;
using Model.ModelVm.BllSoVm;
using Newtonsoft.Json;
using SqlSugar;
using WMS.BLL.Logic;
@@ -27,52 +29,44 @@
        }
        //获取波次单信息
        public List<WaveMageDto> GetWaveMageList(string waveNo, string status, string lotNo, int? logisticsId, int page, int limit, out int count)
        public async Task<List<WaveMageDto>> GetWaveMageList(GetWaveMageVm model, RefAsync<int> count)
        {
            try
            {
                Expression<Func<BllWaveMage, bool>> item = Expressionable.Create<BllWaveMage>()
                    .AndIF(!string.IsNullOrWhiteSpace(waveNo), it => it.WaveNo.Contains(waveNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(status), it => it.Status == status)
                    .AndIF(logisticsId != null, it => it.LogisticsId == logisticsId)
                    .AndIF(!string.IsNullOrWhiteSpace(lotNo), it => it.LotNo.Contains(lotNo))
            Expression<Func<BllWaveMage, bool>> item = Expressionable.Create<BllWaveMage>()
                    .AndIF(!string.IsNullOrWhiteSpace(model.WaveNo), it => it.WaveNo.Contains(model.WaveNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(model.Status), it => it.Status == model.Status)
                    .AndIF(model.LogisticsId != null, it => it.LogisticsId == model.LogisticsId)
                    .AndIF(!string.IsNullOrWhiteSpace(model.LotNo), it => it.LotNo.Contains(model.LotNo))
                    .ToExpression();//注意 这一句 不能少
                var total = 0;
                var data = GetAllWhereAsync(item)
                    .LeftJoin<SysLogisticsInfo>((a, b) => a.LogisticsId == b.Id)
                    .LeftJoin<SysUserInfor>((a, b, c) => a.CreateUser == c.Id)
                    .LeftJoin<SysUserInfor>((a, b, c, d) => a.CreateUser == d.Id)
                    .Select((a, b, c, d) => new WaveMageDto()
                    {
                        Id = a.Id,
                        WaveNo = a.WaveNo,
                        Status = a.Status,
                        Origin = a.Origin,
                        CustomerNo = a.CustomerNo,
                        CustomerName = a.CustomerName,
                        LotNo = a.LotNo,
                        LotText = a.LotText,
                        SupplierLot = a.SupplierLot,
                        LogisticsId = a.LogisticsId,
                        LogisticsName = b.CarrierName,
                        Address = a.Address,
                        CreateUserName = c.RealName,
                        UpdateUserName = c.RealName,
                        CreateTime = a.CreateTime,
                        UpdateTime = a.UpdateTime,
            var data = await GetAllWhereAsync(item)
                .LeftJoin<SysLogisticsInfo>((a, b) => a.LogisticsId == b.Id)
                .LeftJoin<SysUserInfor>((a, b, c) => a.CreateUser == c.Id)
                .LeftJoin<SysUserInfor>((a, b, c, d) => a.CreateUser == d.Id)
                .Select((a, b, c, d) => new WaveMageDto()
                {
                    Id = a.Id,
                    WaveNo = a.WaveNo,
                    Status = a.Status,
                    Origin = a.Origin,
                    CustomerNo = a.CustomerNo,
                    CustomerName = a.CustomerName,
                    LotNo = a.LotNo,
                    LotText = a.LotText,
                    SupplierLot = a.SupplierLot,
                    LogisticsId = a.LogisticsId,
                    LogisticsName = b.CarrierName,
                    Address = a.Address,
                    })
                    .OrderByDescending(a => a.CreateTime)
                    .ToOffsetPage(page, limit, ref total);
                count = total;
                    CreateUserName = c.RealName,
                    UpdateUserName = c.RealName,
                    CreateTime = a.CreateTime,
                    UpdateTime = a.UpdateTime,
                return data;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
                })
                .OrderByDescending(a => a.CreateTime)
                .ToPageListAsync(model.Page, model.Limit, count);
            return data;
        }
        //获取添加波次单的出库单信息