更新通讯依赖版本为1.5.4,中空大理片,钢化大理片S7,modbus测试完成代码提交
| | |
| | | <dependency> |
| | | <groupId>com.github.xingshuangs</groupId> |
| | | <artifactId>iot-communication</artifactId> |
| | | <version>1.4.2</version> |
| | | <version>1.5.4</version> |
| | | </dependency> |
| | | |
| | | <!--引入redis,排除lettuce的引用--> |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | |
| | | @S7Variable(address = "DB49.102", type = EDataType.UINT16) |
| | | private Integer thicknessTwo; |
| | | |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 14) |
| | | private String plcGlassIdOne; |
| | | |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 14) |
| | | private String mesGlassIdOne; |
| | | |
| | | @S7Variable(address = "DB49.54", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB49.54", type = EDataType.STRING, count = 14) |
| | | private String plcGlassIdTwo; |
| | | |
| | | @S7Variable(address = "DB49.76", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB49.76", type = EDataType.STRING, count = 14) |
| | | private String mesglassIdTwo; |
| | | |
| | | } |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | |
| | | @S7Variable(address = "DB49.118", type = EDataType.FLOAT32) |
| | | private Float speed; |
| | | |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 14) |
| | | private String glassIdIn; |
| | | |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 14) |
| | | private String glassIdOut; |
| | | |
| | | @S7Variable(address = "DB49.94", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB49.94", type = EDataType.STRING, count = 14) |
| | | private String glassId; |
| | | |
| | | @S7Variable(address = "DB49.112.0", type = EDataType.BOOL) |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | |
| | | @Bean(name = "s7SerializerDLPOne") |
| | | public S7Serializer s7SerializerDLPOne() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "192.168.20.140"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerDLPTwo") |
| | | public S7Serializer s7SerializerDLPTwo() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "192.168.20.140"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | |
| | | List<BigStorageTaskVO> inTaskList = new ArrayList(); |
| | | // ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.FROM1"); |
| | | String fromOpcUa = s7DataDLPOne.getFrom1().toString(); |
| | | List<Short> states = s7DataDLPOne.getStates(); |
| | | List<Short> tos = s7DataDLPOne.getTos(); |
| | | List<Integer> states = s7DataDLPOne.getStates(); |
| | | List<Integer> tos = s7DataDLPOne.getTos(); |
| | | List<String> ids = s7DataDLPOne.getIds(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | // ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP1A.DLP1A.DI" + i); |
| | |
| | | |
| | | |
| | | //出片任务数据 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | List<BigStorageCageTask> outTaskList = new ArrayList<>(); |
| | | for (int i = 0; i < 6; i++) { |
| | | |
| | | BigStorageCageTask bigStorageCageTask = new BigStorageCageTask(); |
| | | String glassId = ""; |
| | | Integer startSlot = 0; |
| | | Integer targetSlot = 0; |
| | | Integer taskState = 0; |
| | | switch (i) { |
| | | case 0: |
| | | glassId = s7DataWLTwo.getId1(); |
| | | startSlot = s7DataWLTwo.getFrom1(); |
| | | targetSlot = s7DataWLTwo.getTo1(); |
| | | taskState = s7DataWLTwo.getState1(); |
| | | ; |
| | | break; |
| | | case 1: |
| | | glassId = s7DataWLTwo.getId2(); |
| | | startSlot = s7DataWLTwo.getFrom2(); |
| | | targetSlot = s7DataWLTwo.getTo2(); |
| | | taskState = s7DataWLTwo.getState2(); |
| | | break; |
| | | case 2: |
| | | glassId = s7DataWLTwo.getId3(); |
| | | startSlot = s7DataWLTwo.getFrom3(); |
| | | targetSlot = s7DataWLTwo.getTo3(); |
| | | taskState = s7DataWLTwo.getState3(); |
| | | break; |
| | | case 3: |
| | | glassId = s7DataWLTwo.getId4(); |
| | | startSlot = s7DataWLTwo.getFrom4(); |
| | | targetSlot = s7DataWLTwo.getTo4(); |
| | | taskState = s7DataWLTwo.getState4(); |
| | | break; |
| | | case 4: |
| | | glassId = s7DataWLTwo.getId5(); |
| | | startSlot = s7DataWLTwo.getFrom5(); |
| | | targetSlot = s7DataWLTwo.getTo5(); |
| | | taskState = s7DataWLTwo.getState5(); |
| | | break; |
| | | case 5: |
| | | glassId = s7DataWLTwo.getId6(); |
| | | startSlot = s7DataWLTwo.getFrom6(); |
| | | targetSlot = s7DataWLTwo.getTo6(); |
| | | taskState = s7DataWLTwo.getState6(); |
| | | break; |
| | | } |
| | | bigStorageCageTask.setGlassId(glassId); |
| | | bigStorageCageTask.setStartSlot(startSlot); |
| | | bigStorageCageTask.setTargetSlot(targetSlot); |
| | | bigStorageCageTask.setTaskState(taskState); |
| | | outTaskList.add(bigStorageCageTask); |
| | | } |
| | | jsonObject.append("bigStorageCageDetailsOutTask", outTaskList); |
| | | } catch (Exception e) { |
| | | //todo:不做任务处理 |
| | |
| | | // ReadWriteEntity mesReplyEntity = miloService.readFromOpcUa("DLP1A.DLP1A.MesReply"); |
| | | // if ("1".equals(mesReplyEntity.getValue() + "")) { |
| | | String mesReplyEntity = s7DataDLPOne.getMesReply().toString(); |
| | | if (!"1".equals(mesReplyEntity)) { |
| | | if ("1".equals(mesReplyEntity)) { |
| | | log.info("有正在执行的任务,结束进片任务"); |
| | | return; |
| | | } |
| | |
| | | // ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.FROM1"); |
| | | String fromOpcUa = s7DataDLPOne.getFrom1().toString(); |
| | | |
| | | List<Short> states = s7DataDLPOne.getStates(); |
| | | List<String> ids = s7DataDLPOne.getIds(); |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | for (int i = 0; i < 6; i++) { |
| | | // ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP1A.DLP1A.DI" + i); |
| | | String requestWord = states.get(i).toString(); |
| | | String requestWord = ids.get(i); |
| | | // if (null != requestWord.getValue()) { |
| | | if (null != requestWord) { |
| | | if (null != requestWord && !requestWord.isEmpty()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | // task.setGlassId(requestWord.getValue() + ""); |
| | | task.setGlassId(requestWord); |
| | |
| | | //向plc发送报警:当前大车进片玻璃数量与mes读取到的数量不匹配 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 1)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlramSignal((short) 1); |
| | | s7DataDLPOne.setAlarmSignal(1); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | return; |
| | | } |
| | |
| | | //向plc发送报警:同一车进片玻璃存在相同 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 2)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlramSignal((short) 2); |
| | | s7DataDLPOne.setAlarmSignal(2); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | return; |
| | | } |
| | |
| | | //向plc发送报警:理片笼存在相同的进片玻璃 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 4)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlramSignal((short) 4); |
| | | s7DataDLPOne.setAlarmSignal(4); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | return; |
| | | } |
| | |
| | | //向plc发送报警:进片任务数量与系统查询到的玻璃数量不匹配 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 8)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlramSignal((short) 8); |
| | | s7DataDLPOne.setAlarmSignal(8); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | return; |
| | | } |
| | |
| | | //向plc发送报警:笼内格子剩余数量不足 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 16)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlramSignal((short) 16); |
| | | s7DataDLPOne.setAlarmSignal(16); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | return; |
| | | } |
| | |
| | | //向plc发送报警:直通片台存在玻璃,无法继续直通 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 64)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlramSignal((short) 64); |
| | | s7DataDLPOne.setAlarmSignal(64); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | return; |
| | | } |
| | |
| | | .eq(BigStorageCage::getSlot, bigStorageDTO.getSlot())); |
| | | task.setTargetSlot(bigStorageDTO.getSlot()); |
| | | task.setGlassId(info.getGlassId()); |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", task); |
| | | // bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", task); |
| | | //存放历史任务 |
| | | BigStorageCageHistoryTask historyTask = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | |
| | | } else { |
| | | BigStorageCageTask task = inTaskList.get(0); |
| | | task.setTargetSlot(THROUGH_SLOT); |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", task); |
| | | // bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", task); |
| | | //存放历史任务 |
| | | BigStorageCageHistoryTask historyTask = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | |
| | | // list.add(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 1)); |
| | | // miloService.writeToOpcWord(list); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | for (int i = 0; i < inTaskList.size() && i < 6; i++) { |
| | | short value = (short) Integer.parseInt(inTaskList.get(i).getTargetSlot().toString()); |
| | | for (int i = 0; i < inTaskList.size(); i++) { |
| | | Integer value = Integer.parseInt(inTaskList.get(i).getTargetSlot().toString()); |
| | | switch (i) { |
| | | case 0: |
| | | s7DataDLPOne.setTo1(value); |
| | |
| | | } |
| | | } |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setMesReply(1); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | |
| | | return; |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | List<BigStorageCageTask> outTaskList = getOutTaskList(s7DataWLTwo); |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtil.isNotEmpty(outTaskList)) { |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | |
| | | } |
| | | |
| | | // if (null != requestWord.getValue()) { |
| | | if (null != requestWord) { |
| | | if (!requestWord.isEmpty()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | // task.setGlassId(requestWord.getValue() + ""); |
| | | // task.setTargetSlot(Integer.parseInt(toOpcUa.getValue() + "")); |
| | |
| | | .eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | item.setTargetSlot(0); |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item); |
| | | // bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item); |
| | | } |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | |
| | | // } |
| | | // list.add(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 0)); |
| | | // miloService.writeToOpcWord(list); |
| | | s7DataDLPOne =new S7DataDLPOne(); |
| | | s7DataDLPOne.setTo1((short)0); |
| | | s7DataDLPOne.setTo2((short)0); |
| | | s7DataDLPOne.setTo3((short)0); |
| | | s7DataDLPOne.setTo4((short)0); |
| | | s7DataDLPOne.setTo5((short)0); |
| | | s7DataDLPOne.setTo6((short)0); |
| | | s7DataDLPOne.setMesReply((short)0); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setTo1(0); |
| | | s7DataDLPOne.setTo2(0); |
| | | s7DataDLPOne.setTo3(0); |
| | | s7DataDLPOne.setTo4(0); |
| | | s7DataDLPOne.setTo5(0); |
| | | s7DataDLPOne.setTo6(0); |
| | | s7DataDLPOne.setMesReply(0); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | | } |
| | | |
| | |
| | | log.info("当前为非联机状态,结束完成出片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = getOutTaskList(s7DataWLTwo); |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtil.isEmpty(outTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | |
| | | } |
| | | } |
| | | // 重置任务表数据 |
| | | bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task"); |
| | | // bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task"); |
| | | resetOutTask(); |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 0)); |
| | | S7DataDLPTwo s7DataDLPTwo=new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setMesReply((short)0); |
| | | S7DataDLPTwo s7DataDLPTwo = new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setMesReply(0); |
| | | s7SerializerDLPTwo.write(s7DataDLPTwo); |
| | | } |
| | | |
| | |
| | | List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | int glassCount = bigStorageCageTaskList.size(); |
| | | //生成出片任务条数不足6补全 |
| | | while (bigStorageCageTaskList.size() < 6) { |
| | | bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | } |
| | | // while (bigStorageCageTaskList.size() < 6) { |
| | | // bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | // } |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task"); |
| | | bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | resetOutTask(); |
| | | S7DataDLPTwo s7DataDLPTwo = new S7DataDLPTwo(); |
| | | for (int i = 0; i < bigStorageCageTaskList.size() && i < 6; i++) { |
| | | String glassId = bigStorageCageTaskList.get(i).getGlassId(); |
| | | Integer startSlot = bigStorageCageTaskList.get(i).getStartSlot(); |
| | | Integer target = bigStorageCageTaskList.get(i).getTargetSlot(); |
| | | if (startSlot > 0) { |
| | | switch (i) { |
| | | case 0: |
| | | s7DataDLPTwo.setId1(glassId); |
| | | s7DataDLPTwo.setFrom1(startSlot); |
| | | s7DataDLPTwo.setTo1(target); |
| | | break; |
| | | case 1: |
| | | s7DataDLPTwo.setId2(glassId); |
| | | s7DataDLPTwo.setFrom2(startSlot); |
| | | s7DataDLPTwo.setTo2(target); |
| | | break; |
| | | case 2: |
| | | s7DataDLPTwo.setId3(glassId); |
| | | s7DataDLPTwo.setFrom3(startSlot); |
| | | s7DataDLPTwo.setTo3(target); |
| | | break; |
| | | case 3: |
| | | s7DataDLPTwo.setId4(glassId); |
| | | s7DataDLPTwo.setFrom4(startSlot); |
| | | s7DataDLPTwo.setTo4(target); |
| | | break; |
| | | case 4: |
| | | s7DataDLPTwo.setId5(glassId); |
| | | s7DataDLPTwo.setFrom5(startSlot); |
| | | s7DataDLPTwo.setTo5(target); |
| | | break; |
| | | case 5: |
| | | s7DataDLPTwo.setId6(glassId); |
| | | s7DataDLPTwo.setFrom6(startSlot); |
| | | s7DataDLPTwo.setTo6(target); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | s7SerializerDLPTwo.write(s7DataDLPTwo); |
| | | // bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task"); |
| | | // bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | List<BigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> { |
| | | BigStorageCageHistoryTask history = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(e, history); |
| | |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 1)); |
| | | S7DataDLPTwo s7DataDLPTwo=new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setMesReply((short)1); |
| | | s7DataDLPTwo = new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setMesReply(1); |
| | | s7SerializerDLPTwo.write(s7DataDLPTwo); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 1)); |
| | | S7DataDLPTwo s7DataDLPTwo=new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setMesReply((short)1); |
| | | S7DataDLPTwo s7DataDLPTwo = new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setMesReply(1); |
| | | s7SerializerDLPTwo.write(s7DataDLPTwo); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | .value(value) |
| | | .build(); |
| | | } |
| | | |
| | | //重置任务表 |
| | | private void resetOutTask() { |
| | | S7DataDLPTwo s7DataDLPTwo = new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setId1(""); |
| | | s7DataDLPTwo.setId2(""); |
| | | s7DataDLPTwo.setId3(""); |
| | | s7DataDLPTwo.setId4(""); |
| | | s7DataDLPTwo.setId5(""); |
| | | s7DataDLPTwo.setId6(""); |
| | | s7DataDLPTwo.setFrom1(0); |
| | | s7DataDLPTwo.setFrom2(0); |
| | | s7DataDLPTwo.setFrom3(0); |
| | | s7DataDLPTwo.setFrom4(0); |
| | | s7DataDLPTwo.setFrom5(0); |
| | | s7DataDLPTwo.setFrom6(0); |
| | | s7DataDLPTwo.setTo1(0); |
| | | s7DataDLPTwo.setTo2(0); |
| | | s7DataDLPTwo.setTo3(0); |
| | | s7DataDLPTwo.setTo4(0); |
| | | s7DataDLPTwo.setTo5(0); |
| | | s7DataDLPTwo.setTo6(0); |
| | | s7DataDLPTwo.setState1(0); |
| | | s7DataDLPTwo.setState2(0); |
| | | s7DataDLPTwo.setState3(0); |
| | | s7DataDLPTwo.setState4(0); |
| | | s7DataDLPTwo.setState5(0); |
| | | s7DataDLPTwo.setState6(0); |
| | | s7SerializerDLPTwo.write(s7DataDLPTwo); |
| | | } |
| | | |
| | | //读取出片地址 |
| | | private List<BigStorageCageTask> getOutTaskList(S7DataDLPTwo s7DataDLPTwo) { |
| | | List<BigStorageCageTask> outTaskList = new ArrayList<>(); |
| | | List<String> glassIds = s7DataDLPTwo.getIds(); |
| | | List<Integer> startSlots = s7DataDLPTwo.getFroms(); |
| | | List<Integer> endSlots = s7DataDLPTwo.getTos(); |
| | | List<Integer> states = s7DataDLPTwo.getStates(); |
| | | for (int i = 0; i < 6; i++) { |
| | | if (glassIds.get(i) != null && !glassIds.get(i).isEmpty()) { |
| | | BigStorageCageTask bigStorageCageTask = new BigStorageCageTask(); |
| | | bigStorageCageTask.setGlassId(glassIds.get(i)); |
| | | bigStorageCageTask.setStartSlot(startSlots.get(i)); |
| | | bigStorageCageTask.setTargetSlot(endSlots.get(i)); |
| | | bigStorageCageTask.setTaskState(states.get(i)); |
| | | outTaskList.add(bigStorageCageTask); |
| | | } |
| | | } |
| | | return outTaskList; |
| | | } |
| | | } |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | |
| | | @S7Variable(address = "DB3.3118.0", type = EDataType.BOOL) |
| | | private Boolean mesControl; |
| | | |
| | | @S7Variable(address = "DB19.0", type = EDataType.INT16) |
| | | private Short requestMes; |
| | | @S7Variable(address = "DB8.0", type = EDataType.UINT16) |
| | | private Integer requestMes; |
| | | |
| | | @S7Variable(address = "DB19.2", type = EDataType.INT16) |
| | | private Short mesReply; |
| | | @S7Variable(address = "DB8.2", type = EDataType.UINT16) |
| | | private Integer mesReply; |
| | | |
| | | @S7Variable(address = "DB19.140", type = EDataType.INT16) |
| | | private Short from1; |
| | | @S7Variable(address = "DB8.140", type = EDataType.UINT16) |
| | | private Integer from1; |
| | | |
| | | @S7Variable(address = "DB19.142", type = EDataType.INT16) |
| | | private Short from2; |
| | | @S7Variable(address = "DB8.142", type = EDataType.UINT16) |
| | | private Integer from2; |
| | | |
| | | @S7Variable(address = "DB19.144", type = EDataType.INT16) |
| | | private Short from3; |
| | | @S7Variable(address = "DB8.144", type = EDataType.UINT16) |
| | | private Integer from3; |
| | | |
| | | @S7Variable(address = "DB19.146", type = EDataType.INT16) |
| | | private Short from4; |
| | | @S7Variable(address = "DB8.146", type = EDataType.UINT16) |
| | | private Integer from4; |
| | | |
| | | @S7Variable(address = "DB19.148", type = EDataType.INT16) |
| | | private Short from5; |
| | | @S7Variable(address = "DB8.148", type = EDataType.UINT16) |
| | | private Integer from5; |
| | | |
| | | @S7Variable(address = "DB19.150", type = EDataType.INT16) |
| | | private Short from6; |
| | | @S7Variable(address = "DB8.150", type = EDataType.UINT16) |
| | | private Integer from6; |
| | | |
| | | @S7Variable(address = "DB19.152", type = EDataType.INT16) |
| | | private Short to1; |
| | | @S7Variable(address = "DB8.152", type = EDataType.UINT16) |
| | | private Integer to1; |
| | | |
| | | @S7Variable(address = "DB19.154", type = EDataType.INT16) |
| | | private Short to2; |
| | | @S7Variable(address = "DB8.154", type = EDataType.UINT16) |
| | | private Integer to2; |
| | | |
| | | @S7Variable(address = "DB19.156", type = EDataType.INT16) |
| | | private Short to3; |
| | | @S7Variable(address = "DB8.156", type = EDataType.UINT16) |
| | | private Integer to3; |
| | | |
| | | @S7Variable(address = "DB19.158", type = EDataType.INT16) |
| | | private Short to4; |
| | | @S7Variable(address = "DB8.158", type = EDataType.UINT16) |
| | | private Integer to4; |
| | | |
| | | @S7Variable(address = "DB19.160", type = EDataType.INT16) |
| | | private Short to5; |
| | | @S7Variable(address = "DB8.160", type = EDataType.UINT16) |
| | | private Integer to5; |
| | | |
| | | @S7Variable(address = "DB19.162", type = EDataType.INT16) |
| | | private Short to6; |
| | | @S7Variable(address = "DB8.162", type = EDataType.UINT16) |
| | | private Integer to6; |
| | | |
| | | @S7Variable(address = "DB19.164", type = EDataType.INT16) |
| | | private Short state1; |
| | | @S7Variable(address = "DB8.164", type = EDataType.UINT16) |
| | | private Integer state1; |
| | | |
| | | @S7Variable(address = "DB19.166", type = EDataType.INT16) |
| | | private Short state2; |
| | | @S7Variable(address = "DB8.166", type = EDataType.UINT16) |
| | | private Integer state2; |
| | | |
| | | @S7Variable(address = "DB19.168", type = EDataType.INT16) |
| | | private Short state3; |
| | | @S7Variable(address = "DB8.168", type = EDataType.UINT16) |
| | | private Integer state3; |
| | | |
| | | @S7Variable(address = "DB19.170", type = EDataType.INT16) |
| | | private Short state4; |
| | | @S7Variable(address = "DB8.170", type = EDataType.UINT16) |
| | | private Integer state4; |
| | | |
| | | @S7Variable(address = "DB19.172", type = EDataType.INT16) |
| | | private Short state5; |
| | | @S7Variable(address = "DB8.172", type = EDataType.UINT16) |
| | | private Integer state5; |
| | | |
| | | @S7Variable(address = "DB19.174", type = EDataType.INT16) |
| | | private Short state6; |
| | | @S7Variable(address = "DB8.174", type = EDataType.UINT16) |
| | | private Integer state6; |
| | | |
| | | @S7Variable(address = "DB19.1246", type = EDataType.INT16) |
| | | private Short glassCount; |
| | | @S7Variable(address = "DB8.1246", type = EDataType.UINT16) |
| | | private Integer glassCount; |
| | | |
| | | @S7Variable(address = "DB19.8", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.8", type = EDataType.STRING, count = 14) |
| | | private String id1; |
| | | |
| | | @S7Variable(address = "DB19.30", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.30", type = EDataType.STRING, count = 14) |
| | | private String id2; |
| | | |
| | | @S7Variable(address = "DB19.52", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.52", type = EDataType.STRING, count = 14) |
| | | private String id3; |
| | | |
| | | @S7Variable(address = "DB19.74", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.74", type = EDataType.STRING, count = 14) |
| | | private String id4; |
| | | |
| | | @S7Variable(address = "DB19.96", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.96", type = EDataType.STRING, count = 14) |
| | | private String id5; |
| | | |
| | | @S7Variable(address = "DB19.118", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.118", type = EDataType.STRING, count = 14) |
| | | private String id6; |
| | | |
| | | @S7Variable(address = "MW1002", type = EDataType.INT16) |
| | | private Short alramSignal; |
| | | @S7Variable(address = "MW1002", type = EDataType.UINT16) |
| | | private Integer alarmSignal; |
| | | |
| | | public List<Short> getStates() { |
| | | public List<Integer> getStates() { |
| | | return Arrays.asList(state1, state2, state3, state4, state5, state6); |
| | | } |
| | | |
| | |
| | | return Arrays.asList(id1, id2, id3, id4, id5, id6); |
| | | } |
| | | |
| | | public List<Short> getTos() { |
| | | public List<Integer> getTos() { |
| | | return Arrays.asList(to1, to2, to3, to4, to5, to6); |
| | | } |
| | | |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | |
| | | @S7Variable(address = "DB3.3118.0", type = EDataType.BOOL) |
| | | private Boolean mesControl; |
| | | |
| | | @S7Variable(address = "DB19.4", type = EDataType.INT16) |
| | | private Short requestMes; |
| | | @S7Variable(address = "DB8.4", type = EDataType.UINT16) |
| | | private Integer requestMes; |
| | | |
| | | @S7Variable(address = "DB19.6", type = EDataType.INT16) |
| | | private Short mesReply; |
| | | @S7Variable(address = "DB8.6", type = EDataType.UINT16) |
| | | private Integer mesReply; |
| | | |
| | | @S7Variable(address = "DB19.308", type = EDataType.INT16) |
| | | private Short from1; |
| | | @S7Variable(address = "DB8.308", type = EDataType.UINT16) |
| | | private Integer from1; |
| | | |
| | | @S7Variable(address = "DB19.310", type = EDataType.INT16) |
| | | private Short from2; |
| | | @S7Variable(address = "DB8.310", type = EDataType.UINT16) |
| | | private Integer from2; |
| | | |
| | | @S7Variable(address = "DB19.312", type = EDataType.INT16) |
| | | private Short from3; |
| | | @S7Variable(address = "DB8.312", type = EDataType.UINT16) |
| | | private Integer from3; |
| | | |
| | | @S7Variable(address = "DB19.314", type = EDataType.INT16) |
| | | private Short from4; |
| | | @S7Variable(address = "DB8.314", type = EDataType.UINT16) |
| | | private Integer from4; |
| | | |
| | | @S7Variable(address = "DB19.316", type = EDataType.INT16) |
| | | private Short from5; |
| | | @S7Variable(address = "DB8.316", type = EDataType.UINT16) |
| | | private Integer from5; |
| | | |
| | | @S7Variable(address = "DB19.318", type = EDataType.INT16) |
| | | private Short from6; |
| | | @S7Variable(address = "DB8.318", type = EDataType.UINT16) |
| | | private Integer from6; |
| | | |
| | | @S7Variable(address = "DB19.320", type = EDataType.INT16) |
| | | private Short to1; |
| | | @S7Variable(address = "DB8.320", type = EDataType.UINT16) |
| | | private Integer to1; |
| | | |
| | | @S7Variable(address = "DB19.322", type = EDataType.INT16) |
| | | private Short to2; |
| | | @S7Variable(address = "DB8.322", type = EDataType.UINT16) |
| | | private Integer to2; |
| | | |
| | | @S7Variable(address = "DB19.324", type = EDataType.INT16) |
| | | private Short to3; |
| | | @S7Variable(address = "DB8.324", type = EDataType.UINT16) |
| | | private Integer to3; |
| | | |
| | | @S7Variable(address = "DB19.326", type = EDataType.INT16) |
| | | private Short to4; |
| | | @S7Variable(address = "DB8.326", type = EDataType.UINT16) |
| | | private Integer to4; |
| | | |
| | | @S7Variable(address = "DB19.328", type = EDataType.INT16) |
| | | private Short to5; |
| | | @S7Variable(address = "DB8.328", type = EDataType.UINT16) |
| | | private Integer to5; |
| | | |
| | | @S7Variable(address = "DB19.330", type = EDataType.INT16) |
| | | private Short to6; |
| | | @S7Variable(address = "DB8.330", type = EDataType.UINT16) |
| | | private Integer to6; |
| | | |
| | | @S7Variable(address = "DB19.332", type = EDataType.INT16) |
| | | private Short state1; |
| | | @S7Variable(address = "DB8.332", type = EDataType.UINT16) |
| | | private Integer state1; |
| | | |
| | | @S7Variable(address = "DB19.334", type = EDataType.INT16) |
| | | private Short state2; |
| | | @S7Variable(address = "DB8.334", type = EDataType.UINT16) |
| | | private Integer state2; |
| | | |
| | | @S7Variable(address = "DB19.336", type = EDataType.INT16) |
| | | private Short state3; |
| | | @S7Variable(address = "DB8.336", type = EDataType.UINT16) |
| | | private Integer state3; |
| | | |
| | | @S7Variable(address = "DB19.338", type = EDataType.INT16) |
| | | private Short state4; |
| | | @S7Variable(address = "DB8.338", type = EDataType.UINT16) |
| | | private Integer state4; |
| | | |
| | | @S7Variable(address = "DB19.340", type = EDataType.INT16) |
| | | private Short state5; |
| | | @S7Variable(address = "DB8.340", type = EDataType.UINT16) |
| | | private Integer state5; |
| | | |
| | | @S7Variable(address = "DB19.342", type = EDataType.INT16) |
| | | private Short state6; |
| | | @S7Variable(address = "DB8.342", type = EDataType.UINT16) |
| | | private Integer state6; |
| | | |
| | | @S7Variable(address = "DB19.176", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.176", type = EDataType.STRING, count = 14) |
| | | private String id1; |
| | | |
| | | @S7Variable(address = "DB19.198", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.198", type = EDataType.STRING, count = 14) |
| | | private String id2; |
| | | |
| | | @S7Variable(address = "DB19.220", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.220", type = EDataType.STRING, count = 14) |
| | | private String id3; |
| | | |
| | | @S7Variable(address = "DB19.242", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.242", type = EDataType.STRING, count = 14) |
| | | private String id4; |
| | | |
| | | @S7Variable(address = "DB19.264", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.264", type = EDataType.STRING, count = 14) |
| | | private String id5; |
| | | |
| | | @S7Variable(address = "DB19.286", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB8.286", type = EDataType.STRING, count = 14) |
| | | private String id6; |
| | | |
| | | public List<Integer> getStates() { |
| | | return Arrays.asList(state1, state2, state3, state4, state5, state6); |
| | | } |
| | | |
| | | public List<String> getIds() { |
| | | return Arrays.asList(id1, id2, id3, id4, id5, id6); |
| | | } |
| | | |
| | | public List<Integer> getTos() { |
| | | return Arrays.asList(to1, to2, to3, to4, to5, to6); |
| | | } |
| | | |
| | | public List<Integer> getFroms() { |
| | | return Arrays.asList(from1, from2, from3, from4, from5, from6); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| New file |
| | |
| | | package com.mes.config; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2025/4/30 13:50 |
| | | * @Description: |
| | | */ |
| | | @Configuration |
| | | public class ModbusConfig { |
| | | |
| | | @Bean(name = "CMJ1ModbusTcp") |
| | | public ModbusTcp CMJ1ModbusTcp() { |
| | | // return new ModbusTcp("127.0.0.1"); |
| | | return new ModbusTcp("192.168.30.160"); |
| | | } |
| | | |
| | | @Bean(name = "CMJ2ModbusTcp") |
| | | public ModbusTcp CMJ2ModbusTcp() { |
| | | // return new ModbusTcp("127.0.0.1"); |
| | | return new ModbusTcp("192.168.30.162"); |
| | | } |
| | | |
| | | } |
| | |
| | | public class S7Config { |
| | | @Bean(name = "s7SerializerZKDLPOne") |
| | | public S7Serializer s7SerializerZKDLPOne() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.30.100"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "192.168.30.100"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerZKDLPTwo") |
| | | public S7Serializer s7SerializerZKDLPTwo() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.30.100"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "192.168.30.100"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerZKQ2") |
| | | public S7Serializer s7SerializerZKQ2() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "192.168.30.140"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | |
| | | package com.mes.job; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.hollow.entity.vo.HollowGlassFormulaVO; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Autowired(required = false) |
| | | MiloService miloService; |
| | | |
| | | @Autowired |
| | | @Qualifier("CMJ1ModbusTcp") |
| | | ModbusTcp CMJ1ModbusTcp; |
| | | |
| | | @Autowired |
| | | @Qualifier("CMJ2ModbusTcp") |
| | | ModbusTcp CMJ2ModbusTcp; |
| | | |
| | | private Integer offset = 40001; |
| | | |
| | | /** |
| | | * 收到除膜机请求及玻璃id |
| | | * |
| | |
| | | } |
| | | |
| | | private void hollowRemoveChildTask(String cell) throws Exception { |
| | | ReadWriteEntity requestEntity = miloService.readFromOpcUa(cell + "mesControl"); |
| | | if ("0".equals(requestEntity.getValue() + "")) { |
| | | ModbusTcp modbusTcp = null; |
| | | if ("CMJ1.CMJ1.".equals(cell)) { |
| | | modbusTcp = CMJ1ModbusTcp; |
| | | } else { |
| | | modbusTcp = CMJ2ModbusTcp; |
| | | } |
| | | Integer requestEntity = modbusTcp.readUInt16(42001 - offset); |
| | | // ReadWriteEntity requestEntity = miloService.readFromOpcUa(cell + "mesControl"); |
| | | // if ("0".equals(requestEntity.getValue() + "")) { |
| | | if (0 == requestEntity) { |
| | | log.info("当前除膜机为单机状态"); |
| | | return; |
| | | } |
| | | int request = Integer.parseInt(requestEntity.getValue() + ""); |
| | | // int request = Integer.parseInt(requestEntity.getValue() + ""); |
| | | int request = requestEntity; |
| | | int flagRequest = request & 3; |
| | | if (flagRequest != 3) { |
| | | log.info("当前未收到请求玻璃id数据,结束任务"); |
| | | return; |
| | | } |
| | | ReadWriteEntity glassIdEntity = miloService.readFromOpcUa(cell + "glassId"); |
| | | if (null == glassIdEntity.getValue() || StringUtils.isBlank(glassIdEntity.getValue() + "")) { |
| | | String glassIdEntity = modbusTcp.readString(42003 - offset, 20); |
| | | if (null == glassIdEntity || StringUtils.isBlank(glassIdEntity)) { |
| | | // ReadWriteEntity glassIdEntity = miloService.readFromOpcUa(cell + "glassId"); |
| | | // if (null == glassIdEntity.getValue() || StringUtils.isBlank(glassIdEntity.getValue() + "")) { |
| | | log.info("当前未收到玻璃id数据,结束任务"); |
| | | return; |
| | | } |
| | | log.info("当前需要除膜的玻璃id为:{}", glassIdEntity.getValue() + ""); |
| | | log.info("当前需要除膜的玻璃id为:{}", glassIdEntity); |
| | | //按照玻璃id获取对应的任务id |
| | | HollowGlassFormulaVO detailsVO = hollowFormulaDetailsService.queryFormulaDetailsByGlassId(glassIdEntity.getValue() + "", null, null); |
| | | HollowGlassFormulaVO detailsVO = hollowFormulaDetailsService.queryFormulaDetailsByGlassId(glassIdEntity, null, null); |
| | | if (null == detailsVO) { |
| | | log.info("玻璃id不存在,请检查数据"); |
| | | return; |
| | |
| | | |
| | | List<ReadWriteEntity> ualist = new ArrayList<>(); |
| | | List<ReadWriteEntity> wordlist = new ArrayList<>(); |
| | | |
| | | int Id = 0; |
| | | if (detailsVO.getFilmRemove() == 0) { |
| | | // 10111011 |
| | | int sendId = request & 63; |
| | | sendId = sendId + 4; |
| | | wordlist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "mesControl", sendId)); |
| | | Id = sendId + 4; |
| | | // wordlist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "mesControl", sendId)); |
| | | modbusTcp.writeUInt16(42001 - offset, sendId); |
| | | } else { |
| | | // 先将对应的位置为0,获得请求的玻璃数据, 然后将对应位值 110111011 |
| | | int sendId = request & 63; |
| | | sendId = sendId + 4 + 64; |
| | | wordlist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "mesControl", sendId)); |
| | | ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassTop", detailsVO.getTopRemove())); |
| | | ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassBottom", detailsVO.getBottomRemove())); |
| | | ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassLeft", detailsVO.getLeftRemove())); |
| | | ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassRight", detailsVO.getRightRemove())); |
| | | Id = sendId + 4 + 64; |
| | | |
| | | modbusTcp.writeUInt32(42019 - offset, detailsVO.getTopRemove()); |
| | | modbusTcp.writeUInt32(42021 - offset, detailsVO.getTopRemove()); |
| | | modbusTcp.writeUInt32(42023 - offset, detailsVO.getTopRemove()); |
| | | modbusTcp.writeUInt32(42025 - offset, detailsVO.getTopRemove()); |
| | | // wordlist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "mesControl", sendId)); |
| | | // ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassTop", detailsVO.getTopRemove())); |
| | | // ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassBottom", detailsVO.getBottomRemove())); |
| | | // ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassLeft", detailsVO.getLeftRemove())); |
| | | // ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "glassRight", detailsVO.getRightRemove())); |
| | | } |
| | | ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "thickness", (int) (detailsVO.getThickness() * 10))); |
| | | ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "firstLength", (int) (Math.max(detailsVO.getWidth(), detailsVO.getHeight())) * 10)); |
| | | ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "secondLength", (int) (Math.min(detailsVO.getWidth(), detailsVO.getHeight())) * 10)); |
| | | miloService.writeToOpcWord(wordlist); |
| | | miloService.writeToOpcUa(ualist); |
| | | modbusTcp.writeUInt32(42013 - offset, (int) (detailsVO.getThickness() * 10)); |
| | | modbusTcp.writeUInt32(42015 - offset, (int) (Math.max(detailsVO.getWidth(), detailsVO.getHeight())) * 10); |
| | | modbusTcp.writeUInt32(42017 - offset, (int) (Math.min(detailsVO.getWidth(), detailsVO.getHeight())) * 10); |
| | | modbusTcp.writeUInt16(42001 - offset, Id); |
| | | // ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "thickness", (int) (detailsVO.getThickness() * 10))); |
| | | // ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "firstLength", (int) (Math.max(detailsVO.getWidth(), detailsVO.getHeight())) * 10)); |
| | | // ualist.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "secondLength", (int) (Math.min(detailsVO.getWidth(), detailsVO.getHeight())) * 10)); |
| | | // miloService.writeToOpcWord(wordlist); |
| | | // miloService.writeToOpcUa(ualist); |
| | | return; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | public void finishHollowRemoveChildTask(String cell) throws Exception { |
| | | ReadWriteEntity requestEntity = miloService.readFromOpcUa(cell + "mesControl"); |
| | | int request = Integer.parseInt(requestEntity.getValue() + ""); |
| | | // ReadWriteEntity requestEntity = miloService.readFromOpcUa(cell + "mesControl"); |
| | | ModbusTcp modbusTcp = null; |
| | | if ("CMJ1.CMJ1.".equals(cell)) { |
| | | modbusTcp = CMJ1ModbusTcp; |
| | | } else { |
| | | modbusTcp = CMJ2ModbusTcp; |
| | | } |
| | | int requestEntity = modbusTcp.readUInt16(42001 - offset); |
| | | int request = requestEntity; |
| | | int flagRequest = request & 9; |
| | | if (flagRequest != 9) { |
| | | log.info("当前未收到除膜机ID接收完成信号,结束任务"); |
| | |
| | | } |
| | | //向电气发送清楚信号 |
| | | int sendId = request & 251; |
| | | List<ReadWriteEntity> list = new ArrayList<>(); |
| | | list.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "mesControl", sendId)); |
| | | miloService.writeToOpcWord(list); |
| | | // List<ReadWriteEntity> list = new ArrayList<>(); |
| | | // list.add(opcPlcStorageCageHollowTask.generateReadWriteEntity(cell + "mesControl", sendId)); |
| | | // miloService.writeToOpcWord(list); |
| | | modbusTcp.writeUInt16(42001 - offset, sendId); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | |
| | | import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService; |
| | | import com.mes.s7.entity.S7DataZKDLPOne; |
| | | import com.mes.s7.entity.S7DataZKDLPTwo; |
| | | import com.mes.s7.entity.S7DataZKExtra; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | |
| | | @Qualifier("s7SerializerZKDLPTwo") |
| | | private S7Serializer s7SerializerZKDLPTwo; |
| | | |
| | | @Autowired |
| | | @Qualifier("s7SerializerZKQ2") |
| | | private S7Serializer s7SerializerZKQ2; |
| | | |
| | | @Autowired |
| | | @Qualifier("CMJ1ModbusTcp") |
| | | ModbusTcp CMJ1ModbusTcp; |
| | | |
| | | private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task"; |
| | | private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task"; |
| | | /** |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() throws Exception { |
| | | S7DataZKDLPOne s7DataZKDLPOne = s7SerializerZKDLPOne.read(S7DataZKDLPOne.class); |
| | | log.info("进片任务读取s7DataZKDLPOne:{}", s7DataZKDLPOne); |
| | | // ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2A.DLP2A.mesControl"); |
| | | // if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | Boolean inkageEntity = s7DataZKDLPOne.getMesControl(); |
| | |
| | | // ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP2A.DLP2A.FROM1"); |
| | | String fromOpcUa = s7DataZKDLPOne.getFrom1().toString(); |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | List<Integer> requestWords = s7DataZKDLPOne.getStates(); |
| | | List<String> requestWords = s7DataZKDLPOne.getIds(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | // ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP2A.DLP2A.DI" + i); |
| | | Integer requestWord = requestWords.get(i - 1); |
| | | String requestWord = requestWords.get(i - 1); |
| | | // if (null != requestWord.getValue()) { |
| | | if (null != requestWord) { |
| | | if (null != requestWord && !requestWord.isEmpty()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | // task.setGlassId(requestWord.getValue() + ""); |
| | | task.setGlassId(requestWord.toString()); |
| | |
| | | .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot())); |
| | | task.setTargetSlot(bigStorageDTO.getSlot()); |
| | | task.setGlassId(info.getGlassId()); |
| | | bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); |
| | | // bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | |
| | | } else { |
| | | BigStorageCageTask task = inTaskList.get(0); |
| | | task.setTargetSlot(THROUGH_SLOT); |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_two_task", task); |
| | | // bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_two_task", task); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | |
| | | } |
| | | } |
| | | s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | | s7DataZKDLPOne = new S7DataZKDLPOne(); |
| | | s7DataZKDLPOne.setMesReply(1); |
| | | s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void outBigStorageTask() throws Exception { |
| | | Date startDate = new Date(); |
| | | S7DataZKDLPTwo s7DataZKDLPTwo = s7SerializerZKDLPTwo.read(S7DataZKDLPTwo.class); |
| | | log.info("进片任务读取s7DataZKDLPTwo:{}", s7DataZKDLPTwo); |
| | | // ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2B.DLP2B.mesControl"); |
| | | // if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | Boolean inkageEntity = s7DataZKDLPTwo.getMesControl(); |
| | |
| | | return; |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | |
| | | List<BigStorageCageTask> outTaskList = getOutTaskList(s7DataZKDLPTwo); |
| | | |
| | | if (CollectionUtil.isNotEmpty(outTaskList)) { |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | | } |
| | | |
| | | //获取空闲且领取任务的数据信息,没有任务直接走玻璃调度 |
| | | HashMap<Integer, ReadWriteEntity> map = new HashMap<>(); |
| | | ReadWriteEntity oneEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree"); |
| | | ReadWriteEntity twoEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | ReadWriteEntity threeEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree03"); |
| | | |
| | | HashMap<Integer, Boolean> map = new HashMap<>(); |
| | | S7DataZKExtra s7DataZKExtra = s7SerializerZKQ2.read(S7DataZKExtra.class); |
| | | Boolean oneEntity = CMJ1ModbusTcp.readUInt16(42027 - 40001) != 0; |
| | | log.info("读取任务{}", CMJ1ModbusTcp.readUInt16(42027 - 40001)); |
| | | Boolean twoEntity = s7DataZKExtra.getIsFree(); |
| | | Boolean threeEntity = s7DataZKExtra.getIsFree03(); |
| | | // HashMap<Integer, ReadWriteEntity> map = new HashMap<>(); |
| | | // ReadWriteEntity oneEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree"); |
| | | // ReadWriteEntity twoEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | // ReadWriteEntity threeEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree03"); |
| | | map.put(930, oneEntity); |
| | | map.put(931, twoEntity); |
| | | map.put(932, threeEntity); |
| | |
| | | int cell = -1; |
| | | for (int i = 930; i <= 932; i++) { |
| | | if (null == hollowGlassOutRelationInfo) { |
| | | ReadWriteEntity entity = map.get(i); |
| | | Boolean entity = map.get(i); |
| | | cell = i; |
| | | if (null != entity.getValue() && ("1".equals(entity.getValue() + "") || Boolean.parseBoolean(entity.getValue() + ""))) { |
| | | // if (null != entity.getValue() && ("1".equals(entity.getValue() + "") || Boolean.parseBoolean(entity.getValue() + ""))) { |
| | | if (null != entity && entity) { |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService |
| | | .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | |
| | | String toOpcUa = ""; |
| | | String fromOpcUa = ""; |
| | | switch (i) { |
| | | case 0: |
| | | case 1: |
| | | requestWord = s7DataZKDLPOne.getId1().toString(); |
| | | statetWord = s7DataZKDLPOne.getState1().toString(); |
| | | toOpcUa = s7DataZKDLPOne.getTo1().toString(); |
| | | fromOpcUa = s7DataZKDLPOne.getFrom1().toString(); |
| | | break; |
| | | case 1: |
| | | case 2: |
| | | requestWord = s7DataZKDLPOne.getId2().toString(); |
| | | statetWord = s7DataZKDLPOne.getState2().toString(); |
| | | toOpcUa = s7DataZKDLPOne.getTo2().toString(); |
| | | fromOpcUa = s7DataZKDLPOne.getFrom2().toString(); |
| | | break; |
| | | case 2: |
| | | case 3: |
| | | requestWord = s7DataZKDLPOne.getId3().toString(); |
| | | statetWord = s7DataZKDLPOne.getState3().toString(); |
| | | toOpcUa = s7DataZKDLPOne.getTo3().toString(); |
| | | fromOpcUa = s7DataZKDLPOne.getFrom3().toString(); |
| | | break; |
| | | case 3: |
| | | case 4: |
| | | requestWord = s7DataZKDLPOne.getId4().toString(); |
| | | statetWord = s7DataZKDLPOne.getState4().toString(); |
| | | toOpcUa = s7DataZKDLPOne.getTo4().toString(); |
| | | fromOpcUa = s7DataZKDLPOne.getFrom4().toString(); |
| | | break; |
| | | case 4: |
| | | case 5: |
| | | requestWord = s7DataZKDLPOne.getId5().toString(); |
| | | statetWord = s7DataZKDLPOne.getState5().toString(); |
| | | toOpcUa = s7DataZKDLPOne.getTo5().toString(); |
| | | fromOpcUa = s7DataZKDLPOne.getFrom5().toString(); |
| | | break; |
| | | case 5: |
| | | case 6: |
| | | requestWord = s7DataZKDLPOne.getId6().toString(); |
| | | statetWord = s7DataZKDLPOne.getState6().toString(); |
| | | toOpcUa = s7DataZKDLPOne.getTo6().toString(); |
| | |
| | | } |
| | | |
| | | // if (null != requestWord.getValue()) { |
| | | if (null != requestWord) { |
| | | if (null != requestWord && !requestWord.isEmpty()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | // task.setGlassId(requestWord.getValue() + ""); |
| | | // task.setTargetSlot(Integer.parseInt(toOpcUa.getValue() + "")); |
| | |
| | | .eq(HollowBigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | item.setTargetSlot(0); |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item); |
| | | // bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item); |
| | | } |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | |
| | | s7DataZKDLPOne.setTo4(0); |
| | | s7DataZKDLPOne.setTo5(0); |
| | | s7DataZKDLPOne.setTo6(0); |
| | | s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | | s7DataZKDLPOne = new S7DataZKDLPOne(); |
| | | s7DataZKDLPOne.setMesReply(0); |
| | | s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | | } |
| | |
| | | log.info("当前为非联机状态,结束完成出片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | //获取出片任务表 |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | List<BigStorageCageTask> outTaskList = getOutTaskList(s7DataZKDLPTwo); |
| | | if (CollectionUtil.isEmpty(outTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | log.info("当前大车无出片玻璃,结束完成出片任务"); |
| | | return; |
| | | } |
| | | List<BigStorageCageTask> unFinishTaskList = outTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); |
| | |
| | | taskMap.forEach((e1, v) -> { |
| | | if (e1 == 2) { |
| | | //进片完成 |
| | | log.info("3、获取进片已完成的玻璃信息id:{}", v); |
| | | log.info("3、获取出片已完成的玻璃信息id:{}", v); |
| | | List<Integer> outSuccessGlassSlot = new ArrayList<>(); |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT)) { |
| | | outSuccessGlassSlot = v.stream().map(BigStorageCageTask::getStartSlot).collect(Collectors.toList()); |
| | |
| | | List<Integer> slotList = storageCageDTOList.stream().map(UpdateHollowBigStorageCageDTO::getTargetSlot).distinct().collect(Collectors.toList()); |
| | | hollowBigStorageCageDetailsService.updateDeviceIdBySlot(slotList); |
| | | } |
| | | log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", v); |
| | | log.info("4、大理片笼出片状态已完成已完成的玻璃信息id:{}", v); |
| | | updateSlotRemainBySlots(outSuccessGlassSlot); |
| | | } else if (e1 == 3) { |
| | | //破损处理 |
| | |
| | | } |
| | | |
| | | // 重置任务表数据 |
| | | bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | |
| | | // bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | resetOutTask(); |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 0)); |
| | |
| | | int glassCount = baseInfoList.size(); |
| | | List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>(); |
| | | //生成出片任务条数不足6补全 |
| | | for (T t : baseInfoList) { |
| | | bigStorageCageTaskList.add(new BigStorageCageTask(t.getGlassId(), t.getSlot(), targetSlot, 0)); |
| | | } |
| | | while (bigStorageCageTaskList.size() < 6) { |
| | | bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | } |
| | | // for (T t : baseInfoList) { |
| | | // bigStorageCageTaskList.add(new BigStorageCageTask(t.getGlassId(), t.getSlot(), targetSlot, 0)); |
| | | // } |
| | | // while (bigStorageCageTaskList.size() < 6) { |
| | | // bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0)); |
| | | // } |
| | | //清空任务表数据 |
| | | bigStorageCageTaskService.removeAll(tableName); |
| | | bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | resetOutTask(); |
| | | // bigStorageCageTaskService.removeAll(tableName); |
| | | // bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | S7DataZKDLPTwo s7DataZKDLPTwo = new S7DataZKDLPTwo(); |
| | | for (int i = 0; i < bigStorageCageTaskList.size() && i < 6; i++) { |
| | | String glassId = bigStorageCageTaskList.get(i).getGlassId(); |
| | | Integer startSlot = bigStorageCageTaskList.get(i).getStartSlot(); |
| | | Integer target = bigStorageCageTaskList.get(i).getTargetSlot(); |
| | | if (startSlot > 0) { |
| | | switch (i) { |
| | | case 0: |
| | | s7DataZKDLPTwo.setId1(glassId); |
| | | s7DataZKDLPTwo.setFrom1(startSlot); |
| | | s7DataZKDLPTwo.setTo1(target); |
| | | break; |
| | | case 1: |
| | | s7DataZKDLPTwo.setId2(glassId); |
| | | s7DataZKDLPTwo.setFrom2(startSlot); |
| | | s7DataZKDLPTwo.setTo2(target); |
| | | break; |
| | | case 2: |
| | | s7DataZKDLPTwo.setId3(glassId); |
| | | s7DataZKDLPTwo.setFrom3(startSlot); |
| | | s7DataZKDLPTwo.setTo3(target); |
| | | break; |
| | | case 3: |
| | | s7DataZKDLPTwo.setId4(glassId); |
| | | s7DataZKDLPTwo.setFrom4(startSlot); |
| | | s7DataZKDLPTwo.setTo4(target); |
| | | break; |
| | | case 4: |
| | | s7DataZKDLPTwo.setId5(glassId); |
| | | s7DataZKDLPTwo.setFrom5(startSlot); |
| | | s7DataZKDLPTwo.setTo5(target); |
| | | break; |
| | | case 5: |
| | | s7DataZKDLPTwo.setId6(glassId); |
| | | s7DataZKDLPTwo.setFrom6(startSlot); |
| | | s7DataZKDLPTwo.setTo6(target); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | s7SerializerZKDLPTwo.write(s7DataZKDLPTwo); |
| | | List<HollowBigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> { |
| | | HollowBigStorageCageHistoryTask history = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(e, history); |
| | |
| | | .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .in(HollowBigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | | |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 1)); |
| | | S7DataZKDLPTwo s7DataZKDLPTwo = new S7DataZKDLPTwo(); |
| | | s7DataZKDLPTwo = new S7DataZKDLPTwo(); |
| | | s7DataZKDLPTwo.setMesReply(1); |
| | | s7SerializerZKDLPTwo.write(s7DataZKDLPTwo); |
| | | } catch (Exception e) { |
| | |
| | | .value(value) |
| | | .build(); |
| | | } |
| | | |
| | | //读取出片地址 |
| | | private List<BigStorageCageTask> getOutTaskList(S7DataZKDLPTwo s7DataZKDLPTwo) { |
| | | List<BigStorageCageTask> outTaskList = new ArrayList<>(); |
| | | List<String> glassIds = s7DataZKDLPTwo.getIds(); |
| | | List<Integer> startSlots = s7DataZKDLPTwo.getFroms(); |
| | | List<Integer> endSlots = s7DataZKDLPTwo.getTos(); |
| | | List<Integer> states = s7DataZKDLPTwo.getStates(); |
| | | for (int i = 0; i < 6; i++) { |
| | | if (glassIds.get(i) != null && !glassIds.get(i).isEmpty()) { |
| | | BigStorageCageTask bigStorageCageTask = new BigStorageCageTask(); |
| | | bigStorageCageTask.setGlassId(glassIds.get(i)); |
| | | bigStorageCageTask.setStartSlot(startSlots.get(i)); |
| | | bigStorageCageTask.setTargetSlot(endSlots.get(i)); |
| | | bigStorageCageTask.setTaskState(states.get(i)); |
| | | outTaskList.add(bigStorageCageTask); |
| | | } |
| | | } |
| | | return outTaskList; |
| | | } |
| | | |
| | | //重置任务表 |
| | | private void resetOutTask() { |
| | | S7DataZKDLPTwo s7DataZKDLPTwo = new S7DataZKDLPTwo(); |
| | | s7DataZKDLPTwo.setId1(""); |
| | | s7DataZKDLPTwo.setId2(""); |
| | | s7DataZKDLPTwo.setId3(""); |
| | | s7DataZKDLPTwo.setId4(""); |
| | | s7DataZKDLPTwo.setId5(""); |
| | | s7DataZKDLPTwo.setId6(""); |
| | | s7DataZKDLPTwo.setFrom1(0); |
| | | s7DataZKDLPTwo.setFrom2(0); |
| | | s7DataZKDLPTwo.setFrom3(0); |
| | | s7DataZKDLPTwo.setFrom4(0); |
| | | s7DataZKDLPTwo.setFrom5(0); |
| | | s7DataZKDLPTwo.setFrom6(0); |
| | | s7DataZKDLPTwo.setTo1(0); |
| | | s7DataZKDLPTwo.setTo2(0); |
| | | s7DataZKDLPTwo.setTo3(0); |
| | | s7DataZKDLPTwo.setTo4(0); |
| | | s7DataZKDLPTwo.setTo5(0); |
| | | s7DataZKDLPTwo.setTo6(0); |
| | | s7DataZKDLPTwo.setState1(0); |
| | | s7DataZKDLPTwo.setState2(0); |
| | | s7DataZKDLPTwo.setState3(0); |
| | | s7DataZKDLPTwo.setState4(0); |
| | | s7DataZKDLPTwo.setState5(0); |
| | | s7DataZKDLPTwo.setState6(0); |
| | | s7SerializerZKDLPTwo.write(s7DataZKDLPTwo); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | |
| | | import com.mes.largenscreen.entity.RunTime; |
| | | import com.mes.s7.entity.S7DataZKDLPOne; |
| | | import com.mes.s7.entity.S7DataZKDLPTwo; |
| | | import com.mes.s7.entity.S7DataZKExtra; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Qualifier("s7SerializerZKDLPTwo") |
| | | private S7Serializer s7SerializerZKDLPTwo; |
| | | |
| | | @Autowired |
| | | @Qualifier("s7SerializerZKQ2") |
| | | private S7Serializer s7SerializerZKQ2; |
| | | |
| | | @Autowired |
| | | @Qualifier("CMJ1ModbusTcp") |
| | | ModbusTcp CMJ1ModbusTcp; |
| | | |
| | | @Autowired |
| | | @Qualifier("CMJ2ModbusTcp") |
| | | ModbusTcp CMJ2ModbusTcp; |
| | | |
| | | private Integer offset = 40001; |
| | | |
| | | @Resource |
| | | RedisUtil redisUtil; |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskOne() { |
| | | hollowGlassTaskChild(930, "CMJ1.CMJ1.isFree", "HollowGlassOne"); |
| | | hollowGlassTaskChild(930, CMJ1ModbusTcp.readUInt16(42027 - offset) + "", "HollowGlassOne"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskTwo() { |
| | | hollowGlassTaskChild(931, "ZKQ2.ZKQ2.isFree", "HollowGlassTwo"); |
| | | S7DataZKExtra s7DataZKExtra = s7SerializerZKQ2.read(S7DataZKExtra.class); |
| | | hollowGlassTaskChild(931, (s7DataZKExtra.getIsFree() ? 1 : 0) + "", "HollowGlassTwo"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskThree() { |
| | | S7DataZKExtra s7DataZKExtra = s7SerializerZKQ2.read(S7DataZKExtra.class); |
| | | //todo:暂无三线的空闲状态信号,临时标签空闲状态 |
| | | hollowGlassTaskChild(932, "ZKQ3.ZKQ3.isFree", "HollowGlassThree"); |
| | | hollowGlassTaskChild(932, (s7DataZKExtra.getIsFree03() ? 1 : 0) + "", "HollowGlassThree"); |
| | | } |
| | | |
| | | public void hollowGlassTaskChild(int cell, String isFreeTag, String websocketName) { |
| | |
| | | List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>().in(HollowGlassQueueInfo::getRelationId, taskIdList)); |
| | | jsonObject.append("queueInfo", list); |
| | | } |
| | | |
| | | try { |
| | | //930空闲信号 |
| | | ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa(isFreeTag); |
| | | jsonObject.append("freeRequest", freeOneRequestEntity.getValue()); |
| | | jsonObject.append("freeRequest", isFreeTag); |
| | | } catch (Exception e) { |
| | | log.error("opc存在异常", e); |
| | | } |
| | |
| | | public void queryDataSource1(JSONObject jsonObject) throws Exception { |
| | | S7DataZKDLPOne s7DataZKDLPOne = s7SerializerZKDLPOne.read(S7DataZKDLPOne.class); |
| | | S7DataZKDLPTwo s7DataZKDLPTwo = s7SerializerZKDLPTwo.read(S7DataZKDLPTwo.class); |
| | | S7DataZKExtra s7DataZKExtra = s7SerializerZKQ2.read(S7DataZKExtra.class); |
| | | List<Double> carPostion = new ArrayList<>(); |
| | | carPostion.add(0.25); |
| | | carPostion.add(0.5); |
| | |
| | | List<BigStorageTaskVO> inTaskList = new ArrayList(); |
| | | // ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP2A.DLP2A.FROM1"); |
| | | String fromOpcUa = s7DataZKDLPOne.getFrom1().toString(); |
| | | for (int i = 1; i <= 6; i++) { |
| | | for (int i = 0; i < 6; i++) { |
| | | // ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP2A.DLP2A.DI" + i); |
| | | // ReadWriteEntity targetSlotWord = miloService.readFromOpcUa("DLP2A.DLP2A.TO" + i); |
| | | // ReadWriteEntity stateWord = miloService.readFromOpcUa("DLP2A.DLP2A.STATE" + i); |
| | |
| | | String targetSlotWord = ""; |
| | | switch (i) { |
| | | case 0: |
| | | requestWord = s7DataZKDLPOne.getId1().toString(); |
| | | requestWord = s7DataZKDLPOne.getId1(); |
| | | stateWord = s7DataZKDLPOne.getState1().toString(); |
| | | targetSlotWord = s7DataZKDLPOne.getTo1().toString(); |
| | | break; |
| | | case 1: |
| | | requestWord = s7DataZKDLPOne.getId2().toString(); |
| | | requestWord = s7DataZKDLPOne.getId2(); |
| | | stateWord = s7DataZKDLPOne.getState2().toString(); |
| | | targetSlotWord = s7DataZKDLPOne.getTo2().toString(); |
| | | break; |
| | | case 2: |
| | | requestWord = s7DataZKDLPOne.getId3().toString(); |
| | | requestWord = s7DataZKDLPOne.getId3(); |
| | | stateWord = s7DataZKDLPOne.getState3().toString(); |
| | | targetSlotWord = s7DataZKDLPOne.getTo3().toString(); |
| | | break; |
| | | case 3: |
| | | requestWord = s7DataZKDLPOne.getId4().toString(); |
| | | requestWord = s7DataZKDLPOne.getId4(); |
| | | stateWord = s7DataZKDLPOne.getState4().toString(); |
| | | targetSlotWord = s7DataZKDLPOne.getTo4().toString(); |
| | | break; |
| | | case 4: |
| | | requestWord = s7DataZKDLPOne.getId5().toString(); |
| | | requestWord = s7DataZKDLPOne.getId5(); |
| | | stateWord = s7DataZKDLPOne.getState5().toString(); |
| | | targetSlotWord = s7DataZKDLPOne.getTo5().toString(); |
| | | break; |
| | | case 5: |
| | | requestWord = s7DataZKDLPOne.getId6().toString(); |
| | | requestWord = s7DataZKDLPOne.getId6(); |
| | | stateWord = s7DataZKDLPOne.getState6().toString(); |
| | | targetSlotWord = s7DataZKDLPOne.getTo6().toString(); |
| | | break; |
| | |
| | | String outRequestEntity = s7DataZKDLPTwo.getRequestMes().toString(); |
| | | jsonObject.append("outInkageEntity", outInkageEntity); |
| | | //930空闲信号 |
| | | ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree"); |
| | | jsonObject.append("freeOneRequestEntity", freeOneRequestEntity.getValue()); |
| | | // ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree"); |
| | | // jsonObject.append("freeOneRequestEntity", freeOneRequestEntity.getValue()); |
| | | jsonObject.append("freeOneRequestEntity", CMJ1ModbusTcp.readUInt16(42027 - offset)); |
| | | //931空闲信号 |
| | | ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue()); |
| | | // ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | // jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue()); |
| | | jsonObject.append("freeTwoRequestEntity", s7DataZKExtra.getIsFree()); |
| | | //932空闲信号 |
| | | ReadWriteEntity freeThreeRequestEntity = miloService.readFromOpcUa("ZKQ3.ZKQ3.isFree"); |
| | | jsonObject.append("freeThreeRequestEntity", freeThreeRequestEntity.getValue()); |
| | | // ReadWriteEntity freeThreeRequestEntity = miloService.readFromOpcUa("ZKQ3.ZKQ3.isFree"); |
| | | // jsonObject.append("freeThreeRequestEntity", freeThreeRequestEntity.getValue()); |
| | | jsonObject.append("freeThreeRequestEntity", s7DataZKExtra.getIsFree()); |
| | | } catch (Exception e) { |
| | | //todo:不做任务处理 |
| | | } |
| | | |
| | | //出片任务数据 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_two_task"); |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_two_task"); |
| | | // jsonObject.append("bigStorageCageDetailsOutTask", outTaskList); |
| | | List<BigStorageCageTask> outTaskList = new ArrayList<>(); |
| | | for (int i = 0; i < 6; i++) { |
| | | |
| | | BigStorageCageTask bigStorageCageTask = new BigStorageCageTask(); |
| | | String glassId = ""; |
| | | Integer startSlot = 0; |
| | | Integer targetSlot = 0; |
| | | Integer taskState = 0; |
| | | switch (i) { |
| | | case 0: |
| | | glassId = s7DataZKDLPTwo.getId1(); |
| | | startSlot = s7DataZKDLPTwo.getFrom1(); |
| | | targetSlot = s7DataZKDLPTwo.getTo1(); |
| | | taskState = s7DataZKDLPTwo.getState1(); |
| | | ; |
| | | break; |
| | | case 1: |
| | | glassId = s7DataZKDLPTwo.getId2(); |
| | | startSlot = s7DataZKDLPTwo.getFrom2(); |
| | | targetSlot = s7DataZKDLPTwo.getTo2(); |
| | | taskState = s7DataZKDLPTwo.getState2(); |
| | | break; |
| | | case 2: |
| | | glassId = s7DataZKDLPTwo.getId3(); |
| | | startSlot = s7DataZKDLPTwo.getFrom3(); |
| | | targetSlot = s7DataZKDLPTwo.getTo3(); |
| | | taskState = s7DataZKDLPTwo.getState3(); |
| | | break; |
| | | case 3: |
| | | glassId = s7DataZKDLPTwo.getId4(); |
| | | startSlot = s7DataZKDLPTwo.getFrom4(); |
| | | targetSlot = s7DataZKDLPTwo.getTo4(); |
| | | taskState = s7DataZKDLPTwo.getState4(); |
| | | break; |
| | | case 4: |
| | | glassId = s7DataZKDLPTwo.getId5(); |
| | | startSlot = s7DataZKDLPTwo.getFrom5(); |
| | | targetSlot = s7DataZKDLPTwo.getTo5(); |
| | | taskState = s7DataZKDLPTwo.getState5(); |
| | | break; |
| | | case 5: |
| | | glassId = s7DataZKDLPTwo.getId6(); |
| | | startSlot = s7DataZKDLPTwo.getFrom6(); |
| | | targetSlot = s7DataZKDLPTwo.getTo6(); |
| | | taskState = s7DataZKDLPTwo.getState6(); |
| | | break; |
| | | } |
| | | bigStorageCageTask.setGlassId(glassId); |
| | | bigStorageCageTask.setStartSlot(startSlot); |
| | | bigStorageCageTask.setTargetSlot(targetSlot); |
| | | bigStorageCageTask.setTaskState(taskState); |
| | | outTaskList.add(bigStorageCageTask); |
| | | } |
| | | jsonObject.append("bigStorageCageDetailsOutTask", outTaskList); |
| | | |
| | | //调度开关 |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | |
| | | public class S7DataZKDLPOne { |
| | | |
| | | |
| | | @S7Variable(address = "DB3.8", type = EDataType.BOOL) |
| | | @S7Variable(address = "DB3.2992.0", type = EDataType.BOOL) |
| | | private Boolean mesControl; |
| | | |
| | | @S7Variable(address = "DB19.0", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.0", type = EDataType.UINT16) |
| | | private Integer requestMes; |
| | | |
| | | @S7Variable(address = "DB19.2", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.2", type = EDataType.UINT16) |
| | | private Integer mesReply; |
| | | |
| | | @S7Variable(address = "DB19.140", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.140", type = EDataType.UINT16) |
| | | private Integer from1; |
| | | |
| | | @S7Variable(address = "DB19.142", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.142", type = EDataType.UINT16) |
| | | private Integer from2; |
| | | |
| | | @S7Variable(address = "DB19.144", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.144", type = EDataType.UINT16) |
| | | private Integer from3; |
| | | |
| | | @S7Variable(address = "DB19.146", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.146", type = EDataType.UINT16) |
| | | private Integer from4; |
| | | |
| | | @S7Variable(address = "DB19.148", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.148", type = EDataType.UINT16) |
| | | private Integer from5; |
| | | |
| | | @S7Variable(address = "DB19.150", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.150", type = EDataType.UINT16) |
| | | private Integer from6; |
| | | |
| | | @S7Variable(address = "DB19.152", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.152", type = EDataType.UINT16) |
| | | private Integer to1; |
| | | |
| | | @S7Variable(address = "DB19.154", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.154", type = EDataType.UINT16) |
| | | private Integer to2; |
| | | |
| | | @S7Variable(address = "DB19.156", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.156", type = EDataType.UINT16) |
| | | private Integer to3; |
| | | |
| | | @S7Variable(address = "DB19.158", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.158", type = EDataType.UINT16) |
| | | private Integer to4; |
| | | |
| | | @S7Variable(address = "DB19.160", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.160", type = EDataType.UINT16) |
| | | private Integer to5; |
| | | |
| | | @S7Variable(address = "DB19.162", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.162", type = EDataType.UINT16) |
| | | private Integer to6; |
| | | |
| | | @S7Variable(address = "DB19.164", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.164", type = EDataType.UINT16) |
| | | private Integer state1; |
| | | |
| | | @S7Variable(address = "DB19.166", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.166", type = EDataType.UINT16) |
| | | private Integer state2; |
| | | |
| | | @S7Variable(address = "DB19.168", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.168", type = EDataType.UINT16) |
| | | private Integer state3; |
| | | |
| | | @S7Variable(address = "DB19.170", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.170", type = EDataType.UINT16) |
| | | private Integer state4; |
| | | |
| | | @S7Variable(address = "DB19.172", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.172", type = EDataType.UINT16) |
| | | private Integer state5; |
| | | |
| | | @S7Variable(address = "DB19.174", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.174", type = EDataType.UINT16) |
| | | private Integer state6; |
| | | |
| | | @S7Variable(address = "DB19.1246", type = EDataType.UINT16) |
| | | private Integer glassCount; |
| | | |
| | | @S7Variable(address = "DB19.8", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.8", type = EDataType.STRING, count = 14) |
| | | private String id1; |
| | | |
| | | @S7Variable(address = "DB19.30", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.30", type = EDataType.STRING, count = 14) |
| | | private String id2; |
| | | |
| | | @S7Variable(address = "DB19.52", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.52", type = EDataType.STRING, count = 14) |
| | | private String id3; |
| | | |
| | | @S7Variable(address = "DB19.74", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.74", type = EDataType.STRING, count = 14) |
| | | private String id4; |
| | | |
| | | @S7Variable(address = "DB19.96", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.96", type = EDataType.STRING, count = 14) |
| | | private String id5; |
| | | |
| | | @S7Variable(address = "DB19.118", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.118", type = EDataType.STRING, count = 14) |
| | | private String id6; |
| | | |
| | | @S7Variable(address = "MW1002", type = EDataType.UINT16) |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | |
| | | public class S7DataZKDLPTwo { |
| | | |
| | | |
| | | @S7Variable(address = "DB3.8", type = EDataType.BOOL) |
| | | @S7Variable(address = "DB3.2992.0", type = EDataType.BOOL) |
| | | private Boolean mesControl; |
| | | |
| | | @S7Variable(address = "DB19.4", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.4", type = EDataType.UINT16) |
| | | private Integer requestMes; |
| | | |
| | | @S7Variable(address = "DB19.6", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.6", type = EDataType.UINT16) |
| | | private Integer mesReply; |
| | | |
| | | @S7Variable(address = "DB19.308", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.308", type = EDataType.UINT16) |
| | | private Integer from1; |
| | | |
| | | @S7Variable(address = "DB19.310", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.310", type = EDataType.UINT16) |
| | | private Integer from2; |
| | | |
| | | @S7Variable(address = "DB19.312", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.312", type = EDataType.UINT16) |
| | | private Integer from3; |
| | | |
| | | @S7Variable(address = "DB19.314", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.314", type = EDataType.UINT16) |
| | | private Integer from4; |
| | | |
| | | @S7Variable(address = "DB19.316", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.316", type = EDataType.UINT16) |
| | | private Integer from5; |
| | | |
| | | @S7Variable(address = "DB19.318", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.318", type = EDataType.UINT16) |
| | | private Integer from6; |
| | | |
| | | @S7Variable(address = "DB19.320", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.320", type = EDataType.UINT16) |
| | | private Integer to1; |
| | | |
| | | @S7Variable(address = "DB19.322", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.322", type = EDataType.UINT16) |
| | | private Integer to2; |
| | | |
| | | @S7Variable(address = "DB19.324", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.324", type = EDataType.UINT16) |
| | | private Integer to3; |
| | | |
| | | @S7Variable(address = "DB19.326", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.326", type = EDataType.UINT16) |
| | | private Integer to4; |
| | | |
| | | @S7Variable(address = "DB19.328", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.328", type = EDataType.UINT16) |
| | | private Integer to5; |
| | | |
| | | @S7Variable(address = "DB19.330", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.330", type = EDataType.UINT16) |
| | | private Integer to6; |
| | | |
| | | @S7Variable(address = "DB19.332", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.332", type = EDataType.UINT16) |
| | | private Integer state1; |
| | | |
| | | @S7Variable(address = "DB19.334", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.334", type = EDataType.UINT16) |
| | | private Integer state2; |
| | | |
| | | @S7Variable(address = "DB19.336", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.336", type = EDataType.UINT16) |
| | | private Integer state3; |
| | | |
| | | @S7Variable(address = "DB19.338", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.338", type = EDataType.UINT16) |
| | | private Integer state4; |
| | | |
| | | @S7Variable(address = "DB19.340", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.340", type = EDataType.UINT16) |
| | | private Integer state5; |
| | | |
| | | @S7Variable(address = "DB19.342", type = EDataType.UINT16) |
| | | @S7Variable(address = "DB7.342", type = EDataType.UINT16) |
| | | private Integer state6; |
| | | |
| | | @S7Variable(address = "DB19.176", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.176", type = EDataType.STRING, count = 14) |
| | | private String id1; |
| | | |
| | | @S7Variable(address = "DB19.198", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.198", type = EDataType.STRING, count = 14) |
| | | private String id2; |
| | | |
| | | @S7Variable(address = "DB19.220", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.220", type = EDataType.STRING, count = 14) |
| | | private String id3; |
| | | |
| | | @S7Variable(address = "DB19.242", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.242", type = EDataType.STRING, count = 14) |
| | | private String id4; |
| | | |
| | | @S7Variable(address = "DB19.264", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.264", type = EDataType.STRING, count = 14) |
| | | private String id5; |
| | | |
| | | @S7Variable(address = "DB19.286", type = EDataType.STRING, count = 20) |
| | | @S7Variable(address = "DB7.286", type = EDataType.STRING, count = 14) |
| | | private String id6; |
| | | |
| | | public List<Integer> getStates() { |
| | | return Arrays.asList(state1, state2, state3, state4, state5, state6); |
| | | } |
| | | |
| | | public List<String> getIds() { |
| | | return Arrays.asList(id1, id2, id3, id4, id5, id6); |
| | | } |
| | | |
| | | public List<Integer> getTos() { |
| | | return Arrays.asList(to1, to2, to3, to4, to5, to6); |
| | | } |
| | | |
| | | public List<Integer> getFroms() { |
| | | return Arrays.asList(from1, from2, from3, from4, from5, from6); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.mes.s7.entity; |
| | | |
| | | import com.github.xingshuangs.iot.common.enums.EDataType; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Variable; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2025/4/30 14:19 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class S7DataZKExtra { |
| | | |
| | | @S7Variable(address = "DB20.0.0", type = EDataType.BOOL) |
| | | private Boolean isFree; |
| | | |
| | | @S7Variable(address = "DB20.0.1", type = EDataType.BOOL) |
| | | private Boolean isFree03; |
| | | |
| | | } |