优化箱唛列表

This commit is contained in:
tongfei
2024-02-20 09:40:22 +08:00
parent 91258cec55
commit 6e5f39c120
7 changed files with 99 additions and 2 deletions

View File

@@ -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;
}
}
}