Commit 57d00e04 authored by chase's avatar chase

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents 1fa3f350 a35b8768
...@@ -46,7 +46,7 @@ public class PeriodJobDto { ...@@ -46,7 +46,7 @@ public class PeriodJobDto {
String[] codes = stepsCode.split(","); String[] codes = stepsCode.split(",");
if (tasks.stream().anyMatch(m -> m.status.equals(STATUS_ERROR))) { if (tasks.stream().anyMatch(m -> m.status.equals(STATUS_ERROR))) {
this.jobStatus = STATUS_ERROR; this.jobStatus = STATUS_ERROR;
} else if (tasks.size() < codes.length) { } else if (tasks.size() < codes.length || tasks.stream().anyMatch(m -> m.status.equals(STATUS_BEGIN))) {
this.jobStatus = STATUS_RUNNING; this.jobStatus = STATUS_RUNNING;
} else { } else {
this.jobStatus = STATUS_END; this.jobStatus = STATUS_END;
......
...@@ -7,6 +7,7 @@ import org.apache.poi.ss.formula.eval.ValueEval; ...@@ -7,6 +7,7 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverInteger;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString; import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString;
import static pwc.taxtech.atms.exception.Exceptions.BAD_BBVO_PARAMS; import static pwc.taxtech.atms.exception.Exceptions.BAD_BBVO_PARAMS;
...@@ -42,21 +43,45 @@ public class RSUMIFParasBo { ...@@ -42,21 +43,45 @@ public class RSUMIFParasBo {
public String getExpression(ValueEval[] args, OperationEvaluationContext ec) throws EvaluationException { public String getExpression(ValueEval[] args, OperationEvaluationContext ec) throws EvaluationException {
StringBuilder expression = new StringBuilder(""); StringBuilder expression = new StringBuilder("");
String _para = "";
begin(expression); begin(expression);
for(int i = 0 ; i< args.length; i++){ for (int i = 0; i < args.length; i++) {
_para = resolverString(args, ec, i); if (i >= 4) {
concatPara(expression, _para); concatPara(expression, resolverInteger(args, ec, i));
} else {
concatPara(expression, resolverString(args, ec, i));
}
if (i == args.length - 1) {
continue;
}
split(expression); split(expression);
} }
end(expression); end(expression);
return expression.toString(); return expression.toString();
} }
public String getQMYEExpression(Integer subjectType, String subjectCode, Integer year, Integer period, OperationEvaluationContext ec) throws EvaluationException {
StringBuilder expression = new StringBuilder("");
beginQMYE(expression);
concatPara(expression, subjectType);
split(expression);
concatPara(expression, subjectCode);
split(expression);
concatPara(expression, year);
split(expression);
concatPara(expression, period);
end(expression);
return expression.toString();
}
private StringBuilder begin(StringBuilder expression) { private StringBuilder begin(StringBuilder expression) {
return expression.append("RSUMIF("); return expression.append("RSUMIF(");
} }
private StringBuilder beginQMYE(StringBuilder expression) {
return expression.append("QMYE(");
}
private StringBuilder end(StringBuilder expression) { private StringBuilder end(StringBuilder expression) {
return expression.append(")"); return expression.append(")");
} }
...@@ -72,7 +97,10 @@ public class RSUMIFParasBo { ...@@ -72,7 +97,10 @@ public class RSUMIFParasBo {
private StringBuilder concatPara(StringBuilder expression, Integer para) { private StringBuilder concatPara(StringBuilder expression, Integer para) {
return expression.append(para); return expression.append(para);
} }
public RSUMIFParasBo(){}
public RSUMIFParasBo() {
}
public RSUMIFParasBo(RSUMIFParasBo otherBo, int period, int curYear) { public RSUMIFParasBo(RSUMIFParasBo otherBo, int period, int curYear) {
this.reportCode = otherBo.reportCode; this.reportCode = otherBo.reportCode;
this.columnIndex = otherBo.getColumnIndex(); this.columnIndex = otherBo.getColumnIndex();
......
...@@ -70,6 +70,20 @@ public class ReportCellTableSUMIFDataSourceDto extends DataSourceDto { ...@@ -70,6 +70,20 @@ public class ReportCellTableSUMIFDataSourceDto extends DataSourceDto {
this.name = DataSourceName.ReportDataSource; this.name = DataSourceName.ReportDataSource;
} }
public void insertQMYEData(OperationEvaluationContext o, FormulaContext formulaContext) {
this.tag = "QMYE";
this.rowIndex = o.getRowIndex();
this.columnIndex = o.getColumnIndex();
this.cellTemplateId = null;
this.period = formulaContext.getPeriod();
this.reportTemplateId = formulaContext.getReportTemplateGroupId().toString();
this.year = formulaContext.getYear();
this.isOnlyManualInput = false;
this.reportName = formulaContext.getReportTemplateGroupId().toString();
this.name = DataSourceName.ReportDataSource;
}
public String getTag() { public String getTag() {
return this.tag; return this.tag;
......
...@@ -61,7 +61,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*; ...@@ -61,7 +61,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
public class CitReportServiceImpl extends BaseService { public class CitReportServiceImpl extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(CitReportServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(CitReportServiceImpl.class);
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX", private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR", "WPNAME", "WPTYPE", "SUM2", "RSUMIF", "SUM"}; "JXFP", "PSUM", "DFFS", "JFFS", "WPSR", "WPNAME", "WPTYPE", "SUM2", "RSUMIF", "QMYE"};
@Autowired @Autowired
private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper; private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper;
......
...@@ -8,15 +8,16 @@ import pwc.taxtech.atms.common.util.MyAsserts; ...@@ -8,15 +8,16 @@ import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.common.util.StringUtil; import pwc.taxtech.atms.common.util.StringUtil;
import pwc.taxtech.atms.constant.enums.EnumServiceType; import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.CitTbamMapper;
import pwc.taxtech.atms.dao.FormulaAdminMapper; import pwc.taxtech.atms.dao.FormulaAdminMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dao.ProjectServiceTypeMapper; import pwc.taxtech.atms.dao.ProjectServiceTypeMapper;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto; import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dpo.GroupId; import pwc.taxtech.atms.dpo.GroupId;
import pwc.taxtech.atms.dto.TableRule; import pwc.taxtech.atms.dto.TableRule;
import pwc.taxtech.atms.entity.Project; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.ProjectServiceType;
import pwc.taxtech.atms.entity.ProjectServiceTypeExample;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.service.impl.CitCommonUtil;
import pwc.taxtech.atms.vat.dao.*; import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext; import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext;
...@@ -41,6 +42,10 @@ public class FormulaAgent { ...@@ -41,6 +42,10 @@ public class FormulaAgent {
private ProjectServiceTypeMapper projectServiceTypeMapper; private ProjectServiceTypeMapper projectServiceTypeMapper;
@Autowired @Autowired
private PeriodDataSourceMapper periodDataSourceMapper; private PeriodDataSourceMapper periodDataSourceMapper;
@Autowired
private CitTbamMapper citTbamMapper;
@Autowired
private ProjectMapper projectMapper;
public List<CellTemplatePerGroupDto> getCellTemplateGroupDto(Long templateGroupId, String projectId, String code, Integer rowIndex, Integer columnIndex, Integer period) { public List<CellTemplatePerGroupDto> getCellTemplateGroupDto(Long templateGroupId, String projectId, String code, Integer rowIndex, Integer columnIndex, Integer period) {
return adminMp.getCellTemplatePerGroupDto(templateGroupId, code, rowIndex, columnIndex, projectId, period); return adminMp.getCellTemplatePerGroupDto(templateGroupId, code, rowIndex, columnIndex, projectId, period);
...@@ -253,4 +258,25 @@ public class FormulaAgent { ...@@ -253,4 +258,25 @@ public class FormulaAgent {
} }
return new BigDecimal(0); return new BigDecimal(0);
} }
/**
* 获取期末余额
* @author zhikai.z.wei
* @param subjectType
* @param subjectCode
* @param year
* @param period
* @param formulaContext
* @return
*/
public BigDecimal getQMYE(Integer subjectType, String subjectCode, Integer year, Integer period, FormulaContext formulaContext){
Project project = projectMapper.selectByPrimaryKey(formulaContext.getProjectId());
CitTbamExample citTbamExample = new CitTbamExample();
citTbamExample.createCriteria().andAccountCodeEqualTo(subjectCode).andPeriodEqualTo(year+ project.getYear());
List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample);
if(citTbams == null || citTbams.isEmpty()){
return new BigDecimal(0.0);
}
return citTbams.get(0).getEndingBalance();
}
} }
...@@ -147,7 +147,9 @@ public class ReportGeneratorImpl { ...@@ -147,7 +147,9 @@ public class ReportGeneratorImpl {
List<PeriodFormulaBlock> periodFormulaBlocks = periodFormulaBlockMapper.selectByExample(periodFormulaBlockExample2); List<PeriodFormulaBlock> periodFormulaBlocks = periodFormulaBlockMapper.selectByExample(periodFormulaBlockExample2);
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换 //TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
String regex = "[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\:\\u4e00-\\u9fa5\\%]*\\)"; //原始版本正则表达式,update by zhikai.z.wei at 20190319 19:00
// String regex = "[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\:\\u4e00-\\u9fa5\\%]*\\)";
String regex = "[A-Z]*\\([^(^)]*\\)";
Pattern p = Pattern.compile(regex); Pattern p = Pattern.compile(regex);
String sourceFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula()) ? String sourceFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula()) ?
periodCellTemplateConfig.getKeyValueParsedFormula() : periodCellTemplateConfig.getKeyValueParsedFormula() :
...@@ -536,6 +538,21 @@ public class ReportGeneratorImpl { ...@@ -536,6 +538,21 @@ public class ReportGeneratorImpl {
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs); UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack); workbook.addToolPack(udfToolpack);
} }
/**
* 注册所有的自定义方法到工作簿
*
* @param workbook 工作簿
*/
public void addCitFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) {
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new PC(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext), new DFFS(formulaContext),
new JFFS(formulaContext), new WPSR(formulaContext), new WPNAME(formulaContext), new WPTYPE(formulaContext),
new SUM2(formulaContext), new RSUMIF(formulaContext), new QMYE(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack);
}
public List<CellCalcInfoDto> getCellCalcInfo(List<Long> templateIdList, Integer periodParam, String public List<CellCalcInfoDto> getCellCalcInfo(List<Long> templateIdList, Integer periodParam, String
projectId) { projectId) {
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dto.TableRule;
import pwc.taxtech.atms.dto.vatdto.RSUMIFParasBo;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellTableSUMIFDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverInteger;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString;
/**
* @description 计算指定科目期末余额,目前不考虑科目类型,统一为企业科目
* @author ZhiKai Z Wei
*/
public class QMYE extends FunctionBase implements FreeRefFunction {
private String tableName = "CIT_TBAM";
public QMYE(FormulaContext formulaContext) {
super(formulaContext);
}
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
//科目类型
Integer subjectType = 0;
//科目代码
String subjectCode = "";
Integer period = 0;
Integer year = 0;
//参数验证
parameterCheck(args, ec);
BigDecimal cellValue = BigDecimal.ZERO;
List<Object> dataSource = new ArrayList<>();
Map map = new HashMap<String, String>();
ReportCellTableSUMIFDataSourceDto reportCellTableSUMIFDataSourceDto = new ReportCellTableSUMIFDataSourceDto();
reportCellTableSUMIFDataSourceDto.insertQMYEData(ec, formulaContext);
dataSource.add(reportCellTableSUMIFDataSourceDto);
try {
//科目类型,固定写为企业科目
subjectType = resolverInteger(args, ec, 0);
//科目代码
subjectCode = resolverString(args, ec, 1);
year = resolverInteger(args, ec, 2);//年份
period = resolverInteger(args, ec, 3);//期间
cellValue = agent.getQMYE(subjectType, subjectCode, year, period, formulaContext);
return new NumberEval(cellValue.doubleValue());
} catch (EvaluationException e) {
e.printStackTrace();
return new NumberEval(0.00);
} finally {
Long dataSourceId = null;
try {
dataSourceId = saveDataRSUMIFSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellTableSUMIFDataSourceDto,
cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), ec.getColumnIndex(), ec.getRowIndex(),
formulaContext.getProjectId(), selectShow(tableName), null);
} catch (Exception e) {
e.printStackTrace();
}
try {
saveFormulaBlock(formulaContext.getPeriod(), ec,
new RSUMIFParasBo().getQMYEExpression(subjectType, subjectCode, year, period, ec), cellValue, dataSourceId, formulaContext.getProjectId());
} catch (EvaluationException e) {
e.printStackTrace();
}
}
}
//进行参数验证
public void parameterCheck(ValueEval[] args, OperationEvaluationContext ec) {
Integer argsLength = args.length;
if (argsLength != 4) {
//参数小于4当做异常处理
throw Exceptions.parameterError;
}
}
//解决不同表结构关联不同的展示方式
public FormulaDataSourceType selectShow(String tableName) {
if ("CIT_TBAM".equals(tableName)) {
return FormulaDataSourceType.CIT_TBAM;
}
return null;
}
public static String getSql (){
return "";
}
}
...@@ -25,10 +25,26 @@ public class SUM extends FunctionBase implements FreeRefFunction { ...@@ -25,10 +25,26 @@ public class SUM extends FunctionBase implements FreeRefFunction {
super(formulaContext); super(formulaContext);
} }
@Override
public ValueEval evaluate(ValueEval[] valueEvals, OperationEvaluationContext operationEvaluationContext) {
for (int i = 0, j = valueEvals.length; i < j; i++) {
try {
return new NumberEval(sum(getData(parameter(resolverString(valueEvals, operationEvaluationContext, i)))).doubleValue());
} catch (EvaluationException e) {
e.printStackTrace();
return defaultEval;
}
}
return defaultEval;
}
//检查参数合法性 //检查参数合法性
public String parameter(String parameter) { public String parameter(String parameter) {
if (parameter.length() != 2) if (parameter.length() != 2){
throw Exceptions.parameterError; throw Exceptions.parameterError;
}
return parameter; return parameter;
} }
...@@ -47,17 +63,4 @@ public class SUM extends FunctionBase implements FreeRefFunction { ...@@ -47,17 +63,4 @@ public class SUM extends FunctionBase implements FreeRefFunction {
return cellValue; return cellValue;
} }
@Override
public ValueEval evaluate(ValueEval[] valueEvals, OperationEvaluationContext operationEvaluationContext) {
for (int i = 0, j = valueEvals.length; i < j; i++) {
try {
return new NumberEval(sum(getData(parameter(resolverString(valueEvals, operationEvaluationContext, i)))).doubleValue());
} catch (EvaluationException e) {
e.printStackTrace();
return defaultEval;
}
}
return defaultEval;
}
} }
 
citModule.controller('citLayoutController', ['$scope', '$rootScope', '$location', '$q', '$log', '$timeout', '$state', '$translate', 'projectService', 'SweetAlert', citModule.controller('citLayoutController', ['$scope', '$rootScope', '$location', '$q', '$log', '$timeout', '$state', '$translate', 'projectService', 'SweetAlert',
'loginContext', 'citSessionService', 'vatSessionService', 'vatCommonService', 'vatWorkflowService', 'application', 'enums', '$uibModal', 'loginContext', 'citSessionService', 'vatSessionService', 'vatCommonService', 'vatWorkflowService', 'application', 'enums', '$uibModal',
function ($scope, $rootScope, $location, $q, $log, $timeout, $state, $translate, projectService, SweetAlert, loginContext, citSessionService, vatSessionService, function ($scope, $rootScope, $location, $q, $log, $timeout, $state, $translate, projectService, SweetAlert, loginContext, citSessionService, vatSessionService,
...@@ -84,7 +84,7 @@ function ($scope, $rootScope, $location, $q, $log, $timeout, $state, $translate, ...@@ -84,7 +84,7 @@ function ($scope, $rootScope, $location, $q, $log, $timeout, $state, $translate,
} }
else { else {
SweetAlert.warning($translate.instant('NoProjet')); SweetAlert.warning($translate.instant('NoProjet'));
$location.path('/summary'); // $location.path('/summary');
return; return;
} }
......
vatModule.controller('citCalculateDataController', ['$scope', '$log', '$timeout','$interval', '$q', '$translate', 'loginContext', vatModule.controller('citCalculateDataController', ['$scope', '$log', '$timeout','$interval', '$q', '$translate', 'loginContext',
'apiInterceptor', 'Upload', 'dataImportService', 'SweetAlert', 'vatReductionService', 'vatSessionService', 'uiGridConstants', 'apiInterceptor', 'Upload', 'dataImportService', 'SweetAlert', 'vatReductionService', 'vatSessionService', 'uiGridConstants',
'enums', 'modelConfigurationService', 'citReportService', 'vatCommonService', 'BSPLService', 'vatOperationLogService', 'enums', 'modelConfigurationService', 'citReportService', 'vatCommonService', 'BSPLService', 'vatOperationLogService',
'vatWorkflowService', 'vatWorkflowService',
...@@ -208,7 +208,7 @@ debugger; ...@@ -208,7 +208,7 @@ debugger;
var dataValidateCode = [/!*'DA001', 'DA002', 'DA003',*!/ ''];*/ var dataValidateCode = [/!*'DA001', 'DA002', 'DA003',*!/ ''];*/
//数据配置 //数据配置
result.push({ name: $translate.instant('ProcessData'), items: [new task('UpdateReportConfig', 'unstarted')] }); result.push({ name: $translate.instant('ProcessData'), items: [new task('UpdateReportConfig', 'unstarted',"","UpdateConfig")] });
result[result.length - 1].items.forEach(function (t) { t.seqNo = result.length - 1 }); result[result.length - 1].items.forEach(function (t) { t.seqNo = result.length - 1 });
//数据校验 //数据校验
...@@ -583,12 +583,18 @@ debugger; ...@@ -583,12 +583,18 @@ debugger;
debugger; debugger;
item.status = 'completed'; item.status = 'completed';
item.text = $translate.instant('completed'); item.text = $translate.instant('completed');
item.items.forEach(function (_task, index) {
debugger;
tasks.forEach(function(task){
debugger;
if(task.code==_task.code){
_task.status = 'completed';
_task.text = $translate.instant(_task.status);
}
})
})
}); });
$scope.tasks[0].items[0].status = 'completed';
$scope.tasks[0].items[0].text= $translate.instant('completed');
// $scope.tasks[tasks.length-1].items[items.length-1].status = 'completed';
// $scope.tasks[tasks.length-1].items[items.length-1].status.text = $translate.instant(_task.status);
if($scope.timer){ if($scope.timer){
$interval.cancel($scope.timer); $interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
......
citModule.directive('citReportSheet', ['$rootScope', '$log', '$timeout', '$q', 'templateService', 'enums', 'keyValueDataService', 'spreadJsTipService', citModule.directive('citReportSheet', ['$rootScope', '$log', '$timeout', '$q', 'templateService', 'enums', 'keyValueDataService', 'spreadJsTipService',
'$interval', 'vatSessionService', '$interval', 'vatSessionService',
function ($rootScope, $log, $timeout, $q, templateService, enums, keyValueDataService, spreadJsTipService, $interval, vatSessionService) { function ($rootScope, $log, $timeout, $q, templateService, enums, keyValueDataService, spreadJsTipService, $interval, vatSessionService) {
'use strict'; 'use strict';
...@@ -330,6 +330,7 @@ ...@@ -330,6 +330,7 @@
}; };
manualFunc.prototype = new GC.Spread.CalcEngine.Functions.Function("_Manual", 1, 1); manualFunc.prototype = new GC.Spread.CalcEngine.Functions.Function("_Manual", 1, 1);
manualFunc.prototype.evaluate = function (args) { manualFunc.prototype.evaluate = function (args) {
debugger;
if (!_.isString(args)) { if (!_.isString(args)) {
return "#VALUE!"; return "#VALUE!";
} }
...@@ -447,6 +448,7 @@ ...@@ -447,6 +448,7 @@
// 根据已有信息通过spreadJS计算各单元格的值 // 根据已有信息通过spreadJS计算各单元格的值
var setData = function () { var setData = function () {
debugger;
var sheet = scope.spread.sheets[0]; var sheet = scope.spread.sheets[0];
var isExportData = false; var isExportData = false;
if (angular.isArray(scope.reportSource)) { if (angular.isArray(scope.reportSource)) {
...@@ -456,6 +458,7 @@ ...@@ -456,6 +458,7 @@
} }
scope.reportSource.forEach(function (data) { scope.reportSource.forEach(function (data) {
debugger;
//fix bug11737 导出需要显示千分位 //fix bug11737 导出需要显示千分位
// 避免直接使用data.value = parseFloat(data.value)导致非数字型value无法显示 // 避免直接使用data.value = parseFloat(data.value)导致非数字型value无法显示
data.value = PWC.tryParseStringToNum(data.value); data.value = PWC.tryParseStringToNum(data.value);
...@@ -551,11 +554,14 @@ ...@@ -551,11 +554,14 @@
else { else {
parsedFormula = '_Manual("' + data.cellTemplateID + '")'; parsedFormula = '_Manual("' + data.cellTemplateID + '")';
} }
} }
if (!_.isEmpty(parsedFormula)) { if (!_.isEmpty(parsedFormula)) {
parsedFormula = 'IFERROR(' + parsedFormula + ', "")'; debugger;
// parsedFormula = 'IFERROR(' + parsedFormula + ', "")';
sheet.setFormula(data.rowIndex, data.columnIndex, '=' + parsedFormula); sheet.setFormula(data.rowIndex, data.columnIndex, '=' + parsedFormula);
// sheet.setValue(data.rowIndex, data.columnIndex, data.value);
ifShowParseFloat = false; // 有公式或手工数据源,单元格设置为公式 ifShowParseFloat = false; // 有公式或手工数据源,单元格设置为公式
} }
} }
...@@ -573,7 +579,7 @@ ...@@ -573,7 +579,7 @@
//设置 tooltip 和 图标信息 //设置 tooltip 和 图标信息
spreadJsTipService.setCellTipByCellData(sheet.getCell(data.rowIndex, data.columnIndex), data); spreadJsTipService.setCellTipByCellData(sheet.getCell(data.rowIndex, data.columnIndex), data);
}); });
debugger;
// 设置破折号单元格的值和显示格式,将其替换为带破折号格式的0值,这样引用到的其他单元格才能正常计算 // 设置破折号单元格的值和显示格式,将其替换为带破折号格式的0值,这样引用到的其他单元格才能正常计算
var rowCount = sheet.getRowCount(); var rowCount = sheet.getRowCount();
var columnCount = sheet.getColumnCount(); var columnCount = sheet.getColumnCount();
...@@ -593,6 +599,7 @@ ...@@ -593,6 +599,7 @@
// 更新数据源后,通过调用该方法计算所有当前sheet单元格,并通过比较原数据列表与spreadJS计算的新值列表,获取保存时需要修改库中Value的单元格信息列表 // 更新数据源后,通过调用该方法计算所有当前sheet单元格,并通过比较原数据列表与spreadJS计算的新值列表,获取保存时需要修改库中Value的单元格信息列表
var updateCells = function () { var updateCells = function () {
debugger;
setData(); setData();
var sheet = getSpreadControl().sheets[0]; var sheet = getSpreadControl().sheets[0];
var cells = []; var cells = [];
...@@ -600,6 +607,7 @@ ...@@ -600,6 +607,7 @@
.pluck('dataSourceList') .pluck('dataSourceList')
.flatten(true).value(); .flatten(true).value();
angular.forEach(scope.reportSource, function (x) { angular.forEach(scope.reportSource, function (x) {
debugger;
// 比较刷新前后报表中的值的变化 // 比较刷新前后报表中的值的变化
// 优先将单元格转换成数值比较,如果不能则转换为字符串比较 // 优先将单元格转换成数值比较,如果不能则转换为字符串比较
var cell = sheet.getCell(x.rowIndex, x.columnIndex); var cell = sheet.getCell(x.rowIndex, x.columnIndex);
......
citModule.controller('citReportViewController', ['$scope', '$rootScope', '$log', '$translate', '$timeout', '$q', '$compile', '$state', '$stateParams', citModule.controller('citReportViewController', ['$scope', '$rootScope', '$log', '$translate', '$timeout', '$q', '$compile', '$state', '$stateParams',
'apiInterceptor', 'vatExportService', 'SweetAlert', 'BSPLService', 'vatReportService', 'vatReportCacheService', 'vatSessionService', 'apiInterceptor', 'vatExportService', 'SweetAlert', 'BSPLService', 'vatReportService', 'vatReportCacheService', 'vatSessionService',
'loginContext', 'enums', 'vatCommonService', 'vatWorkflowService', 'projectService', '$uibModal', '$cookies', 'Upload', 'vatImportService', 'vatApproveService', 'loginContext', 'enums', 'vatCommonService', 'vatWorkflowService', 'projectService', '$uibModal', '$cookies', 'Upload', 'vatImportService', 'vatApproveService',
function ($scope, $rootScope, $log, $translate, $timeout, $q, $compile, $state, $stateParams, apiInterceptor, vatExportService, SweetAlert, BSPLService, function ($scope, $rootScope, $log, $translate, $timeout, $q, $compile, $state, $stateParams, apiInterceptor, vatExportService, SweetAlert, BSPLService,
...@@ -995,8 +995,10 @@ ...@@ -995,8 +995,10 @@
return; return;
} }
var reportPromiss = vatReportService.getReportData(node.reportId).success(function (reportData) { var reportPromiss = vatReportService.getReportData(node.reportId).success(function (reportData) {
debugger;
if (reportData && reportData.data && reportData.data.cellData) { if (reportData && reportData.data && reportData.data.cellData) {
_.each(reportData.data.cellData, function (x) { _.each(reportData.data.cellData, function (x) {
debugger;
x.value = x.cellValue; x.value = x.cellValue;
if (x.formula && reg.test(x.formula)) { if (x.formula && reg.test(x.formula)) {
x.isFormula = true; x.isFormula = true;
...@@ -1123,7 +1125,9 @@ ...@@ -1123,7 +1125,9 @@
}; };
var getReportData = function () { var getReportData = function () {
debugger;
vatReportService.getReportData($scope.reportId).success(function (reportData) { vatReportService.getReportData($scope.reportId).success(function (reportData) {
debugger;
if (reportData && reportData.data && reportData.data.cellData) { if (reportData && reportData.data && reportData.data.cellData) {
_.each(reportData.data.cellData, function (x) { _.each(reportData.data.cellData, function (x) {
x.value = x.cellValue; x.value = x.cellValue;
......
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