Browse Source

EF迁移同步发运数据服务

master
mahao 1 year ago
parent
commit
c80e5da31c
  1. 12
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs
  3. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs
  4. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs
  5. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  6. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs
  7. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs
  8. 7
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  9. 5333
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.Designer.cs
  10. 79
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.cs
  11. 49
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

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

@ -33,12 +33,6 @@ public class Startup
JobHostdService.AddService(services);
services.AddSingleton<JobHostdService>();
services.AddHostedService(o => o.GetRequiredService<JobHostdService>());
//services.AddTransient<HBPOSeSyncAppService>();
//services.AddTransient<BBACSeSyncAppService>();
//services.AddTransient<ZhiGongBBACSeSyncAppService>();
//services.AddTransient<ZhiGongHBPOSeSyncAppService>();
//services.AddTransient<BeiSeSyncAppService>();
//services.AddTransient<YinDuSeSyncAppService>();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>();
@ -62,12 +56,6 @@ public class Startup
app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub"));
app.ApplicationServices.UseScheduler(scheduler =>
{
//scheduler.Schedule<HBPOSeSyncAppService>().EveryMinute();
//scheduler.Schedule<BBACSeSyncAppService>().EveryMinute();
//scheduler.Schedule<ZhiGongBBACSeSyncAppService>().EveryMinute();
//scheduler.Schedule<ZhiGongHBPOSeSyncAppService>().EveryMinute();
//scheduler.Schedule<BeiSeSyncAppService>().EveryMinute();
//scheduler.Schedule<YinDuSeSyncAppService>().EveryMinute();
});
var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript");

11
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs

@ -8,17 +8,18 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// HBPO发运数据同步服务
/// HBPO发运数据同步
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class BBACSeSyncAppService : ApplicationService, IInvocable
public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
{
/// <summary>
/// WMS数据上下文
@ -48,6 +49,12 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable
_bbacSeDetailRepository = bbacSeDetailRepository;
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
[HttpPost]
public async Task Invoke()
{

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
@ -13,7 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class BeiSeSyncAppService : JitSeSyncAppService
public class BeiSeSyncAppService : JitSeSyncAppService, IJobService
{
/// <summary>
/// 构造
@ -35,4 +37,10 @@ public class BeiSeSyncAppService : JitSeSyncAppService
BusinessType = EnumBusinessType.BeiJian
};
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs

@ -9,17 +9,18 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// HBPO发运数据同步服务
/// HBPO发运数据同步
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService
public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
{
/// <summary>
/// WMS数据上下文
@ -49,6 +50,12 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService
_hbpoSeDetailRepository = hbpoSeDetailRepository;
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
[HttpPost]
public async Task Invoke()
{

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -15,7 +15,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// Jit发运数据同步
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class JitSeSyncAppService : ApplicationService, IInvocable
{
/// <summary>
@ -54,6 +53,10 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
[HttpPost]
public async Task Invoke()
{
if (SeSyncConfigInfo == null)
{
return;
}
//同步表名称
var syncTableName = SeSyncConfigInfo.SyncTableName;
//同步发运主类型

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
@ -13,7 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class YinDuSeSyncAppService : JitSeSyncAppService
public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService
{
/// <summary>
/// 构造
@ -35,4 +37,10 @@ public class YinDuSeSyncAppService : JitSeSyncAppService
BusinessType = EnumBusinessType.YinDuJian
};
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
}

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
@ -13,7 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService
public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService, IJobService
{
/// <summary>
/// 构造
@ -35,4 +37,10 @@ public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService
BusinessType = EnumBusinessType.ZhiGongJianHBPO
};
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
}

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

@ -1337,7 +1337,12 @@ namespace Win.Sfs.SettleAccount
//seed
builder.Entity<JobItem>().HasData(new JobItem("vmi".ToGuid()) { Name = "库存快照", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongBBACSeSync".ToGuid()) { Name = "直供件BBAC发运同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("BBACSeSync".ToGuid()) { Name = "BBAC发运数据同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("HBPOSeSync".ToGuid()) { Name = "HBPO发运数据同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongBBACSeSync".ToGuid()) { Name = "直供件BBAC发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongHBPOSeSync".ToGuid()) { Name = "直供件HBPO发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("BeiSeSync".ToGuid()) { Name = "备件发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("YinDuSeSync".ToGuid()) { Name = "印度件发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("发运入库".ToGuid()) { Type = VmiType.In, Name = "发运入库", Number = "100" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("结算出库".ToGuid()) { Type = VmiType.Out, Name = "结算出库", Number = "200" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("客户退货".ToGuid()) { Type = VmiType.Out, Name = "客户退货", Number = "300" });

5333
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.Designer.cs

File diff suppressed because it is too large

79
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.cs

@ -0,0 +1,79 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308082 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "Cron",
value: "0 0/10 * * * ? ");
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "Cron", "HeartBeat", "IsDisabled", "IsRunning", "Name", "Service" },
values: new object[,]
{
{ new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"), "0 0/10 * * * ? ", null, false, false, "BBAC发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService" },
{ new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"), "0 0/10 * * * ? ", null, false, false, "HBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService" },
{ new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), "0 0/10 * * * ? ", null, false, false, "直供件HBPO发运同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService" },
{ new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), "0 0/10 * * * ? ", null, false, false, "备件发运同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService" },
{ new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), "0 0/10 * * * ? ", null, false, false, "印度件发运同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService" }
});
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "7ee5d3ed981d4f87963af8b5654cd9df");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"));
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "Cron",
value: "0 0/30 * * * ? ");
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "210607a13a294958a95ea0faddc6eb65");
}
}
}

49
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -4151,13 +4151,58 @@ namespace Win.Sfs.SettleAccount.Migrations
Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService"
},
new
{
Id = new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "BBAC发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService"
},
new
{
Id = new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "HBPO发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService"
},
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
Cron = "0 0/30 * * * ? ",
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "直供件BBAC发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService"
},
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "直供件HBPO发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService"
},
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "备件发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService"
},
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "印度件发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService"
});
});
@ -4280,7 +4325,7 @@ namespace Win.Sfs.SettleAccount.Migrations
Id = new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1,
ConcurrencyStamp = "210607a13a294958a95ea0faddc6eb65",
ConcurrencyStamp = "7ee5d3ed981d4f87963af8b5654cd9df",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum",

Loading…
Cancel
Save