Commit b83c00dd authored by neo's avatar neo

[Bugfix] fixed bb eval code sheet index

parent 8d883515
......@@ -95,7 +95,8 @@ public class BB extends FunctionBase implements FreeRefFunction {
return returnEval;
} else if (bo.getPeriod().intValue() == 0) {
cellValue = getCellValue(ec, formulaContext, agent, bo.getRowIndex() - 1, bo.getColumnIndex() - 1,
int index = ec.getWorkbook().getSheetIndex(bo.getReportCode());
cellValue = getCellValue(index, ec, formulaContext, agent, bo.getRowIndex() - 1, bo.getColumnIndex() - 1,
Long.parseLong(cellTemplateData.getCellTemplateId()));
nullCellDto.extractFromGroup(bo, formulaContext.getPeriod(), formulaContext.getYear(), cellTemplateData);
......
......@@ -183,12 +183,12 @@ public class FunctionBase {
SpringContextUtil.periodFormulaBlockMapper.insertSelective(periodFormulaBlock);
}
public static BigDecimal getCellValue(OperationEvaluationContext ec, FormulaContext formulaContext, FormulaAgent agent,
public static BigDecimal getCellValue(int index, OperationEvaluationContext ec, FormulaContext formulaContext, FormulaAgent agent,
int rowIndex, int columnIndex, Long cellTemplateId) throws NoSuchFieldException, IllegalAccessException {
Field evaluatorField = OperationEvaluationContext.class.getDeclaredField("_bookEvaluator");
evaluatorField.setAccessible(true);
WorkbookEvaluator evaluator = (WorkbookEvaluator) evaluatorField.get(ec);
ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(ec.getSheetIndex()).getCell(rowIndex, columnIndex));
ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(index).getCell(rowIndex, columnIndex));
List<PeriodDataSource> dss = agent.queryManualDataSource(cellTemplateId, formulaContext.getProjectId(), formulaContext.getPeriod());
......
......@@ -72,7 +72,7 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
MyAsserts.assertNotEmpty(cellTemplateDataList, Exceptions.PSUM_CELL_TEMP_NULL);
CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0);
BigDecimal cellValue = getCellValue(ec, formulaContext, agent, pCell.rowIndex - 1, pCell.columnIndex - 1,
BigDecimal cellValue = getCellValue(ec.getSheetIndex(), ec, formulaContext, agent, pCell.rowIndex - 1, pCell.columnIndex - 1,
Long.parseLong(cellTemplateData.getCellTemplateId()));
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.fixedWithGroup(cellTemplateData);
......@@ -82,8 +82,8 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
dto.setProjectId(formulaContext.getProjectId());
dto.setRowIndex(pCell.rowIndex-1);
dto.setColumnIndex(pCell.columnIndex-1);
dto.setColumnName((pCell.columnIndex-1)+"列");
dto.setRowName((pCell.rowIndex-1)+"行");
dto.setColumnName((pCell.columnIndex)+"列");
dto.setRowName((pCell.rowIndex)+"行");
dto.setReportName(ec.getWorkbook().getSheetName(ec.getSheetIndex()));
dto.setType( FormulaDataSourceType.Report.getCode());
......
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