diff --git a/acs/nladmin-system/pom.xml b/acs/nladmin-system/pom.xml
index aa9a18954..32af48f4c 100644
--- a/acs/nladmin-system/pom.xml
+++ b/acs/nladmin-system/pom.xml
@@ -40,11 +40,11 @@
jansi
1.9
-
+
org.apache.commons
@@ -90,6 +90,12 @@
org.openscada.utgard
org.openscada.opc.lib
1.5.0
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
com.squareup.okhttp3
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java
new file mode 100644
index 000000000..48c33ca87
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java
@@ -0,0 +1,408 @@
+package org.nl.acs.device_driver.basedriver.casing_station;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.nl.acs.agv.server.AgvService;
+import org.nl.acs.device.service.DeviceService;
+import org.nl.acs.device_driver.DeviceDriver;
+import org.nl.acs.device_driver.RouteableDeviceDriver;
+import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
+import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
+import org.nl.acs.ext.wms.data.ApplyPaperActionRequest;
+import org.nl.acs.ext.wms.data.ApplyPaperActionResponse;
+import org.nl.acs.ext.wms.service.AcsToWmsService;
+import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
+import org.nl.acs.history.ErrorUtil;
+import org.nl.acs.history.service.DeviceErrorLogService;
+import org.nl.acs.history.service.dto.DeviceErrorLogDto;
+import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
+import org.nl.acs.instruction.service.InstructionService;
+import org.nl.acs.instruction.service.dto.Instruction;
+import org.nl.acs.log.service.DeviceExecuteLogService;
+import org.nl.acs.monitor.DeviceStageMonitor;
+import org.nl.acs.opc.Device;
+import org.nl.acs.opc.DeviceAppService;
+import org.nl.acs.route.service.RouteLineService;
+import org.nl.acs.task.service.TaskService;
+import org.nl.acs.task.service.dto.TaskDto;
+import org.nl.modules.system.service.ParamService;
+import org.nl.modules.wql.util.SpringContextHolder;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.*;
+
+/**
+ * 套管工位
+ */
+@Slf4j
+@Data
+@RequiredArgsConstructor
+public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
+ 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
+ ParamService paramService = SpringContextHolder.getBean(ParamService.class);
+ @Autowired
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
+ @Autowired
+ AgvService agvService = SpringContextHolder.getBean(AgvService.class);
+ @Autowired
+ DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
+
+ private Date instruction_update_time = new Date();
+ private Date require_apply_casing_time = new Date();
+ private int instruction_update_time_out = 500;
+ 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;
+
+ //心跳
+ int heartbeat = 0;
+ int last_heartbeat = 0;
+ //工作模式
+ int mode = 0;
+ int last_mode = 0;
+ //光电信号
+ int move = 0;
+ int last_move = 0;
+ //托盘方向
+ int carrier_direction = 0;
+ int last_carrier_direction = 0;
+ //报警
+ int error = 0;
+ int last_error = 0;
+ //任务号
+ int task = 0;
+ int last_task = 0;
+
+ String material1 = null;
+ String last_material1 = null;
+
+ String material2 = null;
+ String last_material2 = null;
+
+
+ //下发命令
+ int to_command = 0;
+ int last_to_command = 0;
+
+ //当前指令
+ Instruction inst = null;
+
+ Boolean isonline = true;
+
+ Boolean iserror = false;
+ //请求成功标记
+ Boolean requireSucess = false;
+
+ String message = null;
+ String device_code;
+
+
+ @Override
+ public Device getDevice() {
+ return this.device;
+ }
+
+ @Override
+ public void execute() {
+ try {
+ String message = null;
+ device_code = this.getDeviceCode();
+ heartbeat = this.itemProtocol.getHeartbeat();
+ mode = this.itemProtocol.getMode();
+ move = this.itemProtocol.getMove();
+ carrier_direction = this.itemProtocol.getCarrier_direction();
+ error = this.itemProtocol.getError();
+ task = this.itemProtocol.getTask();
+ material1 = this.itemProtocol.getMaterial1();
+ material2 = this.itemProtocol.getMaterial2();
+
+ to_command = this.itemProtocol.getTo_command();
+
+
+ if (to_command != last_to_command) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command);
+ }
+ if (!material1.equals(last_material1)) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号material1:" + last_material1 + "->" + material1);
+ }
+ if (!material2.equals(last_material2)) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号material2:" + last_material2 + "->" + material2);
+ }
+
+ if (carrier_direction != last_carrier_direction) {
+ logServer.deviceItemValue(this.device_code, "carrier_direction", String.valueOf(carrier_direction));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction:" + last_carrier_direction + "->" + carrier_direction);
+ }
+ if (task != last_task) {
+ logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
+ }
+ if (error != last_error) {
+ if (error != 0) {
+ DeviceErrorLogDto dto = new DeviceErrorLogDto();
+ dto.setDevice_code(device_code);
+ dto.setError_code(String.valueOf(error));
+ String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
+ dto.setError_info(errorInfo);
+ deviceErrorLogService.create(dto);
+ }
+ logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
+ }
+ if (mode != last_mode) {
+ JSONObject param = new JSONObject();
+ param.put("device_code", this.device_code);
+ param.put("mode", Math.min(mode, 3));
+ param.put("device_name", this.getDevice().getDevice_name());
+ param.put("device_type", "1");
+ param.put("product_area", paramService.findByCode("productArea").getValue());
+ acsToWmsService.sendDeviceStatus(param);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
+ }
+ if (move != last_move) {
+ logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
+ }
+
+ if (move != 0 && task > 1) {
+ update_instruction_status();
+ }
+
+ } catch (Exception var17) {
+ var17.printStackTrace();
+ logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
+ }
+
+ if (mode == 0) {
+ this.setIsonline(false);
+ message = "未联机";
+ } else if (error != 0) {
+ this.setIserror(true);
+ message = "有报警";
+ } else {
+ this.setIsonline(true);
+ this.setIserror(false);
+ message = "";
+ Instruction instruction = null;
+ List toInstructions;
+
+ //纸管库申请任务
+ switch (mode) {
+ case 1:
+ log.debug("弃用(留作兼容)");
+ break;
+ case 2:
+ //申请任务
+ /*if (move > 0 && !requireSucess) {
+ instruction_require();
+ }*/
+ break;
+ case 3:
+ log.info("运行中");
+ break;
+ default:
+ if (move == 1 && !requireSucess) {
+ //申请套管校验
+ apply_for_casing_inspection(material1, material2);
+ }
+ break;
+ }
+ }
+ last_heartbeat = heartbeat;
+ last_mode = mode;
+ last_move = move;
+ last_error = error;
+ last_carrier_direction = carrier_direction;
+ last_task = task;
+ last_material1 = material1;
+ last_material2 = material2;
+ last_to_command = to_command;
+ }
+
+
+ /**
+ * 更新指令状态
+ */
+ public synchronized void update_instruction_status() throws Exception {
+ Date date = new Date();
+ if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
+
+ } else {
+ this.instruction_update_time = date;
+ inst = checkInst();
+ if (inst != null) {
+ if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
+ inst.setInstruction_status("1");
+ inst.setExecute_device_code(this.device_code);
+ instructionService.update(inst);
+ logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
+ }
+ if (StrUtil.equals(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0")) {
+ if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
+ inst.setExecute_device_code(this.device_code);
+ finish_instruction();
+ logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * 申请套管校验
+ */
+ public synchronized void apply_for_casing_inspection(String material1, String material2) {
+ Date date = new Date();
+ if (date.getTime() - this.require_apply_casing_time.getTime() < (long) this.instruction_require_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
+ } else {
+ this.require_apply_casing_time = date;
+ ApplyPaperActionRequest applyPaperActionRequest = new ApplyPaperActionRequest();
+ applyPaperActionRequest.setDevice_code(this.device_code);
+ applyPaperActionRequest.setType("2");
+ applyPaperActionRequest.setTask_code(String.valueOf(task));
+ //获取出库顺序
+ applyPaperActionRequest.setMaterial1(material1);
+ applyPaperActionRequest.setMaterial2(material2);
+ ApplyPaperActionResponse applyPaperActionResponse = acsToWmsService.applyPaperActionRequest(applyPaperActionRequest);
+ Map map = new HashMap();
+ if (applyPaperActionResponse.getstatus() == 200) {
+ map.put("code", "to_command");
+ map.put("value", "4");
+ this.writing(map);
+ requireSucess = true;
+ logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPaperActionResponse);
+ message = "申请套管成功";
+ } else {
+ message = applyPaperActionResponse.getMessage();
+ map.put("code", "to_command");
+ map.put("value", "5");
+ this.writing(map);
+ requireSucess = false;
+ message = "纸管不匹配";
+ logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPaperActionResponse);
+ }
+ }
+ }
+
+
+ /**
+ * 申请任务
+ */
+ public synchronized void instruction_require() {
+ 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;
+ } else {
+ //没有就绪状态的任务,查询就绪状态的指令
+ TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code);
+ Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
+ if (ObjectUtil.isNull(taskdto) && ObjectUtil.isNotNull(inst)) {
+
+ }
+ }
+ }
+
+ /**
+ * 完成指令
+ *
+ * @return
+ * @throws Exception
+ */
+ public synchronized boolean finish_instruction() throws Exception {
+ instructionService.finish(inst);
+ return true;
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ return null;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
+
+ public void writing(List list) {
+ Map itemMap = new HashMap();
+ for (int i = 0; i < list.size(); i++) {
+ Object ob = list.get(i);
+ JSONObject json = (JSONObject) JSONObject.toJSON(ob);
+ if (!StrUtil.isEmpty(json.getString("value"))) {
+ String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ + "." + json.getString("code");
+ itemMap.put(to_param, json.getString("value"));
+ }
+ }
+ logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
+ try {
+ this.checkcontrol(itemMap);
+ } catch (Exception e) {
+ e.printStackTrace();
+ try {
+ this.checkcontrol(itemMap);
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ public void writing(Map map) {
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
+ Map itemMap = new LinkedHashMap<>();
+ map.forEach((key, value) -> {
+ if (ObjectUtil.isNotEmpty(value)) {
+ itemMap.put(getToParam() + key, value);
+ }
+ });
+ if (ObjectUtil.isNotEmpty(itemMap)) {
+ this.control(itemMap);
+ logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
+ }
+ }
+
+ public String getToParam() {
+ return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
+ }
+
+ public Instruction checkInst() {
+ if (ObjectUtil.isNotEmpty(this.inst)) {
+ if (this.task > 0) {
+ if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
+ return this.inst;
+ } else {
+ inst = instructionService.findByCodeFromCache(String.valueOf(task));
+ return inst;
+ }
+ }
+ } else {
+ inst = instructionService.findByCodeFromCache(String.valueOf(task));
+ return inst;
+ }
+ return null;
+ }
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationDefination.java
new file mode 100644
index 000000000..158e279d5
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationDefination.java
@@ -0,0 +1,59 @@
+package org.nl.acs.device_driver.basedriver.casing_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 CasingStationDefination implements OpcDeviceDriverDefination {
+ @Override
+ public String getDriverCode() {
+ return "casing_station";
+ }
+
+ @Override
+ public String getDriverName() {
+ return "套管工位";
+ }
+
+ @Override
+ public String getDriverDescription() {
+ return "套管工位";
+ }
+
+ @Override
+ public DeviceDriver getDriverInstance(Device device) {
+ return (new CasingStationConveyorDeviceDriver().setDevice(device).setDriverDefination(this));
+ }
+
+ @Override
+ public Class extends DeviceDriver> getDeviceDriverType() {
+ return CasingStationConveyorDeviceDriver.class;
+ }
+
+ @Override
+ public List getFitDeviceTypes() {
+ List types = new LinkedList();
+ types.add(DeviceType.conveyor);
+ return types;
+ }
+
+ @Override
+ public List getReadableItemDtos() {
+ return ItemProtocol.getReadableItemDtos();
+ }
+
+ @Override
+ public List getWriteableItemDtos() {
+ return ItemProtocol.getWriteableItemDtos();
+ }
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java
new file mode 100644
index 000000000..feb67bc19
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/ItemProtocol.java
@@ -0,0 +1,125 @@
+package org.nl.acs.device_driver.basedriver.casing_station;
+
+import cn.hutool.core.util.StrUtil;
+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_carrier_direction = "carrier_direction";
+ //报警
+ public static String item_error = "error";
+ //任务号
+ public static String item_task = "task";
+ //物料1
+ public static String item_material1 = "material1";
+ //物料2
+ public static String item_material2 = "material2";
+
+ //下发命令
+ public static String item_to_command = "to_command";
+
+ public ItemProtocol(CasingStationConveyorDeviceDriver 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 getCarrier_direction() {
+ return this.getOpcIntegerValue(item_carrier_direction);
+ }
+
+ public int getError() {
+ return this.getOpcIntegerValue(item_error);
+ }
+
+ public int getTask() {
+ return this.getOpcIntegerValue(item_task);
+ }
+
+ public String getMaterial1() {
+ return this.getOpcStringValue(item_material1);
+ }
+
+ public String getMaterial2() {
+ return this.getOpcStringValue(item_material2);
+ }
+
+ public int getTo_command() {
+ return this.getOpcIntegerValue(item_to_command);
+ }
+
+ Boolean isonline;
+
+ private CasingStationConveyorDeviceDriver driver;
+
+ public int getOpcIntegerValue(String protocol) {
+ Integer value = this.driver.getIntegeregerValue(protocol);
+ if (value == null) {
+ setIsonline(false);
+ } else {
+ setIsonline(true);
+ return value;
+ }
+ return 0;
+
+ }
+
+ public String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (StrUtil.isBlank(value)) {
+
+ } else {
+ return value;
+ }
+ return "0";
+ }
+
+ public static List getReadableItemDtos() {
+ ArrayList list = new ArrayList();
+ list.add(new ItemDto(item_heartbeat, "心跳", "DB101.W0"));
+ list.add(new ItemDto(item_mode, "工作模式", "DB101.W2"));
+ list.add(new ItemDto(item_move, "光电信号", "DB101.W3"));
+ list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.W4"));
+ list.add(new ItemDto(item_error, "报警", "DB101.W58"));
+ list.add(new ItemDto(item_task, "任务号", "DB101.W6"));
+ list.add(new ItemDto(item_material1, "物料1", "DB101.W7"));
+ list.add(new ItemDto(item_material2, "物料1", "DB101.W8"));
+ return list;
+ }
+
+ public static List getWriteableItemDtos() {
+ ArrayList list = new ArrayList();
+ list.add(new ItemDto(item_to_command, "下发命令", "DB102.W4"));
+ return list;
+ }
+
+ @Override
+ public String toString() {
+ return "";
+ }
+
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java
index 745870ba0..c9a4b4fb0 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java
@@ -383,7 +383,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
//存在行架->暂存的AGV任务 需要过滤
// 6 行架任务 8烘箱任务
- if(!StrUtil.equals(taskDto.getTask_type(),"6") || StrUtil.equals(taskDto.getTask_type(),"8")){
+ if(!StrUtil.equals(taskDto.getTask_type(),"6") && !StrUtil.equals(taskDto.getTask_type(),"8")){
taskDto = null;
continue;
}
@@ -478,7 +478,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
taskDtoList = this.sortTask(taskDtoList);
task = taskDtoList.get(j);
// 6 行架任务 8烘箱任务
- if(!StrUtil.equals(task.getTask_type(),"6") || StrUtil.equals(task.getTask_type(),"8")){
+ if(!StrUtil.equals(task.getTask_type(),"6") && !StrUtil.equals(task.getTask_type(),"8")){
task = null;
continue;
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java
index fdabd5ac7..dd690e4e8 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/ItemProtocol.java
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
+import org.nl.acs.device_driver.basedriver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
import java.util.ArrayList;
import java.util.List;
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java
index 07e25a1dc..e0b5f3136 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device/PaperTubeConveyorDeviceDriver.java
@@ -123,7 +123,7 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
}
if (out_finish != last_out_finish) {
if(out_finish == 1){
- this.writing(0);
+ //this.writing(0);
this.writing("to_target","0");
this.writing("to_out_qty","0");
@@ -197,7 +197,7 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
itemMap.put(to_param, Integer.parseInt(param));
// itemMap.put(to_param, Integer.parseInt(value));
- this.control(itemMap);
+ //this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + param);
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/ItemProtocol.java
new file mode 100644
index 000000000..8a14a2ad5
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/ItemProtocol.java
@@ -0,0 +1,321 @@
+package org.nl.acs.device_driver.basedriver.paper_tube_device2;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONUtil;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.formula.functions.T;
+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_carrier_direction = "carrier_direction";
+ //报警
+ public static String item_error = "error";
+ //任务号
+ public static String item_task = "task";
+ //出库顺序数组
+ public static String item_out_seq_arr = "out_seq_arr";
+ //出库数量数组
+ public static String item_out_qty_arr = "out_qty_arr";
+ //物料1
+ public static String item_material1 = "material1";
+ //物料2
+ public static String item_material2 = "material2";
+ //物料3
+ public static String item_material3 = "material3";
+ //物料4
+ public static String item_material4 = "material4";
+ //物料5
+ public static String item_material5 = "material5";
+ //物料6
+ public static String item_material6 = "material6";
+ //物料7
+ public static String item_material7 = "material7";
+ //物料8
+ public static String item_material8 = "material8";
+ //物料9
+ public static String item_material9 = "material9";
+ //物料10
+ public static String item_material10 = "material10";
+ //物料11
+ public static String item_material11 = "material11";
+ //物料12
+ public static String item_material12 = "material12";
+ //数量1
+ public static String item_qty1 = "qty1";
+ //数量2
+ public static String item_qty2 = "qty2";
+ //数量3
+ public static String item_qty3 = "qty3";
+ //数量4
+ public static String item_qty4 = "qty4";
+ //数量5
+ public static String item_qty5 = "qty5";
+ //数量6
+ public static String item_qty6 = "qty6";
+ //数量7
+ public static String item_qty7 = "qty7";
+ //数量8
+ public static String item_qty8 = "qty8";
+ //数量9
+ public static String item_qty9 = "qty9";
+ //数量10
+ public static String item_qty10 = "qty10";
+ //数量11
+ public static String item_qty11 = "qty11";
+ //数量12
+ public static String item_qty12 = "qty12";
+
+
+ //下发命令
+ public static String item_to_command = "to_command";
+ //下发目标站
+ public static String item_to_target = "to_target";
+ //下发任务号
+ public static String item_to_task = "to_task";
+ public static String item_to_material1 = "to_material1";
+ public static String item_to_out_qty1 = "to_out_qty1";
+ public static String item_to_seq1 = "to_seq1";
+ public static String item_to_position1 = "to_position1";
+
+ public static String item_to_material2 = "to_material2";
+ public static String item_to_out_qty2 = "to_out_qty2";
+ public static String item_to_seq2 = "to_seq2";
+ public static String item_to_position2 = "to_position2";
+
+ public static String item_to_material3 = "to_material3";
+ public static String item_to_out_qty3 = "to_out_qty3";
+ public static String item_to_seq3 = "to_seq3";
+ public static String item_to_position3 = "to_position3";
+
+
+ private PaperTubeConveyor2DeviceDriver driver;
+
+ public ItemProtocol(PaperTubeConveyor2DeviceDriver 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 getCarrier_direction() {
+ return this.getOpcIntegerValue(item_carrier_direction);
+ }
+
+ public int getError() {
+ return this.getOpcIntegerValue(item_error);
+ }
+
+ public int getTask() {
+ return this.getOpcIntegerValue(item_task);
+ }
+
+ public int getTo_task() {
+ return this.getOpcIntegerValue(item_to_task);
+ }
+
+ public String getItem_out_seq_arr() {
+ return this.getOpcStringValue(item_out_seq_arr);
+ }
+
+ public List getItem_out_seq_arr1() {
+ return this.getOpcArrayValue1(item_out_seq_arr);
+ }
+
+ public int[] getItem_out_qty_arr() {
+ return this.getOpcArrayValue(item_out_qty_arr);
+ }
+
+
+
+ public String getMaterial1() {
+ return this.getOpcStringValue(item_material1);
+ }
+
+ public String getMaterial2() {
+ return this.getOpcStringValue(item_material2);
+ }
+
+ public String getMaterial3() {
+ return this.getOpcStringValue(item_material3);
+ }
+
+ public String getMaterial4() {
+ return this.getOpcStringValue(item_material4);
+ }
+
+ public String getMaterial5() {
+ return this.getOpcStringValue(item_material5);
+ }
+
+ public String getMaterial6() {
+ return this.getOpcStringValue(item_material6);
+ }
+
+ public String getMaterial7() {
+ return this.getOpcStringValue(item_material7);
+ }
+
+ public String getMaterial8() {
+ return this.getOpcStringValue(item_material8);
+ }
+
+ public String getMaterial9() {
+ return this.getOpcStringValue(item_material9);
+ }
+
+ public String getMaterial10() {
+ return this.getOpcStringValue(item_material10);
+ }
+
+ public String getMaterial11() {
+ return this.getOpcStringValue(item_material11);
+ }
+
+ public String getMaterial12() {
+ return this.getOpcStringValue(item_material12);
+ }
+
+
+ public int getTotarget() {
+ return this.getOpcIntegerValue(item_to_target);
+ }
+
+ public int getTo_command() {
+ return this.getOpcIntegerValue(item_to_command);
+ }
+
+ 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 String getOpcStringValue(String protocol) {
+ String value = this.driver.getStringValue(protocol);
+ if (StrUtil.isBlank(value)) {
+
+ } else {
+ return value;
+ }
+ return "0";
+ }
+
+ public int[] getOpcArrayValue(String protocol) {
+ int[] arrayValue = this.driver.getIntegeregerArrayValue(protocol);
+ if (ObjectUtil.isNull(arrayValue)) {
+
+ } else {
+ return arrayValue;
+ }
+ return new int[3];
+ }
+
+ public List getOpcArrayValue1(String protocol) {
+ List arrayValue = this.driver.getArrayValue(protocol);
+ if (ObjectUtil.isNull(arrayValue)) {
+
+ } else {
+ return arrayValue;
+ }
+ return new ArrayList();
+ }
+
+
+ public static List getReadableItemDtos() {
+ ArrayList list = new ArrayList();
+ list.add(new ItemDto(item_heartbeat, "心跳", "DB101.W0"));
+ list.add(new ItemDto(item_mode, "工作模式", "DB101.W2"));
+ list.add(new ItemDto(item_move, "光电信号", "DB101.W3"));
+ list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.W4"));
+ list.add(new ItemDto(item_error, "报警", "DB101.W58"));
+ list.add(new ItemDto(item_task, "任务号", "DB101.W68"));
+ list.add(new ItemDto(item_out_seq_arr, "出库顺序数组", "DB101.W5"));
+ list.add(new ItemDto(item_out_qty_arr, "出库数量数组", "DB101.W6"));
+ list.add(new ItemDto(item_material1, "物料1", "DB101.W7"));
+ list.add(new ItemDto(item_qty1, "数量1", "DB101.W19"));
+ list.add(new ItemDto(item_material2, "物料2", "DB101.W8"));
+ list.add(new ItemDto(item_qty2, "数量2", "DB101.W20"));
+ list.add(new ItemDto(item_material3, "物料3", "DB101.W9"));
+ list.add(new ItemDto(item_qty3, "数量3", "DB101.W21"));
+ list.add(new ItemDto(item_material4, "物料4", "DB101.W10"));
+ list.add(new ItemDto(item_qty4, "数量4", "DB101.W22"));
+ list.add(new ItemDto(item_material5, "物料5", "DB101.W11"));
+ list.add(new ItemDto(item_qty5, "数量5", "DB101.W23"));
+ list.add(new ItemDto(item_material6, "物料6", "DB101.W12"));
+ list.add(new ItemDto(item_qty6, "数量6", "DB101.W24"));
+ list.add(new ItemDto(item_material7, "物料7", "DB101.W13"));
+ list.add(new ItemDto(item_qty7, "数量7", "DB101.W25"));
+ list.add(new ItemDto(item_material8, "物料8", "DB101.W14"));
+ list.add(new ItemDto(item_qty8, "数量8", "DB101.W26"));
+ list.add(new ItemDto(item_material9, "物料9", "DB101.W15"));
+ list.add(new ItemDto(item_qty9, "数量9", "DB101.W27"));
+ list.add(new ItemDto(item_material10, "物料10", "DB101.W16"));
+ list.add(new ItemDto(item_qty10, "数量10", "DB101.W28"));
+ list.add(new ItemDto(item_material11, "物料11", "DB101.W17"));
+ list.add(new ItemDto(item_qty11, "数量11", "DB101.W29"));
+ list.add(new ItemDto(item_material12, "物料12", "DB101.W18"));
+ list.add(new ItemDto(item_qty12, "数量12", "DB101.W30"));
+ return list;
+ }
+
+ public static List getWriteableItemDtos() {
+ ArrayList list = new ArrayList();
+ list.add(new ItemDto(item_to_target , "下发仓位号", "DB102.W2"));
+ list.add(new ItemDto(item_to_command, "下发命令", "DB102.W4"));
+ list.add(new ItemDto(item_to_task, "下发任务号", "DB102.W1"));
+ list.add(new ItemDto(item_to_material1, "下发物料1", "DB102.W3"));
+ list.add(new ItemDto(item_to_out_qty1, "下发物料1数量", "DB102.W7"));
+ list.add(new ItemDto(item_to_seq1, "出库顺序1", "DB102.W10"));
+ list.add(new ItemDto(item_to_position1, "仓位1", "DB102.W13"));
+ list.add(new ItemDto(item_to_material2, "下发物料2", "DB102.W5"));
+ list.add(new ItemDto(item_to_out_qty2, "下发物料2数量", "DB102.W8"));
+ list.add(new ItemDto(item_to_seq2, "出库顺序2", "DB102.W11"));
+ list.add(new ItemDto(item_to_position2, "仓位2", "DB102.W14"));
+ list.add(new ItemDto(item_to_material3, "下发物料3", "DB102.W6"));
+ list.add(new ItemDto(item_to_out_qty3, "下发物料3数量", "DB102.W9"));
+ list.add(new ItemDto(item_to_seq3, "出库顺序3", "DB102.W12"));
+ list.add(new ItemDto(item_to_position3, "仓位3", "DB102.W15"));
+ return list;
+ }
+
+ @Override
+ public String toString() {
+ return "";
+ }
+
+}
+
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/Paper.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/Paper.java
new file mode 100644
index 000000000..e088a576e
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/Paper.java
@@ -0,0 +1,19 @@
+package org.nl.acs.device_driver.basedriver.paper_tube_device2;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Paper implements Serializable {
+ //设备号
+ private String device_code;
+ //
+ private String meterial_code;
+ private String qty;
+
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2Defination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2Defination.java
new file mode 100644
index 000000000..5ae32d885
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2Defination.java
@@ -0,0 +1,61 @@
+package org.nl.acs.device_driver.basedriver.paper_tube_device2;
+
+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 PaperTubeConveyor2Defination implements OpcDeviceDriverDefination {
+ @Override
+ public String getDriverCode() {
+ return "paper_tube_conveyor2";
+ }
+
+ @Override
+ public String getDriverName() {
+ return "纸管库2";
+ }
+
+ @Override
+ public String getDriverDescription() {
+ return "纸管库2";
+ }
+
+ @Override
+ public DeviceDriver getDriverInstance(Device device) {
+ return (new PaperTubeConveyor2DeviceDriver()).setDevice(device).setDriverDefination(this);
+
+ }
+
+ @Override
+ public Class extends DeviceDriver> getDeviceDriverType() {
+ return PaperTubeConveyor2DeviceDriver.class;
+ }
+
+ @Override
+ public List getFitDeviceTypes() {
+ List types = new LinkedList();
+ types.add(DeviceType.conveyor);
+ return types;
+ }
+
+ @Override
+ public List getReadableItemDtos() {
+ return ItemProtocol.getReadableItemDtos();
+ }
+
+ @Override
+ public List getWriteableItemDtos() {
+ return ItemProtocol.getWriteableItemDtos();
+ }
+
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java
new file mode 100644
index 000000000..8bee5865e
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java
@@ -0,0 +1,622 @@
+package org.nl.acs.device_driver.basedriver.paper_tube_device2;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSON;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.nl.acs.agv.server.AgvService;
+import org.nl.acs.device.service.DeviceService;
+import org.nl.acs.device_driver.DeviceDriver;
+import org.nl.acs.device_driver.RouteableDeviceDriver;
+import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
+import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
+import org.nl.acs.ext.wms.data.ApplyPaperActionRequest;
+import org.nl.acs.ext.wms.data.ApplyPaperActionResponse;
+import org.nl.acs.ext.wms.service.AcsToWmsService;
+import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
+import org.nl.acs.history.ErrorUtil;
+import org.nl.acs.history.service.DeviceErrorLogService;
+import org.nl.acs.history.service.dto.DeviceErrorLogDto;
+import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
+import org.nl.acs.instruction.service.InstructionService;
+import org.nl.acs.instruction.service.dto.Instruction;
+import org.nl.acs.log.service.DeviceExecuteLogService;
+import org.nl.acs.monitor.DeviceStageMonitor;
+import org.nl.acs.opc.Device;
+import org.nl.acs.opc.DeviceAppService;
+import org.nl.acs.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.service.ParamService;
+import org.nl.modules.wql.util.SpringContextHolder;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.*;
+
+/**
+ * 纸管库
+ */
+@Slf4j
+@Data
+@RequiredArgsConstructor
+public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
+ 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
+ ParamService paramService = SpringContextHolder.getBean(ParamService.class);
+ @Autowired
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
+ @Autowired
+ AgvService agvService = SpringContextHolder.getBean(AgvService.class);
+ @Autowired
+ DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
+
+ private Date instruction_update_time = new Date();
+ private Date require_apply_strangulation_time = new Date();
+ private int instruction_update_time_out = 500;
+ 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;
+
+ //心跳
+ int heartbeat = 0;
+ int last_heartbeat = 0;
+ //工作模式
+ int mode = 0;
+ int last_mode = 0;
+ //光电信号
+ int move = 0;
+ int last_move = 0;
+ //托盘方向
+ int carrier_direction = 0;
+ int last_carrier_direction = 0;
+ //报警
+ int error = 0;
+ int last_error = 0;
+ //任务号
+ int task = 0;
+ int last_task = 0;
+
+ int inventory_qty = 0;
+ int out_finish = 0;
+ //下发命令
+ int to_command = 0;
+ int last_to_command = 0;
+ //下发目标站
+ int to_target = 0;
+ int last_to_target = 0;
+ //下发任务号
+ int to_task = 0;
+ int last_to_task = 0;
+
+ String item_out_seq_arr = null;
+ List item_out_seq_arr1 = null;
+ String last_item_out_seq_arr = null;
+ int[] item_out_qty_arr = null;
+ int[] last_item_out_qty_arr = null;
+
+ //当前指令
+ Instruction inst = null;
+
+ String material = null;
+
+ Boolean isonline = true;
+
+ Boolean iserror = false;
+
+ //1-执行任务;2-取货完成;3-放货完成;
+ int flag;
+
+
+ int last_inventory_qty = 0;
+ int last_out_finish = 0;
+
+ String last_material = null;
+ String message = null;
+ String device_code;
+ String task_code = null;
+ String vehicle_code;
+ String inst_message;
+
+ @Override
+ public Device getDevice() {
+ return this.device;
+ }
+
+ //请求成功标记
+ Boolean requireSucess = false;
+
+ @Override
+ public void execute() {
+ try {
+ String message = null;
+ device_code = this.getDeviceCode();
+ heartbeat = this.itemProtocol.getHeartbeat();
+ mode = this.itemProtocol.getMode();
+ move = this.itemProtocol.getMove();
+ carrier_direction = this.itemProtocol.getCarrier_direction();
+ error = this.itemProtocol.getError();
+ task = this.itemProtocol.getTask();
+ to_command = this.itemProtocol.getTo_command();
+ to_target = this.itemProtocol.getTotarget();
+ to_task = this.itemProtocol.getTo_task();
+ //item_out_seq_arr1 = this.itemProtocol.getItem_out_seq_arr1();
+ item_out_seq_arr = this.itemProtocol.getItem_out_seq_arr();
+ item_out_qty_arr = this.itemProtocol.getItem_out_qty_arr();
+
+
+ if (to_command != last_to_command) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command);
+ }
+ if (to_target != last_to_target) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target:" + last_to_target + "->" + to_target);
+ }
+ if (to_task != last_to_task) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task:" + last_to_task + "->" + to_task);
+ }
+
+ if (mode != last_mode) {
+ JSONObject param = new JSONObject();
+ param.put("device_code", this.device_code);
+ param.put("mode", Math.min(mode, 3));
+ param.put("device_name", this.getDevice().getDevice_name());
+ param.put("device_type", "1");
+ param.put("product_area", paramService.findByCode("productArea").getValue());
+ acsToWmsService.sendDeviceStatus(param);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
+ }
+ if (move != last_move) {
+ logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
+ }
+ if (carrier_direction != last_carrier_direction) {
+ logServer.deviceItemValue(this.device_code, "carrier_direction", String.valueOf(carrier_direction));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction:" + last_carrier_direction + "->" + carrier_direction);
+ }
+ if (error != last_error) {
+ if (error != 0) {
+ DeviceErrorLogDto dto = new DeviceErrorLogDto();
+ dto.setDevice_code(device_code);
+ dto.setError_code(String.valueOf(error));
+ String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
+ dto.setError_info(errorInfo);
+ deviceErrorLogService.create(dto);
+ }
+ logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
+ }
+ if (task != last_task) {
+ logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
+ logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
+ }
+
+ if (move != 0 && task > 0) {
+ update_instruction_status();
+ }
+
+ } catch (Exception var17) {
+ var17.printStackTrace();
+ logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
+ }
+
+
+ if (mode == 0) {
+ this.setIsonline(false);
+ message = "未联机";
+ } else if (error != 0) {
+ this.setIserror(true);
+ message = "有报警";
+ } else {
+ this.setIsonline(true);
+ this.setIserror(false);
+ message = "";
+ Instruction instruction = null;
+ List toInstructions;
+
+ //纸管库申请任务
+ switch (mode) {
+ case 1:
+ log.debug("弃用(留作兼容)");
+ break;
+ case 2:
+ //申请任务
+ if (move > 0 && !requireSucess) {
+ instruction_require();
+ }
+ break;
+ case 3:
+ log.info("运行中");
+ break;
+ case 4:
+ //申请出货
+ if (move == 1 && !requireSucess) {
+ request_for_shipment(String.valueOf(mode), item_out_seq_arr, item_out_qty_arr);
+ }
+ break;
+ }
+ }
+ last_heartbeat = heartbeat;
+ last_mode = mode;
+ last_error = error;
+ last_carrier_direction = carrier_direction;
+ last_task = task;
+ last_to_command = to_command;
+ last_to_target = to_target;
+ last_to_task = to_task;
+ last_item_out_seq_arr = item_out_seq_arr;
+ last_item_out_qty_arr = item_out_qty_arr;
+
+ }
+
+
+ public void writing(int command) {
+ String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command;
+
+ Map itemMap = new HashMap();
+ this.control(itemMap);
+ }
+
+
+ public void writing(List list) {
+ Map itemMap = new HashMap();
+ for (int i = 0; i < list.size(); i++) {
+ Object ob = list.get(i);
+ JSONObject json = (JSONObject) JSONObject.toJSON(ob);
+ if (!StrUtil.isEmpty(json.getString("value"))) {
+ String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ + "." + json.getString("code");
+ itemMap.put(to_param, json.getString("value"));
+ }
+ }
+ logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
+ try {
+ this.checkcontrol(itemMap);
+ } catch (Exception e) {
+ e.printStackTrace();
+ try {
+ this.checkcontrol(itemMap);
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ }
+
+ public void writing(Map map) {
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
+ Map itemMap = new LinkedHashMap<>();
+ map.forEach((key, value) -> {
+ if (ObjectUtil.isNotEmpty(value)) {
+ itemMap.put(getToParam() + key, value);
+ }
+ });
+ if (ObjectUtil.isNotEmpty(itemMap)) {
+ this.control(itemMap);
+ logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
+ }
+ }
+
+
+ public synchronized void request_for_shipment(String mode, String item_out_seq_arr, int[] item_out_qty_arr) {
+ Date date = new Date();
+ if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
+ } else {
+ this.require_apply_strangulation_time = date;
+ ApplyPaperActionRequest applyPaperActionRequest = new ApplyPaperActionRequest();
+ applyPaperActionRequest.setDevice_code(this.device_code);
+ applyPaperActionRequest.setType("1");
+ applyPaperActionRequest.setTask_code(String.valueOf(task));
+ //获取出库顺序
+ boolean contains = item_out_seq_arr.contains(",");
+ //String s = item_out_seq_arr.replaceAll("[\\[\\]]", "");
+ if (contains) {
+ String[] split = item_out_seq_arr.split(",");
+ applyPaperActionRequest.setMaterial1(split[0]);
+ applyPaperActionRequest.setMaterial2(split[1]);
+ } else {
+ applyPaperActionRequest.setMaterial1(item_out_seq_arr);
+ }
+ /*if (item_out_qty_arr.length == 2) {
+ // 去除方括号
+ applyPaperActionRequest.setMaterial1(String.valueOf(item_out_qty_arr[0]));
+ applyPaperActionRequest.setMaterial2(String.valueOf(item_out_qty_arr[1]));
+ } else if (item_out_qty_arr.length == 1) {
+ applyPaperActionRequest.setMaterial1(String.valueOf(item_out_qty_arr[0]));
+ }*/
+ if (item_out_qty_arr.length >= 1 && item_out_qty_arr.length < 4) {
+ applyPaperActionRequest.setQty1(String.valueOf(item_out_qty_arr[0]));
+ applyPaperActionRequest.setQty2(String.valueOf(item_out_qty_arr[1]));
+ }
+ ApplyPaperActionResponse applyPaperActionResponse = acsToWmsService.applyPaperActionRequest(applyPaperActionRequest);
+ Map map3 = new HashMap();
+ if (applyPaperActionResponse.getstatus() == 200) {
+ map3.put("to_command", "4");
+ this.writing(map3);
+ requireSucess = true;
+ logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyPaperActionResponse);
+ message = "申请出货成功";
+ } else {
+ message = applyPaperActionResponse.getMessage();
+ map3.put("to_command", "5");
+ this.writing(map3);
+ requireSucess = false;
+ message = "出库顺序错误";
+ logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyPaperActionResponse);
+ }
+ }
+ }
+
+
+ /**
+ * 申请任务
+ */
+ public synchronized Boolean instruction_require() {
+ 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;
+ //查找有没有对应的指令
+ //找指令类型是10的
+ Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
+ if (ObjectUtil.isNull(inst)) {
+ return false;
+ }
+ if (ObjectUtil.isNotNull(inst) && "10".equals(inst.getInstruction_code())) {
+ Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
+ String next_addr = nextdevice.getExtraValue().get("address").toString();
+ TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
+ List paperArray = getPaperArray(taskDto.getPaper_array());
+ if (ObjectUtil.isEmpty(inst)) {
+ return false;
+ }
+ Map map = new HashMap();
+ if (paperArray.size() == 1) {
+ writeStatus(paperArray, map, 1);
+ } else if (paperArray.size() == 2) {
+ writeStatus(paperArray, map, 1);
+ writeStatus(paperArray, map, 2);
+ } else if (paperArray.size() == 3) {
+ writeStatus(paperArray, map, 1);
+ writeStatus(paperArray, map, 2);
+ writeStatus(paperArray, map, 3);
+ }
+ writeData(next_addr, inst, map);
+ this.writing(map);
+ requireSucess = true;
+ return true;
+ } else {
+ //判断是否有相同起点的,任务状态就绪的任务
+ //任务类型是10
+ TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code);
+ if (ObjectUtil.isNull(taskdto)) {
+ return false;
+ }
+ List paperArray = getPaperArray(taskdto.getPaper_array());
+ if (ObjectUtil.isNotNull(taskdto) && "10".equals(taskdto.getTask_type())) {
+ //判断指令的起点和当前的设备号相同
+ if (!taskdto.getStart_device_code().equals(device_code)) {
+ return false;
+ }
+ //判断当前任务号是否存在指令
+ Instruction inst1 = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code());
+ Device nextdevice = deviceAppservice.findDeviceByCode(inst1.getNext_device_code());
+ String next_addr = nextdevice.getExtraValue().get("address").toString();
+ Device pointdevice = deviceAppservice.findDeviceByCode(inst1.getNext_point_code());
+ String point_addr = pointdevice.getExtraValue().get("address").toString();
+ //没有就创建指令
+ String taskid = taskdto.getTask_id();
+ String taskcode = taskdto.getTask_code();
+ String priority = taskdto.getPriority();
+ String start_point_code = taskdto.getStart_point_code();
+ String start_device_code = taskdto.getStart_device_code();
+ String route_plan_code = taskdto.getRoute_plan_code();
+
+ Instruction instdto = new Instruction();
+ instdto.setInstruction_id(IdUtil.simpleUUID());
+ instdto.setRoute_plan_code(route_plan_code);
+ instdto.setRemark(taskdto.getRemark());
+ instdto.setMaterial(taskdto.getMaterial());
+ instdto.setQuantity(taskdto.getQuantity());
+ instdto.setTask_id(taskid);
+ instdto.setTask_code(taskcode);
+ String now = DateUtil.now();
+ instdto.setCreate_time(now);
+ instdto.setCreate_by("auto");
+ instdto.setStart_device_code(start_device_code);
+ instdto.setNext_device_code(next_addr);
+ instdto.setStart_point_code(start_point_code);
+ instdto.setNext_point_code(point_addr);
+ instdto.setPriority(priority);
+ instdto.setInstruction_status("0");
+ instdto.setExecute_device_code(start_point_code);
+ try {
+ instructionService.create(instdto);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("指令创建失败!", e.getMessage());
+ return false;
+ }
+ taskdto.setTask_status("1");
+ taskserver.update(taskdto);
+ requireSucess = true;
+ Map map = new HashMap();
+ if (paperArray.size() == 1) {
+ writeStatus(paperArray, map, 1);
+ } else if (paperArray.size() == 2) {
+ writeStatus(paperArray, map, 1);
+ writeStatus(paperArray, map, 2);
+ } else if (paperArray.size() == 3) {
+ writeStatus(paperArray, map, 1);
+ writeStatus(paperArray, map, 2);
+ writeStatus(paperArray, map, 3);
+ }
+ writeData(next_addr, instdto, map);
+ this.writing(map);
+ requireSucess = true;
+ return true;
+ }
+ //并且指令的起点和当前的设备号相同
+ //找到就要下发数据
+ //查找就绪状态的任务
+ //并且任务的起点和当前的设备号相同
+ //找到创建指令
+ //入库顺序
+ }
+ return false;
+ }
+ }
+
+ public void writeData(String next_addr, Instruction instdto, Map map) {
+ map.put("to_target", next_addr);
+ map.put("to_task", instdto.getInstruction_code());
+ map.put("to_command", "1");
+ }
+
+ public String getToParam() {
+ return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
+ }
+
+ public void writeStatus(List paperArray, Map map, Integer status) {
+ Paper paper = paperArray.get(status);
+ map.put("to_material" + status, paper.getMeterial_code());
+ map.put("to_out_qty" + status, paper.getQty());
+ map.put("to_seq" + status, "1");
+ map.put("to_position" + status, paper.getDevice_code());
+ }
+
+
+ public void writing(String key, String param) {
+
+ 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(param));
+ //itemMap.put(to_param, Integer.parseInt(value));
+ this.control(itemMap);
+ logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + param);
+ }
+
+ public synchronized boolean finish_instruction() throws Exception {
+ instructionService.finish(inst);
+ return true;
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() {
+ JSONObject jo = new JSONObject();
+ String mode = "";
+
+ if (this.getMode() == 0) {
+ mode = "未联机";
+ } else if (this.getMode() == 1) {
+ mode = "单机";
+ } else if (this.getMode() == 2) {
+ mode = "联机";
+ } else if (this.getMode() == 3) {
+ mode = "入库中";
+ } else if (this.getMode() == 4) {
+ mode = "出库中";
+ }
+ jo.put("device_name", this.getDevice().getDevice_name());
+ jo.put("mode", mode);
+ jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError())));
+ jo.put("inventory_qty", inventory_qty);
+ jo.put("out_finish", out_finish);
+ jo.put("material", material);
+ jo.put("isOnline", this.getIsonline());
+
+ return jo;
+ }
+
+ /**
+ * 解析出库的顺序
+ */
+ public List getPaperArray(String paper_array) {
+ JSONArray jsonArray = JSONUtil.parseArray(paper_array);
+ List papers = jsonArray.toList(Paper.class);
+ return papers;
+ }
+
+
+ /**
+ * 更新指令状态
+ */
+ public synchronized void update_instruction_status() throws Exception {
+ Date date = new Date();
+ if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
+
+ } else {
+ this.instruction_update_time = date;
+ inst = checkInst();
+ if (inst != null) {
+ //a点到b点,给状态说允许取货
+ if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
+ inst.setInstruction_status("1");
+ inst.setExecute_device_code(this.device_code);
+ instructionService.update(inst);
+ logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
+ }
+ //当货物到达b点,实现完成指令
+ if (StrUtil.equals(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0")) {
+ if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
+ inst.setExecute_device_code(this.device_code);
+ finish_instruction();
+ logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task);
+ }
+ }
+ }
+ }
+ }
+
+ public Instruction checkInst() {
+ if (ObjectUtil.isNotEmpty(this.inst)) {
+ if (this.task > 0) {
+ if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
+ return this.inst;
+ } else {
+ inst = instructionService.findByCodeFromCache(String.valueOf(task));
+ return inst;
+ }
+ }
+ } else {
+ inst = instructionService.findByCodeFromCache(String.valueOf(task));
+ return inst;
+ }
+ return null;
+ }
+
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java
index 4b31e481c..23a9448d5 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java
@@ -393,6 +393,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
last_error = error;
last_move = move;
last_task = task;
+ last_height = height;
last_plcbarcode_length = plcbarcode_length;
last_plcbarcode = plcbarcode;
last_weight = weight;
@@ -936,8 +937,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
+ "." + param;
Map itemMap = new HashMap();
itemMap.put(to_param, Integer.parseInt(value));
- this.control(itemMap);
-
+ try {
+ this.checkcontrol(itemMap);
+ } catch (Exception e) {
+ e.printStackTrace();
+ try{
+ this.checkcontrol(itemMap);
+ } catch (Exception e1){
+ e1.printStackTrace();
+ }
+ }
}
// 申请贴标
@@ -1017,6 +1026,21 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
} else {
message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
+ List list = new ArrayList();
+ Map map = new HashMap();
+ map.put("code", "to_target");
+ map.put("value", "1011");
+ list.add(map);
+ Map map2 = new HashMap();
+ map2.put("code", "to_command");
+ map2.put("value", "1");
+ list.add(map2);
+ Map map3 = new HashMap();
+ map3.put("code", "to_task");
+ map3.put("value", "0");
+ list.add(map3);
+ this.writing(list);
+ requireSucess = true;
}
}
@@ -1034,7 +1058,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
}
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
- this.control(itemMap);
+ try {
+ this.checkcontrol(itemMap);
+ } catch (Exception e) {
+ e.printStackTrace();
+ try{
+ this.checkcontrol(itemMap);
+ } catch (Exception e1){
+ e1.printStackTrace();
+ }
+ }
}
@Override
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java
index 04f4baedb..157d4f3f1 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java
@@ -81,6 +81,11 @@ public interface OpcDeviceDriver extends DeviceDriver {
return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
+ default List getArrayValue(String protocol) {
+ return (List) this.getOpcValueAccessor().getValue(this.getItem(protocol));
+ }
+
+
default Object getValue(String protocol) {
return this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyPaperActionRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyPaperActionRequest.java
new file mode 100644
index 000000000..c289be887
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyPaperActionRequest.java
@@ -0,0 +1,42 @@
+package org.nl.acs.ext.wms.data;
+
+import lombok.Data;
+
+@Data
+public class ApplyPaperActionRequest extends BaseRequest {
+
+ private String device_code;
+
+ /**
+ * 1 纸管库出库申请
+ * 2 套管请求
+ */
+ private String type;
+
+ /**
+ * 任务号:输送任务号
+ */
+ private String task_code;
+
+
+ /**
+ * 出库物料1
+ */
+ private String material1;
+
+ /**
+ * 出库物料2
+ */
+ private String material2;
+
+ /**
+ * 出库物料数量1
+ */
+ private String qty1;
+
+ /**
+ * 出库物料数量2
+ */
+ private String qty2;
+
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyPaperActionResponse.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyPaperActionResponse.java
new file mode 100644
index 000000000..71cd02ae2
--- /dev/null
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyPaperActionResponse.java
@@ -0,0 +1,14 @@
+package org.nl.acs.ext.wms.data;
+
+import lombok.Data;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Data
+public class ApplyPaperActionResponse extends BaseResponse {
+
+ private Map data = new HashMap();
+
+
+}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java
index b5ec1fee7..e7765a03e 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java
@@ -98,6 +98,13 @@ public interface AcsToWmsService {
*/
ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param);
+ /**
+ * 申请出纸管,套纸管
+ * @param param
+ * @return
+ */
+ ApplyPaperActionResponse applyPaperActionRequest(ApplyPaperActionRequest param);
+
LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest liKuApplyTaskRequest);
UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest updateLKTaskRequest);
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
index 129e2bee9..4e305c38f 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
@@ -478,10 +478,42 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} finally {
MDC.remove(log_file_type);
}
-
-
}
+ @Override
+ public ApplyPaperActionResponse applyPaperActionRequest(ApplyPaperActionRequest param) {
+ try {
+ MDC.put(log_file_type, log_type);
+ ApplyPaperActionResponse applyPaperActionResponse = new ApplyPaperActionResponse();
+ if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
+ String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
+ AddressDto addressDto = addressService.findByCode("applyPaperAction");
+ String methods_url = addressDto.getMethods_url();
+ String url = wmsUrl + methods_url;
+ log.info("ApplyPaperActionRequest----请求参数{}", param);
+ try {
+// String result = "";
+ String result = HttpRequest.post(url)
+ .body(JSON.toJSONString(param))
+ .execute().body();
+ JSONObject jsonObject = JSONObject.parseObject(result);
+ log.info("ApplyPaperActionResponse----返回参数{}", result);
+ applyPaperActionResponse = JSONObject.toJavaObject(jsonObject, ApplyPaperActionResponse.class);
+ } catch (Exception e) {
+ JSONObject map = new JSONObject();
+ map.put("status", 400);
+ map.put("message", e.getMessage());
+ return JSONObject.toJavaObject(map, ApplyPaperActionResponse.class);
+ }
+ }
+ return applyPaperActionResponse;
+ } finally {
+ MDC.remove(log_file_type);
+ }
+ }
+
+
+
@Override
public LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest param) {
try {
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
index bfedc6cb0..4ac9b6396 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
@@ -1255,6 +1255,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
e.printStackTrace();
}
+ } else if(StrUtil.equals(type, "3")){
+ List list = new ArrayList();
+ Map map = new HashMap();
+ map.put("code", "to_command");
+ map.put("value", 3);
+ list.add(map);
+ paperTubeConveyorDeviceDriver.writing(list);
}
}
diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
index d8d4e1284..c1b3dd7c7 100644
--- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
+++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
@@ -1200,6 +1200,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return null;
}
+ /**
+ * 根据任务号查询任务
+ * @param task_code
+ * @return
+ */
public TaskDto findByCodeFromCache(String task_code) {
Iterator var3 = tasks.iterator();
diff --git a/acs/nladmin-ui/src/views/acs/device/driver/casing_station.vue b/acs/nladmin-ui/src/views/acs/device/driver/casing_station.vue
new file mode 100644
index 000000000..032907b97
--- /dev/null
+++ b/acs/nladmin-ui/src/views/acs/device/driver/casing_station.vue
@@ -0,0 +1,500 @@
+
+
+
+
+
+ 设备协议:
+
+
+
+
+ OpcServer:
+
+
+
+
+
+ PLC:
+
+
+
+
+
+
+
+
+
+
+ 输送系统:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 指令相关:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AGV相关:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PLC读取字段:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 测试读
+
+
+
+
+
+
+
+
+
+
+
+ PLC写入字段:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 测试读
+
+
+
+
+
+
+
+ 测试写
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
+
+
+
diff --git a/acs/nladmin-ui/src/views/acs/device/driver/paper_tube_conveyor2.vue b/acs/nladmin-ui/src/views/acs/device/driver/paper_tube_conveyor2.vue
new file mode 100644
index 000000000..032907b97
--- /dev/null
+++ b/acs/nladmin-ui/src/views/acs/device/driver/paper_tube_conveyor2.vue
@@ -0,0 +1,500 @@
+
+
+
+
+
+ 设备协议:
+
+
+
+
+ OpcServer:
+
+
+
+
+
+ PLC:
+
+
+
+
+
+
+
+
+
+
+ 输送系统:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 指令相关:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AGV相关:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PLC读取字段:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 测试读
+
+
+
+
+
+
+
+
+
+
+
+ PLC写入字段:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 测试读
+
+
+
+
+
+
+
+ 测试写
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
+
+
+
diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/szls/rest/LmsToBigScreenController.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/szls/rest/LmsToBigScreenController.java
index 36ebe730b..44f72a81e 100644
--- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/szls/rest/LmsToBigScreenController.java
+++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/szls/rest/LmsToBigScreenController.java
@@ -39,4 +39,28 @@ public class LmsToBigScreenController {
return new ResponseEntity<>(LmsToBigScreenService.getStructInfo(jo), HttpStatus.OK);
}
+ @PostMapping("/getMonthFreight")
+ @Log("当月发货运费信息")
+ @ApiOperation("当月发货运费信息")
+ @SaIgnore
+ public ResponseEntity