学 赵 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.IO.Compression;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -10,15 +9,14 @@ using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.StaticFiles; using Microsoft.AspNetCore.StaticFiles;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using SettleAccount.Job.SignalR; using SettleAccount.Job.SignalR;
//using ShardingCore; //using ShardingCore;
using Win.Sfs.SettleAccount.Entities.BQ; using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs; using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
namespace Win.Sfs.SettleAccount; namespace Win.Sfs.SettleAccount;
@ -30,6 +28,7 @@ public class Startup
} }
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.Configure<GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Fastest); 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", type: "string",
input: "select", input: "select",
options: [ options: [
{ value: 0, label: "无" }, { value: "0", label: "无" },
{ value: 1, label: "保险杠BBAC" }, { value: "1", label: "保险杠BBAC" },
{ value: 2, label: "保险杠HBPO" }, { value: "2", label: "保险杠HBPO" },
{ value: 3, label: "买单件保险杠BBAC" }, { value: "3", label: "买单件保险杠BBAC" },
{ value: 4, label: "买单件保险杠HBPO" }, { value: "4", label: "买单件保险杠HBPO" },
{ value: 5, label: "买单件小件BBAC" }, { value: "5", label: "买单件小件BBAC" },
{ value: 6, label: "买单件小件HBPO" }, { value: "6", label: "买单件小件HBPO" },
{ value: 7, label: "小件BBAC" }, { value: "7", label: "小件BBAC" },
{ value: 8, label: "小件HBPO" }, { value: "8", label: "小件HBPO" },
{ value: 9, label: "JIT直供件BBAC" }, { value: "9", label: "JIT直供件BBAC" },
{ value: 10, label: "JIT直供件HBPO" }, { value: "10", label: "JIT直供件HBPO" },
{ value: 11, label: "印度件BBAC" }, { value: "11", label: "印度件BBAC" },
{ value: 12, label: "北汽4S备件BBAC" }, { value: "12", label: "北汽4S备件BBAC" },
], ],
}; };
@ -135,7 +135,6 @@ const codeType = {
input: "select", input: "select",
options: [ options: [
{ value: "01", label: "前保" }, { value: "01", label: "前保" },
{ value: "02", label: "后保" },
{ value: "03", label: " 左门槛" }, { value: "03", label: " 左门槛" },
{ value: "04", label: "右门槛" }, { value: "04", label: "右门槛" },
{ value: "05", 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 baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/log`; const queryUrl = `${baseUrl}/log`;
const detailsUrl = `${baseUrl}/get/%s`; const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = "settleaccount/vmi/edit-balance"; const createUrl = "settleaccount/vmi/adjust";
const updateUrl = `${baseUrl}/update/%s`; const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`; const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/import`; 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 useVmi from "./vmi.js";
import { dayjs } from "element-plus";
const schema = useVmi(); const schema = useVmi();
@ -58,7 +57,6 @@ export default function () {
value: null, value: null,
readOnly: true, readOnly: true,
title: "发运开始", title: "发运开始",
default: dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
}, },
{ {
logic: "and", logic: "and",
@ -67,7 +65,6 @@ export default function () {
value: null, value: null,
readOnly: true, readOnly: true,
title: "发运结束", title: "发运结束",
default: dayjs().add(1, "month").startOf("day").format("YYYY-MM-DD HH:mm:ss"),
}, },
{ {
logic: "and", 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 { deliverBillType, deliverSubBillType, codeType } from "../_options.js";
import { dayjs } from "element-plus";
function useSchema() { function useSchema() {
return { return {
@ -92,7 +93,7 @@ function useSchema() {
title: "工厂", title: "工厂",
type: "string", type: "string",
}, },
deliverSubBillType, deliverSubBillType: Object.assign({ rules: [{ required: true }] }, deliverSubBillType),
vinCode: { vinCode: {
title: "EDI订单生产码", title: "EDI订单生产码",
type: "string", type: "string",
@ -130,6 +131,7 @@ function useLogSchema() {
input: "datetime", input: "datetime",
clearable: false, clearable: false,
readOnly: true, readOnly: true,
default: dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
}, },
changedType: { changedType: {
title: "变动类型", 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 { ref, onMounted, onUnmounted } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { ElNotification } from "element-plus"; import { ElNotification } from "element-plus";
import request from "../../request/index.js";
export default { export default {
components: { AppList }, components: { AppList },
@ -13,21 +14,28 @@ export default {
const onCommand = async (item, rows) => { const onCommand = async (item, rows) => {
console.log(item.path, 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"; const event = "VmiBalance";
onMounted(async () => { onMounted(async () => {
const model = "vmi/balance"; const model = "vmi/balance";
const useConfig = (await import(`../../models/${model}.js`)).default; const useConfig = (await import(`../../models/${model}.js`)).default;
config.value = useConfig(route.meta?.businessType, route.meta); 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) => { PubSub.subscribe(event, async (_, data) => {
if (route.path === "/vmi/balance") { if (route.path === "/vmi/balance") {
notify?.close(); showMessage(data);
notify = ElNotification({
position: "bottom-right",
title: "待同步库存数量",
message: data,
duration: 0,
});
} }
}); });
}); });

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.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Extensions;
using NPOI.HPSF;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Shouldly; using Shouldly;
using SqlSugar; using SqlSugar;
@ -8,12 +15,15 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
@ -34,14 +44,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// excel服务 /// excel服务
/// </summary> /// </summary>
private readonly IExcelImportAppService _excelImportService; private readonly IExcelImportAppService _excelImportService;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary> /// <summary>
/// 构造 /// 构造
/// </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; _repository = repository;
_excelImportService = excelImportService; _excelImportService = excelImportService;
_fileContainer = fileContainer;
} }
#region 导出 #region 导出
@ -70,6 +85,86 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
return fileName; 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 #endregion
#region 查询 #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); ediDetails.ForEach(t => t.IsHaveSeData = true);
db.BulkUpdate<BBAC_SE_EDI>(ediDetails); db.BulkUpdate<BBAC_SE_EDI>(ediDetails);
} }
db.SaveChanges();
} }
} }
catch (Exception) 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); ediDetails.ForEach(t => t.IsHaveSeData = true);
db.BulkUpdate<HBPO_SE_EDI>(ediDetails); db.BulkUpdate<HBPO_SE_EDI>(ediDetails);
} }
await uow.SaveChangesAsync().ConfigureAwait(false);
//db.SaveChanges();
} }
} }
catch (Exception) 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.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using ClosedXML.Excel; using ClosedXML.Excel;
using LinqToDB.Data;
using LinqToDB.EntityFrameworkCore; using LinqToDB.EntityFrameworkCore;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core.Extension; using Magicodes.ExporterAndImporter.Core.Extension;
@ -30,6 +29,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Users; using Volo.Abp.Users;
using Volo.Abp.Validation; using Volo.Abp.Validation;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
@ -42,10 +42,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ;
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class VmiAppService : ApplicationService, IJobService, ITransientDependency public class VmiAppService : Controller, IApplicationService, IJobService, ITransientDependency
{ {
public static object backupLock = new object(); public static object backupLock = new object();
private readonly IConfiguration _cfg; private readonly IConfiguration _cfg;
private readonly IGuidGenerator _guidGenerator;
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly INormalEfCoreRepository<VmiBalance, Guid> _balanceRepository; private readonly INormalEfCoreRepository<VmiBalance, Guid> _balanceRepository;
private readonly INormalEfCoreRepository<VmiLog, Guid> _logRepository; private readonly INormalEfCoreRepository<VmiLog, Guid> _logRepository;
@ -55,6 +56,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
public VmiAppService(IConfiguration cfg, public VmiAppService(IConfiguration cfg,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IGuidGenerator guidGenerator,
INormalEfCoreRepository<VmiBalance, Guid> balanceRepository, INormalEfCoreRepository<VmiBalance, Guid> balanceRepository,
INormalEfCoreRepository<VmiLog, Guid> logRepository, INormalEfCoreRepository<VmiLog, Guid> logRepository,
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
@ -62,6 +64,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
ICurrentUser currentUser) ICurrentUser currentUser)
{ {
this._cfg = cfg; this._cfg = cfg;
this._guidGenerator = guidGenerator;
this._serviceProvider = serviceProvider; this._serviceProvider = serviceProvider;
this._balanceRepository = balanceRepository; this._balanceRepository = balanceRepository;
this._logRepository = logRepository; this._logRepository = logRepository;
@ -71,40 +74,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
LinqToDBForEFTools.Initialize(); 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> /// <summary>
/// Excel 转 JSON /// Excel 转 JSON
/// </summary> /// </summary>
@ -203,7 +172,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
/// 快照列表 /// 快照列表
/// </summary> /// </summary>
[HttpPost] [HttpPost]
public async Task<List<VmiSnapshot>> Snapshot() public ListResultDto<VmiSnapshot> Snapshot()
{ {
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); using var connection = new SqlConnection(connectionString);
@ -211,7 +180,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options); using var db = new SettleAccountDbContext(options);
var list = db.Set<VmiSnapshot>().AsNoTracking().OrderByDescending(o => o.Start).ToList(); var list = db.Set<VmiSnapshot>().AsNoTracking().OrderByDescending(o => o.Start).ToList();
return list; return new ListResultDto<VmiSnapshot>(list);
} }
/// <summary> /// <summary>
@ -310,6 +279,10 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
{ {
query = query.Where(input.Filters.ToLambda<VmiLog>()); 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(); var totalCount = query.Count();
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting); query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false); 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> /// <param name="log"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public IActionResult EditBalance(VmiLog log) public IActionResult Adjust([FromBody] VmiLog log)
{ {
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); using var connection = new SqlConnection(connectionString);
@ -358,8 +331,9 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
try try
{ {
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options); using var context = new SettleAccountDbContext(options);
log.SetId(GuidGenerator.Create()); context.Database.UseTransaction(transaction);
log.SetId(this._guidGenerator.Create());
if (log.ChangedQty >= decimal.Zero) if (log.ChangedQty >= decimal.Zero)
{ {
log.Qty = log.ChangedQty; log.Qty = log.ChangedQty;
@ -374,8 +348,9 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
} }
log.ChangedBy = this._currentUser.UserName; log.ChangedBy = this._currentUser.UserName;
log.ChangedTime = DateTime.Now; log.ChangedTime = DateTime.Now;
db.Set<VmiLog>().Add(log); context.Set<VmiLog>().Add(log);
db.Set<VmiMessage>().Add(new VmiMessage(GuidGenerator.Create()) { Message = JsonSerializer.Serialize(log) }); context.Set<VmiMessage>().Add(new VmiMessage(this._guidGenerator.Create()) { Message = JsonSerializer.Serialize(log) });
context.SaveChanges();
transaction.Commit(); transaction.Commit();
return new OkResult(); return new OkResult();
} }
@ -399,7 +374,7 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
var list = this.ImportInternal<VmiLog>(ms.ToArray()); var list = this.ImportInternal<VmiLog>(ms.ToArray());
foreach (var file in list) foreach (var file in list)
{ {
EditBalance(file); Adjust(file);
} }
} }
@ -507,52 +482,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
{ {
throw new NotImplementedException(); 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 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.Linq.Dynamic.Core;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension; using Magicodes.ExporterAndImporter.Core.Extension;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Omu.ValueInjecter; using Omu.ValueInjecter;
using SettleAccount.Job.SignalR;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
@ -30,37 +34,41 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); using var connection = new SqlConnection(connectionString);
connection.Open(); connection.Open();
using var transaction = connection.BeginTransaction(); using var transaction = connection.BeginTransaction();
try try
{ {
var command = connection.CreateCommand();
command.Transaction = transaction;
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options); using var context = new SettleAccountDbContext(options);
var messages = db.Set<VmiMessage>().Where(o => !o.isConsumed).OrderBy(o => o.Number).ToList(); context.Database.UseTransaction(transaction);
var repo = db.Set<VmiBalance>(); 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) foreach (var message in messages)
{ {
var log = JsonSerializer.Deserialize<VmiLog>(message.Message); 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 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')"; command.CommandText = $"select OBJECT_ID('{table}', 'U')";
var result = command.ExecuteScalar().ToString(); var result = command.ExecuteScalar().ToString();
if (result == string.Empty) if (result == string.Empty)
{ {
command.CommandText = $"select * into {table} from Set_VmiLog where 1=0;"; command.CommandText = $"select * into {table} from Set_VmiLog where 1=0;";
command.CommandText += $"create clustered index IX_{table}_ChangedTime on {table} (ChangedTime);"; command.ExecuteNonQuery();
db.Database.ExecuteSqlRaw($"alter table {table} add constraint PK_{table} primary key (Id);"); 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.ExecuteNonQuery();
} }
//插入到分表 //插入到分表
command.CommandText = $"insert into {table} select * from Set_VmiLog where id ='{log.Id}'"; command.CommandText = $"insert into {table} select * from Set_VmiLog where id ='{log.Id}'";
command.ExecuteNonQuery();
//插入库存 //插入库存
var balance = db.Set<VmiBalance>().FirstOrDefault( var balance = context.Set<VmiBalance>().FirstOrDefault(
o => o.DeliverBillType == log.DeliverBillType && o => o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType && o.CodeType == log.CodeType &&
o.DeliverBillType == log.DeliverBillType && o.DeliverBillType == log.DeliverBillType &&
@ -110,11 +118,12 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
//添加负库存补货记录 //添加负库存补货记录
var log2 = new VmiReplenished(); var log2 = new VmiReplenished();
log2.InjectFrom(log); log2.InjectFrom(log);
await db.Set<VmiReplenished>().AddAsync(log2).ConfigureAwait(false); await context.Set<VmiReplenished>().AddAsync(log2).ConfigureAwait(false);
} }
} }
message.isConsumed = true; message.isConsumed = true;
} }
context.SaveChanges();
transaction.Commit(); transaction.Commit();
} }
catch (Exception ex) 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> /// </summary>
[Display(Name = "是否有发运数据")] [Display(Name = "是否有发运数据")]
public bool IsHaveSeData { get; set; } public bool IsHaveSeData { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name ="生产线")] [Display(Name ="生产线")]
[MaxLength(50)]
public string LineStationCode { set; get; } public string LineStationCode { set; get; }
public BBAC_SE_EDI() 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 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 string ConcurrencyStamp { get; set; }
public DateTime CreatedTime { 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; } public string ChangedNumber { get; set; }
[Display(Name = "变动时间", Order = 2)] [Display(Name = "变动时间", Order = 2)]
public DateTime ChangedTime { get; set; }=DateTime.Now; public DateTime ChangedTime { get; set; } = DateTime.Now;
[Display(Name = "变动类型", Order = 3)] [Display(Name = "变动类型", Order = 3)]
public VmiType ChangedType { get; set; } public VmiType ChangedType { get; set; }
@ -43,5 +43,5 @@ public class VmiLog : VmiBalanceBase
public string ConcurrencyStamp { get; set; } public string ConcurrencyStamp { get; set; }
public DateTime CreatedTime { 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> /// <summary>
/// JisBBAC Edi、发运对比导出 /// JisBBAC Edi、发运对比导出
/// </summary> /// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)] [ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class JisBBACEidSeCompareExport public class JisBBACEidSeCompareExport
{ {
/// <summary> /// <summary>
@ -31,22 +31,22 @@ public class JisBBACEidSeCompareExport
[ExporterHeader(DisplayName = "交货单号")] [ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; } public string WmsBillNum { get; set; }
/// <summary> /// <summary>
/// CarModeCode /// 车型
/// </summary> /// </summary>
[Display(Name = "CarModeCode")] [Display(Name = "车型")]
[ExporterHeader(DisplayName = "CarModeCode")] [ExporterHeader(DisplayName = "车型")]
public string CarModeCode { get; set; } public string CarModeCode { get; set; }
/// <summary> /// <summary>
/// LineStationcode /// 生产线
/// </summary> /// </summary>
[Display(Name = "LineStationcode")] [Display(Name = "生产线")]
[ExporterHeader(DisplayName = "LineStationcode")] [ExporterHeader(DisplayName = "生产线")]
public string LineStationcode { get; set; } public string LineStationcode { get; set; }
/// <summary> /// <summary>
/// SequenceNumber /// 生产码序列号日期
/// </summary> /// </summary>
[Display(Name = "SequenceNumber")] [Display(Name = "生产码序列号日期")]
[ExporterHeader(DisplayName = "SequenceNumber")] [ExporterHeader(DisplayName = "生产码序列号日期")]
public string SequenceNumber { get; set; } public string SequenceNumber { get; set; }
/// <summary> /// <summary>
/// ParType /// ParType

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

@ -135,7 +135,7 @@ public class SaSeEdiCompareDiff
/// <summary> /// <summary>
/// 结算、发运、Eid对比明细 /// 结算、发运、Eid对比明细
/// </summary> /// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)] [ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class SaSeEdiCompareDetailExport public class SaSeEdiCompareDetailExport
{ {
} }
@ -192,7 +192,6 @@ public interface ISaSeEdiCompareDetailExport
/// <summary> /// <summary>
/// JisBBAC结算、发运、Eid对比明细 /// JisBBAC结算、发运、Eid对比明细
/// </summary> /// </summary>
public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport
{ {
/// <summary> /// <summary>
@ -477,7 +476,7 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
/// <summary> /// <summary>
/// PUB结算与发运对比汇总 /// PUB结算与发运对比汇总
/// </summary> /// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)] [ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class SaSeEdiCompareSumExport public class SaSeEdiCompareSumExport
{ {
/// <summary> /// <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.ToTable($"{options.TablePrefix}_VmiBalance", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(o => o.CreatedTime).ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.UpdatedTime).ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.ConcurrencyStamp).HasMaxLength(50).IsConcurrencyToken(); b.Property(o => o.ConcurrencyStamp).HasMaxLength(50).IsConcurrencyToken();
b.HasIndex(o => o.BillTime).IsClustered(); b.HasIndex(o => o.BillTime).IsClustered();
b.HasIndex(o => (new b.HasIndex(o => (new
@ -1332,8 +1332,9 @@ namespace Win.Sfs.SettleAccount
{ {
b.ToTable($"{options.TablePrefix}_VmiLog", options.Schema); b.ToTable($"{options.TablePrefix}_VmiLog", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(o => o.CreatedTime).ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.ChangedTime).HasDefaultValueSql("getdate()").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.HasIndex(o => o.BillTime).IsClustered(); 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 namespace Win.Sfs.SettleAccount.Migrations
{ {
[DbContext(typeof(SettleAccountDbContext))] [DbContext(typeof(SettleAccountDbContext))]
[Migration("20230828042700_vmi18")] [Migration("20230828074927_vmi18")]
partial class vmi18 partial class vmi18
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -934,6 +934,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<string>("LineStationCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("PN") b.Property<string>("PN")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -4447,7 +4450,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "25ec0d7c647f42d88882c4187af74201", ConcurrencyStamp = "894bdd1d59cf4a3192d3a5d9a743b7ea",
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4457,7 +4460,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "89413f316dbf4647954b6669de927488", ConcurrencyStamp = "53ae466323824168bcb3cfbb7690bf07",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4467,7 +4470,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "ebb73d81d23c4ed9a6ae59730d163f4b", ConcurrencyStamp = "5f2e16e5b3ec4e8289be386e1ee02a8e",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4477,7 +4480,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "93962cebd40f490b9df08b215b2c7bd2", ConcurrencyStamp = "87a03d84519644d390b8588932fe5df2",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4487,7 +4490,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "e581ee4de97a46b1a1c0ba75a101c064", ConcurrencyStamp = "cd646b7951d1416280aa91e4eba0bdcd",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4497,7 +4500,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "1fb801f3cbff422082d888ee8b5dab64", ConcurrencyStamp = "c4ed2f64b0ae4faebfce741f32e24b50",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4507,7 +4510,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "a7be915b8a5541c58081c668219edfb7", ConcurrencyStamp = "cdfe54ee987a4f0693ef60530817cb5c",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4517,7 +4520,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "7bbeaa02b39947c089eda7f4b05babb9", ConcurrencyStamp = "3818b146b26542e197e47ecef3a3dc5e",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4527,7 +4530,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "df723d768280494e88d49734cc6e55e5", ConcurrencyStamp = "b40af7f8fbcf4597b2cc2179cffecf86",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4537,7 +4540,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "c5b29d7fa18e4b9cb8bc1e354d10c3ac", ConcurrencyStamp = "fb3db63b74744f1482b0e66505d582e0",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4547,7 +4550,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "1c542463eb8746db949bcda48eabdbd8", ConcurrencyStamp = "866a884f080542aeb6c028d1ca3b5323",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4612,7 +4615,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime") b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode") b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -4664,7 +4668,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime") b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode") b.Property<string>("VinCode")
.HasColumnType("nvarchar(450)"); .HasColumnType("nvarchar(450)");
@ -4706,7 +4711,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<DateTime>("ChangedTime") b.Property<DateTime>("ChangedTime")
.HasColumnType("datetime2"); .ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<int>("ChangedType") b.Property<int>("ChangedType")
.HasColumnType("int"); .HasColumnType("int");
@ -4722,7 +4729,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime") b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode") b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -4777,7 +4785,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime") b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode") b.Property<string>("VinCode")
.HasColumnType("nvarchar(max)"); .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 namespace Win.Sfs.SettleAccount.Migrations
{ {
public partial class vmi18 : Migration public partial class _202308281 : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.AlterColumn<string>(
name: "Set_VmiSyncTask"); name: "LineStationCode",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
columns: new[] { "ConcurrencyStamp", "Name" }, column: "ConcurrencyStamp",
values: new object[] { "89413f316dbf4647954b6669de927488", "同步结算库存" }); value: "7171dfa8ed7a468697f49f779675204b");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
columns: new[] { "ConcurrencyStamp", "Name" }, column: "ConcurrencyStamp",
values: new object[] { "ebb73d81d23c4ed9a6ae59730d163f4b", "事务消息监控" }); value: "550dcdec5fb44b65a235deaef4be5be5");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "e581ee4de97a46b1a1c0ba75a101c064"); value: "c2ec841c8d8848afa92f5a8b503c28c0");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "a7be915b8a5541c58081c668219edfb7"); value: "8c21427a3b514dca9dc26f393a3109cf");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "1fb801f3cbff422082d888ee8b5dab64"); value: "1211352da8754a31a50d0a30ec3c8481");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "df723d768280494e88d49734cc6e55e5"); value: "37d450957fb54e37be9a792d3a98f558");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "93962cebd40f490b9df08b215b2c7bd2"); value: "e4e1563e8ab544c59f8055555cc05a8c");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "1c542463eb8746db949bcda48eabdbd8"); value: "39199c157f4d4e319ed0cbfd863fc937");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "c5b29d7fa18e4b9cb8bc1e354d10c3ac"); value: "610e0efedca34af8bf1ddd9f869ff9fd");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
columns: new[] { "ConcurrencyStamp", "Name" }, column: "ConcurrencyStamp",
values: new object[] { "25ec0d7c647f42d88882c4187af74201", "库存快照备份" }); value: "9c5c15ca0ef84bd69f3e35687321e68e");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "7bbeaa02b39947c089eda7f4b05babb9"); value: "cc5d77c9310846688906b64a5800d17c");
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.AlterColumn<string>(
name: "Set_VmiSyncTask", name: "LineStationCode",
columns: table => new table: "Set_BBAC_SE_EDI",
{ type: "nvarchar(max)",
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), nullable: true,
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), oldClrType: typeof(string),
LastUpdate = table.Column<DateTime>(type: "datetime2", nullable: false), oldType: "nvarchar(50)",
Name = table.Column<string>(type: "nvarchar(max)", nullable: true), oldMaxLength: 50,
Number = table.Column<string>(type: "nvarchar(max)", nullable: true) oldNullable: true);
},
constraints: table =>
{
table.PrimaryKey("PK_Set_VmiSyncTask", x => x.Id);
});
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
columns: new[] { "ConcurrencyStamp", "Name" }, column: "ConcurrencyStamp",
values: new object[] { "b282d04b720a4453bac838a6d2702c5e", "同步库存" }); value: "53ae466323824168bcb3cfbb7690bf07");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
columns: new[] { "ConcurrencyStamp", "Name" }, column: "ConcurrencyStamp",
values: new object[] { "af7e13c541954124a384db3d957e96f8", "消息监控" }); value: "5f2e16e5b3ec4e8289be386e1ee02a8e");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "1c63ae9d135a409da20ef2956f075921"); value: "cd646b7951d1416280aa91e4eba0bdcd");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "7d2a76e6327d46f4a93d15d91794de13"); value: "cdfe54ee987a4f0693ef60530817cb5c");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "448472749b8e4be587a6c8a9079bb4c1"); value: "c4ed2f64b0ae4faebfce741f32e24b50");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "ffca086d0a884f118ec61e00c1ea11cf"); value: "b40af7f8fbcf4597b2cc2179cffecf86");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "9758552b36a24d20bc4fd3efaa2c828a"); value: "87a03d84519644d390b8588932fe5df2");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "7ac5c23ffc254496b3bfeac777aceb78"); value: "866a884f080542aeb6c028d1ca3b5323");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp", column: "ConcurrencyStamp",
value: "a9ef4db8c8c547ff880badc98ecb3fb7"); value: "fb3db63b74744f1482b0e66505d582e0");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
columns: new[] { "ConcurrencyStamp", "Name" }, column: "ConcurrencyStamp",
values: new object[] { "38598fb3653c48be8f63119787de2df8", "库存快照" }); value: "894bdd1d59cf4a3192d3a5d9a743b7ea");
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",
keyColumn: "Id", keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp", 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"); .HasColumnName("LastModifierId");
b.Property<string>("LineStationCode") b.Property<string>("LineStationCode")
.HasColumnType("nvarchar(max)"); .HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PN") b.Property<string>("PN")
.HasMaxLength(50) .HasMaxLength(50)
@ -4448,7 +4449,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "6e7a483ccf0e41e888beffb1e492f57e", ConcurrencyStamp = "9c5c15ca0ef84bd69f3e35687321e68e",
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4458,7 +4459,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "b6452a12f9814a2ba8097b0a34934cf1", ConcurrencyStamp = "7171dfa8ed7a468697f49f779675204b",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4468,7 +4469,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "e84ff12fed794e3d8eb0d8b6945873ce", ConcurrencyStamp = "550dcdec5fb44b65a235deaef4be5be5",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4478,7 +4479,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "673b92ac1f384632b35953a8601e92f2", ConcurrencyStamp = "e4e1563e8ab544c59f8055555cc05a8c",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4488,7 +4489,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "f4063fd5bc9a4321941edf1663633d73", ConcurrencyStamp = "c2ec841c8d8848afa92f5a8b503c28c0",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4498,7 +4499,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "f21a6c7a50a5405aaced44507dbdd01b", ConcurrencyStamp = "1211352da8754a31a50d0a30ec3c8481",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4508,7 +4509,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "565a6be9ca2a450aae2dc98b972a32bc", ConcurrencyStamp = "8c21427a3b514dca9dc26f393a3109cf",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4518,7 +4519,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "b493f376395d40c7ad727a14ec909ee0", ConcurrencyStamp = "cc5d77c9310846688906b64a5800d17c",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4528,7 +4529,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "df201f57bc0448d3909942c81a553597", ConcurrencyStamp = "37d450957fb54e37be9a792d3a98f558",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4538,7 +4539,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "6a1b56ecc53e4c56b036daab195d3a86", ConcurrencyStamp = "610e0efedca34af8bf1ddd9f869ff9fd",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4548,7 +4549,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "0f62e911f48d4c97a534eab3a6b2ddbd", ConcurrencyStamp = "39199c157f4d4e319ed0cbfd863fc937",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4613,7 +4614,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime") b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode") b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -4665,7 +4667,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime") b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode") b.Property<string>("VinCode")
.HasColumnType("nvarchar(450)"); .HasColumnType("nvarchar(450)");
@ -4707,7 +4710,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<DateTime>("ChangedTime") b.Property<DateTime>("ChangedTime")
.HasColumnType("datetime2"); .ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<int>("ChangedType") b.Property<int>("ChangedType")
.HasColumnType("int"); .HasColumnType("int");
@ -4723,7 +4728,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("CreatedTime") b.Property<DateTime>("CreatedTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("CustPartCode") b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -4778,7 +4784,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("UpdatedTime") b.Property<DateTime>("UpdatedTime")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime2"); .HasColumnType("datetime2")
.HasDefaultValueSql("getdate()");
b.Property<string>("VinCode") b.Property<string>("VinCode")
.HasColumnType("nvarchar(max)"); .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() .Select(t => new JisBBACEidSeCompareExport()
{ {
Category = "JIS", Category = "JIS",
CarModeCode = default, CarModeCode = t.Max(t => t.Extend4),
LineStationcode = default, LineStationcode = t.Max(t => t.LineStationCode),
SequenceNumber = t.Max(t => t.SeqNumber), SequenceNumber = t.Max(t => t.Extend3),
ParType = "01", ParType = t.Max(t => t.Extend2),
PN = t.Key.PN, PN = t.Key.PN,
MaterialNumber = t.Key.LU, MaterialNumber = t.Key.LU,
EdiQty = t.Sum(t => t.Qty), EdiQty = t.Sum(t => t.Qty),
@ -111,7 +111,10 @@ namespace SettleAccount.Job.Services.Report
groupItem.Key.PN, groupItem.Key.PN,
groupItem.Key.LU, groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty), 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>() var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime where se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
@ -138,10 +141,10 @@ namespace SettleAccount.Job.Services.Report
{ {
Category = "JIS", Category = "JIS",
WmsBillNum = se.BillNum, WmsBillNum = se.BillNum,
CarModeCode = default, CarModeCode = edi.Extend4,
LineStationcode = default, LineStationcode = edi.LineStationCode,
SequenceNumber = edi.SeqNumber, SequenceNumber = edi.Extend3,
ParType = "01", ParType = edi.Extend2,
MESConfigCode = se.MESConfigCode, MESConfigCode = se.MESConfigCode,
ShippingDate = se.BillTime, ShippingDate = se.BillTime,
PN = se.PN, 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.Collections.Generic;
using System.Linq; using System.Linq;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases; using SettleAccount.Bases;
@ -116,10 +117,26 @@ namespace SettleAccount.Job.Services.Report
/// <summary> /// <summary>
/// 创建导出文件结构 /// 创建导出文件结构
/// </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, FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc, PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
@ -129,7 +146,7 @@ namespace SettleAccount.Job.Services.Report
}).ToList(); }).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() 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) EdiQty = p.Sum(t => t.EdiQty)
}).ToList(); }).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() 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) EdiQty = p.Sum(t => t.EdiQty)
}).ToList(); }).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() var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{ {
@ -163,20 +180,59 @@ namespace SettleAccount.Job.Services.Report
}).ToList(); }).ToList();
ExcelExporter excelExporter = new ExcelExporter(); ExcelExporter excelExporter = new ExcelExporter();
return excelExporter //结算核对明细输出
.Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出") excelExporter.Append(saSeEdiCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出");
.SeparateBySheet() for (var i = 1; i < saSeEdiCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeEdiCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
.Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出") {
.SeparateBySheet() 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() excelExporter.Append(haveSaHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货明细输出");
.Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出") for (var i = 1; i < haveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
.SeparateBySheet() {
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}有结算无发货明细输出") return excelExporter;
.SeparateBySheet()
.Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出");
} }
/// <summary> /// <summary>

Loading…
Cancel
Save