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/BQ/Dtos/BBAC_CAN_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
index 98460a8c..a90939a4 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
@@ -52,9 +52,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { get; set; }
[ExporterHeader(DisplayName = "发票号")] //全部业务都显示
public string InvBillNum { get; set; }
- [ExporterHeader(DisplayName = "厂内零件号")] //全部业务都显示
+ [ExporterHeader(DisplayName = "客户零件号")] //全部业务都显示
public string LU { get; set; }
- [ExporterHeader(DisplayName = "客户零件号")] //全部业务都显示 (查询条件)
+ [ExporterHeader(DisplayName = "厂内零件号")] //全部业务都显示 (查询条件)
public string PartCode { get; set; }
[ExporterHeader(DisplayName = "零件描述")] //全部业务都显示
public string MaterialDesc { get; set; }
@@ -106,9 +106,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { get; set; }
[ExporterHeader(DisplayName = "发票号")] //全部业务都显示
public string InvBillNum { get; set; }
- [ExporterHeader(DisplayName = "厂内零件号")] //全部业务都显示
+ [ExporterHeader(DisplayName = "客户零件号")] //全部业务都显示
public string LU { get; set; }
- [ExporterHeader(DisplayName = "客户零件号")] //全部业务都显示 (查询条件)
+ [ExporterHeader(DisplayName = "厂内零件号")] //全部业务都显示 (查询条件)
public string PartCode { get; set; }
[ExporterHeader(DisplayName = "零件描述")] //全部业务都显示
public string MaterialDesc { get; set; }
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs
index c8a271eb..2894400f 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs
@@ -105,7 +105,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { get; set; }
[ExporterHeader(DisplayName = "发票分组号")]
public string InvGroupNum { get; set; }
- [ExporterHeader(DisplayName = "LU")]
+ [ExporterHeader(DisplayName = "客户零件")]
public string LU { get; set; }
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDesc { get; set; }
@@ -121,7 +121,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
///
/// 客户零件号
///
- [ExporterHeader(DisplayName = "何苦零件号")]
+ [ExporterHeader(DisplayName = "厂内零件号")]
public string PartCode { get; set; }
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs
index 9dd09781..9e167ee0 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs
@@ -144,7 +144,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { get; set; }
[ExporterHeader(DisplayName = "发票分组号")]
public string InvGroupNum { get; set; }
- [ExporterHeader(DisplayName = "零件号")]
+ [ExporterHeader(DisplayName = "客户零件号")]
public string LU { get; set; }
[ExporterHeader(DisplayName = "物料描述")]
@@ -160,7 +160,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
///
/// 客户零件号
///
- [ExporterHeader(DisplayName = "客户零件号")]
+ [ExporterHeader(DisplayName = "厂内零件号")]
public string PartCode { get; set; }
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs
index c5c0c9d4..ee72c745 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs
@@ -102,7 +102,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { get; set; }
[ExporterHeader(DisplayName = "发票分组号")]
public string InvGroupNum { get; set; }
- [ExporterHeader(DisplayName = "零件号(LU)")]
+ [ExporterHeader(DisplayName = "客户零件号")]
public string LU { get; set; }
[ExporterHeader(DisplayName = "物料描述")]
@@ -116,7 +116,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ExporterHeader(DisplayName = "结算分组号")]
public string GroupNum { get; set; }
- [ExporterHeader(DisplayName = "客户零件号")]
+ [ExporterHeader(DisplayName = "厂内零件号")]
public string PartCode { get; set; }
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
index e4843967..0061cfa3 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
@@ -35,9 +35,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
BBAC_NOT_SA_DETAIL_REQ_DTO,
BBAC_NOT_SA_DETAIL_EXP_DTO>
{
-
private readonly BBAC_NOT_SA_MNG _bbacNotMng;
-
public BBAC_NOT_SA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager, INormalEfCoreRepository detailRepository, BBAC_NOT_SA_MNG bbacNotMng) :
@@ -45,32 +43,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
_bbacNotMng = bbacNotMng;
}
-
[HttpPost]
public override async Task GenerateSettlementOrder(BBAC_NOT_SA_DETAIL_REQ_DTO input)
{
List errorlist = new List();
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
-
if (entitys == null )
{
errorlist.Add(new ERR_EXP_DTO() { Message = "查询条件无记录" });
}
else
{
-
var errors = await _bbacNotMng.GenerateSettlementOrder(entitys);
if (errors.Count > 0)
{
-
-
foreach (var itm in errors)
{
errorlist.Add(new ERR_EXP_DTO() { Message = itm });
}
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorlist) });
-
-
}
}
return new JsonResult(new { Code = 200, Message = "生成成功" });
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
index cbb2456a..08ceebf3 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
@@ -49,7 +49,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[UnitOfWork(false)]
public override async Task ApprovalPassed(List p_list)
{
-
var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
List customConditionList = new List();
customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value =string.Join(",",p_list) });
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
index c9f803a0..4a424a05 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
@@ -71,15 +71,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public async Task GenerateInvoice( [FromBody] string billnum)
{
var main = await _pubMng.GetMainAsync(billnum);
-
if (main != null)
{
if (main.State != SettleBillState.未结状态)
{
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });
}
-
-
if (await _pubMng.SetForwardState(main, SettleBillState.已开票))
{
var entitys = await _pubMng.GetDetalListAsync(billnum);
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs
index cfadb072..a383ab95 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs
@@ -47,7 +47,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public override async Task GenerateSettlementOrder(PUB_NOT_SA_DETAIL_REQ_DTO input)
{
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
-
List errorlist = new List();
if (entitys == null)
{
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
index 6394c208..ee51b03c 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
@@ -102,6 +102,8 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
public void Sync(List p_ls, EnumDeliverBjBmpBillType bussinessType, bool flag=true) where T : PD_BASE,new()
{
+
+
var query = from itm in p_ls
select new VmiLog()
{
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/Managers/HBPO_NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
index 626bf387..7caa22ab 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
@@ -49,6 +49,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
public virtual async Task> GenerateSettlementOrder(List p_list)
{
+ var first=p_list.FirstOrDefault();
List errors = new List();
var priceErrors = await _service.CheckPriceList(p_list);
if (priceErrors.Count > 0)
@@ -58,16 +59,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
errors.Add($"生产号{itm.PN}零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据");
}
}
- var ls=p_list.Select(p => p.Site.Substring(0, 3)).Distinct().ToList();
- if(ls.Count>1)
+ if (first.BusinessType == EnumBusinessType.JisHBPO)
{
- errors.Add($"生成结算数据有多个地点数据{string.Join(",",ls)}");
- }
- if (errors.Count > 0)
- {
- return errors;
- }
+ var ls = p_list.Select(p => p.Site.Substring(0, 3)).Distinct().ToList();
+ if (ls.Count > 1)
+ {
+ errors.Add($"生成结算数据有多个地点数据{string.Join(",", ls)}");
+ }
+ if (errors.Count > 0)
+ {
+ return errors;
+ }
+
+
+ }
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new HBPO_CAN_SA();
_entity.BillNum = billNumber;
@@ -96,7 +102,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
settleDate: itm.SettleDate,
site: itm.Site,
invbillnum: string.Empty,
- partcode:itm.PartCode
+ partcode: itm.PartCode
);
_detailEntity.RealPartCode = itm.RealPartCode;
_entityList.Add(_detailEntity);
@@ -104,6 +110,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _notRepository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
+
+
+
return errors;
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs
index b65a42f5..5eca6fb5 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs
@@ -86,7 +86,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
foreach (var itm in priceErrors)
{
- errors.Add($"{name}零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据");
+ errors.Add($"{name}{itm.GroupNum}零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据");
}
}
if (errors.Count > 0)
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