From 68c4320a588a03f3cdbc57d84e677997d2048f45 Mon Sep 17 00:00:00 2001 From: 86156 <823267011@qq.com> Date: Mon, 14 Jul 2025 17:59:01 +0800 Subject: [PATCH] =?UTF-8?q?bug=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IndustryMaterialServiceImpl.java | 13 +++++++------ .../work/service/impl/IndustryStepServiceImpl.java | 3 ++- .../resources/mapper/work/IndustryStepMapper.xml | 5 ++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/industry-system/src/main/java/com/industry/work/service/impl/IndustryMaterialServiceImpl.java b/industry-system/src/main/java/com/industry/work/service/impl/IndustryMaterialServiceImpl.java index 036084ab..6f3b420f 100644 --- a/industry-system/src/main/java/com/industry/work/service/impl/IndustryMaterialServiceImpl.java +++ b/industry-system/src/main/java/com/industry/work/service/impl/IndustryMaterialServiceImpl.java @@ -233,7 +233,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService { redisCache.setCacheObject("materialFlag", 1L, 100, TimeUnit.HOURS); redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS); - // TODO PLC + // TODO MOM // for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) { // MomResource momResource = getMomResource(industryMaterialVo); // momService.processPowerOn(momResource); @@ -411,7 +411,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService { Long flag = checkFirstOrLast(firstMaterial); - // 记录materialFlagError为升序 + // 记录 materialFlagError 为升序 redisCache.setCacheObject("materialFlagError", flag, 100, TimeUnit.HOURS); redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS); @@ -527,9 +527,9 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService { } } - Long materialFlag = redisCache.getCacheObject("materialFlagError"); + Long materialFlagError = redisCache.getCacheObject("materialFlagError"); // 处理是向上走还是向下走 - if (materialFlag == 0L) { + if (materialFlagError == 0L) { // 降序 // 表示走到了最后一个了 if (start == pos) { @@ -588,10 +588,10 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService { industryMaterialDto.setOperation(0L); updateIndustryMaterial(industryMaterialDto); IndustryMaterialVo industryMaterialVo; - Long materialFlag = redisCache.getCacheObject("materialFlagError"); + Long materialFlagError = redisCache.getCacheObject("materialFlagError"); // 处理是向上走还是向下走 int next = -1; - if (materialFlag == 0L) { + if (materialFlagError == 0L) { // 找到上一个正常的 for (int i = pos - 1; i >= 0; i--) { if (industryMaterialVos.get(i).getState() == 5L && industryMaterialVos.get(i).getIndustryStepVo().getState() == 0L) { @@ -850,6 +850,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService { private Long checkFirstOrLast(IndustryMaterialVo firstMaterial) { IndustryMaterialVo industryMaterialVo = new IndustryMaterialVo(); industryMaterialVo.setState(firstMaterial.getState()); + industryMaterialVo.setBatchId(firstMaterial.getBatchId()); List industryMaterialVos = selectAbnormalList(industryMaterialVo); int pos = -1; diff --git a/industry-system/src/main/java/com/industry/work/service/impl/IndustryStepServiceImpl.java b/industry-system/src/main/java/com/industry/work/service/impl/IndustryStepServiceImpl.java index bdf389c9..ad7f3236 100644 --- a/industry-system/src/main/java/com/industry/work/service/impl/IndustryStepServiceImpl.java +++ b/industry-system/src/main/java/com/industry/work/service/impl/IndustryStepServiceImpl.java @@ -301,8 +301,9 @@ public class IndustryStepServiceImpl implements IIndustryStepService { s7PLC.writeInt32("M854", Math.toIntExact(num - newStep)); Long materialFlagError = redisCache.getCacheObject("materialFlagError"); + long safeFlag = (materialFlagError != null && materialFlagError == 1L) ? 0L : 1L; redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS); - redisCache.setCacheObject("materialFlagError", materialFlagError == 1L ? 0L : 1L, 100, TimeUnit.HOURS); + redisCache.setCacheObject("materialFlagError", safeFlag, 100, TimeUnit.HOURS); s7PLC.writeBoolean("DB15.1.2", false); diff --git a/industry-system/src/main/resources/mapper/work/IndustryStepMapper.xml b/industry-system/src/main/resources/mapper/work/IndustryStepMapper.xml index 17a21c8b..0ecc7ed1 100644 --- a/industry-system/src/main/resources/mapper/work/IndustryStepMapper.xml +++ b/industry-system/src/main/resources/mapper/work/IndustryStepMapper.xml @@ -70,8 +70,8 @@ and angle = #{angle} and operation = #{operation} and state = #{state} - and material_id = #{materialId} - and batch_id = #{batchId} + and material_id = #{materialId} + and batch_id = #{batchId} order by step @@ -224,7 +224,6 @@ create_by = #{createBy}, update_time = #{updateTime}, update_by = #{updateBy}, -