using System.ComponentModel.DataAnnotations; namespace DS.WMS.Core.Invoice.Dtos { /// /// 发票API请求实体 /// public class InvoiceAPIRequest { /// /// 唯一标识,由企业自己生成32位随机码【消息体】 /// public string senid { get; set; } = Guid.NewGuid().ToString("N"); } /// /// 发票冲红请求 /// public class InvoiceReversalRequest : InvoiceAPIRequest, IValidatableObject { /// /// 发票ID,用于获取发票业务号,传入发票业务号时此字段可为空 /// public long? InvoiceId { get; set; } /// /// 发票业务号 /// public string orderNo { get; set; } = string.Empty; /// /// 冲红原因代码:00-直接冲红,01-开票有误,02-销货退回,03-服务中止,04-销售折让,默认值:00 /// public string chyyDm { get; set; } = "00"; /// /// 冲红原因描述 /// public string? Reason { get; set; } /// /// 录入方身份:0-销方,1-购方,默认值:0 /// public string lrfsf { get; set; } = "0"; public IEnumerable Validate(ValidationContext validationContext) { if (InvoiceId == null && string.IsNullOrEmpty(orderNo)) { yield return new ValidationResult($"参数:{nameof(InvoiceId)}和{nameof(orderNo)} 必须指定其中一项"); } } } }