/// <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; } }
标签:return,包装,decimal,最小,qty,minPackagingQty From: https://www.cnblogs.com/friend/p/17317573.html