学 赵 1 year ago
parent
commit
4e875e8b08
  1. 5
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 27
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js
  3. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/adjust.js
  4. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js
  5. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
  6. 24
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js
  7. 97
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs
  8. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  9. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs
  10. 109
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  11. 66
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
  12. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs
  13. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  14. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  15. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs
  16. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs
  17. 9
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  18. 43
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828074927_vmi18.Designer.cs
  19. 258
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828074927_vmi18.cs
  20. 5813
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828092102_20230828-1.Designer.cs
  21. 92
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828092102_20230828-1.cs
  22. 41
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  23. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs
  24. 90
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

5
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -1,4 +1,3 @@
using System;
using System.IO.Compression;
using System.Linq;
using System.Text.RegularExpressions;
@ -10,15 +9,14 @@ using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SettleAccount.Job.SignalR;
//using ShardingCore;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
namespace Win.Sfs.SettleAccount;
@ -30,6 +28,7 @@ public class Startup
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.Configure<GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Fastest);

27
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js

@ -65,19 +65,19 @@ const deliverSubBillType = {
type: "string",
input: "select",
options: [
{ value: 0, label: "无" },
{ value: 1, label: "保险杠BBAC" },
{ value: 2, label: "保险杠HBPO" },
{ value: 3, label: "买单件保险杠BBAC" },
{ value: 4, label: "买单件保险杠HBPO" },
{ value: 5, label: "买单件小件BBAC" },
{ value: 6, label: "买单件小件HBPO" },
{ value: 7, label: "小件BBAC" },
{ value: 8, label: "小件HBPO" },
{ value: 9, label: "JIT直供件BBAC" },
{ value: 10, label: "JIT直供件HBPO" },
{ value: 11, label: "印度件BBAC" },
{ value: 12, label: "北汽4S备件BBAC" },
{ value: "0", label: "无" },
{ value: "1", label: "保险杠BBAC" },
{ value: "2", label: "保险杠HBPO" },
{ value: "3", label: "买单件保险杠BBAC" },
{ value: "4", label: "买单件保险杠HBPO" },
{ value: "5", label: "买单件小件BBAC" },
{ value: "6", label: "买单件小件HBPO" },
{ value: "7", label: "小件BBAC" },
{ value: "8", label: "小件HBPO" },
{ value: "9", label: "JIT直供件BBAC" },
{ value: "10", label: "JIT直供件HBPO" },
{ value: "11", label: "印度件BBAC" },
{ value: "12", label: "北汽4S备件BBAC" },
],
};
@ -135,7 +135,6 @@ const codeType = {
input: "select",
options: [
{ value: "01", label: "前保" },
{ value: "02", label: "后保" },
{ value: "03", label: " 左门槛" },
{ value: "04", label: "右门槛" },
{ value: "05", label: "扰流板" },

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

@ -6,7 +6,7 @@ const schema = useLogSchema();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/log`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = "settleaccount/vmi/edit-balance";
const createUrl = "settleaccount/vmi/adjust";
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/import`;

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

@ -1,5 +1,4 @@
import useVmi from "./vmi.js";
import { dayjs } from "element-plus";
const schema = useVmi();
@ -58,7 +57,6 @@ export default function () {
value: null,
readOnly: true,
title: "发运开始",
default: dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
},
{
logic: "and",
@ -67,7 +65,6 @@ export default function () {
value: null,
readOnly: true,
title: "发运结束",
default: dayjs().add(1, "month").startOf("day").format("YYYY-MM-DD HH:mm:ss"),
},
{
logic: "and",

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

@ -1,4 +1,5 @@
import { deliverBillType, deliverSubBillType, codeType } from "../_options.js";
import { dayjs } from "element-plus";
function useSchema() {
return {
@ -92,7 +93,7 @@ function useSchema() {
title: "工厂",
type: "string",
},
deliverSubBillType,
deliverSubBillType: Object.assign({ rules: [{ required: true }] }, deliverSubBillType),
vinCode: {
title: "EDI订单生产码",
type: "string",
@ -130,6 +131,7 @@ function useLogSchema() {
input: "datetime",
clearable: false,
readOnly: true,
default: dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
},
changedType: {
title: "变动类型",

24
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js

@ -3,6 +3,7 @@ import html from "html";
import { ref, onMounted, onUnmounted } from "vue";
import { useRoute } from "vue-router";
import { ElNotification } from "element-plus";
import request from "../../request/index.js";
export default {
components: { AppList },
@ -13,21 +14,28 @@ export default {
const onCommand = async (item, rows) => {
console.log(item.path, item, rows);
};
let notify = null;
const showMessage = (data) => {
notify?.close();
notify = ElNotification({
position: "bottom-right",
title: "提示",
message: `待同步库存数量: ${data}`,
duration: 0,
});
};
const event = "VmiBalance";
onMounted(async () => {
const model = "vmi/balance";
const useConfig = (await import(`../../models/${model}.js`)).default;
config.value = useConfig(route.meta?.businessType, route.meta);
let notify = null;
const result = await request("settleaccount/vmi-async-message/get-message-count", null, { method: "POST" });
if (!result.errors) {
showMessage(result.data);
}
PubSub.subscribe(event, async (_, data) => {
if (route.path === "/vmi/balance") {
notify?.close();
notify = ElNotification({
position: "bottom-right",
title: "待同步库存数量",
message: data,
duration: 0,
});
showMessage(data);
}
});
});

97
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs

@ -1,6 +1,13 @@
using Castle.Core.Internal;
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Spreadsheet;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Magicodes.ExporterAndImporter.Excel.Utility;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Extensions;
using NPOI.HPSF;
using SettleAccount.Domain.BQ;
using Shouldly;
using SqlSugar;
@ -8,12 +15,15 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -34,14 +44,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// excel服务
/// </summary>
private readonly IExcelImportAppService _excelImportService;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// 构造
/// </summary>
public PUB_SE_DETAIL_SERVICE(INormalEfCoreRepository<PUB_SE_DETAIL, Guid> repository, IExcelImportAppService excelImportService)
public PUB_SE_DETAIL_SERVICE(INormalEfCoreRepository<PUB_SE_DETAIL, Guid> repository, IExcelImportAppService excelImportService, IBlobContainer<MyFileContainer> fileContainer)
{
_repository = repository;
_excelImportService = excelImportService;
_fileContainer = fileContainer;
}
#region 导出
@ -70,6 +85,86 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
return fileName;
}
[HttpGet]
public async Task<string> TextExportAsync()
{
var fileName = $"发运数据_{Guid.NewGuid()}.xlsx";
var haveEdiHaveSeList = new List<JisBBACEidSeCompareExport>();
for (int i = 0; i < 2_000_000; i++)
{
haveEdiHaveSeList.Add(new JisBBACEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = i.ToString(),
CarModeCode = i.ToString(),
LineStationcode = i.ToString(),
SequenceNumber = i.ToString(),
ParType = i.ToString(),
MESConfigCode = i.ToString(),
ShippingDate = DateTime.Now,
PN = i.ToString(),
Seq = i.ToString(),
PjsNum = i.ToString(),
MaterialNumber = i.ToString(),
MaterialDes = i.ToString(),
SEQty = 1,
EdiQty = 1,
AssemblyDate = DateTime.Now,
MatchNumber = i.ToString(),
InjectionCode = i.ToString(),
MateType = "是",
DiffDesc = "WMS有发货EDI有订单"
});
}
var jisBBACEidSeCompareEexcelExporterAttribute = typeof(JisBBACEidSeCompareExport).GetAttribute<ExcelExporterAttribute>();
var jisBBACEidSeCompareEexcelMaxRowNumberOnASheet = 9_000_000;
if (jisBBACEidSeCompareEexcelExporterAttribute != null)
{
jisBBACEidSeCompareEexcelMaxRowNumberOnASheet = jisBBACEidSeCompareEexcelExporterAttribute.MaxRowNumberOnASheet > 0 ? jisBBACEidSeCompareEexcelExporterAttribute.MaxRowNumberOnASheet : jisBBACEidSeCompareEexcelMaxRowNumberOnASheet;
}
ExcelExporter excelExporter = new ExcelExporter();
excelExporter.Append(haveEdiHaveSeList.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList(), $"BBACEDI数据和发货对比");
var ediSheetCount = (int)(haveEdiHaveSeList.Count / jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) + ((haveEdiHaveSeList.Count % jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) > 0 ? 1 : 0);
if (ediSheetCount > 1)
{
for (int i = 1; i < ediSheetCount; i++)
{
var sheetDataItems = haveEdiHaveSeList.Skip(i * jisBBACEidSeCompareEexcelMaxRowNumberOnASheet)
.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"BBACEDI数据和发货对比-{i}");
}
}
excelExporter.Append(haveEdiHaveSeList.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList(), $"BBAC发货和EDI数据对比");
var seSheetCount = (int)(haveEdiHaveSeList.Count / jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) + ((haveEdiHaveSeList.Count % jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) > 0 ? 1 : 0);
if (seSheetCount > 1)
{
for (int i = 1; i < seSheetCount; i++)
{
var sheetDataItems = haveEdiHaveSeList.Skip(i * jisBBACEidSeCompareEexcelMaxRowNumberOnASheet)
.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"BBAC发货和EDI数据对比-{i}");
}
}
//excelExporter
// .Append(haveEdiHaveSeList, $"BBACEDI数据和发货对比");
//.SeparateBySheet()
////.Append(haveEdiHaveSeList, $"BBAC发货和EDI数据对比");
var result = excelExporter.ExportAppendDataAsByteArray();
await result.ShouldNotBeNull().ConfigureAwait(false);
await _fileContainer.SaveAsync(fileName, result.Result, true).ConfigureAwait(false);
return fileName;
}
#endregion
#region 查询

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

@ -68,7 +68,6 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
ediDetails.ForEach(t => t.IsHaveSeData = true);
db.BulkUpdate<BBAC_SE_EDI>(ediDetails);
}
db.SaveChanges();
}
}
catch (Exception)

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs

@ -92,8 +92,6 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
ediDetails.ForEach(t => t.IsHaveSeData = true);
db.BulkUpdate<HBPO_SE_EDI>(ediDetails);
}
await uow.SaveChangesAsync().ConfigureAwait(false);
//db.SaveChanges();
}
}
catch (Exception)

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

@ -11,7 +11,6 @@ using System.Reflection;
using System.Text.Json;
using System.Threading.Tasks;
using ClosedXML.Excel;
using LinqToDB.Data;
using LinqToDB.EntityFrameworkCore;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core.Extension;
@ -30,6 +29,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Users;
using Volo.Abp.Validation;
using Win.Sfs.BaseData.ImportExcelCommon;
@ -42,10 +42,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ;
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class VmiAppService : ApplicationService, IJobService, ITransientDependency
public class VmiAppService : Controller, IApplicationService, IJobService, ITransientDependency
{
public static object backupLock = new object();
private readonly IConfiguration _cfg;
private readonly IGuidGenerator _guidGenerator;
private readonly IServiceProvider _serviceProvider;
private readonly INormalEfCoreRepository<VmiBalance, Guid> _balanceRepository;
private readonly INormalEfCoreRepository<VmiLog, Guid> _logRepository;
@ -55,6 +56,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
public VmiAppService(IConfiguration cfg,
IServiceProvider serviceProvider,
IGuidGenerator guidGenerator,
INormalEfCoreRepository<VmiBalance, Guid> balanceRepository,
INormalEfCoreRepository<VmiLog, Guid> logRepository,
IBlobContainer<MyFileContainer> fileContainer,
@ -62,6 +64,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
ICurrentUser currentUser)
{
this._cfg = cfg;
this._guidGenerator = guidGenerator;
this._serviceProvider = serviceProvider;
this._balanceRepository = balanceRepository;
this._logRepository = logRepository;
@ -71,40 +74,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
LinqToDBForEFTools.Initialize();
}
[HttpPost]
public async Task Test(List<VmiLog> logs, int size = 1000)
{
using var scope = this._serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
using var dc = db.CreateLinqToDBConnection();
dc.BeginTransaction();
try
{
//var skip = 0;
//var count = logs.Count;
//while (count > 0)
//{
// var batchSize = count > size ? size : count;
// var tempLogs = logs.Skip(skip).Take(batchSize);
// var tempMessages = tempLogs.Select(o => new VmiMessage { Message = JsonSerializer.Serialize(o) });
// await dc.BulkCopyAsync(new BulkCopyOptions { TableName = "Set_VmiLog" }, tempLogs).ConfigureAwait(false);
// await dc.BulkCopyAsync(new BulkCopyOptions { TableName = "Set_VmiMessage" }, tempMessages).ConfigureAwait(false);
// count -= batchSize;
// skip += batchSize;
//}
await dc.BulkCopyAsync(new BulkCopyOptions { TableName = "Set_VmiMessage", MaxBatchSize = 1 }, new List<VmiMessage> {
new VmiMessage(Guid.NewGuid()) { Message="1" },
new VmiMessage(Guid.NewGuid()) { Message="2" }
}).ConfigureAwait(false);
dc.Transaction.Commit();
}
catch
{
dc.Transaction.Rollback();
throw;
}
}
/// <summary>
/// Excel 转 JSON
/// </summary>
@ -203,7 +172,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
/// 快照列表
/// </summary>
[HttpPost]
public async Task<List<VmiSnapshot>> Snapshot()
public ListResultDto<VmiSnapshot> Snapshot()
{
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
@ -211,7 +180,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var list = db.Set<VmiSnapshot>().AsNoTracking().OrderByDescending(o => o.Start).ToList();
return list;
return new ListResultDto<VmiSnapshot>(list);
}
/// <summary>
@ -310,6 +279,10 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
{
query = query.Where(input.Filters.ToLambda<VmiLog>());
}
if(input.LogTypes.Count > 0)
{
query = query.Where(o => input.LogTypes.Contains(o.LogType));
}
var totalCount = query.Count();
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false);
@ -349,7 +322,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
/// <param name="log"></param>
/// <returns></returns>
[HttpPost]
public IActionResult EditBalance(VmiLog log)
public IActionResult Adjust([FromBody] VmiLog log)
{
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
@ -358,8 +331,9 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
try
{
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
log.SetId(GuidGenerator.Create());
using var context = new SettleAccountDbContext(options);
context.Database.UseTransaction(transaction);
log.SetId(this._guidGenerator.Create());
if (log.ChangedQty >= decimal.Zero)
{
log.Qty = log.ChangedQty;
@ -374,8 +348,9 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
}
log.ChangedBy = this._currentUser.UserName;
log.ChangedTime = DateTime.Now;
db.Set<VmiLog>().Add(log);
db.Set<VmiMessage>().Add(new VmiMessage(GuidGenerator.Create()) { Message = JsonSerializer.Serialize(log) });
context.Set<VmiLog>().Add(log);
context.Set<VmiMessage>().Add(new VmiMessage(this._guidGenerator.Create()) { Message = JsonSerializer.Serialize(log) });
context.SaveChanges();
transaction.Commit();
return new OkResult();
}
@ -399,7 +374,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
var list = this.ImportInternal<VmiLog>(ms.ToArray());
foreach (var file in list)
{
EditBalance(file);
Adjust(file);
}
}
@ -507,52 +482,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
{
throw new NotImplementedException();
}
//private void SetPropertyValue(PropertyInfo property, VmiLog entity, string value)
//{
// try
// {
// object propertyValue = null;
// if (!string.IsNullOrEmpty(value))
// {
// propertyValue = Convert.ChangeType(value, property.PropertyType);
// }
// property.SetValue(entity, propertyValue, null);
// }
// catch (Exception)
// {
// throw;
// }
//}
//private string GetOperator(EnumFilterAction action)
//{
// var dictonary = new Dictionary<EnumFilterAction, string>() {
// {EnumFilterAction.Equal,"={0}"},
// {EnumFilterAction.NotEqual,"!={0}"},
// {EnumFilterAction.SmallThanOrEqual,"<={0}"},
// {EnumFilterAction.Like,"~/{0}/"},
// {EnumFilterAction.NotLike,"!~/{0}/"},
// {EnumFilterAction.BiggerThan,">{0}"},
// {EnumFilterAction.BiggerThanOrEqual,">={0}"},
// {EnumFilterAction.SmallThan,"<{0}"},
// };
// return dictonary[action];
//}
//private object GetValue(PropertyInfo property, string value)
//{
// if (property.PropertyType == typeof(int) ||
// property.PropertyType == typeof(long) ||
// property.PropertyType == typeof(float) ||
// property.PropertyType == typeof(double) ||
// property.PropertyType == typeof(decimal) ||
// property.PropertyType == typeof(bool))
// {
// return value;
// }
// return $"'{value}'";
//}
}
public class BackupListRequest : RequestDto

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

@ -4,11 +4,15 @@ using System.Linq;
using System.Linq.Dynamic.Core;
using System.Text.Json;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Omu.ValueInjecter;
using SettleAccount.Job.SignalR;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
@ -30,37 +34,41 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
public async Task Invoke(IServiceProvider serviceProvider)
{
var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
connection.Open();
using var transaction = connection.BeginTransaction();
try
{
var command = connection.CreateCommand();
command.Transaction = transaction;
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var messages = db.Set<VmiMessage>().Where(o => !o.isConsumed).OrderBy(o => o.Number).ToList();
var repo = db.Set<VmiBalance>();
using var context = new SettleAccountDbContext(options);
context.Database.UseTransaction(transaction);
var messages = context.Set<VmiMessage>().Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(1000 * 100).ToList();
var repo = context.Set<VmiBalance>();
foreach (var message in messages)
{
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}";
var command = connection.CreateCommand();
command.Transaction = transaction;
command.CommandText = $"select OBJECT_ID('{table}', 'U')";
var result = command.ExecuteScalar().ToString();
if (result == string.Empty)
{
command.CommandText = $"select * into {table} from Set_VmiLog where 1=0;";
command.CommandText += $"create clustered index IX_{table}_ChangedTime on {table} (ChangedTime);";
db.Database.ExecuteSqlRaw($"alter table {table} add constraint PK_{table} primary key (Id);");
command.ExecuteNonQuery();
command.CommandText = $"create clustered index IX_{table}_ChangedTime on {table} (ChangedTime);";
command.ExecuteNonQuery();
command.CommandText = $"alter table {table} add constraint PK_{table} primary key (Id);";
command.ExecuteNonQuery();
}
//插入到分表
command.CommandText = $"insert into {table} select * from Set_VmiLog where id ='{log.Id}'";
command.ExecuteNonQuery();
//插入库存
var balance = db.Set<VmiBalance>().FirstOrDefault(
var balance = context.Set<VmiBalance>().FirstOrDefault(
o => o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType &&
o.DeliverBillType == log.DeliverBillType &&
@ -110,11 +118,12 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
//添加负库存补货记录
var log2 = new VmiReplenished();
log2.InjectFrom(log);
await db.Set<VmiReplenished>().AddAsync(log2).ConfigureAwait(false);
await context.Set<VmiReplenished>().AddAsync(log2).ConfigureAwait(false);
}
}
message.isConsumed = true;
}
context.SaveChanges();
transaction.Commit();
}
catch (Exception ex)
@ -125,3 +134,40 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
}
}
}
/// <summary>
/// 消息表定时清理
/// </summary>
public class VmiAsyncMessageService : Controller, IApplicationService, IJobService, ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public VmiAsyncMessageService(IServiceProvider serviceProvider)
{
this._serviceProvider = serviceProvider;
}
[NonAction]
public Task Invoke(IServiceProvider serviceProvider)
{
using var scope = serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
db.Set<VmiMessage>().Where(o => o.isConsumed).BatchDelete();
var count = db.Set<VmiMessage>().Where(o => !o.isConsumed).Count();
scope.ServiceProvider.GetService<IHubContext<PageHub>>().Clients.All.ServerToClient("VmiBalance", count.ToString(), "");
return Task.CompletedTask;
}
/// <summary>
/// 未处理消息数量
/// </summary>
/// <returns></returns>
[HttpPost]
public int GetMessageCount()
{
using var scope = this._serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var count = db.Set<VmiMessage>().Where(o => !o.isConsumed).Count();
return count;
}
}

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs

@ -51,12 +51,13 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
/// </summary>
[Display(Name = "是否有发运数据")]
public bool IsHaveSeData { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name ="生产线")]
[MaxLength(50)]
public string LineStationCode { set; get; }
public BBAC_SE_EDI()
{ }
public BBAC_SE_EDI(Guid guid, string keyCode, string version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate

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

@ -16,5 +16,5 @@ public class VmiBalance : VmiBalanceBase
public string ConcurrencyStamp { get; set; }
public DateTime CreatedTime { get; set; }
public DateTime UpdatedTime { get; set; }
public DateTime UpdatedTime { get; set; } = DateTime.Now;
}

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

@ -30,7 +30,7 @@ public class VmiLog : VmiBalanceBase
public string ChangedNumber { get; set; }
[Display(Name = "变动时间", Order = 2)]
public DateTime ChangedTime { get; set; }=DateTime.Now;
public DateTime ChangedTime { get; set; } = DateTime.Now;
[Display(Name = "变动类型", Order = 3)]
public VmiType ChangedType { get; set; }
@ -43,5 +43,5 @@ public class VmiLog : VmiBalanceBase
public string ConcurrencyStamp { get; set; }
public DateTime CreatedTime { get; set; }
public DateTime UpdatedTime { get; set; }
public DateTime UpdatedTime { get; set; } = DateTime.Now;
}

20
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs

@ -15,7 +15,7 @@ public class JisBBACEidSeCompareReport
/// <summary>
/// JisBBAC Edi、发运对比导出
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class JisBBACEidSeCompareExport
{
/// <summary>
@ -31,22 +31,22 @@ public class JisBBACEidSeCompareExport
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// CarModeCode
/// 车型
/// </summary>
[Display(Name = "CarModeCode")]
[ExporterHeader(DisplayName = "CarModeCode")]
[Display(Name = "车型")]
[ExporterHeader(DisplayName = "车型")]
public string CarModeCode { get; set; }
/// <summary>
/// LineStationcode
/// 生产线
/// </summary>
[Display(Name = "LineStationcode")]
[ExporterHeader(DisplayName = "LineStationcode")]
[Display(Name = "生产线")]
[ExporterHeader(DisplayName = "生产线")]
public string LineStationcode { get; set; }
/// <summary>
/// SequenceNumber
/// 生产码序列号日期
/// </summary>
[Display(Name = "SequenceNumber")]
[ExporterHeader(DisplayName = "SequenceNumber")]
[Display(Name = "生产码序列号日期")]
[ExporterHeader(DisplayName = "生产码序列号日期")]
public string SequenceNumber { get; set; }
/// <summary>
/// ParType

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs

@ -135,7 +135,7 @@ public class SaSeEdiCompareDiff
/// <summary>
/// 结算、发运、Eid对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class SaSeEdiCompareDetailExport
{
}
@ -192,7 +192,6 @@ public interface ISaSeEdiCompareDetailExport
/// <summary>
/// JisBBAC结算、发运、Eid对比明细
/// </summary>
public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport
{
/// <summary>
@ -477,7 +476,7 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
/// <summary>
/// PUB结算与发运对比汇总
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class SaSeEdiCompareSumExport
{
/// <summary>

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

@ -1311,8 +1311,8 @@ namespace Win.Sfs.SettleAccount
{
b.ToTable($"{options.TablePrefix}_VmiBalance", options.Schema);
b.ConfigureByConvention();
b.Property(o => o.CreatedTime).ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.UpdatedTime).ValueGeneratedOnAddOrUpdate().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.ConcurrencyStamp).HasMaxLength(50).IsConcurrencyToken();
b.HasIndex(o => o.BillTime).IsClustered();
b.HasIndex(o => (new
@ -1332,8 +1332,9 @@ namespace Win.Sfs.SettleAccount
{
b.ToTable($"{options.TablePrefix}_VmiLog", options.Schema);
b.ConfigureByConvention();
b.Property(o => o.CreatedTime).ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.UpdatedTime).ValueGeneratedOnAddOrUpdate().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.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.HasIndex(o => o.BillTime).IsClustered();
});

43
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828042700_vmi18.Designer.cs → code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828074927_vmi18.Designer.cs

@ -11,7 +11,7 @@ using Win.Sfs.SettleAccount;
namespace Win.Sfs.SettleAccount.Migrations
{
[DbContext(typeof(SettleAccountDbContext))]
[Migration("20230828042700_vmi18")]
[Migration("20230828074927_vmi18")]
partial class vmi18
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -934,6 +934,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LineStationCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("PN")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -4447,7 +4450,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "25ec0d7c647f42d88882c4187af74201",
ConcurrencyStamp = "894bdd1d59cf4a3192d3a5d9a743b7ea",
Cron = "0 0 8 26 *",
IsDisabled = false,
IsRunning = false,
@ -4457,7 +4460,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "89413f316dbf4647954b6669de927488",
ConcurrencyStamp = "53ae466323824168bcb3cfbb7690bf07",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4467,7 +4470,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "ebb73d81d23c4ed9a6ae59730d163f4b",
ConcurrencyStamp = "5f2e16e5b3ec4e8289be386e1ee02a8e",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4477,7 +4480,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "93962cebd40f490b9df08b215b2c7bd2",
ConcurrencyStamp = "87a03d84519644d390b8588932fe5df2",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4487,7 +4490,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "e581ee4de97a46b1a1c0ba75a101c064",
ConcurrencyStamp = "cd646b7951d1416280aa91e4eba0bdcd",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4497,7 +4500,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "1fb801f3cbff422082d888ee8b5dab64",
ConcurrencyStamp = "c4ed2f64b0ae4faebfce741f32e24b50",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4507,7 +4510,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "a7be915b8a5541c58081c668219edfb7",
ConcurrencyStamp = "cdfe54ee987a4f0693ef60530817cb5c",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4517,7 +4520,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "7bbeaa02b39947c089eda7f4b05babb9",
ConcurrencyStamp = "3818b146b26542e197e47ecef3a3dc5e",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4527,7 +4530,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "df723d768280494e88d49734cc6e55e5",
ConcurrencyStamp = "b40af7f8fbcf4597b2cc2179cffecf86",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4537,7 +4540,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "c5b29d7fa18e4b9cb8bc1e354d10c3ac",
ConcurrencyStamp = "fb3db63b74744f1482b0e66505d582e0",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4547,7 +4550,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "1c542463eb8746db949bcda48eabdbd8",
ConcurrencyStamp = "866a884f080542aeb6c028d1ca3b5323",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4612,7 +4615,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
@ -4664,7 +4668,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode")
.HasColumnType("nvarchar(450)");
@ -4706,7 +4711,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("ChangedTime")
.HasColumnType("datetime2");
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<int>("ChangedType")
.HasColumnType("int");
@ -4722,7 +4729,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
@ -4777,7 +4785,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode")
.HasColumnType("nvarchar(max)");

258
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828074927_vmi18.cs

@ -0,0 +1,258 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class vmi18 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedTime",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
defaultValueSql: "getdate()",
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedTime",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
defaultValueSql: "getdate()",
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AlterColumn<DateTime>(
name: "ChangedTime",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
defaultValueSql: "getdate()",
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedTime",
table: "Set_VmiBalance",
type: "datetime2",
nullable: false,
defaultValueSql: "getdate()",
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedTime",
table: "Set_VmiBalance",
type: "datetime2",
nullable: false,
defaultValueSql: "getdate()",
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "53ae466323824168bcb3cfbb7690bf07");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "5f2e16e5b3ec4e8289be386e1ee02a8e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "cd646b7951d1416280aa91e4eba0bdcd");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "cdfe54ee987a4f0693ef60530817cb5c");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "c4ed2f64b0ae4faebfce741f32e24b50");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "b40af7f8fbcf4597b2cc2179cffecf86");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "87a03d84519644d390b8588932fe5df2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "866a884f080542aeb6c028d1ca3b5323");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "fb3db63b74744f1482b0e66505d582e0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "894bdd1d59cf4a3192d3a5d9a743b7ea");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "3818b146b26542e197e47ecef3a3dc5e");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedTime",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValueSql: "getdate()");
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedTime",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValueSql: "getdate()");
migrationBuilder.AlterColumn<DateTime>(
name: "ChangedTime",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValueSql: "getdate()");
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedTime",
table: "Set_VmiBalance",
type: "datetime2",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValueSql: "getdate()");
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedTime",
table: "Set_VmiBalance",
type: "datetime2",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValueSql: "getdate()");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "b6452a12f9814a2ba8097b0a34934cf1");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "e84ff12fed794e3d8eb0d8b6945873ce");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "f4063fd5bc9a4321941edf1663633d73");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "565a6be9ca2a450aae2dc98b972a32bc");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "f21a6c7a50a5405aaced44507dbdd01b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "df201f57bc0448d3909942c81a553597");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "673b92ac1f384632b35953a8601e92f2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "0f62e911f48d4c97a534eab3a6b2ddbd");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "6a1b56ecc53e4c56b036daab195d3a86");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "6e7a483ccf0e41e888beffb1e492f57e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "b493f376395d40c7ad727a14ec909ee0");
}
}
}

5813
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828092102_20230828-1.Designer.cs

File diff suppressed because it is too large

92
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828042700_vmi18.cs → code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230828092102_20230828-1.cs

@ -3,184 +3,186 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class vmi18 : Migration
public partial class _202308281 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Set_VmiSyncTask");
migrationBuilder.AlterColumn<string>(
name: "LineStationCode",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "89413f316dbf4647954b6669de927488", "同步结算库存" });
column: "ConcurrencyStamp",
value: "7171dfa8ed7a468697f49f779675204b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "ebb73d81d23c4ed9a6ae59730d163f4b", "事务消息监控" });
column: "ConcurrencyStamp",
value: "550dcdec5fb44b65a235deaef4be5be5");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "e581ee4de97a46b1a1c0ba75a101c064");
value: "c2ec841c8d8848afa92f5a8b503c28c0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "a7be915b8a5541c58081c668219edfb7");
value: "8c21427a3b514dca9dc26f393a3109cf");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "1fb801f3cbff422082d888ee8b5dab64");
value: "1211352da8754a31a50d0a30ec3c8481");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "df723d768280494e88d49734cc6e55e5");
value: "37d450957fb54e37be9a792d3a98f558");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "93962cebd40f490b9df08b215b2c7bd2");
value: "e4e1563e8ab544c59f8055555cc05a8c");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "1c542463eb8746db949bcda48eabdbd8");
value: "39199c157f4d4e319ed0cbfd863fc937");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "c5b29d7fa18e4b9cb8bc1e354d10c3ac");
value: "610e0efedca34af8bf1ddd9f869ff9fd");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "25ec0d7c647f42d88882c4187af74201", "库存快照备份" });
column: "ConcurrencyStamp",
value: "9c5c15ca0ef84bd69f3e35687321e68e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "7bbeaa02b39947c089eda7f4b05babb9");
value: "cc5d77c9310846688906b64a5800d17c");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Set_VmiSyncTask",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
LastUpdate = table.Column<DateTime>(type: "datetime2", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_VmiSyncTask", x => x.Id);
});
migrationBuilder.AlterColumn<string>(
name: "LineStationCode",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "b282d04b720a4453bac838a6d2702c5e", "同步库存" });
column: "ConcurrencyStamp",
value: "53ae466323824168bcb3cfbb7690bf07");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "af7e13c541954124a384db3d957e96f8", "消息监控" });
column: "ConcurrencyStamp",
value: "5f2e16e5b3ec4e8289be386e1ee02a8e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "1c63ae9d135a409da20ef2956f075921");
value: "cd646b7951d1416280aa91e4eba0bdcd");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "7d2a76e6327d46f4a93d15d91794de13");
value: "cdfe54ee987a4f0693ef60530817cb5c");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "448472749b8e4be587a6c8a9079bb4c1");
value: "c4ed2f64b0ae4faebfce741f32e24b50");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "ffca086d0a884f118ec61e00c1ea11cf");
value: "b40af7f8fbcf4597b2cc2179cffecf86");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "9758552b36a24d20bc4fd3efaa2c828a");
value: "87a03d84519644d390b8588932fe5df2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "7ac5c23ffc254496b3bfeac777aceb78");
value: "866a884f080542aeb6c028d1ca3b5323");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "a9ef4db8c8c547ff880badc98ecb3fb7");
value: "fb3db63b74744f1482b0e66505d582e0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "38598fb3653c48be8f63119787de2df8", "库存快照" });
column: "ConcurrencyStamp",
value: "894bdd1d59cf4a3192d3a5d9a743b7ea");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "298ad96e7d61427ba492ccdb1db7e900");
value: "3818b146b26542e197e47ecef3a3dc5e");
}
}
}

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

@ -933,7 +933,8 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnName("LastModifierId");
b.Property<string>("LineStationCode")
.HasColumnType("nvarchar(max)");
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PN")
.HasMaxLength(50)
@ -4448,7 +4449,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "6e7a483ccf0e41e888beffb1e492f57e",
ConcurrencyStamp = "9c5c15ca0ef84bd69f3e35687321e68e",
Cron = "0 0 8 26 *",
IsDisabled = false,
IsRunning = false,
@ -4458,7 +4459,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "b6452a12f9814a2ba8097b0a34934cf1",
ConcurrencyStamp = "7171dfa8ed7a468697f49f779675204b",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4468,7 +4469,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "e84ff12fed794e3d8eb0d8b6945873ce",
ConcurrencyStamp = "550dcdec5fb44b65a235deaef4be5be5",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4478,7 +4479,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "673b92ac1f384632b35953a8601e92f2",
ConcurrencyStamp = "e4e1563e8ab544c59f8055555cc05a8c",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4488,7 +4489,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "f4063fd5bc9a4321941edf1663633d73",
ConcurrencyStamp = "c2ec841c8d8848afa92f5a8b503c28c0",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4498,7 +4499,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "f21a6c7a50a5405aaced44507dbdd01b",
ConcurrencyStamp = "1211352da8754a31a50d0a30ec3c8481",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4508,7 +4509,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "565a6be9ca2a450aae2dc98b972a32bc",
ConcurrencyStamp = "8c21427a3b514dca9dc26f393a3109cf",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4518,7 +4519,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "b493f376395d40c7ad727a14ec909ee0",
ConcurrencyStamp = "cc5d77c9310846688906b64a5800d17c",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4528,7 +4529,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "df201f57bc0448d3909942c81a553597",
ConcurrencyStamp = "37d450957fb54e37be9a792d3a98f558",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4538,7 +4539,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "6a1b56ecc53e4c56b036daab195d3a86",
ConcurrencyStamp = "610e0efedca34af8bf1ddd9f869ff9fd",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4548,7 +4549,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "0f62e911f48d4c97a534eab3a6b2ddbd",
ConcurrencyStamp = "39199c157f4d4e319ed0cbfd863fc937",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4613,7 +4614,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
@ -4665,7 +4667,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode")
.HasColumnType("nvarchar(450)");
@ -4707,7 +4710,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("ChangedTime")
.HasColumnType("datetime2");
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<int>("ChangedType")
.HasColumnType("int");
@ -4723,7 +4728,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
@ -4778,7 +4784,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2");
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode")
.HasColumnType("nvarchar(max)");

21
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs

@ -71,10 +71,10 @@ namespace SettleAccount.Job.Services.Report
.Select(t => new JisBBACEidSeCompareExport()
{
Category = "JIS",
CarModeCode = default,
LineStationcode = default,
SequenceNumber = t.Max(t => t.SeqNumber),
ParType = "01",
CarModeCode = t.Max(t => t.Extend4),
LineStationcode = t.Max(t => t.LineStationCode),
SequenceNumber = t.Max(t => t.Extend3),
ParType = t.Max(t => t.Extend2),
PN = t.Key.PN,
MaterialNumber = t.Key.LU,
EdiQty = t.Sum(t => t.Qty),
@ -111,7 +111,10 @@ namespace SettleAccount.Job.Services.Report
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber)
Extend2 = groupItem.Max(t => t.Extend2),
Extend3 = groupItem.Max(t => t.Extend3),
Extend4 = groupItem.Max(t => t.Extend4),
LineStationCode = groupItem.Max(t => t.LineStationCode)
};
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
@ -138,10 +141,10 @@ namespace SettleAccount.Job.Services.Report
{
Category = "JIS",
WmsBillNum = se.BillNum,
CarModeCode = default,
LineStationcode = default,
SequenceNumber = edi.SeqNumber,
ParType = "01",
CarModeCode = edi.Extend4,
LineStationcode = edi.LineStationCode,
SequenceNumber = edi.Extend3,
ParType = edi.Extend2,
MESConfigCode = se.MESConfigCode,
ShippingDate = se.BillTime,
PN = se.PN,

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

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases;
@ -116,10 +117,26 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// 创建导出文件结构
/// </summary>
public ExcelExporter BindExcelExporter<T>(List<T> pubSaSeCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new()
public ExcelExporter BindExcelExporter<T>(List<T> saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new()
{
//详情Sheet行数
var detailMaxRowNumberOnASheet = 500_000;
var detailExportExporterAttribute = typeof(T).GetAttribute<ExcelExporterAttribute>();
if (detailExportExporterAttribute != null)
{
detailMaxRowNumberOnASheet = detailExportExporterAttribute.MaxRowNumberOnASheet > 0 ? detailExportExporterAttribute.MaxRowNumberOnASheet : detailMaxRowNumberOnASheet;
}
//汇总Sheet行数
var sumMaxRowNumberOnASheet = 500_000;
var sumExportExporterAttribute = typeof(SaSeEdiCompareSumExport).GetAttribute<ExcelExporterAttribute>();
if (sumExportExporterAttribute != null)
{
sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet;
}
//汇总
var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
var saSeEdiCompareSumExports = saSeEdiCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
@ -129,7 +146,7 @@ namespace SettleAccount.Job.Services.Report
}).ToList();
//有结算有发运
var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi }.Contains(t.Category));
var haveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi }.Contains(t.Category));
//有结算有发运汇总
var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
@ -140,7 +157,7 @@ namespace SettleAccount.Job.Services.Report
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
//有结算无发运
var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category));
var haveSaNotHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category));
//有结算无发运
var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
@ -151,7 +168,7 @@ namespace SettleAccount.Job.Services.Report
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
//无结算有发运
var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi }.Contains(t.Category));
var notHaveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi }.Contains(t.Category));
//无结算有发运
var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
@ -163,20 +180,59 @@ namespace SettleAccount.Job.Services.Report
}).ToList();
ExcelExporter excelExporter = new ExcelExporter();
return excelExporter
.Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
.SeparateBySheet()
.Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
.SeparateBySheet()
//结算核对明细输出
excelExporter.Append(saSeEdiCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出");
for (var i = 1; i < saSeEdiCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeEdiCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = saSeEdiCompareDetailExports.Skip(i * detailMaxRowNumberOnASheet)
.Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对明细输出-{i}");
}
//结算核对汇总输出
excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出");
for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}");
}
.Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
.SeparateBySheet()
.Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
.SeparateBySheet()
//有结算有发货明细输出
excelExporter.Append(haveSaHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货明细输出");
for (var i = 1; i < haveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveSaHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货明细输出-{i}");
}
//有结算有发货汇总输出
excelExporter.Append(haveSaHaveSeSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货汇总输出");
for (var i = 1; i < haveSaHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveSaHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货汇总输出-{i}");
}
//有结算有发货明细输出
excelExporter.Append(haveSaNotHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货明细输出");
for (var i = 1; i < haveSaNotHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveSaNotHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货明细输出-{i}");
}
//有结算有发货汇总输出
excelExporter.Append(haveSaNotHaveSeSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货汇总输出");
for (var i = 1; i < haveSaNotHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaNotHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveSaNotHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}");
}
.Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
.SeparateBySheet()
.Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出");
return excelExporter;
}
/// <summary>

Loading…
Cancel
Save