hwh
2024-07-15 9c247fc802c8a9b48dae041bf5de53defaa68a39
Wms/WMS.BLL/BllSoServer/CompleteDetailServer.cs
@@ -3,7 +3,9 @@
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Model.ModelDto.BllSoDto;
using Model.ModelVm.BllSoVm;
using SqlSugar;
using WMS.DAL;
using WMS.Entity.BllSoEntity;
@@ -21,19 +23,13 @@
        }
        //查询拣货明细箱码信息(分组后)
        public List<CompleteDetailDto> GetCompleteDetailList(int id, int page, int limit, out int count)
        {
            try
            {
                var total = 0;
                var detailInfo = Db.Queryable<BllCompleteDetail>().First(w => string.IsNullOrEmpty(w.BoxNo) || string.IsNullOrEmpty(w.BoxNo3));
                if (detailInfo == null)
        public async Task<List<CompleteDetailDto>> GetCompleteDetailList(GetCompleteDetailVm model, RefAsync<int> count)
                {
                    Expression<Func<BllCompleteDetail, bool>> item = Expressionable.Create<BllCompleteDetail>()
                    .And(it => it.ExportAllotId == id)
                .And(it => it.ExportAllotId == model.Id)
                    .And(it => it.IsDel == "0")
                    .ToExpression();//注意 这一句 不能少
                    var data = GetAllWhereAsync(item)
            var data = await GetAllWhereAsync(item)
                        .GroupBy(m => new
                        {
                            m.SONo,
@@ -49,7 +45,7 @@
                            m.SkuName,
                            m.Standard,
                            m.PalletNo,
                            m.NowPalletNo,
                    m.NowPalletNo
                        })
                        .Select(a => new CompleteDetailDto()
                        {
@@ -68,63 +64,9 @@
                            PalletNo = a.PalletNo,
                            CompleteQty = SqlFunc.AggregateSum(a.CompleteQty),
                            NowPalletNo = a.NowPalletNo,
                            //CreateTime = a.CreateTime
                        }).ToOffsetPage(page, limit, ref total);
                    count = total;
                    return data;
                }
                else //箱码或支码为空说明是按数量拣货,增加 CreateTime 分组条件
                {
                    Expression<Func<BllCompleteDetail, bool>> item = Expressionable.Create<BllCompleteDetail>()
                    .And(it => it.ExportAllotId == id)
                    .And(it => it.IsDel == "0")
                    .ToExpression();//注意 这一句 不能少
                    var data = GetAllWhereAsync(item)
                        .GroupBy(m => new
                        {
                            m.SONo,
                            m.SODetailNo,
                            m.StockId,
                            m.ExportAllotId,
                }).ToPageListAsync(model.Page, model.Limit, count);
                            m.BoxNo,
                            m.LotNo,
                            m.LotText,
                            m.SupplierLot,
                            m.SkuNo,
                            m.SkuName,
                            m.Standard,
                            m.PalletNo,
                            m.NowPalletNo,
                            m.CreateTime
                        })
                        .Select(a => new CompleteDetailDto()
                        {
                            SONo = a.SONo,
                            SODetailNo = a.SODetailNo,
                            StockId = a.StockId,
                            ExportAllotId = a.ExportAllotId,
                            BoxNo = a.BoxNo,
                            LotNo = a.LotNo,
                            LotText = a.LotText,
                            SupplierLot = a.SupplierLot,
                            SkuNo = a.SkuNo,
                            SkuName = a.SkuName,
                            Standard = a.Standard,
                            PalletNo = a.PalletNo,
                            CompleteQty = SqlFunc.AggregateSum(a.CompleteQty),
                            NowPalletNo = a.NowPalletNo,
                        //CreateTime = a.CreateTime
                    }).ToOffsetPage(page, limit, ref total);
                    count = total;
                    return data;
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        //查询拣货明细支码详细信息