去掉排序

This commit is contained in:
tongfei
2024-02-20 11:12:49 +08:00
parent 12e2ca1070
commit ac4a1493bd
2 changed files with 49 additions and 47 deletions

View File

@@ -108,9 +108,9 @@ namespace WMS.Web.Core.Dto
/// </summary> /// </summary>
public decimal ProductQty { get; set; } public decimal ProductQty { get; set; }
/// <summary> ///// <summary>
/// 排序 ///// 排序
/// </summary> ///// </summary>
public int Sort { get; set; } //public int Sort { get; set; }
} }
} }

View File

@@ -61,43 +61,45 @@ namespace WMS.Web.Domain.Services
//返回列表-对应刚刚生成的数据和编号集合 //返回列表-对应刚刚生成的数据和编号集合
var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId); var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId);
//处理-批次生成的排序和总数量
var resultList = new List<BoxMarkQueryResponse>();
if (list != null && list.Count != 0) if (list != null && list.Count != 0)
{ {
//处理-总数量
list.ForEach(x => list.ForEach(x =>
{ {
x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty); x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
}); });
var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList(); //var resultList = new List<BoxMarkQueryResponse>();
foreach (var id in ids) //var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
{ //foreach (var id in ids)
//{
var itemDetailId = 0; // var itemDetailId = 0;
foreach (var item in list) // foreach (var item in list)
{ // {
if (id == item.Id) // if (id == item.Id)
{ // {
var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault(); // var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
var newItem = item; // var newItem = item;
if (current == null) // if (current == null)
newItem.Sort = 1; // newItem.Sort = 1;
else // else
newItem.Sort = current.Sort + 1; // newItem.Sort = current.Sort + 1;
resultList.Add(newItem); // resultList.Add(newItem);
itemDetailId = item.DetailId; // itemDetailId = item.DetailId;
} // }
} // }
} //}
} }
return ResultList<BoxMarkQueryResponse>.ReSuccess(resultList); return ResultList<BoxMarkQueryResponse>.ReSuccess(list);
} }
/// <summary> /// <summary>
@@ -110,7 +112,7 @@ namespace WMS.Web.Domain.Services
{ {
var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId); var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId);
var resultList = new List<BoxMarkQueryResponse>(); //var resultList = new List<BoxMarkQueryResponse>();
if (list != null && list.Count != 0) if (list != null && list.Count != 0)
{ {
@@ -120,33 +122,33 @@ namespace WMS.Web.Domain.Services
}); });
var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList(); //var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
foreach (var id in ids) //foreach (var id in ids)
{ //{
var itemDetailId = 0; // var itemDetailId = 0;
foreach (var item in list) // foreach (var item in list)
{ // {
if (id == item.Id) // if (id == item.Id)
{ // {
var current= resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault(); // var current= resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
var newItem = item; // var newItem = item;
if (current == null) // if (current == null)
newItem.Sort =1; // newItem.Sort =1;
else // else
newItem.Sort = current.Sort+ 1; // newItem.Sort = current.Sort+ 1;
resultList.Add(newItem); // resultList.Add(newItem);
itemDetailId = item.DetailId; // itemDetailId = item.DetailId;
} // }
} // }
} //}
} }
return (resultList, count); return (list, count);
} }
/// <summary> /// <summary>