diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
index 05b77e14..36bc7ce8 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
@@ -80,7 +80,7 @@ export default function (businessType, type) {
} else {
if (businessType === "JisBBAC") {
service = "bbac_can_sa_service";
- } else if (businessType === "JisHBPO") {
+ } else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") {
service = "hbpo_can_sa_service";
} else {
service = "pub_can_sa_service";
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
index 63fb32ec..0dcfdd8e 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
@@ -135,12 +135,14 @@ function useLogSchema() {
},
changedType: {
title: "变动类型",
- type: "string",
+ type: "number",
input: "select",
options: [
{
value: 0,
label: "入库",
+ },
+ {
value: 1,
label: "出库",
},
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
index 24819e29..603e0cf8 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
@@ -189,7 +189,7 @@ public class PriceListRequestDto : PagedAndSortedResultRequestDto
///
/// 备件价格
///
-public class PriceListBJDto : EntityDto
+public class PriceListBJDto : AuditedEntityDto
{
///
/// 客户零件号
@@ -371,7 +371,7 @@ public class PriceListBJRequestDto : RequestInputBase
///
/// 列表
///
-public class TB_PRICE_LISTDto : EntityDto
+public class TB_PRICE_LISTDto : AuditedEntityDto
{
///
/// 零件号
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
index 274ff1e2..eed95dee 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
@@ -12,7 +12,7 @@ using System.Text.Json;
using System.Threading.Tasks;
using ClosedXML.Excel;
using DocumentFormat.OpenXml;
-using LinqToDB.Data;
+using EFCore.BulkExtensions;
using LinqToDB.EntityFrameworkCore;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core.Extension;
@@ -113,7 +113,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
db.Set().Add(snapshot);
db.SaveChanges();
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);");
snapshot.End = DateTime.Now;
transaction.Commit();
@@ -121,7 +121,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
}
throw new UserFriendlyException("备份程序正在运行", "500");
}
- catch(Exception ex)
+ catch (Exception ex)
{
transaction.Rollback();
throw new UserFriendlyException(ex.ToString(), "500");
@@ -182,9 +182,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
public ListResultDto Snapshot()
{
var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
- using var connection = new SqlConnection(connectionString);
- connection.Open();
- var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options;
+ var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options);
var list = db.Set().AsNoTracking().OrderByDescending(o => o.Start).ToList();
return new ListResultDto(list);
@@ -196,8 +194,9 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost]
public async Task> Backup(BackupListRequest input)
{
- using var scope = this._serviceProvider.CreateScope();
- var db = scope.ServiceProvider.GetRequiredService();
+ var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
+ var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options;
+ using var db = new SettleAccountDbContext(options);
var name = input.Name;
var sql = $"select * from {name}";
var query = db.Set().FromSqlRaw(sql);
@@ -218,8 +217,9 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost]
public async Task BackupExport(BackupListRequest input)
{
- using var scope = this._serviceProvider.CreateScope();
- var db = scope.ServiceProvider.GetRequiredService();
+ var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
+ var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options;
+ using var db = new SettleAccountDbContext(options);
var name = input.Name;
var sql = $"select * from {name}";
var query = db.Set().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 end = DateTime.Parse(input.Filters.FirstOrDefault(o => o.Column == "changedTime" && o.Action == EnumFilterAction.SmallThan).Value);
var tables = new List();
-
var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
connection.Open();
@@ -271,7 +270,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
}
}
}
- var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options;
+ var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options);
var sql = string.Empty;
if (tables.Any())
@@ -353,7 +352,6 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
}
catch (Exception ex)
{
- transaction.Rollback();
this._logger.LogError(ex.ToString());
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)
{
- log.ChangedTime = log.Id.ToDateTime().Value;
+ log.ChangedTime = log.Id.ToDateTime().Value.ToLocalTime();
if (log.ChangedQty >= decimal.Zero)
{
log.Qty = log.ChangedQty;
@@ -384,8 +382,6 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost]
public async Task Import(List files)
{
- var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
- using var connection = new SqlConnection(connectionString);
try
{
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);
return new JsonResult(new { code = 400, message = "输入异常", fileName });
}
- var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options;
- using var context = new SettleAccountDbContext(options);
list.ForEach(Update);
- var messageList = list.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) });
- using var dc = context.CreateLinqToDBConnection();
- dc.BeginTransaction();
+ var messageList = list.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList();
+ var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
+ var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options;
+ using var context = new SettleAccountDbContext(options);
var st = new Stopwatch();
st.Start();
- this._logger.LogInformation("事务开始");
- 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);
- dc.CommitTransaction();
- st.Stop();
- this._logger.LogInformation($"事务结束,耗时 ${st.ElapsedMilliseconds / 1000 / 60}分钟");
+ try
+ {
+ using var transaction = context.Database.BeginTransaction();
+ 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();
+ this._logger.LogInformation($"事务结束,耗时 ${st.ElapsedMilliseconds / 1000 / 60}分钟");
+ }
return new JsonResult(new { code = 200, message = "ok" });
}
catch (Exception ex)
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
index 19f4446b..0ef9e04f 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
@@ -51,11 +52,12 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
public async Task Invoke(IServiceProvider serviceProvider)
{
var batchSize = 1000;
+ var fetchSize = 0;
+ var connectionString = serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
for (var i = 0; i < 1000; i++)
{
var sw = new Stopwatch();
sw.Start();
- var connectionString = serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
connection.Open();
using var transaction = connection.BeginTransaction();
@@ -66,20 +68,26 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options;
using var context = new SettleAccountDbContext(options);
context.Database.UseTransaction(transaction);
- if (!context.Set().Any(o => !o.isConsumed))
+ var vmiMessageRepo = context.Set();
+ var vmiLogRepo = context.Set();
+ var vmiBalanceRepo = context.Set();
+ var vmiReplenishedRepo = context.Set();
+ if (!vmiMessageRepo.Any(o => !o.isConsumed))
{
+ transaction.Commit();
break;
}
- var messages = context.Set()
- //.AsNoTracking()
- .Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(batchSize).ToList();
- var repo = context.Set();
- foreach (var message in messages)
+ var messages = vmiMessageRepo.Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(batchSize).ToList();
+ fetchSize=messages.Count;
+ var list = messages.Select(o =>
+ {
+ var log = JsonSerializer.Deserialize(o.Message);
+ log.SetId(Guid.Parse(JsonSerializer.Deserialize(o.Message).GetProperty("Id").GetString()));
+ return new KeyValuePair(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(message.Message);
- log.SetId(Guid.Parse(JsonSerializer.Deserialize(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')";
var result = command.ExecuteScalar().ToString();
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.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.ExecuteNonQuery();
//插入库存
- var balance = context.Set().FirstOrDefault(
+ var balance = vmiBalanceRepo.FirstOrDefault(
o => o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType &&
o.DeliverBillType == log.DeliverBillType &&
@@ -110,7 +125,7 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
balance = new VmiBalance();
if (log.LogType == VmiLogType.Type300)
{//反结算入库,重建库存
- var logHistory = context.Set().AsNoTracking().FirstOrDefault(
+ var logHistory = vmiLogRepo.AsNoTracking().FirstOrDefault(
o => o.LogType == VmiLogType.Type100 &&
o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType &&
@@ -134,7 +149,7 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
balance.InjectFrom(log);
}
balance.Qty = log.ChangedQty;
- await repo.AddAsync(balance).ConfigureAwait(false);
+ await vmiBalanceRepo.AddAsync(balance).ConfigureAwait(false);
}
else
{//存在库存记录
@@ -162,31 +177,30 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
//添加负库存补货记录
var log2 = new VmiReplenished();
log2.InjectFrom(log);
- await context.Set().AddAsync(log2).ConfigureAwait(false);
+ await vmiReplenishedRepo.AddAsync(log2).ConfigureAwait(false);
}
// 更新库存
balance.Qty = currentQty + log.ChangedQty;
if (balance.Qty == decimal.Zero)
{
//删除0库存
- repo.Remove(balance);
+ vmiBalanceRepo.Remove(balance);
}
}
message.isConsumed = true;
+ context.SaveChanges();
}
- context.SaveChanges();
transaction.Commit();
}
catch (Exception ex)
{
this._logger.LogError(ex.ToString());
- transaction.Rollback();
throw new UserFriendlyException(ex.ToString(), "500");
}
finally
{
sw.Stop();
- this._logger.LogInformation($"处理{batchSize}条,耗时 {sw.ElapsedMilliseconds / 1000 / 60}分钟,{sw.ElapsedMilliseconds / 1000}秒");
+ this._logger.LogInformation($"处理{fetchSize}条,耗时 {sw.ElapsedMilliseconds / 1000 / 60}分钟,{sw.ElapsedMilliseconds / 1000}秒");
}
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
index 16e42d34..be8a6c7c 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
@@ -7,7 +7,7 @@ public class VmiBalance : VmiBalanceBase
public VmiBalance()
{
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
- CreatedTime = Id.ToDateTime().Value;
+ CreatedTime = Id.ToDateTime().Value.ToLocalTime();
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
index 039adc17..c5950b70 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
@@ -12,7 +12,7 @@ public class VmiLog : VmiBalanceBase, IValidatableObject
public VmiLog()
{
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
- ChangedTime = Id.ToDateTime().Value;
+ ChangedTime = Id.ToDateTime().Value.ToLocalTime();
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiMessage.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiMessage.cs
index e541e079..ee10db06 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiMessage.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiMessage.cs
@@ -8,7 +8,7 @@ public class VmiMessage : Entity
public VmiMessage()
{
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
- CreatedTime = Id.ToDateTime().Value;
+ CreatedTime = Id.ToDateTime().Value.ToLocalTime();
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
index 40495d8b..eb86e8c8 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
+++ b/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.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.ConcurrencyStamp).HasMaxLength(50).IsConcurrencyToken();
- b.HasIndex(o => o.BillTime).IsClustered();
b.HasIndex(o => (new
{
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.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().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);
});
@@ -1344,7 +1342,6 @@ namespace Win.Sfs.SettleAccount
{
b.ToTable($"{options.TablePrefix}_VmiReplenished", options.Schema);
b.ConfigureByConvention();
- b.HasIndex(o => o.BillTime).IsClustered();
b.Property(o => o.RealPartCode).HasMaxLength(50);
});
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230901084349_vmi20.Designer.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230901084349_vmi20.Designer.cs
new file mode 100644
index 00000000..1a73c0e5
--- /dev/null
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230901084349_vmi20.Designer.cs
@@ -0,0 +1,5771 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Volo.Abp.EntityFrameworkCore;
+using Win.Sfs.SettleAccount;
+
+namespace Win.Sfs.SettleAccount.Migrations
+{
+ [DbContext(typeof(SettleAccountDbContext))]
+ [Migration("20230901084349_vmi20")]
+ partial class vmi20
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.17")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_CAN_SA", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("BusinessType")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("InvGroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("SettleBillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Site")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("State")
+ .HasMaxLength(50)
+ .HasColumnType("int");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Set_BBAC_CAN_SA");
+ });
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_CAN_SA_DETAIL", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("BusinessType")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ContractDocID")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("ErpLoc")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("GroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("InvGroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("InvbillNum")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsMaiDan")
+ .HasColumnType("bit");
+
+ b.Property("IsReturn")
+ .HasMaxLength(50)
+ .HasColumnType("bit");
+
+ b.Property("KeyCode")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LU")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("PN")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("PartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Qty")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("RealPartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SettleBillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("SettleDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Site")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Set_BBAC_CAN_SA_DETAIL");
+ });
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_NOT_SA_DETAIL", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BusinessType")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ContractDocID")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("ErpLoc")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("GroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("InvGroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("IsMaiDan")
+ .HasColumnType("bit");
+
+ b.Property("IsReturn")
+ .HasMaxLength(50)
+ .HasColumnType("bit");
+
+ b.Property("KeyCode")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LU")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("PN")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("PartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Qty")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("RealPartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SettleBillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("SettleDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Site")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Set_BBAC_NOT_SA_DETAIL");
+ });
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_PD", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("InvGroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("SettleBillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Site")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("State")
+ .HasColumnType("int");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Set_BBAC_PD");
+ });
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_PD_DETAIL", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("BusinessType")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("DeletionTime");
+
+ b.Property("Extend1")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Extend2")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Extend3")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Extend4")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("GroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("InvGroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("IsMaiDan")
+ .HasColumnType("bit");
+
+ b.Property("KeyCode")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LU")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("PN")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Price")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Qty")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("RELU")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("REPN")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("SettleDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Site")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Set_BBAC_PD_DETAIL");
+ });
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SA", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("BusinessType")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("DNBillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Site")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("State")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Set_BBAC_SA");
+ });
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SA_DETAIL", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("BillNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("BusinessType")
+ .HasColumnType("int");
+
+ b.Property("Category")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ContractDocID")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("CustomerPartCodeNoSpace")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("GroupNum")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("IsReturn")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("KeyCode")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LU")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("PN")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("PartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Qty")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("SettleDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Site")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Set_BBAC_SA_DETAIL");
+ });
+
+ modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SE_DETAIL", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AssembleData")
+ .HasColumnType("datetime2");
+
+ b.Property("AssemblyCode")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Batch")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("BeginDate")
+ .HasColumnType("datetime2");
+
+ b.Property("BillCharacter")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("BillNum")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("BillTime")
+ .HasColumnType("datetime2");
+
+ b.Property("BillType")
+ .HasColumnType("int");
+
+ b.Property("BusinessType")
+ .HasColumnType("int");
+
+ b.Property("CodeType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreateTime")
+ .HasColumnType("datetime2");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("CreatorId");
+
+ b.Property("CustPartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CustomerPartCodeNoSpace")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("DeleterId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("DeletionTime");
+
+ b.Property("DeliverBillType")
+ .HasColumnType("int");
+
+ b.Property("DeliverCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DeliverSubBillType")
+ .HasColumnType("int");
+
+ b.Property("ErpToLoc")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Factory")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FactoryPartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FromLoc")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("InjectionCode")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("IsHaveEdiData")
+ .HasColumnType("bit");
+
+ b.Property("JISNum")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("KeyCode")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LU")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime2")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("LastModifierId");
+
+ b.Property("MESConfigCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MatchNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Oper")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderNum")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrigiCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PN")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("PartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PartDesc")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PjsNum")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Position")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProType")
+ .HasColumnType("int");
+
+ b.Property("Qty")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("RealCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RealPartCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RefBillNum")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RefVinCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Remark")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Seq")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SeqNumber")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ShippingDate")
+ .HasColumnType("datetime2");
+
+ b.Property