| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | // 定义该功能使用数据源为南通的工厂 |
| | | final String plant = "FORTUNA"; |
| | | |
| | | final String major="钣金"; |
| | | // 查询相关数据 |
| | | ApsPlatePlan platePlan = new ApsPlatePlan(); |
| | | platePlan.setPlant(plant); |
| | |
| | | |
| | | ApsStandardProcess process = new ApsStandardProcess(); |
| | | process.setPlant(plant); |
| | | process.setMajor(major); |
| | | List<ApsStandardProcess> shopProcesses = standardProcessMapper.selectApsStandardProcessList(process); |
| | | if (planList.isEmpty() || shopList.isEmpty() || shopProcesses.isEmpty()) { |
| | | log.warn("计划列表、车间列表或工序列表为空,无法生成统计信息"); |
| | |
| | | planEndDayTitle.setCellValue("计划完工日"); |
| | | planEndDayTitle.setCellStyle(title); |
| | | |
| | | |
| | | |
| | | |
| | | for (int i = 0; i < shopNames.size(); i++) { |
| | | String shopName = shopNames.get(i); |
| | | SXSSFCell beginDateCell = rowTitle.createCell(i * 2 + 11); |
| | |
| | | beginDateCell.setCellStyle(title); |
| | | endDateCell.setCellStyle(title); |
| | | } |
| | | |
| | | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (int i = 0; i < table.size(); i++) { |
| | | ApsPlateProcessShopPlanStat plan = table.get(i); |
| | | /*创建数据行*/ |
| | | |
| | | SXSSFRow dataRow = sheet.createRow(i+1); |
| | | |
| | | SXSSFCell mainPartNumberCell = dataRow.createCell(0); |
| | | mainPartNumberTitle.setCellValue(plan.getMainPartNumber()); |
| | | //mainPartNumberTitle.setCellStyle(title); |
| | | mainPartNumberCell.setCellValue(plan.getMainPartNumber()); |
| | | |
| | | //mainPartNumberCell.setCellStyle(title); |
| | | |
| | | SXSSFCell businessTypeCell= dataRow.createCell(1); |
| | | businessTypeCell.setCellValue(plan.getBusinessType()); |
| | |
| | | // productionQuantityCell.setCellStyle(title); |
| | | |
| | | SXSSFCell planEndDayCell = dataRow.createCell(10); |
| | | planEndDayCell.setCellValue(plan.getPlanEndDay()); |
| | | planEndDayCell.setCellValue(dateFormat.format(plan.getPlanEndDay())); |
| | | // planEndDayCell.setCellStyle(title); |
| | | |
| | | for (int j = 0; j< shopNames.size(); j++) { |
| | | String shopName = shopNames.get(j); |
| | | SXSSFCell beginDateCell = dataRow.createCell(j * 2 + 11); |
| | | SXSSFCell endDateCell = dataRow.createCell(j * 2 + 12); |
| | | plan.getDeptPlans().stream().filter(x->x.getShopName().equals(shopName)).findFirst().ifPresent(x->{ |
| | | beginDateCell.setCellValue(x.getPlanStartDate()); |
| | | endDateCell.setCellValue(x.getPlanEndDate()); |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | for (int i = 0; i < 24; i++) { |
| | | |
| | | sheet.setColumnWidth(i, 20 * 256); |
| | | } |
| | | |
| | | wb.write(response.getOutputStream()); |
| | | } |
| | | catch (Exception e) |
| | |
| | | style.setFont(titleFont); |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | |
| | | |
| | | |
| | | |
| | | styles.put("title", style); |
| | | return styles; |
| | | } |