diff --git a/WebApiService/Win_in.Sfs.Scp.WebApi.sln b/WebApiService/Win_in.Sfs.Scp.WebApi.sln index 1b99ce9..57b1d77 100644 --- a/WebApiService/Win_in.Sfs.Scp.WebApi.sln +++ b/WebApiService/Win_in.Sfs.Scp.WebApi.sln @@ -49,7 +49,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scp", "scp", "{925EA68F-25D EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "webApi", "webApi", "{A79A01B2-9532-4C6B-880F-193251F3B9F3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win_in.Sfs.Scp.WebApi.Console", "src\Win_in.Sfs.Scp.WebApi.Console\Win_in.Sfs.Scp.WebApi.Console.csproj", "{FAC4C418-08A2-48C5-A966-A832FB091C78}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.Console", "src\Win_in.Sfs.Scp.WebApi.Console\Win_in.Sfs.Scp.WebApi.Console.csproj", "{FAC4C418-08A2-48C5-A966-A832FB091C78}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apps", "apps", "{F4E990AA-C8C9-4574-9027-CC2640A6C1BB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -158,7 +160,7 @@ Global {98CDED94-F046-4010-88F4-700B7481169E} = {44A92E7C-E2FC-4F37-AF3D-6B7213EF54FE} {925EA68F-25D1-444F-A79B-EB9BF754EC3C} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {A79A01B2-9532-4C6B-880F-193251F3B9F3} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} - {FAC4C418-08A2-48C5-A966-A832FB091C78} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} + {FAC4C418-08A2-48C5-A966-A832FB091C78} = {F4E990AA-C8C9-4574-9027-CC2640A6C1BB} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentHostedService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentHostedService.cs new file mode 100644 index 0000000..5211c9c --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentHostedService.cs @@ -0,0 +1,41 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Volo.Abp; + +namespace Win_in.Sfs.Scp.WebApi.Agent +{ + public class AgentHostedService : IHostedService + { + private readonly IAbpApplicationWithExternalServiceProvider _application; + private readonly IServiceProvider _serviceProvider; + private readonly AgentService _agentService; + + public AgentHostedService( + IAbpApplicationWithExternalServiceProvider application, + IServiceProvider serviceProvider, + AgentService agentService) + { + _application = application; + _serviceProvider = serviceProvider; + _agentService = agentService; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + _application.Initialize(_serviceProvider); + + _agentService.Start(); + + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + _application.Shutdown(); + + return Task.CompletedTask; + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentModule.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentModule.cs new file mode 100644 index 0000000..434d4a5 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentModule.cs @@ -0,0 +1,60 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Volo.Abp; +using Volo.Abp.Autofac; +using Volo.Abp.AutoMapper; +using Volo.Abp.BackgroundJobs; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; +using Win_in.Sfs.Scp.v1.Domain; +using Win_in.Sfs.Scp.v1.EntityFrameworkCore; + +namespace Win_in.Sfs.Scp.WebApi.Agent +{ + [DependsOn( + typeof(AbpAutofacModule), + typeof(AbpAutoMapperModule), + typeof(AbpBackgroundJobsModule), + typeof(AbpBackgroundWorkersModule) + )] + [DependsOn( + typeof(V1ScpDomainModule), + typeof(V1ScpEntityFrameworkCoreModule) + )] + public class AgentModule : AbpModule + { + + + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + var env = context.Services.GetSingletonInstance(); + + Configure(options => + { + options.UseSqlServer(); + }); + + + Configure(configuration.GetSection("AgentOptions")); + + context.Services.AddHostedService(); + + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddMaps(validate: false); + }); + + + } + + public override void OnApplicationInitialization( + ApplicationInitializationContext context) + { + context.AddBackgroundWorker(); + } + + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentOptions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentOptions.cs new file mode 100644 index 0000000..6610972 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentOptions.cs @@ -0,0 +1,16 @@ +namespace Win_in.Sfs.Scp.WebApi.Agent +{ + public class AgentOptions + { + public IncomingOptions IncomingOptions { get; set; } + } + + public class IncomingOptions + { + public bool Active { get; set; } = false; + public int PeriodSeconds { get; set; } = 5 * 60; + public int RetryTimes { get; set; } = 3; + public int BatchSize { get; set; } = 100; + } + +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentService.cs new file mode 100644 index 0000000..0c7d08e --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/AgentService.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.DependencyInjection; + +namespace Win_in.Sfs.Scp.WebApi.Agent +{ + public class AgentService : ITransientDependency + { + public void Start() + { + Console.WriteLine("Wms dataExchange service has started..."); + } + + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/EnumExchangeDataErrorCode.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/EnumExchangeDataErrorCode.cs new file mode 100644 index 0000000..47162b0 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/EnumExchangeDataErrorCode.cs @@ -0,0 +1,10 @@ +namespace Win_in.Sfs.Scp.WebApi.Agent +{ + public enum EnumExchangeDataErrorCode + { + None = 0, + UnknownDataType = 1, + WrongDataFormat = 2, + Exception = 9, + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/IncomingDataWorker.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/IncomingDataWorker.cs new file mode 100644 index 0000000..4b33b13 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/IncomingDataWorker.cs @@ -0,0 +1,67 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; +using Volo.Abp.Uow; + +namespace Win_in.Sfs.Scp.WebApi.Agent +{ + public class IncomingDataWorker : AsyncPeriodicBackgroundWorkerBase + { + private readonly IOptions _options; + + public IncomingDataWorker( + AbpAsyncTimer timer, + IOptions options, + IServiceScopeFactory serviceScopeFactory + ) : base(timer, serviceScopeFactory) + { + _options = options; + Timer.Period = options.Value.IncomingOptions.PeriodSeconds * 1000; //default 5 minutes + } + + [UnitOfWork] + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + Logger.LogInformation("Starting: Handling Incoming Exchange data..."); + if (!_options.Value.IncomingOptions.Active) + { + Logger.LogInformation("Incoming Exchange is not active!"); + return; + } + //Resolve dependencies + var incomingDataManager = workerContext + .ServiceProvider + .GetRequiredService(); + //Do the work + var incomingDataList = await incomingDataManager.GetReadyListAsync(); + + foreach (var incomingData in incomingDataList) + { + + try + { + await UpdateWmsAsync(incomingData); + } + catch (Exception e) + { + e = e.GetBaseException(); + incomingData.SetError(EnumExchangeDataErrorCode.Exception, e.Message); + } + //归档并删除 + await incomingDataManager.FileAndDeleteAsync(incomingData); + + } + + Logger.LogInformation("Completed: Handling Incoming Exchange data..."); + } + + private async Task UpdateWmsAsync(object incomingData) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Program.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Program.cs new file mode 100644 index 0000000..2ecbd10 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Program.cs @@ -0,0 +1,57 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Serilog; +using Serilog.Events; + +namespace Win_in.Sfs.Scp.WebApi.Agent +{ + public class Program + { + public static async Task Main(string[] args) + { + Log.Logger = new LoggerConfiguration() +#if DEBUG + .MinimumLevel.Debug() +#else + .MinimumLevel.Information() +#endif + .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .Enrich.FromLogContext() + .WriteTo.Async(c => c.File("Logs/logs.txt")) + .WriteTo.Async(c => c.Console()) + .CreateLogger(); + + try + { + Log.Information("Starting console host."); + await CreateHostBuilder(args).RunConsoleAsync(); + return 0; + } + catch (Exception ex) + { + Log.Fatal(ex, "Host terminated unexpectedly!"); + return 1; + } + finally + { + Log.CloseAndFlush(); + } + + } + + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseAutofac() + .UseSerilog() + .ConfigureAppConfiguration((context, config) => + { + //setup your additional configuration sources + }) + .ConfigureServices((hostContext, services) => + { + services.AddApplication(); + }); + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Win_in.Sfs.Scp.WebApi.Agent.csproj b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Win_in.Sfs.Scp.WebApi.Agent.csproj new file mode 100644 index 0000000..113e428 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/Win_in.Sfs.Scp.WebApi.Agent.csproj @@ -0,0 +1,35 @@ + + + + Exe + net5.0 + + + + + + + + + + + + + + + + + + + PreserveNewest + Always + + + + + + + + + + diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/appsettings.json b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/appsettings.json new file mode 100644 index 0000000..8be85df --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Agent/appsettings.json @@ -0,0 +1,14 @@ +{ + "ConnectionStrings": { + "DataExchange": "Server=127.0.0.1;Database=DataExchange_Test;uid=sa;pwd=Microsoft2008;" + }, + + "AgentOptions": { + "IncomingOptions": { + "Active": false, + "PeriodSeconds": 300, + "RetryTimes": 3, + "BatchSize": 100 + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/IX12AsnAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/IX12AsnAppService.cs new file mode 100644 index 0000000..2ceea31 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/IX12AsnAppService.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Validation; +using Win_in.Sfs.Scp.WebApi.Asns; + +namespace Win_in.Sfs.Scp.WebApi +{ + /// + /// Asn接口 + /// + public interface IX12AsnAppService : IReadOnlyAppService + { + Task> GetUnreadListAsync(int count); + + } + + +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/X12AsnDTO.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/X12AsnDTO.cs new file mode 100644 index 0000000..a4042f8 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/X12AsnDTO.cs @@ -0,0 +1,26 @@ +using System; +using Win_in.Sfs.Scp.WebApi.Asns; +using Win_in.Sfs.Scp.WebApi.Domain.Shared; + +namespace Win_in.Sfs.Scp.WebApi; + +public class X12AsnDTO: EntityDtoBase +{ + public long UID { get; set; } + + /// + /// 单据号 + /// + public string BillNum { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 数据内容 + /// + public ASN_X12_856_3060 AsnX12 { get; set; } + +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/RouteConsts.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/RouteConsts.cs index fbf8276..ddf6c12 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/RouteConsts.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/RouteConsts.cs @@ -10,5 +10,6 @@ namespace Win_in.Sfs.Scp.WebApi public const string Receipt = "api/scp/receipt"; public const string Supplier = "api/scp/supplier"; public const string UnplannedReceipt = "api/scp/unplanned-receipt"; + public const string X12Asn = "api/scp/asn"; } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Asns/X12AsnAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Asns/X12AsnAppService.cs new file mode 100644 index 0000000..4608586 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Asns/X12AsnAppService.cs @@ -0,0 +1,97 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using System.Threading.Tasks.Dataflow; +using AutoMapper; +using AutoMapper.Configuration; +using FluentValidation; +using Microsoft.EntityFrameworkCore; +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 Volo.Abp.Clients; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Validation; +using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration; +using Volo.Abp.TenantManagement; +using Win_in.Sfs.Scp.WebApi.Asns; + +namespace Win_in.Sfs.Scp.WebApi +{ + /// + /// 零件服务 + /// + [Authorize] + [Route(RouteConsts.X12Asn)] + [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] + + public class X12AsnAppService : ReadOnlyAppService, IX12AsnAppService + { + private readonly IX12AsnRepository _x12AsnRepository; + private readonly ITenantStore _tenantStore; + private readonly ITenantRepository _tenantRepository; + + public X12AsnAppService( + IX12AsnRepository repository + , ITenantStore tenantStore + , ITenantRepository tenantRepository + ) : base(repository) + { + _x12AsnRepository = repository; + _tenantStore = tenantStore; + _tenantRepository = tenantRepository; + } + + /// + /// 按ID获取零件 (Get X12Asn by ID) + /// + /// 唯一ID(unique ID) + /// + + [HttpGet] + [Route("{id}")] + public override async Task GetAsync(Guid id) + { + return await base.GetAsync(id); + } + + + /// + /// 按条件获取零件列表 (Get X12Asn list by request condition) + /// + /// 请求条件DTO(Request condition DTO) + /// + [HttpGet] + [Route("")] + public override async Task> GetListAsync(RequestDTO requestDTO) + { + return await base.GetListAsync(requestDTO); + } + + public async Task> GetUnreadListAsync(int count) + { + var entities = await _x12AsnRepository.GetUnreadListAsync(count); + + var dtos = entities.Select(entity => new X12AsnDTO() + { + Id = entity.Id, + UID = entity.UID, + BillNum = entity.BillNum, + Remark = entity.Remark, + AsnX12 = JsonSerializer.Deserialize(entity.DataContent) + }) + .ToList(); + + return new ListResultDto(dtos); + + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs index 038e42f..7c6b294 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs @@ -1,6 +1,7 @@ using AutoMapper; using Volo.Abp.AutoMapper; using Volo.Abp.Timing; +using Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi { @@ -18,6 +19,7 @@ namespace Win_in.Sfs.Scp.WebApi CreateMapPurchaseOrder(); CreateMapPurchaseOrderDetail(); CreateMapUnplannedReceipt(); + CreateMapX12Asn(); } /// @@ -95,5 +97,11 @@ namespace Win_in.Sfs.Scp.WebApi .Ignore(p => p.CreatorId) .Ignore(p => p.CreationTime); } + + private void CreateMapX12Asn() + { + CreateMap() + .Ignore(p=>p.AsnX12); + } } } diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Program.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Program.cs index 37ed14c..afcdb4d 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Program.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Program.cs @@ -36,13 +36,13 @@ namespace Win_in.Sfs.Scp.WebApi.Console new TS_BARCODE() { BarCode = "BARCODE_02", - PartCode = "PART_A", - Qty=20, - Batch="20220404", - PoUnit = "EA", - PoBillNum = "PO1111", - PackQty = 20, - Extend2 = "PALLET_01" + PartCode = "PART_A", + Qty=20, + Batch="20220404", + PoUnit = "EA", + PoBillNum = "PO1111", + PackQty = 20, + Extend2 = "PALLET_01" }, new TS_BARCODE() { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ASN_X12_856_3060.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ASN_X12_856_3060.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060Extensions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ASN_X12_856_3060Extensions.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060Extensions.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ASN_X12_856_3060Extensions.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/DTM.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Commons/DTM.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/DTM.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Commons/DTM.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/HL.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Commons/HL.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/HL.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Commons/HL.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/REF.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Commons/REF.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/REF.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Commons/REF.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/FunctionalGroup.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/FunctionalGroup.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/FunctionalGroup.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/FunctionalGroup.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/FunctionalGroupExtensions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/FunctionalGroupExtensions.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/FunctionalGroupExtensions.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/FunctionalGroupExtensions.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GE.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/GE.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GE.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/GE.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GS.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/GS.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GS.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/FunctionGroups/GS.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IEA.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/IEA.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IEA.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/IEA.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISA.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ISA.cs similarity index 97% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISA.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ISA.cs index 71ce489..6facb4c 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISA.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ISA.cs @@ -1,9 +1,5 @@ using System; using System.ComponentModel.DataAnnotations; -using System.Net; -using System.Reflection; -using static System.Net.Mime.MediaTypeNames; -using static AutoMapper.Internal.ExpressionFactory; namespace Win_in.Sfs.Scp.WebApi.Asns; diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/CLD.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/CLD.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/CLD.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/CLD.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/Item.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/Item.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/Item.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/Item.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/ItemExtentions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/ItemExtentions.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/ItemExtentions.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/ItemExtentions.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/LIN.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/LIN.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/LIN.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/LIN.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/PRF.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/PRF.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/PRF.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/PRF.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/SN1.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/SN1.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/SN1.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Items/SN1.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/BSN.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/BSN.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/BSN.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/BSN.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/CTT.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/CTT.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/CTT.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/CTT.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/FOB.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/FOB.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/FOB.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/FOB.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/SE.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/SE.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/SE.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/SE.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ST.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/ST.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ST.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/ST.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNotice.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/ShipNotice.cs similarity index 98% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNotice.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/ShipNotice.cs index 43fb34c..a2f05a7 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNotice.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/ShipNotice.cs @@ -1,5 +1,4 @@ using System.Text; -using Microsoft.AspNetCore.SignalR; namespace Win_in.Sfs.Scp.WebApi.Asns; diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNoticeExtensions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/ShipNoticeExtensions.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNoticeExtensions.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/ShipNotices/ShipNoticeExtensions.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/MEA.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/MEA.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/MEA.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/MEA.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/N1.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/N1.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/N1.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/N1.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/Shipment.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/Shipment.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/Shipment.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/Shipment.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/ShipmentExtensions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/ShipmentExtensions.cs similarity index 95% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/ShipmentExtensions.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/ShipmentExtensions.cs index 93aad11..949bf7c 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/ShipmentExtensions.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/ShipmentExtensions.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using Microsoft.AspNetCore.SignalR; - + namespace Win_in.Sfs.Scp.WebApi.Asns; public static class ShipmentExtensions diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD1.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/TD1.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD1.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/TD1.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD3.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/TD3.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD3.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/TD3.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD5.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/TD5.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD5.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Shipments/TD5.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Tares/Tare.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Tares/Tare.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Tares/Tare.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Tares/Tare.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Tares/TareExtensions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Tares/TareExtensions.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Tares/TareExtensions.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/Tares/TareExtensions.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Const.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/X12Const.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Const.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/ASN_X12/X12Const.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EnumExchangeDataErrorCode.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EnumExchangeDataErrorCode.cs new file mode 100644 index 0000000..c8840ed --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EnumExchangeDataErrorCode.cs @@ -0,0 +1,9 @@ +namespace Win_in.Sfs.Scp.WebApi.Asns; + +public enum EnumExchangeDataErrorCode +{ + None = 0, + UnknownDataType = 1, + WrongDataFormat = 2, + Exception = 9, +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EnumExchangeDataStatus.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EnumExchangeDataStatus.cs new file mode 100644 index 0000000..cd55885 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EnumExchangeDataStatus.cs @@ -0,0 +1,25 @@ +namespace Win_in.Sfs.Scp.WebApi.Asns; + +public enum EnumExchangeDataStatus +{ + /// + /// 新增 + /// + Ready = 0, + /// + /// 处理中 + /// + Processing = 1, + /// + /// 完成 + /// + Success = 2, + /// + /// 搁置 + /// + Hold = 9, + /// + /// 错误 + /// + Error = -1, +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IX12AsnRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IX12AsnRepository.cs new file mode 100644 index 0000000..d8c647a --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IX12AsnRepository.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Scp.WebApi.Asns; + +public interface IX12AsnRepository : IRepository +{ + Task> GetUnreadListAsync(int count); + + Task UpdateStatusAsync(Guid id, EnumExchangeDataStatus status); +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Asn.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Asn.cs new file mode 100644 index 0000000..594edeb --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Asn.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Win_in.Sfs.Scp.WebApi.Domain.Shared; + +namespace Win_in.Sfs.Scp.WebApi.Asns; + +public class X12Asn: EntityBase +{ + public long UID { get; set; } + + /// + /// 单据号 + /// + public string BillNum { get; set; } + + /// + /// 数据类型 + /// + public string DataType { get; set; } + + /// + /// 生效日期 + /// + public DateTime EffectiveDate { get; protected internal set; } = DateTime.Today; + + /// + /// 数据状态 + /// + public EnumExchangeDataStatus Status { get; protected internal set; } = 0; + + /// + /// 数据内容 + /// + public string DataContent { get; set; } + + /// + /// 目标系统 + /// + public string DestinationSystem { get; set; } + + /// + /// 读取时间 + /// + public DateTime? ReadTime { get; set; } + /// + /// 读取者 + /// + public string Reader { get; set; } + + /// + /// 来源系统 + /// + public string SourceSystem { get; set; } + + /// + /// 写入时间 + /// + public DateTime WriteTime { get; set; } = DateTime.Now; + /// + /// 写入者 + /// + public string Writer { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + + public int RetryTimes { get; protected internal set; } = 0; + + + public X12Asn(long uid,string billNum,string dataContent,DateTime effectiveDate) + { + UID = uid; + BillNum = billNum; + DataType = "ASN"; + DataContent = dataContent; + EffectiveDate = effectiveDate; + DestinationSystem = "QAD"; + SourceSystem = "SCP"; + Writer = "SCP"; + } + + + public void SetEffectiveDate(DateTime newDate) + { + EffectiveDate = newDate; + } + + public void SetError(EnumExchangeDataErrorCode errorCode, string errorMessage, string remark = null) + { + Status = EnumExchangeDataStatus.Error; + ErrorCode = (int)errorCode; + ErrorMessage = errorMessage; + Remark = remark; + RetryTimes++; + + } + + public void SetHold(string remark = null) + { + Status = EnumExchangeDataStatus.Hold; + Remark = remark; + } + + public virtual void Reset(string remark = null) + { + Status = EnumExchangeDataStatus.Ready; + ErrorCode = (int)EnumExchangeDataErrorCode.None; + ErrorMessage = ""; + Remark = remark; + RetryTimes = 0; + } + + + public void Take(string remark = null) + { + Status = EnumExchangeDataStatus.Processing; + Remark = remark; + } + + public void SetSuccess(string remark = null) + { + Status = EnumExchangeDataStatus.Success; + ErrorCode = (int)EnumExchangeDataErrorCode.None; + ErrorMessage = ""; + Remark = remark; + } + + public void SetProcessing(string remark =null) + { + Status = EnumExchangeDataStatus.Processing; + Remark = remark; + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/IWebApiDbContext.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/IWebApiDbContext.cs index eb46893..1feecd6 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/IWebApiDbContext.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/IWebApiDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore { @@ -16,5 +17,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore DbSet PurchaseOrders { get; set; } DbSet Receipts { get; set; } DbSet UnplannedReceipts { get; set; } + + DbSet X12Asns { get; set; } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContext.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContext.cs index fdb7064..fe267ed 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContext.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContext.cs @@ -12,6 +12,7 @@ using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement.EntityFrameworkCore; +using Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore { @@ -33,6 +34,8 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore public virtual DbSet Receipts { get; set; } public virtual DbSet UnplannedReceipts { get; set; } + public virtual DbSet X12Asns { get; set; } + #region Entities from the modules diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs index c0e4509..daf384b 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs @@ -2,6 +2,7 @@ using System; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore { @@ -42,11 +43,12 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore */ builder.ConfigurePart(options); - builder.ConfigSuppliers(options); - builder.ConfigReceipt(options); - builder.ConfigPurchaseOrder(options); - builder.ConfigPurchaseOrderDetail(options); - builder.ConfigUnplannedReceipt(options); + builder.ConfigureSuppliers(options); + builder.ConfigureReceipt(options); + builder.ConfigurePurchaseOrder(options); + builder.ConfigurePurchaseOrderDetail(options); + builder.ConfigureUnplannedReceipt(options); + builder.ConfigureX12Asn(options); } /// @@ -95,12 +97,12 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore /// /// 供应商 /// - private static void ConfigSuppliers(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) + private static void ConfigureSuppliers(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) { builder.Entity(b => { - //Configure table & schema name - b.ToTable(options.TablePrefix + "_Suppliers", options.Schema); + //Configure table & schema name + b.ToTable(options.TablePrefix + "_Suppliers", options.Schema); b.ConfigureByConvention(); @@ -154,7 +156,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore /// /// 收货单与退货单明细 /// - private static void ConfigReceipt(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) + private static void ConfigureReceipt(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) { builder.Entity(b => { @@ -189,7 +191,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore /// /// 采购订单主表 /// - private static void ConfigPurchaseOrder(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) + private static void ConfigurePurchaseOrder(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) { builder.Entity(b => { @@ -223,7 +225,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore /// /// 采购订单明细表 /// - private static void ConfigPurchaseOrderDetail(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) + private static void ConfigurePurchaseOrderDetail(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) { builder.Entity(b => { @@ -246,7 +248,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore } - private static void ConfigUnplannedReceipt(this ModelBuilder builder, + private static void ConfigureUnplannedReceipt(this ModelBuilder builder, WebApiModelBuilderConfigurationOptions options) { builder.Entity(b => @@ -275,6 +277,33 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore }); } + private static void ConfigureX12Asn(this ModelBuilder builder, + WebApiModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + "_X12Asn", options.Schema); + + b.ConfigureByConvention(); + + b.Property(q => q.BillNum).HasMaxLength(16).IsRequired(); + b.Property(q => q.EffectiveDate).HasColumnType("datetime2(7)").IsRequired(); + b.Property(q => q.Status).IsRequired(); + b.Property(q => q.ErrorCode).IsRequired(); + b.Property(q => q.ErrorMessage); + b.Property(q => q.DataContent); + b.Property(q => q.DataType).IsRequired().HasMaxLength(16); + b.Property(q => q.SourceSystem).IsRequired().HasMaxLength(16); + b.Property(q => q.WriteTime).IsRequired(); + b.Property(q => q.Writer).HasMaxLength(16); + b.Property(q => q.DestinationSystem).IsRequired().HasMaxLength(16); + b.Property(q => q.ReadTime).IsRequired(); + b.Property(q => q.Reader).HasMaxLength(16); + b.Property(q => q.Remark); + }); + } + /* /// /// 发货单主表 diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519044235_X12Asn.Designer.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519044235_X12Asn.Designer.cs new file mode 100644 index 0000000..695d664 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519044235_X12Asn.Designer.cs @@ -0,0 +1,2998 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.WebApi.EntityFrameworkCore; + +namespace Win_in.Sfs.Scp.WebApi.Migrations +{ + [DbContext(typeof(WebApiDbContext))] + [Migration("20220519044235_X12Asn")] + partial class X12Asn + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.17") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasColumnType("nvarchar(max)"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("nvarchar(max)"); + + b.Property("JobName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("ApiResourceId", "Scope"); + + b.ToTable("IdentityServerApiResourceScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiResourceSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.Property("ApiScopeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("ApiScopeId", "Type"); + + b.ToTable("IdentityServerApiScopeClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.Property("ApiScopeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("ApiScopeId", "Key", "Value"); + + b.ToTable("IdentityServerApiScopeProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenType") + .HasColumnType("int"); + + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); + + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); + + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); + + b.Property("AllowRememberConsent") + .HasColumnType("bit"); + + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); + + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); + + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("BackChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("ClientClaimsPrefix") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ClientName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ClientUri") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentLifetime") + .HasColumnType("int"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); + + b.Property("EnableLocalLogin") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("FrontChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); + + b.Property("IncludeJwtId") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("PairWiseSubjectSalt") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ProtocolType") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); + + b.Property("RefreshTokenUsage") + .HasColumnType("int"); + + b.Property("RequireClientSecret") + .HasColumnType("bit"); + + b.Property("RequireConsent") + .HasColumnType("bit"); + + b.Property("RequirePkce") + .HasColumnType("bit"); + + b.Property("RequireRequestObject") + .HasColumnType("bit"); + + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); + + b.Property("UserCodeType") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserSsoLifetime") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("IdentityServerClients"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Origin") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("GrantType") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Provider") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("PostLogoutRedirectUri") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("ClientId", "Key", "Value"); + + b.ToTable("IdentityServerClientProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("RedirectUri") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("UserCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode"); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsumedTime") + .HasColumnType("datetime2"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.HasIndex("SubjectId", "SessionId", "Type"); + + b.ToTable("IdentityServerPersistedGrants"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("IdentityResourceId", "Key", "Value"); + + b.ToTable("IdentityServerIdentityResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.Asns.X12Asn", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DataContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DataType") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("DestinationSystem") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("EffectiveDate") + .HasColumnType("datetime2(7)"); + + b.Property("ErrorCode") + .HasColumnType("int"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("ReadTime") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("Reader") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("RetryTimes") + .HasColumnType("int"); + + b.Property("SourceSystem") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TraceId") + .HasColumnType("nvarchar(max)"); + + b.Property("WriteTime") + .HasColumnType("datetime2"); + + b.Property("Writer") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.HasKey("Id"); + + b.ToTable("WebApi_X12Asn"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.Part", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AbcClass") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Catalog") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Company") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Desc1") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Desc2") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ErrorCode") + .HasColumnType("int"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Group") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsBuyPart") + .HasColumnType("bit"); + + b.Property("IsMakePart") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ProductLine") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TraceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Version") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.ToTable("WebApi_Part"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.PurchaseOrder", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Company") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContactName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ContactPhone") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DueDate") + .HasColumnType("datetime2"); + + b.Property("ErrorCode") + .HasColumnType("int"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsConsignment") + .HasColumnType("bit"); + + b.Property("OrderDate") + .HasColumnType("datetime2"); + + b.Property("PoNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PoType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Remark") + .HasMaxLength(4096) + .HasColumnType("nvarchar(max)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SupplierCode") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TaxRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("TraceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.ToTable("WebApi_PO"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.PurchaseOrderDetail", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("IsConsignment") + .HasColumnType("bit"); + + b.Property("LineStatus") + .HasColumnType("int"); + + b.Property("MasterId") + .HasColumnType("uniqueidentifier"); + + b.Property("OrderQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PartCode") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PoLine") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PoNumber") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Remark") + .HasMaxLength(4096) + .HasColumnType("nvarchar(max)"); + + b.Property("StdPackQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StdPackUom") + .HasColumnType("nvarchar(max)"); + + b.Property("SupplierPackConvertRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("MasterId"); + + b.ToTable("WebApi_PODetail"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.Receipt", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AsnNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Company") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Dock") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ErrorCode") + .HasColumnType("int"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Lot") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PartCode") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PoLine") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PoNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RcNumber") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RcType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReceiveDate") + .HasColumnType("datetime2"); + + b.Property("ReceiveQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReceiveTime") + .HasColumnType("datetime2"); + + b.Property("Remark") + .HasMaxLength(4096) + .HasColumnType("nvarchar(max)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SupplierCode") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SupplierLot") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SupplierPackConvertRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("TraceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Warehouse") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.ToTable("WebApi_Receipt"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.Supplier", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Address") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("Bank") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("City") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Company") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContactName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Country") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Currency") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Desc") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ErrorCode") + .HasColumnType("int"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Fax") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PostId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Rank") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Remark") + .HasMaxLength(4096) + .HasColumnType("nvarchar(max)"); + + b.Property("TraceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.ToTable("WebApi_Suppliers"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.UnplannedReceipt", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Address") + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("Company") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EffectiveDate") + .HasColumnType("datetime2"); + + b.Property("ErrorCode") + .HasColumnType("int"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Location") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("Lot") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Order") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PartCode") + .IsRequired() + .HasMaxLength(18) + .HasColumnType("nvarchar(18)"); + + b.Property("Qty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Remark") + .HasMaxLength(4096) + .HasColumnType("nvarchar(max)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("SoJob") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("SystemDate") + .HasColumnType("datetime2"); + + b.Property("TrNbr") + .HasColumnType("bigint"); + + b.Property("TrType") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("TraceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.HasKey("Id"); + + b.ToTable("WebApi_UnplannedReceipt"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("Properties") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("Properties") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.PurchaseOrderDetail", b => + { + b.HasOne("Win_in.Sfs.Scp.WebApi.PurchaseOrder", null) + .WithMany("Details") + .HasForeignKey("MasterId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.PurchaseOrder", b => + { + b.Navigation("Details"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519044235_X12Asn.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519044235_X12Asn.cs new file mode 100644 index 0000000..68a2ff6 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519044235_X12Asn.cs @@ -0,0 +1,70 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Win_in.Sfs.Scp.WebApi.Migrations +{ + public partial class X12Asn : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "AsnNumber", + table: "WebApi_Receipt", + type: "nvarchar(64)", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(64)", + oldMaxLength: 64); + + migrationBuilder.CreateTable( + name: "WebApi_X12Asn", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + BillNum = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: false), + DataType = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: false), + EffectiveDate = table.Column(type: "datetime2(7)", nullable: false), + Status = table.Column(type: "int", nullable: false), + DataContent = table.Column(type: "nvarchar(max)", nullable: true), + DestinationSystem = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: false), + ReadTime = table.Column(type: "datetime2", nullable: false), + Reader = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + SourceSystem = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: false), + WriteTime = table.Column(type: "datetime2", nullable: false), + Writer = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + Remark = table.Column(type: "nvarchar(max)", nullable: true), + RetryTimes = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + TraceId = table.Column(type: "nvarchar(max)", nullable: true), + ErrorCode = table.Column(type: "int", nullable: false), + ErrorMessage = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WebApi_X12Asn", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WebApi_X12Asn"); + + migrationBuilder.AlterColumn( + name: "AsnNumber", + table: "WebApi_Receipt", + type: "nvarchar(64)", + maxLength: 64, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(64)", + oldMaxLength: 64, + oldNullable: true); + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs index 408ba22..77eda9b 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.15") + .HasAnnotation("ProductVersion", "5.0.17") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => @@ -1928,6 +1928,93 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations b.ToTable("AbpTenantConnectionStrings"); }); + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.Asns.X12Asn", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DataContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DataType") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("DestinationSystem") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("EffectiveDate") + .HasColumnType("datetime2(7)"); + + b.Property("ErrorCode") + .HasColumnType("int"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("ReadTime") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("Reader") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("RetryTimes") + .HasColumnType("int"); + + b.Property("SourceSystem") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TraceId") + .HasColumnType("nvarchar(max)"); + + b.Property("WriteTime") + .HasColumnType("datetime2"); + + b.Property("Writer") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.HasKey("Id"); + + b.ToTable("WebApi_X12Asn"); + }); + modelBuilder.Entity("Win_in.Sfs.Scp.WebApi.Part", b => { b.Property("Id") @@ -2206,7 +2293,6 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations .HasColumnType("uniqueidentifier"); b.Property("AsnNumber") - .IsRequired() .HasMaxLength(64) .HasColumnType("nvarchar(64)"); diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Repositories/X12AsnRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Repositories/X12AsnRepository.cs new file mode 100644 index 0000000..38e41ee --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Repositories/X12AsnRepository.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.WebApi.Asns; + +namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore; + +public class X12AsnRepository : EfCoreRepository, IX12AsnRepository +{ + public X12AsnRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public async Task> GetUnreadListAsync(int count) + { + var dbSet = await GetDbSetAsync(); + var list =await dbSet.Where(p => p.Status == EnumExchangeDataStatus.Ready) + .OrderBy(p => p.UID) + .Take(count) + .ToListAsync(); + + foreach (var entity in list) + { + await UpdateStatusAsync(entity.Id, EnumExchangeDataStatus.Success); + } + + return list; + } + + + public async Task UpdateStatusAsync(Guid id,EnumExchangeDataStatus status) + { + var entity =await base.GetAsync(id); + switch (status) + { + case EnumExchangeDataStatus.Ready: + entity.Reset(); + break; + case EnumExchangeDataStatus.Processing: + entity.SetProcessing(); + break; + case EnumExchangeDataStatus.Success: + entity.SetSuccess(); + break; + case EnumExchangeDataStatus.Hold: + entity.SetHold(); + break; + case EnumExchangeDataStatus.Error: + entity.SetError(EnumExchangeDataErrorCode.Exception,""); + break; + default: + throw new ArgumentOutOfRangeException(nameof(status), status, null); + } + return await UpdateAsync(entity); + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBackgroundWorker.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBackgroundWorker.cs new file mode 100644 index 0000000..d48afc0 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBackgroundWorker.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Threading; +using Volo.Abp.Uow; +using Win_in.Sfs.Scp.v1.Domain; +using Win_in.Sfs.Scp.WebApi.Asns; + +namespace Win_in.Sfs.Scp.WebApi; + +public class AsnBackgroundWorker : AsyncPeriodicBackgroundWorkerBase +{ + private readonly IOptions _options; + + public AsnBackgroundWorker( + AbpAsyncTimer timer, + IOptions options, + IServiceScopeFactory serviceScopeFactory + ) : base(timer, serviceScopeFactory) + { + _options = options; + Timer.Period = options.Value.PeriodSeconds * 1000; //default 5 minutes + } + + [UnitOfWork] + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + Logger.LogInformation("Starting: Handling Scp Asn data..."); + if (!_options.Value.Active) + { + Logger.LogInformation("Scp Asn is not active!"); + return; + } + //Resolve dependencies + var scpAsnManager = workerContext + .ServiceProvider + .GetRequiredService(); + + var x12AsnRepository = workerContext + .ServiceProvider + .GetRequiredService(); + + //Do the work + var maxUid = await x12AsnRepository.MaxAsync(p => p.UID); + var scpAsns = await scpAsnManager.GetUnreadAsnsAsync(maxUid, _options.Value.BatchSize); + Logger.LogInformation($"{scpAsns.Count} Scp ASN records were Found"); + + if (scpAsns.Count > 0) + { + var asnX12List = new List(); + foreach (var asn in scpAsns) + { + var barcodes = await scpAsnManager.GetBarcodesAsync(asn.AsnBillNum); + + var asnFactory = new AsnFactory(); + var asnX128563060 = asnFactory.CreateAsnX128563060(asn, barcodes); + + var dataContent = JsonSerializer.Serialize(asnX128563060); + var asnX12 = new X12Asn(asn.UID, asn.AsnBillNum, dataContent,asn.ShipTime??DateTime.Today); + asnX12List.Add(asnX12); + } + await x12AsnRepository.InsertManyAsync(asnX12List); + } + + Logger.LogInformation("Completed: Handling Scp Asn data..."); + } + +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBgWorker.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBgWorker.cs new file mode 100644 index 0000000..8b30490 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBgWorker.cs @@ -0,0 +1,9 @@ +namespace Win_in.Sfs.Scp.WebApi; + +public class AsnBgWorker +{ + public bool Active { get; set; } = false; + public int PeriodSeconds { get; set; } = 60; + public int RetryTimes { get; set; } = 3; + public int BatchSize { get; set; } = 10; +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnFactory.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnFactory.cs new file mode 100644 index 0000000..f0e1e4e --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnFactory.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Win_in.Sfs.Scp.v1.Domain.Asns; +using Win_in.Sfs.Scp.WebApi.Asns; + +namespace Win_in.Sfs.Scp.WebApi +{ + public class AsnFactory + { + public ASN_X12_856_3060 CreateAsnX128563060(TB_ASN scpAsn,List barcodes) + { + + var asnCode = scpAsn.AsnBillNum; + var senderId = scpAsn.VendId; + var receiverId = "IACNA_ID"; + var shipTime = scpAsn.ShipTime ?? DateTime.Now; + + var envType = ISA.EnvType.P; + var authorization = ""; + var security = ""; + //初始化ASN单 + var asn = CreateAsn(asnCode,senderId,receiverId,shipTime,envType,authorization,security); + + var functionalGroupCode = "123456789"; + //初始化功能组 + var functionalGroup = CreateFunctionalGroup(senderId,receiverId,shipTime,functionalGroupCode); + + var shipNoticeCode = "0001"; + var datetimeType = "011"; + //初始化发货单 + var shipNotice = CreateShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType); + + var gValue = 0; + var gUom = "KG"; + var nValue = 0; + var nUom = "KG"; + var routeSequenceCode = "B"; + var identificationCode = "PSTV"; + var mode = "LT"; + var equipmentCode = "TL"; + var equipmentNumber = "123456";//TODO 车牌号 + //初始化发货明细 + var shipment = CreateShipment(shipNotice,gValue,gUom,nValue,nUom,routeSequenceCode,identificationCode,mode, + equipmentCode,equipmentNumber,functionalGroupCode,functionalGroupCode,senderId,receiverId); + + + //计算与添加托盘和尾箱 + var palletCodes = barcodes.Select(p => p.Extend2).Distinct().ToList(); + foreach (var palletCode in palletCodes) + { + var palletBarcodes = barcodes.Where(p => p.Extend2==palletCode).ToList(); + + var items = new List(); + var group = palletBarcodes + .GroupBy(p => new { p.PartCode, p.Qty, p.Batch, p.PoUnit, p.PoBillNum,p.PackQty}) + .Select(p => new + { + p.Key.PartCode, + p.Key.Qty, + p.Key.Batch, + p.Key.PoUnit, + p.Key.PoBillNum, + p.Key.PackQty, + Labels = p.Select(p=>p.BarCode).ToList() + }) + .ToList(); + + foreach (var b in group) + { + var accumQty = 0;//TODO 如何计算 + var loadQty = b.Labels.Count; + var unitQty = b.PackQty; + var item = CreateItem(b.PartCode, loadQty * unitQty, b.PoUnit, accumQty, b.PoBillNum, loadQty, unitQty,b.Labels); + items.Add(item); + } + + //如果托标签为空,当作尾箱处理 + if (string.IsNullOrEmpty(palletCode)) + { + foreach (var item in items) + { + shipment.AddOrphanItem(shipNotice,item); + } + } + //添加托盘 + else + { + var tare = CreateTare(palletCode); + shipment.AddTare(shipNotice,tare); + foreach (var item in items) + { + tare.AddItem(shipNotice, item); + } + } + + } + + //TODO 如何获取包装代码,或者规则是什么? + var packagingCode = "PLT90"; + //装载量需要在添加托盘和尾箱后再计算 + var loadingQty = shipment.Tares.Count+shipment.OrphanItems.Count; + shipment.SetTD1(packagingCode, loadingQty); + + shipNotice + .AddShipment(shipment) //添加发货明细 + .SetCTT() //设置发货单汇总 + .SetSE(shipNoticeCode); //设置发货明细结尾 + //添加发货单 + functionalGroup + .AddShipNotice(shipNotice) + .SetGE(functionalGroupCode); + //添加功能组 + asn + .AddFunctionGroup(functionalGroup) + .SetIEA(asnCode); + return asn; + } + + private ASN_X12_856_3060 CreateAsn(string asnCode, string senderId, string receiverId, DateTime datetime, + ISA.EnvType envType = ISA.EnvType.P, string authorization = "", string security = "") + { + var asn = new ASN_X12_856_3060(); + asn.SetISA(asnCode, senderId, receiverId, datetime, envType, authorization, security); + return asn; + } + + private FunctionalGroup CreateFunctionalGroup(string senderId, string receiverId, DateTime datetime, + string functionalGroupCode) + { + var functionGroup = new FunctionalGroup(); + functionGroup.SetGS(senderId, receiverId, datetime, functionalGroupCode); + return functionGroup; + } + + private ShipNotice CreateShipNotice(string shipNoticeCode, string noticeNumber, DateTime datetime, + string datetimeType="011", string purpose = "00") + { + var shipNotice = new ShipNotice(); + shipNotice + .SetST(shipNoticeCode) + .SetBSN(noticeNumber, datetime, purpose) + .SetDTM(datetime, datetimeType); + shipNotice.AddSegment(4); + return shipNotice; + } + + private Shipment CreateShipment(ShipNotice shipNotice, decimal gValue, string gUom, decimal nValue, string nUom, + string routeSequenceCode, string identificationCode, string mode, string equipmentCode, + string equipmentNumber, string bmRefValue, string pkRefValue, string senderId, string receiverId) + { + var shipment = new Shipment(); + shipment + .SetHL() + .SetMEA_G(gValue, gUom) + .SetMEA_N(nValue, nUom) + .SetTD5(routeSequenceCode, identificationCode, mode) + .SetTD3(equipmentCode, equipmentNumber) + .SetREF_BM(bmRefValue) + .SetREF_PK(pkRefValue) + .SetN1_SF(senderId) + .SetN1_ST(receiverId) + ; + shipNotice.AddSegment(10); + + return shipment; + } + + private Tare CreateTare(string tareLabelCode) + { + var tare = new Tare(); + tare.SetHL() + .SetREF_LS(tareLabelCode); + + return tare; + } + + private Item CreateItem(string itemCode, decimal qty, string uom, int accumQty, + string poNumber, int loadQty, decimal unitQty, List itemLabelCodes) + { + + var item = new Item(); + item.SetHL() + .SetLIN(itemCode) + .SetSN1(qty, uom, accumQty) + .SetPRF(poNumber) + .SetCLD(loadQty, unitQty) + .SetREF_LSs(itemLabelCodes); + return item; + } + + + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/EnumExchangeDataErrorCode.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/EnumExchangeDataErrorCode.cs new file mode 100644 index 0000000..e9f507d --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/EnumExchangeDataErrorCode.cs @@ -0,0 +1,9 @@ +namespace Win_in.Sfs.Scp.WebApi; + +public enum EnumExchangeDataErrorCode +{ + None = 0, + UnknownDataType = 1, + WrongDataFormat = 2, + Exception = 9, +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs index 304da1c..fcbb7b7 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs @@ -30,6 +30,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; +using Volo.Abp.BackgroundWorkers; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.Swashbuckle; @@ -53,7 +54,8 @@ namespace Win_in.Sfs.Scp.WebApi typeof(AbpAccountWebIdentityServerModule), typeof(AbpAspNetCoreSerilogModule), typeof(AbpSwashbuckleModule), - typeof(AbpMultiTenancyModule) + typeof(AbpMultiTenancyModule), + typeof(AbpBackgroundWorkersModule) )] [DependsOn( typeof(V1ScpEntityFrameworkCoreModule))] @@ -76,6 +78,8 @@ namespace Win_in.Sfs.Scp.WebApi ConfigureMultiTenancy(configuration); ConfigureAuthorization(context,configuration); context.Services.AddScoped(); + Configure(configuration.GetSection("AsnBgWorker")); + } private void ConfigureMultiTenancy(IConfiguration configuration) @@ -285,6 +289,8 @@ namespace Win_in.Sfs.Scp.WebApi public override void OnApplicationInitialization(ApplicationInitializationContext context) { + context.AddBackgroundWorker(); + var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); @@ -343,7 +349,6 @@ namespace Win_in.Sfs.Scp.WebApi app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } + } - - } diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj index 299726e..207ebe5 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj @@ -1,4 +1,4 @@ - + diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json index 8884ebf..5ac6c3b 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json @@ -34,6 +34,12 @@ } } }, + "AsnBgWorker": { + "Active": true, + "PeriodSeconds": 10, + "RetryTimes": 3, + "BatchSize": 10 + }, "AlwaysAllowAuthorization": true, "ValidSites": "T8,T9" } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/IScpAsnManager.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/IScpAsnManager.cs new file mode 100644 index 0000000..0860da3 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/IScpAsnManager.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Win_in.Sfs.Scp.v1.Domain.Asns; + +namespace Win_in.Sfs.Scp.v1.Domain +{ + public interface IScpAsnManager:IDomainService + { + Task> GetUnreadAsnsAsync(long uid, int batchSize); + Task> GetBarcodesAsync(string billNum); + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ITbAsnRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ITbAsnRepository.cs new file mode 100644 index 0000000..bd74ddf --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ITbAsnRepository.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Win_in.Sfs.Scp.v1.Domain.Asns; + +namespace Win_in.Sfs.Scp.v1.Domain +{ + public interface ITbAsnRepository : IRepository,ITransientDependency + { + Task> GetUnreadListAsync(long uid,int batchSize); + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ITsBarcodeRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ITsBarcodeRepository.cs new file mode 100644 index 0000000..7f1fed4 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ITsBarcodeRepository.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Win_in.Sfs.Scp.v1.Domain.Asns; + +namespace Win_in.Sfs.Scp.v1.Domain +{ + public interface ITsBarcodeRepository : IRepository, ITransientDependency + { + Task> GetListByBillNumAsync(string billNum); + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ScpAsnManager.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ScpAsnManager.cs new file mode 100644 index 0000000..5fb687d --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/ScpAsnManager.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Win_in.Sfs.Scp.v1.Domain.Asns; + +namespace Win_in.Sfs.Scp.v1.Domain +{ + public class ScpAsnManager : DomainService,IScpAsnManager + { + private readonly ITbAsnRepository _tbAsnRepository; + private readonly ITsBarcodeRepository _tsBarcodeRepository; + + public ScpAsnManager(ITbAsnRepository tbAsnRepository + ,ITsBarcodeRepository tsBarcodeRepository) + { + _tbAsnRepository = tbAsnRepository; + _tsBarcodeRepository = tsBarcodeRepository; + } + public async Task> GetUnreadAsnsAsync(long uid, int batchSize) + { + return await _tbAsnRepository.GetUnreadListAsync(uid, batchSize); + } + + public async Task> GetBarcodesAsync(string billNum) + { + return await _tsBarcodeRepository.GetListByBillNumAsync(billNum); + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs index 235c840..279a42f 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs @@ -1,11 +1,14 @@ using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; namespace Win_in.Sfs.Scp.v1.Domain.Asns { - public class TB_ASN + public class TB_ASN : Entity, IMultiTenant { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long UID { get; set; } @@ -44,7 +47,6 @@ namespace Win_in.Sfs.Scp.v1.Domain.Asns public string SubSite { get; set; } - - + public Guid? TenantId { get; } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs index 029a202..d195163 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; namespace Win_in.Sfs.Scp.v1.Domain.Asns { - public partial class TS_BARCODE + public partial class TS_BARCODE : Entity, IMultiTenant { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] @@ -88,5 +90,6 @@ namespace Win_in.Sfs.Scp.v1.Domain.Asns [DisplayName("是否扫描")] public bool IsScanned { get; set; } + public Guid? TenantId { get; } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs index d71ea1b..f4e1f13 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs @@ -17,7 +17,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore public async Task UpsertAsync(TA_PART taPart) { TA_PART ret; - var dbSet =await GetDbSetAsync(); + var dbSet = await GetDbSetAsync(); var current = await dbSet.FirstOrDefaultAsync(p => p.Site == taPart.Site && p.PartCode == taPart.PartCode); if (current == null) diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbAsnRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbAsnRepository.cs new file mode 100644 index 0000000..988a68b --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbAsnRepository.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.v1.Domain; +using Win_in.Sfs.Scp.v1.Domain.Asns; + +namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore +{ + public class TbAsnRepository : EfCoreRepository, ITbAsnRepository + { + public TbAsnRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public async Task> GetUnreadListAsync(long uid, int batchSize) + { + var dbSet = await GetDbSetAsync(); + var list = await dbSet + .Where(p => p.UID > uid) + .OrderBy(p => p.UID) + .Take(batchSize) + .ToListAsync(); + return list; + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TsBarcodeRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TsBarcodeRepository.cs new file mode 100644 index 0000000..233ca24 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TsBarcodeRepository.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.v1.Domain; +using Win_in.Sfs.Scp.v1.Domain.Asns; + +namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore +{ + public class TsBarcodeRepository : EfCoreRepository, ITsBarcodeRepository + { + public TsBarcodeRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public async Task> GetListByBillNumAsync(string billNum) + { + var dbSet = await GetDbSetAsync(); + var list = await dbSet + .Where(p => p.BillNum == billNum) + .ToListAsync(); + return list; + } + } +} \ No newline at end of file