From c68e77815a564ff31542661deb3b8594e2e95683 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 17 Apr 2025 22:04:10 +0800 Subject: [PATCH] =?UTF-8?q?=2046281=20PCN-=E6=8C=89=E5=B7=A5=E4=BD=8D?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BA=A7=E9=87=8F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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();