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.

80 lines
1.7 KiB
C#

using DS.Module.Core.Extensions;
using DS.WMS.Core.FeeModule.Dtos;
using FluentValidation;
namespace DS.WMS.Core.WmsModule.Dtos;
public class WmsInPlanFeeRateInput
{
public Guid? Id { get; set; }
/// <summary>
/// 明细
/// </summary>
public List<WmsInFeeRateDetailInput> List { get; set; }
}
public class WmsInFeeRateDetailInput
{
public Guid? GID { get; set; }
// public Guid? ID { get; set; }
public Guid? FEERATEDETAILID { 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 Guid? GoodsFeeTypeGID { get; set; }
public string GOODSFEETYPE { get; set; }
public string FeeId { get; set; }
}
/// <summary>
/// 验证
/// </summary>
public class WmsInFeeRateDetailInputValidator : AbstractValidator<WmsInFeeRateDetailInput>
{
/// <summary>
/// 构造函数
/// </summary>
public WmsInFeeRateDetailInputValidator()
{
this.RuleFor(o => o.FEEPRICE)
.GreaterThan(0).WithMessage("计费单价必须大于0")
.Custom((price, context) =>
{
if (price.ToDecimal() < 0)
{
context.AddFailure("计费单价必须为正数!");
}
});
}
}