Browse Source

EF迁移

master
mahao 1 year ago
parent
commit
58432ef501
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  2. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs
  3. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs
  4. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  5. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs
  6. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs
  7. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs
  8. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SE_DETAIL.cs
  9. 5542
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817051027_20230817-4.Designer.cs
  10. 45
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817051027_20230817-4.cs
  11. 7
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -544,6 +544,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
var pubCanSa = new PUB_CAN_SA()
{
BillNum = pubCanSaBillNum,
InvGroupNum = pubCanSaBillNum,
SettleBillNum = pubSaBillNum,
State = SettleBillState.,
BusinessType = pubSa.BusinessType,
@ -571,7 +572,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
(await _pubSaDetailRepository.GetDbContextAsync().ConfigureAwait(false)).BulkInsert(pubSaDetails);
if (pubCanSaDetails.Count > 0)
{
pubCanSa.InvGroupNum = pubCanSaDetails.Count.ToString();
pubCanSaDetails.ForEach(pubCanSaDetail =>
{
pubCanSaDetail.BillNum = pubCanSaDetail.InvGroupNum = pubCanSaBillNum;

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs

@ -8,7 +8,6 @@ using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
@ -74,13 +73,13 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
return;
}
await SyncJitRecordAsync().ConfigureAwait(false);
await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false);
await SyncJisRecordAsync().ConfigureAwait(false);
}
/// <summary>
/// 同步JitRecord
/// </summary>
[UnitOfWork]
private async Task SyncJitRecordAsync()
{
//同步表名称
@ -115,6 +114,7 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
jisSeDetails.ForEach(t =>
{
t.SetId(GuidGenerator.Create());
t.BusinessType = businessType;
t.KeyCode = t.PN + t.LU;
});
@ -140,7 +140,6 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
/// <summary>
/// 同步JisRecord
/// </summary>
[UnitOfWork]
private async Task SyncJisRecordAsync()
{
//同步表名称
@ -175,6 +174,7 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
jisSeDetails.ForEach(t =>
{
t.SetId(GuidGenerator.Create());
t.BusinessType = businessType;
t.KeyCode = t.PN + t.LU;
});

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs

@ -74,6 +74,7 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
return;
}
await SyncJitRecordAsync().ConfigureAwait(false);
await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false);
await SyncJisRecordAsync().ConfigureAwait(false);
}
@ -115,7 +116,8 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
jisSeDetails.ForEach(t =>
{
//t.BusinessType = businessType;
t.SetId(GuidGenerator.Create());
t.BusinessType = businessType;
t.KeyCode = t.PN + t.LU;
});
await _jisSeDetailRepository.DbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false);

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

@ -106,6 +106,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
pubSeDetails.ForEach(t =>
{
t.SetId(GuidGenerator.Create());
t.BusinessType = businessType;
t.KeyCode = t.PN + t.LU;
});

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

@ -270,9 +270,8 @@ public class BBAC_SE_DETAIL:SE_BASE
}
public BBAC_SE_DETAIL SetQty(decimal qty)
public void SetId(Guid id)
{
this.Qty = qty;
return this;
Id = id;
}
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs

@ -10,6 +10,12 @@ namespace SettleAccount.Domain.BQ;
[Display(Name = "HBPO发运数据")]
public class HBPO_SE_DETAIL :SE_BASE
{
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
//[Display(Name = "LU+生产码")]
//public string KeyCode { get; set; } = null!;
@ -263,4 +269,9 @@ public class HBPO_SE_DETAIL :SE_BASE
public HBPO_SE_DETAIL()
{
}
public void SetId(Guid id)
{
Id = id;
}
}

17
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Services;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
@ -28,13 +29,15 @@ public class MaterialRelationshipManager : DomainService
/// </summary>
public async Task AddNewMaterialRelationships(IEnumerable<MaterialRelationship> materialRelationships)
{
//客户零件号和厂内零件号
var luRePartCodes = materialRelationships.Select(t => new { t.ErpMaterialCode, t.SettleMaterialCode }).Distinct().ToList();
var haveLuRePartCodes = materialRelationships.Join(_materialRelationshipRepository.AsNoTracking(),
a => new { a.ErpMaterialCode, a.SettleMaterialCode },
b => new { b.ErpMaterialCode, b.SettleMaterialCode },
(a, b) => a).ToList();
var noHaveLuRePartCodes = materialRelationships.Except(haveLuRePartCodes).ToList();
//新客户零件号和厂内零件号
var noHaveLuRePartCodes = from item1 in materialRelationships
join item2 in _materialRelationshipRepository
on new { item1.ErpMaterialCode, item1.SettleMaterialCode } equals new { item2.ErpMaterialCode, item2.SettleMaterialCode }
into temp
from item3 in temp.DefaultIfEmpty()
where item3 == null
select item1;
if (noHaveLuRePartCodes.Any())
{
await _materialRelationshipRepository.InsertManyAsync(noHaveLuRePartCodes).ConfigureAwait(false);

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

@ -193,4 +193,9 @@ public class PUB_SE_DETAIL :SE_BASE
public PUB_SE_DETAIL()
{
}
public void SetId(Guid id)
{
Id = id;
}
}

5542
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817051027_20230817-4.Designer.cs

File diff suppressed because it is too large

45
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817051027_20230817-4.cs

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308174 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("9574edd9-55aa-48b6-bb63-fae78eaf5cf7"));
migrationBuilder.AddColumn<int>(
name: "BusinessType",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
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("65c2e515-7ca9-4b2e-8c16-a066175d1190"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "2ccdf785b5c648349a36813097be6165", 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("65c2e515-7ca9-4b2e-8c16-a066175d1190"));
migrationBuilder.DropColumn(
name: "BusinessType",
table: "Set_HBPO_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("9574edd9-55aa-48b6-bb63-fae78eaf5cf7"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "14dfff8fd6ae4d639ca21b8c8c950de5", 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 });
}
}
}

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

@ -1828,6 +1828,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<int>("BillType")
.HasColumnType("int");
b.Property<int>("BusinessType")
.HasColumnType("int");
b.Property<string>("CodeType")
.HasColumnType("nvarchar(max)");
@ -4528,10 +4531,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData(
new
{
Id = new Guid("9574edd9-55aa-48b6-bb63-fae78eaf5cf7"),
Id = new Guid("65c2e515-7ca9-4b2e-8c16-a066175d1190"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1,
ConcurrencyStamp = "14dfff8fd6ae4d639ca21b8c8c950de5",
ConcurrencyStamp = "2ccdf785b5c648349a36813097be6165",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum",

Loading…
Cancel
Save