| | |
| | | @Bean(name = "s7SerializerWLOne") |
| | | public S7Serializer s7SerializerWLOne() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.100"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerWLTwo") |
| | | public S7Serializer s7SerializerWLTwo() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.130"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerMBOne") |
| | | public S7Serializer s7SerializerMBOne() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.58"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerMBTwo") |
| | | public S7Serializer s7SerializerMBTwo() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.18"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.opctask.entity.EdgStorageDeviceTask; |
| | | import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; |
| | | import com.mes.opctask.service.EdgStorageDeviceTaskHistoryService; |
| | | import com.mes.opctask.service.EdgStorageDeviceTaskService; |
| | |
| | | import com.mes.s7.entity.S7DataWL; |
| | | import com.mes.s7.entity.S7DataWLExtra; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | public void startOneOpcTask() throws Exception { |
| | | S7DataWL s7DataWLTwo = s7SerializerWLTwo.read(S7DataWL.class); |
| | | S7DataWL s7DataWLOne = s7SerializerWLOne.read(S7DataWL.class); |
| | | log.info("二线卧理: {}", s7DataWLTwo); |
| | | log.info("一线卧理: {}", s7DataWLOne); |
| | | //获取第二条线路的卧式理片笼状态 |
| | | // ReadWriteEntity twoInkageEntity = miloService.readFromOpcUa("WL2.WL2.deviceState"); |
| | | Boolean twoInkageEntity = s7DataWLTwo.getDeviceState(); |
| | | // Boolean twoInkageEntity = Boolean.FALSE; |
| | | //默认只跑一台卧式理片,两条线路都可以走 |
| | | int cellFlag = 1; |
| | | //如果两条线都启动则只能跑一条线 |
| | |
| | | public void startTwoOpcTask() throws Exception { |
| | | S7DataWL s7DataWLOne = s7SerializerWLOne.read(S7DataWL.class); |
| | | S7DataWL s7DataWLTwo = s7SerializerWLTwo.read(S7DataWL.class); |
| | | log.info("一线卧理: {}", s7DataWLOne); |
| | | log.info("二线卧理: {}", s7DataWLTwo); |
| | | // ReadWriteEntity oneInkageEntity = miloService.readFromOpcUa("WL1.WL1.deviceState"); |
| | | Boolean oneInkageEntity = s7DataWLOne.getDeviceState(); |
| | | int cellFlag = 1; |
| | |
| | | // task.setTaskRunning(Const.GLASS_CACHE_TYPE_RUNNING); |
| | | // edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | if (device == 2) { |
| | | s7SerializerWLTwo.write(S7DataWL.builder().taskRunning(Const.GLASS_CACHE_TYPE_RUNNING.shortValue()).build()); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_RUNNING); |
| | | s7SerializerWLTwo.write(S7DataWL.builder().taskRunning(Const.GLASS_CACHE_TYPE_RUNNING).build()); |
| | | } else { |
| | | s7SerializerWLOne.write(S7DataWL.builder().taskRunning(Const.GLASS_CACHE_TYPE_RUNNING.shortValue()).build()); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_RUNNING); |
| | | s7SerializerWLOne.write(S7DataWL.builder().taskRunning(Const.GLASS_CACHE_TYPE_RUNNING).build()); |
| | | } |
| | | |
| | | } else if (request == 5) { |
| | |
| | | // String glassId = task.getGlassId(); |
| | | S7DataWL s7DataWLOne = s7SerializerWLOne.read(S7DataWL.class); |
| | | String glassId = s7DataWLOne.getGlassId(); |
| | | log.info("1号线玻璃id{},历史id{}", glassId, glassIdOne); |
| | | if (StringUtils.isBlank(glassId) || glassId.equals(glassIdOne)) { |
| | | log.info("{}号线磨边前玻璃未就位,结束本次任务", 1); |
| | | return; |
| | |
| | | // EdgStorageDeviceTask task = edgStorageDeviceTaskService.queryTaskMessage(EDG_STORAGE_DEVICE_TWO_TASK); |
| | | // String glassId = task.getGlassId(); |
| | | S7DataWL s7DataWLTwo = s7SerializerWLTwo.read(S7DataWL.class); |
| | | // S7DataMB s7DataMB = s7SerializerMBOne.read(S7DataMB.class); |
| | | // log.info("磨边数据{}", s7DataMB); |
| | | String glassId = s7DataWLTwo.getGlassId(); |
| | | log.info("2号线玻璃id{},历史id{}", glassId, glassIdTwo); |
| | | if (StringUtils.isBlank(glassId) || glassId.equals(glassIdTwo)) { |
| | | log.info("{}号线磨边前玻璃未就位,结束本次任务", 2); |
| | | return; |
| | |
| | | // |
| | | // miloService.writeToOpcUa(list); |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".thickness", (int) glassInfo.getThickness() * ratio)); |
| | | |
| | | S7DataMB s7DataMB = new S7DataMB(); |
| | | s7DataMB.setToEdingId(Integer.parseInt(toEndingId)); |
| | | s7DataMB.setGlassId(Integer.parseInt(toEndingId)); |
| | | s7DataMB.setWidth((int) Math.max(glassInfo.getWidth() * ratio, glassInfo.getHeight() * ratio)); |
| | | s7DataMB.setHeight((int) Math.min(glassInfo.getWidth() * ratio, glassInfo.getHeight() * ratio)); |
| | | s7SerializerMBOne.write(s7DataMB); |
| | | |
| | | log.info("玻璃id:{},{}线向PLC发送宽高数据{}", glassId, cell, s7DataMB); |
| | | if (cell == 1) { |
| | | s7SerializerMBOne.write(s7DataMB); |
| | | } else { |
| | | s7SerializerMBTwo.write(s7DataMB); |
| | | } |
| | | s7DataMB = new S7DataMB(); |
| | | s7DataMB.setThickness((short) (glassInfo.getThickness() * ratio)); |
| | | s7DataMB.setThickness((int) (glassInfo.getThickness() * ratio)); |
| | | log.info("{}线向PLC发送厚度数据{}", cell, s7DataMB); |
| | | if (cell == 1) { |
| | | s7SerializerMBOne.write(s7DataMB); |
| | | } else { |
| | |
| | | // task.setStartCell(edgStorageCage.getSlot()); |
| | | // task.setTaskRunning(Const.GLASS_CACHE_TYPE_IN); |
| | | // edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | task.setStartCell(edgStorageCage.getSlot().shortValue()); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_IN.shortValue()); |
| | | task.setStartCell(edgStorageCage.getSlot()); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_IN); |
| | | if (deviceId == 1) { |
| | | s7SerializerWLOne.write( |
| | | S7DataWL.builder().startCell(edgStorageCage.getSlot().shortValue()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_IN.shortValue()).build() |
| | | S7DataWL.builder().startCell(edgStorageCage.getSlot()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_IN).build() |
| | | ); |
| | | } else { |
| | | s7SerializerWLTwo.write( |
| | | S7DataWL.builder().startCell(edgStorageCage.getSlot().shortValue()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_IN.shortValue()).build() |
| | | S7DataWL.builder().startCell(edgStorageCage.getSlot()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_IN).build() |
| | | ); |
| | | } |
| | | saveHistoryTask(task, deviceId); |
| | |
| | | S7DataWL s7DataWLOne = s7SerializerWLOne.read(S7DataWL.class); |
| | | S7DataWL s7DataWLTwo = s7SerializerWLTwo.read(S7DataWL.class); |
| | | S7DataWLExtra s7DataWLExtraTwo = s7SerializerWLTwo.read(S7DataWLExtra.class); |
| | | Short oneOutStateEntity = s7DataWLOne.getSlotState(); |
| | | Short twoOutStateEntity = s7DataWLTwo.getSlotState(); |
| | | Short d06OutStateEntity = s7DataWLExtraTwo.getD06SlotState(); |
| | | Integer oneOutStateEntity = s7DataWLOne.getSlotState(); |
| | | Integer twoOutStateEntity = s7DataWLTwo.getSlotState(); |
| | | Integer d06OutStateEntity = s7DataWLExtraTwo.getD06SlotState(); |
| | | //状态有3中情况:0空闲 1忙碌 2禁用 |
| | | String oneOutState = Const.OUT_DISABLE; |
| | | String twoOutState = Const.OUT_DISABLE; |
| | |
| | | log.info("5、更新出片玻璃的状态为{}", Const.GLASS_STATE_OUT); |
| | | } |
| | | //生成出片任务 |
| | | // task.setGlassIdOut(edgStorageCageDetails.getGlassId()); |
| | | // task.setStartCell(edgStorageCageDetails.getSlot()); |
| | | // task.setTaskRunning(taskType); |
| | | // task.setEndCell(cell); |
| | | task.setGlassIdOut(edgStorageCageDetails.getGlassId()); |
| | | task.setStartCell(edgStorageCageDetails.getSlot()); |
| | | task.setTaskRunning(taskType); |
| | | task.setEndCell(cell); |
| | | // edgStorageDeviceTaskService.updateTaskMessage(tableName, task); |
| | | if (deviceId == 1) { |
| | | s7SerializerWLOne.write( |
| | | S7DataWL.builder() |
| | | .glassIdOut(edgStorageCageDetails.getGlassId()) |
| | | .startCell(edgStorageCageDetails.getSlot().shortValue()) |
| | | .taskRunning((short) taskType) |
| | | .endCell((short) cell) |
| | | .startCell(edgStorageCageDetails.getSlot()) |
| | | .taskRunning(taskType) |
| | | .endCell(cell) |
| | | .build() |
| | | ); |
| | | } else { |
| | | s7SerializerWLTwo.write( |
| | | S7DataWL.builder() |
| | | .glassIdOut(edgStorageCageDetails.getGlassId()) |
| | | .startCell(edgStorageCageDetails.getSlot().shortValue()) |
| | | .taskRunning((short) taskType) |
| | | .endCell((short) cell) |
| | | .startCell(edgStorageCageDetails.getSlot()) |
| | | .taskRunning(taskType) |
| | | .endCell(cell) |
| | | .build() |
| | | ); |
| | | } |
| | |
| | | if (device == 1) { |
| | | s7SerializerWLOne.write( |
| | | S7DataWL.builder() |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY.shortValue()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY) |
| | | .glassIdOut("") |
| | | .startCell((short) 0) |
| | | .endCell((short) 0) |
| | | .startCell(0) |
| | | .endCell(0) |
| | | .build() |
| | | ); |
| | | } else { |
| | | s7SerializerWLTwo.write( |
| | | S7DataWL.builder() |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY.shortValue()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY) |
| | | .glassIdOut("") |
| | | .startCell((short) 0) |
| | | .endCell((short) 0) |
| | | .startCell(0) |
| | | .endCell(0) |
| | | .build() |
| | | ); |
| | | } |
| | |
| | | if (device == 1) { |
| | | s7SerializerWLOne.write( |
| | | S7DataWL.builder() |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY.shortValue()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY) |
| | | .glassIdOut("") |
| | | .startCell((short) 0) |
| | | .endCell((short) 0) |
| | | .startCell(0) |
| | | .endCell(0) |
| | | .build() |
| | | ); |
| | | } else { |
| | | s7SerializerWLTwo.write( |
| | | S7DataWL.builder() |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY.shortValue()) |
| | | .taskRunning(Const.GLASS_CACHE_TYPE_EMPTY) |
| | | .glassIdOut("") |
| | | .startCell((short) 0) |
| | | .endCell((short) 0) |
| | | .startCell(0) |
| | | .endCell(0) |
| | | .build() |
| | | ); |
| | | } |
| | |
| | | EdgStorageDeviceTaskHistory taskHistory = new EdgStorageDeviceTaskHistory(); |
| | | BeanUtils.copyProperties(task, taskHistory); |
| | | // taskHistory.setTaskType(task.getTaskRunning()); |
| | | taskHistory.setTaskType(Integer.parseInt(task.getTaskRunning().toString())); |
| | | taskHistory.setTaskType(task.getTaskRunning()); |
| | | taskHistory.setCreateTime(new Date()); |
| | | taskHistory.setTaskState(Const.RAW_GLASS_TASK_NEW); |
| | | taskHistory.setDeviceId(deviceId); |
| | |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 2000) |
| | | public void startOneEdgTask() throws Exception { |
| | | startEdgTaskChild("01"); |
| | |
| | | |
| | | private void startEdgTaskChild(String cell) throws Exception { |
| | | S7DataMBExtra s7DataMBExtra = s7SerializerMBExtra.read(S7DataMBExtra.class); |
| | | |
| | | log.info("MB04读取数据{}", s7DataMBExtra); |
| | | // ReadWriteEntity request = miloService.readFromOpcUa("MB04.MB04.request" + cell); |
| | | // if (null == request || "0".equals(request.getValue() + "")) { |
| | | String request = ""; |
| | |
| | | // ualist.add(generateReadWriteEntity("MB04.MB04.thickness" + cell, (int) glassInfo.getThickness() * 10)); |
| | | // miloService.writeToOpcWord(ualist); |
| | | // miloService.writeToOpcUa(generateReadWriteEntity("MB04.MB04.mes_glass_Id_" + cell, glassId)); |
| | | |
| | | log.info("{}线发送尺寸信息宽:{},高:{},厚度:{}", cell, Math.max(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10), Math.min(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10), glassInfo.getThickness() * 10); |
| | | if ("01".equals(cell)) { |
| | | s7SerializerMBExtra.write( |
| | | S7DataMBExtra.builder() |
| | | .widthOne((short) Math.max(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .heightOne((short) Math.min(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .thicknessOne((short) (glassInfo.getThickness() * 10)) |
| | | .widthOne((int) Math.max(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .heightOne((int) Math.min(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .thicknessOne((int) (glassInfo.getThickness() * 10)) |
| | | .build() |
| | | ); |
| | | s7SerializerMBExtra.write( |
| | |
| | | } else { |
| | | s7SerializerMBExtra.write( |
| | | S7DataMBExtra.builder() |
| | | .widthTwo((short) Math.max(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .heightTwo((short) Math.min(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .thicknessTwo((short) (glassInfo.getThickness() * 10)) |
| | | .widthTwo((int) Math.max(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .heightTwo((int) Math.min(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10)) |
| | | .thicknessTwo((int) (glassInfo.getThickness() * 10)) |
| | | .build() |
| | | ); |
| | | s7SerializerMBExtra.write( |
| | |
| | | public class S7DataMB { |
| | | |
| | | |
| | | @S7Variable(address = "DB19.6", type = EDataType.FLOAT32) |
| | | @S7Variable(address = "DB323.6", type = EDataType.FLOAT32) |
| | | private Float speed; |
| | | |
| | | @S7Variable(address = "DB49.10", type = EDataType.INT32) |
| | | private Integer width; |
| | | |
| | | @S7Variable(address = "DB49.2", type = EDataType.INT32) |
| | | @S7Variable(address = "DB324.2", type = EDataType.INT32) |
| | | private Integer toEdingId; |
| | | |
| | | @S7Variable(address = "DB49.6", type = EDataType.INT32) |
| | | @S7Variable(address = "DB324.6", type = EDataType.INT32) |
| | | private Integer glassId; |
| | | |
| | | @S7Variable(address = "DB49.14", type = EDataType.INT32) |
| | | @S7Variable(address = "DB324.10", type = EDataType.INT32) |
| | | private Integer width; |
| | | |
| | | @S7Variable(address = "DB324.14", type = EDataType.INT32) |
| | | private Integer height; |
| | | |
| | | @S7Variable(address = "DB49.18", type = EDataType.INT16) |
| | | private Short thickness; |
| | | @S7Variable(address = "DB324.18", type = EDataType.UINT16) |
| | | private Integer thickness; |
| | | |
| | | @S7Variable(address = "DB49.0.3", type = EDataType.BOOL) |
| | | @S7Variable(address = "DB324.0.3", type = EDataType.BOOL) |
| | | private Boolean mesControl; |
| | | |
| | | // @S7Variable(address = "DB49.126", type = EDataType.INT32) |
| | | // private Integer toEdingId; |
| | | // |
| | | // @S7Variable(address = "DB49.130", type = EDataType.INT32) |
| | | // private Integer glassId; |
| | | // |
| | | // @S7Variable(address = "DB49.134", type = EDataType.INT32) |
| | | // private Integer width; |
| | | // |
| | | // @S7Variable(address = "DB49.138", type = EDataType.INT32) |
| | | // private Integer height; |
| | | // |
| | | // @S7Variable(address = "DB49.142", type = EDataType.UINT16) |
| | | // private Short thickness; |
| | | |
| | | } |
| | |
| | | public class S7DataMBExtra { |
| | | |
| | | |
| | | @S7Variable(address = "DB49.0", type = EDataType.INT16) |
| | | private Short requestOne; |
| | | @S7Variable(address = "DB49.0", type = EDataType.UINT16) |
| | | private Integer requestOne; |
| | | |
| | | @S7Variable(address = "DB49.46", type = EDataType.INT16) |
| | | private Short widthOne; |
| | | @S7Variable(address = "DB49.46", type = EDataType.UINT16) |
| | | private Integer widthOne; |
| | | |
| | | @S7Variable(address = "DB49.48", type = EDataType.INT16) |
| | | private Short heightOne; |
| | | @S7Variable(address = "DB49.48", type = EDataType.UINT16) |
| | | private Integer heightOne; |
| | | |
| | | @S7Variable(address = "DB49.50", type = EDataType.INT16) |
| | | private Short thicknessOne; |
| | | @S7Variable(address = "DB49.50", type = EDataType.UINT16) |
| | | private Integer thicknessOne; |
| | | |
| | | @S7Variable(address = "DB49.52", type = EDataType.INT16) |
| | | private Short requestTwo; |
| | | @S7Variable(address = "DB49.52", type = EDataType.UINT16) |
| | | private Integer requestTwo; |
| | | |
| | | @S7Variable(address = "DB49.98", type = EDataType.INT16) |
| | | private Short widthTwo; |
| | | @S7Variable(address = "DB49.98", type = EDataType.UINT16) |
| | | private Integer widthTwo; |
| | | |
| | | @S7Variable(address = "DB49.100", type = EDataType.INT16) |
| | | private Short heightTwo; |
| | | @S7Variable(address = "DB49.100", type = EDataType.UINT16) |
| | | private Integer heightTwo; |
| | | |
| | | @S7Variable(address = "DB49.102", type = EDataType.INT16) |
| | | private Short thicknessTwo; |
| | | @S7Variable(address = "DB49.102", type = EDataType.UINT16) |
| | | private Integer thicknessTwo; |
| | | |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 20) |
| | | private String plcGlassIdOne; |
| | | |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 20) |
| | | private String mesGlassIdOne; |
| | | |
| | | @S7Variable(address = "DB49.54", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB49.54", type = EDataType.STRING, count = 20) |
| | | private String plcGlassIdTwo; |
| | | |
| | | @S7Variable(address = "DB49.76", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB49.76", type = EDataType.STRING, count = 20) |
| | | private String mesglassIdTwo; |
| | | |
| | | } |
| | |
| | | public class S7DataWL { |
| | | |
| | | |
| | | @S7Variable(address = "DB49.0", type = EDataType.INT16) |
| | | private Short taskRunning; |
| | | @S7Variable(address = "DB49.0", type = EDataType.UINT16) |
| | | private Integer taskRunning; |
| | | |
| | | @S7Variable(address = "DB49.46", type = EDataType.INT16) |
| | | private Short currentCell; |
| | | @S7Variable(address = "DB49.46", type = EDataType.UINT16) |
| | | private Integer currentCell; |
| | | |
| | | @S7Variable(address = "DB49.48", type = EDataType.INT16) |
| | | private Short startCell; |
| | | @S7Variable(address = "DB49.48", type = EDataType.UINT16) |
| | | private Integer startCell; |
| | | |
| | | @S7Variable(address = "DB49.50", type = EDataType.INT16) |
| | | private Short endCell; |
| | | @S7Variable(address = "DB49.50", type = EDataType.UINT16) |
| | | private Integer endCell; |
| | | |
| | | @S7Variable(address = "DB49.52", type = EDataType.INT16) |
| | | private Short TaskState; |
| | | @S7Variable(address = "DB49.52", type = EDataType.UINT16) |
| | | private Integer TaskState; |
| | | |
| | | @S7Variable(address = "DB49.116", type = EDataType.INT16) |
| | | private Short inPlace; |
| | | @S7Variable(address = "DB49.116", type = EDataType.UINT16) |
| | | private Integer inPlace; |
| | | |
| | | @S7Variable(address = "DB49.124", type = EDataType.INT16) |
| | | private Short slotState; |
| | | @S7Variable(address = "DB49.124", type = EDataType.UINT16) |
| | | private Integer slotState; |
| | | |
| | | @S7Variable(address = "DB49.118", type = EDataType.FLOAT32) |
| | | private Float speed; |
| | | |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB49.2", type = EDataType.STRING, count = 20) |
| | | private String glassIdIn; |
| | | |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB49.24", type = EDataType.STRING, count = 20) |
| | | private String glassIdOut; |
| | | |
| | | @S7Variable(address = "DB49.94", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB49.94", type = EDataType.STRING, count = 20) |
| | | private String glassId; |
| | | |
| | | @S7Variable(address = "DB49.112.0", type = EDataType.BOOL) |
| | |
| | | @Data |
| | | public class S7DataWLExtra { |
| | | |
| | | @S7Variable(address = "DB49.126", type = EDataType.INT16) |
| | | private Short d06SlotState; |
| | | @S7Variable(address = "DB49.126", type = EDataType.UINT16) |
| | | private Integer d06SlotState; |
| | | |
| | | } |
| | |
| | | public class S7Config { |
| | | @Bean(name = "s7SerializerDLPOne") |
| | | public S7Serializer s7SerializerDLPOne() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.20.140"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "192.168.20.140"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerDLPTwo") |
| | | public S7Serializer s7SerializerDLPTwo() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.20.140"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "192.168.20.140"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | |
| | | public class S7DataDLPOne { |
| | | |
| | | |
| | | @S7Variable(address = "DB3.3118", type = EDataType.BOOL) |
| | | @S7Variable(address = "DB3.3118.0", type = EDataType.BOOL) |
| | | private Boolean mesControl; |
| | | |
| | | @S7Variable(address = "DB19.0", type = EDataType.INT16) |
| | |
| | | @S7Variable(address = "DB19.1246", type = EDataType.INT16) |
| | | private Short glassCount; |
| | | |
| | | @S7Variable(address = "DB19.8", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.8", type = EDataType.STRING, count = 20) |
| | | private String id1; |
| | | |
| | | @S7Variable(address = "DB19.30", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.30", type = EDataType.STRING, count = 20) |
| | | private String id2; |
| | | |
| | | @S7Variable(address = "DB19.52", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.52", type = EDataType.STRING, count = 20) |
| | | private String id3; |
| | | |
| | | @S7Variable(address = "DB19.74", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.74", type = EDataType.STRING, count = 20) |
| | | private String id4; |
| | | |
| | | @S7Variable(address = "DB19.96", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.96", type = EDataType.STRING, count = 20) |
| | | private String id5; |
| | | |
| | | @S7Variable(address = "DB19.118", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.118", type = EDataType.STRING, count = 20) |
| | | private String id6; |
| | | |
| | | @S7Variable(address = "MW1002", type = EDataType.INT16) |
| | |
| | | public class S7DataDLPTwo { |
| | | |
| | | |
| | | @S7Variable(address = "DB3.3118", type = EDataType.BOOL) |
| | | @S7Variable(address = "DB3.3118.0", type = EDataType.BOOL) |
| | | private Boolean mesControl; |
| | | |
| | | @S7Variable(address = "DB19.4", type = EDataType.INT16) |
| | |
| | | @S7Variable(address = "DB19.342", type = EDataType.INT16) |
| | | private Short state6; |
| | | |
| | | @S7Variable(address = "DB19.176", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.176", type = EDataType.STRING, count = 20) |
| | | private String id1; |
| | | |
| | | @S7Variable(address = "DB19.198", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.198", type = EDataType.STRING, count = 20) |
| | | private String id2; |
| | | |
| | | @S7Variable(address = "DB19.220", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.220", type = EDataType.STRING, count = 20) |
| | | private String id3; |
| | | |
| | | @S7Variable(address = "DB19.242", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.242", type = EDataType.STRING, count = 20) |
| | | private String id4; |
| | | |
| | | @S7Variable(address = "DB19.264", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.264", type = EDataType.STRING, count = 20) |
| | | private String id5; |
| | | |
| | | @S7Variable(address = "DB19.286", type = EDataType.STRING, count = 22) |
| | | @S7Variable(address = "DB19.286", type = EDataType.STRING, count = 20) |
| | | private String id6; |
| | | |
| | | |
| | |
| | | |
| | | @Bean(name = "s7SerializerCC") |
| | | public S7Serializer s7SerializerCC() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.80"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.80"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerSPOne") |
| | | public S7Serializer s7SerializerSPOne() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.15"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.15"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerSPTwo") |
| | | public S7Serializer s7SerializerSPTwo() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.21"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.21"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | } |
| | |
| | | if ("1".equals(confireWord) && "0".equals(reportWord)) { |
| | | // if ("1".equals(confireWord.getValue() + "") && "0".equals(reportWord.getValue() + "")) { |
| | | S7DataCC s7Data = new S7DataCC(); |
| | | s7Data.setConfirmation((short) 0); |
| | | s7Data.setConfirmation(0); |
| | | s7SerializerCC.write(s7Data); |
| | | // List<ReadWriteEntity> list = new ArrayList<>(); |
| | | // list.add(generateReadWriteEntity("CC.CC.confirmation", 0)); |
| | |
| | | if ("1".equals(taskWord)) { |
| | | // if ("1".equals(taskWord.getValue() + "")) { |
| | | S7DataCC s7Data = new S7DataCC(); |
| | | s7Data.setTaskWord((short) 0); |
| | | s7Data.setStartSlot((short) 0); |
| | | s7Data.setEndSlot((short) 0); |
| | | s7Data.setTaskWord(0); |
| | | s7Data.setStartSlot(0); |
| | | s7Data.setEndSlot(0); |
| | | s7SerializerCC.write(s7Data); |
| | | // List<ReadWriteEntity> list = new ArrayList<>(); |
| | | // list.add(generateReadWriteEntity("CC.CC.taskWord", 0)); |
| | |
| | | |
| | | } |
| | | S7DataCC s7Data = new S7DataCC(); |
| | | s7Data.setConfirmation((short) 1); |
| | | s7Data.setConfirmation(1); |
| | | s7SerializerCC.write(s7Data); |
| | | // List<ReadWriteEntity> list = new ArrayList<>(); |
| | | // list.add(generateReadWriteEntity("CC.CC.confirmation", 1)); |
| | |
| | | if (null == twoLoadStation) { |
| | | //按照尺寸生成二号位上片任务信息 |
| | | // LoadGlassDeviceTask loadTask = loadGlassDeviceTaskService.queryTaskMessage(tableName); |
| | | S7DataSP loadTask=new S7DataSP(); |
| | | if(stationCell == 5){ |
| | | loadTask=s7SerializerSPOne.read(S7DataSP.class); |
| | | }else{ |
| | | loadTask=s7SerializerSPTwo.read(S7DataSP.class); |
| | | S7DataSP loadTask = new S7DataSP(); |
| | | if (stationCell == 5) { |
| | | loadTask = s7SerializerSPOne.read(S7DataSP.class); |
| | | } else { |
| | | loadTask = s7SerializerSPTwo.read(S7DataSP.class); |
| | | } |
| | | RawGlassStorageDetails rawDetails = null; |
| | | if (oneLoadStation.getRemainQuantity() > (loadTask.getTotalCount() + loadTask.getDamageCount())) { |
| | |
| | | //todo:当二号为的尺寸大于0时,是否执行调度任务,更换当前原片的尺寸,等待下一次任务的直接执行;还是继续等待,当尺寸不一样,等待一号工位的进出库调度任务。 |
| | | if (twoLoadStation.getRemainQuantity() > 0) { |
| | | // LoadGlassDeviceTask loadTask = loadGlassDeviceTaskService.queryTaskMessage(tableName); |
| | | S7DataSP loadTask=new S7DataSP(); |
| | | if(stationCell == 5){ |
| | | loadTask=s7SerializerSPOne.read(S7DataSP.class); |
| | | }else{ |
| | | loadTask=s7SerializerSPTwo.read(S7DataSP.class); |
| | | S7DataSP loadTask = new S7DataSP(); |
| | | if (stationCell == 5) { |
| | | loadTask = s7SerializerSPOne.read(S7DataSP.class); |
| | | } else { |
| | | loadTask = s7SerializerSPTwo.read(S7DataSP.class); |
| | | } |
| | | if (oneLoadStation.getRemainQuantity() > (loadTask.getTotalCount() + loadTask.getDamageCount())) { |
| | | usageVOS = upListMap.get("2"); |
| | |
| | | public class S7DataCC { |
| | | |
| | | |
| | | // @S7Variable(address = "DB1.0", type = EDataType.INT16) |
| | | // private Short request; |
| | | // @S7Variable(address = "DB1.0", type = EDataType.UINT16) |
| | | // private Integer request; |
| | | // |
| | | // @S7Variable(address = "DB1.2", type = EDataType.INT16) |
| | | // private Short requestId; |
| | | // @S7Variable(address = "DB1.2", type = EDataType.UINT16) |
| | | // private Integer requestId; |
| | | // |
| | | // @S7Variable(address = "DB1.4", type = EDataType.INT16) |
| | | // private Short reportWord; |
| | | // @S7Variable(address = "DB1.4", type = EDataType.UINT16) |
| | | // private Integer reportWord; |
| | | // |
| | | // @S7Variable(address = "DB1.6", type = EDataType.INT16) |
| | | // private Short reportId; |
| | | // @S7Variable(address = "DB1.6", type = EDataType.UINT16) |
| | | // private Integer reportId; |
| | | // |
| | | // @S7Variable(address = "DB1.8", type = EDataType.INT16) |
| | | // private Short inCar; |
| | | // @S7Variable(address = "DB1.8", type = EDataType.UINT16) |
| | | // private Integer inCar; |
| | | // |
| | | // @S7Variable(address = "DB1.10", type = EDataType.INT16) |
| | | // private Short taskWord; |
| | | // @S7Variable(address = "DB1.10", type = EDataType.UINT16) |
| | | // private Integer taskWord; |
| | | // |
| | | // @S7Variable(address = "DB1.12", type = EDataType.INT16) |
| | | // private Short taskId; |
| | | // @S7Variable(address = "DB1.12", type = EDataType.UINT16) |
| | | // private Integer taskId; |
| | | // |
| | | // @S7Variable(address = "DB1.14", type = EDataType.INT16) |
| | | // private Short startSlot; |
| | | // @S7Variable(address = "DB1.14", type = EDataType.UINT16) |
| | | // private Integer startSlot; |
| | | // |
| | | // @S7Variable(address = "DB1.16", type = EDataType.INT16) |
| | | // private Short endSlot; |
| | | // @S7Variable(address = "DB1.16", type = EDataType.UINT16) |
| | | // private Integer endSlot; |
| | | // |
| | | // @S7Variable(address = "DB1.18", type = EDataType.INT16) |
| | | // private Short taskSending; |
| | | // @S7Variable(address = "DB1.18", type = EDataType.UINT16) |
| | | // private Integer taskSending; |
| | | // |
| | | // @S7Variable(address = "DB1.20", type = EDataType.INT16) |
| | | // private Short confirmation; |
| | | // @S7Variable(address = "DB1.20", type = EDataType.UINT16) |
| | | // private Integer confirmation; |
| | | // |
| | | // @S7Variable(address = "DB1.22", type = EDataType.INT16) |
| | | // private Short confirmationId; |
| | | // @S7Variable(address = "DB1.22", type = EDataType.UINT16) |
| | | // private Integer confirmationId; |
| | | |
| | | @S7Variable(address = "DB38.0", type = EDataType.INT16) |
| | | private Short request; |
| | | @S7Variable(address = "DB38.0", type = EDataType.UINT16) |
| | | private Integer request; |
| | | |
| | | @S7Variable(address = "DB38.2", type = EDataType.INT16) |
| | | private Short requestId; |
| | | @S7Variable(address = "DB38.2", type = EDataType.UINT16) |
| | | private Integer requestId; |
| | | |
| | | @S7Variable(address = "DB38.10", type = EDataType.INT16) |
| | | private Short reportWord; |
| | | @S7Variable(address = "DB38.10", type = EDataType.UINT16) |
| | | private Integer reportWord; |
| | | |
| | | @S7Variable(address = "DB38.12", type = EDataType.INT16) |
| | | private Short reportId; |
| | | @S7Variable(address = "DB38.12", type = EDataType.UINT16) |
| | | private Integer reportId; |
| | | |
| | | @S7Variable(address = "DB38.18", type = EDataType.INT16) |
| | | private Short inCar; |
| | | @S7Variable(address = "DB38.18", type = EDataType.UINT16) |
| | | private Integer inCar; |
| | | |
| | | @S7Variable(address = "DB38.20", type = EDataType.INT16) |
| | | private Short taskWord; |
| | | @S7Variable(address = "DB38.20", type = EDataType.UINT16) |
| | | private Integer taskWord; |
| | | |
| | | @S7Variable(address = "DB38.22", type = EDataType.INT16) |
| | | private Short taskId; |
| | | @S7Variable(address = "DB38.22", type = EDataType.UINT16) |
| | | private Integer taskId; |
| | | |
| | | @S7Variable(address = "DB38.24", type = EDataType.INT16) |
| | | private Short startSlot; |
| | | @S7Variable(address = "DB38.24", type = EDataType.UINT16) |
| | | private Integer startSlot; |
| | | |
| | | @S7Variable(address = "DB38.26", type = EDataType.INT16) |
| | | private Short endSlot; |
| | | @S7Variable(address = "DB38.26", type = EDataType.UINT16) |
| | | private Integer endSlot; |
| | | |
| | | @S7Variable(address = "DB38.28", type = EDataType.INT16) |
| | | private Short taskSending; |
| | | @S7Variable(address = "DB38.28", type = EDataType.UINT16) |
| | | private Integer taskSending; |
| | | |
| | | @S7Variable(address = "DB38.40", type = EDataType.INT16) |
| | | private Short confirmation; |
| | | @S7Variable(address = "DB38.40", type = EDataType.UINT16) |
| | | private Integer confirmation; |
| | | |
| | | @S7Variable(address = "DB38.42", type = EDataType.INT16) |
| | | private Short confirmationId; |
| | | @S7Variable(address = "DB38.42", type = EDataType.UINT16) |
| | | private Integer confirmationId; |
| | | |
| | | |
| | | } |
| | |
| | | public class S7DataSP { |
| | | |
| | | |
| | | @S7Variable(address = "DB19.14", type = EDataType.INT16) |
| | | private Short taskState; |
| | | @S7Variable(address = "DB19.14", type = EDataType.UINT16) |
| | | private Integer taskState; |
| | | |
| | | @S7Variable(address = "DB19.18", type = EDataType.INT16) |
| | | private Short damageCount; |
| | | @S7Variable(address = "DB19.18", type = EDataType.UINT16) |
| | | private Integer damageCount; |
| | | |
| | | @S7Variable(address = "DB19.20", type = EDataType.INT16) |
| | | private Short rawGlassWidth; |
| | | @S7Variable(address = "DB19.20", type = EDataType.UINT16) |
| | | private Integer rawGlassWidth; |
| | | |
| | | @S7Variable(address = "DB19.22", type = EDataType.INT16) |
| | | private Short rawGlassHeight; |
| | | @S7Variable(address = "DB19.22", type = EDataType.UINT16) |
| | | private Integer rawGlassHeight; |
| | | |
| | | @S7Variable(address = "DB19.24", type = EDataType.INT16) |
| | | private Short slot; |
| | | @S7Variable(address = "DB19.24", type = EDataType.UINT16) |
| | | private Integer slot; |
| | | |
| | | @S7Variable(address = "DB19.26", type = EDataType.INT16) |
| | | private Short totalCount; |
| | | @S7Variable(address = "DB19.26", type = EDataType.UINT16) |
| | | private Integer totalCount; |
| | | |
| | | @S7Variable(address = "DB19.28", type = EDataType.INT16) |
| | | private Short finishCount; |
| | | @S7Variable(address = "DB19.28", type = EDataType.UINT16) |
| | | private Integer finishCount; |
| | | |
| | | @S7Variable(address = "DB19.16.0", type = EDataType.BOOL) |
| | | private Boolean taskRunning; |
| | | |
| | | @S7Variable(address = "DB19.30", type = EDataType.INT16) |
| | | private Short inkageState; |
| | | @S7Variable(address = "DB19.30", type = EDataType.UINT16) |
| | | private Integer inkageState; |
| | | |
| | | |
| | | } |
| | |
| | | public class S7Config { |
| | | @Bean(name = "s7SerializerSPOne") |
| | | public S7Serializer s7SerializerSPOne() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.15"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.15"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |
| | | @Bean(name = "s7SerializerSPTwo") |
| | | public S7Serializer s7SerializerSPTwo() { |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.21"); |
| | | // S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.10.21"); |
| | | S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.153.19.191"); |
| | | return S7Serializer.newInstance(s7PLC); |
| | | } |
| | | |