diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java index 6ea0450bf..ff628b40b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java @@ -33,4 +33,85 @@ public class InteractionJsonDTO { */ private String containerType; + /** + * 是否拔轴 + */ + private String toPull; + + /** + * 是否套轴 + */ + private String isBushing; + + /** + * 气胀轴尺寸 + */ + private String toSize; + + /** + * 下发气胀轴条码 + */ + private String toBarcode; + + /** + * 套管纸管1编码 + */ + private String toMaterial1; + /** + * 套管纸管2编码 + */ + private String toMaterial2; + /** + * 套管纸管1规格 + */ + private String toSpec1; + /** + * 套管纸管2规格 + */ + private String toSpec2; + /** + * 套管纸管数量 + */ + private String toQty1; + /** + * 套管纸管1尺寸 + */ + private String toSize1; + /** + * 套管纸管2尺寸 + */ + private String toSize2; + /** + * 拔轴纸管1编码 + */ + private String toMaterial3; + /** + * 拔轴纸管2编码 + */ + private String toMaterial4; + /** + * 拔轴纸管1规格 + */ + private String toSpec3; + /** + * 拔轴纸管2规格 + */ + private String toSpec4; + /** + * 拔轴纸管数量 + */ + private String toQty2; + /** + * 拔轴纸管1尺寸 + */ + private String toSize3; + /** + * 拔轴纸管2尺寸 + */ + private String toSize4; + + + + + } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 6cd660ac0..5e1ce184f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -43,9 +43,11 @@ import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; +import org.nl.config.thread.ThreadPoolExecutorUtil; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; +import java.util.concurrent.ThreadPoolExecutor; /** * 烘箱-行架机械手 @@ -76,6 +78,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i @Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + final ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + //工作模式 int mode = 0; int last_mode = 0; @@ -432,12 +436,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map3); this.writing(list); if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + EXECUTOR.submit(() -> { + toOpenDoor(startdevice); + }); } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + EXECUTOR.submit(() -> { + toOpenDoor(nextdevice); + }); } this.setRequireSucess(true); return true; @@ -629,16 +635,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map2); list.add(map3); this.writing(list); - //HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; - if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + EXECUTOR.submit(() -> { + toOpenDoor(startdevice); + }); } - if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); - hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + EXECUTOR.submit(() -> { + toOpenDoor(nextdevice); + }); } this.setRequireSucess(true); notCreateInstMessage = ""; @@ -650,6 +655,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } + private void toOpenDoor(Device nextdevice) { + HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; + hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); + hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); + } + + private void toCloseDoor(Device nextdevice) { + HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; + hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); + hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); + } /** * 判断经过的烘箱是否关门 */ @@ -884,12 +900,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); - Map map1 = new HashMap(); - ArrayList list1 = new ArrayList(); - map1.put("code", "to_close_door"); - map1.put("value", "1"); - list1.add(map1); - hongXiangConveyorDeviceDriver.writing(list1); + EXECUTOR.submit(() -> { + toCloseDoor(device); + }); } map.put("code", "to_command"); map.put("value", "3"); @@ -988,12 +1001,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i LampThreecolorDeviceDriver lampThreecolorDeviceDriver; if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); - Map map1 = new HashMap(); - ArrayList list1 = new ArrayList(); - map1.put("code", "to_close_door"); - map1.put("value", "1"); - list1.add(map1); - hongXiangConveyorDeviceDriver.writing(list1); + EXECUTOR.submit(() -> { + toCloseDoor(nextDevice); + }); if (StrUtil.isNotEmpty(taskDto.getOven_time())) { //下发烘箱时间 int time = Integer.parseInt(taskDto.getOven_time()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java index bf7c53cb4..82da1d99d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -17,6 +18,7 @@ import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.InteractionJsonDTO; import org.nl.acs.device_driver.two_conveyor.pull_head_manipulator.ItemProtocol; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; @@ -358,7 +360,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } String startAddr = startDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString(); - String interaction_json = taskDto.getInteraction_json(); + /*String interaction_json = taskDto.getInteraction_json(); JSONObject jsonObject = JSONObject.parseObject(interaction_json); //套管1物料 Object to_material1 = jsonObject.get("left"); @@ -388,13 +390,14 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //套管数量 Object to_qty1 = jsonObject.get("casingCount"); //拔管数量 - Object to_qty2 = jsonObject.get("pullCount"); + Object to_qty2 = jsonObject.get("pullCount");*/ Map map = new LinkedHashMap<>(); map.put("to_command", CommonFinalParam.ONE); map.put("to_onset", startAddr); map.put("to_task", instruction.getInstruction_code()); map.put("to_target", nextAddr); - map.put("to_material1", to_material1); + toTranscription(taskDto,map); + /*map.put("to_material1", to_material1); if (ObjectUtil.isNotEmpty(to_material2)) { map.put("to_material2", to_material2); } @@ -419,7 +422,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp map.put("to_spec4", to_spec4); } map.put("to_qty1", to_qty1); - map.put("to_qty2", to_qty2); + map.put("to_qty2", to_qty2);*/ this.writing(map); this.setRequireSucess(true); return true; @@ -496,7 +499,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } String startAddr = startDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString(); - String interactionJson = task.getInteraction_json(); + /*String interactionJson = task.getInteraction_json(); JSONObject jsonObject = JSONObject.parseObject(interactionJson); //所需纸管信息(左边) Object left = jsonObject.get("left"); @@ -509,18 +512,19 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //套管数量 Object casingCount = jsonObject.get("casingCount"); //拔管数量 - Object pullCount = jsonObject.get("pullCount"); + Object pullCount = jsonObject.get("pullCount");*/ Map map = new LinkedHashMap<>(); map.put("to_command", CommonFinalParam.ONE); map.put("to_onset", startAddr); map.put("to_task", instdto.getInstruction_code()); map.put("to_target", nextAddr); - map.put("left", left); + toTranscription(task,map); + /*map.put("left", left); map.put("right", right); map.put("currentLeft", currentLeft); map.put("currentRight", currentRight); map.put("casingCount", casingCount); - map.put("pullCount", pullCount); + map.put("pullCount", pullCount);*/ this.writing(map); this.setRequireSucess(true); notCreateInstMessage = ""; @@ -532,6 +536,38 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } + private void toTranscription(TaskDto taskDto,Map map){ + String interactionJson = taskDto.getInteraction_json(); + InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); + if(ObjectUtil.isNotEmpty(interactionJsonDTO)){ + toDevice(interactionJsonDTO.getToPull(),"to_pull",map); + toDevice(interactionJsonDTO.getIsBushing(),"is_bushing",map); + toDevice(interactionJsonDTO.getToSize(),"to_size",map); + toDevice(interactionJsonDTO.getToBarcode(),"to_barcode",map); + toDevice(interactionJsonDTO.getToMaterial1(),"to_material1",map); + toDevice(interactionJsonDTO.getToMaterial2(),"to_material2",map); + toDevice(interactionJsonDTO.getToSpec1(),"to_spec1",map); + toDevice(interactionJsonDTO.getToSpec2(),"to_spec2",map); + toDevice(interactionJsonDTO.getToQty1(),"to_qty1",map); + toDevice(interactionJsonDTO.getToSize1(),"to_size1",map); + toDevice(interactionJsonDTO.getToSize2(),"to_size2",map); + toDevice(interactionJsonDTO.getToMaterial3(),"to_material3",map); + toDevice(interactionJsonDTO.getToMaterial4(),"to_material4",map); + toDevice(interactionJsonDTO.getToSpec3(),"to_spec3",map); + toDevice(interactionJsonDTO.getToSpec4(),"to_spec4",map); + toDevice(interactionJsonDTO.getToQty2(),"to_qty2",map); + toDevice(interactionJsonDTO.getToSize3(),"to_size3",map); + toDevice(interactionJsonDTO.getToSize4(),"to_size4",map); + } + } + + private void toDevice(String toOrder,String signal,Map map){ + if(ObjectUtil.isNotEmpty(toOrder)){ + map.put(signal, toOrder); + } + } + + public synchronized boolean finish_instruction(Instruction inst) throws Exception { instructionService.finish(inst); return true; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index 5f0d8318d..63ecfe979 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -17,6 +18,7 @@ import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.InteractionJsonDTO; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; @@ -359,6 +361,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //抓取工位 List getDeviceCodeList = this.getExtraDeviceCodes("get_device_code"); //放货工位 + List putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); TaskDto task = null; for (int i = 0; i < getDeviceCodeList.size(); i++) { @@ -384,7 +387,29 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } String start_addr = startDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString(); + String interactionJson = taskDto.getInteraction_json(); + InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); Map map = new LinkedHashMap<>(); + /*if(ObjectUtil.isNotEmpty(interactionJsonDTO)){ + toDevice(interactionJsonDTO.getToPull(),"to_pull",map); + toDevice(interactionJsonDTO.getIsBushing(),"is_bushing",map); + toDevice(interactionJsonDTO.getToSize(),"to_size",map); + toDevice(interactionJsonDTO.getToBarcode(),"to_barcode",map); + toDevice(interactionJsonDTO.getToMaterial1(),"to_material1",map); + toDevice(interactionJsonDTO.getToMaterial2(),"to_material2",map); + toDevice(interactionJsonDTO.getToSpec1(),"to_spec1",map); + toDevice(interactionJsonDTO.getToSpec2(),"to_spec2",map); + toDevice(interactionJsonDTO.getToQty1(),"to_qty1",map); + toDevice(interactionJsonDTO.getToSize1(),"to_size1",map); + toDevice(interactionJsonDTO.getToSize2(),"to_size2",map); + toDevice(interactionJsonDTO.getToMaterial3(),"to_material3",map); + toDevice(interactionJsonDTO.getToMaterial4(),"to_material4",map); + toDevice(interactionJsonDTO.getToSpec3(),"to_spec3",map); + toDevice(interactionJsonDTO.getToSpec4(),"to_spec4",map); + toDevice(interactionJsonDTO.getToQty2(),"to_qty2",map); + toDevice(interactionJsonDTO.getToSize3(),"to_size3",map); + toDevice(interactionJsonDTO.getToSize4(),"to_size4",map); + }*/ map.put("to_command", CommonFinalParam.ONE); map.put("to_onset", start_addr); map.put("to_task", instruction.getInstruction_code()); @@ -434,7 +459,8 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp instdto.setPriority(priority); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); instdto.setExecute_device_code(start_point_code); - + String interactionJson = task.getInteraction_json(); + InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); try { instructionService.create(instdto); } catch (Exception e) { @@ -466,6 +492,26 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp String start_addr = startDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString(); Map map = new LinkedHashMap<>(); + /*if(ObjectUtil.isNotEmpty(interactionJsonDTO)){ + toDevice(interactionJsonDTO.getToPull(),"to_pull",map); + toDevice(interactionJsonDTO.getIsBushing(),"is_bushing",map); + toDevice(interactionJsonDTO.getToSize(),"to_size",map); + toDevice(interactionJsonDTO.getToBarcode(),"to_barcode",map); + toDevice(interactionJsonDTO.getToMaterial1(),"to_material1",map); + toDevice(interactionJsonDTO.getToMaterial2(),"to_material2",map); + toDevice(interactionJsonDTO.getToSpec1(),"to_spec1",map); + toDevice(interactionJsonDTO.getToSpec2(),"to_spec2",map); + toDevice(interactionJsonDTO.getToQty1(),"to_qty1",map); + toDevice(interactionJsonDTO.getToSize1(),"to_size1",map); + toDevice(interactionJsonDTO.getToSize2(),"to_size2",map); + toDevice(interactionJsonDTO.getToMaterial3(),"to_material3",map); + toDevice(interactionJsonDTO.getToMaterial4(),"to_material4",map); + toDevice(interactionJsonDTO.getToSpec3(),"to_spec3",map); + toDevice(interactionJsonDTO.getToSpec4(),"to_spec4",map); + toDevice(interactionJsonDTO.getToQty2(),"to_qty2",map); + toDevice(interactionJsonDTO.getToSize3(),"to_size3",map); + toDevice(interactionJsonDTO.getToSize4(),"to_size4",map); + }*/ map.put("to_command", CommonFinalParam.ONE); map.put("to_onset", start_addr); map.put("to_task", instdto.getInstruction_code()); @@ -481,6 +527,14 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } + + private void toDevice(String toOrder,String signal,Map map){ + if(ObjectUtil.isNotEmpty(toOrder)){ + map.put(signal, toOrder); + } + } + + public synchronized boolean finish_instruction(Instruction inst) throws Exception { instructionService.finish(inst); return true; @@ -504,7 +558,11 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } }); if (ObjectUtil.isNotEmpty(itemMap)) { - this.control(itemMap); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + } logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code)