diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java index d00ec76..e02babc 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java @@ -828,17 +828,21 @@ public class MesWorkOrderService implements IMesWorkOrderService { MesShift currentShift = shiftList.stream().filter(shift -> { String startTime = lotNo + " " + shift.getStartTime(); String endTime = lotNo + " " + shift.getEndTime(); - if (Objects.equals(shift.getShiftCode(), "20")) { - endTime = getDateTime(lotNo, 2) + " " + shift.getEndTime(); + // 如果是晚班,12点前,结束时间要加一天,如果是12点后,开始时间要减一天 + if (Objects.equals(shift.getShiftCode(),"20")) { + if (hours < 12) { + startTime = getDateTime(lotNo, 1) + " " + shift.getStartTime(); + } else { + endTime = getDateTime(lotNo, 2) + " " + shift.getEndTime(); + } } Date startDate = DateUtil.parse(startTime); Date endDate = DateUtil.parse(endTime); - return currentDate.getTime() > startDate.getTime() && currentDate.getTime() < endDate.getTime(); + return currentDate.getTime() >= startDate.getTime() && currentDate.getTime() <= endDate.getTime(); }).findFirst().orElse(null); - String orderDate = productionRecord.getLotNo(); if (currentShift.getStartTime().compareTo(currentShift.getEndTime()) > 0) { // 如果比0点大,需要找日期前一天的班次的工单号,如果是0点前,date =lotNO 如果是0点后,则找lot的前一天