优化接口
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
|
||||
|
||||
@@ -108,9 +108,9 @@ namespace WMS.Web.Core.Dto
|
||||
/// </summary>
|
||||
public decimal ProductQty { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 排序
|
||||
///// </summary>
|
||||
//public int Sort { get; set; }
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace WMS.Web.Domain.Services
|
||||
//返回列表-对应刚刚生成的数据和编号集合
|
||||
var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId);
|
||||
|
||||
|
||||
|
||||
|
||||
var resultList = new List<BoxMarkQueryResponse>();
|
||||
if (list != null && list.Count != 0)
|
||||
{
|
||||
//处理-总数量
|
||||
@@ -72,34 +72,31 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
});
|
||||
|
||||
//var resultList = new List<BoxMarkQueryResponse>();
|
||||
//var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
|
||||
//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;
|
||||
// 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;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
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(list);
|
||||
return ResultList<BoxMarkQueryResponse>.ReSuccess(resultList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -112,7 +109,7 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId);
|
||||
|
||||
//var resultList = new List<BoxMarkQueryResponse>();
|
||||
var resultList = new List<BoxMarkQueryResponse>();
|
||||
|
||||
if (list != null && list.Count != 0)
|
||||
{
|
||||
@@ -122,33 +119,28 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
});
|
||||
|
||||
//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;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user