diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java index 1f31947..18b3171 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java @@ -161,7 +161,17 @@ public class MesShiftServiceImpl implements IMesShiftService { Optional shiftOptional = shiftList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getStartTime()) && !StringUtils.isEmpty(o.getEndTime()) && o.getStartTime().compareTo(time) <= 0 && o.getEndTime().compareTo(time) >= 0)).findFirst(); - if (null == shiftOptional || !shiftOptional.isPresent()) return null; + MesShift shiftOp = null; + for (MesShift shift : shiftList) { + if (null == shift || StringUtils.isEmpty(shift.getStartTime()) || StringUtils.isEmpty(shift.getEndTime())) continue; + if (shift.getStartTime().compareTo(shift.getEndTime()) < 0) { + if (shift.getStartTime().compareTo(time) <= 0 && shift.getEndTime().compareTo(time) >= 0) shiftOp = shift; + } else { + if (shift.getStartTime().compareTo(time) <= 0 || shift.getEndTime().compareTo(time) >= 0) shiftOp = shift; + } + } + + if (null == shiftOp) return null; //当天早班的开始时间 String todayStartTime = today + MesPcnExtConstWords.ONE_SPACE + shiftList.get(0).getStartTime();