Browse Source

[add] EventHandler

master
贾荣国 3 years ago
parent
commit
3c4519bbb3
  1. 12
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDto.cs
  2. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderCreateDTO.cs
  3. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptCreateDTO.cs
  4. 9
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierCreateDTO.cs
  5. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/UnplannedReceiptCreateDTO.cs
  6. 6
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs
  7. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  8. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs
  9. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs
  10. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs
  11. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs
  12. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Win_in.Sfs.Scp.WebApi.Application.csproj
  13. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.DbMigrator/appsettings.json
  14. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Data/WebApiDbMigrationService.cs
  15. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/Part.cs
  16. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/WebApiDomainModule.cs
  17. 16
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/EntityFrameworkCore/PartRepository.cs
  18. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/EntityFrameworkCore/WebApiEntityFrameworkCoreModule.cs
  19. 2857
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220111031851_AddTraceID.Designer.cs
  20. 69
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220111031851_AddTraceID.cs
  21. 15
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs
  22. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.csproj
  23. 8
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs
  24. 28
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  25. 5
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Parts/ITaPartRepository.cs
  26. 5
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoRepository.cs
  27. 5
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptRepository.cs
  28. 5
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs
  29. 5
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/ITaVenderRepository.cs
  30. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Win_in.Sfs.Scp.v1.EntityFrameworkCore.csproj
  31. 18
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs
  32. 6
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/V1ScpEventModule.cs
  33. 1
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/Win_in.Sfs.Scp.v1.Event.csproj

12
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDto.cs

@ -1,9 +1,11 @@
using System.ComponentModel.DataAnnotations; using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.WebApi;
public class PartCreateDto : EntityDto public class PartCreateDto : EntityDto,ICanTrace
{ {
/// <summary> /// <summary>
/// 代码(Code) /// 代码(Code)
@ -100,4 +102,10 @@ public class PartCreateDto : EntityDto
/// </summary> /// </summary>
[Display(Name = "公司")] [Display(Name = "公司")]
public string Company { get; set; } public string Company { get; set; }
/// <summary>
/// 跟踪编号(Trace ID)
/// </summary>
[Display(Name = "跟踪编号")]
public Guid TraceId { get; set; }
} }

10
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderCreateDTO.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.WebApi;
@ -9,7 +10,7 @@ namespace Win_in.Sfs.Scp.WebApi;
/// 采购订单DTO(Purchase order DTO) /// 采购订单DTO(Purchase order DTO)
/// </summary> /// </summary>
public class PurchaseOrderCreateDTO : EntityDto public class PurchaseOrderCreateDTO : EntityDto,ICanTrace
{ {
/// <summary> /// <summary>
@ -98,4 +99,11 @@ public class PurchaseOrderCreateDTO : EntityDto
public virtual ICollection<PurchaseOrderDetailDTO> Details { get; set; } public virtual ICollection<PurchaseOrderDetailDTO> Details { get; set; }
/// <summary>
/// 跟踪编号(Trace ID)
/// </summary>
[Display(Name = "跟踪编号")]
public Guid TraceId { get; set; }
} }

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

@ -1,13 +1,14 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.WebApi;
/// <summary> /// <summary>
/// 收货单DTO(Receipt DTO) /// 收货单DTO(Receipt DTO)
/// </summary> /// </summary>
public class ReceiptCreateDTO : EntityDto public class ReceiptCreateDTO : EntityDto,ICanTrace
{ {
/// <summary> /// <summary>
/// 收货单号(RcNumber) /// 收货单号(RcNumber)
@ -123,4 +124,11 @@ public class ReceiptCreateDTO : EntityDto
/// </summary> /// </summary>
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
/// <summary>
/// 跟踪编号(Trace ID)
/// </summary>
[Display(Name = "跟踪编号")]
public Guid TraceId { get; set; }
} }

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

@ -1,12 +1,14 @@
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.WebApi;
/// <summary> /// <summary>
/// 供应商DTO(Supplier DTO) /// 供应商DTO(Supplier DTO)
/// </summary> /// </summary>
public class SupplierCreateDTO : EntityDto public class SupplierCreateDTO : EntityDto,ICanTrace
{ {
/// <summary> /// <summary>
/// 代码(Code) /// 代码(Code)
@ -104,5 +106,10 @@ public class SupplierCreateDTO : EntityDto
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary>
/// 跟踪编号(Trace ID)
/// </summary>
[Display(Name = "跟踪编号")]
public Guid TraceId { get; set; }
} }

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

@ -1,13 +1,14 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.WebApi;
/// <summary> /// <summary>
/// 计划外入库单DTO(Unplanned Receipt DTO) /// 计划外入库单DTO(Unplanned Receipt DTO)
/// </summary> /// </summary>
public class UnplannedReceiptCreateDTO : EntityDto public class UnplannedReceiptCreateDTO : EntityDto,ICanTrace
{ {
/// <summary> /// <summary>
/// 单号(TrNbr) /// 单号(TrNbr)
@ -95,4 +96,11 @@ public class UnplannedReceiptCreateDTO : EntityDto
/// </summary> /// </summary>
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
/// <summary>
/// 跟踪编号(Trace ID)
/// </summary>
[Display(Name = "跟踪编号")]
public Guid TraceId { get; set; }
} }

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

@ -7,13 +7,14 @@ using AutoMapper;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
{ {
/// <summary> /// <summary>
/// 零件服务 /// 零件服务
/// </summary> /// </summary>
[AllowAnonymous] [Authorize]
[Route("api/scp/part")] [Route("api/scp/part")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
@ -58,7 +59,8 @@ namespace Win_in.Sfs.Scp.WebApi
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("")] [Route("")]
public async Task<PartDTO> CreateAsync(PartCreateDto partCreateDTO) [UnitOfWork]
public virtual async Task<PartDTO> CreateAsync(PartCreateDto partCreateDTO)
{ {
var entity = ObjectMapper.Map<PartCreateDto, Part>(partCreateDTO); var entity = ObjectMapper.Map<PartCreateDto, Part>(partCreateDTO);

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

@ -11,7 +11,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 采购订单服务 /// 采购订单服务
/// </summary> /// </summary>
[AllowAnonymous] [Authorize]
[Route("api/scp/po")] [Route("api/scp/po")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class PurchaseOrderAppService : ReadOnlyAppService<PurchaseOrder, PurchaseOrderDTO, Guid,RequestDTO>, IPurchaseOrderAppService public class PurchaseOrderAppService : ReadOnlyAppService<PurchaseOrder, PurchaseOrderDTO, Guid,RequestDTO>, IPurchaseOrderAppService

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

@ -11,7 +11,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 收货单服务 /// 收货单服务
/// </summary> /// </summary>
[AllowAnonymous] [Authorize]
[Route("api/scp/receipt")] [Route("api/scp/receipt")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class ReceiptAppService : ReadOnlyAppService<Receipt, ReceiptDTO, Guid,RequestDTO>, IReceiptAppService public class ReceiptAppService : ReadOnlyAppService<Receipt, ReceiptDTO, Guid,RequestDTO>, IReceiptAppService

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

@ -12,7 +12,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 供应商服务 /// 供应商服务
/// </summary> /// </summary>
[AllowAnonymous] [Authorize]
[Route("api/scp/supplier")] [Route("api/scp/supplier")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class SuppliersAppService : ReadOnlyAppService<Supplier, SupplierDTO, Guid,RequestDTO>, ISupplierAppService public class SuppliersAppService : ReadOnlyAppService<Supplier, SupplierDTO, Guid,RequestDTO>, ISupplierAppService

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

@ -9,9 +9,9 @@ using Volo.Abp.Application.Services;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
{ {
/// <summary> /// <summary>
/// 收货单服务 /// 计划外入库单服务
/// </summary> /// </summary>
[AllowAnonymous] [Authorize]
[Route("api/scp/unplanned-receipt")] [Route("api/scp/unplanned-receipt")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class UnplannedReceiptAppService : ReadOnlyAppService<UnplannedReceipt, UnplannedReceiptDTO, Guid,RequestDTO>, IUnplannedReceiptAppService public class UnplannedReceiptAppService : ReadOnlyAppService<UnplannedReceipt, UnplannedReceiptDTO, Guid,RequestDTO>, IUnplannedReceiptAppService
@ -25,7 +25,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 按ID获取收货单 (Get receipt by ID) /// 按ID获取计划外入库单 (Get unplanned receipt by ID)
/// </summary> /// </summary>
/// <param name="id">唯一ID(unique ID)</param> /// <param name="id">唯一ID(unique ID)</param>
/// <returns></returns> /// <returns></returns>
@ -38,7 +38,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 按请求条件获取收货单列表(Get receipt list by request condition) /// 按请求条件获取计划外入库单列表(Get unplanned receipt list by request condition)
/// </summary> /// </summary>
/// <param name="requestDTO">请求条件DTO(Request condition DTO)</param> /// <param name="requestDTO">请求条件DTO(Request condition DTO)</param>
/// <returns></returns> /// <returns></returns>
@ -51,7 +51,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 新增收货单(Create receipt) /// 新增计划外入库单(Create unplanned receipt)
/// </summary> /// </summary>
/// <param name="receiptCreateDTO"></param> /// <param name="receiptCreateDTO"></param>
/// <returns></returns> /// <returns></returns>

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs

@ -7,6 +7,7 @@ using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement; using Volo.Abp.SettingManagement;
using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
{ {
[DependsOn( [DependsOn(

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Win_in.Sfs.Scp.WebApi.Application.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />

10
WebApiService/src/Win_in.Sfs.Scp.WebApi.DbMigrator/appsettings.json

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Scp_WehApi;User ID=sa;Password=Microsoft2008;connection timeout=600;", "Default": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"WebApi": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;" "WebApi": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;"
}, },
"IdentityServer": { "IdentityServer": {
@ -8,22 +8,22 @@
"WebApi_Web": { "WebApi_Web": {
"ClientId": "WebApi_Web", "ClientId": "WebApi_Web",
"ClientSecret": "1q2w3e*", "ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:44322" "RootUrl": "https://localhost:9988"
}, },
"WebApi_App": { "WebApi_App": {
"ClientId": "WebApi_App", "ClientId": "WebApi_App",
"ClientSecret": "1q2w3e*", "ClientSecret": "1q2w3e*",
"RootUrl": "http://localhost:4200" "RootUrl": "https://localhost:9988"
}, },
"WebApi_BlazorServerTiered": { "WebApi_BlazorServerTiered": {
"ClientId": "WebApi_BlazorServerTiered", "ClientId": "WebApi_BlazorServerTiered",
"ClientSecret": "1q2w3e*", "ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:44314" "RootUrl": "https://localhost:9988"
}, },
"WebApi_Swagger": { "WebApi_Swagger": {
"ClientId": "WebApi_Swagger", "ClientId": "WebApi_Swagger",
"ClientSecret": "1q2w3e*", "ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:44359" "RootUrl": "https://localhost:9988"
} }
} }
} }

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Data/WebApiDbMigrationService.cs

@ -197,7 +197,7 @@ namespace Win_in.Sfs.Scp.WebApi.Data
var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src"); var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src");
return Directory.GetDirectories(srcDirectoryPath) return Directory.GetDirectories(srcDirectoryPath)
.FirstOrDefault(d => d.EndsWith(".EntityFrameworkCore")); .FirstOrDefault(d => d.EndsWith("WebApi.EntityFrameworkCore"));
} }
private string GetSolutionDirectoryPath() private string GetSolutionDirectoryPath()

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/Part.cs

@ -1,5 +1,6 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Guids; using Volo.Abp.Guids;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -164,5 +165,4 @@ namespace Win_in.Sfs.Scp.WebApi
Id = id; Id = id;
} }
} }
} }

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/WebApiDomainModule.cs

@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
using Win_in.Sfs.Scp.WebApi.MultiTenancy; using Win_in.Sfs.Scp.WebApi.MultiTenancy;
using Volo.Abp.AuditLogging; using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs; using Volo.Abp.BackgroundJobs;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.Emailing; using Volo.Abp.Emailing;
using Volo.Abp.FeatureManagement; using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity; using Volo.Abp.Identity;
@ -41,6 +42,9 @@ namespace Win_in.Sfs.Scp.WebApi
#if DEBUG #if DEBUG
context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>()); context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
#endif #endif
} }
} }
} }

16
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/EntityFrameworkCore/PartRepository.cs

@ -1,4 +1,6 @@
using System; using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -6,7 +8,21 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore;
public class PartRepository:EfCoreRepository<WebApiDbContext,Part,Guid> ,IPartRepository public class PartRepository:EfCoreRepository<WebApiDbContext,Part,Guid> ,IPartRepository
{ {
private readonly IDbContextProvider<WebApiDbContext> _dbContextProvider;
private WebApiDbContext db;
public PartRepository(IDbContextProvider<WebApiDbContext> dbContextProvider) : base(dbContextProvider) public PartRepository(IDbContextProvider<WebApiDbContext> dbContextProvider) : base(dbContextProvider)
{ {
_dbContextProvider = dbContextProvider;
} }
/*
public override async Task<Part> InsertAsync(Part entity, bool autoSave = false, CancellationToken cancellationToken = new CancellationToken())
{
db = _dbContextProvider.GetDbContextAsync().Result;
await db.Parts.AddAsync(entity, cancellationToken);
await db.SaveChangesAsync(cancellationToken);
return entity;
// return base.InsertAsync(entity, autoSave, cancellationToken);
}*/
} }

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/EntityFrameworkCore/WebApiEntityFrameworkCoreModule.cs

@ -12,6 +12,7 @@ using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore; using Volo.Abp.TenantManagement.EntityFrameworkCore;
// using Win_in.Sfs.Scp.v1.Event;
namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
{ {
@ -27,6 +28,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule) typeof(AbpFeatureManagementEntityFrameworkCoreModule)
)] )]
// [DependsOn(typeof(V1ScpEventModule))]
public class WebApiEntityFrameworkCoreModule : AbpModule public class WebApiEntityFrameworkCoreModule : AbpModule
{ {
public override void PreConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)
@ -75,6 +77,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
options.UseSqlServer(); options.UseSqlServer();
}); });
} }
} }
} }

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

File diff suppressed because it is too large

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

@ -0,0 +1,69 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class AddTraceID : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "TraceId",
table: "WebApi_UnplannedReceipt",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "TraceId",
table: "WebApi_Suppliers",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "TraceId",
table: "WebApi_Receipt",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "TraceId",
table: "WebApi_PO",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "TraceId",
table: "WebApi_Part",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TraceId",
table: "WebApi_UnplannedReceipt");
migrationBuilder.DropColumn(
name: "TraceId",
table: "WebApi_Suppliers");
migrationBuilder.DropColumn(
name: "TraceId",
table: "WebApi_Receipt");
migrationBuilder.DropColumn(
name: "TraceId",
table: "WebApi_PO");
migrationBuilder.DropColumn(
name: "TraceId",
table: "WebApi_Part");
}
}
}

15
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs

@ -2007,6 +2007,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasMaxLength(64) .HasMaxLength(64)
.HasColumnType("nvarchar(64)"); .HasColumnType("nvarchar(64)");
b.Property<Guid>("TraceId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Type") b.Property<string>("Type")
.HasMaxLength(64) .HasMaxLength(64)
.HasColumnType("nvarchar(64)"); .HasColumnType("nvarchar(64)");
@ -2099,6 +2102,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<decimal>("TaxRate") b.Property<decimal>("TaxRate")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<Guid>("TraceId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Version") b.Property<string>("Version")
.IsRequired() .IsRequired()
.HasMaxLength(64) .HasMaxLength(64)
@ -2264,6 +2270,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<decimal>("SupplierPackConvertRate") b.Property<decimal>("SupplierPackConvertRate")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<Guid>("TraceId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Uom") b.Property<string>("Uom")
.IsRequired() .IsRequired()
.HasMaxLength(64) .HasMaxLength(64)
@ -2366,6 +2375,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasMaxLength(4096) .HasMaxLength(4096)
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<Guid>("TraceId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("WebApi_Suppliers"); b.ToTable("WebApi_Suppliers");
@ -2448,6 +2460,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasMaxLength(8) .HasMaxLength(8)
.HasColumnType("nvarchar(8)"); .HasColumnType("nvarchar(8)");
b.Property<Guid>("TraceId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Uom") b.Property<string>("Uom")
.IsRequired() .IsRequired()
.HasMaxLength(8) .HasMaxLength(8)

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

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />

8
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs

@ -63,6 +63,14 @@ namespace Win_in.Sfs.Scp.WebApi
ConfigureVirtualFileSystem(context); ConfigureVirtualFileSystem(context);
ConfigureCors(context, configuration); ConfigureCors(context, configuration);
ConfigureSwaggerServices(context, configuration); ConfigureSwaggerServices(context, configuration);
ConfigureAuthorization(context);
}
private static void ConfigureAuthorization(ServiceConfigurationContext context)
{
//绕过授权服务
context.Services.AddAlwaysAllowAuthorization();
} }
private void ConfigureBundles() private void ConfigureBundles()

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

@ -2,10 +2,10 @@
"App": { "App": {
"SelfUrl": "https://localhost:9988", "SelfUrl": "https://localhost:9988",
"CorsOrigins": "http://*.WebApi.com", "CorsOrigins": "http://*.WebApi.com",
"RedirectAllowedUrls": "http://localhost:4200,http://localhost:9988" "RedirectAllowedUrls": "http://localhost:4200,https://localhost:9988"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Scp_WehApi;User ID=sa;Password=Microsoft2008;connection timeout=600;", "Default": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"WebApi": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;" "WebApi": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;"
}, },
"AuthServer": { "AuthServer": {
@ -13,5 +13,29 @@
"RequireHttpsMetadata": "false", "RequireHttpsMetadata": "false",
"SwaggerClientId": "WebApi_Swagger", "SwaggerClientId": "WebApi_Swagger",
"SwaggerClientSecret": "1q2w3e*" "SwaggerClientSecret": "1q2w3e*"
},
"IdentityServer": {
"Clients": {
"WebApi_Web": {
"ClientId": "WebApi_Web",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:9988"
},
"WebApi_App": {
"ClientId": "WebApi_App",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:9988"
},
"WebApi_BlazorServerTiered": {
"ClientId": "WebApi_BlazorServerTiered",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:9988"
},
"WebApi_Swagger": {
"ClientId": "WebApi_Swagger",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:9988"
}
}
} }
} }

5
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Parts/ITaPartRepository.cs

@ -1,8 +1,9 @@
using Volo.Abp.Domain.Repositories; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Scp.v1.Domain namespace Win_in.Sfs.Scp.v1.Domain
{ {
public interface ITaPartRepository : IRepository<TA_PART> public interface ITaPartRepository : IRepository<TA_PART>,ITransientDependency
{ {
} }

5
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoRepository.cs

@ -1,8 +1,9 @@
using Volo.Abp.Domain.Repositories; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Scp.v1.Domain namespace Win_in.Sfs.Scp.v1.Domain
{ {
public interface ITbPoRepository : IRepository<TB_PO> public interface ITbPoRepository : IRepository<TB_PO>, ITransientDependency
{ {
} }

5
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptRepository.cs

@ -1,8 +1,9 @@
using Volo.Abp.Domain.Repositories; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Scp.v1.Domain namespace Win_in.Sfs.Scp.v1.Domain
{ {
public interface ITbReceiptRepository : IRepository<TB_RECEIVE_QAD> public interface ITbReceiptRepository : IRepository<TB_RECEIVE_QAD>, ITransientDependency
{ {
} }

5
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs

@ -1,8 +1,9 @@
using Volo.Abp.Domain.Repositories; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Scp.v1.Domain namespace Win_in.Sfs.Scp.v1.Domain
{ {
public interface ITbRejectRepository : IRepository<TB_REJECT> public interface ITbRejectRepository : IRepository<TB_REJECT>, ITransientDependency
{ {
} }

5
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/ITaVenderRepository.cs

@ -1,8 +1,9 @@
using Volo.Abp.Domain.Repositories; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Scp.v1.Domain namespace Win_in.Sfs.Scp.v1.Domain
{ {
public interface ITaVenderRepository : IRepository<TA_VENDER> public interface ITaVenderRepository : IRepository<TA_VENDER>, ITransientDependency
{ {
} }

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

@ -5,6 +5,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Volo.Abp.Core" Version="4.4.2" /> <PackageReference Include="Volo.Abp.Core" Version="4.4.2" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.4.2" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.4.2" />
</ItemGroup> </ItemGroup>

18
WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs

@ -1,12 +1,18 @@
using System.Threading.Tasks; using System;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Win_in.Sfs.Scp.v1.Domain; using Win_in.Sfs.Scp.v1.Domain;
using Win_in.Sfs.Scp.WebApi; using Win_in.Sfs.Scp.WebApi;
namespace Win_in.Sfs.Scp.v1.Event namespace Win_in.Sfs.Scp.v1.Event
{ {
public class PartEventHandler:ILocalEventHandler<EntityCreatedEto<Part>> public class PartEventHandler
: ILocalEventHandler<EntityCreatedEventData<Part>>,
ITransientDependency
{ {
private readonly ITaPartRepository _taPartRepository; private readonly ITaPartRepository _taPartRepository;
@ -15,12 +21,14 @@ namespace Win_in.Sfs.Scp.v1.Event
_taPartRepository = taPartRepository; _taPartRepository = taPartRepository;
} }
public Task HandleEventAsync(EntityCreatedEto<Part> eventData) public Task HandleEventAsync(EntityCreatedEventData<Part> eventData)
{ {
throw new System.NotImplementedException(); Console.WriteLine("Local Event:" + eventData.Entity.Id);
return Task.CompletedTask;
// throw new System.NotImplementedException();
//TODO 根据传入数据新增或修改TA_PART //TODO 根据传入数据新增或修改TA_PART
} }
} }
} }

6
WebApiService/src/Win_in.Sfs.Scp.v1.Event/V1ScpDomainModule.cs → WebApiService/src/Win_in.Sfs.Scp.v1.Event/V1ScpEventModule.cs

@ -16,10 +16,8 @@ namespace Win_in.Sfs.Scp.v1.Event
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<AbpDistributedEntityEventOptions>(options =>
{
options.AutoEventSelectors.AddAll();
});
} }
} }
} }

1
WebApiService/src/Win_in.Sfs.Scp.v1.Event/Win_in.Sfs.Scp.v1.Event.csproj

@ -11,6 +11,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Win_in.Sfs.Scp.v1.Domain\Win_in.Sfs.Scp.v1.Domain.csproj" /> <ProjectReference Include="..\Win_in.Sfs.Scp.v1.Domain\Win_in.Sfs.Scp.v1.Domain.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.v1.EntityFrameworkCore\Win_in.Sfs.Scp.v1.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Domain\Win_in.Sfs.Scp.WebApi.Domain.csproj" /> <ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Domain\Win_in.Sfs.Scp.WebApi.Domain.csproj" />
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save