From af2a1bd1f5012eb67efa9d0df28c3a9ea7805cab Mon Sep 17 00:00:00 2001 From: hdka <823267011@qq.com> Date: Thu, 7 Aug 2025 22:08:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E4=BA=8C=E8=BE=8A=E5=B0=86?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BC=A0=E5=85=A5=E5=9B=9B=E8=BE=8A=E8=B0=83?= =?UTF-8?q?=E8=AF=95=20=E5=8A=A0=E5=85=A5=E7=AC=AC=E4=B8=80=E9=81=93?= =?UTF-8?q?=E6=AC=A1=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IndustryMaterialServiceImpl.java | 3 ++- .../service/impl/IndustryStepServiceImpl.java | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 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 602bac75..71eb50ac 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 @@ -120,8 +120,9 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService { // TODO 这里需要查一下数据库查看是否有正在轧或者说是未轧的情况 state=0,1,3,4 List industryMaterialVos1 = industryMaterialMapper.selectIndustryMaterialListAndNotFinish(); + System.out.println("触发四辊数据写入"); // 这个大小等于0 表示四辊没有东西再轧制了可以进行放行 - if (industryMaterialVos1.size()<=0){ + if (industryMaterialVos1.isEmpty()){ IndustryBatch industryBatch = new IndustryBatch(); industryBatch.setBatchSize((long) industryMaterialVos.size()); industryBatchService.insertIndustryBatch(industryBatch); 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 72ffc48d..0d3c7643 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 @@ -340,6 +340,13 @@ public class IndustryStepServiceImpl implements IIndustryStepService { s7PLC.writeBoolean("DB15.0.3", false); } + + s7PLC.writeInt32("DB16.0", Math.toIntExact(smallStep.getStep())); + //以及剩余道次 + Long num = industryStepMapper.selectMaxStepNum(smallStep.getBatchId()); + s7PLC.writeInt32("M854", Math.toIntExact(num - smallStep.getStep())); + + // 将此批次所有的进行中全部更新成 operation = 0 IndustryStep newStep = new IndustryStep(); newStep.setBatchId(industryMaterial.getBatchId()); @@ -592,11 +599,21 @@ public class IndustryStepServiceImpl implements IIndustryStepService { public void start(IndustryStep industryStep) { List industryStepVos = industryStepMapper.selectIndustryStepList(industryStep); if (!industryStepVos.isEmpty()) { - s7PLC.writeFloat32("DB15.118", industryStepVos.get(0).getSetValue().floatValue()); + IndustryStepVo firstStep = industryStepVos.get(0); + + s7PLC.writeFloat32("DB15.118", firstStep.getSetValue().floatValue()); s7PLC.writeBoolean("DB15.0.3", true); + + while (s7PLC.readBoolean("DB15.0.3")) { s7PLC.writeBoolean("DB15.0.3", false); } + + // TODO 加入写入道次对齐 + s7PLC.writeInt32("DB16.0", Math.toIntExact(firstStep.getStep())); + //以及剩余道次 + Long num = industryStepMapper.selectMaxStepNum(firstStep.getBatchId()); + s7PLC.writeInt32("M854", Math.toIntExact(num - firstStep.getStep())); } industryStep.setOperation(1L); industryStepMapper.start(industryStep);