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);