diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 8d4fd056c..c096a172f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -63,7 +63,9 @@ public enum DriverTypeEnum { INDOOR_MANIPULATOR(24,"indoor_manipulator","内包间-行架机械手","station"), - PLUGGING_UNPLUGGING_MACHINE(25,"plugging_unplugging_machine","插拔轴机","station"); + PLUGGING_UNPLUGGING_MACHINE(25,"plugging_unplugging_machine","插拔轴机","station"), + + RGV(28,"rgv","rgv","conveyor"); //驱动索引 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java index c5a43c70e..09687c993 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java @@ -99,6 +99,9 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i String material2 = null; String last_material2 = null; + int qty = 0; + int last_qty = 0; + //下发命令 int to_command = 0; @@ -135,6 +138,7 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i task = this.itemProtocol.getTask(); material1 = this.itemProtocol.getMaterial1(); material2 = this.itemProtocol.getMaterial2(); + qty = this.itemProtocol.getQty(); to_command = this.itemProtocol.getTo_command(); @@ -186,6 +190,11 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move); } + if (qty != last_qty) { + logServer.deviceItemValue(this.device_code, "qty", String.valueOf(qty)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号qty:" + last_qty + "->" + qty); + } + if (move != 0 && task > 1) { update_instruction_status(); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java index 6e560b925..4bac4eb09 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java @@ -28,6 +28,8 @@ public class ItemProtocol { public static String item_material1 = "material1"; //物料2 public static String item_material2 = "material2"; + //数量 + public static String item_qty = "qty"; //下发命令 public static String item_to_command = "to_command"; @@ -48,6 +50,10 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_move); } + public int getQty() { + return this.getOpcIntegerValue(item_qty); + } + public int getCarrier_direction() { return this.getOpcIntegerValue(item_carrier_direction); } @@ -108,12 +114,13 @@ public class ItemProtocol { list.add(new ItemDto(item_task, "任务号", "DB101.W6")); list.add(new ItemDto(item_material1, "物料1", "DB101.W7")); list.add(new ItemDto(item_material2, "物料2", "DB101.W8")); + list.add(new ItemDto(item_qty, "数量", "DB101.W114")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "DB102.W4")); + list.add(new ItemDto(item_to_command, "下发命令", "DB201.W4")); return list; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java index 8ea99edbf..6a4610d00 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java @@ -146,6 +146,11 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv bushingSucess(); } break; + case 6: + if (task1 > 0 && !requireSucess) { + pullingSucess(); + } + break; default: break; @@ -159,6 +164,31 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv last_task2 = task2; } + private synchronized void pullingSucess() { + ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); + ApplyManipulatorActionResponse applyManipulatorActionResponse; + Instruction inst1 = instructionService.findByCode(String.valueOf(task1)); + String task_code1 = inst1.getTask_code(); + applyManipulatorActionRequest.setTask_code1(task_code1); + applyManipulatorActionRequest.setType("8"); + applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); + if (applyManipulatorActionResponse.getstatus()==200) { + Map map = new LinkedHashMap<>(); + map.put("to_command", 6); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyManipulatorActionResponse); + message = "拔轴完成成功"; + }else{ + message = applyManipulatorActionResponse.getMessage(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); + requireSucess = true; + message = "拔轴失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyManipulatorActionResponse); + } + } + private synchronized void bushingSucess() { ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); @@ -175,6 +205,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv if (applyManipulatorActionResponse.getstatus()==200) { Map map = new LinkedHashMap<>(); map.put("to_command", 5); + this.writing(map); requireSucess = true; logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); message = "套轴完成成功"; @@ -182,6 +213,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv message = applyManipulatorActionResponse.getMessage(); Map map = new LinkedHashMap<>(); map.put("to_command", 99); + this.writing(map); requireSucess = true; message = "套轴失败"; logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); @@ -203,6 +235,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv if (applyManipulatorActionResponse.getstatus()==200) { Map map = new LinkedHashMap<>(); map.put("to_command", 4); + this.writing(map); requireSucess = true; logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); message = "套轴申请成功"; @@ -210,6 +243,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv message = applyManipulatorActionResponse.getMessage(); Map map = new LinkedHashMap<>(); map.put("to_command", 99); + this.writing(map); requireSucess = true; message = "申请失败"; logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); @@ -225,22 +259,32 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv } } - public void writing(List list) { + /** + * 抽取统一下发电气信号前缀 + * + * @return + */ + public String getToParam() { + return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "."; + } - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - for (int i = 0; i < list.size(); i++) { - Object ob = list.get(i); - JSONObject json = (JSONObject) JSONObject.toJSON(ob); - if (!StrUtil.isEmpty(json.getString("value"))) { - String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + json.getString("code"); - itemMap.put(to_param, json.getString("value")); + /** + * 多个信号一起下发电气 + * + * @param map + */ + public void writing(Map map) { + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + Map itemMap = new LinkedHashMap<>(); + map.forEach((key, value) -> { + if (ObjectUtil.isNotEmpty(value)) { + itemMap.put(getToParam() + key, value); } + }); + if (ObjectUtil.isNotEmpty(itemMap)) { + this.control(itemMap); + logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); } - logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); - this.control(itemMap); } //将扩展表中的字符串数据转换成集合 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java new file mode 100644 index 000000000..162912e33 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java @@ -0,0 +1,103 @@ +package org.nl.acs.device_driver.basedriver.rgv; + + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Data +public class ItemProtocol { + public static String item_heartbeat = "heartbeat"; + public static String item_mode = "mode"; + public static String item_move1 = "move1"; + public static String item_move2 = "move2"; + public static String item_error = "error"; + public static String item_task = "task"; + public static String item_qty1 = "qty1"; + public static String item_qty2 = "qty2"; + public static String item_to_command = "to_command"; + + + private RgvDeviceDriver driver; + + public ItemProtocol(RgvDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getMove1() { + return this.getOpcIntegerValue(item_move1); + } + + public int getMove2() { + return this.getOpcIntegerValue(item_move2); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + public int getQty1() { + return this.getOpcIntegerValue(item_qty1); + } + + public int getQty2() { + return this.getOpcIntegerValue(item_qty2); + } + + public int getToCommand() { + return this.getOpcIntegerValue(item_to_command); + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_heartbeat, "心跳", "DB102.W0")); + list.add(new ItemDto(item_mode, "工作状态", "DB102.W2")); + list.add(new ItemDto(item_move1, "光电开关信号1", "DB102.W4")); + list.add(new ItemDto(item_move1, "光电开关信号2", "DB102.W6")); + list.add(new ItemDto(item_qty1, "工位1重量", "DB102.REAL8")); + list.add(new ItemDto(item_qty2, "工位2重量", "DB102.REAL12")); + list.add(new ItemDto(item_error, "报警信号", "DB102.W16")); + list.add(new ItemDto(item_task, "任务号(行架任务号)", "DB102.D18")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_command, "作业命令", "DB202.W0")); + return list; + } +} + + + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDefination.java new file mode 100644 index 000000000..9d24d9b5f --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDefination.java @@ -0,0 +1,57 @@ +package org.nl.acs.device_driver.basedriver.rgv; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +@Service +public class RgvDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "rgv"; + } + + @Override + public String getDriverName() { + return "rgv"; + } + + @Override + public String getDriverDescription() { + return "rgv"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new RgvDeviceDriver()).setDevice(device).setDriverDefination(this); + } + + @Override + public Class getDeviceDriverType() { + return RgvDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.conveyor); + return types; + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java new file mode 100644 index 000000000..61c5667b4 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java @@ -0,0 +1,294 @@ +package org.nl.acs.device_driver.basedriver.rgv; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +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.ext.wms.data.ApplyManipulatorActionRequest; +import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.opc.DeviceAppServiceImpl; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.system.service.impl.ParamServiceImpl; +import org.nl.modules.wql.util.SpringContextHolder; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@Slf4j +@Data +@RequiredArgsConstructor +public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); + @Autowired + DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); + @Autowired + RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); + @Autowired + TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); + @Autowired + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); + @Autowired + DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + @Autowired + DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + @Autowired + ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); + + int mode = 0; + int last_mode = 0; + int error = 0; + int last_error = 0; + int move1 = 0; + int last_move1 = 0; + int move2 = 0; + int last_move2 = 0; + int qty1 = 0; + int last_qty1 = 0; + int qty2 = 0; + int last_qty2 = 0; + + int task = 0; + int last_task = 0; + Boolean isonline = true; + + Boolean iserror = false; + //行架机械手申请任务成功标识 + boolean requireSucess = false; + + //当前指令 + Instruction inst = null; + + //1-执行任务;2-取货完成;3-放货完成; + int flag; + + String device_code; + + String message = null; + + @Override + public Device getDevice() { + return this.device; + } + + public void execute() { + String message = null; + try { + device_code = this.getDeviceCode(); + mode = this.itemProtocol.getMode(); + error = this.itemProtocol.getError(); + move1 = this.itemProtocol.getMove1(); + move2 = this.itemProtocol.getMove2(); + qty1 = this.itemProtocol.getQty1(); + qty2 = this.itemProtocol.getQty2(); + task = this.itemProtocol.getTask(); + + if (mode != last_mode) { + this.requireSucess = false; + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); + } + if (move1 != last_move1) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号move1:" + last_move1 + "->" + move1); + } + if (move2 != last_move2) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号move2:" + last_move2 + "->" + move2); + } + + } catch (Exception var17) { + + + } + + if (mode == 0) { + this.setIsonline(false); + message = "未联机"; + //有报警 + + } else { + this.setIsonline(true); + this.setIserror(false); + if (error != 0) { + this.setIserror(true); + message = "有报警"; + } + message = ""; + Instruction instruction = null; + List toInstructions; + switch (mode) { + case 1: + log.debug("设备运转模式:等待工作"); + return; + case 2: + break; + case 3: + break; + case 4: + if (task > 0 && !requireSucess && (qty1 > 0 || qty2 > 0)) { + feedbackQty(); + } + break; + default: + break; + + } + + } + last_mode = mode; + last_error = error; + last_move1 = move1; + last_move2 = move2; + last_task = task; + last_qty1 = qty1; + last_qty2 = qty2; + } + + private void feedbackQty() { + ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); + ApplyManipulatorActionResponse applyManipulatorActionResponse; + Instruction inst1 = checkInst(); + String task_code = inst1.getTask_code(); + applyManipulatorActionRequest.setType("2"); + if (qty1 > 0) { + applyManipulatorActionRequest.setQty(String.valueOf(qty1)); + } + if (qty2 > 0) { + applyManipulatorActionRequest.setQty(String.valueOf(qty2)); + } + applyManipulatorActionRequest.setTask_code1(task_code); + applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); + if (applyManipulatorActionResponse.getstatus() == 200) { + requireSucess = true; + message = "反馈LMS成功..."; + logServer.deviceExecuteLog(this.device_code, "", "", "反馈重量请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); + Map map = new LinkedHashMap<>(); + map.put("to_command", 4); + this.writing(map); + } else { + requireSucess = false; + message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "反馈重量请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); + this.writing(map); + } + } + + /** + * 抽取统一下发电气信号前缀 + * + * @return + */ + public String getToParam() { + return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "."; + } + + /** + * 多个信号一起下发电气 + * + * @param map + */ + public void writing(Map map) { + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + Map itemMap = new LinkedHashMap<>(); + map.forEach((key, value) -> { + if (ObjectUtil.isNotEmpty(value)) { + itemMap.put(getToParam() + key, value); + } + }); + if (ObjectUtil.isNotEmpty(itemMap)) { + this.control(itemMap); + logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); + } + } + + + public Instruction checkInst() { + if (ObjectUtil.isNotEmpty(this.inst)) { + if (this.task > 0) { + if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) { + return this.inst; + } else { + inst = instructionService.findByCodeFromCache(String.valueOf(task)); + return inst; + } + } + } else { + inst = instructionService.findByCodeFromCache(String.valueOf(task)); + return inst; + } + return null; + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String move1 = ""; + String move2 = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } + + if (this.getMove1() == 0 && this.getMove2() == 0) { + move1 = "无货"; + move2 = "无货"; + jo.put("hasGoods", false); + } else if (this.getMove1() == 1 || this.getMove2() == 1) { + jo.put("hasGoods", true); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move1", move1); + jo.put("move2", move2); + jo.put("isOnline", this.getIsonline()); + jo.put("isError", this.getIserror()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + + public void writing(String param, String value) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + + this.control(itemMap); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java index ddcd86a25..18cf94a85 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java @@ -13,6 +13,7 @@ public class ApplyManipulatorActionRequest extends BaseRequest { * 5-反馈二次放货点 * 6-套轴申请 * 7-套轴完成 + * 8-拔轴完成 */ private String type; @@ -35,5 +36,10 @@ public class ApplyManipulatorActionRequest extends BaseRequest { * 取货完成1 放货完成2 */ private String action; + /** + * 重量 + */ + private String qty; + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index a6ea893db..2294668b5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -112,10 +112,22 @@ public interface AcsToWmsService { // 输送线有货变成无货时向lms请求 HttpResponse shipDeviceUpdate(JSONObject param); + //task变化时向LMS请求 HttpResponse taskDeviceUpdate(JSONObject param); void sendDeviceStatus(JSONObject param); + /** + * 向lms申请反馈 + * @param param + * @return + */ ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param); + + /** + * 向LMS反馈缓存库取/放货完成 + * @param param + * @return + */ ApplyManipulatorActionResponse actionFinishRequest(ApplyManipulatorActionRequest param); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 49e0d7173..03336d1db 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -34,6 +34,7 @@ import org.nl.acs.device_driver.basedriver.paper_tube_device2.Paper; import org.nl.acs.device_driver.basedriver.paper_tube_device2.PaperTubeConveyor2DeviceDriver; import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver; +import org.nl.acs.device_driver.basedriver.rgv.RgvDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver; @@ -252,6 +253,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { IndoorManipulatorDeviceDriver indoorManipulatorDeviceDriver; //套管工位 CasingStationConveyorDeviceDriver casingStationConveyorDeviceDriver; + //RGV + RgvDeviceDriver rgvDeviceDriver; if (datas.size() == 0) { throw new BadRequestException("缺少输入参数!"); @@ -315,6 +318,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("task", casingStationConveyorDeviceDriver.getTask()); jo.put("material1", casingStationConveyorDeviceDriver.getMaterial1()); jo.put("material2", casingStationConveyorDeviceDriver.getMaterial2()); + jo.put("qty", casingStationConveyorDeviceDriver.getQty()); } else if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) { @@ -326,7 +330,19 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("material_code", ObjectUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial()) ? "" : paperTubeConveyorDeviceDriver.getMaterial()); jo.put("out_finish", paperTubeConveyorDeviceDriver.getOut_finish()); - } else if (device.getDeviceDriver() instanceof DeviceStatusDeviceDriver) { + } else if (device.getDeviceDriver() instanceof RgvDeviceDriver) { + rgvDeviceDriver = (RgvDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", parent_device_code); + jo.put("qty1", rgvDeviceDriver.getQty1()); + jo.put("qty2", rgvDeviceDriver.getQty2()); + jo.put("mode", rgvDeviceDriver.getMode()); + jo.put("move1", rgvDeviceDriver.getMove1()); + jo.put("move2", rgvDeviceDriver.getMove2()); + jo.put("task", rgvDeviceDriver.getTask()); + jo.put("error", rgvDeviceDriver.getError()); + + + }else if (device.getDeviceDriver() instanceof DeviceStatusDeviceDriver) { deviceStatusDeviceDriver = (DeviceStatusDeviceDriver) device.getDeviceDriver(); jo.put("device_code", deviceStatusDeviceDriver.getDevice().getDevice_code()); jo.put("device_name", deviceStatusDeviceDriver.getDevice().getDevice_name()); diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index f8ed9781a..9b4b5a250 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -105,6 +105,7 @@ import casing_station from '@/views/acs/device/driver/casing_station' import device_status from '@/views/acs/device/driver/device_status' import indoor_manipulator from '@/views/acs/device/driver/indoor_manipulator' import plugging_unplugging_machine from '@/views/acs/device/driver/plugging_unplugging_machine' +import rgv from '@/views/acs/device/driver/rgv' export default { name: 'DeviceConfig', @@ -140,7 +141,8 @@ export default { casing_station, device_status, indoor_manipulator, - plugging_unplugging_machine + plugging_unplugging_machine, + rgv }, dicts: ['device_type'], mixins: [crud], diff --git a/acs/nladmin-ui/src/views/acs/device/driver/rgv.vue b/acs/nladmin-ui/src/views/acs/device/driver/rgv.vue new file mode 100644 index 000000000..4dc95213f --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/device/driver/rgv.vue @@ -0,0 +1,500 @@ + + + + + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java index 3ae026a58..5a938f833 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java @@ -186,27 +186,7 @@ public class CutConveyorTask extends AbstractAcsTask { //判断载具上是否存在气涨轴 String vehicle_code = jsonTask.getString("vehicle_code"); - if (StrUtil.isNotEmpty(vehicle_code)) { - JSONObject out_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(out_jo)) { - throw new BadRequestException("未查询到对应的点位!"); - } - String point_location = out_jo.getString("point_location"); - JSONObject vehicle_jo = WQLObject.getWQLObject("md_pb_vehiclearea").query("point_location = '" + point_location + "' AND product_area = '" + jsonTask.getString("product_area") + "'").uniqueResult(0); - String qzz_generation = vehicle_jo.getString("qzz_generation"); - JSONObject jo = new JSONObject(); - jo.put("task_type", "010605"); - jo.put("point_code1", "A1_FQSS_OUT"); - jo.put("point_code2", "A1_RGV"); - jo.put("truss_type", "1"); - jo.put("vehicle_code", jsonTask.getString("vehicle_code")); - jo.put("product_area", jsonTask.getString("product_area")); - JSONObject request_param = new JSONObject(); - request_param.put("have_generation", qzz_generation); - jo.put("request_param", request_param.toString()); - PaperTrussTask paperTrussTask = SpringContextHolder.getBean(PaperTrussTask.class); - paperTrussTask.createTask(jo); - } + } //分切输送入任务