Browse Source

EF同步

master
mahao 1 year ago
parent
commit
4bdbbf2c77
  1. 44
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  2. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs
  3. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs
  4. 5401
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810081159_20230810-3.Designer.cs
  5. 56
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810081159_20230810-3.cs
  6. 10
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

44
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Coravel.Invocable;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// JisBBAC 发运数据与EDI数据对比
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
{
private readonly IServiceProvider _serviceProvider;
public JisBBACSeEdiCompareAppService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
/// <summary>
/// 执行
/// </summary>
public async Task Invoke()
{
using var serviceScope = _serviceProvider.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var query = db.Set<BBAC_SE_DETAIL>().Join(db.Set<BBAC_SE_EDI>(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false);
var ses = query.Select(t => t.se);
var edis = query.Select(t => t.edi);
ses.ForEach(t => t.IsHaveEdiData = true);
edis.ForEach(t => t.IsHaveSeData = true);
db.Set<BBAC_SE_DETAIL>().UpdateRange(ses);
db.Set<BBAC_SE_EDI>().UpdateRange(edis);
await db.SaveChangesAsync().ConfigureAwait(false);
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs

@ -194,6 +194,12 @@ public class BBAC_SE_DETAIL:SE_BASE
[Display(Name = "客户位置")] [Display(Name = "客户位置")]
public string Position { get; set; } public string Position { get; set; }
/// <summary>
/// 是否有EDI数据
/// </summary>
[Display(Name = "是否有EDI数据")]
public bool IsHaveEdiData { get; set; }
public BBAC_SE_DETAIL(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, DateTime shippingDate, string wmsBillNum) public BBAC_SE_DETAIL(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, DateTime shippingDate, string wmsBillNum)
{ {
Id= guid; Id= guid;

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs

@ -44,6 +44,11 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
public string Extend3 { set; get; } public string Extend3 { set; get; }
public string Extend4 { set; get; } public string Extend4 { set; get; }
/// <summary>
/// 是否有发运数据
/// </summary>
[Display(Name = "是否有发运数据")]
public bool IsHaveSeData { get; set; }
public BBAC_SE_EDI() public BBAC_SE_EDI()
{ } { }

5401
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810081159_20230810-3.Designer.cs

File diff suppressed because it is too large

56
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810081159_20230810-3.cs

@ -0,0 +1,56 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308103 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("96b1beec-0eef-4ae5-880b-23678addb759"));
migrationBuilder.AddColumn<bool>(
name: "IsHaveSeData",
table: "Set_BBAC_SE_EDI",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsHaveEdiData",
table: "Set_BBAC_SE_DETAIL",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "1d0093aa74814ffd982671a5ac362c52", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545"));
migrationBuilder.DropColumn(
name: "IsHaveSeData",
table: "Set_BBAC_SE_EDI");
migrationBuilder.DropColumn(
name: "IsHaveEdiData",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("96b1beec-0eef-4ae5-880b-23678addb759"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "ebf2d34687e14358a9d63dbe3df7abd3", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
}
}

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

@ -672,6 +672,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsHaveEdiData")
.HasColumnType("bit");
b.Property<string>("KeyCode") b.Property<string>("KeyCode")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -833,6 +836,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsHaveSeData")
.HasColumnType("bit");
b.Property<string>("KeyCode") b.Property<string>("KeyCode")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -4384,10 +4390,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData( b.HasData(
new new
{ {
Id = new Guid("96b1beec-0eef-4ae5-880b-23678addb759"), Id = new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1, BillType = 1,
ConcurrencyStamp = "ebf2d34687e14358a9d63dbe3df7abd3", ConcurrencyStamp = "1d0093aa74814ffd982671a5ac362c52",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc", ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum", OrderNum = "OrderNum",

Loading…
Cancel
Save