学 赵 1 year ago
parent
commit
3e5e7ca020
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
  2. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
  3. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  4. 54
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  5. 52
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  7. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  8. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiMessage.cs
  9. 3
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  10. 5771
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230901084349_vmi20.Designer.cs
  11. 176
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230901084349_vmi20.cs
  12. 29
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js

@ -80,7 +80,7 @@ export default function (businessType, type) {
} else { } else {
if (businessType === "JisBBAC") { if (businessType === "JisBBAC") {
service = "bbac_can_sa_service"; service = "bbac_can_sa_service";
} else if (businessType === "JisHBPO") { } else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") {
service = "hbpo_can_sa_service"; service = "hbpo_can_sa_service";
} else { } else {
service = "pub_can_sa_service"; service = "pub_can_sa_service";

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js

@ -135,12 +135,14 @@ function useLogSchema() {
}, },
changedType: { changedType: {
title: "变动类型", title: "变动类型",
type: "string", type: "number",
input: "select", input: "select",
options: [ options: [
{ {
value: 0, value: 0,
label: "入库", label: "入库",
},
{
value: 1, value: 1,
label: "出库", label: "出库",
}, },

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -189,7 +189,7 @@ public class PriceListRequestDto : PagedAndSortedResultRequestDto
/// <summary> /// <summary>
/// 备件价格 /// 备件价格
/// </summary> /// </summary>
public class PriceListBJDto : EntityDto<Guid> public class PriceListBJDto : AuditedEntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 客户零件号 /// 客户零件号
@ -371,7 +371,7 @@ public class PriceListBJRequestDto : RequestInputBase
/// <summary> /// <summary>
/// 列表 /// 列表
/// </summary> /// </summary>
public class TB_PRICE_LISTDto : EntityDto<Guid> public class TB_PRICE_LISTDto : AuditedEntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 零件号 /// 零件号

54
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -12,7 +12,7 @@ using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using ClosedXML.Excel; using ClosedXML.Excel;
using DocumentFormat.OpenXml; using DocumentFormat.OpenXml;
using LinqToDB.Data; using EFCore.BulkExtensions;
using LinqToDB.EntityFrameworkCore; using LinqToDB.EntityFrameworkCore;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core.Extension; using Magicodes.ExporterAndImporter.Core.Extension;
@ -113,7 +113,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
db.Set<VmiSnapshot>().Add(snapshot); db.Set<VmiSnapshot>().Add(snapshot);
db.SaveChanges(); db.SaveChanges();
db.Database.ExecuteSqlRaw($"select * into {table} from Set_VmiBalance;"); db.Database.ExecuteSqlRaw($"select * into {table} from Set_VmiBalance;");
db.Database.ExecuteSqlRaw($"create clustered index IX_{table}_BillTime on {table} (BillTime)"); db.Database.ExecuteSqlRaw($"create clustered index IX_{table}_BillTime on {table} (Id)");
db.Database.ExecuteSqlRaw($"alter table {table} add constraint PK_{table} primary key (Id);"); db.Database.ExecuteSqlRaw($"alter table {table} add constraint PK_{table} primary key (Id);");
snapshot.End = DateTime.Now; snapshot.End = DateTime.Now;
transaction.Commit(); transaction.Commit();
@ -182,9 +182,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
public ListResultDto<VmiSnapshot> Snapshot() public ListResultDto<VmiSnapshot> Snapshot()
{ {
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
connection.Open();
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options); using var db = new SettleAccountDbContext(options);
var list = db.Set<VmiSnapshot>().AsNoTracking().OrderByDescending(o => o.Start).ToList(); var list = db.Set<VmiSnapshot>().AsNoTracking().OrderByDescending(o => o.Start).ToList();
return new ListResultDto<VmiSnapshot>(list); return new ListResultDto<VmiSnapshot>(list);
@ -196,8 +194,9 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost] [HttpPost]
public async Task<PagedResultDto<VmiBalance>> Backup(BackupListRequest input) public async Task<PagedResultDto<VmiBalance>> Backup(BackupListRequest input)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options);
var name = input.Name; var name = input.Name;
var sql = $"select * from {name}"; var sql = $"select * from {name}";
var query = db.Set<VmiBalance>().FromSqlRaw(sql); var query = db.Set<VmiBalance>().FromSqlRaw(sql);
@ -218,8 +217,9 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost] [HttpPost]
public async Task<string> BackupExport(BackupListRequest input) public async Task<string> BackupExport(BackupListRequest input)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options);
var name = input.Name; var name = input.Name;
var sql = $"select * from {name}"; var sql = $"select * from {name}";
var query = db.Set<VmiBalance>().FromSqlRaw(sql); var query = db.Set<VmiBalance>().FromSqlRaw(sql);
@ -249,7 +249,6 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
var start = DateTime.Parse(input.Filters.FirstOrDefault(o => o.Column == "changedTime" && o.Action == EnumFilterAction.BiggerThanOrEqual).Value); var start = DateTime.Parse(input.Filters.FirstOrDefault(o => o.Column == "changedTime" && o.Action == EnumFilterAction.BiggerThanOrEqual).Value);
var end = DateTime.Parse(input.Filters.FirstOrDefault(o => o.Column == "changedTime" && o.Action == EnumFilterAction.SmallThan).Value); var end = DateTime.Parse(input.Filters.FirstOrDefault(o => o.Column == "changedTime" && o.Action == EnumFilterAction.SmallThan).Value);
var tables = new List<string>(); var tables = new List<string>();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); using var connection = new SqlConnection(connectionString);
connection.Open(); connection.Open();
@ -271,7 +270,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
} }
} }
} }
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options); using var db = new SettleAccountDbContext(options);
var sql = string.Empty; var sql = string.Empty;
if (tables.Any()) if (tables.Any())
@ -353,7 +352,6 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
} }
catch (Exception ex) catch (Exception ex)
{ {
transaction.Rollback();
this._logger.LogError(ex.ToString()); this._logger.LogError(ex.ToString());
return new JsonResult(new { code = 400, data = ex.ToString(), message = ex.Message }); ; return new JsonResult(new { code = 400, data = ex.ToString(), message = ex.Message }); ;
} }
@ -361,7 +359,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
private void Update(VmiLog log) private void Update(VmiLog log)
{ {
log.ChangedTime = log.Id.ToDateTime().Value; log.ChangedTime = log.Id.ToDateTime().Value.ToLocalTime();
if (log.ChangedQty >= decimal.Zero) if (log.ChangedQty >= decimal.Zero)
{ {
log.Qty = log.ChangedQty; log.Qty = log.ChangedQty;
@ -384,8 +382,6 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost] [HttpPost]
public async Task<IActionResult> Import(List<IFormFile> files) public async Task<IActionResult> Import(List<IFormFile> files)
{ {
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
try try
{ {
using var ms = new MemoryStream(); using var ms = new MemoryStream();
@ -412,20 +408,30 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false); await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false);
return new JsonResult(new { code = 400, message = "输入异常", fileName }); return new JsonResult(new { code = 400, message = "输入异常", fileName });
} }
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var context = new SettleAccountDbContext(options);
list.ForEach(Update); list.ForEach(Update);
var messageList = list.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }); var messageList = list.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList();
using var dc = context.CreateLinqToDBConnection(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
dc.BeginTransaction(); var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var context = new SettleAccountDbContext(options);
var st = new Stopwatch(); var st = new Stopwatch();
st.Start(); st.Start();
this._logger.LogInformation("事务开始"); try
await dc.BulkCopyAsync(new BulkCopyOptions { TableName = "Set_VmiLog", MaxBatchSize = 1000 }, list).ConfigureAwait(false); {
await dc.BulkCopyAsync(new BulkCopyOptions { TableName = "Set_VmiMessage", MaxBatchSize = 1000 }, messageList).ConfigureAwait(false); using var transaction = context.Database.BeginTransaction();
dc.CommitTransaction(); await context.BulkInsertAsync(list).ConfigureAwait(false);
await context.BulkInsertAsync(messageList).ConfigureAwait(false);
transaction.Commit();
}
catch (Exception ex)
{
_logger.LogError(ex.ToString());
return new JsonResult(new { code = 500, message = ex.ToString() });
}
finally
{
st.Stop(); st.Stop();
this._logger.LogInformation($"事务结束,耗时 ${st.ElapsedMilliseconds / 1000 / 60}分钟"); this._logger.LogInformation($"事务结束,耗时 ${st.ElapsedMilliseconds / 1000 / 60}分钟");
}
return new JsonResult(new { code = 200, message = "ok" }); return new JsonResult(new { code = 200, message = "ok" });
} }
catch (Exception ex) catch (Exception ex)

52
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -51,11 +52,12 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
var batchSize = 1000; var batchSize = 1000;
var fetchSize = 0;
var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
for (var i = 0; i < 1000; i++) for (var i = 0; i < 1000; i++)
{ {
var sw = new Stopwatch(); var sw = new Stopwatch();
sw.Start(); sw.Start();
var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); using var connection = new SqlConnection(connectionString);
connection.Open(); connection.Open();
using var transaction = connection.BeginTransaction(); using var transaction = connection.BeginTransaction();
@ -66,20 +68,26 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var context = new SettleAccountDbContext(options); using var context = new SettleAccountDbContext(options);
context.Database.UseTransaction(transaction); context.Database.UseTransaction(transaction);
if (!context.Set<VmiMessage>().Any(o => !o.isConsumed)) var vmiMessageRepo = context.Set<VmiMessage>();
var vmiLogRepo = context.Set<VmiLog>();
var vmiBalanceRepo = context.Set<VmiBalance>();
var vmiReplenishedRepo = context.Set<VmiReplenished>();
if (!vmiMessageRepo.Any(o => !o.isConsumed))
{ {
transaction.Commit();
break; break;
} }
var messages = context.Set<VmiMessage>() var messages = vmiMessageRepo.Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(batchSize).ToList();
//.AsNoTracking() fetchSize=messages.Count;
.Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(batchSize).ToList(); var list = messages.Select(o =>
var repo = context.Set<VmiBalance>(); {
foreach (var message in messages) var log = JsonSerializer.Deserialize<VmiLog>(o.Message);
log.SetId(Guid.Parse(JsonSerializer.Deserialize<JsonElement>(o.Message).GetProperty("Id").GetString()));
return new KeyValuePair<VmiMessage, VmiLog>(o, log);
}).ToDictionary(o => o.Key, o => o.Value);
var tables = list.Values.Select(o => $"Set_VmiLog_{o.ChangedTime.Year}_{(o.ChangedTime.Month - 1) / 3 + 1}").Distinct().ToList();
foreach (var table in tables)
{ {
var log = JsonSerializer.Deserialize<VmiLog>(message.Message);
log.SetId(Guid.Parse(JsonSerializer.Deserialize<JsonElement>(message.Message).GetProperty("Id").GetString()));
//插入分表
var table = $"Set_VmiLog_{log.ChangedTime.Year}_{(log.ChangedTime.Month - 1) / 3 + 1}";
command.CommandText = $"select OBJECT_ID('{table}', 'U')"; command.CommandText = $"select OBJECT_ID('{table}', 'U')";
var result = command.ExecuteScalar().ToString(); var result = command.ExecuteScalar().ToString();
if (result == string.Empty) if (result == string.Empty)
@ -91,11 +99,18 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
command.CommandText = $"alter table {table} add constraint PK_{table} primary key (Id);"; command.CommandText = $"alter table {table} add constraint PK_{table} primary key (Id);";
command.ExecuteNonQuery(); command.ExecuteNonQuery();
} }
}
foreach (var keyValue in list)
{
var message = keyValue.Key;
var log = keyValue.Value;
//获取分表名
var table = $"Set_VmiLog_{log.ChangedTime.Year}_{(log.ChangedTime.Month - 1) / 3 + 1}";
//插入到分表 //插入到分表
command.CommandText = $"insert into {table} select * from Set_VmiLog where id ='{log.Id}'"; command.CommandText = $"insert into {table} select * from Set_VmiLog where id ='{log.Id}'";
command.ExecuteNonQuery(); command.ExecuteNonQuery();
//插入库存 //插入库存
var balance = context.Set<VmiBalance>().FirstOrDefault( var balance = vmiBalanceRepo.FirstOrDefault(
o => o.DeliverBillType == log.DeliverBillType && o => o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType && o.CodeType == log.CodeType &&
o.DeliverBillType == log.DeliverBillType && o.DeliverBillType == log.DeliverBillType &&
@ -110,7 +125,7 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
balance = new VmiBalance(); balance = new VmiBalance();
if (log.LogType == VmiLogType.Type300) if (log.LogType == VmiLogType.Type300)
{//反结算入库,重建库存 {//反结算入库,重建库存
var logHistory = context.Set<VmiLog>().AsNoTracking().FirstOrDefault( var logHistory = vmiLogRepo.AsNoTracking().FirstOrDefault(
o => o.LogType == VmiLogType.Type100 && o => o.LogType == VmiLogType.Type100 &&
o.DeliverBillType == log.DeliverBillType && o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType && o.CodeType == log.CodeType &&
@ -134,7 +149,7 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
balance.InjectFrom(log); balance.InjectFrom(log);
} }
balance.Qty = log.ChangedQty; balance.Qty = log.ChangedQty;
await repo.AddAsync(balance).ConfigureAwait(false); await vmiBalanceRepo.AddAsync(balance).ConfigureAwait(false);
} }
else else
{//存在库存记录 {//存在库存记录
@ -162,31 +177,30 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
//添加负库存补货记录 //添加负库存补货记录
var log2 = new VmiReplenished(); var log2 = new VmiReplenished();
log2.InjectFrom(log); log2.InjectFrom(log);
await context.Set<VmiReplenished>().AddAsync(log2).ConfigureAwait(false); await vmiReplenishedRepo.AddAsync(log2).ConfigureAwait(false);
} }
// 更新库存 // 更新库存
balance.Qty = currentQty + log.ChangedQty; balance.Qty = currentQty + log.ChangedQty;
if (balance.Qty == decimal.Zero) if (balance.Qty == decimal.Zero)
{ {
//删除0库存 //删除0库存
repo.Remove(balance); vmiBalanceRepo.Remove(balance);
} }
} }
message.isConsumed = true; message.isConsumed = true;
}
context.SaveChanges(); context.SaveChanges();
}
transaction.Commit(); transaction.Commit();
} }
catch (Exception ex) catch (Exception ex)
{ {
this._logger.LogError(ex.ToString()); this._logger.LogError(ex.ToString());
transaction.Rollback();
throw new UserFriendlyException(ex.ToString(), "500"); throw new UserFriendlyException(ex.ToString(), "500");
} }
finally finally
{ {
sw.Stop(); sw.Stop();
this._logger.LogInformation($"处理{batchSize}条,耗时 {sw.ElapsedMilliseconds / 1000 / 60}分钟,{sw.ElapsedMilliseconds / 1000}秒"); this._logger.LogInformation($"处理{fetchSize}条,耗时 {sw.ElapsedMilliseconds / 1000 / 60}分钟,{sw.ElapsedMilliseconds / 1000}秒");
} }
} }
} }

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs

@ -7,7 +7,7 @@ public class VmiBalance : VmiBalanceBase
public VmiBalance() public VmiBalance()
{ {
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid(); Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
CreatedTime = Id.ToDateTime().Value; CreatedTime = Id.ToDateTime().Value.ToLocalTime();
ConcurrencyStamp = Guid.NewGuid().ToString("N"); ConcurrencyStamp = Guid.NewGuid().ToString("N");
} }

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs

@ -12,7 +12,7 @@ public class VmiLog : VmiBalanceBase, IValidatableObject
public VmiLog() public VmiLog()
{ {
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid(); Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
ChangedTime = Id.ToDateTime().Value; ChangedTime = Id.ToDateTime().Value.ToLocalTime();
ConcurrencyStamp = Guid.NewGuid().ToString("N"); ConcurrencyStamp = Guid.NewGuid().ToString("N");
} }

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiMessage.cs

@ -8,7 +8,7 @@ public class VmiMessage : Entity<Guid>
public VmiMessage() public VmiMessage()
{ {
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid(); Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
CreatedTime = Id.ToDateTime().Value; CreatedTime = Id.ToDateTime().Value.ToLocalTime();
ConcurrencyStamp = Guid.NewGuid().ToString("N"); ConcurrencyStamp = Guid.NewGuid().ToString("N");
} }

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

@ -1314,7 +1314,6 @@ namespace Win.Sfs.SettleAccount
b.Property(o => o.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.ConcurrencyStamp).HasMaxLength(50).IsConcurrencyToken(); b.Property(o => o.ConcurrencyStamp).HasMaxLength(50).IsConcurrencyToken();
b.HasIndex(o => o.BillTime).IsClustered();
b.HasIndex(o => (new b.HasIndex(o => (new
{ {
o.DeliverBillType, o.DeliverBillType,
@ -1336,7 +1335,6 @@ namespace Win.Sfs.SettleAccount
b.Property(o => o.ChangedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.ChangedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.HasIndex(o => o.BillTime).IsClustered();
b.Property(o => o.RealPartCode).HasMaxLength(50); b.Property(o => o.RealPartCode).HasMaxLength(50);
}); });
@ -1344,7 +1342,6 @@ namespace Win.Sfs.SettleAccount
{ {
b.ToTable($"{options.TablePrefix}_VmiReplenished", options.Schema); b.ToTable($"{options.TablePrefix}_VmiReplenished", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasIndex(o => o.BillTime).IsClustered();
b.Property(o => o.RealPartCode).HasMaxLength(50); b.Property(o => o.RealPartCode).HasMaxLength(50);
}); });

5771
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230901084349_vmi20.Designer.cs

File diff suppressed because it is too large

176
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230901084349_vmi20.cs

@ -0,0 +1,176 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class vmi20 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "119eda96252e4bd58016d77b0bf1f43b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "3bd216de9cdf423ab81dc6cf014f8616");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "24fd0b376e354409a5bcdec267b72b2d");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "7884254f65f7422da2abe11929da3f6b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "229a34c072454e7d949556e07a9f1e1f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "313eaf08e98642ec9b7531ac5e1575c9");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "1680a6235f8d40f092e576028cde752a");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "0464f68915234385b952314fefffc134");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "45a3d39659e34ef3bee5b93bb5781412");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "0c40557cb16c4c079fa836f5337875ed");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "9f16199bb6f34f14a193a7ae7fa700be");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Set_VmiReplenished_ChangedTime",
table: "Set_VmiReplenished");
migrationBuilder.DropIndex(
name: "IX_Set_VmiLog_ChangedTime",
table: "Set_VmiLog");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "d12f27a181f54465b338dd2401a08b6e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "d9f3e1d0603c46479198f5baad678663");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "20cdc48f0766480d9c7a70b390ce0f9f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "7da7c559aba84699ae1c6c6fa0a5dc59");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "20c50e67224d4595986559438cd975ad");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "366afac45e0e485d8f43e53346442ad2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "662702ee66444ca08ef7190b6ad1e8f3");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "8e44067496fa43c085d2cf3bc2ed8779");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "7fd5fef49685400fb7254abbfd3754a1");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "42aed6aa66044a06ab92e8bf2d882cb2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "c2cbd6a620fe4fd08d3f021939d31509");
}
}
}

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

@ -4453,7 +4453,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "42aed6aa66044a06ab92e8bf2d882cb2", ConcurrencyStamp = "0c40557cb16c4c079fa836f5337875ed",
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4463,7 +4463,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "d12f27a181f54465b338dd2401a08b6e", ConcurrencyStamp = "119eda96252e4bd58016d77b0bf1f43b",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4473,7 +4473,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "d9f3e1d0603c46479198f5baad678663", ConcurrencyStamp = "3bd216de9cdf423ab81dc6cf014f8616",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4483,7 +4483,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "662702ee66444ca08ef7190b6ad1e8f3", ConcurrencyStamp = "1680a6235f8d40f092e576028cde752a",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4493,7 +4493,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "20cdc48f0766480d9c7a70b390ce0f9f", ConcurrencyStamp = "24fd0b376e354409a5bcdec267b72b2d",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4503,7 +4503,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "20c50e67224d4595986559438cd975ad", ConcurrencyStamp = "229a34c072454e7d949556e07a9f1e1f",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4513,7 +4513,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "7da7c559aba84699ae1c6c6fa0a5dc59", ConcurrencyStamp = "7884254f65f7422da2abe11929da3f6b",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4523,7 +4523,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "c2cbd6a620fe4fd08d3f021939d31509", ConcurrencyStamp = "9f16199bb6f34f14a193a7ae7fa700be",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4533,7 +4533,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "366afac45e0e485d8f43e53346442ad2", ConcurrencyStamp = "313eaf08e98642ec9b7531ac5e1575c9",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4543,7 +4543,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "7fd5fef49685400fb7254abbfd3754a1", ConcurrencyStamp = "45a3d39659e34ef3bee5b93bb5781412",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4553,7 +4553,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "8e44067496fa43c085d2cf3bc2ed8779", ConcurrencyStamp = "0464f68915234385b952314fefffc134",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4683,9 +4683,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("BillTime")
.IsClustered();
b.HasIndex("DeliverBillType", "CodeType", "RealPartCode", "VinCode", "ErpToLoc", "OrderNum", "factory", "Configcode") b.HasIndex("DeliverBillType", "CodeType", "RealPartCode", "VinCode", "ErpToLoc", "OrderNum", "factory", "Configcode")
.IsUnique() .IsUnique()
.HasFilter("[DeliverBillType] IS NOT NULL AND [CodeType] IS NOT NULL AND [RealPartCode] IS NOT NULL AND [VinCode] IS NOT NULL AND [ErpToLoc] IS NOT NULL AND [OrderNum] IS NOT NULL AND [factory] IS NOT NULL AND [Configcode] IS NOT NULL"); .HasFilter("[DeliverBillType] IS NOT NULL AND [CodeType] IS NOT NULL AND [RealPartCode] IS NOT NULL AND [VinCode] IS NOT NULL AND [ErpToLoc] IS NOT NULL AND [OrderNum] IS NOT NULL AND [factory] IS NOT NULL AND [Configcode] IS NOT NULL");
@ -4801,7 +4798,7 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("BillTime") b.HasIndex("ChangedTime")
.IsClustered(); .IsClustered();
b.ToTable("Set_VmiLog"); b.ToTable("Set_VmiLog");
@ -4939,7 +4936,7 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("BillTime") b.HasIndex("ChangedTime")
.IsClustered(); .IsClustered();
b.ToTable("Set_VmiReplenished"); b.ToTable("Set_VmiReplenished");

Loading…
Cancel
Save