最小包装量
/// <summary> /// 计算最小包装数量 /// </summary> /// <param name="qty">订单数量</param> /// <param name="minPackagingQty">最小包装数量</param> /// <returns></returns> public decimal CalcMinPackagingQuantity(decimal minPackagingQty, decimal qty) { if (qty < minPackagingQty) { return minPackagingQty; } else if (qty % minPackagingQty == 0) {//刚好是最小包装量的倍数 return qty; } else { //倍数多1, 计算公式:倍数*最小包装量+最小包装量 return Math.Floor(qty / minPackagingQty) * minPackagingQty + minPackagingQty; } }