You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.3 KiB
C#

using DS.Module.Core.Extensions;
using FluentValidation;
namespace DS.WMS.Core.FeeModule.Dtos;
public class WmsFeeRateDetailInput
{
public Guid? ID { get; set; }
public Guid? FEERATEID { get; set; }
public string FEEMAKETYPE { get; set; } = "";
public string FEENAME { get; set; } = "";
public string DEFAULTUNIT { get; set; } = "";
public decimal? FEEPRICE { get; set; } = 0;
public byte? FEETYPE { get; set; } = 0;
public byte? FEEGRADE { get; set; } = 0;
public int? FEESCALE { get; set; } = 0;
public decimal? ADDPRICE { get; set; } = 0;
public decimal? ENDPRICE { get; set; } = 0;
public string REMARK { get; set; } = "";
public string INPUTMODE { get; set; } = "";
public string FeeId { get; set; }
}
/// <summary>
/// 验证
/// </summary>
public class WmsFeeRateDetailInputValidator : AbstractValidator<WmsFeeRateDetailInput>
{
/// <summary>
/// 构造函数
/// </summary>
public WmsFeeRateDetailInputValidator()
{
this.RuleFor(o => o.FEEPRICE)
.GreaterThan(0).WithMessage("计费单价必须大于0")
.Custom((price, context) =>
{
if (price.ToDecimal() < 0)
{
context.AddFailure("计费单价必须为正数!");
}
});
}
}