parent
f97dea2d99
commit
902802a93d
|
@ -16,6 +16,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class MeasureciFormPlugin extends AbstractFormPlugin {
|
public class MeasureciFormPlugin extends AbstractFormPlugin {
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,17 +29,11 @@ public class MeasureciFormPlugin extends AbstractFormPlugin {
|
||||||
Object measurecostid = this.getModel().getValue("measurecostid");//成本测算ID
|
Object measurecostid = this.getModel().getValue("measurecostid");//成本测算ID
|
||||||
DynamicObject measurecost = BusinessDataServiceHelper.loadSingle(measurecostid,"recos_measurecost");
|
DynamicObject measurecost = BusinessDataServiceHelper.loadSingle(measurecostid,"recos_measurecost");
|
||||||
DynamicObject project = measurecost.getDynamicObject("project");
|
DynamicObject project = measurecost.getDynamicObject("project");
|
||||||
String number = project.getString("number");//项目编码
|
DynamicObject repmd_projectbill = BusinessDataServiceHelper.loadSingle(project.getPkValue(),"repmd_projectbill");//获取项目
|
||||||
QFilter filter = new QFilter("qeug_cpmc.id", QCP.equals, producttypeid).
|
DynamicObjectCollection productentry = repmd_projectbill.getDynamicObjectCollection("productentry");//获取对应产品
|
||||||
and(new QFilter("qeug_xmnumber", QCP.equals, number));
|
List<DynamicObject> children = productentry .stream().filter(e -> e.getDynamicObject("productentry_producttype").getString("id").equals(producttypeid.toString())).collect(Collectors.toList());
|
||||||
DynamicObject queryone = QueryServiceHelper.queryOne("qeug_gcl", "id", filter.toArray());
|
DynamicObjectCollection qeug_entryentity = children.get(0).getDynamicObjectCollection("qeug_subentryentity");//子单据体
|
||||||
if (queryone==null){
|
|
||||||
this.getView().showSuccessNotification("请维护项目面积数据");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Map<String, BigDecimal> result = new HashMap<>();
|
Map<String, BigDecimal> result = new HashMap<>();
|
||||||
DynamicObject gcl = BusinessDataServiceHelper.loadSingle(queryone.get("id"),"qeug_gcl");
|
|
||||||
DynamicObjectCollection qeug_entryentity = gcl.getDynamicObjectCollection("qeug_entryentity");//面积
|
|
||||||
for (int i = 0; i <qeug_entryentity.size() ; i++) {
|
for (int i = 0; i <qeug_entryentity.size() ; i++) {
|
||||||
DynamicObject dynamicObject = qeug_entryentity.get(i);
|
DynamicObject dynamicObject = qeug_entryentity.get(i);
|
||||||
BigDecimal sum = dynamicObject.getBigDecimal("qeug_hjs");
|
BigDecimal sum = dynamicObject.getBigDecimal("qeug_hjs");
|
||||||
|
|
|
@ -12,8 +12,10 @@ import kd.bos.entity.plugin.Plugin;
|
||||||
import kd.bos.fileservice.FileItem;
|
import kd.bos.fileservice.FileItem;
|
||||||
import kd.bos.fileservice.FileService;
|
import kd.bos.fileservice.FileService;
|
||||||
import kd.bos.fileservice.FileServiceFactory;
|
import kd.bos.fileservice.FileServiceFactory;
|
||||||
|
import kd.bos.form.ConfirmTypes;
|
||||||
import kd.bos.form.FormShowParameter;
|
import kd.bos.form.FormShowParameter;
|
||||||
import kd.bos.form.IFormView;
|
import kd.bos.form.IFormView;
|
||||||
|
import kd.bos.form.MessageBoxOptions;
|
||||||
import kd.bos.form.control.AttachmentPanel;
|
import kd.bos.form.control.AttachmentPanel;
|
||||||
import kd.bos.form.control.Control;
|
import kd.bos.form.control.Control;
|
||||||
import kd.bos.form.control.events.BeforeItemClickEvent;
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
@ -187,6 +189,19 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
|
||||||
|
|
||||||
// 单据列表数据风格样式,设置字体为黑体,字号15
|
// 单据列表数据风格样式,设置字体为黑体,字号15
|
||||||
XSSFCellStyle billStyle = workbook.createCellStyle();
|
XSSFCellStyle billStyle = workbook.createCellStyle();
|
||||||
|
|
||||||
|
// 设置边框
|
||||||
|
billStyle.setBorderBottom(BorderStyle.THIN);
|
||||||
|
billStyle.setBorderTop(BorderStyle.THIN);
|
||||||
|
billStyle.setBorderLeft(BorderStyle.THIN);
|
||||||
|
billStyle.setBorderRight(BorderStyle.THIN);
|
||||||
|
|
||||||
|
// 设置边框颜色
|
||||||
|
billStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
||||||
|
billStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
||||||
|
billStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
||||||
|
billStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
||||||
|
|
||||||
// 设置水平居中
|
// 设置水平居中
|
||||||
billStyle.setAlignment(HorizontalAlignment.CENTER);
|
billStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||||
// 设置垂直居中
|
// 设置垂直居中
|
||||||
|
@ -203,6 +218,17 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
|
||||||
for (int u=0;u<excel.get(i).size();u++){
|
for (int u=0;u<excel.get(i).size();u++){
|
||||||
XSSFCell ncell = nrow.createCell(u);
|
XSSFCell ncell = nrow.createCell(u);
|
||||||
ncell.setCellStyle(billStyle);
|
ncell.setCellStyle(billStyle);
|
||||||
|
if (i==0){
|
||||||
|
// 创建单元格样式
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
// 设置垂直居中
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
// 设置背景颜色为淡灰色
|
||||||
|
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||||
|
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
|
ncell.setCellStyle(style);
|
||||||
|
}
|
||||||
Object s = excel.get(i).get(u);
|
Object s = excel.get(i).get(u);
|
||||||
if (s instanceof BigDecimal) {
|
if (s instanceof BigDecimal) {
|
||||||
BigDecimal b=(BigDecimal)s;
|
BigDecimal b=(BigDecimal)s;
|
||||||
|
@ -315,19 +341,25 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int j = rowNum; j <= rowCountsheet - 2; j++){//序号行至最后一行总计前一行
|
for (int j = rowNum; j <= rowCountsheet - 1; j++){//序号行至最后一行
|
||||||
Row row = sheet.getRow(j);
|
Row row = sheet.getRow(j);
|
||||||
Calculation calculation = new Calculation(
|
Calculation calculation = null;
|
||||||
row.getCell(6).getStringCellValue(),//科目编码
|
try {
|
||||||
row.getCell(7).getStringCellValue(),//科目名称
|
calculation = new Calculation(
|
||||||
row.getCell(10).getStringCellValue(),//单位
|
String.valueOf(getcellvallue(row.getCell(6))),//科目编码
|
||||||
row.getCell(12).getNumericCellValue(),// 调整系数
|
String.valueOf(getcellvallue(row.getCell(7))),//科目名称
|
||||||
row.getCell(14).getNumericCellValue(),//合价(含税)
|
String.valueOf(getcellvallue(row.getCell(10))),//单位
|
||||||
row.getCell(13).getNumericCellValue(),//单价
|
(double)getcellvallue(row.getCell(12)),// 调整系数
|
||||||
row.getCell(11).getNumericCellValue(),//工程量
|
(double)getcellvallue(row.getCell(14)),//合价(含税)
|
||||||
row.getCell(9).getStringCellValue(),//估算口径
|
(double)getcellvallue(row.getCell(13)),//单价
|
||||||
String.valueOf(getcellvallue(row.getCell(15)))//备注
|
(double)getcellvallue(row.getCell(11)),//工程量
|
||||||
);
|
String.valueOf(getcellvallue(row.getCell(9))),//估算口径
|
||||||
|
String.valueOf(getcellvallue(row.getCell(15)))//备注
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.getView().showConfirm("导入功能失败", e.getMessage()+"原因:"+sheetName+"第"+(j+1)+"行获取数据格式有误,请检查", MessageBoxOptions.OK, ConfirmTypes.Default, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
arrayList.add(calculation);
|
arrayList.add(calculation);
|
||||||
}
|
}
|
||||||
String res = updateRecosMeasurecos(arrayList, sheetName,result);
|
String res = updateRecosMeasurecos(arrayList, sheetName,result);
|
||||||
|
|
Loading…
Reference in New Issue