From 065b4241d92ad384f07d6489dec90027f05ebd26 Mon Sep 17 00:00:00 2001 From: gsz Date: Fri, 26 Jul 2024 14:38:06 +0800 Subject: [PATCH] =?UTF-8?q?42221=20=E5=8D=95=E4=BB=B6=E6=9D=A1=E7=A0=81?= =?UTF-8?q?=E8=BF=94=E5=B7=A5=E5=90=8E=E6=8A=A5=E5=BA=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedulejob/MesQmsSuspiciousJob.java | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/schedulejob/MesQmsSuspiciousJob.java b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/schedulejob/MesQmsSuspiciousJob.java index 740138c..bb5289d 100644 --- a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/schedulejob/MesQmsSuspiciousJob.java +++ b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/schedulejob/MesQmsSuspiciousJob.java @@ -19,6 +19,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.util.CollectionUtils; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -68,14 +71,34 @@ public class MesQmsSuspiciousJob extends BaseMesScheduleJob { //获取前一天的所有ncStatus=40报废状态下可疑品缺陷 DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); //按天执行前一天的所有可疑记录 + //按小时 条码+物料出现过一次 就排除当前时间段 // DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), "systemSyncStatus", packBean); - DdlPreparedPack.timeBuilder( - new SimpleDateFormat("yyyy-MM-dd").format(TimeTool.getDateBefore(new Date(), 1)) + " 00:00:00", - TimeTool.getToday() + " 00:00:00", "createDatetime", packBean, true); +// DdlPreparedPack.timeBuilder( +// new SimpleDateFormat("yyyy-MM-dd").format(TimeTool.getDateBefore(new Date(), 1)) + " 00:00:00", +// TimeTool.getToday() + " 00:00:00", "createDatetime", packBean, true); + // 获取当前时间前1小时的时间 + LocalDateTime now = LocalDateTime.now(); + LocalDateTime oneHourAgo = now.minusHours(1); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String formattedNow = now.format(formatter); + String formattedOneHourAgo = oneHourAgo.format(formatter); + + DdlPreparedPack.timeBuilder(formattedOneHourAgo ,formattedNow, "createDatetime", packBean, true); List mesPartInspectionList = partInspectionRepository.findByHqlWhere(packBean); if (!CollectionUtils.isEmpty(mesPartInspectionList)) { - qmsSuspiciousService.doQmsSuspiciousByPartInspection(mesPartInspectionList,organizeCode); + //过滤掉已经汇总的 + List partInspectionList = new ArrayList<>(); + for (MesPartInspection mesPartInspection : mesPartInspectionList) { + DdlPackBean packBeanNew = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringLikerPack(mesPartInspection.getPartNo(), "partNo", packBeanNew); + DdlPreparedPack.getStringLikerPack(mesPartInspection.getSn(), "sn", packBeanNew); + boolean flg = partInspectionRepository.isExitByHql(packBeanNew); + if (!flg) { + partInspectionList.add(mesPartInspection); + } + } + qmsSuspiciousService.doQmsSuspiciousByPartInspection(partInspectionList,organizeCode); for (MesPartInspection mesPartInspection : mesPartInspectionList) { mesPartInspection.setSystemSyncStatus(1);