|
|
@@ -1294,6 +1294,30 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+ public Map<String, Integer> getCurrentHourCapacityStats(String lineSn, List<String> oprnos) {
|
|
|
+ Map<String, Integer> ret = MapUtils.newHashMap();
|
|
|
+ if (StringUtils.isBlank(lineSn) || oprnos == null || oprnos.isEmpty()) {
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ Date startTime = calendar.getTime();
|
|
|
+ calendar.add(Calendar.HOUR_OF_DAY, 1);
|
|
|
+ Date endTime = calendar.getTime();
|
|
|
+ for (String oprno : oprnos) {
|
|
|
+ if (StringUtils.isBlank(oprno)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String formatOprno = CommonUitl.formatOprno(oprno.trim());
|
|
|
+ Long count = mesProductRecordDao.countHourCapacityByLineAndOprnoPrefix(
|
|
|
+ lineSn.trim(), formatOprno, startTime, endTime);
|
|
|
+ ret.put(formatOprno, count == null ? 0 : count.intValue());
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
private void fillHourlyCounts(List<Map<String, Object>> rows, int[] bucket) {
|
|
|
if (rows == null) {
|
|
|
return;
|