diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index 574ababaf..6c14ded70 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -197,8 +197,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - standardAutodoorDeviceDriver.writing("to_open","1"); - standardAutodoorDeviceDriver.writing("to_close","0"); + + try { + standardAutodoorDeviceDriver.writing("to_open","1"); + standardAutodoorDeviceDriver.writing("to_close","0"); + } catch (Exception e){ + log.info("下发电气信号失败:"+e.getMessage()); + e.printStackTrace(); + } if(standardAutodoorDeviceDriver.getOpen() == 1){ data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } @@ -211,9 +217,13 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - standardAutodoorDeviceDriver.writing("to_close","1"); - standardAutodoorDeviceDriver.writing( - "to_open","0"); + try { + standardAutodoorDeviceDriver.writing("to_close","1"); + standardAutodoorDeviceDriver.writing("to_open","0"); + } catch (Exception e){ + log.info("下发电气信号失败:"+e.getMessage()); + e.printStackTrace(); + } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } 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 7ba3fb466..4c9deab05 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 @@ -49,7 +49,9 @@ public enum DriverTypeEnum { PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor"), - STANDARD_AUTODOOR(20, "standard_autodoor", "标准版-自动门", "autodoor"); + STANDARD_AUTODOOR(20, "standard_autodoor", "标准版-自动门", "autodoor"), + + LAMP_THREE_COLOR(21, "lamp_three_color", "标准版-三色灯", "三色灯"); //驱动索引 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java index f20f944c1..db9a42596 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java @@ -127,30 +127,6 @@ public class DeviceController { return new ResponseEntity<>(deviceService.selectDeviceListByRegion(region), HttpStatus.OK); } - @GetMapping("/selectListOne") - @Log("查询区域一设备") - @ApiOperation("查询区域一设备") - //@PreAuthorize("@el.check('routePlan:list')") - public ResponseEntity selectListOne() { - return new ResponseEntity<>(deviceService.selectDeviceListOne(), HttpStatus.OK); - } - - @GetMapping("/selectListTwo") - @Log("查询区域二设备") - @ApiOperation("查询区域二设备") - //@PreAuthorize("@el.check('routePlan:list')") - public ResponseEntity selectListTwo() { - return new ResponseEntity<>(deviceService.selectDeviceListTwo(), HttpStatus.OK); - } - - @GetMapping("/selectListThree") - @Log("查询区域三设备") - @ApiOperation("查询区域三设备") - //@PreAuthorize("@el.check('routePlan:list')") - public ResponseEntity selectListThree() { - return new ResponseEntity<>(deviceService.selectDeviceListThree(), HttpStatus.OK); - } - @GetMapping("/type/{type}") @Log("根据设备类型查询已配置设备") @ApiOperation("根据类型查询设备") diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java index 80ca6689a..03d6fae16 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java @@ -143,26 +143,6 @@ public interface DeviceService { */ JSONArray selectDeviceDevicerInfo(String status); - /** - * 查询区域一设备 - * - * @return - */ - JSONArray selectDeviceListOne(); - - /** - * 查询区域二设备 - * - * @return - */ - JSONArray selectDeviceListTwo(); - - /** - * 查询区域三设备 - * - * @return - */ - JSONArray selectDeviceListThree(); /** * 更新驱动配置信息 @@ -298,4 +278,9 @@ public interface DeviceService { * @param request */ void excelImport(MultipartFile file, HttpServletRequest request); + + void addDeviceCodeByAddress(StorageCellDto dto); + + void updateDeviceCodeByAddress(StorageCellDto dto); + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 1dae504a3..9b12517b5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -406,152 +406,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial return result; } - @Override - public JSONArray selectDeviceListOne() { - //设备基础信息表【acs_device】 - JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '1'", "seq_num").getResultJSONArray(0); - //acs_device_extra - WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra"); - JSONArray result = new JSONArray(); - for (int i = 0; i < arr.size(); i++) { - JSONObject obj = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("device_id", obj.getString("device_id")); - json.put("device_code", obj.getString("device_code")); - json.put("checked", false); - json.put("device_name", obj.getString("device_name")); - Device device = deviceAppService.findDeviceByCode(obj.getString("device_code")); - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - json.put("quantity", standardOrdinarySiteDeviceDriver.getQty()); - json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial()); - json.put("remark", standardOrdinarySiteDeviceDriver.getRemark()); - } - JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0); - for (int m = 0; m < extraArr.size(); m++) { - JSONObject jsonObject = extraArr.getJSONObject(m); - String extra_code = jsonObject.getString("extra_code"); - //定点作业:自动创建任务 - if ("auto_create_task".equals(extra_code)) { - json.put("auto_create_task", jsonObject.getBoolean("extra_value")); - } - //呼叫 - if ("apply_task".equals(extra_code)) { - json.put("apply_task", jsonObject.getBoolean("extra_value")); - } - //响应 - if ("manual_create_task".equals(extra_code)) { - json.put("manual_create_task", jsonObject.getBoolean("extra_value")); - } - //清除 - if ("auto_clean_task".equals(extra_code)) { - json.put("auto_clean_task", jsonObject.getBoolean("extra_value")); - } - - } - result.add(json); - } - return result; - } - - @Override - public JSONArray selectDeviceListTwo() { - //设备基础信息表【acs_device】 - JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '2'", "seq_num").getResultJSONArray(0); - //acs_device_extra - WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra"); - JSONArray result = new JSONArray(); - for (int i = 0; i < arr.size(); i++) { - JSONObject obj = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("device_id", obj.getString("device_id")); - json.put("checked", false); - json.put("device_code", obj.getString("device_code")); - json.put("device_name", obj.getString("device_name")); - Device device = deviceAppService.findDeviceByCode(obj.getString("device_code")); - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - json.put("quantity", standardOrdinarySiteDeviceDriver.getQty()); - json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial()); - json.put("remark", standardOrdinarySiteDeviceDriver.getRemark()); - } - JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0); - for (int m = 0; m < extraArr.size(); m++) { - JSONObject jsonObject = extraArr.getJSONObject(m); - String extra_code = jsonObject.getString("extra_code"); - //定点作业:自动创建任务 - if ("auto_create_task".equals(extra_code)) { - json.put("auto_create_task", jsonObject.getBoolean("extra_value")); - } - //呼叫 - if ("apply_task".equals(extra_code)) { - json.put("apply_task", jsonObject.getBoolean("extra_value")); - } - //响应 - if ("manual_create_task".equals(extra_code)) { - json.put("manual_create_task", jsonObject.getBoolean("extra_value")); - } - //清除 - if ("auto_clean_task".equals(extra_code)) { - json.put("auto_clean_task", jsonObject.getBoolean("extra_value")); - } - - } - result.add(json); - } - return result; - } - - @Override - public JSONArray selectDeviceListThree() { - //设备基础信息表【acs_device】 - JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '3'", "seq_num").getResultJSONArray(0); - //acs_device_extra - WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra"); - JSONArray result = new JSONArray(); - for (int i = 0; i < arr.size(); i++) { - JSONObject obj = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("device_id", obj.getString("device_id")); - json.put("device_code", obj.getString("device_code")); - json.put("checked", false); - json.put("device_name", obj.getString("device_name")); - Device device = deviceAppService.findDeviceByCode(obj.getString("device_code")); - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - json.put("quantity", standardOrdinarySiteDeviceDriver.getQty()); - json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial()); - json.put("remark", standardOrdinarySiteDeviceDriver.getRemark()); - } - JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0); - for (int m = 0; m < extraArr.size(); m++) { - JSONObject jsonObject = extraArr.getJSONObject(m); - String extra_code = jsonObject.getString("extra_code"); - //定点作业:自动创建任务 - if ("auto_create_task".equals(extra_code)) { - json.put("auto_create_task", jsonObject.getBoolean("extra_value")); - } - //呼叫 - if ("apply_task".equals(extra_code)) { - json.put("apply_task", jsonObject.getBoolean("extra_value")); - } - //响应 - if ("manual_create_task".equals(extra_code)) { - json.put("manual_create_task", jsonObject.getBoolean("extra_value")); - } - //清除 - if ("auto_clean_task".equals(extra_code)) { - json.put("auto_clean_task", jsonObject.getBoolean("extra_value")); - } - - } - result.add(json); - } - return result; - } @Override public JSONArray selectDeviceDevicerInfo(String status) { @@ -1515,6 +1369,35 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial return "0"; } + + @Override + public void updateDeviceCodeByAddress(StorageCellDto dto){ + Iterator iterator = storageCells.iterator(); + StorageCellDto dto1 = null; + while (iterator.hasNext()) { + StorageCellDto storageCellDto = (StorageCellDto) iterator.next(); + if(StrUtil.equals(storageCellDto.getStorage_code(),dto.getStorage_code())){ + storageCells.remove(storageCellDto); + storageCells.add(dto); + } + } + } + + @Override + public void addDeviceCodeByAddress(StorageCellDto dto){ + Iterator iterator = storageCells.iterator(); + StorageCellDto dto1 = null; + while (iterator.hasNext()) { + StorageCellDto storageCellDto = (StorageCellDto) iterator.next(); + if(StrUtil.equals(storageCellDto.getStorage_code(),dto.getStorage_code())){ + dto1 = storageCellDto; + } + } + if(ObjectUtil.isEmpty(dto1)){ + storageCells.add(dto); + } + } + @Override public List findCacheDevice() { List list = deviceAppService.findAllDevice(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/StorageCellServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/StorageCellServiceImpl.java index ba8af2281..42367c9fa 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/StorageCellServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/StorageCellServiceImpl.java @@ -11,6 +11,8 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.service.DeviceExtraService; +import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.StorageCellService; import org.nl.acs.device.service.dto.StorageCellDto; import org.nl.modules.common.exception.BadRequestException; @@ -40,6 +42,9 @@ import java.util.Map; @Slf4j public class StorageCellServiceImpl implements StorageCellService { + private final DeviceService deviceService; + + @Override public Map queryAll(Map whereJson, Pageable page) { String storage_code = MapUtil.getStr(whereJson, "storage_code"); @@ -105,11 +110,11 @@ public class StorageCellServiceImpl implements StorageCellService { dto.setUpdate_by(currentUsername); dto.setUpdate_time(now); dto.setCreate_time(now); - WQLObject wo = WQLObject.getWQLObject("acs_storage_cell"); JSONObject json = (JSONObject) JSONObject.toJSON(dto); - wo.insert(json); + deviceService.addDeviceCodeByAddress(dto); + } @Override @@ -125,8 +130,9 @@ public class StorageCellServiceImpl implements StorageCellService { WQLObject wo = WQLObject.getWQLObject("acs_storage_cell"); JSONObject json = (JSONObject) JSONObject.toJSON(dto); - wo.update(json); + deviceService.updateDeviceCodeByAddress(dto); + } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java index 8db0378eb..320be13e5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java @@ -255,15 +255,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, Integer.parseInt(value)); -// itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); - } public void writing(int type, int command) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/ItemProtocol.java new file mode 100644 index 000000000..1d48fda21 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/ItemProtocol.java @@ -0,0 +1,48 @@ +package org.nl.acs.device_driver.basedriver.lamp_three_color; + +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ItemProtocol { + + public static String item_to_command = "to_command"; + + + private LampThreecolorDeviceDriver driver; + + public ItemProtocol(LampThreecolorDeviceDriver driver) { + this.driver = driver; + } + + public int getToCommand() { + return this.getOpcIntegerValue(item_to_command); + } + + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + } else { + return value; + } + return 0; + + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_command, "作业命令", "08011")); + return list; + } + +} + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/LampThreecolorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/LampThreecolorDefination.java new file mode 100644 index 000000000..8f2f3a920 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/LampThreecolorDefination.java @@ -0,0 +1,65 @@ +package org.nl.acs.device_driver.basedriver.lamp_three_color; + +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.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * 标准版-三色灯 + */ +@Service +public class LampThreecolorDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "lamp_three_color"; + } + + @Override + public String getDriverName() { + return "标准版-三色灯"; + } + + @Override + public String getDriverDescription() { + return "标准版-三色灯"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new LampThreecolorDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return LampThreecolorDeviceDriver.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/lamp_three_color/LampThreecolorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/LampThreecolorDeviceDriver.java new file mode 100644 index 000000000..269e127b8 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/lamp_three_color/LampThreecolorDeviceDriver.java @@ -0,0 +1,109 @@ +package org.nl.acs.device_driver.basedriver.lamp_three_color; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.opc.Device; +import org.nl.modules.wql.util.SpringContextHolder; +import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 标准版-三色灯 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + + @Autowired + DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + + String container; + String container_type_desc; + String last_container_type_desc; + String last_container; + //放货准备锁 + String putReadyLock = null; + //有货标记 + protected boolean has_goods_tag = false; + String devicecode; + int mode = 0; + int action = 0; + int error = 0; + int move = 0; + int task = 0; + int last_action = 0; + int last_mode = 0; + int last_error = 0; + int last_move = 0; + int last_task = 0; + + boolean hasVehicle = false; + boolean isReady = false; + protected int instruction_num = 0; + protected int instruction_num_truth = 0; + protected boolean hasGoods = false; + boolean isFold = false; + private String assemble_check_tag; + private Boolean sampleMode0; + private Boolean sampleMode3; + private Integer sampleError; + private Boolean sampleOnline; + protected String displayMessage = null; + public int display_message_time_out = 30000; + public Date display_message_time; + protected String current_stage_instruction_message; + protected String last_stage_instruction_message; + Integer heartbeat_tag; + private Date instruction_require_time = new Date(); + private Date instruction_finished_time = new Date(); + + private int instruction_require_time_out; + boolean requireSucess = false; + + private int instruction_finished_time_out; + + int branchProtocol = 0; + + String device_code = null; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + String message = null; + device_code = this.getDevice().getDevice_code(); + + } + + 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/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index ef9e23c77..5daeacb56 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -15,6 +15,7 @@ import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; +import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver; import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; @@ -374,6 +375,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //Device startDevice = deviceAppService.findDeviceByCode(start_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; // if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { // hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); // hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); @@ -390,6 +393,28 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes)); } } + + if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver(); +// hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); + + if(StrUtil.startWith(taskDto.getTask_code(), "-")){ + if(ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))){ + String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString(); + Device lampDevice = deviceAppService.findDeviceByCode(lamp); + if(ObjectUtil.isEmpty(lampDevice)){ + return; + } + if (lampDevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lampDevice.getDeviceDriver(); + logServer.deviceExecuteLog(this.device_code, "", "", "下发报警灯"+ lamp +"报警信号"); + lampThreecolorDeviceDriver.writing("to_command","1"); + } + } + } + + } + if (this.getNow_steps_type() == 5) { this.writing("to_command", "5"); this.setNow_steps_type(6); @@ -843,11 +868,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } public void writing(int command) { - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); this.control(itemMap); - } //将扩展表中的字符串数据转换成集合 diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 96cdcc222..e58e5a5eb 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -98,6 +98,8 @@ import siemens_conveyor_ckk from '@/views/acs/device/driver/siemens_conveyor_ckk import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor' import photoelectric_inspection_site from '@/views/acs/device/driver/photoelectric_inspection_site' import standard_autodoor from '@/views/acs/device/driver/standard_autodoor' +import lamp_three_color from '@/views/acs/device/driver/lamp_three_color' + export default { name: 'DeviceConfig', @@ -126,7 +128,8 @@ export default { siemens_conveyor_ckk, siemens_onefloor_agv_conveyor, photoelectric_inspection_site, - standard_autodoor + standard_autodoor, + lamp_three_color }, dicts: ['device_type'], mixins: [crud], diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue b/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue index bdb907919..ed6082c0f 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue @@ -105,6 +105,14 @@ /> + + + +