mahao 1 year ago
parent
commit
602c2d2406
  1. 3
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  2. 5824
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230918060007_20230918-1.Designer.cs
  3. 208
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230918060007_20230918-1.cs
  4. 28
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  5. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs
  6. 34
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

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

@ -242,7 +242,8 @@ namespace Win.Sfs.SettleAccount
b.ToTable($"{options.TablePrefix}_relationship", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.ErpMaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.ErpMaterialCode, x.BusinessType }).IsUnique();
b.Property(x => x.SettleMaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.ErpMaterialCode, x.SettleMaterialCode, x.BusinessType }).IsUnique();
});
}

5824
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230918060007_20230918-1.Designer.cs

File diff suppressed because it is too large

208
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230918060007_20230918-1.cs

@ -0,0 +1,208 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202309181 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Set_relationship_ErpMaterialCode_BusinessType",
table: "Set_relationship");
migrationBuilder.AlterColumn<string>(
name: "SettleMaterialCode",
table: "Set_relationship",
type: "nvarchar(36)",
maxLength: 36,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "74b5f640459d4fb4af7e663ad318a7e8");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "3741a2331a464353932a67e49726504e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "efbcbfc8ff684d41a932181e7deec6b2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "abfcd02d9de44e678d983d5aa842c92d");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "6e2c96f0817e47e6a70dc07633f92365");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "626ba1e106b34594980d8d21abe54f2b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "06c84c84594341a0b7dd108a11ed4b13");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "0750f96fa58c4452be0f0ccd7d304953");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "654ad9973c87451ca057551e0ced4822");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "92d9e39172c2463e9a06b09252533b94");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "621689c5c9ff4ae198f99abcec3fedb9");
migrationBuilder.CreateIndex(
name: "IX_Set_relationship_ErpMaterialCode_SettleMaterialCode_BusinessType",
table: "Set_relationship",
columns: new[] { "ErpMaterialCode", "SettleMaterialCode", "BusinessType" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Set_relationship_ErpMaterialCode_SettleMaterialCode_BusinessType",
table: "Set_relationship");
migrationBuilder.AlterColumn<string>(
name: "SettleMaterialCode",
table: "Set_relationship",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(36)",
oldMaxLength: 36);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "d58d671303b941739e1f15175d2885fa");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "11cb239191164161b43fe11f01e15ff1");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "cad1d2b24dfa40af9cef675a1483033e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "757f9afcb2b0452e80903f64435c50e0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "59396a1080ba4af7ab4d644f2db85992");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "8cb7e348ae5645748e52c3fd998fe792");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "1d37186ccfcf423b963303847322dacf");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "8cfaa28a391b4092a54c3e6bc038c96e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "69697dd7feb94adc94f47e761b14be51");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "eb45100def7f4621bc511c4fb779d500");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "1efb2d30d2a34d929b10ad04ef3daaf9");
migrationBuilder.CreateIndex(
name: "IX_Set_relationship_ErpMaterialCode_BusinessType",
table: "Set_relationship",
columns: new[] { "ErpMaterialCode", "BusinessType" },
unique: true);
}
}
}

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

@ -4506,7 +4506,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "eb45100def7f4621bc511c4fb779d500",
ConcurrencyStamp = "92d9e39172c2463e9a06b09252533b94",
Cron = "0 0 8 26 *",
IsDisabled = false,
IsRunning = false,
@ -4516,7 +4516,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "d58d671303b941739e1f15175d2885fa",
ConcurrencyStamp = "74b5f640459d4fb4af7e663ad318a7e8",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4526,7 +4526,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "11cb239191164161b43fe11f01e15ff1",
ConcurrencyStamp = "3741a2331a464353932a67e49726504e",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4536,7 +4536,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "1d37186ccfcf423b963303847322dacf",
ConcurrencyStamp = "06c84c84594341a0b7dd108a11ed4b13",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4546,7 +4546,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "cad1d2b24dfa40af9cef675a1483033e",
ConcurrencyStamp = "efbcbfc8ff684d41a932181e7deec6b2",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4556,7 +4556,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "59396a1080ba4af7ab4d644f2db85992",
ConcurrencyStamp = "6e2c96f0817e47e6a70dc07633f92365",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4566,7 +4566,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "757f9afcb2b0452e80903f64435c50e0",
ConcurrencyStamp = "abfcd02d9de44e678d983d5aa842c92d",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4576,7 +4576,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "1efb2d30d2a34d929b10ad04ef3daaf9",
ConcurrencyStamp = "621689c5c9ff4ae198f99abcec3fedb9",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4586,7 +4586,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "8cb7e348ae5645748e52c3fd998fe792",
ConcurrencyStamp = "626ba1e106b34594980d8d21abe54f2b",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4596,7 +4596,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "69697dd7feb94adc94f47e761b14be51",
ConcurrencyStamp = "654ad9973c87451ca057551e0ced4822",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4606,7 +4606,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "8cfaa28a391b4092a54c3e6bc038c96e",
ConcurrencyStamp = "0750f96fa58c4452be0f0ccd7d304953",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -5794,11 +5794,13 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)");
b.Property<string>("SettleMaterialCode")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.HasKey("Id");
b.HasIndex("ErpMaterialCode", "BusinessType")
b.HasIndex("ErpMaterialCode", "SettleMaterialCode", "BusinessType")
.IsUnique();
b.ToTable("Set_relationship");

5
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

@ -5,7 +5,6 @@ using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
@ -276,7 +275,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// 结算数据处理
/// 写入库位、替换零件号
/// 结算详情表写入库位、替换零件号
/// </summary>
public virtual void HandleSaDetails<TCanSa, TNotSa>(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType, int version)
where TCanSa : SA_CAN_BASE
@ -320,7 +319,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// 处理结算数据
/// 结算、发运对比上的数据修改结算数据状态
/// 结算、发运对比上的数据修改结算详情表匹配类型
/// </summary>
public virtual void HandleSaDetailsMain<T>(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType, int version) where T : SA_BASE
{

34
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

@ -9,7 +9,6 @@ using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Entities.SettleAccountDomain;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
@ -176,6 +175,39 @@ namespace SettleAccount.Job.Services.Report
}
}
/// <summary>
/// 处理结算数据
/// 结算、发运对比上的数据修改结算详情表匹配类型
/// </summary>
public virtual void HandleSaDetailsMain<T>(List<SaSeEdiCompareDiff> saSeEdiCompareDiff, EnumBusinessType businessType, int version) where T : SA_BASE
{
var haveSaHaveSes = saSeEdiCompareDiff.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi);
if (haveSaHaveSes.Any())
{
//结算详情
var saDetails = _settleAccountDbContext.Set<T>()
.Where(t => t.BusinessType == businessType)
.Where(t => t.MappingType == EnumMappingType.None)
.Where(t => t.Version == version)
.ToList();
if (saDetails.Any())
{
var saDetailsUpdate = saDetails.Join(haveSaHaveSes, o => new { o.PN, o.LU }, i => new { i.PN, LU = i.CustomerPartCode }, (o, i) =>
{
var mappingType = (i.SAQty - i.SEQty) switch
{
0 => EnumMappingType.PerfectMatch,
> 0 or < 0 => EnumMappingType.PartialMatch,
_ => default,
};
o.MappingType = mappingType;
return o;
}).ToList();
_settleAccountDbContext.BulkUpdate(saDetailsUpdate);
}
}
}
/// <summary>
/// 创建导出文件结构
/// </summary>

Loading…
Cancel
Save