Browse Source

[fix]1.22.0719.1 过滤前缀不是PO的采购订单

master
贾荣国 2 years ago
parent
commit
e13048d797
  1. 13
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  2. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/AsnOptions.cs
  3. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj
  4. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

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

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
@ -13,6 +14,7 @@ using Volo.Abp.Validation;
using Win_in.Sfs.Scp.v1.Domain; using Win_in.Sfs.Scp.v1.Domain;
using System.Security.Policy; using System.Security.Policy;
using Volo.Abp.Data; using Volo.Abp.Data;
using Microsoft.Extensions.Options;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
{ {
@ -31,6 +33,7 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly ITenantStore _tenantStore; private readonly ITenantStore _tenantStore;
private readonly ITenantRepository _tenantRepository; private readonly ITenantRepository _tenantRepository;
private readonly IDataFilter _dataFilter; private readonly IDataFilter _dataFilter;
private readonly IOptions<AsnOptions> _options;
public PurchaseOrderAppService( public PurchaseOrderAppService(
IPurchaseOrderRepository repository IPurchaseOrderRepository repository
@ -40,6 +43,7 @@ namespace Win_in.Sfs.Scp.WebApi
, ITenantStore tenantStore , ITenantStore tenantStore
, ITenantRepository tenantRepository , ITenantRepository tenantRepository
, IDataFilter dataFilter , IDataFilter dataFilter
, IOptions<AsnOptions> options
) : base(repository) ) : base(repository)
{ {
_purchaseOrderRepository = repository; _purchaseOrderRepository = repository;
@ -49,6 +53,7 @@ namespace Win_in.Sfs.Scp.WebApi
_tenantStore = tenantStore; _tenantStore = tenantStore;
_tenantRepository = tenantRepository; _tenantRepository = tenantRepository;
_dataFilter = dataFilter; _dataFilter = dataFilter;
_options = options;
} }
@ -105,6 +110,8 @@ namespace Win_in.Sfs.Scp.WebApi
Validator.CheckSite(_tenantRepository, entity.Site); Validator.CheckSite(_tenantRepository, entity.Site);
Validator.CheckSite(_tenantRepository, entity.Company); Validator.CheckSite(_tenantRepository, entity.Company);
if (entity.PoNumber.StartsWith(_options.Value.ValidPoPre, true, CultureInfo.CurrentCulture))
{
var tenant = await _tenantStore.FindAsync(entity.Site); var tenant = await _tenantStore.FindAsync(entity.Site);
using (CurrentTenant.Change(tenant.Id, tenant.Name)) using (CurrentTenant.Change(tenant.Id, tenant.Name))
{ {
@ -113,12 +120,16 @@ namespace Win_in.Sfs.Scp.WebApi
Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.SupplierCode); Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.SupplierCode);
await UpsertTbPoAndTbPoDetailAsync(entity, tenant.Id); await UpsertTbPoAndTbPoDetailAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync(); await CurrentUnitOfWork.SaveChangesAsync();
} }
} }
} }
else
{
entity.ErrorMessage = $"'{entity.PoNumber}' is not start with '{_options.Value.ValidPoPre}',ignore.";
}
}
catch (Exception ex) catch (Exception ex)
{ {
var baseEx = ex.GetBaseException(); var baseEx = ex.GetBaseException();

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/AsnOptions.cs

@ -9,6 +9,7 @@ public class AsnOptions
public int RetryTimes { get; set; } = 3; public int RetryTimes { get; set; } = 3;
public int BatchSize { get; set; } = 10; public int BatchSize { get; set; } = 10;
public int MaxCount { get; set; } = 100; public int MaxCount { get; set; } = 100;
public string ValidPoPre { get; set; } = "PO";
public List<Site> Sites { get; set; } =new() ; public List<Site> Sites { get; set; } =new() ;
public class Site public class Site

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj

@ -7,8 +7,8 @@
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace> <RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace>
<PreserveCompilationReferences>true</PreserveCompilationReferences> <PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Win_in.Sfs.Scp.WebApi-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId> <UserSecretsId>Win_in.Sfs.Scp.WebApi-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
<AssemblyVersion>1.22.0711.1</AssemblyVersion> <AssemblyVersion>1.22.0719.1</AssemblyVersion>
<FileVersion>1.22.0711.1</FileVersion> <FileVersion>1.22.0719.1</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

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

@ -84,6 +84,7 @@
"RetryTimes": 3, "RetryTimes": 3,
"BatchSize": 10, "BatchSize": 10,
"MaxCount": 100, "MaxCount": 100,
"ValidPoPre": "PO",
"Receiver": "IACNA_ID", "Receiver": "IACNA_ID",
"Sites": [ "Sites": [
{ {

Loading…
Cancel
Save