| | |
| | | } |
| | | |
| | | private List<Map<String, Object>> buildFaultDuration(List<WrkAnalysis> list) { |
| | | Map<String, Long> durationMap = new LinkedHashMap<>(); |
| | | for (WrkAnalysis item : list) { |
| | | addDeviceFaultDuration(durationMap, "单堆垛机", item.getCrnNo(), item.getCrnFaultDurationMs()); |
| | | addDeviceFaultDuration(durationMap, "双工位堆垛机", item.getDualCrnNo(), item.getDualCrnFaultDurationMs()); |
| | | addDeviceFaultDuration(durationMap, "RGV", item.getRgvNo(), item.getRgvFaultDurationMs()); |
| | | } |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | result.add(slice("单堆垛机", list.stream().map(WrkAnalysis::getCrnFaultDurationMs).filter(Objects::nonNull).reduce(0L, Long::sum))); |
| | | result.add(slice("双工位堆垛机", list.stream().map(WrkAnalysis::getDualCrnFaultDurationMs).filter(Objects::nonNull).reduce(0L, Long::sum))); |
| | | result.add(slice("RGV", list.stream().map(WrkAnalysis::getRgvFaultDurationMs).filter(Objects::nonNull).reduce(0L, Long::sum))); |
| | | durationMap.forEach((name, durationMs) -> result.add(slice(name, durationMs))); |
| | | return result; |
| | | } |
| | | |
| | | private void addDeviceFaultDuration(Map<String, Long> durationMap, String deviceLabel, Integer deviceNo, Long durationMs) { |
| | | long value = defaultLong(durationMs); |
| | | if (value <= 0L) { |
| | | return; |
| | | } |
| | | String key = deviceNo == null ? deviceLabel : deviceLabel + deviceNo; |
| | | durationMap.merge(key, value, Long::sum); |
| | | } |
| | | |
| | | private List<Map<String, Object>> buildDetailRows(List<WrkAnalysis> list) { |
| | | return list.stream().map(this::toDetailItem).collect(Collectors.toList()); |
| | | } |
| | |
| | | } |
| | | }, |
| | | legend: { data: ["站点耗时", "堆垛机耗时", "总耗时"] }, |
| | | grid: { left: 50, right: 20, top: 40, bottom: 70 }, |
| | | grid: { left: 88, right: 20, top: 40, bottom: 70, containLabel: true }, |
| | | xAxis: { |
| | | type: "category", |
| | | data: rows.map(function (item) { return String(item.wrkNo); }), |
| | |
| | | } |
| | | }, |
| | | legend: { data: ["平均总耗时", "平均站点耗时", "平均堆垛机耗时"] }, |
| | | grid: { left: 50, right: 20, top: 40, bottom: 70 }, |
| | | grid: { left: 88, right: 20, top: 40, bottom: 70, containLabel: true }, |
| | | xAxis: { |
| | | type: "category", |
| | | data: rows.map(function (item) { return item.bucketLabel; }), |
| | |
| | | return lines.join("<br>"); |
| | | } |
| | | }, |
| | | grid: { left: 50, right: 20, top: 20, bottom: 40 }, |
| | | grid: { left: 88, right: 20, top: 20, bottom: 68, containLabel: true }, |
| | | xAxis: { |
| | | type: "category", |
| | | data: rows.map(function (item) { return item.name; }) |
| | | data: rows.map(function (item) { return item.name; }), |
| | | axisLabel: { |
| | | interval: 0, |
| | | rotate: rows.length > 6 ? 30 : 0 |
| | | } |
| | | }, |
| | | yAxis: { |
| | | type: "value", |