# Conflicts:
#	acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
#	acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java
#	acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java
#	acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java
#	acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java
#	acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java
#	acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java
#	acs/qd/.env.development
This commit is contained in:
ldj_willow
2022-08-18 14:59:22 +08:00
55 changed files with 1159 additions and 898 deletions

View File

@@ -64,15 +64,21 @@ public interface OpcDeviceDriver extends DeviceDriver {
}
default Float getFloatValue(String protocol) {
return (Float) this.getOpcValueAccessor().getValue(this.getItem(protocol));
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
return (Float)redisUtils.get(this.getItem(protocol));
// return (Float) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
default int[] getIntegeregerArrayValue(String protocol) {
return (int[]) this.getOpcValueAccessor().getValue(this.getItem(protocol));
// return (int[]) this.getOpcValueAccessor().getValue(this.getItem(protocol));
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
return (int[])redisUtils.get(this.getItem(protocol));
}
default String getStringValue(String protocol) {
return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol));
// return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol));
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
return (String)redisUtils.get(this.getItem(protocol));
}
default Object getValue(String protocol) {

View File

@@ -17,6 +17,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -36,7 +37,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -403,4 +404,36 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
}
return flag;
}
@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 = "运行中";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("container_type", this.getContainer_type());
jo.put("barcode", this.getBarcode());
jo.put("task", this.getTask());
jo.put("error", this.getError());
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_kiln_lane;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -13,6 +14,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -28,7 +30,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -357,4 +359,46 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String status = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("open_time", this.getOpen_time());
jo.put("standby_time", this.getStandby_time());
jo.put("production_time", this.getProduction_time());
jo.put("error_time", this.getError_time());
jo.put("car_sum", this.getCar_sum());
jo.put("nullCar_qty", this.getNullCar_qty());
jo.put("burning_car_qty", this.getBurning_car_qty());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.lnsh.lnsh_labeling_machine;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -13,6 +14,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -28,7 +30,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -227,4 +229,48 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String status = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", this.getIsonline());
jo.put("open_time", this.getOpen_time());
jo.put("close_time", this.getClose_time());
jo.put("standby_time", this.getStandby_time());
jo.put("production_time", this.getProduction_time());
jo.put("error_time", this.getError_time());
jo.put("labeling_qty", this.getLabeling_qty());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -16,6 +17,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -35,7 +37,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -402,4 +404,78 @@ public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements D
return true;
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String move_1 = "";
String action_1 = "";
String walk_y = "";
String mode = "";
String status = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
if (this.getMove_1() == 0) {
move_1 = "无货";
} else if (this.getMove_1() == 1) {
move_1 = "有货";
} else if (this.getMove_1() == 2) {
move_1 = "有托盘有货";
}
if (this.getAction_1() == 1) {
action_1 = "取货中";
} else if (this.getAction_1() == 2) {
action_1 = "取货完成";
} else if (this.getAction_1() == 3) {
action_1 = "放货中";
} else if (this.getAction_1() == 4) {
action_1 = "放货完成";
}
if (this.getWalk_y() == 0) {
walk_y = "原位";
} else if (this.getWalk_y() == 2) {
walk_y = "非原位";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("move_1", move_1);
jo.put("action_1", action_1);
jo.put("walk_y", walk_y);
jo.put("error", this.getError());
jo.put("task1", this.getTask1());
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("task_qty", this.getTask_qty());
jo.put("finishTask_qty", this.getFinishTask_qty());
jo.put("batch", this.getBatch());
jo.put("specifications", this.getSpecifications());
jo.put("qty", this.getQty());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -17,6 +17,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
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.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
@@ -35,7 +36,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -1244,4 +1245,71 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String status = "";
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 = "人工排产确认";
} else if (this.getMode() == 5) {
mode = "获取托盘信息";
} else if (this.getMode() == 6) {
mode = "码垛完成";
} else if (this.getMode() == 7) {
mode = "码垛强制完成";
} else if (this.getMode() == 8) {
mode = "申请空盘";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
String onoff_status = "";
if (this.getOnoff_status() == 1) {
onoff_status = "关机";
} else if (this.getOnoff_status() == 2) {
onoff_status = "开机";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("onoff_status", onoff_status);
jo.put("specifications", this.getSpecifications());
jo.put("batch", this.getBatch());
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("putStation", this.getPut_station());
jo.put("barcode", this.getBarcode());
jo.put("material", this.getMaterial());
jo.put("qty", this.getQty());
jo.put("open_time", this.getOpen_time());
jo.put("standby_time", this.getStandby_time());
jo.put("production_time", this.getProduction_time());
jo.put("error_time", this.getError_time());
jo.put("order_No", this.getOrder_No());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -17,6 +17,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -36,7 +37,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -482,6 +483,69 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String status = "";
String action = "";
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 = "获取托盘信息";
} else if (this.getMode() == 5) {
mode = "码垛完成";
} else if (this.getMode() == 6) {
mode = "码垛强制完成";
} else if (this.getMode() == 7) {
mode = "申请空盘";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
if (this.getAction() == 0) {
action = "禁止取放";
} else if (this.getAction() == 1) {
action = "允许取货";
} else if (this.getAction() == 2) {
action = "允许放货";
} else if (this.getAction() == 3) {
action = "允许取放";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("action", action);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("put_station", this.getPut_station());
jo.put("material", this.getMaterial());
jo.put("encoder_qty", this.getEncoder_qty());
jo.put("specifications", this.getSpecifications());
jo.put("batch", this.getBatch());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
// public void writing(int type, int command) {
// String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
// + "." + ItemProtocol.item_to_material_code;

View File

@@ -152,7 +152,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return "";
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -17,6 +17,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -35,7 +36,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -473,4 +474,78 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
return "";
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String io_action = "";
String move = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 4) {
mode = "叫料";
} else if (this.getMode() == 5) {
mode = "申请空盘";
} else if (this.getMode() == 6) {
mode = "申请入库";
}
if (this.getAction() == 0) {
action = "禁止取放";
} else if (this.getAction() == 1) {
action = "允许取货";
} else if (this.getAction() == 2) {
action = "允许放货";
} else if (this.getAction() == 3) {
action = "允许取放";
}
if (this.getIo_action() == 0) {
io_action = "禁止进出";
} else if (this.getIo_action() == 1) {
io_action = "允许进入";
} else if (this.getIo_action() == 2) {
io_action = "允许离开";
} else if (this.getIo_action() == 3) {
io_action = "允许进出";
}
if (this.getMove() == 0) {
move = "无货";
} else if (this.getMove() == 1) {
move = "有货";
} else if (this.getMove() == 2) {
move = "有托盘有货";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("io_action", io_action);
jo.put("hasGoods", this.getHasGoods());
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("task", this.getTask());
jo.put("weight", this.getWeight());
jo.put("material", this.getMaterial());
jo.put("barcode", this.getBarcode());
jo.put("specifications", this.getSpecifications());
jo.put("AlongSide", this.getAlongSide());
jo.put("BshortSide", this.getBshortSide());
jo.put("Htrapezoidal", this.getHtrapezoidal());
jo.put("Wthickness", this.getWthickness());
jo.put("batch", this.getBatch());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -16,6 +17,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -38,7 +40,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -612,4 +614,106 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
Map<String, Object> itemMap = new HashMap<String, Object>();
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String move_1 = "";
String move_2 = "";
String action_1 = "";
String action_2 = "";
String walk_y = "";
String mode = "";
String status = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
if (this.getMove_1() == 0) {
move_1 = "无货";
} else if (this.getMove_1() == 1) {
move_1 = "有货";
} else if (this.getMove_1() == 2) {
move_1 = "有托盘有货";
}
if (this.getMove_2() == 0) {
move_2 = "无货";
} else if (this.getMove_2() == 1) {
move_2 = "有货";
} else if (this.getMove_2() == 2) {
move_2 = "有托盘有货";
}
if (this.getAction_1() == 1) {
action_1 = "取货中";
} else if (this.getAction_1() == 2) {
action_1 = "取货完成";
} else if (this.getAction_1() == 3) {
action_1 = "放货中";
} else if (this.getAction_1() == 4) {
action_1 = "放货完成";
}
if (this.getAction_2() == 1) {
action_2 = "取货中";
} else if (this.getAction_2() == 2) {
action_2 = "取货完成";
} else if (this.getAction_2() == 3) {
action_2 = "放货中";
} else if (this.getAction_2() == 4) {
action_2 = "放货完成";
}
if (this.getWalk_y() == 0) {
walk_y = "原位";
} else if (this.getWalk_y() == 2) {
walk_y = "非原位";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("move_1", move_1);
jo.put("move_2", move_2);
jo.put("action_1", action_1);
jo.put("action_2", action_2);
jo.put("walk_y", walk_y);
jo.put("error", this.getError());
jo.put("task1", this.getTask1());
jo.put("task2", this.getTask2());
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("open_time", this.getOpen_time());
jo.put("standby_time", this.getStandby_time());
jo.put("production_time", this.getProduction_time());
jo.put("error_time", this.getError_time());
jo.put("task_qty", this.getTask_qty());
jo.put("finishTask_qty", this.getFinishTask_qty());
jo.put("batch", this.getBatch());
jo.put("specifications", this.getSpecifications());
jo.put("qty", this.getQty());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -17,6 +17,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
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.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
@@ -34,7 +35,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -1038,4 +1039,57 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
ReadUtil.write(itemMap, server);
}
@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() == 5) {
mode = "获取托盘信息";
} else if (this.getMode() == 6) {
mode = "拆垛完成";
} else if (this.getMode() == 7) {
mode = "申请空盘";
}
String onoff_status = "";
if (this.getOnoff_status() == 0) {
onoff_status = "关机";
} else if (this.getOnoff_status() == 1) {
onoff_status = "开机";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("getStation", this.getGetStation());
jo.put("barcode", this.getBarcode());
jo.put("material", this.getMaterial());
jo.put("total_split", this.getTotal_split());
jo.put("open_time", this.getOpen_time());
jo.put("standby_time", this.getStandby_time());
jo.put("production_time", this.getProduction_time());
jo.put("error_time", this.getError_time());
jo.put("batch", this.getBatch());
jo.put("specifications", this.getSpecifications());
jo.put("qty", this.getQty());
jo.put("onoff_status", onoff_status);
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -19,6 +19,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
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.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
@@ -37,7 +38,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -661,4 +662,74 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
return "";
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String io_action = "";
String move = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 4) {
mode = "叫料";
} else if (this.getMode() == 5) {
mode = "申请空盘";
} else if (this.getMode() == 6) {
mode = "申请入库";
}
if (this.getAction() == 0) {
action = "禁止取放";
} else if (this.getAction() == 1) {
action = "允许取货";
} else if (this.getAction() == 2) {
action = "允许放货";
} else if (this.getAction() == 3) {
action = "允许取放";
}
if (this.getIo_action() == 0) {
io_action = "禁止进出";
} else if (this.getIo_action() == 1) {
io_action = "允许进入";
} else if (this.getIo_action() == 2) {
io_action = "允许离开";
} else if (this.getIo_action() == 3) {
io_action = "允许进出";
}
if (this.getMove() == 0) {
move = "无货";
} else if (this.getMove() == 1) {
move = "有货";
} else if (this.getMove() == 2) {
move = "有托盘有货";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("io_action", io_action);
jo.put("hasGoods", this.getHasGoods());
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("task", this.getTask());
jo.put("weight", this.getWeight());
jo.put("material", this.getMaterial());
jo.put("barcode", this.getBarcode());
jo.put("specifications", this.getSpecifications());
jo.put("batch", this.getBatch());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -767,7 +767,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return "";
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -17,6 +17,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
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.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
@@ -35,7 +36,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -689,13 +690,15 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
case 6:
//码垛完成
if (!requireSucess) {
applyEmpty();
palletizing();
}
break;
case 7:
//码垛强制完成
//码垛强制完成 半托缓存
if (!requireSucess) {
mandatoryPalletizing();
applyEmpty();
mandatoryPalletizing("0");
}
break;
case 8:
@@ -716,6 +719,19 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
enterProduction(json);
}
break;
case 10:
//叫料
if (!requireSucess && getStation>0 && StrUtil.isNotEmpty(material)) {
callMaterial();
}
break;
case 11:
//强制去包装
if (!requireSucess) {
applyEmpty();
mandatoryPalletizing("1");
}
break;
}
switch (flag) {
@@ -819,6 +835,43 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
}
}
/**
* 叫料
*
* @param
*/
public synchronized boolean callMaterial() {
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;
JSONObject json = new JSONObject();
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(getStation-1).replace("\"",""));
json.put("type","2");
json.put("material_code",material);
json.put("vehicle_code",barcode);
json.put("is_full","1");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
this.writing(1);
}
this.setRequireSucess(true);
}
return true;
}
}
/**
* 排产单确认
*
@@ -864,7 +917,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("vehicle_code",barcode);
JSONObject jo = acsToWmsService.getVehicle(json);
@@ -1018,7 +1075,8 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("qty",qty);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("qty",qty);
json.put("vehicle_code",barcode);
json.put("is_full","1");
json.put("product_code",product_code);
@@ -1097,7 +1155,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
*
* @param
*/
public synchronized boolean mandatoryPalletizing() {
public synchronized boolean mandatoryPalletizing(String type) {
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);
@@ -1109,9 +1167,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("qty",qty);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("qty",qty);
json.put("vehicle_code",barcode);
json.put("is_full","0");
json.put("material_code",material);
json.put("is_full",type);
json.put("product_code",product_code);
json.put("AlongSide",AlongSide);
json.put("BshortSide",BshortSide);
@@ -1176,8 +1236,8 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
this.writing(this.mode);
this.setRequireSucess(true);
}
this.setRequireSucess(true);
}
return true;
}
@@ -1262,4 +1322,36 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
jo.put("device_code", device.getDevice_code());
jo.put("mode", this.getMode());
jo.put("status", this.getStatus());
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("putStation", this.getPut_station());
jo.put("barcode", this.getBarcode());
jo.put("material", this.getMaterial());
jo.put("qty", this.getQty());
jo.put("open_time", this.getOpen_time());
jo.put("standby_time", this.getStandby_time());
jo.put("production_time", this.getProduction_time());
jo.put("error_time", this.getError_time());
jo.put("order_No", this.getOrder_No());
jo.put("onoff_status", this.getOnoff_status());
jo.put("getStation", this.getGetStation());
jo.put("specifications", this.getSpecifications());
jo.put("batch", this.getBatch());
jo.put("total_split", this.getTotal_split());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -15,8 +15,10 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -434,6 +436,5 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem
return true;
}
}
}

View File

@@ -25,7 +25,6 @@ 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.RedisUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -389,16 +388,29 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
@Override
public JSONObject getDeviceStatusName() {
JSONObject data = new JSONObject();
data.put("device_name", this.getDevice().getDevice_name());
if (mode == 1) {
data.put("mode", "单机");
String move = "";
JSONObject jo = new JSONObject();
if (this.getHasGoods() == 0) {
move = "无货";
} else if (this.getHasGoods() == 1) {
move = "有货";
} else if (this.getHasGoods() == 2) {
move = "有托盘有货";
}
if (mode == 2) {
data.put("mode", "联机");
}
return data;
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("move", move);
jo.put("container", this.getContainer());
jo.put("hasGoods", this.getHasGoods());
jo.put("isOnline", true);
//点击弹出
jo.put("is_click", true);
jo.put("device_type", device.getDevice_type());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("material", this.getMaterial());
jo.put("batch", this.getBatch());
return jo;
}
@Override

View File

@@ -1,58 +0,0 @@
package org.nl.acs.ext.xr_lk.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.ext.xr_lk.service.AcsToXrlkService;
import org.nl.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ludj
* @date 2021-07-21
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "新锐立库接口")
@RequestMapping("/api/xrlk")
@Slf4j
public class AcsToXrlkController {
private final AcsToXrlkService acsToXrlkService;
@PostMapping("/isPutPermission")
@Log("获取对接位是否允许放货")
@ApiOperation("获取对接位是否允许放货")
public ResponseEntity<Object> getPutPermission(@RequestBody String device_code) {
return new ResponseEntity<>(acsToXrlkService.isPutPermission(device_code), HttpStatus.OK);
}
@PostMapping("/isTakePermission")
@Log("获取对接位是否允许取货")
@ApiOperation("获取对接位是否允许取货")
public ResponseEntity<Object> getTakePermission(@RequestBody String device_code) {
return new ResponseEntity<>(acsToXrlkService.isTakePermission(device_code), HttpStatus.OK);
}
@PostMapping("/invokeDoor")
@Log("获取是否允许进入")
@ApiOperation("获取是否允许进入")
public ResponseEntity<Object> getInOutMode(@RequestBody String device_code) {
return new ResponseEntity<>(acsToXrlkService.invokeDoor(device_code), HttpStatus.OK);
}
@PostMapping("/AGVWorkStatus")
@Log("动作完成")
@ApiOperation("动作完成")
public ResponseEntity<Object> AGVWorkStatus(@RequestBody String device_code, String type) {
return new ResponseEntity<>(acsToXrlkService.AGVWorkStatus(device_code, type), HttpStatus.OK);
}
}

View File

@@ -1,25 +0,0 @@
package org.nl.acs.ext.xr_lk.rest;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.ext.xr_lk.service.XrlkToAcsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author wangs
* @date 2021-07-21
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "新锐立库接口")
@RequestMapping("/api/xrlk")
@Slf4j
public class XrlkToAcsController {
private final XrlkToAcsService xrlkToAcsService;
}

View File

@@ -1,41 +0,0 @@
package org.nl.acs.ext.xr_lk.service;
import cn.hutool.http.HttpResponse;
public interface AcsToXrlkService {
/**
* 获取是否允许进入:
*
* @param device_code
* @return
*/
HttpResponse invokeDoor(String device_code);
/**
* 获取对接位是否允许放货:
*
* @param device_code
* @return
*/
HttpResponse isPutPermission(String device_code);
/**
* 获取对接位是否允许取货
*
* @param device_code
* @return
*/
HttpResponse isTakePermission(String device_code);
/**
* 动作完成
*
* @param device_code
* @return
*/
HttpResponse AGVWorkStatus(String device_code, String type);
}

View File

@@ -1,6 +0,0 @@
package org.nl.acs.ext.xr_lk.service;
public interface XrlkToAcsService {
}

View File

@@ -1,105 +0,0 @@
package org.nl.acs.ext.xr_lk.service.impl;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.address.service.AddressService;
import org.nl.acs.device.address.service.dto.AddressDto;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.ext.xr_lk.service.AcsToXrlkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@Slf4j
public class AcsToXRlkServiceImpl implements AcsToXrlkService {
@Autowired
AcsConfigService acsConfigService;
@Autowired
DeviceService deviceService;
@Autowired
AddressService addressService;
@Override
public HttpResponse invokeDoor(String device_code) {
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.ERPURL);
AddressDto addressDto = addressService.findByCode("invokeDoor");
String url = wcsurl + addressDto.getMethods_url() + device_code;
HttpResponse result = null;
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
.execute();
System.out.println(result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
return result;
}
@Override
public HttpResponse isPutPermission(String device_code) {
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.ERPURL);
AddressDto addressDto = addressService.findByCode("isPutPermission");
String url = wcsurl + addressDto.getMethods_url() + device_code;
HttpResponse result = null;
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
.execute();
System.out.println(result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
return result;
}
@Override
public HttpResponse isTakePermission(String device_code) {
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.ERPURL);
AddressDto addressDto = addressService.findByCode("isTakePermission");
String url = wcsurl + addressDto.getMethods_url() + device_code;
HttpResponse result = null;
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
.execute();
System.out.println(result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
return result;
}
@Override
public HttpResponse AGVWorkStatus(String device_code, String type) {
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.ERPURL);
AddressDto addressDto = addressService.findByCode("AGVWorkStatus");
String url = wcsurl + addressDto.getMethods_url();
HttpResponse result = null;
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
.execute();
System.out.println(result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
return result;
}
}

View File

@@ -1,25 +0,0 @@
package org.nl.acs.ext.xr_lk.service.impl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.ext.xr_lk.service.XrlkToAcsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@Slf4j
public class XrlkToAcsServiceImpl implements XrlkToAcsService {
private final InstructionService InstructionService;
private final TaskService TaskService;
private final DeviceService DeviceService;
private final DeviceAppService DeviceAppService;
private final RouteLineService RouteLineService;
}

View File

@@ -3,7 +3,9 @@ package org.nl.acs.monitor;
import com.alibaba.fastjson.JSONObject;
/**
* 设备监控服务
* @Author: lyd
* @Description: 设备监控服务
* @Date: 2022-08-17
*/
public interface DeviceStageMonitor {
/**

View File

@@ -1,4 +1,38 @@
package org.nl.acs.monitor.rest;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.monitor.service.DeviceStageMonitorService;
import org.nl.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: lyd
* @Description: 设备信息
* @Date: 2022-08-17
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "设备信息")
@RequestMapping("/api/deviceInfo")
public class DeviceStageMonitorController {
private final DeviceStageMonitorService deviceStageMonitorService;
@Log("获取舞台设备信息")
@ApiOperation("获取舞台设备信息")
@PostMapping("/getDeviceByCodes")
public ResponseEntity<Object> getDeviceByCodes(@RequestBody String json) {
JSONArray jsonArray = JSONArray.parseArray(json);
return new ResponseEntity<>(deviceStageMonitorService.getData(jsonArray), HttpStatus.OK);
}
}

View File

@@ -3,7 +3,9 @@ package org.nl.acs.monitor.service;
import com.alibaba.fastjson.JSONArray;
/**
* 设备舞台监控服务
* @Author: lyd
* @Description: 取设备舞台监控数据
* @Date: 2022-08-17
*/
public interface DeviceStageMonitorService {
/**

View File

@@ -11,6 +11,11 @@ import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.springframework.stereotype.Service;
/**
* @Author: lyd
* @Description:
* @Date: 2022-08-17
*/
@Slf4j
@Service
@RequiredArgsConstructor
@@ -35,10 +40,11 @@ public class DeviceStageMonitorServiceImpl implements DeviceStageMonitorService
JSONObject json = new JSONObject();
if (device.getDeviceDriver() instanceof DeviceStageMonitor) {
DeviceStageMonitor monitorService = (DeviceStageMonitor) device.getDeviceDriver();
json = monitorService.getDeviceStatusName();
json = monitorService.getDeviceStatusName();
}
obj.put("data", json);
obj.put("device_name",json.get("device_name"));
obj.put("device_code", js.get("device_code"));
obj.put("id", js.getString("id")); // 设备不存在就只保留id方便前端查看
arr.add(obj);

View File

@@ -1,104 +0,0 @@
package org.nl.acs.test.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.test.service.TestService;
import org.nl.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Map;
/**
* @author ldjun
* @date 2021-03-18
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "任务管理")
@RequestMapping("/api/test")
@Slf4j
public class TestController {
private final TestService testService;
@Log("test1")
@ApiOperation("test1")
@PostMapping("/test1")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> test1() throws IOException {
testService.test1();
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("test2")
@ApiOperation("test2")
@PostMapping("/test2")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> test2() throws IOException {
testService.test2();
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("test3")
@ApiOperation("test3")
@PostMapping("/test3")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> test3() throws IOException {
testService.test3();
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("test4")
@ApiOperation("test4")
@PostMapping("/test4")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> test4(@RequestBody Map map) throws IOException {
testService.test4(map);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("test5")
@ApiOperation("test5")
@PostMapping("/test5")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> test5() throws IOException {
testService.test5();
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("test6")
@ApiOperation("test6")
@PostMapping("/test6")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> test6(@RequestBody Map map) throws IOException {
testService.test6(map);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("test7")
@ApiOperation("test7")
@PostMapping("/test7")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> test7() throws IOException {
testService.test7();
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("print")
@ApiOperation("print")
@PostMapping("/print")
//@PreAuthorize("@el.check('task:add')")
public ResponseEntity<Object> print() throws IOException {
return new ResponseEntity<>(testService.print(), HttpStatus.OK);
}
}

View File

@@ -1,72 +0,0 @@
package org.nl.acs.test.service;
import com.alibaba.fastjson.JSONObject;
import java.io.IOException;
import java.util.Map;
/**
* @author ldjun
* @description 服务接口
* @date 2021-03-18
**/
public interface TestService {
/**
* 初始化
*
* @throws IOException
*/
void test1() throws IOException;
/**
* 触发打印
*
* @throws IOException
*/
void test2() throws IOException;
/**
* 加载模板
*
* @throws IOException
*/
void test3() throws IOException;
/**
* 发送bufferdata缓存数据
*
* @throws IOException
*/
void test4(Map map) throws IOException;
/**
* 清空缓存
*
* @throws IOException
*/
void test5() throws IOException;
/**
* 发送settext指令
*
* @throws IOException
*/
void test6(Map map) throws IOException;
/**
* 事务发送
*
* @throws IOException
*/
void test7() throws IOException;
/**
* 发送打印
*
* @throws IOException
*/
JSONObject print() throws IOException;
}

View File

@@ -1,124 +0,0 @@
package org.nl.acs.test.service.impl;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.test.service.TestService;
import org.nl.start.auto.run.LetteringSocketConnectionAutoRun;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.Map;
/**
* @author ldjun
* @description 服务实现
* @date 2021-03-18
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class TestServiceImpl implements TestService {
@Override
public void test1() throws IOException {
try {
//返回编译完成信号
LetteringSocketConnectionAutoRun.write("SETMSG 26 1" + "\r\n");
//返回打印开始信号
LetteringSocketConnectionAutoRun.write("SETMSG 2 1" + "\r\n");
//返回打印完成信号
LetteringSocketConnectionAutoRun.write("SETMSG 3 1" + "\r\n");
//返回每次打印的内容
LetteringSocketConnectionAutoRun.write("SETMSG 24 1" + "\r\n");
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void test2() throws IOException {
try {
LetteringSocketConnectionAutoRun.write("BUFFERCLEAR" + "\r\n");
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void test3() throws IOException {
// LOADPROJECT "ZY.lbm"
//此处为模板名称 D310激光机,加载CS.lbm模版
String str = "CS.lbm";
try {
LetteringSocketConnectionAutoRun.write("LOADPROJECT" + " \"" + str + "\"" + "\r\n");
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void test4(Map map) throws IOException {
String name = map.get("name").toString();
String name2 = map.get("name2").toString();
String name3 = map.get("name3").toString();
String name4 = map.get("name4").toString();
String yh = "\"";
try {
//先清空缓存
LetteringSocketConnectionAutoRun.write("BUFFERCLEAR" + "\r\n");
// test5();
// LetteringSocketConnectionAutoRun.write("BUFFERDATA -1 "+ yh + name + yh +" " + yh + name2 + yh +" "
// +yh +name3 +yh + " " + yh + name4 + yh + "\r\n");
//两行
// LetteringSocketConnectionAutoRun.write("BUFFERDATA -1 "+ yh + name + yh +" " + yh + name2 + yh +" "
// + "\r\n");
LetteringSocketConnectionAutoRun.write("BUFFERDATA -1 " + yh + name + yh + " " + "\r\n");
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void test5() throws IOException {
try {
LetteringSocketConnectionAutoRun.write("BUFFERCLEAR" + "\r\n");
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void test6(Map map) throws IOException {
String yh = "\"";
String inst = map.get("inst").toString();
String inst2 = map.get("inst2").toString();
String strInst = "SETTEXT " + "S1" + " " + yh + inst + yh + "\r\n"; //2个变量
String strInst2 = "SETTEXT " + "S2" + " " + yh + inst2 + yh + "\r\n"; //2个变量
LetteringSocketConnectionAutoRun.write(strInst);
LetteringSocketConnectionAutoRun.write(strInst2);
}
@Override
public void test7() throws IOException {
}
@Override
public JSONObject print() throws IOException {
JSONObject jo = new JSONObject();
jo.put("cpbh", "A1111111111");
jo.put("cpmc", "产品名称:A1111111111");
return jo;
}
}

View File

@@ -1,138 +0,0 @@
package org.nl.start.auto.run;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.config.server.impl.AcsConfigServiceImpl;
import org.nl.utils.SpringContextHolder;
import org.springframework.stereotype.Component;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.util.Date;
@Slf4j
@Component
public class LetteringSocketConnectionAutoRun extends AbstractAutoRunnable {
Socket s;
String ip = "127.0.0.1";
int port = 1234;
static DataOutputStream dos;
static DataInputStream dis;
private int recordTimeOut = 10000;
private Date recordTime;
boolean bConnected = true;
public LetteringSocketConnectionAutoRun() {
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
}
public String getCode() {
return LetteringSocketConnectionAutoRun.class.getSimpleName();
}
public String getName() {
return "海亮激光刻字在线连接";
}
public void autoRun() throws IOException {
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigServiceImpl.class);
ip = acsConfigService.findConfigFromCache().get(AcsConfig.LETTERINGURL);
port = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.LETTERINGPORT));
byte[] b = new byte[1028];
s = new Socket(ip, port);
dos = new DataOutputStream(s.getOutputStream());
dis = new DataInputStream(s.getInputStream());
while (bConnected) {
int count = dis.read(b);
if (count == -1) {
break;
}
int[] arr = new int[count];
StringBuffer bs = new StringBuffer();
for (int i = 0; i < count; i++) {
int temp = b[i];
if (temp < 0)
temp += 256;
arr[i] = temp;
bs.append(asciiToString(String.valueOf(temp)));
}
System.out.println("收到请求参数:" + bs);
//打印完成
if (StrUtil.equals(bs.toString(), "MSG 3")) {
}
}
}
public static void write(String str) throws IOException {
System.out.println(str);
dos.write(hexStringToByte(bytesToHexString(stringToByte(str))));
}
public static byte[] stringToByte(String str) {
byte[] bytes = str.getBytes();
return bytes;
}
public static String bytesToHexString(byte[] src) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < src.length; i++) {
int v = src[i] & 0xff;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
builder.append(0);
}
builder.append(hv);
}
return builder.toString().toUpperCase();
}
public static byte[] hexStringToByte(String hex) {
byte[] b = new byte[hex.length() / 2];
int j = 0;
for (int i = 0; i < b.length; i++) {
char c0 = hex.charAt(j++);
char c1 = hex.charAt(j++);
b[i] = (byte) ((parse(c0) << 4) | parse(c1));
}
return b;
}
private static int parse(char c) {
if (c >= 'a')
return (c - 'a' + 10) & 0x0f;
if (c >= 'A')
return (c - 'A' + 10) & 0x0f;
return (c - '0') & 0x0f;
}
/*
* Ascii转换为字符串
*
* @param value
* @return
*/
public static String asciiToString(String value) {
StringBuffer sbu = new StringBuffer();
String[] chars = value.split(",");
for (int i = 0; i < chars.length; i++) {
sbu.append((char) Integer.parseInt(chars[i]));
}
return sbu.toString();
}
public static void main(String[] args) throws UnsupportedEncodingException {
byte[] bytes = "".getBytes("utf-8");
}
}