From dbc43cb2fb2607aac54655f57c4c525a983199c7 Mon Sep 17 00:00:00 2001 From: xiongcz Date: Tue, 3 Jun 2025 17:25:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SystemDataDistributionDialog.java | 747 +++++++++++------- 1 file changed, 455 insertions(+), 292 deletions(-) diff --git a/src/cn/com/ebewin/ysr/dialog/systemdatadistribution/SystemDataDistributionDialog.java b/src/cn/com/ebewin/ysr/dialog/systemdatadistribution/SystemDataDistributionDialog.java index 3912f52..7217791 100644 --- a/src/cn/com/ebewin/ysr/dialog/systemdatadistribution/SystemDataDistributionDialog.java +++ b/src/cn/com/ebewin/ysr/dialog/systemdatadistribution/SystemDataDistributionDialog.java @@ -23,7 +23,10 @@ import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import javax.swing.*; import javax.swing.filechooser.FileSystemView; @@ -31,6 +34,7 @@ import javax.swing.table.DefaultTableModel; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; @@ -76,6 +80,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen private String sjTime1 = null; //实际时间2 private String sjTime2 = null; + //记录“差值/单项完成百分比”所在位置的列索引 + private Map percentageColumnIndexMap = new HashMap(); private JTextField projectNumField; @@ -174,6 +180,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen private int fm = 0;//每个项目的系统资料完成百分比-分母 private int tcpodi_fz = 0;//查询资料的总完成百分比-分子 private int tcpodi_fm = 0;//查询资料的总完成百分比-分母 + //布置图单项百分比 private int bzt_total_fz = 0; private int bzt_total_fm = 0; @@ -207,9 +214,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen //采购单项百分比 private int cg_total_fz = 0; private int cg_total_fm = 0; - - - + public SystemDataDistributionDialog(TCSession session) throws Exception { System.out.println("SystemDataDistributionDialog~"); this.session = session; @@ -255,17 +260,29 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen this.cg_total_fm = 0; } + /** + * 打印此时的单项百分比的分子分母 + */ + public void showIndividualPercentage() { + System.out.println(" 布置图=> "+this.bzt_total_fz+"/"+this.bzt_total_fm); + System.out.println(" 布局图=> "+this.bjt_total_fz+"/"+this.bjt_total_fm); + System.out.println(" 系统总目录=> "+this.zml_total_fz+"/"+this.zml_total_fm); + System.out.println(" 机器人配置=> "+this.jqr_total_fz+"/"+this.jqr_total_fm); + System.out.println(" 项目启动会资料=> "+this.qdh_total_fz+"/"+this.qdh_total_fm); + System.out.println(" 设计施工式样书=> "+this.sjsg_total_fz+"/"+this.sjsg_total_fm); + System.out.println(" 设备颜色通知=> "+this.sbys_total_fz+"/"+this.sbys_total_fm); + System.out.println(" 外委启动审批=> "+this.wwsp_total_fz+"/"+this.wwsp_total_fm); + System.out.println(" 电气程序=> "+this.elec_total_fz+"/"+this.elec_total_fm); + System.out.println(" 交底会=> "+this.jdh_total_fz+"/"+this.jdh_total_fm); + System.out.println(" 采购单=> "+this.cg_total_fz+"/"+this.cg_total_fm); + + } + /** * 设置列宽 */ public void setColumnWidth() { int[] czdxwcbfb = {10,13,16,19,22,25,28,31,34,37,40};//差值单项百分比的列索引 -// for (int i = 0; i < this.columnNum; i++){ -// int headNum = this.columnNames[i].length();//获取表头长度 -// if (headNum <= 4){ -// this.table.getColumnModel().getColumn(i).setPreferredWidth(50);//2,3 -// } -// } this.table.getColumnModel().getColumn(0).setPreferredWidth(100);//项目号 this.table.getColumnModel().getColumn(1).setPreferredWidth(250);//订货厂家 this.table.getColumnModel().getColumn(2).setPreferredWidth(70);//项目经理 @@ -730,6 +747,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } + private long queryStartTime; // 查询开始时间 + private long queryEndTime; // 查询结束时间 /* * 界面操作监听器 */ @@ -739,6 +758,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen Object s = e.getSource(); try { if (s.equals(this.queryButton)) { + queryStartTime = System.currentTimeMillis(); System.out.println("触发查询事件"); this.tcpodiField.setText(""); data.clear(); @@ -833,8 +853,11 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen this.tcpodi_fz = 0; this.tcpodi_fm = 0; blankIndividualPercentage(); + System.out.println("置空后的单项百分比-分子分母:"); + showIndividualPercentage(); for (int i = 0; i < resultComponents.length; i++) {//遍历查询结果 String[] ss = new String[this.columnNum];//用来存放行数据的数组(一条项目信息对应一行数据) + //处理每一行数据前,对分子分母置空 this.fz = 0; this.fm = 0; InterfaceAIFComponent interfaceAIFComponent = resultComponents[i]; @@ -876,16 +899,23 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen String s1 = caculateTcpodi(this.tcpodi_fz, this.tcpodi_fm); this.tcpodiField.setText(s1); updataTable(data,timeType,startDateInput,endDateInput,fileNames); + System.out.println("数据组织完成后的单项百分比-分子分母:"); + showIndividualPercentage(); }else { MessageBox.post("查询结束,未查询到符合要求的结果!","查询结果",MessageBox.INFORMATION); } + // 记录查询结束时间 + queryEndTime = System.currentTimeMillis(); + // 打印耗时 + long duration = queryEndTime - queryStartTime; + System.out.println("查询耗时: " + duration + " 毫秒"); }else { MessageBox.post("调用'项目启动通知单查询'失败","查询结果",MessageBox.INFORMATION); } }else if (s.equals(this.exportButton)) { + System.out.println("触发导出按钮~"); if (this.finalData.size()>0) { - System.out.println("触发导出按钮~"); JFileChooser fileChooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory()); fileChooser.setDialogTitle("Select a folder"); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); @@ -899,7 +929,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen if (this.finalData.size()>0) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); String timestamp = dateFormat.format(new Date()); - String fileName = chooserPathString+"\\系统资料下发统计表_" + timestamp + ".xls"; + String fileName = chooserPathString+"\\系统资料下发统计表_" + timestamp + ".xlsx"; exportExcel(fileName, this.finalData); } }else { @@ -926,6 +956,50 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } } + /** + * 根据需求控制分子分母的增减(第四版:有计划有实际-分子分母加1;有计划无实际-分母加1;有实际无计划-分子分母+1;无计划无实际-都不加) + * @param jhTime 计划时间 + * @param sjTime 实际时间 + */ + public void incremeFZOFM(String jhTime,String sjTime,String title) { + if (isPresence(jhTime) && isPresence(sjTime)){ + System.out.println(">>>【"+title+"】有计划有实际-分子分母+1"); + this.fz ++; + this.fm ++; + } else if (isPresence(jhTime) && !isPresence(sjTime)) { + System.out.println(">>>【"+title+"】有计划无实际-分母+1"); + this.fm ++; + } else if (isPresence(sjTime) && !isPresence(jhTime)) { + System.out.println(">>>【"+title+"】有实际无计划-分子分母+1"); + this.fz ++; + this.fm ++; + } + } + + public boolean isPresence(String attributeValue){ + if (attributeValue != null && !attributeValue.isEmpty()){ + return true; + }else { + return false; + } + } + + /** + * 对仅有实际完成时间的对象特殊处理分子分母(实际有值-分子分母加1;实际无值-分母加1) + * @param sjTime + */ + public void incremeFZOFMForOnlySJ(String sjTime,String title) { + if (sjTime != null && !sjTime.isEmpty()){ + System.out.println(">>>【"+title+"】有计划有实际-分子分母+1"); + this.fz ++; + this.fm ++; + }else { + System.out.println(">>>【"+title+"】有计划无实际-分母+1"); + this.fm ++; + } + } + + /** * 获取所有信息 * @param ss 存放所有信息的数组,入参时只保存项目基础信息 @@ -935,6 +1009,10 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen */ private String[] getAllAttribute(String[] ss,String projectCodeString) throws Exception { System.out.println("getAllAttribute~"); + System.out.println("==================================================================================="); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>> 开始获取项目【"+ss[0]+"】的相关信息 <<<<<<<<<<<<<<<<<<<<<<<<"); + System.out.println("==================================================================================="); + System.out.println("项目: "+ss[0]+" 初始化分子="+this.fz+" 分母="+this.fm); //组织查询入参:项目号_****** String XMFXPGD_id = projectCodeString +"_XMFXPGD";//项目风险评估单 String BZT_id = projectCodeString +"_BZT";//布置图、终版布局图 @@ -952,6 +1030,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen //---------------------------姜科审批时间&二次效果评价--------------------------------------------------------------- if (XMFXPGD_id != null) {//项目风险评估单 System.out.println("姜科审批时间查询···"); + String jkJHTime = null; + String jkSJTime = null; List entryNamesJK = new ArrayList(); List entryValuesJK = new ArrayList(); entryNamesJK.add("流程名称"); @@ -969,9 +1049,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen if (xmfxpgdRsJK.length > 0){ System.out.println("姜科审批时间查询成功!查询结果数量:"+xmfxpgdRsJK.length); TCComponentTask task = (TCComponentTask)xmfxpgdRsJK[0]; - String jkspsj = task.getProperty("fnd0EndDate"); - incremeFM(jkspsj); - ss[6] = jkspsj == null ? "" : jkspsj;//姜科审批时间 + jkJHTime = task.getProperty("fnd0EndDate"); + ss[6] = jkJHTime == null ? "" : jkJHTime;//姜科审批时间 }else { System.out.println("当前版本对象未发布流程!获取姜科审批时间失败!"); @@ -995,21 +1074,21 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen if (xmfxpgdRs.length > 0) { System.out.println("项目文档查询成功!查询结果数量:"+xmfxpgdRs.length); TCComponentItemRevision rev = (TCComponentItemRevision)xmfxpgdRs[0]; - String ecxgpj = rev.getProperty("date_released"); - incremeFZ(ecxgpj); - incremeFM(ecxgpj); - ss[7] = ecxgpj == null ? "" : ecxgpj;//二次效果评价(实际) + jkSJTime = rev.getProperty("date_released"); + ss[7] = jkSJTime == null ? "" : jkSJTime;//二次效果评价(实际) }else { System.out.println("项目风险评估单-未查询到任何信息!"); } - + incremeFZOFM(jkJHTime,jkSJTime,"风险评估"); } //-------------------------------------------------------------------------------------------------------------------------------- if (BZT_id != null){//布置图 System.out.println("布置图查询···"); InterfaceAIFComponent[] sjbrw = null; + String bztjhTime = null; + String bztsjTime = null; //查询“布置图”的计划:单元格索引-8 InterfaceAIFComponent[] sjbrw1 = scheduleTaskQuery1("【"+projectCodeString+"】布置图"); InterfaceAIFComponent[] sjbrw2 = scheduleTaskQuery1(projectCodeString+"布置图"); @@ -1021,12 +1100,11 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen System.out.println("调用时间表任务 未查询到 布置图 的计划信息!"); } if (sjbrw != null && sjbrw.length>0) { - String bztjh = sjbrw[0].getProperty("finish_date"); - incremeFM(bztjh); - if (bztjh != null && !bztjh.isEmpty()){ - this.bzt_total_fm ++; - } - ss[8] = bztjh == null ? "" : bztjh; + bztjhTime = sjbrw[0].getProperty("finish_date"); +// if (bztjhTime != null && !bztjhTime.isEmpty()){ +// this.bzt_total_fm ++; +// } + ss[8] = bztjhTime == null ? "" : bztjhTime; } //查询“布置图”的实际:单元格索引-9 List entryNames2 = new ArrayList(); @@ -1046,24 +1124,34 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] bztsjs = queryBuilder("项目文档查询", entryNames2, entryValues2); if (bztsjs.length>0){ - String bztsj = bztsjs[0].getProperty("date_released"); - incremeFZ(bztsj); - incremeFM(bztsj); + bztsjTime = bztsjs[0].getProperty("date_released"); - if (bztsj != null && !bztsj.isEmpty()){ - this.bzt_total_fz ++; - this.bzt_total_fm ++; - } - ss[9] = bztsj == null ? "" : bztsj; + ss[9] = bztsjTime == null ? "" : bztsjTime; }else { System.out.println("调用项目文档查询 未查询到 布置图 的实际信息!"); } + // + if (isPresence(bztjhTime) && isPresence(bztsjTime)){ + System.out.println("差值》布置图计划-实际,分子分母+1"); + this.bzt_total_fz ++; + this.bzt_total_fm ++; + }else if (isPresence(bztjhTime) && !isPresence(bztsjTime)) { + System.out.println("差值》布置图计划,分母+1"); + this.bzt_total_fm ++; + } else if (isPresence(bztsjTime) && !isPresence(bztjhTime)) { + System.out.println("差值》布置图实际,分子分母+1"); + this.bzt_total_fz ++; + this.bzt_total_fm ++; + } //计算差值,索引-10 ss[10] = caculateDifference(ss[8], ss[9]); + incremeFZOFM(bztjhTime,bztsjTime,"布置图"); //-------------------------------------------------------------------------------------------------------------------------------- System.out.println("终版布局图查询···"); + String zbjhTime = null; + String zbsjTime = null; //查询终版布局图的计划,单元格索引-11 InterfaceAIFComponent[] zbbjtjhs = null; InterfaceAIFComponent[] zbbjtjhs1 = scheduleTaskQuery1("【"+projectCodeString+"】提供最终布置图(有交付物)"); @@ -1076,13 +1164,13 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen System.out.println("调用时间表任务 未查询到 终版布局图 的计划信息!"); } if (zbbjtjhs != null && zbbjtjhs.length>0) { - String zbbjtjh = zbbjtjhs[0].getProperty("finish_date"); - incremeFM(zbbjtjh); - if (zbbjtjh != null && !zbbjtjh.isEmpty()){ - this.bjt_total_fm ++; - } + zbjhTime = zbbjtjhs[0].getProperty("finish_date"); + +// if (zbjhTime != null && !zbjhTime.isEmpty()){ +// this.bjt_total_fm ++; +// } - ss[11] = zbbjtjh == null ? "" : zbbjtjh; + ss[11] = zbjhTime == null ? "" : zbjhTime; } //查询终版布局图的实际,单元格索引-12 List entryNames4 = new ArrayList(); @@ -1102,25 +1190,34 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] zbbjtsjs = queryBuilder("项目文档查询", entryNames4, entryValues4); if (zbbjtsjs.length>0){ - String zbbjtsj = zbbjtsjs[0].getProperty("date_released"); - incremeFZ(zbbjtsj); - incremeFM(zbbjtsj); + zbsjTime = zbbjtsjs[0].getProperty("date_released"); - if (zbbjtsj != null && !zbbjtsj.isEmpty()){ - this.bjt_total_fz ++; - this.bjt_total_fm ++; - } - ss[12] = zbbjtsj == null ? "" : zbbjtsj; + ss[12] = zbsjTime == null ? "" : zbsjTime; }else { System.out.println("调用项目文档查询 未查询到 终版布局图 的实际信息!"); } + // + if (isPresence(zbjhTime) && isPresence(zbsjTime)){ + System.out.println("差值》终版布局图计划-实际,分子分母+1"); + this.bjt_total_fz ++; + this.bjt_total_fm ++; + }else if (isPresence(zbjhTime) && !isPresence(zbsjTime)) { + System.out.println("差值》终版布局图计划,分母+1"); + this.bjt_total_fm ++; + } else if (isPresence(zbsjTime) && !isPresence(zbjhTime)) { + System.out.println("差值》终版布局图实际,分子分母+1"); + this.bjt_total_fz ++; + this.bjt_total_fm ++; + } //计算差值,索引-13 ss[13] = caculateDifference(ss[11], ss[12]); - + incremeFZOFM(zbjhTime,zbsjTime,"终版布局图"); } //-------------------------------------------------------------------------------------------------------------------------------- if (XTZML != null){//总目录 System.out.println("系统总目录查询···"); + String zmljhTime = null; + String zmlsjTime = null; //总目录-计划,单元格索引-14 InterfaceAIFComponent[] zmljhs = null; InterfaceAIFComponent[] zmljhs1 = scheduleTaskQuery1("【" + projectCodeString + "】下发总目录"); @@ -1134,14 +1231,13 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (zmljhs != null && zmljhs.length>0) { - String zmljh = zmljhs[0].getProperty("finish_date"); - incremeFM(zmljh); + zmljhTime = zmljhs[0].getProperty("finish_date"); - if (zmljh != null && !zmljh.isEmpty()){ - this.zml_total_fm ++; - } +// if (zmljhTime != null && !zmljhTime.isEmpty()){ +// this.zml_total_fm ++; +// } - ss[14] = zmljh == null ? "" : zmljh; + ss[14] = zmljhTime == null ? "" : zmljhTime; }else { System.out.println("调用时间表任务 未查询到 总目录 的计划信息!"); } @@ -1163,25 +1259,35 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] zmlsjs = queryBuilder("项目文档查询", entryNames2, entryValues2); if (zmlsjs.length>0){ - String zmlsj = zmlsjs[0].getProperty("date_released"); - incremeFZ(zmlsj); - incremeFM(zmlsj); - - if (zmlsj != null && !zmlsj.isEmpty()){ - this.zml_total_fz ++; - this.zml_total_fm ++; - } + zmlsjTime = zmlsjs[0].getProperty("date_released"); - ss[15] = zmlsj == null ? "" : zmlsj; + ss[15] = zmlsjTime == null ? "" : zmlsjTime; }else { System.out.println("调用项目文档查询 未查询到 终版布局图 的实际信息!"); } + // + if (isPresence(zmljhTime) && isPresence(zmlsjTime)){ + System.out.println("差值》系统总目录计划-实际,分子分母+1"); + this.zml_total_fz ++; + this.zml_total_fm ++; + }else if (isPresence(zmljhTime) && !isPresence(zmlsjTime)) { + System.out.println("差值》系统总目录计划,分母+1"); + this.zml_total_fm ++; + } else if (isPresence(zmlsjTime) && !isPresence(zmljhTime)) { + System.out.println("差值》系统总目录实际,分子分母+1"); + this.zml_total_fz ++; + this.zml_total_fm ++; + } + //计算差值,索引-16 ss[16] = caculateDifference(ss[14], ss[15]); + incremeFZOFM(zmljhTime,zmlsjTime,"系统总目录"); } //------------------------------------------------------------------------------------------------------------------------------- if (JQR01 != null){//机器人配置单 System.out.println("机器人配置单查询···"); + String jqjhTime = null; + String jqsjTime = null; //机器人配置单-计划,单元格索引-17 InterfaceAIFComponent[] jqrpzds = null; InterfaceAIFComponent[] jqrpzds1 = scheduleTaskQuery1("【" + projectCodeString + "】机器人采购单"); @@ -1195,14 +1301,13 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (jqrpzds != null && jqrpzds.length>0){ - String jqrpzd = jqrpzds[0].getProperty("finish_date"); - incremeFM(jqrpzd); + jqjhTime = jqrpzds[0].getProperty("finish_date"); - if (jqrpzd != null && !jqrpzd.isEmpty()){ - this.jqr_total_fm ++; - } +// if (jqjhTime != null && !jqjhTime.isEmpty()){ +// this.jqr_total_fm ++; +// } - ss[17] = jqrpzd == null ? "" : jqrpzd; + ss[17] = jqjhTime == null ? "" : jqjhTime; }else { System.out.println("调用时间表任务 未查询到 机器人配置单 的计划信息!"); } @@ -1224,25 +1329,35 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] jqrpzjs = queryBuilder("项目文档查询", entryNames2, entryValues2); if (jqrpzjs.length>0){ - String jqrpzj = jqrpzjs[0].getProperty("date_released"); - incremeFZ(jqrpzj); - incremeFM(jqrpzj); - //单项百分比累加计算 - if (jqrpzj != null && !jqrpzj.isEmpty()){ - this.jqr_total_fz ++; - this.jqr_total_fm ++; - } + jqsjTime = jqrpzjs[0].getProperty("date_released"); - ss[18] = jqrpzj == null ? "" : jqrpzj; + ss[18] = jqsjTime == null ? "" : jqsjTime; }else { System.out.println("调用项目文档查询 未查询到 机器人配置单 的实际信息!"); } + // + if (isPresence(jqjhTime) && isPresence(jqsjTime)){ + System.out.println("差值》机器人配置单计划-实际,分子分母+1"); + this.jqr_total_fz ++; + this.jqr_total_fm ++; + }else if (isPresence(jqjhTime) && !isPresence(jqsjTime)) { + System.out.println("差值》机器人配置单计划,分母+1"); + this.jqr_total_fm ++; + } else if (isPresence(jqsjTime) && !isPresence(jqjhTime)) { + System.out.println("差值》机器人配置单实际,分子分母+1"); + this.jqr_total_fz ++; + this.jqr_total_fm ++; + } + //计算差值,索引-19 ss[19] = caculateDifference(ss[17], ss[18]); + incremeFZOFM(jqjhTime,jqsjTime,"机器人配置单"); } //-------------------------------------------------------------------------------------------------------------------------------- if (QDHZL01 != null){ System.out.println("项目启动会资料···"); + String qdhjhTime = null; + String qdhsjTime = null; //项目启动会资料-计划,单元格索引-20 InterfaceAIFComponent[] qdhjhs = null; InterfaceAIFComponent[] qdhjhs1 = scheduleTaskQuery1("【" + projectCodeString + "】启动会(有交付物)"); @@ -1256,14 +1371,13 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (qdhjhs != null && qdhjhs.length>0){ - String qdhjh = qdhjhs[0].getProperty("finish_date"); - incremeFM(qdhjh); + qdhjhTime = qdhjhs[0].getProperty("finish_date"); - if (qdhjh != null && !qdhjh.isEmpty()){ - this.qdh_total_fm ++; - } +// if (qdhjhTime != null && !qdhjhTime.isEmpty()){ +// this.qdh_total_fm ++; +// } - ss[20] = qdhjh == null ? "" : qdhjh; + ss[20] = qdhjhTime == null ? "" : qdhjhTime; }else { System.out.println("调用时间表任务 未查询到 项目启动会资料 的计划信息!"); } @@ -1285,25 +1399,36 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] qdhsjs = queryBuilder("项目文档查询", entryNames2, entryValues2); if (qdhsjs.length>0){ - String qdhsj = qdhsjs[0].getProperty("date_released"); - incremeFZ(qdhsj); - incremeFM(qdhsj); + qdhsjTime = qdhsjs[0].getProperty("date_released"); - if (qdhsj != null && !qdhsj.isEmpty()){ - this.qdh_total_fz ++; - this.qdh_total_fm ++; - } - - ss[21] = qdhsj == null ? "" : qdhsj; + ss[21] = qdhsjTime == null ? "" : qdhsjTime; }else { System.out.println("调用项目文档查询 未查询到 项目启动会资料 的实际信息!"); } + // + if (isPresence(qdhjhTime) && isPresence(qdhsjTime)){ + System.out.println("差值》项目启动会资料计划-实际,分子分母+1"); + this.qdh_total_fz ++; + this.qdh_total_fm ++; + }else if (isPresence(qdhjhTime) && !isPresence(qdhsjTime)) { + System.out.println("差值》项目启动会资料计划,分母+1"); + this.qdh_total_fm ++; + } else if (isPresence(qdhsjTime) && !isPresence(qdhjhTime)) { + System.out.println("差值》项目启动会资料实际,分子分母+1"); + this.qdh_total_fz ++; + this.qdh_total_fm ++; + } + + //计算差值,索引-22 ss[22] = caculateDifference(ss[20], ss[21]); + incremeFZOFM(qdhjhTime,qdhsjTime,"项目启动会资料"); } //--------------------------------------------------------------------------------------------------------------------------------- if (SJSY01 != null){ System.out.println("设计施工式样书···"); + String sjjhTime = null; + String sjsjTime = null; //设计施工式样书-计划,单元格索引-23 InterfaceAIFComponent[] sjsgyss = null; InterfaceAIFComponent[] sjsgyss1 = scheduleTaskQuery1("【" + projectCodeString + "】下发设计任务书"); @@ -1317,14 +1442,13 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (sjsgyss!=null&&sjsgyss.length>0){ - String sjsgys = sjsgyss[0].getProperty("finish_date"); - incremeFM(sjsgys); + sjjhTime = sjsgyss[0].getProperty("finish_date"); - if (sjsgys != null && !sjsgys.isEmpty()){ - this.sjsg_total_fm ++; - } +// if (sjjhTime != null && !sjjhTime.isEmpty()){ +// this.sjsg_total_fm ++; +// } - ss[23] = sjsgys == null ? "" : sjsgys; + ss[23] = sjjhTime == null ? "" : sjjhTime; }else { System.out.println("调用时间表任务 未查询到 设计施工式样书 的计划信息!"); } @@ -1346,25 +1470,34 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] sjsgysjs = queryBuilder("项目文档查询", entryNames2, entryValues2); if (sjsgysjs.length>0){ - String sjsgysj = sjsgysjs[0].getProperty("date_released"); - incremeFZ(sjsgysj); - incremeFM(sjsgysj); - - if (sjsgysj != null && !sjsgysj.isEmpty()){ - this.sjsg_total_fz ++; - this.sjsg_total_fm ++; - } + sjsjTime = sjsgysjs[0].getProperty("date_released"); - ss[24] = sjsgysj == null ? "" : sjsgysj; + ss[24] = sjsjTime == null ? "" : sjsjTime; }else { System.out.println("调用项目文档查询 未查询到 设计施工式样书 的实际信息!"); } + // + if (isPresence(sjjhTime) && isPresence(sjsjTime)){ + System.out.println("差值》设计施工式样书计划-实际,分子分母+1"); + this.sjsg_total_fz ++; + this.sjsg_total_fm ++; + }else if (isPresence(sjjhTime) && !isPresence(sjsjTime)) { + System.out.println("差值》设计施工式样书计划,分母+1"); + this.sjsg_total_fm ++; + } else if (isPresence(sjsjTime) && !isPresence(sjjhTime)) { + System.out.println("差值》设计施工式样书实际,分子分母+1"); + this.sjsg_total_fz ++; + this.sjsg_total_fm ++; + } //计算差值,索引-25 ss[25] = caculateDifference(ss[23], ss[24]); + incremeFZOFM(sjjhTime,sjsjTime,"设计施工式样书"); } //--------------------------------------------------------------------------------------------------------------------------------- if (YSTZ != null){ System.out.println("设备颜色通知···"); + String sbjhTime = null; + String sbsjTime = null; //设备颜色通知-计划,单元格索引-26 InterfaceAIFComponent[] ystzjhs = null; InterfaceAIFComponent[] ystzjhs1 = scheduleTaskQuery1("【"+projectCodeString + "】设备颜色通知"); @@ -1378,14 +1511,13 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (ystzjhs!=null&&ystzjhs.length>0){ - String ystzjh = ystzjhs[0].getProperty("finish_date"); - incremeFM(ystzjh); + sbjhTime = ystzjhs[0].getProperty("finish_date"); - if (ystzjh != null && !ystzjh.isEmpty()){ - this.sbys_total_fm ++; - } +// if (sbjhTime != null && !sbjhTime.isEmpty()){ +// this.sbys_total_fm ++; +// } - ss[26] = ystzjh == null ? "" : ystzjh; + ss[26] = sbjhTime == null ? "" : sbjhTime; }else { System.out.println("调用时间表任务 未查询到 设备颜色通知 的计划信息!"); } @@ -1407,21 +1539,28 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] ystzsjs = queryBuilder("项目文档查询", entryNames2, entryValues2); if (ystzsjs.length>0){ - String ystzsj = ystzsjs[0].getProperty("date_released"); - incremeFZ(ystzsj); - incremeFM(ystzsj); + sbsjTime = ystzsjs[0].getProperty("date_released"); - if (ystzsj != null && !ystzsj.isEmpty()){ - this.sbys_total_fz ++; - this.sbys_total_fm ++; - } - - ss[27] = ystzsj == null ? "" : ystzsj; + ss[27] = sbsjTime == null ? "" : sbsjTime; }else { System.out.println("调用项目文档查询 未查询到 设备颜色通知 的实际信息!"); } + // + if (isPresence(sbjhTime) && isPresence(sbsjTime)){ + System.out.println("差值》设备颜色通知计划-实际,分子分母+1"); + this.sbys_total_fz ++; + this.sbys_total_fm ++; + }else if (isPresence(sbjhTime) && !isPresence(sbsjTime)) { + System.out.println("差值》设备颜色通知计划,分母+1"); + this.sbys_total_fm ++; + } else if (isPresence(sbsjTime) && !isPresence(sbjhTime)) { + System.out.println("差值》设备颜色通知实际,分子分母+1"); + this.sbys_total_fz ++; + this.sbys_total_fm ++; + } //计算差值,索引-28 ss[28] = caculateDifference(ss[26], ss[27]); + incremeFZOFM(sbjhTime,sbsjTime,"设备颜色通知"); } //--------------------------------------------------------------------------------------------------------------------------------- if (WWQD01 != null){ @@ -1451,11 +1590,10 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen jhNum ++; String wwqdjh0 = wwqdjhs[i].getProperty("finish_date"); wwqdjh += wwqdjh0 + ";"; - incremeFM(wwqdjh0); - if (wwqdjh0 != null && !wwqdjh0.isEmpty()){ - this.wwsp_total_fm ++; - } +// if (wwqdjh0 != null && !wwqdjh0.isEmpty()){ +// this.wwsp_total_fm ++; +// } } ss[29] = wwqdjh == null ? "" : wwqdjh; @@ -1485,23 +1623,42 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen sjNum ++; String wwqds0= wwqdsjs[i].getProperty("date_released"); wwqdsj += wwqds0 + ";"; - incremeFZ(wwqds0); - incremeFM(wwqds0); if (wwqds0 != null && !wwqds0.isEmpty()){ - this.wwsp_total_fz ++; - this.wwsp_total_fm ++; // 比较并更新最早的时间 if (earliestDate == null || isTimeEarlier(wwqds0, earliestDate)) { earliestDate = wwqds0; } } } -// String wwqdsj = wwqdsjs[0].getProperty("date_released"); ss[30] = earliestDate == null ? "" : earliestDate; }else { System.out.println("调用项目文档查询 未查询到 外委启动审批单 的实际信息!"); } + String wwJHtime = null; + String wwSJtime = null; + //处理分子分母 + if (wwqdjhs != null && wwqdjhs.length > 0){ + wwJHtime = "wwqdjh"; + } + if (wwqdsjs.length>0){ + wwSJtime = "wwqdsj"; + } + // + if (isPresence(wwJHtime) && isPresence(wwSJtime)){ + System.out.println("差值》外委启动审批单计划-实际,分子分母+1"); + this.wwsp_total_fz ++; + this.wwsp_total_fm ++; + }else if (isPresence(wwJHtime) && !isPresence(wwSJtime)) { + System.out.println("差值》外委启动审批单计划,分母+1"); + this.wwsp_total_fm ++; + } else if (isPresence(wwSJtime) && !isPresence(wwJHtime)) { + System.out.println("差值》外委启动审批单实际,分子分母+1"); + this.wwsp_total_fz ++; + this.wwsp_total_fm ++; + } + incremeFZOFM(wwJHtime,wwSJtime,"外委启动审批单"); + if (jhNum != 0 && sjNum != 0 ) { //计算差值,索引-31 System.out.println("外围启动审批单计算差值中,计划完成时间="+wwqdjhs[0].getProperty("finish_date")+",最早的实际完成时间="+earliestDate); @@ -1513,6 +1670,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } //--------------------------------------------------------------------------------------------------------------------------------- System.out.println("电器程序查询···"); + String dqjhTime = null; + String dqsjTime = null; //电器程序-计划and实际,单元格索引-32and33 InterfaceAIFComponent[] dqcxs = null; InterfaceAIFComponent[] dqcxs1 = scheduleTaskQuery1("【" + projectCodeString + "】电气程序编写"); @@ -1526,30 +1685,38 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (dqcxs!=null&&dqcxs.length>0){ - String dqcxjh = dqcxs[0].getProperty("finish_date"); - incremeFM(dqcxjh); + dqjhTime = dqcxs[0].getProperty("finish_date"); - if (dqcxjh != null && !dqcxjh.isEmpty()){ - this.elec_total_fm ++; - } - ss[32] = dqcxjh == null ? "" : dqcxjh; - - String dqcxsj = dqcxs[0].getProperty("actual_finish_date"); - incremeFZ(dqcxsj); - incremeFM(dqcxsj); - - if (dqcxsj != null && !dqcxsj.isEmpty()){ - this.elec_total_fz ++; - this.elec_total_fm ++; - } - - ss[33] = dqcxsj == null ? "" : dqcxsj; - } +// if (dqjhTime != null && !dqjhTime.isEmpty()){ +// this.elec_total_fm ++; +// } + ss[32] = dqjhTime == null ? "" : dqjhTime; + + dqsjTime = dqcxs[0].getProperty("actual_finish_date"); + + ss[33] = dqsjTime == null ? "" : dqsjTime; + } + // + if (isPresence(dqjhTime) && isPresence(dqsjTime)){ + System.out.println("差值》电器程序编写计划-实际,分子分母+1"); + this.elec_total_fz ++; + this.elec_total_fm ++; + }else if (isPresence(dqjhTime) && !isPresence(dqsjTime)) { + System.out.println("差值》电器程序编写计划,分母+1"); + this.elec_total_fm ++; + } else if (isPresence(dqsjTime) && !isPresence(dqjhTime)) { + System.out.println("差值》电器程序编写实际,分子分母+1"); + this.elec_total_fz ++; + this.elec_total_fm ++; + } + incremeFZOFM(dqjhTime,dqsjTime,"电器程序编写"); //计算差值,索引-34 ss[34] = caculateDifference(ss[32], ss[33]); //--------------------------------------------------------------------------------------------------------------------------------- if (JDHZL01 != null){ System.out.println("交底会查询···"); + String jdhjhTime = null; + String jdhsjTime = null; //交底会-计划,单元格索引-35 InterfaceAIFComponent[] jdhjhs = null; InterfaceAIFComponent[] jdhjhs1 = scheduleTaskQuery1("【" + projectCodeString + "】交底会(有交付物)"); @@ -1563,14 +1730,13 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (jdhjhs!=null&&jdhjhs.length>0){ - String jdhjh = jdhjhs[0].getProperty("finish_date"); - incremeFM(jdhjh); + jdhjhTime = jdhjhs[0].getProperty("finish_date"); - if (jdhjh != null && !jdhjh.isEmpty()){ - this.jdh_total_fm ++; - } +// if (jdhjhTime != null && !jdhjhTime.isEmpty()){ +// this.jdh_total_fm ++; +// } - ss[35] = jdhjh == null ? "" : jdhjh; + ss[35] = jdhjhTime == null ? "" : jdhjhTime; }else { System.out.println("调用时间表任务 未查询到 交底会 的计划信息!"); } @@ -1592,21 +1758,28 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] jdhsjs = queryBuilder("项目文档查询", entryNames2, entryValues2); if (jdhsjs.length>0){ - String jdhsj = jdhsjs[0].getProperty("date_released"); - incremeFZ(jdhsj); - incremeFM(jdhsj); - - if (jdhsj != null && !jdhsj.isEmpty()){ - this.jdh_total_fz ++; - this.jdh_total_fm ++; - } + jdhsjTime = jdhsjs[0].getProperty("date_released"); - ss[36] = jdhsj == null ? "" : jdhsj; + ss[36] = jdhsjTime == null ? "" : jdhsjTime; }else { System.out.println("调用项目文档查询 未查询到 交底会 的实际信息!"); } + // + if (isPresence(jdhjhTime) && isPresence(jdhsjTime)){ + System.out.println("差值》交底会计划-实际,分子分母+1"); + this.jdh_total_fz ++; + this.jdh_total_fm ++; + }else if (isPresence(jdhjhTime) && !isPresence(jdhsjTime)) { + System.out.println("差值》交底会计划,分母+1"); + this.jdh_total_fm ++; + } else if (isPresence(jdhsjTime) && !isPresence(jdhjhTime)) { + System.out.println("差值》交底会计算实际,分子分母+1"); + this.jdh_total_fz ++; + this.jdh_total_fm ++; + } //计算差值,索引-37 ss[37] = caculateDifference(ss[35], ss[36]); + incremeFZOFM(jdhjhTime,jdhsjTime,"交底会"); } //--------------------------------------------------------------------------------------------------------------------------------- System.out.println("采购单查询···"); @@ -1629,13 +1802,11 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen for (int i = 0; i < cgdjhs.length; i++) { String cgdjh0= cgdjhs[i].getProperty("finish_date"); cgdjh += cgdjh0 + ";"; - incremeFM(cgdjh0); - if (cgdjh0 != null && !cgdjh0.isEmpty()){ - this.cg_total_fm ++; - } +// if (cgdjh0 != null && !cgdjh0.isEmpty()){ +// this.cg_total_fm ++; +// } } -// String cgdjh = cgdjhs[0].getProperty("finish_date"); ss[38] = cgdjh == null ? "" : cgdjh; }else { System.out.println("调用时间表任务 未查询到 采购单 的计划信息!"); @@ -1663,12 +1834,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen for (int i = 0; i < cgdsjs.length; i++){ String cgdsj0= cgdsjs[i].getProperty("date_released"); cgdsj += cgdsj0 + ";"; - incremeFZ(cgdsj0); - incremeFM(cgdsj0); if (cgdsj0 != null && !cgdsj0.isEmpty()){ - this.cg_total_fz ++; - this.cg_total_fm ++; // 比较并更新最早的时间 if (earliestDate1 == null || isTimeEarlier(cgdsj0, earliestDate1)) { earliestDate1 = cgdsj0; @@ -1680,6 +1847,29 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen }else { System.out.println("调用项目文档查询 未查询到 采购单 的实际信息!"); } + String cgdjhTime = null; + String cgdsjTime = null; + if (cgdjhs != null && cgdjhs.length > 0){ + cgdjhTime = "cgdjh"; + } + if (cgdsjs != null && cgdsjs.length > 0){ + cgdsjTime = "cgdsj"; + } + // + if (isPresence(cgdjhTime) && isPresence(cgdsjTime)){ + System.out.println("差值》采购单 计划-实际,分子分母+1"); + this.cg_total_fz ++; + this.cg_total_fm ++; + }else if (isPresence(cgdjhTime) && !isPresence(cgdsjTime)) { + System.out.println("差值》采购单 计划,分母+1"); + this.cg_total_fm ++; + } else if (isPresence(cgdsjTime) && !isPresence(cgdjhTime)) { + System.out.println("差值》采购单 计算实际,分子分母+1"); + this.cg_total_fz ++; + this.cg_total_fm ++; + } + incremeFZOFM(cgdjhTime, cgdsjTime, "采购单"); + //计算差值,索引-40 if (cgdjhs != null && cgdjhs.length > 0 && cgdsjs != null && cgdsjs.length > 0 ) { System.out.println("采购单差值的计划完成时间="+cgdjhs[0].getProperty("finish_date")+",最早的实际完成时间="+earliestDate1); @@ -1710,9 +1900,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] jsxys = queryBuilder("项目文档查询", entryNamesJSXY, entryValuesJSXY); if (jsxys.length>0){ String jsxy = jsxys[0].getProperty("date_released"); - incremeFZ(jsxy); - incremeFM(jsxy); - this.fm ++; + incremeFZOFMForOnlySJ(jsxy,"技术协议"); + ss[41] = jsxy == null ? "" : jsxy; }else { System.out.println("调用项目文档查询 未查询到 技术协议 的信息!"); @@ -1739,9 +1928,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] yysbgs = queryBuilder("项目文档查询", entryNamesYYSBG, entryValuesYYSBG); if (yysbgs.length>0){ String yysbg = yysbgs[0].getProperty("date_released"); - incremeFZ(yysbg); - incremeFM(yysbg); - this.fm ++; + incremeFZOFMForOnlySJ(yysbg,"预验收报告"); ss[42] = yysbg == null ? "" : yysbg; }else { System.out.println("调用项目文档查询 未查询到 预验收报告 的信息!"); @@ -1768,9 +1955,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] zysds = queryBuilder("项目文档查询", entryNamesZYSD, entryValuesZYSD); if (zysds.length>0){ String zysd = zysds[0].getProperty("date_released"); - incremeFZ(zysd); - incremeFM(zysd); - this.fm ++; + incremeFZOFMForOnlySJ(zysd,"终验收单"); ss[43] = zysd == null ? "" : zysd; }else { System.out.println("调用项目文档查询 未查询到 终验收单 的信息!"); @@ -1797,8 +1982,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] xmqdtzs = queryBuilder("项目文档查询", entryNamesXMQDTZ, entryValuesXMQDTZ); if (xmqdtzs.length>0){ String xmqdtz = xmqdtzs[0].getProperty("date_released"); - incremeFZ(xmqdtz); - incremeFM(xmqdtz); + incremeFZOFMForOnlySJ(xmqdtz,"项目启动通知"); ss[44] = xmqdtz == null ? "" : xmqdtz; }else { System.out.println("调用项目文档查询 未查询到 项目启动通知 的信息!"); @@ -1823,27 +2007,11 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen InterfaceAIFComponent[] xmjdjhs1 = queryBuilder("时间表任务查询", entryNamesXMJDJH, entryValuesXMJDJH); -// List entryNamesXMJDJH1 = new ArrayList(); -// List entryValuesXMJDJH1 = new ArrayList(); -// entryNamesXMJDJH1.add("名称"); -// entryNamesXMJDJH1.add("任务类型"); -// entryValuesXMJDJH1.add(projectCodeString + "*"); -// entryValuesXMJDJH1.add("6"); -// InterfaceAIFComponent[] xmjdjhs2 = queryBuilder("时间表任务查询", entryNamesXMJDJH1, entryValuesXMJDJH1); - -// if (xmjdjhs1.length>0){ - xmjdjhs = xmjdjhs1.clone(); -// } else if (xmjdjhs2.length > 0) { -// xmjdjhs = xmjdjhs2.clone(); -// } else { -// System.out.println("调用时间表任务查询 未查询到 项目进度计划任务 的信息!"); -// } - + xmjdjhs = xmjdjhs1.clone(); if (xmjdjhs != null && xmjdjhs.length>0){ - String xmjdjh = xmjdjhs[0].getProperty("actual_finish_date"); - incremeFZ(xmjdjh); - incremeFM(xmjdjh); + String xmjdjh = xmjdjhs[0].getProperty("actual_start_date"); + incremeFZOFMForOnlySJ(xmjdjh,"项目进度计划任务"); ss[45] = xmjdjh == null ? "" : xmjdjh; }else { System.out.println("调用时间表任务查询 未查询到 项目进度计划任务 的信息!"); @@ -1890,13 +2058,8 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (vmdtjh!=null&&vmdtjh.length>0){ String vmdtjhs = vmdtjh[0].getProperty("finish_date"); - incremeFM(vmdtjhs); ss[46] = vmdtjhs == null ? "" : vmdtjhs;//虚拟调试完成时间-计划 -// String vmdtsjString = vmdts[0].getProperty("actual_finish_date"); -// incremeFZ(vmdtsjString); -// incremeFM(vmdtsjString); -// ss[47] = vmdtsjString == null ? "" : vmdtsjString;//虚拟调试完成时间-实际 }else { System.out.println("调用时间表任务查询 未查询到 虚拟调试完成时间 的计划and实际信息!"); } @@ -1914,10 +2077,18 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (xnsjs!=null&&xnsjs.length>0){ String vmdtsjString = xnsjs[0].getProperty("actual_finish_date"); - incremeFZ(vmdtsjString); - incremeFM(vmdtsjString); ss[47] = vmdtsjString == null ? "" : vmdtsjString;//虚拟调试完成时间-实际 } + //分子分母处理 + String xnjhTime = null; + String xnsjTime = null; + if (vmdtjh!=null&&vmdtjh.length>0){ + xnjhTime = "xnjh"; + } + if (xnsjs!=null&&xnsjs.length>0){ + xnsjTime = "xnsj"; + } + incremeFZOFM(xnjhTime,xnsjTime,"虚拟调用"); //---------------------------------------------------------------------------------------------------------------------------------- System.out.println("三维审核时间查询···"); @@ -1935,13 +2106,9 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen if (ths!=null&&ths.length>0){ String thjh = ths[0].getProperty("finish_date"); - incremeFM(thjh); +// incremeFM(thjh); ss[48] = thjh == null ? "" : thjh;//三维审核时间-计划 - -// String thsj = ths[0].getProperty("actual_finish_date"); -// incremeFZ(thsj); -// incremeFM(thsj); -// ss[49] = thsj == null ? "" : thsj; + }else { System.out.println("调用时间表任务查询 未查询到 三维审核时间 的计划and实际信息!"); } @@ -1957,10 +2124,20 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (thsj!=null&&thsj.length>0){ String thsjs = thsj[0].getProperty("actual_finish_date"); - incremeFZ(thsjs); - incremeFM(thsjs); +// incremeFZ(thsjs); +// incremeFM(thsjs); ss[49] = thsjs == null ? "" : thsjs;//三维审核时间-实际 } + //处理分子分母 + String thjhTime = null; + String thsjTime = null; + if (ths != null && ths.length > 0){ + thjhTime = "thjh"; + } + if (thsj != null && thsj.length > 0){ + thsjTime = "thsj"; + } + incremeFZOFM(thjhTime,thsjTime,"三维审核"); //---------------------------------------------------------------------------------------------------------------------------------- System.out.println("预制线缆表交付查询···"); @@ -1977,7 +2154,7 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen if (yzsComponents!=null&&yzsComponents.length>0){ String yzjh = yzsComponents[0].getProperty("finish_date"); - incremeFM(yzjh); +// incremeFM(yzjh); ss[50] = yzjh == null ? "" : yzjh;//预制线缆表交付-计划 }else { @@ -1995,17 +2172,27 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } if (yzxsjComponents!=null&&yzxsjComponents.length>0){ String yzsj = yzxsjComponents[0].getProperty("actual_finish_date"); - incremeFZ(yzsj); - incremeFM(yzsj); +// incremeFZ(yzsj); +// incremeFM(yzsj); ss[51] = yzsj == null ? "" : yzsj; } + //处理分子分母 + String yzjhTime = null; + String yzxsjTime = null; + if (yzsComponents != null && yzsComponents.length > 0){ + yzjhTime = "yzjh"; + } + if (yzxsjComponents != null && yzxsjComponents.length > 0){ + yzxsjTime = "yzxsj"; + } + incremeFZOFM(yzjhTime,yzxsjTime,"预制线缆表交付"); //---------------------------------------------------------------------------------------------------------------------------------- System.out.println("每个项目的系统资料完成百分比查询···分子="+this.fz+",分母="+this.fm); double percentage = (double) this.fz / this.fm * 100; - System.out.println("每个项目的系统资料完成百分比查询="+percentage); String fb = String.format("%.2f", percentage); ss[52] = fb + "%"; + System.out.println("每个项目的系统资料完成百分比查询="+ss[52]); //将每个项目的系统资料完成百分比的分子分母有效值,累加保存,用于计算“查询资料的总完成百分比” this.tcpodi_fz += this.fz; @@ -2047,13 +2234,19 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen /** * 导出Excel.xlsx文件 - * @param finalDataList + * @param finalDataList 要导出的数据集合 * @param outputPath * @throws TCException * @throws Exception * */ public boolean exportExcel(String outputPath, List finalDataList) throws TCException { + System.out.println("最终导出数据条数="+finalDataList.size()); + int tg = 0; + for (String[] ss : finalDataList){ + System.out.println("第"+tg+"条数据的数据个数="+ss.length); + tg ++; + } File fmsFile = null; //1.获取模板文件 TCComponent stringToComponent = session.stringToComponent("wHkdr3SyY$uSgD"); @@ -2083,6 +2276,26 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen Sheet sheet = workbook.getSheetAt(0); //获取标题行 Row titleRow = sheet.getRow(0); + System.out.println("开始处理标题行的单项完成百分比!"); + //更新标题行-单项完成百分比 + for(Entry entry : percentageColumnIndexMap.entrySet()){ + Integer key = entry.getKey(); + String value = entry.getValue(); + System.out.println("标题行索引="+key+",对应的内容="+value); + + DataFormatter dataFormatter = new DataFormatter(); + String cellValue = dataFormatter.formatCellValue(titleRow.getCell(key)); + System.out.println("获取到标题行中单项完成百分比的值(模板值)"+cellValue); + String[] split = cellValue.split("="); + if (split.length == 1){ + System.out.println("格式正确!"); + if (split[0].equals("差值/单项完成百分比")){ + System.out.println("匹配!"); + titleRow.getCell(key).setCellValue(value); + } + } + } + // String stringCellValue = titleRow.getCell(???).getStringCellValue(); // 从第几行开始写入数据(假设从第 2 行开始) @@ -2115,78 +2328,11 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen } catch (IOException e) { e.printStackTrace(); } finally { -// try { -// if (fis != null) fis.close(); -// if (workbook != null) workbook.close(); // 手动关闭 Workbook -// if (fos != null) fos.close(); -// } catch (IOException e) { -// e.printStackTrace(); -// } + } } return true; } - - - -// public boolean exportExcel(String outputPath, List finalDataList) { -// System.out.println("exportExcel~outputPath="+outputPath+",导出数据条数="+(finalDataList.size()-1)); -// // 校验输出文件是否已经存在,如果存在则删除 -// File file = new File(outputPath); -// if (file.exists()) { -// if (file.delete()) { -// System.out.println("旧文件已成功删除!"); -// } else { -// System.out.println("无法删除旧文件!"); -// return false; -// } -// } -// // 创建一个新的工作簿和工作表 -// Workbook workbook = new HSSFWorkbook(); -// try { -// Sheet sheet = workbook.createSheet("SheetName"); -// // 写入首行列名称 -// Row headerRow = sheet.createRow(0); -// String[] header = columnNames; -// for (int i = 0; i < columnNum; i++) { -// Cell cell = headerRow.createCell(i); -// cell.setCellValue(header[i]); -// } -// // 写入行数据 -//// int rowNum = 1; -// for (int i = 0; i < finalDataList.size(); i++) { -// Row row = sheet.createRow(i+1);//因为首行已经作为标题行了,所以创建行时要+1 -// String[] rowdata = finalDataList.get(i);//逐行取出查到的每行数据 -// for (int i1 = 0; i1 < columnNum; i1++) { -// Cell cell = row.createCell(i1); -// cell.setCellValue(rowdata[i1]); -// } -// } -// // 自动调整列宽 -// for (int i = 0; i < finalDataList.get(0).length; i++) { -// sheet.autoSizeColumn(i); -// } -// // 将工作簿写入文件 -// try (FileOutputStream fileOut = new FileOutputStream(outputPath)) { -// workbook.write(fileOut); -// } catch (IOException e) { -// e.printStackTrace(); -// MessageBox.post("导出文件失败!","错误",MessageBox.INFORMATION); -// return false; -// } -// } catch (Exception e) { -// // TODO: handle exception -// e.printStackTrace(); -// return false; -// } finally { -// if (workbook != null) { -// } -// } -// -// MessageBox.post("Excel 文件导出成功!","提示",MessageBox.INFORMATION); -// System.out.println("Excel 文件已成功创建!"); -// return true; -// } /** @@ -2194,6 +2340,9 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen */ public String caculateTcpodi(int fz1,int fm1){ System.out.println("caculateTcpodi~入参分子="+fz1+",入参分母="+fm1); + if (fm1 == 0 && fz1 == 0){ + return "0.00%"; + } double percentage = (double) fz1 / fm1 * 100; String fb = String.format("%.2f", percentage); String s = fb + "%"; @@ -2234,6 +2383,20 @@ public class SystemDataDistributionDialog extends JFrame implements ActionListen newColumnNames[40] = "差值/单项完成百分比="+cgd_dxbfb;//采购单 this.model.setColumnIdentifiers(newColumnNames);//更新表头,增加‘单项完成百分比’ setColumnWidth(); + percentageColumnIndexMap = new HashMap(); + percentageColumnIndexMap.put(10, newColumnNames[10]); + percentageColumnIndexMap.put(13, newColumnNames[13]); + percentageColumnIndexMap.put(16, newColumnNames[16]); + percentageColumnIndexMap.put(19, newColumnNames[19]); + percentageColumnIndexMap.put(22, newColumnNames[22]); + percentageColumnIndexMap.put(25, newColumnNames[25]); + percentageColumnIndexMap.put(28, newColumnNames[28]); + percentageColumnIndexMap.put(31, newColumnNames[31]); + percentageColumnIndexMap.put(34, newColumnNames[34]); + percentageColumnIndexMap.put(37, newColumnNames[37]); + percentageColumnIndexMap.put(40, newColumnNames[40]); + System.out.println("resetHeader~更新表头成功!"); + } /**