Browse Source

[fix]调整映射默认值

master
贾荣国Home 3 years ago
parent
commit
e63c000825
  1. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDtoValidator.cs
  2. 6
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptCreateDtoValidator.cs
  3. 23
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDtoValidator.cs

@ -1,4 +1,5 @@
using FluentValidation; using System.Collections.Generic;
using FluentValidation;
namespace Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.WebApi;

6
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptCreateDtoValidator.cs

@ -10,15 +10,15 @@ public class ReceiptCreateDtoValidator : AbstractValidator<ReceiptCreateDTO>
RuleFor(q => q.AsnNumber).MaximumLength(64); RuleFor(q => q.AsnNumber).MaximumLength(64);
RuleFor(q => q.PoNumber).MaximumLength(64); RuleFor(q => q.PoNumber).MaximumLength(64);
RuleFor(q => q.SupplierCode).MaximumLength(64).NotEmpty(); RuleFor(q => q.SupplierCode).MaximumLength(64).NotEmpty();
RuleFor(q => q.RcType).MaximumLength(64).NotNull(); RuleFor(q => q.RcType).MaximumLength(64);
RuleFor(q => q.Warehouse).MaximumLength(64); RuleFor(q => q.Warehouse).MaximumLength(64);
RuleFor(q => q.Dock).MaximumLength(64); RuleFor(q => q.Dock).MaximumLength(64);
RuleFor(q => q.ReceiveDate).NotNull(); RuleFor(q => q.ReceiveDate).NotNull();
RuleFor(q => q.ReceiveTime); RuleFor(q => q.ReceiveTime);
RuleFor(q => q.PoLine).MaximumLength(64); RuleFor(q => q.PoLine).MaximumLength(64);
RuleFor(q => q.PartCode).MaximumLength(64).NotEmpty(); RuleFor(q => q.PartCode).MaximumLength(64).NotEmpty();
RuleFor(q => q.Lot).MaximumLength(64).NotNull(); RuleFor(q => q.Lot).MaximumLength(64);
RuleFor(q => q.SupplierLot).NotNull(); RuleFor(q => q.SupplierLot);
RuleFor(q => q.Uom).MaximumLength(64).NotNull(); RuleFor(q => q.Uom).MaximumLength(64).NotNull();
RuleFor(q => q.ReceiveQty).NotNull(); RuleFor(q => q.ReceiveQty).NotNull();
RuleFor(q => q.SupplierPackConvertRate).NotNull(); RuleFor(q => q.SupplierPackConvertRate).NotNull();

23
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs

@ -38,9 +38,8 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.PartGroup, p => p.MapFrom(q => q.Group)) .ForMember(p => p.PartGroup, p => p.MapFrom(q => q.Group))
.ForMember(p => p.State, p => p.MapFrom(q => q.Status)) .ForMember(p => p.State, p => p.MapFrom(q => q.Status))
.ForMember(p => p.Configuration, p => p.MapFrom(q => q.Type))//TODO .ForMember(p => p.Configuration, p => p.MapFrom(q => q.Type))//TODO
.ForMember(p => p.ValidityDays, p => p.MapFrom(q => 0))//默认值
// .ForMember(p => p.ValidityDays, p => p.MapFrom(q => 0))//默认值 .ForMember(p => p.ReceivePort, p => p.MapFrom(q => q.Desc2))//默认值
// .ForMember(p => p.ReceivePort, p => p.MapFrom(q => ""))//默认值
// .ForMember(p => p.PalletSize, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.PalletSize, p => p.MapFrom(q => ""))//默认值
.ForMember(p => p.Remark, p => p.MapFrom(q => q.Version)) .ForMember(p => p.Remark, p => p.MapFrom(q => q.Version))
// .ForMember(p => p.Qlevel, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.Qlevel, p => p.MapFrom(q => ""))//默认值
@ -69,10 +68,10 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.Contacter, p => p.MapFrom(q => q.ContactName)) .ForMember(p => p.Contacter, p => p.MapFrom(q => q.ContactName))
.ForMember(p => p.Phone, p => p.MapFrom(q => q.Phone)) .ForMember(p => p.Phone, p => p.MapFrom(q => q.Phone))
.ForMember(p => p.Fax, p => p.MapFrom(q => q.Fax)) .ForMember(p => p.Fax, p => p.MapFrom(q => q.Fax))
// .ForMember(p => p.Email, p => p.MapFrom(q => ""))//接口没有传入Email .ForMember(p => p.Email, p => p.MapFrom(q => ""))//接口没有传入Email
.ForMember(p => p.State, p => p.MapFrom(q => q.IsActive ? 1 : 0))//1:有效,2:无效 .ForMember(p => p.State, p => p.MapFrom(q => q.IsActive ? 1 : 0))//1:有效,2:无效
.ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark))
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
// .ForMember(p => p.ReceiveTimeScope, p => p.MapFrom(q =>0))//默认值 // .ForMember(p => p.ReceiveTimeScope, p => p.MapFrom(q =>0))//默认值
// .ForMember(p => p.Quota, p => p.MapFrom(q =>0))//默认值 // .ForMember(p => p.Quota, p => p.MapFrom(q =>0))//默认值
; ;
@ -105,7 +104,7 @@ namespace Win_in.Sfs.Scp.WebApi
// .ForMember(p => p.OperName, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.OperName, p => p.MapFrom(q => ""))//默认值
.ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货 .ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
; ;
var poLine = 0; var poLine = 0;
@ -118,7 +117,7 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber)) .ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber))
.ForMember(p => p.PoLine, p => p.MapFrom(q => int.TryParse(q.PoLine, out poLine) ? poLine : 0)) .ForMember(p => p.PoLine, p => p.MapFrom(q => int.TryParse(q.PoLine, out poLine) ? poLine : 0))
.ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode)) .ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode))
.ForMember(p => p.Batch, p => p.MapFrom(q => q.Lot)) .ForMember(p => p.Batch, p => p.MapFrom(q => string.IsNullOrEmpty(q.Lot)?"":q.Lot))
.ForMember(p => p.Qty, p => p.MapFrom(q => q.ReceiveQty)) .ForMember(p => p.Qty, p => p.MapFrom(q => q.ReceiveQty))
.ForMember(p => p.DockCode, p => p.MapFrom(q => q.Dock)) .ForMember(p => p.DockCode, p => p.MapFrom(q => q.Dock))
.ForMember(p => p.State, p => p.MapFrom(q => 0))//0:未处理 .ForMember(p => p.State, p => p.MapFrom(q => 0))//0:未处理
@ -129,14 +128,14 @@ namespace Win_in.Sfs.Scp.WebApi
// .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值
.ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值
.ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货 .ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货
.ForMember(p => p.VendBatch, p => p.MapFrom(q => q.SupplierLot)) .ForMember(p => p.VendBatch, p => p.MapFrom(q => string.IsNullOrEmpty(q.SupplierLot)?"":q.Lot))
.ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom)) .ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom))
.ForMember(p => p.LocUnit, p => p.MapFrom(q => q.Uom)) .ForMember(p => p.LocUnit, p => p.MapFrom(q => q.Uom))
// .ForMember(p => p.PurCost, p => p.MapFrom(q => 0))//默认值 .ForMember(p => p.PurCost, p => p.MapFrom(q => 0))//默认值
// .ForMember(p => p.StdCost, p => p.MapFrom(q => 0))//默认值 .ForMember(p => p.StdCost, p => p.MapFrom(q => 0))//默认值
.ForMember(p => p.Rate, p => p.MapFrom(q => q.SupplierPackConvertRate)) .ForMember(p => p.Rate, p => p.MapFrom(q => q.SupplierPackConvertRate))
// .ForMember(p => p.CurAmt, p => p.MapFrom(q => 0))//默认值 .ForMember(p => p.CurAmt, p => p.MapFrom(q => 0))//默认值
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
// .ForMember(p => p.Extend1, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.Extend1, p => p.MapFrom(q => ""))//默认值
// .ForMember(p => p.Extend2, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.Extend2, p => p.MapFrom(q => ""))//默认值
// .ForMember(p => p.Extend3, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.Extend3, p => p.MapFrom(q => ""))//默认值

Loading…
Cancel
Save