优化接口
This commit is contained in:
@@ -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