Browse Source

[fix]计划外入库单使用address保存供应商ID

[fix]增加Site和VendID的校验
master
jiargcnXPS 3 years ago
parent
commit
1c6430680e
  1. 8
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/UnplannedReceiptCreateDTO.cs
  2. 7
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs
  3. 9
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  4. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs
  5. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs
  6. 9
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs
  7. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs
  8. 28
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Validator.cs
  9. 8
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs
  10. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs
  11. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220110060855_Init.Designer.cs
  12. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220111031851_AddTraceID.Designer.cs
  13. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220113030842_Decimal.Designer.cs
  14. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126082355_ModifyPoDetail.Designer.cs
  15. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126092735_AddErrorCodeAndErrorMessageToPart.Designer.cs
  16. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220127010533_AddErrorCodeAndErrorMessageToAll.Designer.cs
  17. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  18. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs
  19. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs
  20. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Win_in.Sfs.Scp.v1.EntityFrameworkCore.csproj

8
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/UnplannedReceiptCreateDTO.cs

@ -90,6 +90,14 @@ public class UnplannedReceiptCreateDTO : EntityDto,ICanTrace
public string SoJob { get; set; }
/// <summary>
/// 地址(Address)
/// </summary>
[XmlElement("address")]
[Display(Name = "地址(Address)")]
public string Address { get; set; }
/// <summary>
/// 备注(Remark)

7
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs

@ -4,11 +4,14 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using AutoMapper;
using AutoMapper.Configuration;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
using Microsoft.Extensions.Configuration;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
namespace Win_in.Sfs.Scp.WebApi
{
@ -23,14 +26,17 @@ namespace Win_in.Sfs.Scp.WebApi
{
private readonly IPartRepository _partRepository;
private readonly ITaPartRepository _taPartRepository;
private readonly string _validSites = Validator.VALID_SITES;
public PartAppService(
IPartRepository repository
,ITaPartRepository taPartRepository
,IConfiguration configuration
) : base(repository)
{
_partRepository = repository;
_taPartRepository = taPartRepository;
_validSites = configuration["ValidSites"];
}
/// <summary>
@ -72,6 +78,7 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
await UpsertTaPartAsync(entity);
await CurrentUnitOfWork.SaveChangesAsync();
}

9
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Win_in.Sfs.Scp.v1.Domain;
@ -20,16 +21,22 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly IPurchaseOrderRepository _purchaseOrderRepository;
private readonly ITbPoRepository _tbPoRepository;
private readonly ITbPoDetailRepository _tbPoDetailRepository;
private readonly ITaVenderRepository _taVenderRepository;
private readonly string _validSites = Validator.VALID_SITES;
public PurchaseOrderAppService(
IPurchaseOrderRepository repository
, ITbPoRepository tbPoRepository
, ITbPoDetailRepository tbPoDetailRepository
, ITaVenderRepository taVenderRepository
, IConfiguration configuration
) : base(repository)
{
_purchaseOrderRepository = repository;
_tbPoRepository = tbPoRepository;
_tbPoDetailRepository = tbPoDetailRepository;
_taVenderRepository = taVenderRepository;
_validSites = configuration["ValidSites"];
}
@ -75,6 +82,8 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
Validator.CheckSupplierCode(_taVenderRepository,entity.Site, entity.SupplierCode);
await UpsertTbPoAndTbPoDetailAsync(entity);
await CurrentUnitOfWork.SaveChangesAsync();

10
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
@ -21,16 +22,23 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly IReceiptRepository _receiptRepository;
private readonly ITbReceiptRepository _tbReceiptRepository;
private readonly ITbReceiptDetailRepository _tbReceiptDetailRepository;
private readonly ITaVenderRepository _taVenderRepository;
private readonly string _validSites = Validator.VALID_SITES;
public ReceiptAppService(
IReceiptRepository repository
,ITbReceiptRepository tbReceiptRepository
,ITbReceiptDetailRepository tbReceiptDetailRepository
,ITaVenderRepository taVenderRepository
, IConfiguration configuration
) : base(repository)
{
_receiptRepository = repository;
_tbReceiptRepository = tbReceiptRepository;
_tbReceiptDetailRepository = tbReceiptDetailRepository;
_taVenderRepository = taVenderRepository;
_validSites = configuration["ValidSites"];
}
@ -74,6 +82,8 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
Validator.CheckSupplierCode(_taVenderRepository,entity.Site, entity.SupplierCode);
await UpsertTbReceiptAndTbReceiptDetailAsync(entity);
await CurrentUnitOfWork.SaveChangesAsync();

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

@ -231,7 +231,7 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.RecvBillNum, p => p.MapFrom(q => q.TrNbr))
.ForMember(p => p.PoBillNum, p => p.MapFrom(q => ""))
.ForMember(p => p.AsnBillNum, p => p.MapFrom(q => q.Order))
.ForMember(p => p.VendId, p => p.MapFrom(q => q.SoJob))//默认值
.ForMember(p => p.VendId, p => p.MapFrom(q => q.Address))//默认值
// .ForMember(p => p.ShipTime, p => p.MapFrom(q => DateTime.MinValue))//默认值
.ForMember(p => p.State, p => p.MapFrom(q => 1))//TODO
.ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark))

9
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
@ -21,13 +22,18 @@ namespace Win_in.Sfs.Scp.WebApi
{
private readonly ISupplierRepository _supplierRepository;
private readonly ITaVenderRepository _taVenderRepository;
private readonly string _validSites = Validator.VALID_SITES;
public SuppliersAppService(
ISupplierRepository repository
,ITaVenderRepository taVenderRepository) : base(repository)
,ITaVenderRepository taVenderRepository
, IConfiguration configuration
) : base(repository)
{
_supplierRepository = repository;
_taVenderRepository = taVenderRepository;
_validSites = configuration["ValidSites"];
}
@ -70,6 +76,7 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Company);
UpsertTaVenderAsync(entity).Wait();
await CurrentUnitOfWork.SaveChangesAsync();

11
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
@ -21,16 +22,23 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly IUnplannedReceiptRepository _unplannedReceiptRepository;
private readonly ITbReceiptRepository _tbReceiptRepository;
private readonly ITbReceiptDetailRepository _tbReceiptDetailRepository;
private readonly ITaVenderRepository _taVenderRepository;
private readonly string _validSites = Validator.VALID_SITES;
public UnplannedReceiptAppService(
IUnplannedReceiptRepository repository
, ITbReceiptRepository tbReceiptRepository
, ITbReceiptDetailRepository tbReceiptDetailRepository
, ITaVenderRepository taVenderRepository
, IConfiguration configuration
) : base(repository)
{
_unplannedReceiptRepository = repository;
_tbReceiptRepository = tbReceiptRepository;
_tbReceiptDetailRepository = tbReceiptDetailRepository;
_taVenderRepository = taVenderRepository;
_validSites = configuration["ValidSites"];
}
@ -73,6 +81,9 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
Validator.CheckSupplierCode(_taVenderRepository,entity.Site, entity.Address);
await UpsertTbReceiptAndTbReceiptDetailAsync(entity);
await CurrentUnitOfWork.SaveChangesAsync();

28
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Validator.cs

@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using Volo.Abp;
using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.WebApi;
public static class Validator
{
public const string VALID_SITES = "T8";
public static void CheckSite(string validSites,string site)
{
if (!validSites.Contains(site) )
{
throw new UserFriendlyException($"Site must be in [{validSites}]");
}
}
public static void CheckSupplierCode(ITaVenderRepository taVenderRepository, string site, string supplierCode)
{
if (!taVenderRepository.Any(p =>p.Site==site && p.VendId == supplierCode))
{
throw new UserFriendlyException($"Wrong supplier code: '{supplierCode}' of Site : '{site}'");
}
}
}

8
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs

@ -78,6 +78,14 @@ namespace Win_in.Sfs.Scp.WebApi
public string SoJob { get; set; }
/// <summary>
/// 地址(Address)
/// </summary>
[Display(Name = "地址(Address)")]
public string Address { get; set; }
/// <summary>
/// 备注(Remark)
/// </summary>

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs

@ -267,6 +267,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
b.Property(q => q.Uom).IsRequired().HasMaxLength(8);
b.Property(q => q.Qty).IsRequired().HasPrecision(18, 6);
b.Property(q => q.SoJob).HasMaxLength(20);
b.Property(q => q.Address).HasMaxLength(8);
b.Property(q => q.Remark).HasMaxLength(4096);
b.Property(q => q.Site).IsRequired().HasMaxLength(8);
b.Property(q => q.Company).IsRequired().HasMaxLength(8);

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220110060855_Init.Designer.cs

@ -20,7 +20,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220111031851_AddTraceID.Designer.cs

@ -20,7 +20,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220113030842_Decimal.Designer.cs

@ -20,7 +20,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126082355_ModifyPoDetail.Designer.cs

@ -20,7 +20,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126092735_AddErrorCodeAndErrorMessageToPart.Designer.cs

@ -20,7 +20,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220127010533_AddErrorCodeAndErrorMessageToAll.Designer.cs

@ -20,7 +20,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

@ -34,5 +34,6 @@
}
}
},
"AlwaysAllowAuthorization": true
"AlwaysAllowAuthorization": true,
"ValidSites":"T8,"
}

2
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs

@ -20,7 +20,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TA_PART", b =>

2
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs

@ -18,7 +18,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore.Migrations
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.13")
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TA_PART", b =>

2
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Win_in.Sfs.Scp.v1.EntityFrameworkCore.csproj

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.13">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

Loading…
Cancel
Save