diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
index 88fd5632..c981c795 100644
--- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
+++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
@@ -12,6 +12,7 @@
..\..\..\..
net5.0
True
+ false
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
index 79dd2355..17b547e7 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
@@ -70,6 +70,25 @@ namespace SettleAccount.Job.Services.Report
_dapper2 = dapper2;
// _errorListRepository = errorListRepository;
}
+ public int CalculatePageCount(int totalItems, int itemsPerPage)
+ {
+ return (int)Math.Ceiling((double)totalItems / itemsPerPage);
+ }
+ public List GetPage(List source, int pageNumber, int pageSize)
+ {
+ if (source == null)
+ throw new ArgumentNullException(nameof(source));
+
+ if (pageNumber < 1)
+ throw new ArgumentOutOfRangeException(nameof(pageNumber));
+
+ if (pageSize < 1)
+ throw new ArgumentOutOfRangeException(nameof(pageSize));
+
+ int skip = (pageNumber - 1) * pageSize;
+
+ return source.Skip(skip).Take(pageSize).ToList();
+ }
public string ExportFile(Guid id, List exportName, List p_list)
{
@@ -237,99 +256,116 @@ equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.CustomerMaterialC
DiffAmt = p.Sum(p => p.DiffAMT)
});
-
-
- if (_ls1.Count() > 900000)
+ ExcelExporter _exporter = new ExcelExporter();//导出Excel
+ _exporter.Append(_ls, "R3大众未结对比系统未结");
+ _exporter.SeparateBySheet();
+ int pagenum = CalculatePageCount(_ls1.Count, 900000);
+ for (var i = 0; i < pagenum; i++)
{
- if (_ls1.Count() > 2700000)
- {
- var _lsSheet1 = _ls1.Skip(0 * 900000).Take(900000);
- var _lsSheet2 = _ls1.Skip(1* 900000).Take(900000);
- var _lsSheet3 = _ls1.Skip(2 * 900000).Take(900000);
- var _lsSheet4 = _ls1.Skip(3 * 900000).Take(900000);
- ExcelExporter _exporter = new ExcelExporter();//导出Excel
- var result = _exporter.Append(_ls, "R3大众未结对比系统未结")
- .SeparateBySheet()
- .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第1页)")
- .SeparateBySheet()
- .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第2页)")
- .SeparateBySheet()
- .Append(_lsSheet3.ToList(), "系统未结对比R3大众未结(第3页)")
- .SeparateBySheet()
- .Append(_lsSheet3.ToList(), "系统未结对比R3大众未结(第4页)")
- .SeparateBySheet()
- .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
+ _exporter.Append(GetPage(_ls1, i + 1, 900000), $"系统未结对比R3大众未结(第{i + 1}页)");
+ _exporter.SeparateBySheet();
+ }
+ _exporter.Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
.SeparateBySheet()
- .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
- .ExportAppendDataAsByteArray();
- result.ShouldNotBeNull();
- _fileContainer.SaveAsync(_first, result.Result, true);
+ .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总");
- }
- else
- {
- if (_ls1.Count() > 18000000)
- {
- var _lsSheet1 = _ls1.Skip(0 * 900000).Take(900000);
- var _lsSheet2 = _ls1.Skip(1 * 900000).Take(900000);
- var _lsSheet3 = _ls1.Skip(2 * 900000).Take(900000);
- ExcelExporter _exporter = new ExcelExporter();//导出Excel
- var result = _exporter.Append(_ls, "R3大众未结对比系统未结")
- .SeparateBySheet()
- .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第1页)")
- .SeparateBySheet()
- .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第2页)")
- .SeparateBySheet()
- .Append(_lsSheet3.ToList(), "系统未结对比R3大众未结(第3页)")
- .SeparateBySheet()
- .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
- .SeparateBySheet()
- .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
- .ExportAppendDataAsByteArray();
- result.ShouldNotBeNull();
- _fileContainer.SaveAsync(_first, result.Result, true);
-
- }
- else
- {
- var _lsSheet1 = _ls1.Skip(0 * 900000).Take(900000);
- var _lsSheet2 = _ls1.Skip(1 * 900000).Take(900000);
- ExcelExporter _exporter = new ExcelExporter();//导出Excel
- var result = _exporter.Append(_ls.ToList(), "R3大众未结对比系统未结")
- .SeparateBySheet()
- .Append(_lsSheet1.ToList(), "系统未结对比R3大众未结(第1页)")
- .SeparateBySheet()
- .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第2页)")
- .SeparateBySheet()
- .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
- .SeparateBySheet()
- .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
- .ExportAppendDataAsByteArray();
- result.ShouldNotBeNull();
- _fileContainer.SaveAsync(_first, result.Result, true);
-
-
- }
- }
- }
- else
- {
+ var result = _exporter.ExportAppendDataAsByteArray();
- ExcelExporter _exporter = new ExcelExporter();//导出Excel
- var result = _exporter.Append(_ls, "R3大众未结对比系统未结")
- .SeparateBySheet()
- .Append(_ls1.ToList(), "系统未结对比R3大众未结")
- .SeparateBySheet()
- .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
- .SeparateBySheet()
- .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
- .ExportAppendDataAsByteArray();
- result.ShouldNotBeNull();
- _fileContainer.SaveAsync(_first, result.Result, true);
+ result.ShouldNotBeNull();
+ _fileContainer.SaveAsync(_first, result.Result, true);
+
+
+ //if (_ls1.Count() > 900000)
+ //{
+ // if (_ls1.Count() > 2700000)
+ // {
+ // var _lsSheet1 = _ls1.Skip(0 * 900000).Take(900000);
+ // var _lsSheet2 = _ls1.Skip(1* 900000).Take(900000);
+ // var _lsSheet3 = _ls1.Skip(2 * 900000).Take(900000);
+ // var _lsSheet4 = _ls1.Skip(3 * 900000).Take(900000);
+ // ExcelExporter _exporter = new ExcelExporter();//导出Excel
+ // var result = _exporter.Append(_ls, "R3大众未结对比系统未结")
+ // .SeparateBySheet()
+ // .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第1页)")
+ // .SeparateBySheet()
+ // .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第2页)")
+ // .SeparateBySheet()
+ // .Append(_lsSheet3.ToList(), "系统未结对比R3大众未结(第3页)")
+ // .SeparateBySheet()
+ // .Append(_lsSheet3.ToList(), "系统未结对比R3大众未结(第4页)")
+ // .SeparateBySheet()
+ // .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
+ // .SeparateBySheet()
+ // .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
+ // .ExportAppendDataAsByteArray();
+ // result.ShouldNotBeNull();
+ // _fileContainer.SaveAsync(_first, result.Result, true);
+
+ // }
+ // else
+ // {
+ // if (_ls1.Count() > 18000000)
+ // {
+ // var _lsSheet1 = _ls1.Skip(0 * 900000).Take(900000);
+ // var _lsSheet2 = _ls1.Skip(1 * 900000).Take(900000);
+ // var _lsSheet3 = _ls1.Skip(2 * 900000).Take(900000);
+ // ExcelExporter _exporter = new ExcelExporter();//导出Excel
+ // var result = _exporter.Append(_ls, "R3大众未结对比系统未结")
+ // .SeparateBySheet()
+ // .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第1页)")
+ // .SeparateBySheet()
+ // .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第2页)")
+ // .SeparateBySheet()
+ // .Append(_lsSheet3.ToList(), "系统未结对比R3大众未结(第3页)")
+ // .SeparateBySheet()
+ // .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
+ // .SeparateBySheet()
+ // .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
+ // .ExportAppendDataAsByteArray();
+ // result.ShouldNotBeNull();
+ // _fileContainer.SaveAsync(_first, result.Result, true);
+
+ // }
+ // else
+ // {
+ // var _lsSheet1 = _ls1.Skip(0 * 900000).Take(900000);
+ // var _lsSheet2 = _ls1.Skip(1 * 900000).Take(900000);
+ // ExcelExporter _exporter = new ExcelExporter();//导出Excel
+ // var result = _exporter.Append(_ls.ToList(), "R3大众未结对比系统未结")
+ // .SeparateBySheet()
+ // .Append(_lsSheet1.ToList(), "系统未结对比R3大众未结(第1页)")
+ // .SeparateBySheet()
+ // .Append(_lsSheet2.ToList(), "系统未结对比R3大众未结(第2页)")
+ // .SeparateBySheet()
+ // .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
+ // .SeparateBySheet()
+ // .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
+ // .ExportAppendDataAsByteArray();
+ // result.ShouldNotBeNull();
+ // _fileContainer.SaveAsync(_first, result.Result, true);
+
+
+ // }
+ // }
+ //}
+ //else
+ //{
+
+ // ExcelExporter _exporter = new ExcelExporter();//导出Excel
+ // var result = _exporter.Append(_ls, "R3大众未结对比系统未结")
+ // .SeparateBySheet()
+ // .Append(_ls1.ToList(), "系统未结对比R3大众未结")
+ // .SeparateBySheet()
+ // .Append(_lsSum.ToList(), "大众R3未结对比结算系统差异汇总")
+ // .SeparateBySheet()
+ // .Append(_lsSum1.ToList(), "结算系统对比大众R3未结差异汇总")
+ // .ExportAppendDataAsByteArray();
+ // result.ShouldNotBeNull();
+ // _fileContainer.SaveAsync(_first, result.Result, true);
+
+ //}
- }
-
return id.ToString();
}