Browse Source

EF迁移TaskJob

master
mahao 1 year ago
parent
commit
ba8404f9e0
  1. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  2. 58
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  3. 8
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  4. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs
  5. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/IJobService.cs
  6. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobItem.cs
  7. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobLog.cs
  8. 35
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  9. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiCategory.cs
  10. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  11. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiOperatorType.cs
  12. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiSnapshot.cs
  13. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs
  14. 8
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs
  15. 317
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  16. 19
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccountDbContextFactory.cs
  17. 4
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/appsettings.json

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj

@ -20,6 +20,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Coravel" Version="4.2.1" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.24" /> <PackageReference Include="Hangfire.AspNetCore" Version="1.7.24" />
<PackageReference Include="Hangfire.SqlServer" Version="1.7.24" /> <PackageReference Include="Hangfire.SqlServer" Version="1.7.24" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" /> <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />

58
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -1,4 +1,8 @@
using Microsoft.AspNetCore.Builder; using System;
using System.Linq;
using System.Text.RegularExpressions;
using Coravel;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
@ -6,14 +10,16 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.StaticFiles; using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Text.RegularExpressions; using Volo.Abp.Domain.Repositories;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount;
namespace Win.Sfs.SettleAccount
{
public class Startup public class Startup
{ {
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddScheduler();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer)); services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer()))); services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>(); services.AddApplication<SettleAccountHttpApiHostModule>();
@ -32,6 +38,49 @@ namespace Win.Sfs.SettleAccount
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{ {
app.ApplicationServices.UseScheduler(scheduler =>
{
using var scope = app.ApplicationServices.CreateScope();
var jobs = scope.ServiceProvider.GetService<IRepository<JobItem>>()?.ToList();
jobs?.ForEach(job =>
{
var jobId = job.Id;
using var scope = app.ApplicationServices.CreateScope();
var serviceType = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).FirstOrDefault(o => o.FullName == job.Service);
if (serviceType != null)
{
if (scope.ServiceProvider.GetService(serviceType) is IJobService jobService)
{
scheduler.Schedule(() => {
using var scope = app.ApplicationServices.CreateScope();
var jobItemRepository = scope.ServiceProvider.GetRequiredService<IRepository<JobItem>>();
var jobLogRepository = scope.ServiceProvider.GetRequiredService<IRepository<JobLog>>();
var jobItem = jobItemRepository.FirstOrDefault(o => o.Id == jobId);
jobItem.IsRunning = true;
jobItemRepository.UpdateAsync(jobItem).Wait();
var jobLog = new JobLog { JobId = jobId, Start = DateTime.Now };
try
{
jobService.Invoke();
jobLog.Success = true;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
jobLog.Exception = ex.ToString();
}
finally
{
jobLog.End = DateTime.Now;
jobLogRepository.InsertAsync(jobLog).Wait();
jobItem.IsRunning = false;
jobItemRepository.UpdateAsync(jobItem).Wait();
}
}).Cron(job.Cron);
}
}
});
});
var contentTypeProvider = new FileExtensionContentTypeProvider(); var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript"); contentTypeProvider.Mappings.Add(".mjs", "text/javascript");
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider }); app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider });
@ -49,4 +98,3 @@ namespace Win.Sfs.SettleAccount
} }
} }
} }
}

8
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -1,10 +1,12 @@
{ {
"App": { "App": {
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088" "CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", //"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;" //"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;"
"SettleAccountService": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
}, },
"Serilog": { "Serilog": {
"Using": [], "Using": [],

50
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs

@ -0,0 +1,50 @@
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount.Entities.BQ;
public interface IVmiService : IApplicationService, ITransientDependency, IJobService
{
string Test();
void In();
void Out();
IQueryable<VmiBalance> Query();
}
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class VmiService : IVmiService
{
public void Invoke()
{
throw new System.NotImplementedException();
}
public void In()
{
throw new System.NotImplementedException();
}
public void Out()
{
throw new System.NotImplementedException();
}
public IQueryable<VmiBalance> Query()
{
throw new System.NotImplementedException();
}
[HttpGet]
public string Test()
{
return "Test";
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/IJobService.cs

@ -0,0 +1,6 @@
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public interface IJobService
{
void Invoke();
}

20
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobItem.cs

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class JobItem : Entity<Guid>, IHasConcurrencyStamp
{
public JobItem()
{
this.Id = Guid.NewGuid();
}
public string Name { get; set; }
public string Cron { get; set; }
public string Service { get; set; }
public bool IsRunning { get; set; }
public List<JobLog> Logs { get; set; } = new List<JobLog>();
public string ConcurrencyStamp { get; set; }
}

14
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobLog.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class JobLog : Entity<Guid>
{
public JobItem Job { get; set; }
public Guid? JobId { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public bool Success { get; set; }
public string Exception { get; set; }
}

35
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class VmiBalance : Entity<Guid>
{
/// <summary>
/// LU零件号:BBAC发运单BBAC_SE_DETAIL.LU
/// </summary>
public string LU { get; set; }
/// <summary>
/// 生产码:BBAC发运单BBAC_SE_DETAIL.PN
/// </summary>
public string PN { get; set; }
/// <summary>
/// 生产码类型(01前保、02后保、03门槛等)
/// </summary>
public int PNType { get; set; }
/// <summary>
/// 发货类型???
/// </summary>
public string Type { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal Qty { get; set; }
public List<VmiLog> Logs { get; set; } = new List<VmiLog>();
}

16
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiCategory.cs

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 寄售库存操作分类
/// </summary>
public class VmiCategory : Entity<Guid>
{
public VmiType Type { get; set; }
public string Number { get; set; }
public string Name { get; set; }
public List<VmiLog> Logs { get; set; } = new List<VmiLog>();
}

22
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs

@ -0,0 +1,22 @@
using System;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 寄售库存操作记录
/// </summary>
public class VmiLog : Entity<Guid>
{
public Guid CategoryId { get; set; }
public Guid BalanceId { get; set; }
/// <summary>
/// 操作范围
/// </summary>
public string SessionId { get; set; }
public VmiOperatorType Type { get; set; }
public VmiCategory Category { get; set; }
public VmiBalance Balance { get; set; }
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiOperatorType.cs

@ -0,0 +1,8 @@
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public enum VmiOperatorType
{
Do,
UnDo,
ReDo
}

17
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiSnapshot.cs

@ -0,0 +1,17 @@
using System;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 库存快照,每月26日8.00,取库存按照时间存储到sqlite文件中
/// </summary>
public class VmiSnapshot : Entity<Guid>
{
/// <summary>
/// YYYY-MM-DD hh
/// </summary>
public string Name { get; set; }
public string Path { get; set; }
}

10
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs

@ -0,0 +1,10 @@
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 寄售库存操作类型
/// </summary>
public enum VmiType
{
In,
Out
}

8
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs

@ -1,10 +1,6 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SettleAccount;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
@ -28,6 +24,4 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureSettleAccount(); builder.ConfigureSettleAccount();
} }
} }
} }

317
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -1,51 +1,20 @@
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.EntityFrameworkCore.Modeling;
using Win.Sfs.SettleAccount.Boms; using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.Customers; using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.Boms; using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.CodeSettings; using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Controls; using Win.Sfs.SettleAccount.Entities.Controls;
using Win.Sfs.SettleAccount.FISes; using Win.Sfs.SettleAccount.Entities.Invoices;
using Win.Sfs.SettleAccount.Entities.Inventories;
using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Prebatches; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.SettleAccounts; using Win.Sfs.SettleAccount.Entities.SettleAccounts;
using Win.Sfs.SettleAccount.Entities.StorageLocations;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.Inventories;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
using Win.Sfs.Shared.Constant; using Win.Sfs.Shared.Constant;
using Win.Sfs.SettleAccount.Entities.Factories;
using Win.Sfs.SettleAccount.StockFisDiffReports;
using Win.Sfs.SettleAccount.StockSettledDiffReports;
using Win.Sfs.SettleAccount.SecondaryActuralAdjustmentReports;
using Win.Sfs.SettleAccount.SecondaryActuralDiffReports;
using Win.Sfs.SettleAccount.SupplierItemSetUps;
using Win.Sfs.SettleAccount.BTSeqKBDiffReports;
using Win.Sfs.SettleAccount.BTNotConsignReports;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Invoices;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.FISes;
using Win.Sfs.SettleAccount.Entities.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.SettlementParts;
using Win.Sfs.SettleAccount.Entities.ItemInvoicePrices;
using Win.Sfs.SettleAccount.Entities.SecMatch;
using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts;
using Win.Sfs.SettleAccount.Errors;
using SettleAccount.Domain.BQ;
using System.DirectoryServices.ActiveDirectory;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
@ -65,6 +34,7 @@ namespace Win.Sfs.SettleAccount
); );
#region 基础数据 #region 基础数据
builder.ConfigureCodeSetting(options); builder.ConfigureCodeSetting(options);
//价格 //价格
builder.ConfigurePriceListVersion(options); builder.ConfigurePriceListVersion(options);
@ -85,9 +55,8 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePURCHASE_PRICE(options); builder.ConfigurePURCHASE_PRICE(options);
//客户替换件关系 //客户替换件关系
builder.ConfigureTB_RePartsRelationship(options); builder.ConfigureTB_RePartsRelationship(options);
#endregion
#endregion 基础数据
#region 北汽结算 #region 北汽结算
builder.ConfigureTaskJob(options); builder.ConfigureTaskJob(options);
@ -124,12 +93,7 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePUB_SA(options); builder.ConfigurePUB_SA(options);
builder.ConfigurePUB_SA_DETAIL(options); builder.ConfigurePUB_SA_DETAIL(options);
builder.ConfigurePUB_SE_DETAIL(options); builder.ConfigurePUB_SE_DETAIL(options);
builder.ConfigureVmi(options);
//大众发票导入 //大众发票导入
//builder.ConfigureInvoice(options); //builder.ConfigureInvoice(options);
@ -139,50 +103,40 @@ namespace Win.Sfs.SettleAccount
//builder.ConfigureSettleAccount(options); //builder.ConfigureSettleAccount(options);
//builder.ConfigureSettleAccountVersion(options); //builder.ConfigureSettleAccountVersion(options);
////红旗主机场-未结明细-导入 ////红旗主机场-未结明细-导入
//builder.ConfigureUnHQSettleAccount(options); //builder.ConfigureUnHQSettleAccount(options);
//builder.ConfigureUnHQSettleAccountVersion(options); //builder.ConfigureUnHQSettleAccountVersion(options);
//builder.ConfigureWmsDetailReport(options); //builder.ConfigureWmsDetailReport(options);
//builder.ConfigureWmsDetailDiffReport(options); //builder.ConfigureWmsDetailDiffReport(options);
//builder.ConfigureWmsDetailCancelReport(options); //builder.ConfigureWmsDetailCancelReport(options);
//有条码 //有条码
//builder.ConfigureWmsDetailWithCodeReport(options); //builder.ConfigureWmsDetailWithCodeReport(options);
//builder.ConfigureErrorBill(options); //builder.ConfigureErrorBill(options);
#endregion #endregion 北汽结算
} }
#region 基础数据 #region 基础数据
private static void ConfigurePriceListBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePriceListBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PriceListBJ>(b => builder.Entity<PriceListBJ>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PriceListBJ", options.Schema); b.ToTable($"{options.TablePrefix}_PriceListBJ", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.MaterialCode).HasMaxLength(50); b.Property(x => x.MaterialCode).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50); b.Property(x => x.CustomerCode).HasMaxLength(50);
}); });
} }
private static void ConfigurePriceListVersionBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePriceListVersionBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PriceListVersionBJ>(b => builder.Entity<PriceListVersionBJ>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PriceListVersionBJ", options.Schema); b.ToTable($"{options.TablePrefix}_PriceListVersionBJ", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -190,13 +144,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Period).HasMaxLength(50); b.Property(x => x.Period).HasMaxLength(50);
b.Property(x => x.Version).HasMaxLength(50); b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.Factory).HasMaxLength(50); b.Property(x => x.Factory).HasMaxLength(50);
}); });
} }
private static void ConfigureCentralizedControl(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureCentralizedControl(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<CentralizedControl>(b => builder.Entity<CentralizedControl>(b =>
{ {
b.ToTable($"{options.TablePrefix}_control", options.Schema); b.ToTable($"{options.TablePrefix}_control", options.Schema);
@ -207,10 +159,8 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigureBomVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBomVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BomVersion>(b => builder.Entity<BomVersion>(b =>
{ {
b.ToTable($"{options.TablePrefix}_bom_version", options.Schema); b.ToTable($"{options.TablePrefix}_bom_version", options.Schema);
@ -222,12 +172,10 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigureBom(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBom(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<Bom>(b => builder.Entity<Bom>(b =>
{ {
b.ToTable($"{options.TablePrefix}_bom", options.Schema); b.ToTable($"{options.TablePrefix}_bom", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -259,19 +207,14 @@ namespace Win.Sfs.SettleAccount
b.ToTable($"{options.TablePrefix}_material", options.Schema); b.ToTable($"{options.TablePrefix}_material", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.EstimateType).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.EstimateType).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Unit).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.Unit).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); b.HasIndex(x => new { x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter);
}); });
} }
private static void ConfigureMaterialRelationship(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureMaterialRelationship(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<MaterialRelationship>(b => builder.Entity<MaterialRelationship>(b =>
@ -299,24 +242,20 @@ namespace Win.Sfs.SettleAccount
private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PriceList>(b => builder.Entity<PriceList>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PriceList", options.Schema); b.ToTable($"{options.TablePrefix}_PriceList", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.MaterialCode).HasMaxLength(50); b.Property(x => x.MaterialCode).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50); b.Property(x => x.CustomerCode).HasMaxLength(50);
}); });
} }
private static void ConfigurePriceListVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePriceListVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PriceListVersion>(b => builder.Entity<PriceListVersion>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PriceListVersion", options.Schema); b.ToTable($"{options.TablePrefix}_PriceListVersion", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -324,7 +263,6 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Period).HasMaxLength(50); b.Property(x => x.Period).HasMaxLength(50);
b.Property(x => x.Version).HasMaxLength(50); b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.Factory).HasMaxLength(50); b.Property(x => x.Factory).HasMaxLength(50);
}); });
} }
@ -340,7 +278,6 @@ namespace Win.Sfs.SettleAccount
}); });
} }
/// <summary> /// <summary>
/// 客户替换件关系 /// 客户替换件关系
/// </summary> /// </summary>
@ -352,22 +289,11 @@ namespace Win.Sfs.SettleAccount
b.ConfigureByConvention(); b.ConfigureByConvention();
}); });
} }
#endregion
#endregion 基础数据
#region 北汽 #region 北汽
/// <summary> /// <summary>
/// 一汽轿车平台验收结算明细-导入 /// 一汽轿车平台验收结算明细-导入
/// </summary> /// </summary>
@ -375,10 +301,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param> /// <param name="options"></param>
//private static void ConfigureHQCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) //private static void ConfigureHQCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{ //{
// builder.Entity<HQ_Car_Platform>(b => // builder.Entity<HQ_Car_Platform>(b =>
// { // {
// b.ToTable($"{options.TablePrefix}_HQ_Car_Platform", options.Schema); // b.ToTable($"{options.TablePrefix}_HQ_Car_Platform", options.Schema);
// b.ConfigureByConvention(); // b.ConfigureByConvention();
@ -402,7 +326,6 @@ namespace Win.Sfs.SettleAccount
//private static void ConfigureHQCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) //private static void ConfigureHQCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{ //{
// builder.Entity<HQ_Car_PlatformVersion>(b => // builder.Entity<HQ_Car_PlatformVersion>(b =>
// { // {
// b.ToTable($"{options.TablePrefix}_HQ_Car_PlatformVersion", options.Schema); // b.ToTable($"{options.TablePrefix}_HQ_Car_PlatformVersion", options.Schema);
@ -422,10 +345,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param> /// <param name="options"></param>
//private static void ConfigureUnHQSettleAccount(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) //private static void ConfigureUnHQSettleAccount(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{ //{
// builder.Entity<UnHQSettleAccount>(b => // builder.Entity<UnHQSettleAccount>(b =>
// { // {
// b.ToTable($"{options.TablePrefix}_UnHQSettleAccount", options.Schema); // b.ToTable($"{options.TablePrefix}_UnHQSettleAccount", options.Schema);
// b.ConfigureByConvention(); // b.ConfigureByConvention();
@ -457,7 +378,6 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param> /// <param name="options"></param>
//private static void ConfigureUnHQSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) //private static void ConfigureUnHQSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{ //{
// builder.Entity<UnHQSettleAccountVersion>(b => // builder.Entity<UnHQSettleAccountVersion>(b =>
// { // {
// b.ToTable($"{options.TablePrefix}_UnHQSettleAccountVersion", options.Schema); // b.ToTable($"{options.TablePrefix}_UnHQSettleAccountVersion", options.Schema);
@ -478,10 +398,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param> /// <param name="options"></param>
//private static void ConfigureInvoice(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) //private static void ConfigureInvoice(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{ //{
// builder.Entity<Invoice>(b => // builder.Entity<Invoice>(b =>
// { // {
// b.ToTable($"{options.TablePrefix}_Invoice", options.Schema); // b.ToTable($"{options.TablePrefix}_Invoice", options.Schema);
// b.ConfigureByConvention(); // b.ConfigureByConvention();
@ -502,10 +420,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param> /// <param name="options"></param>
private static void ConfigureInvoiceVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureInvoiceVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<InvoiceVersion>(b => builder.Entity<InvoiceVersion>(b =>
{ {
b.ToTable($"{options.TablePrefix}_InvoiceVersion", options.Schema); b.ToTable($"{options.TablePrefix}_InvoiceVersion", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -514,7 +430,6 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Version).HasMaxLength(50); b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50); b.Property(x => x.CustomerCode).HasMaxLength(50);
// b.Property(x => x.Factory).HasMaxLength(50); // b.Property(x => x.Factory).HasMaxLength(50);
}); });
} }
@ -555,7 +470,6 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param> /// <param name="options"></param>
private static void ConfigureSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<SettleAccountVersion>(b => builder.Entity<SettleAccountVersion>(b =>
{ {
b.ToTable($"{options.TablePrefix}_Settle_Version", options.Schema); b.ToTable($"{options.TablePrefix}_Settle_Version", options.Schema);
@ -566,7 +480,6 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter); b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter);
}); });
} }
private static void ConfigureTaskJob(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureTaskJob(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
@ -580,10 +493,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureBBAC_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_CAN_SA>(b => builder.Entity<BBAC_CAN_SA>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -593,15 +504,12 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.InvGroupNum).HasMaxLength(50); b.Property(x => x.InvGroupNum).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_CAN_SA_DETAIL>(b => builder.Entity<BBAC_CAN_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -618,12 +526,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_PD_DETAIL>(b => builder.Entity<BBAC_PD_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_PD_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_PD_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -640,13 +547,10 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigureBBAC_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_NOT_SA_DETAIL>(b => builder.Entity<BBAC_NOT_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_NOT_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -662,12 +566,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_SA>(b => builder.Entity<BBAC_SA>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_SA", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_SA", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -677,12 +580,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_SA_DETAIL>(b => builder.Entity<BBAC_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -697,12 +599,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_SE_DETAIL>(b => builder.Entity<BBAC_SE_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_SE_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_SE_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -719,10 +620,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureBBAC_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_SE_EDI>(b => builder.Entity<BBAC_SE_EDI>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_SE_EDI", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_SE_EDI", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -737,16 +636,13 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Extend2).HasMaxLength(50); b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50); b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50); b.Property(x => x.Extend4).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_SE_REPORT>(b => builder.Entity<BBAC_SE_REPORT>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_SE_REPORT", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_SE_REPORT", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -760,12 +656,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_SE_SA_REPORT>(b => builder.Entity<BBAC_SE_SA_REPORT>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_SE_SA_REPORT", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -784,12 +679,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureHBPO_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_CAN_SA>(b => builder.Entity<HBPO_CAN_SA>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -803,10 +697,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_CAN_SA_DETAIL>(b => builder.Entity<HBPO_CAN_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -824,10 +716,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_NOT_SA_DETAIL>(b => builder.Entity<HBPO_NOT_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_NOT_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -841,12 +731,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureHBPO_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_PD_DETAIL>(b => builder.Entity<HBPO_PD_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_PD_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_PD_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -862,12 +751,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureHBPO_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SA>(b => builder.Entity<HBPO_SA>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_SA", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_SA", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -881,10 +769,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SA_DETAIL>(b => builder.Entity<HBPO_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -898,12 +784,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureHBPO_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SE_DETAIL>(b => builder.Entity<HBPO_SE_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_SE_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_SE_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -917,12 +802,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureHBPO_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SE_EDI>(b => builder.Entity<HBPO_SE_EDI>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_SE_EDI", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_SE_EDI", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -937,17 +821,13 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Extend2).HasMaxLength(50); b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50); b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50); b.Property(x => x.Extend4).HasMaxLength(50);
}); });
} }
private static void ConfigureHBPO_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SE_REPORT>(b => builder.Entity<HBPO_SE_REPORT>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_SE_REPORT", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_SE_REPORT", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -962,13 +842,10 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigureHBPO_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SE_SA_REPORT>(b => builder.Entity<HBPO_SE_SA_REPORT>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_SE_SA_REPORT", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -988,13 +865,10 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigureINVOICE_GRP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureINVOICE_GRP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<INVOICE_GRP>(b => builder.Entity<INVOICE_GRP>(b =>
{ {
b.ToTable($"{options.TablePrefix}_INVOICE_GRP", options.Schema); b.ToTable($"{options.TablePrefix}_INVOICE_GRP", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1006,12 +880,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureINVOICE_MAP_GROUP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureINVOICE_MAP_GROUP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<INVOICE_MAP_GROUP>(b => builder.Entity<INVOICE_MAP_GROUP>(b =>
{ {
b.ToTable($"{options.TablePrefix}_INVOICE_MAP_GROUP", options.Schema); b.ToTable($"{options.TablePrefix}_INVOICE_MAP_GROUP", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1023,12 +896,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureINVOICE_NOT_SETTLE(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureINVOICE_NOT_SETTLE(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<INVOICE_NOT_SETTLE>(b => builder.Entity<INVOICE_NOT_SETTLE>(b =>
{ {
b.ToTable($"{options.TablePrefix}_INVOICE_NOT_SETTLE", options.Schema); b.ToTable($"{options.TablePrefix}_INVOICE_NOT_SETTLE", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1044,10 +916,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureINVOICE_WAIT_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureINVOICE_WAIT_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<INVOICE_WAIT_DETAIL>(b => builder.Entity<INVOICE_WAIT_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_INVOICE_WAIT_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_INVOICE_WAIT_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1065,10 +935,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureJIT_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureJIT_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<JIT_SE_SA_REPORT>(b => builder.Entity<JIT_SE_SA_REPORT>(b =>
{ {
b.ToTable($"{options.TablePrefix}_JIT_SE_SA_REPORT", options.Schema); b.ToTable($"{options.TablePrefix}_JIT_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1090,10 +958,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigurePUB_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_CAN_SA>(b => builder.Entity<PUB_CAN_SA>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_CAN_SA", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_CAN_SA", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1105,13 +971,10 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigurePUB_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_CAN_SA_DETAIL>(b => builder.Entity<PUB_CAN_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_CAN_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1128,13 +991,10 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigurePUB_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_NOT_SA_DETAIL>(b => builder.Entity<PUB_NOT_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_NOT_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1152,12 +1012,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigurePUB_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_PD_DETAIL>(b => builder.Entity<PUB_PD_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_PD_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_PD_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1174,12 +1033,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigurePUB_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_SA>(b => builder.Entity<PUB_SA>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_SA", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_SA", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1188,12 +1046,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigurePUB_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_SA_DETAIL>(b => builder.Entity<PUB_SA_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_SA_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_SA_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1209,12 +1066,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigurePUB_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_SE_DETAIL>(b => builder.Entity<PUB_SE_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_SE_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_SE_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -1230,85 +1086,52 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigureVmi(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<JobItem>().HasData(new JobItem { Name = "库存快照", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
builder.Entity<JobItem>(b =>
{
b.ToTable($"{options.TablePrefix}_JobItem", options.Schema);
b.ConfigureByConvention();
b.Property(o => o.Name).HasMaxLength(50).IsRequired();
b.HasIndex(o => o.Name).IsUnique();
b.Property(o => o.Service).HasMaxLength(100).IsRequired();
b.Property(o => o.Cron).HasMaxLength(50).IsRequired();
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
builder.Entity<JobLog>().HasOne(o => o.Job).WithMany(o => o.Logs).HasForeignKey(o => o.JobId).OnDelete(DeleteBehavior.SetNull);
builder.Entity<VmiCategory>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiCategory", options.Schema);
b.ConfigureByConvention();
b.Property(o => o.Number).HasMaxLength(50).IsRequired();
b.HasIndex(o => o.Number).IsUnique();
b.Property(o => o.Name).HasMaxLength(50).IsRequired();
});
builder.Entity<VmiBalance>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiBalance", options.Schema);
b.ConfigureByConvention();
b.HasAlternateKey(o => new { o.PN, o.LU });
});
builder.Entity<VmiLog>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiLog", options.Schema);
b.ConfigureByConvention();
});
builder.Entity<VmiLog>().HasOne(o => o.Category).WithMany(o => o.Logs).HasForeignKey(o => o.CategoryId).OnDelete(DeleteBehavior.Cascade);
builder.Entity<VmiLog>().HasOne(o => o.Balance).WithMany(o => o.Logs).HasForeignKey(o => o.BalanceId).OnDelete(DeleteBehavior.Cascade);
builder.Entity<VmiSnapshot>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiSnapshot", options.Schema);
b.ConfigureByConvention();
});
} }
#endregion
} }
#endregion 北汽
}

19
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccountDbContextFactory.cs

@ -0,0 +1,19 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace Win.Sfs.SettleAccount;
public class SettleAccountDbContextFactory : IDesignTimeDbContextFactory<SettleAccountDbContext>
{
public SettleAccountDbContext CreateDbContext(string[] args)
{
var config = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();
var connectionString = config.GetConnectionString("SettleAccountService");
var optionsBuilder = new DbContextOptionsBuilder<SettleAccountDbContext>();
optionsBuilder.UseSqlServer(connectionString);
return new SettleAccountDbContext(optionsBuilder.Options);
}
}

4
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/appsettings.json

@ -9,8 +9,8 @@
"CorsOrigins": "http://localhost:9527,http://dev.ccwin-in.com:10588,http://localhost:44307" "CorsOrigins": "http://localhost:9527,http://dev.ccwin-in.com:10588,http://localhost:44307"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"SettleAccountService": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True", "SettleAccountService": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True" "Default": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
}, },
"ElasticSearch": { "ElasticSearch": {
"Url": "http://localhost:9200" "Url": "http://localhost:9200"

Loading…
Cancel
Save