Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
a057f219db
  1. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs
  2. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  3. 34
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  4. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  5. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/start.cmd
  6. 16
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js
  7. 13
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js
  8. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs
  9. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs
  10. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  11. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  12. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs
  13. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs
  14. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Consts/AppConst.cs
  15. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs
  16. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOEidSeCompareReport.cs
  17. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs
  18. 5817
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230829061958_20230829-1.Designer.cs
  19. 179
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230829061958_20230829-1.cs
  20. 26
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  21. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs
  22. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs
  23. 90
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs
  24. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;
using Win.Sfs.SettleAccount.influxdb; using Serilog.Settings.Configuration;
namespace Win.Sfs.SettleAccount; namespace Win.Sfs.SettleAccount;
@ -27,7 +27,7 @@ public class Program
//} //}
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration) .ReadFrom.Configuration(configuration, ConfigurationAssemblySource.AlwaysScanDllFiles)
.WriteTo.Async(c => c.Console()) .WriteTo.Async(c => c.Console())
.CreateLogger(); .CreateLogger();
@ -58,7 +58,7 @@ public class Program
options.Limits.MaxRequestBodySize = long.MaxValue; options.Limits.MaxRequestBodySize = long.MaxValue;
options.Limits.MaxRequestBufferSize = long.MaxValue; options.Limits.MaxRequestBufferSize = long.MaxValue;
options.Limits.MaxRequestLineSize = int.MaxValue; options.Limits.MaxRequestLineSize = int.MaxValue;
options.Limits.KeepAliveTimeout= TimeSpan.MaxValue; options.Limits.KeepAliveTimeout = TimeSpan.MaxValue;
}); });
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>();
}) })

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj

@ -5,7 +5,6 @@
<PropertyGroup> <PropertyGroup>
<RootNamespace>Win.Sfs.SettleAccount</RootNamespace> <RootNamespace>Win.Sfs.SettleAccount</RootNamespace>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>SettleAccount-c2d31439-b723-48e2-b061-5ebd7aeb6010</UserSecretsId> <UserSecretsId>SettleAccount-c2d31439-b723-48e2-b061-5ebd7aeb6010</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\..\..</DockerfileContext> <DockerfileContext>..\..\..\..</DockerfileContext>

34
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs

@ -26,6 +26,7 @@ using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs.Hangfire; using Volo.Abp.BackgroundJobs.Hangfire;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem; using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.BlobStoring.Minio;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.EntityFrameworkCore.SqlServer;
@ -162,20 +163,35 @@ namespace Win.Sfs.SettleAccount
/// 上传文件的容器 /// 上传文件的容器
/// </summary> /// </summary>
/// <param name="context"></param> /// <param name="context"></param>
private void ConfigureBLOBServices(IConfiguration configPath) private void ConfigureBLOBServices(IConfiguration cfg)
{ {
//Configure<AbpBlobStoringOptions>(options =>
//{
// options.Containers.Configure<MyFileContainer>(configuration =>
// {
// configuration.UseFileSystem(fileSystem =>
// {
// var filestreampath = Environment.CurrentDirectory + @"\wwwroot\files";
// if (!Directory.Exists(filestreampath))
// {
// Directory.CreateDirectory(filestreampath);
// }
// fileSystem.BasePath = filestreampath;
// });
// });
//});
Configure<AbpBlobStoringOptions>(options => Configure<AbpBlobStoringOptions>(options =>
{ {
options.Containers.Configure<MyFileContainer>(configuration => options.Containers.ConfigureDefault(container =>
{
configuration.UseFileSystem(fileSystem =>
{ {
var filestreampath = Environment.CurrentDirectory + @"\wwwroot\files"; container.UseMinio(minio =>
if (!Directory.Exists(filestreampath))
{ {
Directory.CreateDirectory(filestreampath); minio.EndPoint = cfg.GetValue("MinIO:EndPoint", "localhost:10684");
} minio.AccessKey = cfg.GetValue("MinIO:AccessKey", "g0GKnhRGEQHI0uiGBYre");
fileSystem.BasePath = filestreampath; minio.SecretKey = cfg.GetValue("MinIO:SecretKey", "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv");
minio.BucketName = cfg.GetValue("MinIO:BucketName", "default");
minio.WithSSL = false;
}); });
}); });
}); });

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -8,6 +8,12 @@
"WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;", "WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;",
"questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;" "questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;"
}, },
"MinIO": {
"EndPoint": "dev.ccwin-in.com:16084",
"AccessKey": "g0GKnhRGEQHI0uiGBYre",
"SecretKey": "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv",
"BucketName": "default"
},
"Serilog": { "Serilog": {
"Using": [], "Using": [],
"MinumumLevel": { "MinumumLevel": {

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/start.cmd

@ -6,6 +6,9 @@ if %errorlevel% == 0 (
  exit   exit
) )
cd /d %~dp0
%1 start mshta vbscript:createobject("wscript.shell").run("""%~0"" ::",0)(window.close)&&exit %1 start mshta vbscript:createobject("wscript.shell").run("""%~0"" ::",0)(window.close)&&exit
start /b SettleAccount.HttpApi.Host.exe --urls http://*:16082 start /b SettleAccount.HttpApi.Host.exe --urls http://*:16082

16
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js

@ -50,10 +50,10 @@ export default [
createButton("export", "title=导出&isTop=true&pattern=paged"), createButton("export", "title=导出&isTop=true&pattern=paged"),
], ],
}, },
{ // {
...createPage("bom", "title=BOM结构"), // ...createPage("bom", "title=BOM结构"),
children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], // children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
}, // },
{ {
...createPage("bei-jian", "title=备件价格单"), ...createPage("bei-jian", "title=备件价格单"),
children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
@ -66,10 +66,10 @@ export default [
...createPage("xiao-shou", "title=销售价格单"), ...createPage("xiao-shou", "title=销售价格单"),
children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
}, },
{ // {
...createPage("ke-hu", "title=客户库位关系表"), // ...createPage("ke-hu", "title=客户库位关系表"),
children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], // children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
}, // },
{ {
...createPage("job-item", "title=定时任务"), ...createPage("job-item", "title=定时任务"),
children: [ children: [

13
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js

@ -246,6 +246,15 @@ export default {
type: "object", type: "object",
title: "结算分组零件", title: "结算分组零件",
properties: { properties: {
realInvBillNum: {
type: "string",
title: "金税发票号",
},
invDate: {
type: "string",
title: "发票日期",
input: "datetime",
},
invGroupNum: { invGroupNum: {
type: "string", type: "string",
title: "发票分组号", title: "发票分组号",
@ -262,6 +271,10 @@ export default {
type: "string", type: "string",
title: "状态", title: "状态",
}, },
qty: {
type: "string",
title: "数量",
},
}, },
}; };
const columns4 = { const columns4 = {

7
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs

@ -162,7 +162,6 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "External Call Number")] [ImporterHeader(Name = "External Call Number")]
public string PN { get; set; } public string PN { get; set; }
/// <summary> /// <summary>
/// Movement Type /// Movement Type
/// MovementType = 967,代表退货需要标记为负数 /// MovementType = 967,代表退货需要标记为负数
@ -171,6 +170,12 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[Display(Name = "Movement Type")] [Display(Name = "Movement Type")]
[ImporterHeader(Name = "Movement Type")] [ImporterHeader(Name = "Movement Type")]
public string MovementType { get; set; } public string MovementType { get; set; }
/// <summary>
/// Contract Doc ID
/// </summary>
[Display(Name = "Contract Doc ID")]
[ImporterHeader(Name = "Contract Doc ID")]
public string ContractDocID { get; set; }
} }
/// <summary> /// <summary>

50
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

@ -1,14 +1,18 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Linq.Dynamic.Core;
using System.Net; using System.Net;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Cronos; using Cronos;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using SettleAccount.Job.SignalR; using SettleAccount.Job.SignalR;
@ -163,7 +167,7 @@ public class JobHostdService : BackgroundService, IApplicationService
} }
} }
} }
catch(CronFormatException ex) catch (CronFormatException ex)
{ {
Console.WriteLine($"{job.Name},Cron解析失败:{ex.Message},{ex.ToString()}"); Console.WriteLine($"{job.Name},Cron解析失败:{ex.Message},{ex.ToString()}");
} }
@ -191,8 +195,10 @@ public class JobHostdService : BackgroundService, IApplicationService
private void JobItemFaild(Guid id, Guid jobLogId, Exception ex) private void JobItemFaild(Guid id, Guid jobLogId, Exception ex)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id); var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id);
if (entity != null) if (entity != null)
{ {
@ -207,8 +213,10 @@ public class JobHostdService : BackgroundService, IApplicationService
private void JobItemSuccess(Guid id, Guid jobLogId) private void JobItemSuccess(Guid id, Guid jobLogId)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id); var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id);
if (entity != null) if (entity != null)
{ {
@ -225,8 +233,10 @@ public class JobHostdService : BackgroundService, IApplicationService
private void JobItemStop(Guid id) private void JobItemStop(Guid id)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id); var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id);
if (entity != null) if (entity != null)
{ {
@ -240,8 +250,10 @@ public class JobHostdService : BackgroundService, IApplicationService
private Guid? JobItemStart(Guid id) private Guid? JobItemStart(Guid id)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id); var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id);
if (entity != null) if (entity != null)
{ {
@ -256,14 +268,20 @@ public class JobHostdService : BackgroundService, IApplicationService
private JobItem GetJobItem(Guid id) private JobItem GetJobItem(Guid id)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
return scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>().Set<JobItem>().FirstOrDefault(o => o.Id == id); using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var repo = db.Set<JobItem>();
return repo.FirstOrDefault(o => o.Id == id);
} }
private void JobItemHeartBeat(Guid id) private void JobItemHeartBeat(Guid id)
{ {
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id); var entity = db.Set<JobItem>().FirstOrDefault(o => o.Id == id);
if (entity != null) if (entity != null)
{ {
@ -299,8 +317,10 @@ public class JobHostdService : BackgroundService, IApplicationService
protected override Task ExecuteAsync(CancellationToken stoppingToken) protected override Task ExecuteAsync(CancellationToken stoppingToken)
{ {
this._stoppingToken = stoppingToken; this._stoppingToken = stoppingToken;
using var scope = this._serviceProvider.CreateScope(); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var jobs = db.Set<JobItem>().ToList(); var jobs = db.Set<JobItem>().ToList();
jobs.ForEach(this.AddJob); jobs.ForEach(this.AddJob);
return Task.CompletedTask; return Task.CompletedTask;

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

@ -37,8 +37,7 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
await HandDelEdiDataAsync().ConfigureAwait(false); await HandDelEdiDataAsync().ConfigureAwait(false);
lock (_lockObj)
{
var seDetailGroup = db.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace }).Select(t => new { t.Key.PN, LU = t.Key.CustomerPartCodeNoSpace }); var seDetailGroup = db.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace }).Select(t => new { t.Key.PN, LU = t.Key.CustomerPartCodeNoSpace });
var ediDetailGroup = db.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); var ediDetailGroup = db.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
@ -57,17 +56,20 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
var seDetails = seDetailsQuery.Take(5000).ToList(); var seDetails = seDetailsQuery.Take(5000).ToList();
var ediDetails = ediDetailsQuery.Take(5000).ToList(); var ediDetails = ediDetailsQuery.Take(5000).ToList();
seDetails.ForEach(t => t.IsHaveEdiData = true);
ediDetails.ForEach(t => t.IsHaveSeData = true);
if (seDetails.Any()) using var transaction = await db.Database.BeginTransactionAsync().ConfigureAwait(false);
try
{ {
seDetails.ForEach(t => t.IsHaveEdiData = true); await db.BulkUpdateAsync<BBAC_SE_DETAIL>(seDetails).ConfigureAwait(false);
db.BulkUpdate<BBAC_SE_DETAIL>(seDetails); await db.BulkUpdateAsync<BBAC_SE_EDI>(ediDetails).ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
} }
if (ediDetails.Any()) catch (Exception)
{ {
ediDetails.ForEach(t => t.IsHaveSeData = true); await transaction.RollbackAsync().ConfigureAwait(false);
db.BulkUpdate<BBAC_SE_EDI>(ediDetails); throw;
}
} }
} }
catch (Exception) catch (Exception)

19
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -9,10 +9,8 @@ using LinqToDB;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -126,12 +124,10 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
t.Version = int.Parse(t.BillTime?.ToString("yyyyMM")); t.Version = int.Parse(t.BillTime?.ToString("yyyyMM"));
} }
}); });
await _settleAccountDbContext.BulkInsertAsync(pubSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString(); syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false);
} }
else else
{ {
@ -140,7 +136,19 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
TableName = syncTableName, TableName = syncTableName,
Position = wmsSeRecords.Last().UID.ToString() Position = wmsSeRecords.Last().UID.ToString()
}; };
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); }
using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false);
try
{
_settleAccountDbContext.Set<SyncPositionFlag>().AddOrUpdate(t => t.TableName == syncPositionFlag.TableName, syncPositionFlag);
await _settleAccountDbContext.BulkInsertAsync(pubSeDetails).ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
}
catch (Exception)
{
await transaction.RollbackAsync().ConfigureAwait(false);
throw;
} }
foreach (var pubSeDetail in pubSeDetails) foreach (var pubSeDetail in pubSeDetails)
@ -218,7 +226,6 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
if (noHaveLuRePartCodes.Any()) if (noHaveLuRePartCodes.Any())
{ {
await _settleAccountDbContext.BulkInsertAsync(noHaveLuRePartCodes.ToList()).ConfigureAwait(false); await _settleAccountDbContext.BulkInsertAsync(noHaveLuRePartCodes.ToList()).ConfigureAwait(false);
//await _materialRelationshipRepository.InsertManyAsync(noHaveLuRePartCodes).ConfigureAwait(false);
} }
} }
} }

3
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs

@ -7,7 +7,6 @@ using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -45,6 +44,6 @@ public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
await this.Invoke(); await this.Invoke().ConfigureAwait(false);
} }
} }

14
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs

@ -33,20 +33,6 @@ namespace Win.Sfs.SettleAccount
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
var cfg = context.Services.GetConfiguration();
//Configure<AbpBlobStoringOptions>(options =>
//{
// options.Containers.ConfigureDefault(container =>
// {
// container.UseMinio(minio =>
// {
// minio.EndPoint = cfg.GetValue("MinIO:EndPoint", "");
// minio.AccessKey = cfg.GetValue("MinIO:AccessKey", "");
// minio.SecretKey = cfg.GetValue("MinIO:SecretKey", "");
// minio.BucketName = cfg.GetValue("MinIO:BucketName", "");
// });
// });
//});
//context.Services.AddAutoMapperObjectMapper<SettleAccountApplicationModule>(); //context.Services.AddAutoMapperObjectMapper<SettleAccountApplicationModule>();
//Configure<AbpAutoMapperOptions>(options => //Configure<AbpAutoMapperOptions>(options =>
//{ //{

12
code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Consts/AppConst.cs

@ -0,0 +1,12 @@
namespace Win.Sfs.SettleAccount.Consts;
/// <summary>
/// 应用常量
/// </summary>
public static class AppConst
{
/// <summary>
/// 单页Sheet默认行数
/// </summary>
public const int DefaultRowNumberOnASheet = 500_000;
}

16
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs

@ -115,21 +115,11 @@ public class BBAC_SA_DETAIL:SA_BASE
/// </summary> /// </summary>
[Display(Name = "是否退货")] [Display(Name = "是否退货")]
public string IsReturn { get; set; } = null!; public string IsReturn { get; set; } = null!;
/// <summary> /// <summary>
/// 对应字段PostingDate /// ContractDocID
/// </summary> /// </summary>
//[Display(Name = "结算日期(收货日期)")] [MaxLength(100)]
//public DateTime SettleDate { get; set; } public string ContractDocID { get; set; }
///// <summary>
///// 对应字段Reference
///// </summary>
//[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!;
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!;
public BBAC_SA_DETAIL(Guid p_guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string category, string isReturn, DateTime settleDate, string groupNum, string invGroupNum):base(p_guid) public BBAC_SA_DETAIL(Guid p_guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string category, string isReturn, DateTime settleDate, string groupNum, string invGroupNum):base(p_guid)
{ {

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOEidSeCompareReport.cs

@ -15,7 +15,7 @@ public class JisHBPOEidSeCompareReport
/// <summary> /// <summary>
/// JisHBPO Edi与发运对比导出 /// JisHBPO Edi与发运对比导出
/// </summary> /// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)] [ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class JisHBPOEidSeCompareExport public class JisHBPOEidSeCompareExport
{ {
/// <summary> /// <summary>

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

@ -299,6 +299,11 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
/// <summary> /// <summary>
/// 结算与EDI量差 /// 结算与EDI量差
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "结算与WMS发货量差")]
public decimal SaSeQty => SAQty - SEQty;
/// <summary>
/// 结算与EDI量差
/// </summary>
[ExporterHeader(DisplayName = "结算与EDI量差")] [ExporterHeader(DisplayName = "结算与EDI量差")]
public decimal SaEdiQty => SAQty - EdiQty; public decimal SaEdiQty => SAQty - EdiQty;
/// <summary> /// <summary>
@ -310,7 +315,7 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
[ExporterHeader(DisplayName = "是否完全匹配")] [ExporterHeader(DisplayName = "是否完全匹配")]
[ValueMapping("是", true)] [ValueMapping("是", true)]
[ValueMapping("否", false)] [ValueMapping("否", false)]
public bool MateType => SaEdiQty == 0 && SeEdiQty == 0; public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0;
/// <summary> /// <summary>
/// 定价 /// 定价
/// </summary> /// </summary>
@ -441,6 +446,11 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
/// <summary> /// <summary>
/// 结算与EDI量差 /// 结算与EDI量差
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "结算与WMS发货量差")]
public decimal SaSeQty => SAQty - SEQty;
/// <summary>
/// 结算与EDI量差
/// </summary>
[ExporterHeader(DisplayName = "结算与EDI量差")] [ExporterHeader(DisplayName = "结算与EDI量差")]
public decimal SaEdiQty => SAQty - EdiQty; public decimal SaEdiQty => SAQty - EdiQty;
/// <summary> /// <summary>
@ -452,7 +462,7 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
[ExporterHeader(DisplayName = "是否完全匹配")] [ExporterHeader(DisplayName = "是否完全匹配")]
[ValueMapping("是", true)] [ValueMapping("是", true)]
[ValueMapping("否", false)] [ValueMapping("否", false)]
public bool MateType => SaEdiQty == 0 && SeEdiQty == 0; public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0;
/// <summary> /// <summary>
/// 定价 /// 定价
/// </summary> /// </summary>

5817
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230829061958_20230829-1.Designer.cs

File diff suppressed because it is too large

179
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230829061958_20230829-1.cs

@ -0,0 +1,179 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308291 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ContractDocID",
table: "Set_BBAC_SA_DETAIL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "64c6af2dbd034e919161ff37304b57b0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "087376a7732a4f0caec36a83389a856d");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "e6a18e47a9d0467ba66dfb6a70ae8f80");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "6c08bd3ad65b4d29b613fe0a72015cc2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "51f7bc3b725847c3b3bc7f1702e775d7");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "2a423514ae5e4c19a4524fa4b675c28e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "11992367052c4b459c68966b7fab6b13");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "6c75a4d283954fbc895242d9405340e0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "ecb2819e7667499295cea61d7bf4eae3");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "466f09814b2d4da1988a382e45ce2601");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "1d2d6618d5644fafaab03c543f178128");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ContractDocID",
table: "Set_BBAC_SA_DETAIL");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "7171dfa8ed7a468697f49f779675204b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "550dcdec5fb44b65a235deaef4be5be5");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "c2ec841c8d8848afa92f5a8b503c28c0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "8c21427a3b514dca9dc26f393a3109cf");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "1211352da8754a31a50d0a30ec3c8481");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "37d450957fb54e37be9a792d3a98f558");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "e4e1563e8ab544c59f8055555cc05a8c");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "39199c157f4d4e319ed0cbfd863fc937");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "610e0efedca34af8bf1ddd9f869ff9fd");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "9c5c15ca0ef84bd69f3e35687321e68e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "cc5d77c9310846688906b64a5800d17c");
}
}
}

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

@ -559,6 +559,10 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(50)") .HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp"); .HasColumnName("ConcurrencyStamp");
b.Property<string>("ContractDocID")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("CreationTime"); .HasColumnName("CreationTime");
@ -4449,7 +4453,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "0bd67219a5564fb586a9f3be1e6126c9", ConcurrencyStamp = "466f09814b2d4da1988a382e45ce2601",
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4459,7 +4463,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "c3e3165a405d46aab69c31f2f82d756f", ConcurrencyStamp = "64c6af2dbd034e919161ff37304b57b0",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4469,7 +4473,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "ba68c04aac4f4416b989d7b55bdc4b7e", ConcurrencyStamp = "087376a7732a4f0caec36a83389a856d",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4479,7 +4483,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "2da3b07d5f914c86bc0a43f924ed1749", ConcurrencyStamp = "11992367052c4b459c68966b7fab6b13",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4489,7 +4493,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "683c8c8939e14a1395088c6e0bd05bf4", ConcurrencyStamp = "e6a18e47a9d0467ba66dfb6a70ae8f80",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4499,7 +4503,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "eb380e1324a74068abc87a93d0f7f014", ConcurrencyStamp = "51f7bc3b725847c3b3bc7f1702e775d7",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4509,7 +4513,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "609e5d6d97514b848dd51be85dfb9f1f", ConcurrencyStamp = "6c08bd3ad65b4d29b613fe0a72015cc2",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4519,7 +4523,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "7c954b11c9584a2198947011c6bf2cd4", ConcurrencyStamp = "1d2d6618d5644fafaab03c543f178128",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4529,7 +4533,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "068e141b55ea41f3afa25065d6578ccd", ConcurrencyStamp = "2a423514ae5e4c19a4524fa4b675c28e",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4539,7 +4543,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "7c5e7b3a484149e7aafa2b5fa797cf2e", ConcurrencyStamp = "ecb2819e7667499295cea61d7bf4eae3",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4549,7 +4553,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "0a1e55d5a565455898b8be3e9ae310c2", ConcurrencyStamp = "6c75a4d283954fbc895242d9405340e0",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,

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

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
@ -14,6 +15,7 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Reports; using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
@ -65,6 +67,14 @@ namespace SettleAccount.Job.Services.Report
var seEndDateTime = DateTime.Parse(strSeEndDateTime); var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault(); var filename = exportName.FirstOrDefault();
// Sheet行数
var maxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var excelExporterAttribute = typeof(JisBBACEidSeCompareExport).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (excelExporterAttribute != null)
{
maxRowNumberOnASheet = excelExporterAttribute.MaxRowNumberOnASheet > 0 ? excelExporterAttribute.MaxRowNumberOnASheet : maxRowNumberOnASheet;
}
//有EDI无发运 //有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false) var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.LU, t.PN }) .GroupBy(t => new { t.LU, t.PN })
@ -166,11 +176,21 @@ namespace SettleAccount.Job.Services.Report
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList); notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
notHaveEdiHaveSeList.Reverse(); notHaveEdiHaveSeList.Reverse();
ExcelExporter excelExporter = new ExcelExporter(); var excelExporter = new ExcelExporter();
excelExporter // EDI数据和发货对比
.Append(haveEdiNotHaveSeList, $"BBACEDI数据和发货对比") excelExporter.Append(haveEdiNotHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"BBACEDI数据和发货对比");
.SeparateBySheet() for (var i = 1; i < haveEdiNotHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
.Append(notHaveEdiHaveSeList, $"BBAC发货和EDI数据对比"); {
var sheetDataItems = haveEdiNotHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"BBACEDI数据和发货对比-{i}");
}
// 发货和EDI数据对比
excelExporter.Append(notHaveEdiHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"BBAC发货和EDI数据对比");
for (var i = 1; i < notHaveEdiHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = notHaveEdiHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"BBAC发货和EDI数据对比-{i}");
}
var result = excelExporter.ExportAppendDataAsByteArray(); var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();

30
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
@ -12,6 +13,7 @@ using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Reports; using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
@ -62,6 +64,14 @@ namespace SettleAccount.Job.Services.Report
var seEndDateTime = DateTime.Parse(strSeEndDateTime); var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault(); var filename = exportName.FirstOrDefault();
// Sheet行数
var maxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var excelExporterAttribute = typeof(JisHBPOEidSeCompareExport).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (excelExporterAttribute != null)
{
maxRowNumberOnASheet = excelExporterAttribute.MaxRowNumberOnASheet > 0 ? excelExporterAttribute.MaxRowNumberOnASheet : maxRowNumberOnASheet;
}
//有EDI无发运 //有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false) var haveEdiNotHaveSeList = _settleAccountDbContext.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.LU, t.PN }) .GroupBy(t => new { t.LU, t.PN })
@ -165,11 +175,21 @@ namespace SettleAccount.Job.Services.Report
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList); notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
notHaveEdiHaveSeList.Reverse(); notHaveEdiHaveSeList.Reverse();
ExcelExporter excelExporter = new ExcelExporter(); var excelExporter = new ExcelExporter();
excelExporter // EDI数据和发货对比
.Append(haveEdiNotHaveSeList, $"HBPOEDI数据和发货对比") excelExporter.Append(haveEdiNotHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"HBPOEDI数据和发货对比");
.SeparateBySheet() for (var i = 1; i < haveEdiNotHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
.Append(notHaveEdiHaveSeList, $"HBPO发货和EDI数据对比"); {
var sheetDataItems = haveEdiNotHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"HBPOEDI数据和发货对比-{i}");
}
// 发货和EDI数据对比
excelExporter.Append(notHaveEdiHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"HBPO发货和EDI数据对比");
for (var i = 1; i < notHaveEdiHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = notHaveEdiHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"HBPO发货和EDI数据对比-{i}");
}
var result = excelExporter.ExportAppendDataAsByteArray(); var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();

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

@ -1,12 +1,14 @@
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;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR; using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Enums; using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports; using Win.Sfs.SettleAccount.Reports;
@ -174,10 +176,26 @@ namespace SettleAccount.Job.Services.Report
/// <summary> /// <summary>
/// 创建导出文件结构 /// 创建导出文件结构
/// </summary> /// </summary>
public ExcelExporter BindExcelExporter<T>(List<T> pubSaSeCompareDetailExports, string businessTypeDisplayName) where T : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport, new() public ExcelExporter BindExcelExporter<T>(List<T> saSeCompareDetailExports, string businessTypeDisplayName) where T : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport, new()
{ {
//详情Sheet行数
var detailMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var detailExportExporterAttribute = typeof(T).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (detailExportExporterAttribute != null)
{
detailMaxRowNumberOnASheet = detailExportExporterAttribute.MaxRowNumberOnASheet > 0 ? detailExportExporterAttribute.MaxRowNumberOnASheet : detailMaxRowNumberOnASheet;
}
//汇总Sheet行数
var sumMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var sumExportExporterAttribute = typeof(PubSaSeCompareSumExport).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (sumExportExporterAttribute != null)
{
sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet;
}
//结算核对汇总 //结算核对汇总
var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() var saSeCompareSumExports = saSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{ {
FactoryPartCode = p.Key, FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc, PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
@ -186,7 +204,7 @@ namespace SettleAccount.Job.Services.Report
}).ToList(); }).ToList();
//有结算有发运 //有结算有发运
var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe); var haveSaHaveSeExports = saSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
//有结算有发运汇总 //有结算有发运汇总
var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{ {
@ -196,7 +214,7 @@ namespace SettleAccount.Job.Services.Report
SEQty = p.Sum(t => t.SEQty) SEQty = p.Sum(t => t.SEQty)
}).ToList(); }).ToList();
//有结算无发运 //有结算无发运
var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe); var haveSaNotHaveSeExports = saSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
//有结算无发运 //有结算无发运
var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{ {
@ -206,7 +224,7 @@ namespace SettleAccount.Job.Services.Report
SEQty = p.Sum(t => t.SEQty) SEQty = p.Sum(t => t.SEQty)
}).ToList(); }).ToList();
//无结算有发运 //无结算有发运
var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe); var notHaveSaHaveSeExports = saSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
//无结算有发运 //无结算有发运
var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{ {
@ -216,21 +234,53 @@ namespace SettleAccount.Job.Services.Report
SEQty = p.Sum(t => t.SEQty) SEQty = p.Sum(t => t.SEQty)
}).ToList(); }).ToList();
ExcelExporter excelExporter = new ExcelExporter(); var excelExporter = new ExcelExporter();
return excelExporter //结算核对明细输出
.Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出") excelExporter.Append(saSeCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出");
.SeparateBySheet() for (var i = 1; i < saSeCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
.Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出") {
.SeparateBySheet() var sheetDataItems = saSeCompareDetailExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对明细输出-{i}");
.Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出") }
.SeparateBySheet() //结算核对汇总输出
.Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出") excelExporter.Append(saSeCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出");
.SeparateBySheet() for (var i = 1; i < saSeCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
.Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出") var sheetDataItems = saSeCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); ;
.SeparateBySheet() excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}");
.Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出"); }
//有结算有发货明细输出
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.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.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.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.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}");
}
return excelExporter;
} }
/// <summary> /// <summary>

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

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases; using SettleAccount.Bases;
using SettleAccount.Job.SignalR; using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Enums; using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports; using Win.Sfs.SettleAccount.Reports;
@ -120,16 +121,16 @@ namespace SettleAccount.Job.Services.Report
public ExcelExporter BindExcelExporter<T>(List<T> saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new() public ExcelExporter BindExcelExporter<T>(List<T> saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new()
{ {
//详情Sheet行数 //详情Sheet行数
var detailMaxRowNumberOnASheet = 500_000; var detailMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var detailExportExporterAttribute = typeof(T).GetAttribute<ExcelExporterAttribute>(); var detailExportExporterAttribute = typeof(T).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (detailExportExporterAttribute != null) if (detailExportExporterAttribute != null)
{ {
detailMaxRowNumberOnASheet = detailExportExporterAttribute.MaxRowNumberOnASheet > 0 ? detailExportExporterAttribute.MaxRowNumberOnASheet : detailMaxRowNumberOnASheet; detailMaxRowNumberOnASheet = detailExportExporterAttribute.MaxRowNumberOnASheet > 0 ? detailExportExporterAttribute.MaxRowNumberOnASheet : detailMaxRowNumberOnASheet;
} }
//汇总Sheet行数 //汇总Sheet行数
var sumMaxRowNumberOnASheet = 500_000; var sumMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var sumExportExporterAttribute = typeof(SaSeEdiCompareSumExport).GetAttribute<ExcelExporterAttribute>(); var sumExportExporterAttribute = typeof(SaSeEdiCompareSumExport).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (sumExportExporterAttribute != null) if (sumExportExporterAttribute != null)
{ {
sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet; sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet;
@ -179,22 +180,19 @@ namespace SettleAccount.Job.Services.Report
EdiQty = p.Sum(t => t.EdiQty) EdiQty = p.Sum(t => t.EdiQty)
}).ToList(); }).ToList();
ExcelExporter excelExporter = new ExcelExporter(); var excelExporter = new ExcelExporter();
//结算核对明细输出 //结算核对明细输出
excelExporter.Append(saSeEdiCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出"); excelExporter.Append(saSeEdiCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出");
for (var i = 1; i < saSeEdiCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeEdiCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < saSeEdiCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeEdiCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = saSeEdiCompareDetailExports.Skip(i * detailMaxRowNumberOnASheet) var sheetDataItems = saSeEdiCompareDetailExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
.Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对明细输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对明细输出-{i}");
} }
//结算核对汇总输出 //结算核对汇总输出
excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出"); excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出");
for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();;
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}");
} }
@ -203,7 +201,6 @@ namespace SettleAccount.Job.Services.Report
for (var i = 1; i < haveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < haveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = haveSaHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); var sheetDataItems = haveSaHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货明细输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货明细输出-{i}");
} }
//有结算有发货汇总输出 //有结算有发货汇总输出
@ -211,7 +208,6 @@ namespace SettleAccount.Job.Services.Report
for (var i = 1; i < haveSaHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < haveSaHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = haveSaHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); var sheetDataItems = haveSaHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货汇总输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货汇总输出-{i}");
} }
@ -220,7 +216,6 @@ namespace SettleAccount.Job.Services.Report
for (var i = 1; i < haveSaNotHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < haveSaNotHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = haveSaNotHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); var sheetDataItems = haveSaNotHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货明细输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货明细输出-{i}");
} }
//有结算有发货汇总输出 //有结算有发货汇总输出
@ -228,7 +223,6 @@ namespace SettleAccount.Job.Services.Report
for (var i = 1; i < haveSaNotHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaNotHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < haveSaNotHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaNotHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = haveSaNotHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); var sheetDataItems = haveSaNotHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}");
} }

Loading…
Cancel
Save