diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/config/server/impl/AcsConfigServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/config/server/impl/AcsConfigServiceImpl.java index 31ab0ac..432448a 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/config/server/impl/AcsConfigServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/config/server/impl/AcsConfigServiceImpl.java @@ -83,6 +83,9 @@ public class AcsConfigServiceImpl implements AcsConfigService, ApplicationAutoIn public AcsConfigDto findByCode(String code) { WQLObject wo = WQLObject.getWQLObject("sys_param"); JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(json)){ + return null; + } final AcsConfigDto obj = json.toJavaObject(AcsConfigDto.class); return obj; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 3c2bbf1..b9fef08 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -11,29 +11,43 @@ import com.alibaba.fastjson.JSONObject; public enum DriverTypeEnum { ORDINARY_SITE(1, "standard_ordinary_site", "普通站点", "station"), - INSPECT_SITE(3, "standard_inspect_site", "检测站点", "station"), + INSPECT_SITE(2, "standard_inspect_site", "检测站点", "station"), - AUTODOOR(9, "standard_autodoor", "标准版-自动门", "autodoor"), + AUTODOOR(3, "standard_autodoor", "标准版-自动门", "autodoor"), - STACK_EMPUYPALLET_SITE(10, "standard_emptypallet_site", "标准版-空盘叠盘站点", "station"), + STACK_EMPUYPALLET_SITE(4, "standard_emptypallet_site", "标准版-空盘叠盘站点", "station"), - LAMP_THREE_COLOR(11, "lamp_three_color", "标准版-三色灯", "alarmLamp"), + LAMP_THREE_COLOR(5, "lamp_three_color", "标准版-三色灯", "alarmLamp"), - STORAGE(13, "standard_storage", "标准版-货架", "storage"), + STORAGE(6, "standard_storage", "标准版-货架", "storage"), - SCANNER(14, "standard_scanner", "标准版-扫码器", "scanner"), + SCANNER(7, "standard_scanner", "标准版-扫码器", "scanner"), - INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(15, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "station"), + INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(8, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "station"), - INSPECT_CONVEYOR_CONTROL(16, "standard_conveyor_control", "标准版-输送机-控制点", "conveyor"), + INSPECT_CONVEYOR_CONTROL(9, "standard_conveyor_control", "标准版-输送机-控制点", "conveyor"), - INSPECT_CONVEYOR_MONITOR(17, "standard_conveyor_monitor", "标准版-输送机-监控点", "conveyor"), + INSPECT_CONVEYOR_MONITOR(10, "standard_conveyor_monitor", "标准版-输送机-监控点", "conveyor"), - MANIPULATOR_INSPECT_SITE_NDC(18, "manipulator_inspect_site_NDC", "区域管制设备交互站点-NDC", "station"), + MANIPULATOR_INSPECT_SITE_NDC(11, "manipulator_inspect_site_NDC", "区域管制设备交互站点-NDC", "station"), - INSPECT_CONVEYOR_CONTROL_WITH_PLCSCANNER(27, "standard_conveyor_control_with_plcscanner", "标准版-输送机-控制点-PLC扫码", "conveyor"), + INSPECT_CONVEYOR_CONTROL_WITH_PLCSCANNER(12, "standard_conveyor_control_with_plcscanner", "标准版-输送机-控制点-PLC扫码", "conveyor"), - ELECTRIC_FENCE(32, "electric_fence", "标准版-电子围栏", "safetydoor"); + ELECTRIC_FENCE(13, "electric_fence", "标准版-电子围栏", "safetydoor"), + + HAILIANG_OLD_SPECIAL_DEVICE_DRIVER(14, "hailiang_old_special_device", "老车间-专机设备", "conveyor"), + + HAILIANG_OLD_SPECIAL_EMPTY_STATION_DRIVER(15, "hailiang_old_special_empty_station", "老车间-专机空料位", "conveyor"), + + HAILIANG_OLD_SPECIAL_FULL_STATION_DRIVER(16, "hailiang_old_special_full_station", "老车间-专机满料位", "conveyor"), + + HAILIANG_OLD_SPECIAL_PICK_STATION_DRIVER(17, "hailiang_old_special_pick_station", "老车间-专机收料位", "conveyor"), + + HAILIANG_OLD_SPECIAL_EMPTY_POUR_DRIVER(18, "hailiang_old_special_pour_station", "老车间-专机倒料位", "conveyor"), + + HAILIANG_OLD_STACKING_MANIPULATOR_DRIVER(19, "hailiang_old_stacking_manipulator", "老车间-码垛机械手", "station"), + + HAILIANG_OLD_PALLETIZING_STATION_DRIVER(20, "hailiang_old_palletizing_station", "老车间-码垛工位", "station"); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java index ff6b4f1..5eaa2dd 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java @@ -82,6 +82,14 @@ public class DeviceController { deviceService.downDeviceDBloadCSV(deviceService.queryDeviceProtocol(whereJson), response); } + @Log("导出Smart设备协议CSV") + @ApiOperation("导出Smart设备协议CSV") + @GetMapping(value = "/protocol/downloadSmartCSV") + //@PreAuthorize("@el.check('device:list')") + public void downDeviceDBloadSmartCSV(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { + deviceService.downDeviceDBloadSmartCSV(deviceService.queryDeviceProtocol(whereJson), response); + } + @Log("导出欧姆龙设备协议CSV") @ApiOperation("导出欧姆龙设备协议CSV") @GetMapping(value = "/protocol/downloadoumulongCSV") @@ -113,7 +121,6 @@ public class DeviceController { //@PreAuthorize("@el.check('device:del')") @DeleteMapping public ResponseEntity delete(@RequestBody String[] ids) { - deviceService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java index e48bf37..7882c2e 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java @@ -241,7 +241,7 @@ public interface DeviceService { void downDeviceDBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); void downDeviceDBloadOumulongCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); - + void downDeviceDBloadSmartCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); JSONArray selectDeviceListByType(String type); /** diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 5c7a4fe..3dd175a 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -238,7 +238,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial log.info("设备删除成功!"); if (deviceByCode != null) { - if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name())) { + DeviceDriverDefination deviceDriverDefination = deviceByCode.getDeviceDriverDefination(); + String name = ""; + if (ObjectUtil.isNotEmpty(deviceDriverDefination)){ + name = deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name(); + } + if (StrUtil.equals("storage", name)) { storageTab.delete("substring_index( storage_code,'-',1)= '" + device_code + "'"); } else { @@ -1554,4 +1559,49 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } + + @Override + public void downDeviceDBloadSmartCSV(JSONArray jsonarr, HttpServletResponse response) { + List cellList = new ArrayList<>(); + for (int i = 0; i < jsonarr.size(); i++) { + List item = new ArrayList(); + JSONObject jo = jsonarr.getJSONObject(i); + String extra_code = jo.getString("extra_code"); + //校验数据 格式为: RD1.RD1.A1.mode + int num = countStr(extra_code, "."); + if (num != 3) { + throw new BadRequestException(extra_code + "数据格式不正确"); + } + + extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length()); + extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length()); + item.add(extra_code); + item.add(jo.get("extra_name")); + String datatype = jo.getString("extra_name"); + //西门子200 + if (!datatype.contains(".")) { + String[] split = datatype.split(""); + if (split[1].equals("W")) { + datatype = "Word"; + } else if (split[1].equals("D")) { + datatype = "DWord"; + } + } else { + datatype = "Boolean"; + } + + item.add(datatype); + item.add("1"); + item.add("R/W"); + item.add("100"); + + cellList.add(item.toArray()); + } + + String[] tableHeaderArr = {"Tag Name", "Address", "Data Type", "Respect Data Type", + "Client Access", "Scan Rate"}; + String fileName = "导出文件.csv"; + byte[] bytes = ExportCSVUtil.writeCsvAfterToBytes(tableHeaderArr, cellList); + ExportCSVUtil.responseSetProperties(fileName, bytes, response); + } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java index 60b9c34..6f15123 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java @@ -1,10 +1,18 @@ package org.nl.acs.device_driver.driver; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.opc.OpcConfig; import org.nl.modules.udw.UnifiedDataAccessor; import org.nl.modules.udw.UnifiedDataAccessorFactory; +import org.nl.utils.SpringContextHolder; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver { -public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver { UnifiedDataAccessor opcUdw; public AbstractOpcDeviceDriver() { @@ -15,4 +23,288 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc public UnifiedDataAccessor getOpcValueAccessor() { return this.opcUdw; } + + //不需要写入日志的点位名称 + String notWriteLog = "heartbeat,device_running_time"; + + //信号值与上次值不一致时的日志 + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + if (lastNumber != nowNumber) { + logServer.deviceItemValue(device_code, name, String.valueOf(nowNumber)); + logServer.deviceExecuteLog(device_code, "", "", "信号'" + name + "':" + lastNumber + "->" + nowNumber); + } + } + + //判断信号是否异常 + public synchronized void signalIsException(T sonDriver) { + Class sonDriverClass = sonDriver.getClass(); + try { + //获取对应驱动的itemprotocol对象 + Method methodItemProtocol = sonDriverClass.getMethod("getItemProtocol"); + Object itemProtocol = methodItemProtocol.invoke(sonDriver); + //获取对应驱动的设备编码 + String deviceCode = (String) sonDriverClass.getMethod("getDeviceCode").invoke(sonDriver); + //获取itemProtocol对象中的所有属性 + Field[] fields = itemProtocol.getClass().getDeclaredFields(); + //遍历所有属性 主要是获取对应的点位信息 + for (Field field : fields) { + //获取属性名字 itemProtocol中定义点位的变量严格按照规范 + //即定义读取的变量名称时,需要在前缀加上item_,定义写入的变量时需要在前缀加上item_to_, + //定义读取或写入的点位名称(即变量名称对应的值)时去掉item_即可 + String fieldName = field.getName(); + //判断点位名称是否含有item_,如果含有说明是需要读取或写入的点位 + if (fieldName.contains("item_")) { + //判断点位是否是读取的点位,因为主要是获取kep上可读取的点位值,不需要写入的, + //主要是用来记录与上次点位不一致时写入日志,或作一些其他事情 + if (!fieldName.contains("to_")) { + //通过itemProtocol对象中定义的变量名称,获取对应的点位名称, + //主要是为了通过点位名称获取对应的点位值 + String fieldValue = (String) field.get(fieldName); + Method methodGet = null; + try { + //通过反射获取点位值的方法 规定方法名为get+点位名称,其中点位名称首字母大写 + methodGet = itemProtocol.getClass().getMethod("get" + initialUpperCase(fieldValue)); + } catch (Exception e) { + } + //定义点位值 + int itemValue = 0; + //判断是否有获取获取该点位值的方法,若果有就通过反射执行该方法,并将获取到的值赋给点位值 + if (ObjectUtil.isNotEmpty(methodGet)) { + itemValue = (int) methodGet.invoke(itemProtocol); + } + + //通过反射将点位值赋值给驱动中定义的点位变量 + Method methodSet = null; + try { + methodSet = sonDriverClass.getMethod("set" + initialUpperCase(fieldValue), int.class); + } catch (Exception e) { + } + if (ObjectUtil.isNotEmpty(methodSet)) { + try { + methodSet.invoke(sonDriver, itemValue); + } catch (Exception e) { + } + } + //判断本次点位值和上次是否一致 如果不一致则写入日志记录 + // notWriteLog是值不一致时,不需要写入日志的点位名称 + if (!fieldValue.contains(notWriteLog)) { + //通过反射获取点位上一次的值的方法 + Method methodGetLast = null; + try { + methodGetLast = sonDriverClass.getMethod("getLast_" + fieldValue); + } catch (Exception e) { + } + //定义上次点位值 + int last_Number = 0; + //判断是否有获取获取该上次点位值的方法,若果有就通过反射执行该方法,并将获取到的值赋给上次点位值 + if (ObjectUtil.isNotEmpty(methodGetLast)) { + last_Number = (int) methodGetLast.invoke(sonDriver); + } + //通过反射获取本次与上次点位值不一样写入日志的方法writeLogInfo + //需要传入设备编码,点位名称,上一次点位值,本次点位值 + Method writeLogInfo = null; + try { + writeLogInfo = sonDriverClass.getMethod("writeLogInfo", String.class, String.class, int.class, int.class); + } catch (Exception e) { + } + if (ObjectUtil.isNotEmpty(writeLogInfo)) { + writeLogInfo.invoke(sonDriver, deviceCode, fieldValue, last_Number, itemValue); + } + } + } + } + } + + //method1 是在获取点位值并写入日志后 需要执行的业务逻辑方法 + //如果需要在获取点位值并写入日志后执行业务逻辑,在驱动对应的method1方法中书写就行 + Method method1 = null; + try { + method1 = sonDriverClass.getMethod("method1"); + } catch (Exception e) { + } + if (ObjectUtil.isNotEmpty(method1)) { + method1.invoke(sonDriver); + } + + //获取设置设备是否在线方法 + Method methodIsonline = null; + try { + methodIsonline = sonDriverClass.getMethod("setIsonline", Boolean.class); + } catch (Exception e) { + } + //获取设置设备是否故障方法 + Method methodIserror = null; + try { + methodIserror = sonDriverClass.getMethod("setIserror", Boolean.class); + } catch (Exception e) { + } + //获取设置异常消息的方法 貌似没用 + Method methodMessage = null; + try { + methodMessage = sonDriverClass.getMethod("setMessage", String.class); + } catch (Exception e) { + } + //获取mode值方法 是否联机 + Method methodMode = null; + try { + methodMode = sonDriverClass.getMethod("getMode"); + } catch (Exception e) { + } + //获取设备是否故障方法 + Method methodError = null; + try { + methodError = sonDriverClass.getMethod("getError"); + } catch (Exception e) { + } + //获取设备是否在线方法 + Method methodOnline = null; + try { + methodOnline = itemProtocol.getClass().getMethod("getIsonline"); + } catch (Exception e) { + } + + //定义是否联机点位值 + int mode = 0; + //定义故障点位值 + int error = 0; + //定义在线点位值 + Boolean isonline = true; + //先判断该驱动是否有该点位值,如果有-> + //执行获取mode值的方法,并将获取的mode值付给联机点位值 + if (ObjectUtil.isNotEmpty(methodMode)) { + mode = (int) methodMode.invoke(sonDriver); + } else { + mode = 1; + } + //执行获取error值的方法,并将error值付给故障点位值 + if (ObjectUtil.isNotEmpty(methodError)) { + error = (int) methodError.invoke(sonDriver); + } + //执行获取isonline值的方法,并将isonline值付给在线点位值 + //该值是在其驱动对象对应的itemProtocol中获取的 + if (ObjectUtil.isNotEmpty(methodOnline)) { + isonline = (Boolean) methodOnline.invoke(itemProtocol); + } + //设备不在线时执行逻辑 + if (!isonline) { + try { + methodIsonline.invoke(sonDriver, false); + methodIserror.invoke(sonDriver, true); + methodMessage.invoke(sonDriver, "信号量同步异常"); + } catch (Exception e) { + } + } else if (mode == 0) { //设备未联机执行逻辑 如果该设备没有mode值 上面有赋值mode=1 不会执行该方法 + try { + methodIsonline.invoke(sonDriver, false); + methodIserror.invoke(sonDriver, true); + methodMessage.invoke(sonDriver, "未联机"); + } catch (Exception e) { + } + } else if (error != 0) { //设备异常执行逻辑 + try { + methodIsonline.invoke(sonDriver, false); + methodIserror.invoke(sonDriver, true); + methodMessage.invoke(sonDriver, "有报警"); + } catch (Exception e) { + } + } else { + //设备正常时执行的业务逻辑 + try { + methodIsonline.invoke(sonDriver, true); + methodIserror.invoke(sonDriver, false); + } catch (Exception e) { + } + + //判断是否符合生成任务的条件,如果需要生成任务在该驱动的isSatisfyCreateTask方法中做一些逻辑判断 + //断条件是否满足,如果满足就返回需要执行的任务方法名,如果不满足就返回null + Method methodIsSatisfyCreateTask = null; + try { + methodIsSatisfyCreateTask = sonDriverClass.getMethod("isSatisfyCreateTask"); + } catch (Exception e) { + } + //通过反射获取isSatisfyCreateTask返回的需要生成任务的方法名 + String methodName = null; + if (ObjectUtil.isNotEmpty(methodIsSatisfyCreateTask)) { + Object o = methodIsSatisfyCreateTask.invoke(sonDriver); + if (ObjectUtil.isNotEmpty(o)) { + methodName = (String) o; + } + + } + //判断方法名是否为空,如果为空则不需要生成任务 不做任何操作 + //不为空则执行生成任务的方法 + if (StrUtil.isNotEmpty(methodName)) { + Method methodTask = null; + try { + methodTask = sonDriverClass.getMethod(methodName); + } catch (Exception e) { + + } + if (ObjectUtil.isNotEmpty(methodTask)) { + methodTask.invoke(sonDriver); + } + //sonDriverClass.getMethod(methodName).invoke(sonDriver); + } + + //method2 也是做做一些业务处理的方法 设备正常执行时 比如说任务完成时,需要做的一些业务逻辑等 + Method method2 = null; + try { + method2 = sonDriverClass.getMethod("method2"); + } catch (Exception e) { + } + if (ObjectUtil.isNotEmpty(method2)) { + method2.invoke(sonDriver); + } + } + //赋值last_属性 将当前读取到的值赋值给需要记录的上一次值 + //首先获取驱动中的所有属性 + Field[] declaredFields = sonDriverClass.getDeclaredFields(); + //遍历所有属性 + for (Field declaredField : declaredFields) { + //获取属性名称 + String fieldName = declaredField.getName(); + //获取属性类型 + Class fieldType = declaredField.getType(); + //判断属性类型是否位int或Integer 因为需要将当前值赋值给记录上一次值的变量的都是整型 + if (fieldType == int.class || fieldType == Integer.class) { + //判断属性名是否包含last_,因为只有设备需要记录上一次的点位值才含有last_ + if (fieldName.contains("last_")) { + //获取执行赋值的方法 + Method method = null; + try { + method = sonDriverClass.getMethod("set" + initialUpperCase(fieldName), int.class); + } catch (Exception e) { + } + //将属性名从last_后截取,因为要读取当前的属性值 + int index = fieldName.indexOf("last_"); + String subName = fieldName.substring(index + 5); + //获取执行获取当前点位值的方法 + Method methodSub = null; + try { + methodSub = sonDriverClass.getMethod("get" + initialUpperCase(subName)); + } catch (Exception e) { + + } + //执行获取当前点位值的方法,并将获取的值付给当前点位值 + int nowItemValue = 0; + if (ObjectUtil.isNotEmpty(methodSub)) { + nowItemValue = (int) methodSub.invoke(sonDriver); + } + //执行将当前点位值赋值给记录上次值的变量 + if (ObjectUtil.isNotEmpty(method)) { + method.invoke(sonDriver, nowItemValue); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + //首字母转大写 + public String initialUpperCase(String str) { + return str.substring(0, 1).toUpperCase() + str.substring(1, str.length()); + } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/HailiangOldPalletizingStationDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/HailiangOldPalletizingStationDefination.java new file mode 100644 index 0000000..449cfae --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/HailiangOldPalletizingStationDefination.java @@ -0,0 +1,60 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_palletizing_station; + +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 HailiangOldPalletizingStationDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_old_palletizing_station"; + } + + @Override + public String getDriverName() { + return "海亮老车间-码垛工位"; + } + + @Override + public String getDriverDescription() { + return "海亮老车间-码垛工位"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangOldPalletizingStationDriver()).setDevice(device).setDriverDefination(this); + } + + @Override + public Class getDeviceDriverType() { + return HailiangOldPalletizingStationDriver.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/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/HailiangOldPalletizingStationDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/HailiangOldPalletizingStationDriver.java new file mode 100644 index 0000000..77c7f36 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/HailiangOldPalletizingStationDriver.java @@ -0,0 +1,171 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_palletizing_station; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.config.server.AcsConfigService; +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.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.order.service.ProduceshiftorderService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.utils.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 HailiangOldPalletizingStationDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @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 + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + @Autowired + AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class); + @Autowired + ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderService.class); + + + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + private long last_feedDeviceStatusTime = 0; + int status_type = 0; + int last_status_type = 0; + + private Date instruction_require_time = new Date(); + private Date instruction_finished_time = new Date(); + private Date instruction_apply_time = new Date(); + private int instruction_require_time_out = 3000; + //请求成功标记 + Boolean requireSucess = false; + + String device_code; + + //心跳 + int heartbert = 0; + int last_heartbert = 0; + //模式 + int mode = 0; + int last_mode = 0; + //光电信号 + int move = 0; + int last_move = 0; + //数量 + int number = 0; + int last_number = 0; + //故障 + int error = 0; + int last_error = 0; + //箱型 + int boxtype = 0; + int last_boxtype = 0; + + @Override + + public Device getDevice() { + return this.device; + } + + + @Override + public synchronized void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + this.signalIsException(this); + } catch (Exception var17) { + return; + } + } + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + public void executing(int command, Instruction instruction, String appendMessage) { + + } + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + public void writing(int command, int target, int task) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + itemMap.put(to_target, target); + itemMap.put(to_task, task); + ReadUtil.write(itemMap, server); + + } + + 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; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + ReadUtil.write(itemMap, server); + } + + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); + if (lastNumber != nowNumber) { +// if (name.equals("mode")) { +// this.setRequireSucess(false); +// } + } + } + + public String isSatisfyCreateTask() { + return null; + } + + public void method1() { + } + + public void method2() { + } + +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/ItemProtocol.java new file mode 100644 index 0000000..fefee37 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_palletizing_station/ItemProtocol.java @@ -0,0 +1,112 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_palletizing_station; + +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_move = "move"; + //数量 + public static String item_number = "number"; + //故障 + public static String item_error = "error"; + //箱型 + public static String item_boxtype = "boxtype"; + + //下发命令 + public static String item_to_command = "to_command"; + + + private HailiangOldPalletizingStationDriver driver; + + public ItemProtocol(HailiangOldPalletizingStationDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getMove() { + return this.getOpcIntegerValue(item_move); + } + + public int getNumber() { + return this.getOpcIntegerValue(item_number); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getBoxtype() { + return this.getOpcIntegerValue(item_boxtype); + } + + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static String getField_desc(String item) { + String field_desc = ""; + List readlist = getReadableItemDtos(); + List writelist = getWriteableItemDtos(); + for (int i = 0; i < readlist.size(); i++) { + ItemDto dto = readlist.get(i); +// if(){ +// +// } + } + return field_desc; + } + + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_heartbeat, "心跳", "DB600.W0")); + list.add(new ItemDto(item_mode, "工作模式", "DB600.W2")); + list.add(new ItemDto(item_move, "光电信号", "DB600.W4")); + list.add(new ItemDto(item_number, "数量", "DB600.W6")); + list.add(new ItemDto(item_error, "故障", "DB600.W8")); + list.add(new ItemDto(item_boxtype, "箱型", "DB600.W10")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_command, "下发命令", "DB601.W2")); + return list; + } + +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/HailiangOldSpecialDeviceDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/HailiangOldSpecialDeviceDefination.java new file mode 100644 index 0000000..6061997 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/HailiangOldSpecialDeviceDefination.java @@ -0,0 +1,61 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_device; + +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 HailiangOldSpecialDeviceDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_old_special_device"; + } + + @Override + public String getDriverName() { + return "海亮老车间-专机设备"; + } + + @Override + public String getDriverDescription() { + return "海亮老车间-专机设备"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangOldSpecialDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return HailiangOldSpecialDeviceDriver.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/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/HailiangOldSpecialDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/HailiangOldSpecialDeviceDriver.java new file mode 100644 index 0000000..83031f5 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/HailiangOldSpecialDeviceDriver.java @@ -0,0 +1,273 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_device; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.config.server.AcsConfigService; +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.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.order.service.ProduceshiftorderService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.utils.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 HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @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 + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + @Autowired + AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class); + @Autowired + ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderService.class); + + int heartbeat = 0; + int mode = 0; + int line_status = 0; + int error = 0; + int task = 0; + int is_open = 0; + int running = 0; + int finish = 0; + int all_ready = 0; + int order_compel_finish = 0; + int order = 0; + int now_order_prod_num = 0; + int full_number = 0; + int now_one_box_num = 0; + int storage_stock_num = 0; + int line_stock_num = 0; + int open_ready_time = 0; + int device_running_time = 0; + int await_time = 0; + int order_prod_allnum = 0; + int empty_is_lack = 0; //空箱位缺箱 + int device_is_running = 0; //专机运行状态 + int empty_is_finish = 0; //空位完成 + int full_ready_req_agv = 0; //满箱位就绪,请求AGV + int full_out = 0; //满箱已运出满箱位 + int device_prepare = 0; //专机准备中 + int device_ready = 0; //专机就绪 + int line_ready = 0; //线体就绪 + + int last_heartbeat = 0; + int last_mode = 0; + int last_error = 0; + int last_task = 0; + int last_is_open = 0; + int last_running = 0; + int last_finish = 0; + int last_all_ready = 0; + int last_order_compel_finish = 0; + int last_order = 0; + int last_now_order_prod_num = 0; + int last_full_number = 0; + int last_now_one_box_num = 0; + int last_storage_stock_num = 0; + int last_line_stock_num = 0; + int last_open_ready_time = 0; + int last_device_running_time = 0; + int last_await_time = 0; + int last_order_prod_allnum = 0; + int last_empty_is_lack = 0; //空箱位缺箱 + int last_device_is_running = 0; //专机运行状态 + int last_empty_is_finish = 0; //空位完成 + int last_full_ready_req_agv = 0; //满箱位就绪,请求AGV + int last_full_out = 0; //满箱已运出满箱位 + int last_device_prepare = 0; //专机准备中 + int last_device_ready = 0; //专机就绪 + int last_line_ready = 0; //线体就绪 + int last_line_status = 0; + + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + private long last_feedDeviceStatusTime = 0; + int status_type = 0; + int last_status_type = 0; + + private Date instruction_require_time = new Date(); + private Date instruction_finished_time = new Date(); + private Date instruction_apply_time = new Date(); + private int instruction_require_time_out = 3000; + //请求成功标记 + Boolean requireSucess = false; + + String device_code; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public synchronized void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + this.signalIsException(this); + } catch (Exception var17) { + return; + } + } + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + public void executing(int command, Instruction instruction, String appendMessage) { + + } + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + public void writing(int command, int target, int task) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + itemMap.put(to_target, target); + itemMap.put(to_task, task); + ReadUtil.write(itemMap, server); + + } + + 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; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + ReadUtil.write(itemMap, server); + } + + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); + if (lastNumber != nowNumber) { +// if (name.equals("mode")) { +// this.setRequireSucess(false); +// } + } + } + + public String isSatisfyCreateTask(){ + return null; + } + + public void method1(){ + if (mode == 1 && last_mode == 0 && order > 0){ + System.out.println("我进入方法一了"); + } +// synchronized (this){ +// int realError = 0; +// long now_feedTime = System.currentTimeMillis(); +// if (now_feedTime - last_feedDeviceStatusTime >= 5000){ +// heartbeat = this.itemProtocol.getHeartbeat(); +// if (heartbeat == last_heartbeat){ +// status_type = 01; +// } else { +// status_type = 02; +// if (error == 1 || error == 51) { +// status_type = 05; +// realError = error; +// }else if (mode == 1 && order > 0) { +// status_type = 03; +// realError = 0; +// } else if (mode == 0 && order > 0) { +// realError = 0; +// status_type = 04; +// } +// } +// if (status_type != last_status_type) { +// JSONObject map = new JSONObject(); +// map.put("device_code", device_code); +// map.put("status_type", "0" + status_type); +// map.put("start_time", DateUtil.now()); +// map.put("error_code",realError); +// acsToWmsService.feedDeviceStatusType(map); +// last_status_type = status_type; +// } +// last_feedDeviceStatusTime = now_feedTime; +// last_heartbeat = heartbeat; +// } +// } + } + + public void method2(){ + if (mode == 0 && last_mode == 1 && order > 0){ + System.out.println("我进入方法2了"); + } +// if ( mode == 1 && finish != last_finish && finish == 1 && order > 0){ +// ProduceshiftorderDto dto = new ProduceshiftorderDto(); +// dto.setOrder_code(order + ""); +// dto.setOrder_status("2"); +// ProduceshiftorderDto deviceInfo = produceshiftorderService.findOrderByDeviceCode(this.device_code); +// if(deviceInfo != null){ +// if (StrUtil.isNotEmpty(deviceInfo.getExt_order_id())) { +// String ext_order_id = deviceInfo.getExt_order_id(); +// JSONObject param = new JSONObject(); +// param.put("ext_order_id",ext_order_id); +// acsToWmsService.feedbackOrderStatus(param); +// logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的外部标识:"+ext_order_id); +// }else { +// logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的没有外部标识"); +// } +// }else { +// logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单信息为空"); +// } +// produceshiftorderService.updateByOrderCode(dto); +// this.writing("to_confirm_finished","1"); +// this.writing("to_order", "0"); +// this.writing("to_clear","1"); +// this.writing("to_pause","1"); +// } else { +// logServer.deviceLogToacs(this.device_code,"","",device_code+":,finish>"+ finish +",last_finish>"+last_finish + "mode:" + mode + "order:" + order); +// } + } + +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/ItemProtocol.java new file mode 100644 index 0000000..cb09781 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_device/ItemProtocol.java @@ -0,0 +1,277 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_device; + +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_line_status = "line_status"; //线体状态 + public static String item_is_open = "is_open";// 线体是否启动 + public static String item_running = "running"; //是否运行 + public static String item_finish = "finish";// 订单完成 + public static String item_all_ready = "all_ready"; //所有设备就绪 + public static String item_order_compel_finish = "order_compel_finish"; // 订单强制完成 + public static String item_order = "order"; //订单号 + public static String item_error = "error"; //报警信号 + public static String item_task = "task"; //任务号 + public static String item_now_order_prod_num = "now_order_prod_num"; //当前生产总量 + public static String item_full_number = "full_number"; //出料口满框数量 + public static String item_now_one_box_num = "now_one_box_num"; //每框数量 + public static String item_storage_stock_num = "storage_stock_num"; //储料仓库存数量 + public static String item_line_stock_num = "line_stock_num"; //线体库存数量 + public static String item_open_ready_time = "open_ready_time";//开机准备时间(S) + public static String item_device_running_time = "device_running_time";//设备运行时间(S) + public static String item_await_time = "await_time";//待机时间(S) + public static String item_order_prod_allnum = "order_prod_allnum";//订单生产总量 + public static String item_empty_is_lack = "empty_is_lack"; //空箱位缺箱 + public static String item_device_is_running = "device_is_running"; //专机运行状态 + public static String item_empty_is_finish = "empty_is_finish"; //空位完成 + public static String item_full_ready_req_agv = "full_ready_req_agv"; //满箱位就绪,请求AGV + public static String item_full_out = "full_out"; //满箱已运出满箱位 + public static String item_device_prepare = "device_prepare"; //专机准备中 + public static String item_device_ready = "device_ready"; //专机就绪 + public static String item_line_ready = "line_ready"; //线体就绪 + + + //开机 + public static String item_to_open = "to_open"; + //产量清零 + public static String item_to_clear = "to_clear"; + //确认完成(订单完成状态置零) + public static String item_to_confirm_finished = "to_confirm_finished"; + //暂停 + public static String item_to_pause = "to_pause"; + //工单强制完成 + public static String item_to_order_compel_finished = "to_order_compel_finished"; + //订单生产总量 + public static String item_to_order_prod_num = "to_order_prod_num"; + //每框接料数量 + public static String item_to_one_box_num = "to_one_box_num"; + //倒料数量 + public static String item_to_out_num = "to_out_num"; + //工单号 + public static String item_to_order = "to_order"; + //agvAGV空位就绪 + public static String item_to_empty_ready = "to_empty_ready"; + //agvAGV满位就绪 + public static String item_to_full_ready = "to_full_ready"; + //agvAGV取货完成 + public static String item_to_pick_finish = "to_pick_finish"; + //任务号 + public static String item_to_task = "to_task"; + + + + private HailiangOldSpecialDeviceDriver driver; + + public ItemProtocol(HailiangOldSpecialDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getLineStatus() { + return this.getOpcIntegerValue(item_line_status); + } + + public int getIsOpen() { + return this.getOpcIntegerValue(item_is_open); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getRunning() { + return this.getOpcIntegerValue(item_running); + } + + public int getAllReady() { + return this.getOpcIntegerValue(item_all_ready); + } + + public int getOrder() { + return this.getOpcIntegerValue(item_order); + } + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getFinish() { + return this.getOpcIntegerValue(item_finish); + } + + public int getOrder_compel_finish() { + return this.getOpcIntegerValue(item_order_compel_finish); + } + + public int getNow_order_prod_num() { + return this.getOpcIntegerValue(item_now_order_prod_num); + } + + public int getFull_number() { + return this.getOpcIntegerValue(item_full_number); + } + + public int getNow_one_box_num() { + return this.getOpcIntegerValue(item_now_one_box_num); + } + + public int getStorage_stock_num() { + return this.getOpcIntegerValue(item_storage_stock_num); + } + + public int getLine_stock_num() { + return this.getOpcIntegerValue(item_line_stock_num); + } + + public int getOpen_ready_time() { + return this.getOpcIntegerValue(item_open_ready_time); + } + + public int getDevice_running_time() { + return this.getOpcIntegerValue(item_device_running_time); + } + + public int getAwait_time() { + return this.getOpcIntegerValue(item_await_time); + } + + public int getOrder_prod_allnum() { + return this.getOpcIntegerValue(item_order_prod_allnum); + } + + public int getEmpty_is_lack() { + return this.getOpcIntegerValue(item_empty_is_lack); + } + + public int getDevice_is_running() { + return this.getOpcIntegerValue(item_device_is_running); + } + + public int getEmpty_is_finish() { + return this.getOpcIntegerValue(item_empty_is_finish); + } + + public int getFull_ready_req_agv() { + return this.getOpcIntegerValue(item_full_ready_req_agv); + } + + public int getFull_out() { + return this.getOpcIntegerValue(item_full_out); + } + + public int getDevice_prepare() { + return this.getOpcIntegerValue(item_device_prepare); + } + + public int getDevice_ready() { + return this.getOpcIntegerValue(item_device_ready); + } + + public int getLine_ready() { + return this.getOpcIntegerValue(item_line_ready); + } + + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static String getField_desc(String item) { + String field_desc = ""; + List readlist = getReadableItemDtos(); + List writelist = getWriteableItemDtos(); + for (int i = 0; i < readlist.size(); i++) { + ItemDto dto = readlist.get(i); +// if(){ +// +// } + } + return field_desc; + } + + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_line_status, "线体状态", "V0.0")); + list.add(new ItemDto(item_is_open, "线体开机状态", "V0.1")); + list.add(new ItemDto(item_device_is_running, "专机运行状态", "V0.3")); + list.add(new ItemDto(item_empty_is_lack, "空箱位缺箱", "V0.5")); + list.add(new ItemDto(item_running, "空位运行", "V0.6")); + list.add(new ItemDto(item_empty_is_finish, "空位完成", "V0.7")); + list.add(new ItemDto(item_full_ready_req_agv, "满箱位就绪,请求AGV", "V1.0")); + list.add(new ItemDto(item_full_out, "满箱已运出满箱位", "V1.1")); + list.add(new ItemDto(item_finish, "订单完成", "V1.2")); + list.add(new ItemDto(item_device_prepare, "专机准备中", "V1.3")); + list.add(new ItemDto(item_device_ready, "专机就绪", "V1.4")); + list.add(new ItemDto(item_line_ready, "线体就绪", "V1.5")); + list.add(new ItemDto(item_all_ready, "所有设备就绪", "V1.6")); + list.add(new ItemDto(item_mode, "手自动状态", "V1.7", Boolean.valueOf(true))); + list.add(new ItemDto(item_order_compel_finish, "订单强制完成", "V2.0")); + list.add(new ItemDto(item_error, "报警信号", "VW8")); + list.add(new ItemDto(item_heartbeat, "心跳", "VW22")); + list.add(new ItemDto(item_now_order_prod_num, "当前生产总量", "VD32")); + list.add(new ItemDto(item_now_one_box_num, "当前箱生产总量", "VD36")); + list.add(new ItemDto(item_task, "任务号", "VD40")); + list.add(new ItemDto(item_full_number, "出料口满框数量", "VD44")); + list.add(new ItemDto(item_storage_stock_num, "储料仓库存数量", "VD48")); + list.add(new ItemDto(item_line_stock_num, "线体库存数量", "VD52")); + list.add(new ItemDto(item_open_ready_time, "开机准备时间(S)", "VD56")); + list.add(new ItemDto(item_device_running_time, "设备运行时间(S)", "VD60")); + list.add(new ItemDto(item_await_time, "待机时间(S)", "VD64")); + list.add(new ItemDto(item_order_prod_allnum, "订单生产总量", "VD68")); + list.add(new ItemDto(item_order, "工单号", "VD72")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_open, "设备开关", "VW108", Boolean.valueOf(true))); + list.add(new ItemDto(item_to_empty_ready, "AGV空位就绪", "VW110")); + list.add(new ItemDto(item_to_full_ready, "AGV满位就绪", "VW112")); + list.add(new ItemDto(item_to_pick_finish, "AGV取货完成", "VW114")); + list.add(new ItemDto(item_to_clear, "当前产量清零", "VW116")); + list.add(new ItemDto(item_to_confirm_finished, "确认完成", "VW118")); + list.add(new ItemDto(item_to_pause, "暂停", "VW120")); + list.add(new ItemDto(item_to_order_compel_finished, "工单强制完成", "VW122")); + list.add(new ItemDto(item_to_order_prod_num, "订单生产总量", "VD132")); + list.add(new ItemDto(item_to_one_box_num, "每箱接料数量", "VD136")); + list.add(new ItemDto(item_to_task, "任务号", "VD140")); + list.add(new ItemDto(item_to_out_num, "倒料数量", "VD144")); + list.add(new ItemDto(item_to_order, "工单号", "VD172")); + return list; + } + +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/HailiangOldSpecialEmptyStationDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/HailiangOldSpecialEmptyStationDefination.java new file mode 100644 index 0000000..bf0b7bd --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/HailiangOldSpecialEmptyStationDefination.java @@ -0,0 +1,61 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_empty_station; + +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 HailiangOldSpecialEmptyStationDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_old_special_empty_station"; + } + + @Override + public String getDriverName() { + return "海亮老车间-专机设备空框位"; + } + + @Override + public String getDriverDescription() { + return "海亮老车间-专机设备空框位"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangOldSpecialEmptyStationDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return HailiangOldSpecialEmptyStationDeviceDriver.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/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/HailiangOldSpecialEmptyStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/HailiangOldSpecialEmptyStationDeviceDriver.java new file mode 100644 index 0000000..410fc4c --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/HailiangOldSpecialEmptyStationDeviceDriver.java @@ -0,0 +1,219 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_empty_station; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.agv.server.AgvService; +import org.nl.acs.config.server.AcsConfigService; +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.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.utils.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.List; +import java.util.Map; + +/** + * 海亮专机设备空框位 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class HailiangOldSpecialEmptyStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @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 + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + @Autowired + AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class); + @Autowired + AgvService agvService = SpringContextHolder.getBean(AgvService.class); + + String container; + + int agvphase = 0; + int index = 0; + String device_code; + + int mode = 0; + int status = 0; + int move = 0; + int finish = 0; + int allready = 0; + int order = 0; + int error = 0; + int task = 0; + int running = 0; + //出入库模式 + int operation_type = 0; + int last_mode = 0; + int last_status = 0; + int last_error = 0; + int last_move = 0; + int last_task = 0; + int last_all_ready = 0; + int last_order = 0; + int last_finish = 0; + int last_running = 0; + + + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + + boolean hasVehicle = false; + boolean isReady = false; + protected int instruction_num = 0; + protected int instruction_num_truth = 0; + boolean isFold = false; + private String assemble_check_tag; + + 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 Date instruction_apply_time = new Date(); + private int instruction_require_time_out = 3000; + //请求成功标记 + Boolean requireSucess = false; + //申请指令成功标记 + Boolean applySucess = false; + String inst_message; + + private int instruction_finished_time_out; + + int branchProtocol = 0; + //备注 + String remark; + //数量 + String qty; + //物料 + String material; + //当前指令 + Instruction inst = null; + //上次指令 + Instruction last_inst = null; + + //触摸屏手动触发任务 + private Boolean is_has_task = false; + + //申请搬运任务 + private Boolean apply_handling = false; + //申请物料 + private Boolean apply_material = false; + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag = 0; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() throws Exception { + String message = null; + try { + this.signalIsException(this); + } catch (Exception var17) { + return; + } + } + + + public boolean exe_business() { + return true; + } + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + public void executing(int command, Instruction instruction, String appendMessage) { + + } + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + + public void writing(int command, int target, int task) { + + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + itemMap.put(to_target, target); + itemMap.put(to_task, task); + ReadUtil.write(itemMap, server); + } + + public void writing(int type, int command) { + + } + + public void writing(String key, String value) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + key; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, value); + ReadUtil.write(itemMap, server); + } + + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); + if (lastNumber != nowNumber) { +// if (name.equals("mode")) { +// this.setRequireSucess(false); +// } + } + } + + public String isSatisfyCreateTask(){ + return null; + } + + public void method1(){} + public void method2(){} + + +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/ItemProtocol.java new file mode 100644 index 0000000..3a44829 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_empty_station/ItemProtocol.java @@ -0,0 +1,109 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_empty_station; + +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_move = "move"; + public static String item_running = "running"; + public static String item_status = "status"; + public static String item_finish = "finish"; + public static String item_all_ready = "all_ready"; + public static String item_order = "order"; + public static String item_error = "error"; + public static String item_task = "task"; + + public static String item_to_agv_ready = "to_agv_ready"; + + public static String item_to_agv_finish = "to_agv_finish"; + + private HailiangOldSpecialEmptyStationDeviceDriver driver; + + public ItemProtocol(HailiangOldSpecialEmptyStationDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getMove() { + return this.getOpcIntegerValue(item_move); + } + + public int getRunning() { + return this.getOpcIntegerValue(item_running); + } + + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getFinish() { return this.getOpcIntegerValue(item_finish);} + + public int getAllReady() { return this.getOpcIntegerValue(item_all_ready);} + + public int getOrder() { return this.getOpcIntegerValue(item_order);} + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + public int getStatus() { + return this.getOpcIntegerValue(item_status); + } + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_status, "线体状态", "V0.0", Boolean.valueOf(true))); + list.add(new ItemDto(item_mode, "线体开机状态", "V0.1")); + list.add(new ItemDto(item_move, "空箱位光电信号", "V0.5")); + list.add(new ItemDto(item_running, "空位运行", "V0.6")); + list.add(new ItemDto(item_finish, "空位完成", "V0.7")); + list.add(new ItemDto(item_all_ready, "所有设备就绪", "V1.6")); + list.add(new ItemDto(item_error, "报警信号", "VW8")); + list.add(new ItemDto(item_heartbeat, "心跳", "VW22")); + list.add(new ItemDto(item_task, "任务号", "VD40")); + list.add(new ItemDto(item_order, "工单号", "VD72")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_agv_ready, "AGV空位就绪", "VW110", Boolean.valueOf(true))); + return list; + } + +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/HailiangOldSpecialFullStationDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/HailiangOldSpecialFullStationDefination.java new file mode 100644 index 0000000..e9b9258 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/HailiangOldSpecialFullStationDefination.java @@ -0,0 +1,61 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_full_station; + +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 HailiangOldSpecialFullStationDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_old_special_full_station"; + } + + @Override + public String getDriverName() { + return "海亮老车间-专机设备满框位"; + } + + @Override + public String getDriverDescription() { + return "海亮老车间-专机设备满框位"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangOldSpecialFullStationDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return HailiangOldSpecialFullStationDeviceDriver.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/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/HailiangOldSpecialFullStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/HailiangOldSpecialFullStationDeviceDriver.java new file mode 100644 index 0000000..8ff7962 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/HailiangOldSpecialFullStationDeviceDriver.java @@ -0,0 +1,207 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_full_station; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.agv.server.AgvService; +import org.nl.acs.config.server.AcsConfigService; +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.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.order.service.ProduceshiftorderService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.utils.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 HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @Autowired + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + @Autowired + DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); + @Autowired + TaskService taskserver = SpringContextHolder.getBean(TaskService.class); + @Autowired + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + @Autowired + AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class); + @Autowired + ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderService.class); + @Autowired + AgvService agvService = SpringContextHolder.getBean(AgvService.class); + + String container; + String container_type_desc; + String last_container_type_desc; + String last_container; + //放货准备锁 + String putReadyLock = null; + //有货标记 + protected boolean has_goods_tag = false; + + int mode = 0; + int move = 0; + int status = 0; + int finish = 0; + int all_ready = 0; + int order = 0; + int error = 0; + int task = 0; + int full_number = 0; + //出入库模式 + int operation_type = 0; + int last_mode = 0; + int last_status = 0; + int last_error = 0; + int last_move = 0; + int last_task = 0; + int last_all_ready = 0; + int last_order = 0; + int last_finish = 0; + int last_full_number = 0; + + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + + boolean hasVehicle = false; + boolean isReady = false; + protected int instruction_num = 0; + protected int instruction_num_truth = 0; + boolean isFold = false; + private String assemble_check_tag; + + 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 Date instruction_apply_time = new Date(); + private int instruction_require_time_out = 3000; + //请求成功标记 + Boolean requireSucess = false; + //申请指令成功标记 + Boolean applySucess = false; + String inst_message; + + private int instruction_finished_time_out; + + int branchProtocol = 0; + //备注 + String remark; + //数量 + String qty; + //物料 + String material; + //当前指令 + Instruction inst = null; + //上次指令 + Instruction last_inst = null; + + //触摸屏手动触发任务 + private Boolean is_has_task = false; + + //申请搬运任务 + private Boolean apply_handling = false; + //申请物料 + private Boolean apply_material = false; + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag = 0; + + int agvphase = 0; + int index = 0; + String device_code; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + this.signalIsException(this); + } catch (Exception var17) { + return; + } + + } + + + + + + public boolean exe_business() { + return true; + } + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + public void executing(int command, Instruction instruction, String appendMessage) { + + } + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + + public void writing(String key, String value) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + key; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, value); + ReadUtil.write(itemMap, server); + } + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); + if (lastNumber != nowNumber) { +// if (name.equals("mode")) { +// this.setRequireSucess(false); +// } + } + } + + public String isSatisfyCreateTask(){ + return null; + } + + public void method1(){} + public void method2(){} + +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/ItemProtocol.java new file mode 100644 index 0000000..141f421 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_full_station/ItemProtocol.java @@ -0,0 +1,110 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_full_station; + +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_move = "move"; + public static String item_status = "status"; + public static String item_finish = "finish"; + public static String item_all_ready = "all_ready"; + public static String item_order = "order"; + public static String item_error = "error"; + public static String item_task = "task"; + public static String item_full_number = "full_number"; + + public static String item_to_agv_ready = "to_agv_ready"; + + public static String item_to_agv_finish = "to_agv_finish"; + + private HailiangOldSpecialFullStationDeviceDriver driver; + + public ItemProtocol(HailiangOldSpecialFullStationDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMove() { + return this.getOpcIntegerValue(item_move); + } + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + public int getStatus() { + return this.getOpcIntegerValue(item_status); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getFinish() { return this.getOpcIntegerValue(item_finish);} + + public int getAll_Ready() { return this.getOpcIntegerValue(item_all_ready);} + + public int getOrder() { return this.getOpcIntegerValue(item_order);} + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + public int getFull_number() { + return this.getOpcIntegerValue(item_full_number); + } + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + //System.out.println(driver.getDevice_code()+":" + protocol+"数据同步异常"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_status, "线体状态", "V0.0", Boolean.valueOf(true))); + list.add(new ItemDto(item_mode, "线体开机状态", "V0.1")); + list.add(new ItemDto(item_finish, "空位完成", "V0.7")); + list.add(new ItemDto(item_move, "满料位光电信号", "V1.0")); + list.add(new ItemDto(item_all_ready, "所有设备就绪", "V1.6")); + list.add(new ItemDto(item_error, "报警信号", "VW8")); + list.add(new ItemDto(item_heartbeat, "心跳", "VW22")); + list.add(new ItemDto(item_task, "任务号", "VD40")); + list.add(new ItemDto(item_full_number, "出料口满框数量", "VD44")); + list.add(new ItemDto(item_order, "工单号", "VD72")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_agv_ready, "AGV满位就绪", "W112", Boolean.valueOf(true))); + list.add(new ItemDto(item_to_agv_finish, "AGV取货完成", "W114", Boolean.valueOf(true))); + return list; + } + +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/HailiangOldSpecialPickStationDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/HailiangOldSpecialPickStationDefination.java new file mode 100644 index 0000000..74123b4 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/HailiangOldSpecialPickStationDefination.java @@ -0,0 +1,61 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_pick_station; + +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 HailiangOldSpecialPickStationDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_old_special_pick_station"; + } + + @Override + public String getDriverName() { + return "海亮老车间-专机设备收料位"; + } + + @Override + public String getDriverDescription() { + return "海亮老车间-专机设备收料位"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangOldSpecialPickStationDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return HailiangOldSpecialPickStationDeviceDriver.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/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/HailiangOldSpecialPickStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/HailiangOldSpecialPickStationDeviceDriver.java new file mode 100644 index 0000000..0f66c6e --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/HailiangOldSpecialPickStationDeviceDriver.java @@ -0,0 +1,224 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_pick_station; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.config.server.AcsConfigService; +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.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.opc.WcsConfig; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.route.service.dto.RouteLineDto; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.system.util.CodeUtil; +import org.nl.utils.SpringContextHolder; +import org.nl.wql.core.bean.WQLObject; +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.List; +import java.util.Map; + +/** + * 海亮老车间专机设备接框位 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class HailiangOldSpecialPickStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @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 + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + @Autowired + AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class); + String container; + String container_type_desc; + String last_container_type_desc; + String last_container; + //放货准备锁 + String putReadyLock = null; + //有货标记 + protected boolean has_goods_tag = false; + + int mode = 0; + int status = 0; + int error = 0; + int task = 0; + int finish = 0; + int order = 0; + int full_number = 0; + //出入库模式 + int operation_type = 0; + int last_mode = 0; + int last_status = 0; + int last_error = 0; + int last_task = 0; + int last_finish = 0; + int last_order = 0; + int last_full_number = 0; + + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + + boolean hasVehicle = false; + boolean isReady = false; + protected int instruction_num = 0; + protected int instruction_num_truth = 0; + boolean isFold = false; + private String assemble_check_tag; + + 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 Date instruction_apply_time = new Date(); + private int instruction_require_time_out = 3000; + //请求成功标记 + Boolean requireSucess = false; + //申请指令成功标记 + Boolean applySucess = false; + String inst_message; + + private int instruction_finished_time_out; + + int branchProtocol = 0; + //备注 + String remark; + //数量 + String qty; + //物料 + String material; + //当前指令 + Instruction inst = null; + //上次指令 + Instruction last_inst = null; + + //触摸屏手动触发任务 + private Boolean is_has_task = false; + + //申请搬运任务 + private Boolean apply_handling = false; + //申请物料 + private Boolean apply_material = false; + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag = 0; + + String device_code; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + this.signalIsException(this); + } catch (Exception var17) { + return; + } + + + } + + + + + public boolean exe_business() { + return true; + } + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + public void executing(int command, Instruction instruction, String appendMessage) { + + } + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + public void writing(int command) {} + + public void writing(int command, int target, int task) { + + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + itemMap.put(to_target, target); + itemMap.put(to_task, task); + ReadUtil.write(itemMap, server); + } + + public void writing(String key, String value) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + key; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, value); + ReadUtil.write(itemMap, server); + } + + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); + if (lastNumber != nowNumber) { +// if (name.equals("mode")) { +// this.setRequireSucess(false); +// } + } + } + + public String isSatisfyCreateTask(){ + return null; + } + + public void method1(){} + public void method2(){} +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/ItemProtocol.java new file mode 100644 index 0000000..191d364 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pick_station/ItemProtocol.java @@ -0,0 +1,97 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_pick_station; + +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_finish = "finish"; + public static String item_order = "order"; + public static String item_error = "error"; + public static String item_full_number = "full_number"; + public static String item_task = "task"; + public static String item_status = "status"; + + public static String item_to_agv_ready = "to_agv_ready"; + + public static String item_to_agv_finish = "to_agv_finish"; + + + private HailiangOldSpecialPickStationDeviceDriver driver; + + public ItemProtocol(HailiangOldSpecialPickStationDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + public int getStatus() { + return this.getOpcIntegerValue(item_status); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getFinish() { return this.getOpcIntegerValue(item_finish);} + + public int getOrder() { return this.getOpcIntegerValue(item_order);} + + public int getFull_number() { return this.getOpcIntegerValue(item_full_number);} + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_status, "线体状态", "V0.0", Boolean.valueOf(true))); + list.add(new ItemDto(item_mode, "线体开机状态", "V0.1")); + list.add(new ItemDto(item_finish, "空位完成", "V0.7")); + list.add(new ItemDto(item_error, "报警信号", "VW8")); + list.add(new ItemDto(item_heartbeat, "心跳", "VW22")); + list.add(new ItemDto(item_task, "任务号", "VD40")); + list.add(new ItemDto(item_full_number, "出料口满框数量", "VD44")); + list.add(new ItemDto(item_order, "工单号", "VD72")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + return list; + } + +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/HailiangOldSpecialPourStationDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/HailiangOldSpecialPourStationDefination.java new file mode 100644 index 0000000..f9726a3 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/HailiangOldSpecialPourStationDefination.java @@ -0,0 +1,61 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_pour_station; + +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 HailiangOldSpecialPourStationDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_old_special_pour_station"; + } + + @Override + public String getDriverName() { + return "海亮老车间-专机设备倒料位"; + } + + @Override + public String getDriverDescription() { + return "海亮老车间-专机设备倒料位"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangOldSpecialPourStationDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return HailiangOldSpecialPourStationDeviceDriver.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/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/HailiangOldSpecialPourStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/HailiangOldSpecialPourStationDeviceDriver.java new file mode 100644 index 0000000..57d243b --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/HailiangOldSpecialPourStationDeviceDriver.java @@ -0,0 +1,212 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_pour_station; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.agv.server.AgvService; +import org.nl.acs.config.server.AcsConfigService; +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.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.utils.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 HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @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 + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + @Autowired + AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class); + @Autowired + AgvService agvService = SpringContextHolder.getBean(AgvService.class); + + + String container; + String container_type_desc; + String last_container_type_desc; + String last_container; + //放货准备锁 + String putReadyLock = null; + //有货标记 + protected boolean has_goods_tag = false; + private Date instruction_require_time = new Date(); + private int instruction_require_time_out = 3000; + int mode = 0; + int error = 0; + int task = 0; + int status = 0; + int running = 0; + int finish = 0; + int all_ready = 0; + int storage_stock_num = 0; + int line_stock_num = 0; + int order = 0; + int full_number = 0; + //出入库模式 + int operation_type = 0; + int last_mode = 0; + int last_error = 0; + int last_task = 0; + int last_status = 0; + int last_running = 0; + int last_finish = 0; + int last_all_ready = 0; + int last_storage_stock_num = 0; + int last_line_stock_num = 0; + int last_order = 0; + int last_full_number = 0; + + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + //请求成功标记 + Boolean requireSucess = false; + //申请指令成功标记 + Boolean applySucess = false; + String inst_message; + + private int instruction_finished_time_out; + private Date instruction_apply_time = new Date(); + int agvphase=0; + int index =0; + + int branchProtocol = 0; + //备注 + String remark; + //数量 + String qty; + //物料 + String material; + //当前指令 + Instruction inst = null; + //上次指令 + Instruction last_inst = null; + + //触摸屏手动触发任务 + private Boolean is_has_task = false; + + //申请搬运任务 + private Boolean apply_handling = false; + //申请物料 + private Boolean apply_material = false; + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag = 0; + + String device_code; + + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + this.signalIsException(this); + } catch (Exception var17) { + return; + } + } + + + public boolean exe_business() { + return true; + } + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + public void executing(int command, Instruction instruction, String appendMessage) { + + } + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + + public void writing(String key, String value) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + key; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, value); + ReadUtil.write(itemMap, server); + } + + public void writing(int command, int target, int task) { + + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + itemMap.put(to_target, target); + itemMap.put(to_task, task); + ReadUtil.write(itemMap, server); + } + + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); + if (lastNumber != nowNumber) { +// if (name.equals("mode")) { +// this.setRequireSucess(false); +// } + } + } + + public String isSatisfyCreateTask(){ + return null; + } + + public void method1(){} + public void method2(){} +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/ItemProtocol.java new file mode 100644 index 0000000..20db9b1 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_special_pour_station/ItemProtocol.java @@ -0,0 +1,109 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_special_pour_station; + +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_status = "status"; + public static String item_running = "running"; + public static String item_finish = "finish"; + public static String item_all_ready = "all_ready"; + public static String item_storage_stock_num = "storage_stock_num"; + public static String item_line_stock_num = "line_stock_num"; + public static String item_order = "order"; + public static String item_error = "error"; + public static String item_full_number = "full_number"; + public static String item_task = "task"; + + public static String item_to_pour_num = "to_item_pour_num"; + + private HailiangOldSpecialPourStationDeviceDriver driver; + + public ItemProtocol(HailiangOldSpecialPourStationDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getStatus() { + return this.getOpcIntegerValue(item_status); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getRunning() { return this.getOpcIntegerValue(item_running);} + + public int getFinish() { return this.getOpcIntegerValue(item_finish);} + + public int getAll_Ready() { return this.getOpcIntegerValue(item_all_ready);} + + public int getOrder() { return this.getOpcIntegerValue(item_order);} + + public int getFull_number() { return this.getOpcIntegerValue(item_full_number);} + public int getLine_stock_num() { return this.getOpcIntegerValue(item_line_stock_num);} + public int getStorage_stock_num() { return this.getOpcIntegerValue(item_storage_stock_num);} + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_status, "线体状态", "V0.0", Boolean.valueOf(true))); + list.add(new ItemDto(item_mode, "线体开机状态", "V0.1")); + list.add(new ItemDto(item_running, "空位运行", "V0.6")); + list.add(new ItemDto(item_all_ready, "所有设备就绪", "V1.6")); + list.add(new ItemDto(item_error, "报警信号", "VW8")); + list.add(new ItemDto(item_heartbeat, "心跳", "VW22")); + list.add(new ItemDto(item_task, "任务号", "VD40")); + list.add(new ItemDto(item_full_number, "出料口满框数量", "VD44")); + list.add(new ItemDto(item_storage_stock_num, "储料仓库存数量", "VD48")); + list.add(new ItemDto(item_line_stock_num, "线体库存数量", "VD52")); + list.add(new ItemDto(item_order, "工单号", "VD72")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_pour_num, "倒料数量", "VD144")); + return list; + } + +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/HailiangOldStackingManipulatorDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/HailiangOldStackingManipulatorDefination.java new file mode 100644 index 0000000..0f64775 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/HailiangOldStackingManipulatorDefination.java @@ -0,0 +1,60 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_stacking_manipulator; + +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 HailiangOldStackingManipulatorDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_old_stacking_manipulator"; + } + + @Override + public String getDriverName() { + return "海亮老车间-码垛机械手"; + } + + @Override + public String getDriverDescription() { + return "海亮老车间-码垛机械手"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangOldStackingManipulatorDriver()).setDevice(device).setDriverDefination(this); + } + + @Override + public Class getDeviceDriverType() { + return HailiangOldStackingManipulatorDriver.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/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/HailiangOldStackingManipulatorDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/HailiangOldStackingManipulatorDriver.java new file mode 100644 index 0000000..2f8f8a8 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/HailiangOldStackingManipulatorDriver.java @@ -0,0 +1,327 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_stacking_manipulator; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.config.server.AcsConfigService; +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.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.order.service.ProduceshiftorderService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.utils.SpringContextHolder; +import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; + +/** + * 海亮老车间码垛机械手 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class HailiangOldStackingManipulatorDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @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 + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + @Autowired + AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class); + @Autowired + ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderService.class); + + //心跳 + int heartbeat = 0; + int last_heartbeat = 0; + //模式 + int mode = 0; + int last_mode = 0; + //状态 + int status = 0; + int last_status = 0; + //动作 + int action = 0; + int last_action = 0; + //故障 + int error = 0; + int last_error = 0; + //当前抓取工位 + int getStation = 0; + int last_getStation = 0; + //当前码盘工位 + int putStation = 0; + int last_putStation = 0; + //码盘位当前码盘数量 + int encoder_qty = 0; + int last_encoder_qty = 0; + //箱型 + int boxtype = 0; + int last_boxtype = 0; + + //请求托盘信息成功标志 + Boolean vehicleInfoRequireSuccess = false; + //请求单次放置完成成功标志 + Boolean singlePlacementRequireSuccess = false; + //请求码垛完成标志 + Boolean stackingRequireSuccess = false; + + + + //当前设备状态 01代表 关机, 02代表 开机, 03代表 生产中, 04代表 待机, 05代表 异常 + int status_type = 0; + //上次设备状态 + int last_status_type = 0; + + //获取托盘信息请求时间 + private Date instruction_require_time = new Date(); + //单次放置请求完成时间 + private Date singlePlacementRequireTime = new Date(); + //码垛完成请求时间 + private Date stackingRequireTime = new Date(); + //请求超时时间 + private int instruction_require_time_out = 3000; + + //设备是否在线 + Boolean isonline = true; + //设备是否异常 + Boolean iserror = false; + //异常消息 + String message = null; + + String device_code; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public synchronized void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + this.signalIsException(this); + } catch (Exception var17) { + return; + } + } + + + //判断是否生成任务 如果生成任务返回执行该任务的方法名,如果不需要生成任务则返回null + public String isSatisfyCreateTask() { + return null; + } + + public void method1() { + + } + + public void method2() { + switch (action) { + case 1: + if (!vehicleInfoRequireSuccess){ + getVehicleInfo(); + } + break; + case 2: + if (!singlePlacementRequireSuccess){ + singlePlacementCompleted(); + } + break; + case 3: + if (!stackingRequireSuccess){ + stackingCompleted(); + } + break; + } + } + + //获取托盘信息 + public synchronized boolean getVehicleInfo() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + //获取机械手关联抓取工位/放货工位的设备信息 将读取kep抓取工位的值-1 作为对应设备编码所在的索引位置 + //抓取工位 + List getDeviceCodeList = this.getExtraDeviceCodes("link_get_device_code"); + //放货工位 + List putDeviceCodeList = this.getExtraDeviceCodes("link_put_device_code"); + //根据kep读取到的抓取工位的值 - 1 得到对应设备的下标,再根据下标获得对应设备的编码 + String getDeviceCode = getDeviceCodeList.get(getGetStation() - 1).replace("\"", ""); + //根据抓取工位获取托盘信息 + JSONObject map = new JSONObject(); + map.put("getStation", getDeviceCode); + JSONObject resp = acsToWmsService.getVehicle(map); + int code = Integer.parseInt(resp.getString("code")); + String message = resp.getString("message"); + String getStation = resp.getString("getStation"); + String putStation = resp.getString("putStation"); + String encoder_qty = resp.getString("encoder_qty"); + String boxtype = resp.getString("boxtype"); + if (code == 200) { + //根据获取托盘信息返回的结果 得到对应抓取工位/放货工位设备编码所在的索引位置 + int getIndex = putDeviceCodeList.indexOf(getStation); + int putIndex = putDeviceCodeList.indexOf(putStation); + //将的到的索引 + 1 写入kep中 + this.writing("to_feedback", "1"); + this.writing("to_getStation", String.valueOf(getIndex + 1)); + this.writing("to_putStation", String.valueOf(putIndex + 1)); + this.writing("to_boxtype", boxtype); + //获取托盘信息成功后 设为true 防止多次请求 等单次防止完成时设为false + this.setVehicleInfoRequireSuccess(true); + } else { + log.warn("获取托盘信息失败!设备号:{},原因{}", device_code,message); + } + } + return true; + } + + //单次放置完成 + public synchronized boolean singlePlacementCompleted() { + Date date = new Date(); + if (date.getTime() - this.singlePlacementRequireTime.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.singlePlacementRequireTime = date; + //获取机械手关联抓取工位/放货工位的设备信息 将读取kep抓取工位的值-1 作为对应设备编码所在的索引位置 + //抓取工位 + List getDeviceCodeList = this.getExtraDeviceCodes("link_get_device_code"); + //放货工位 + List putDeviceCodeList = this.getExtraDeviceCodes("link_put_device_code"); + //根据kep读取到的抓取工位的值 - 1 得到对应设备的下标,再根据下标获得对应设备的编码 + String getDeviceCode = getDeviceCodeList.get(getGetStation() - 1).replace("\"", ""); + //根据kep读取到的放货工位的值 - 1 得到对应设备的下标,再根据下标获得对应设备的编码 + String putDeviceCode = putDeviceCodeList.get(getPutStation() - 1).replace("\"", ""); + JSONObject map = new JSONObject(); + map.put("getStation", getDeviceCode); + map.put("putStation", putDeviceCode); + map.put("encoder_qty", getEncoder_qty()); + map.put("boxtype", getBoxtype()); + JSONObject resp = acsToWmsService.singlePlacementCompleted(map); + int code = Integer.parseInt(resp.getString("code")); + String message = resp.getString("message"); + JSONObject data = resp.getJSONObject("data"); + if (code == 200){ + this.writing("to_feedback","2"); + this.setSinglePlacementRequireSuccess(true); + } else { + log.warn("单次放置完成反馈失败!设备号:{},原因{}", device_code,message); + } + } + return true; + } + + //码垛完成 + public synchronized boolean stackingCompleted() { + Date date = new Date(); + if (date.getTime() - this.stackingRequireTime.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.stackingRequireTime = date; + //获取机械手关联放货工位的设备信息 将读取kep抓取工位的值-1 作为对应设备编码所在的索引位置 + //放货工位 + List putDeviceCodeList = this.getExtraDeviceCodes("link_put_device_code"); + //根据kep读取到的放货工位的值 - 1 得到对应设备的下标,再根据下标获得对应设备的编码 + String putDeviceCode = putDeviceCodeList.get(getPutStation() - 1).replace("\"", ""); + JSONObject map = new JSONObject(); + map.put("putStation", putDeviceCode); + map.put("encoder_qty", getEncoder_qty()); + map.put("boxtype", getBoxtype()); + JSONObject resp = acsToWmsService.stackingCompleted(map); + int code = Integer.parseInt(resp.getString("code")); + String message = resp.getString("message"); + JSONObject data = resp.getJSONObject("data"); + if (code == 200){ + this.writing("to_feedback","3"); + this.setStackingRequireSuccess(true); + } else { + log.warn("码垛完成反馈失败!设备号:{},原因{}", device_code,message); + } + } + return true; + } + + //将扩展表中的字符串数据转换成集合 + public List getExtraDeviceCodes(String extraName){ + String extraValue = (String) this.getDevice().getExtraValue().get(extraName); + String[] devices = extraValue.substring(1, extraValue.length() - 1).split(","); + List devicesList = Arrays.asList(devices); + return devicesList; + } + + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + + public void executing(int command, Instruction instruction, String appendMessage) { + + } + + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + //写入kep点位值 + 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; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + ReadUtil.write(itemMap, server); + } + + //判断当前点位值和上一次值是否一致 不一致写入日志并且复位请求成功标志 + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); + if (lastNumber != nowNumber) { + if (name.equals("action")) { + if (action == 1){ + this.setVehicleInfoRequireSuccess(false); + } else if (action == 2){ + this.setSinglePlacementRequireSuccess(false); + } else if (action == 3){ + this.setStackingRequireSuccess(false); + } + } + } + } + + public String toString() { + return ""; + } + +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/ItemProtocol.java new file mode 100644 index 0000000..cd60f79 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang_old/hailiang_old_stacking_manipulator/ItemProtocol.java @@ -0,0 +1,149 @@ +package org.nl.acs.device_driver.hailiang_old.hailiang_old_stacking_manipulator; + +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_status = "status"; + //动作 + public static String item_action = "action"; + //故障 + public static String item_error = "error"; + //当前抓取工位 + public static String item_getStation = "getStation"; + //当前码盘工位 + public static String item_putStation = "putStation"; + //码盘位当前码盘数量 + public static String item_encoder_qty= "encoder_qty"; + //箱型 + public static String item_boxtype= "boxtype"; + + //机器人动作反馈 + public static String item_to_feedback = "to_feedback"; + //故障 + public static String item_to_error = "to_error"; + //当前抓取工位 + public static String item_to_getStation = "to_getStation"; + //当前码盘 + public static String item_to_putStation = "to_putStation"; + //箱型 + public static String item_to_boxtype = "to_boxtype"; + + + + private HailiangOldStackingManipulatorDriver driver; + + public ItemProtocol(HailiangOldStackingManipulatorDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getStatus() { + return this.getOpcIntegerValue(item_status); + } + + public int getAction() { + return this.getOpcIntegerValue(item_action); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getGetStation() { + return this.getOpcIntegerValue(item_getStation); + } + + public int getPutStation() { + return this.getOpcIntegerValue(item_putStation); + } + + public int getEncoder_qty() { + return this.getOpcIntegerValue(item_encoder_qty); + } + + public int getBoxtype() { + return this.getOpcIntegerValue(item_boxtype); + } + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public static String getField_desc(String item) { + String field_desc = ""; + List readlist = getReadableItemDtos(); + List writelist = getWriteableItemDtos(); + for (int i = 0; i < readlist.size(); i++) { + ItemDto dto = readlist.get(i); +// if(){ +// +// } + } + return field_desc; + } + + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_heartbeat, "心跳", "DB602.W0")); + list.add(new ItemDto(item_mode, "工作模式", "DB602.W2")); + list.add(new ItemDto(item_status, "设备状态", "DB602.W4")); + list.add(new ItemDto(item_action, "动作", "DB602.W6")); + list.add(new ItemDto(item_error, "故障", "DB602.W8")); + list.add(new ItemDto(item_getStation, "当前抓取工位", "DB602.W10")); + list.add(new ItemDto(item_putStation, "当前码盘工位", "DB602.W12")); + list.add(new ItemDto(item_encoder_qty, "码盘位当前码盘数量", "DB602.W14")); + list.add(new ItemDto(item_boxtype, "箱型", "DB602.W16")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_feedback, "机器人动作反馈", "DB603.W2")); + list.add(new ItemDto(item_to_error, "故障", "DB603.W4")); + list.add(new ItemDto(item_to_getStation, "当前抓取工位", "DB603.W6")); + list.add(new ItemDto(item_to_putStation, "当前码盘工位", "DB603.W8")); + list.add(new ItemDto(item_to_boxtype, "箱型", "DB603.W10")); + return list; + } + + @Override + public String toString() { + return "ItemProtocol{}"; + } +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 526dbe7..daa5ae9 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -104,36 +104,36 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple hasGoods = this.getDevice().getHas_goods(); batch = this.getDevice().getBatch(); devicecode = this.getDeviceCode(); - if (branchProtocol != last_branchProtocol) { - requireSucess = false; - } - switch (branchProtocol) { - case 1: - break; - //呼叫请求 - case 2: - if (material.length() > 0 && Integer.parseInt(this.getQty()) > 0 && !requireSucess) { - } - break; - //响应生成任务 - case 3: - if (material.length() > 0 && qty.length() > 0 && purpose.length() > 0 && !requireSucess) { - this.instruction_require(material, qty, this.getRemark(), purpose); - } - break; - //自动创建任务 叫料 - case 4: - if (!requireSucess) { - autoCreateTask(); - } - break; - //搬运空车、空托 - case 5: - if (!requireSucess) { - autoCreateEmptyPallet(); - } - break; - } +// if (branchProtocol != last_branchProtocol) { +// requireSucess = false; +// } +// switch (branchProtocol) { +// case 1: +// break; +// //呼叫请求 +// case 2: +// if (material.length() > 0 && Integer.parseInt(this.getQty()) > 0 && !requireSucess) { +// } +// break; +// //响应生成任务 +// case 3: +// if (material.length() > 0 && qty.length() > 0 && purpose.length() > 0 && !requireSucess) { +// this.instruction_require(material, qty, this.getRemark(), purpose); +// } +// break; +// //自动创建任务 叫料 +// case 4: +// if (!requireSucess) { +// autoCreateTask(); +// } +// break; +// //搬运空车、空托 +// case 5: +// if (!requireSucess) { +// autoCreateEmptyPallet(); +// } +// break; +// } } public boolean instruction_require(String container_code) { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java index 124461c..79196cb 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java @@ -52,13 +52,6 @@ public class AcsToWmsController { return new ResponseEntity<>(acstowmsService.applyTaskManipulatorToWms(json), HttpStatus.OK); } - @PostMapping("/getVehicle") - @Log("获取托盘信息") - @ApiOperation("获取托盘信息") - public ResponseEntity getVehicle(@RequestBody JSONObject json) { - return new ResponseEntity<>(acstowmsService.getVehicle(json), HttpStatus.OK); - } - @PostMapping("/getVehicleTokiln") @Log("获取入窑托盘信息") @ApiOperation("获取入窑托盘信息") @@ -129,4 +122,25 @@ public class AcsToWmsController { public ResponseEntity feedbackDeviceStatus(@RequestBody String device_code, String code, String value) { return new ResponseEntity<>(acstowmsService.feedbackDeviceStatus(device_code, code, value), HttpStatus.OK); } + + @PostMapping("/getVehicleInfo") + @Log("获取托盘信息") + @ApiOperation("获取托盘信息") + public ResponseEntity getVehicle(@RequestBody JSONObject json) { + return new ResponseEntity<>(acstowmsService.getVehicle(json), HttpStatus.OK); + } + + @PostMapping("/singlePlacementCompleted") + @Log("单次放置完成") + @ApiOperation("单次放置完成") + public ResponseEntity singlePlacementCompleted(@RequestBody JSONObject param) { + return new ResponseEntity<>(acstowmsService.singlePlacementCompleted(param), HttpStatus.OK); + } + + @PostMapping("/stackingCompleted") + @Log("码垛完成") + @ApiOperation("码垛完成") + public ResponseEntity stackingCompleted(@RequestBody JSONObject param) { + return new ResponseEntity<>(acstowmsService.stackingCompleted(param), HttpStatus.OK); + } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index eb40bbc..a9516e9 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -158,4 +158,22 @@ public interface AcsToWmsService { HttpResponse queryDoorsStatus(); + /** + * 单次放置完成 + * + * @param + * @returna + */ + JSONObject singlePlacementCompleted(JSONObject param); + + /** + * 码垛完成 + * + * @param + * @returna + */ + JSONObject stackingCompleted(JSONObject param); + + + } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index cfedf7d..1289f37 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -310,31 +310,37 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public JSONObject getVehicle(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); - AddressDto addressDto = addressService.findByCode("getVehicle"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - log.info("getVehicle----请求参数{}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - log.info("getVehicle----返回参数{}", result.body()); - JSONObject jo = JSONObject.parseObject(result.body()); - return jo; - - } finally { - MDC.remove(log_file_type); - } + JSONObject map = new JSONObject(); + map.put("code",200); + map.put("message","成功"); + map.put("getStation","X001"); + map.put("putStation","L001"); + map.put("encoder_qty","1"); + map.put("boxtype","1"); + return map; +// try { +// MDC.put(log_file_type, log_type); +// String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); +// AddressDto addressDto = addressService.findByCode("getVehicle"); +// String methods_url = addressDto.getMethods_url(); +// String url = wmsurl + methods_url; +// log.info("getVehicle----获取托盘信息请求参数{}", json.toString()); +// HttpResponse result = null; +// try { +// result = HttpRequest.post(url) +// .header("Authorization", token) +// .body(String.valueOf(json)) +// .execute(); +// System.out.println(result); +// } catch (Exception e) { +// System.out.println(e.getMessage()); +// } +// log.info("getVehicle----获取托盘信息返回参数{}", result.body()); +// JSONObject jo = JSONObject.parseObject(result.body()); +// return jo; +// } finally { +// MDC.remove(log_file_type); +// } } @@ -933,4 +939,66 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } + @Override + public JSONObject singlePlacementCompleted(JSONObject param) { + JSONObject map = new JSONObject(); + map.put("code",200); + map.put("message","成功"); + map.put("data",null); + return map; +// try { +// MDC.put(log_file_type, log_type); +// String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); +// HttpResponse result = null; +// log.info("singlePlacementCompleted-----单次放置完成请求"); +// AddressDto addressDto = addressService.findByCode("singlePlacementCompleted"); +// String methods_url = addressDto.getMethods_url(); +// try { +// result = HttpRequest.get(wmsurl + methods_url) +// .body("") +// .execute(); +// log.info("singlePlacementCompleted-----单次放置完成输出参数{}", result.body().toString()); +// } catch (Exception e) { +// String msg = e.getMessage(); +// //网络不通 +// System.out.println(msg); +// } +// JSONObject jo = JSONObject.parseObject(result.body()); +// return jo; +// } finally { +// MDC.remove(log_file_type); +// } + } + + @Override + public JSONObject stackingCompleted(JSONObject param) { + JSONObject map = new JSONObject(); + map.put("code",200); + map.put("message","成功"); + map.put("data",null); + return map; +// try { +// MDC.put(log_file_type, log_type); +// String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); +// HttpResponse result = null; +// log.info("stackingCompleted-----码垛完成请求"); +// AddressDto addressDto = addressService.findByCode("stackingCompleted"); +// String methods_url = addressDto.getMethods_url(); +// try { +// result = HttpRequest.get(wmsurl + methods_url) +// .body("") +// .execute(); +// log.info("stackingCompleted-----码垛完成输出参数{}", result.body().toString()); +// } catch (Exception e) { +// String msg = e.getMessage(); +// //网络不通 +// System.out.println(msg); +// } +// JSONObject jo = JSONObject.parseObject(result.body()); +// return jo; +// } finally { +// MDC.remove(log_file_type); +// } + } + } diff --git a/acs/hd/nladmin-system/src/main/resources/config/application-dev.yml b/acs/hd/nladmin-system/src/main/resources/config/application-dev.yml index e17aff6..5df8714 100644 --- a/acs/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/acs/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -8,11 +8,11 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lnsh_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true -# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rljn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + #url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lnsh_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_acs_two}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} # password: ${DB_PWD:P@ssw0rd} - password: ${DB_PWD:Root.123456} + password: ${DB_PWD:password} # password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 diff --git a/acs/hd/nladmin-system/src/main/resources/logback-spring.xml b/acs/hd/nladmin-system/src/main/resources/logback-spring.xml index a61e494..2c74c2a 100644 --- a/acs/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/acs/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -35,7 +35,7 @@ https://juejin.cn/post/6844903775631572999 ${log.pattern} - ${log.charset} + UTF-8 diff --git a/acs/qd/.env.development b/acs/qd/.env.development index d3d2806..42ce1c5 100644 --- a/acs/qd/.env.development +++ b/acs/qd/.env.development @@ -1,7 +1,7 @@ ENV = 'development' # 接口地址 -VUE_APP_BASE_API = 'http://192.168.81.140:8010' +VUE_APP_BASE_API = 'http://127.0.0.1:8010' VUE_APP_WS_API = 'ws://127.0.0.1:8010' # 是否启用 babel-plugin-dynamic-import-node插件 diff --git a/acs/qd/src/views/acs/device/config.vue b/acs/qd/src/views/acs/device/config.vue index 2703f8d..e7a1259 100644 --- a/acs/qd/src/views/acs/device/config.vue +++ b/acs/qd/src/views/acs/device/config.vue @@ -46,6 +46,7 @@ v-model="form.driver_code" placeholder="" filterable + clearable @change="changeDriver" > + +
+ + +
+ 设备协议: +
+ + + + OpcServer: + + + + + + PLC: + + + + + + +
+ + +
+ 输送系统: +
+ + + + + + + + + +
+ + +
+ 指令相关: +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ AGV相关: +
+ + + + + + + + + + + + + + +
+ + +
+ PLC读取字段: +
+ + + + + + + + + + + + + + +
+ + +
+ PLC写入字段: +
+ + + + + + + + + + + + + + +
+ + +
+ + 保存 + +
+
+ +
+ + + + + diff --git a/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_device.vue b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_device.vue new file mode 100644 index 0000000..df7e676 --- /dev/null +++ b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_device.vue @@ -0,0 +1,463 @@ + + + + + diff --git a/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_empty_station.vue b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_empty_station.vue new file mode 100644 index 0000000..02a3e18 --- /dev/null +++ b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_empty_station.vue @@ -0,0 +1,443 @@ + + + + + diff --git a/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_full_station.vue b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_full_station.vue new file mode 100644 index 0000000..66122e1 --- /dev/null +++ b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_full_station.vue @@ -0,0 +1,460 @@ + + + + + diff --git a/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_pick_station.vue b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_pick_station.vue new file mode 100644 index 0000000..1361559 --- /dev/null +++ b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_pick_station.vue @@ -0,0 +1,449 @@ + + + + + diff --git a/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_pour_station.vue b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_pour_station.vue new file mode 100644 index 0000000..1def2f5 --- /dev/null +++ b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_special_pour_station.vue @@ -0,0 +1,455 @@ + + + + + diff --git a/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_stacking_manipulator.vue b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_stacking_manipulator.vue new file mode 100644 index 0000000..50d1567 --- /dev/null +++ b/acs/qd/src/views/acs/device/driver/hailiang_old/hailiang_old_stacking_manipulator.vue @@ -0,0 +1,490 @@ + + + + + diff --git a/acs/qd/src/views/acs/device/index.vue b/acs/qd/src/views/acs/device/index.vue index daafed9..ceb1251 100644 --- a/acs/qd/src/views/acs/device/index.vue +++ b/acs/qd/src/views/acs/device/index.vue @@ -90,8 +90,8 @@ /> - - + + @@ -196,7 +196,8 @@ const defaultForm = { region_type: null, region: null, is_config: null, - remark: null + remark: null, + seq_num: 1 } export default { name: 'Device', diff --git a/acs/qd/src/views/acs/device/opc/index.vue b/acs/qd/src/views/acs/device/opc/index.vue index 1afca03..81d455f 100644 --- a/acs/qd/src/views/acs/device/opc/index.vue +++ b/acs/qd/src/views/acs/device/opc/index.vue @@ -35,14 +35,14 @@ - + - + 详情 - + @@ -51,7 +51,7 @@ - + diff --git a/acs/qd/src/views/acs/device/protocol/index.vue b/acs/qd/src/views/acs/device/protocol/index.vue index ee4352b..d2bf550 100644 --- a/acs/qd/src/views/acs/device/protocol/index.vue +++ b/acs/qd/src/views/acs/device/protocol/index.vue @@ -57,6 +57,17 @@ > 导出CSV + + 导出SMARTCSV + { + downloadFile(result, crud.title + '数据', 'csv') + this.downLoadcsvLoadingSmart = false + }).catch(() => { + this.downLoadcsvLoadingSmart = false + }) + }, // 钩子:在获取表格数据之前执行,false 则代表不获取数据 [CRUD.HOOK.beforeRefresh]() { return true diff --git a/acs/qd/src/views/acs/task/index.vue b/acs/qd/src/views/acs/task/index.vue index c986dda..a4e39f4 100644 --- a/acs/qd/src/views/acs/task/index.vue +++ b/acs/qd/src/views/acs/task/index.vue @@ -121,7 +121,7 @@ /> - + - + - + - + - + - +