Commit 826fb36a by lcx

添加自定义提取,抽取列值替换公式

parent 1b8f0709
......@@ -150,7 +150,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
var notWrite = !value.HasValue && !string.IsNullOrEmpty(cell.ToString());
if (cell.CellType != CellType.Formula && !notWrite)
if (/*cell.CellType != CellType.Formula && */!notWrite)
{
cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column))
......
......@@ -4,6 +4,7 @@
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Repository;
using Performance.Services.ExtractExcelService.SheetDataWrite;
using System;
using System.Collections.Generic;
using System.IO;
......@@ -19,6 +20,7 @@ public class ExtractService : IAutoInjection
private readonly PersonService personService;
private readonly PerSheetService perSheetService;
private readonly DictionaryService dictionaryService;
private readonly CustomDataWrite customDataWrite;
private readonly PerforPerallotRepository perallotRepository;
private readonly PerforCollectdataRepository collectdataRepository;
private readonly PerforPeremployeeRepository peremployeeRepository;
......@@ -31,6 +33,7 @@ public class ExtractService : IAutoInjection
PersonService personService,
PerSheetService perSheetService,
DictionaryService dictionaryService,
CustomDataWrite customDataWrite,
PerforPerallotRepository perallotRepository,
PerforCollectdataRepository collectdataRepository,
PerforPeremployeeRepository peremployeeRepository,
......@@ -43,6 +46,7 @@ PerforPerdeptdicRepository perdeptdicRepository
this.personService = personService;
this.perSheetService = perSheetService;
this.dictionaryService = dictionaryService;
this.customDataWrite = customDataWrite;
this.perallotRepository = perallotRepository;
this.collectdataRepository = collectdataRepository;
this.peremployeeRepository = peremployeeRepository;
......@@ -162,6 +166,8 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
HandleSheet(workbook, allot, exdict, extractDto, groupName, isSingle, sheet, ratio, types, factory, style, employeeDict, collectData);
}
customDataWrite.WriteDataToCustom(workbook, allot, style);
}
private void HandleSheet(IWorkbook workbook, per_allot allot, Dictionary<ExDataDict, object> exdict, List<ExtractTransDto> extractDto, string groupName, bool isSingle,
......
......@@ -9,7 +9,7 @@
namespace Performance.Services.ExtractExcelService.SheetDataWrite
{
public class CustomDataWrite
public class CustomDataWrite : IAutoInjection
{
private readonly ILogger<CustomDataWrite> logger;
private readonly PerforHospitalconfigRepository hospitalconfigRepository;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment