| | |
| | | String excelName = "FBX-"+nowFormat; |
| | | HSSFWorkbook wb = new HSSFWorkbook(); |
| | | |
| | | HSSFSheet sheet = wb.createSheet("数据总览"); |
| | | HSSFSheet sheet = wb.createSheet("数据总表"); |
| | | |
| | | //图片元素 |
| | | HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); |
| | |
| | | |
| | | int rowNumSheet = 0; |
| | | FboDataHeadStart start = fboDataInf.fboDataStart; |
| | | FboDataHeadStop stop = fboDataInf.fboDataStop; |
| | | sheet.createRow(rowNumSheet); |
| | | sheet.getRow(rowNumSheet).createCell(0).setCellValue("电池组名称:"+start.battNameStr); |
| | | sheet.getRow(rowNumSheet).createCell(1).setCellValue("电池品牌:"+start.battBrandStr); |
| | | rowNumSheet++; |
| | | sheet.createRow(rowNumSheet); |
| | | sheet.getRow(rowNumSheet).createCell(0).setCellValue("电池品牌:"+start.battBrandStr); |
| | | sheet.getRow(rowNumSheet).createCell(1).setCellValue("安装日期:"+start.batt_date_str); |
| | | sheet.getRow(rowNumSheet).createCell(2).setCellValue("单体数量:"+start.batt_mon_num); |
| | | |
| | | sheet.getRow(rowNumSheet).createCell(0).setCellValue("安装日期:"+start.batt_date_str); |
| | | sheet.getRow(rowNumSheet).createCell(1).setCellValue("单体数量:"+start.batt_mon_num); |
| | | rowNumSheet++; |
| | | sheet.createRow(rowNumSheet); |
| | | //sheet.getRow(rowNumSheet).createCell(0).setCellValue("电池品牌:"+formartDate(,"yyyy-MM-dd")); |
| | | //sheet.getRow(rowNumSheet).createCell(1).setCellValue("安装日期:"+start.batt_date_str); |
| | | //sheet.getRow(rowNumSheet).createCell(2).setCellValue("单体数量:"+start.batt_mon_num); |
| | | sheet.getRow(rowNumSheet).createCell(0).setCellValue("测试开始时间:"+formartDate(start.testStartTime,"yyyy-MM-dd")); |
| | | sheet.getRow(rowNumSheet).createCell(1).setCellValue("测试时长:"+stop.TestTimeLong.hms()); |
| | | rowNumSheet++; |
| | | sheet.createRow(rowNumSheet); |
| | | sheet.getRow(rowNumSheet).createCell(0).setCellValue("正极绝缘电阻:"+list.get(list.size()-1).PosInsRes); |
| | | sheet.getRow(rowNumSheet).createCell(1).setCellValue("负极绝缘电阻:"+list.get(list.size()-1).NegInsRes); |
| | | if(start.DataType==0xFD){ |
| | | sheet.getRow(rowNumSheet).createCell(2).setCellValue("预估实际容量:"+list.get(list.size()-1).actualCap); |
| | | } |
| | | rowNumSheet+=2; |
| | | //插入图片 |
| | | int picNum = 0; |
| | |
| | | |
| | | |
| | | //属性栏 |
| | | String[] rowName = {"测试时间","总电压","测试容量","实际容量"}; |
| | | String[] rowName = getRowName(start.DataType); |
| | | HSSFRow row = sheet1.createRow(rowNum); |
| | | for (int i=0;i<rowName.length;i++){ |
| | | row.createCell(i).setCellValue(rowName[i]); |
| | | } |
| | | //row.createCell(0).setCellValue("测试时间"); //创建单元格 |
| | | //row.createCell(1).setCellValue("总电压"); |
| | | //row.createCell(2).setCellValue("测试容量"); |
| | | //row.createCell(3).setCellValue("剩余容量"); |
| | | for(int i=0;i<list.get(0).SingleVol.length;i++){ |
| | | row.createCell(rowName.length+i).setCellValue("#"+Integer.valueOf(i+1)); |
| | | } |
| | |
| | | FboData fbo=list.get(i); |
| | | sheet1.getRow(rowNum).createCell(0).setCellValue(fbo.m_TestTime.hms()); |
| | | sheet1.getRow(rowNum).createCell(1).setCellValue(fbo.SumVoltage); |
| | | sheet1.getRow(rowNum).createCell(2).setCellValue(fbo.testCap); |
| | | sheet1.getRow(rowNum).createCell(2).setCellValue(fbo.SumCurrent); |
| | | sheet1.getRow(rowNum).createCell(3).setCellValue(fbo.actualCap); |
| | | sheet1.getRow(rowNum).createCell(4).setCellValue(fbo.Temp_Envi); |
| | | sheet1.getRow(rowNum).createCell(5).setCellValue(fbo.Humi_Envi); |
| | | if (start.DataType!=0xFB){ |
| | | sheet1.getRow(rowNum).createCell(6).setCellValue(fbo.testCap); |
| | | } |
| | | for (int k = 0;k<list.get(0).SingleVol.length;k++){ |
| | | sheet1.getRow(rowNum).createCell(4+k).setCellValue(fbo.SingleVol[k]); |
| | | sheet1.getRow(rowNum).createCell(rowName.length+k).setCellValue(fbo.SingleVol[k]); |
| | | } |
| | | rowNum++; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public String[] getRowName(int dateType){ |
| | | if (dateType==0xFB){ |
| | | String[] rowName = {"测试时间","总电压","总电流","实际容量","环境温度","环境湿度"}; |
| | | return rowName; |
| | | }else{ |
| | | String[] rowName1 = {"测试时间","总电压","总电流","实际容量","环境温度","环境湿度","测试容量"}; |
| | | return rowName1; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将日期格式转换成指定的字符串格式 |
| | |
| | | * @param str 字符串的格式 |
| | | * @return |
| | | */ |
| | | public String formartDate(Date date, String str){ |
| | | public static String formartDate(Date date, String str){ |
| | | return new SimpleDateFormat(str).format(date); |
| | | } |
| | | |