Browse Source

添加寄售库代码

master
wanggang 1 year ago
parent
commit
e8422b42af
  1. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  2. 60
      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. 320
      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>
<ItemGroup>
<PackageReference Include="Coravel" Version="4.2.1" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.24" />
<PackageReference Include="Hangfire.SqlServer" Version="1.7.24" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />

60
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.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Routing;
@ -6,14 +10,16 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection;
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)
{
services.AddScheduler();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>();
@ -32,6 +38,49 @@ namespace Win.Sfs.SettleAccount
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();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript");
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider });
@ -48,5 +97,4 @@ namespace Win.Sfs.SettleAccount
return Regex.Replace(str?.ToString(), "([a-z])([A-Z])", "$1-$2").ToLowerInvariant();
}
}
}
}

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

@ -1,10 +1,12 @@
{
{
"App": {
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
},
"ConnectionStrings": {
"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;"
//"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=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": {
"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 SettleAccount;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
namespace Win.Sfs.SettleAccount
{
@ -28,6 +24,4 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureSettleAccount();
}
}
}

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

@ -1,51 +1,19 @@
using System;
using System;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.Customers;
using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Controls;
using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.Entities.Inventories;
using Win.Sfs.SettleAccount.Entities.Invoices;
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.StorageLocations;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.Inventories;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
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
{
@ -65,6 +33,7 @@ namespace Win.Sfs.SettleAccount
);
#region 基础数据
builder.ConfigureCodeSetting(options);
//价格
builder.ConfigurePriceListVersion(options);
@ -85,14 +54,11 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePURCHASE_PRICE(options);
//客户替换件关系
builder.ConfigureTB_RePartsRelationship(options);
#endregion
#endregion 基础数据
#region 北汽结算
builder.ConfigureBBAC_CAN_SA(options);
builder.ConfigureBBAC_CAN_SA_DETAIL(options);
builder.ConfigureBBAC_NOT_SA_DETAIL(options);
@ -126,12 +92,7 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePUB_SA(options);
builder.ConfigurePUB_SA_DETAIL(options);
builder.ConfigurePUB_SE_DETAIL(options);
builder.ConfigureVmi(options);
//大众发票导入
//builder.ConfigureInvoice(options);
@ -141,50 +102,40 @@ namespace Win.Sfs.SettleAccount
//builder.ConfigureSettleAccount(options);
//builder.ConfigureSettleAccountVersion(options);
////红旗主机场-未结明细-导入
//builder.ConfigureUnHQSettleAccount(options);
//builder.ConfigureUnHQSettleAccountVersion(options);
//builder.ConfigureWmsDetailReport(options);
//builder.ConfigureWmsDetailDiffReport(options);
//builder.ConfigureWmsDetailCancelReport(options);
//有条码
//builder.ConfigureWmsDetailWithCodeReport(options);
//builder.ConfigureErrorBill(options);
#endregion
#endregion 北汽结算
}
#region 基础数据
private static void ConfigurePriceListBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceListBJ>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceListBJ", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.MaterialCode).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50);
});
}
private static void ConfigurePriceListVersionBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceListVersionBJ>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceListVersionBJ", options.Schema);
b.ConfigureByConvention();
@ -192,13 +143,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Period).HasMaxLength(50);
b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.Factory).HasMaxLength(50);
});
}
private static void ConfigureCentralizedControl(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<CentralizedControl>(b =>
{
b.ToTable($"{options.TablePrefix}_control", options.Schema);
@ -209,10 +158,8 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureBomVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BomVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_bom_version", options.Schema);
@ -224,12 +171,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureBom(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<Bom>(b =>
{
b.ToTable($"{options.TablePrefix}_bom", options.Schema);
b.ConfigureByConvention();
@ -261,19 +206,14 @@ namespace Win.Sfs.SettleAccount
b.ToTable($"{options.TablePrefix}_material", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.MaterialCode).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.Unit).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter);
});
}
private static void ConfigureMaterialRelationship(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<MaterialRelationship>(b =>
@ -301,24 +241,20 @@ namespace Win.Sfs.SettleAccount
private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceList>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceList", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.MaterialCode).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50);
});
}
private static void ConfigurePriceListVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceListVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceListVersion", options.Schema);
b.ConfigureByConvention();
@ -326,7 +262,6 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Period).HasMaxLength(50);
b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.Factory).HasMaxLength(50);
});
}
@ -342,7 +277,6 @@ namespace Win.Sfs.SettleAccount
});
}
/// <summary>
/// 客户替换件关系
/// </summary>
@ -354,22 +288,11 @@ namespace Win.Sfs.SettleAccount
b.ConfigureByConvention();
});
}
#endregion
#endregion 基础数据
#region 北汽
/// <summary>
/// 一汽轿车平台验收结算明细-导入
/// </summary>
@ -377,10 +300,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureHQCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<HQ_Car_Platform>(b =>
// {
// b.ToTable($"{options.TablePrefix}_HQ_Car_Platform", options.Schema);
// b.ConfigureByConvention();
@ -404,7 +325,6 @@ namespace Win.Sfs.SettleAccount
//private static void ConfigureHQCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<HQ_Car_PlatformVersion>(b =>
// {
// b.ToTable($"{options.TablePrefix}_HQ_Car_PlatformVersion", options.Schema);
@ -424,10 +344,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureUnHQSettleAccount(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<UnHQSettleAccount>(b =>
// {
// b.ToTable($"{options.TablePrefix}_UnHQSettleAccount", options.Schema);
// b.ConfigureByConvention();
@ -459,7 +377,6 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureUnHQSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<UnHQSettleAccountVersion>(b =>
// {
// b.ToTable($"{options.TablePrefix}_UnHQSettleAccountVersion", options.Schema);
@ -480,10 +397,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureInvoice(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<Invoice>(b =>
// {
// b.ToTable($"{options.TablePrefix}_Invoice", options.Schema);
// b.ConfigureByConvention();
@ -504,10 +419,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
private static void ConfigureInvoiceVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<InvoiceVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_InvoiceVersion", options.Schema);
b.ConfigureByConvention();
@ -516,7 +429,6 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50);
// b.Property(x => x.Factory).HasMaxLength(50);
});
}
@ -557,7 +469,6 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
private static void ConfigureSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<SettleAccountVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_Settle_Version", options.Schema);
@ -568,15 +479,12 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter);
});
}
private static void ConfigureBBAC_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_CAN_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA", options.Schema);
b.ConfigureByConvention();
@ -586,15 +494,12 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.InvGroupNum).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_CAN_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -611,12 +516,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_PD_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_PD_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -633,13 +537,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureBBAC_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_NOT_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -655,12 +556,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SA", options.Schema);
b.ConfigureByConvention();
@ -670,12 +570,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -690,12 +589,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -712,10 +610,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureBBAC_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_EDI>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_EDI", options.Schema);
b.ConfigureByConvention();
@ -730,16 +626,13 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_REPORT", options.Schema);
b.ConfigureByConvention();
@ -753,12 +646,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_SA_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention();
@ -777,12 +669,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_CAN_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA", options.Schema);
b.ConfigureByConvention();
@ -796,10 +687,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_CAN_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -817,10 +706,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_NOT_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -834,12 +721,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_PD_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_PD_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -855,12 +741,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SA", options.Schema);
b.ConfigureByConvention();
@ -874,10 +759,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -891,12 +774,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -910,12 +792,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_EDI>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_EDI", options.Schema);
b.ConfigureByConvention();
@ -930,17 +811,13 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_REPORT", options.Schema);
b.ConfigureByConvention();
@ -955,13 +832,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureHBPO_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_SA_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention();
@ -981,13 +855,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureINVOICE_GRP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_GRP>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_GRP", options.Schema);
b.ConfigureByConvention();
@ -999,12 +870,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureINVOICE_MAP_GROUP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_MAP_GROUP>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_MAP_GROUP", options.Schema);
b.ConfigureByConvention();
@ -1016,12 +886,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureINVOICE_NOT_SETTLE(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_NOT_SETTLE>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_NOT_SETTLE", options.Schema);
b.ConfigureByConvention();
@ -1037,10 +906,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureINVOICE_WAIT_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_WAIT_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_WAIT_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1058,10 +925,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureJIT_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<JIT_SE_SA_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_JIT_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention();
@ -1083,10 +948,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigurePUB_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_CAN_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_CAN_SA", options.Schema);
b.ConfigureByConvention();
@ -1098,13 +961,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigurePUB_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_CAN_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1121,13 +981,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigurePUB_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_NOT_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1145,12 +1002,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_PD_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_PD_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1167,12 +1023,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_SA", options.Schema);
b.ConfigureByConvention();
@ -1181,12 +1036,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1202,12 +1056,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_SE_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_SE_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1223,85 +1076,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"
},
"ConnectionStrings": {
"SettleAccountService": "Server=localhost;Database=BJABP;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"
"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"
},
"ElasticSearch": {
"Url": "http://localhost:9200"

Loading…
Cancel
Save