|
@@ -75,7 +75,11 @@ public class BrokenYarnExportServiceImpl {
|
|
|
|
|
|
cell = sheet.getRow(2).getCell(1);
|
|
|
cell.setCellValue(openDevices);
|
|
|
- BigDecimal avgOpenTimes = totOpenTimes.divide(BigDecimal.valueOf(openDevices), 0, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal avgOpenTimes = BigDecimal.ZERO;
|
|
|
+ if (openDevices > 0) {
|
|
|
+ avgOpenTimes = totOpenTimes.divide(BigDecimal.valueOf(openDevices), 0, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
|
|
|
cell = sheet.getRow(3).getCell(1);
|
|
|
cell.setCellValue(Tools.convertHMS(totOpenTimes.longValue()));
|
|
@@ -158,10 +162,10 @@ public class BrokenYarnExportServiceImpl {
|
|
|
int[] pos = {0, 10, 5, 30};
|
|
|
int[] data = {2, 8, 3, 3};
|
|
|
int[] xdata = {2, 8, 0, 0};
|
|
|
- drawBar(sheet, "停机次数占比", "停机原因", pos, xdata, data,BarDirection.BAR);
|
|
|
+ drawBar(sheet, "停机次数占比", "停机原因", pos, xdata, data, BarDirection.BAR);
|
|
|
int[] pos1 = {6, 10, 16, 30};
|
|
|
int[] data1 = {2, 8, 4, 4};
|
|
|
- drawBar(sheet, "停机时长占比", "停机原因", pos1, xdata, data1,BarDirection.BAR);
|
|
|
+ drawBar(sheet, "停机时长占比", "停机原因", pos1, xdata, data1, BarDirection.BAR);
|
|
|
|
|
|
brokenYarn(wb, yarnStopList, stopTime[1], stopList.size());
|
|
|
yarn(wb, yarnStopList, dateStyle, timeStyle, p2);
|
|
@@ -226,7 +230,7 @@ public class BrokenYarnExportServiceImpl {
|
|
|
int[] pos = {10, 2, 16, rn};
|
|
|
int[] data = {2, rn, 1, 1};
|
|
|
int[] xdata = {2, rn, 0, 0};
|
|
|
- drawBar(sheet, "断纱停机周TOP", "设备名称", pos, xdata, data,BarDirection.BAR);
|
|
|
+ drawBar(sheet, "断纱停机周TOP", "设备名称", pos, xdata, data, BarDirection.BAR);
|
|
|
drawTopLine(sheet, rn);
|
|
|
}
|
|
|
|
|
@@ -332,7 +336,7 @@ public class BrokenYarnExportServiceImpl {
|
|
|
chart.plot(data);
|
|
|
}
|
|
|
|
|
|
- public void drawBar(XSSFSheet sheet, String title, String xTitle, int[] pos, int[] xdata, int[] data,BarDirection barDirection) {
|
|
|
+ public void drawBar(XSSFSheet sheet, String title, String xTitle, int[] pos, int[] xdata, int[] data, BarDirection barDirection) {
|
|
|
// 创建一个画布
|
|
|
XSSFDrawing drawing = sheet.createDrawingPatriarch();
|
|
|
// 前四个默认0,[0,5]:从0列5行开始;[7,26]:到7列26行结束
|