44991 产线看板问题(10点正以后才能看到8-9点的报工数据)

tags/yfai-mes-ext-v2.9
logic.fang 3 months ago
parent bf114910e2
commit cf1c76b57e

@ -528,34 +528,43 @@ public class IMesYfBoardServiceImpl implements IMesYfBoardService {
Map<String, Map<String, String>> timeZoneMap = new LinkedHashMap<>();
DateTimeFormatter hourFormatter = DateTimeFormatter.ofPattern("HH");
DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd ");
// //时间节点计算测试
// String dateStr = "2025-02-08 09:30:00";
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// LocalDateTime nowTime = LocalDateTime.parse(dateStr, formatter);
LocalDateTime nowTime = LocalDateTime.now();
String nowDay = dayFormatter.format(nowTime);
String startTime;
String endTime;
String key;
for (int i = 0; i < designatedQuantity; i++) {
Map<String, String> zoneMap = new HashMap<>();
String startTimeDay;
String endTimeDay;
if (i == 0) {
//第一个区段获取当前时间所在的小时区间
startTime = hourFormatter.format(nowTime.minusHours(i)) + ":00";
startTimeDay = dayFormatter.format(nowTime.minusHours(i));
endTime = hourFormatter.format(nowTime.plusHours(1)) + ":00";
endTimeDay = dayFormatter.format(nowTime.plusHours(i));
}else {
startTime = hourFormatter.format(nowTime.minusHours(i)) + ":00";
startTimeDay = dayFormatter.format(nowTime.minusHours(i));
endTime = hourFormatter.format(nowTime.minusHours(i - 1)) + ":00";
endTimeDay = dayFormatter.format(nowTime.minusHours(i - 1));
}
key = startTime + "-" + endTime;
zoneMap.put(START_TIME, nowDay + startTime + ":00");
zoneMap.put(END_TIME, nowDay + endTime + ":00");
zoneMap.put(START_TIME, startTimeDay + startTime + ":00");
zoneMap.put(END_TIME, endTimeDay + endTime + ":00");
timeZoneMap.put(key, zoneMap);
Map<String, String> map = new HashMap<>();
if (i == 0) {
//将第一个时间段作为本段查询时间区间的结束(因为是递减)
map.put(END_TIME, nowDay + startTime + ":00");
map.put(END_TIME, endTimeDay + endTime + ":00");
timeZoneMap.put(END_TIME, map);
}
if (i == designatedQuantity - 1) {
//将最后一个时间段作为本段查询时间区间的开始(因为是递减)
map.put(START_TIME, nowDay + endTime + ":00");
map.put(START_TIME, startTimeDay + startTime + ":00");
timeZoneMap.put(START_TIME, map);
}
}

Loading…
Cancel
Save