优化列表接口数据
This commit is contained in:
@@ -450,6 +450,11 @@
|
||||
产品数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BoxMarkQueryResponse.Sort">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.GenerateBoxMarkDto">
|
||||
<summary>
|
||||
生成箱唛dto
|
||||
|
||||
@@ -107,5 +107,10 @@ namespace WMS.Web.Core.Dto
|
||||
/// 产品数量
|
||||
/// </summary>
|
||||
public decimal ProductQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
@@ -59,7 +60,44 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
//返回列表-对应刚刚生成的数据和编号集合
|
||||
var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId);
|
||||
return ResultList<BoxMarkQueryResponse>.ReSuccess(list);
|
||||
|
||||
//处理-批次生成的排序和总数量
|
||||
var resultList = new List<BoxMarkQueryResponse>();
|
||||
if (list != null && list.Count != 0)
|
||||
{
|
||||
list.ForEach(x =>
|
||||
{
|
||||
x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
|
||||
|
||||
});
|
||||
|
||||
var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
|
||||
foreach (var id in ids)
|
||||
{
|
||||
|
||||
var itemDetailId = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (id == item.Id)
|
||||
{
|
||||
|
||||
var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
|
||||
|
||||
var newItem = item;
|
||||
if (current == null)
|
||||
newItem.Sort = 1;
|
||||
else
|
||||
newItem.Sort = current.Sort + 1;
|
||||
resultList.Add(newItem);
|
||||
itemDetailId = item.DetailId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return ResultList<BoxMarkQueryResponse>.ReSuccess(resultList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,15 +110,43 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId);
|
||||
|
||||
var resultList = new List<BoxMarkQueryResponse>();
|
||||
|
||||
if (list != null && list.Count != 0)
|
||||
{
|
||||
list.ForEach(x =>
|
||||
{
|
||||
x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
|
||||
|
||||
});
|
||||
|
||||
var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
|
||||
foreach (var id in ids)
|
||||
{
|
||||
|
||||
var itemDetailId = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (id == item.Id)
|
||||
{
|
||||
|
||||
var current= resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
|
||||
|
||||
var newItem = item;
|
||||
if (current == null)
|
||||
newItem.Sort =1;
|
||||
else
|
||||
newItem.Sort = current.Sort+ 1;
|
||||
resultList.Add(newItem);
|
||||
itemDetailId = item.DetailId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return (list, count);
|
||||
return (resultList, count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,5 +168,7 @@ namespace WMS.Web.Domain.Services
|
||||
boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag));
|
||||
return boxCount;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,7 @@ namespace WMS.Web.Repositories
|
||||
var query = _context.BoxMarkBillNo
|
||||
.GroupJoin(_context.BoxMark, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.OrderByDescending(x => x.detail.Id).ThenByDescending(x => x.detail.FirstBillNo).ThenByDescending(x => x.detail.LastBillNo)
|
||||
.Where(adv => adv.order.Id == id);
|
||||
var list = await query.Select(s => new BoxMarkQueryResponse()
|
||||
{
|
||||
@@ -229,17 +230,20 @@ namespace WMS.Web.Repositories
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.order.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.order.MaterialId),
|
||||
BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.order.MaterialId),
|
||||
|
||||
CratingQty = s.order.CratingQty,
|
||||
CratingNetWeightQty = s.order.CratingNetWeightQty,
|
||||
CratingGrossWeightQty = s.order.CratingGrossWeightQty,
|
||||
|
||||
TailboxQty = s.order.TailboxQty,
|
||||
TailboxNetWeightQty = s.order.TailboxNetWeightQty,
|
||||
TailboxGrossWeightQty = s.order.TailboxGrossWeightQty,
|
||||
IsTail = s.detail.IsTail,
|
||||
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.CreatorId),
|
||||
CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
Remark = s.order.Remark
|
||||
}).OrderByDescending(x => x.DetailId).ToListAsync();
|
||||
Remark = s.order.Remark,
|
||||
ProductQty = s.order.ProductQty,
|
||||
}).ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user