优化箱唛列表
This commit is contained in:
@@ -20,5 +20,13 @@ namespace WMS.Web.Domain.IService
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultList<BoxMarkQueryResponse>> Generate(GenerateBoxMarkDto dto, LoginInDto loginInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 列表-分页
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <returns></returns>
|
||||
Task<(List<BoxMarkQueryResponse> list, int total)> GetPagedList(BoxMarkQueryRequest dto, int companyId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,5 +61,46 @@ namespace WMS.Web.Domain.Services
|
||||
var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId);
|
||||
return ResultList<BoxMarkQueryResponse>.ReSuccess(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表分页
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<(List<BoxMarkQueryResponse> list, int total)> GetPagedList(BoxMarkQueryRequest dto, int companyId)
|
||||
{
|
||||
var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId);
|
||||
|
||||
if (list != null && list.Count != 0)
|
||||
{
|
||||
list.ForEach(x =>
|
||||
{
|
||||
x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
|
||||
});
|
||||
}
|
||||
|
||||
return (list, count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 装箱总数
|
||||
/// </summary>
|
||||
/// <param name="productQty"></param>
|
||||
/// <param name="cratingQty"></param>
|
||||
/// <returns></returns>
|
||||
private int GetSortCount(decimal productQty, decimal cratingQty)
|
||||
{
|
||||
//计算要装的箱数量
|
||||
var boxCount_tag = productQty / cratingQty;
|
||||
var boxCount = Convert.ToInt32(boxCount_tag);
|
||||
//判断是否存在小数点;true表明有尾箱数,false没有尾箱数
|
||||
var hasPart = Math.Floor(boxCount_tag) != boxCount_tag;
|
||||
|
||||
//有小数点向上取整
|
||||
if (hasPart)
|
||||
boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag));
|
||||
return boxCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user