Merge remote-tracking branch 'origin/master'

# Conflicts:
#	acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error.properties
#	acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_en_US.properties
#	acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_in_ID.properties
#	acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_zh_CN.properties
This commit is contained in:
2024-02-26 16:33:08 +08:00
112 changed files with 895 additions and 338 deletions

View File

@@ -114,4 +114,11 @@ public interface XianGongAgvService {
* 查询场景中指定机器人信息
*/
HttpResponse getRobotInfo(String robotCode);
/**
* 下发叉车运单
* @param dto
* @return
*/
HttpResponse sendOrderSequencesToForklift(Instruction dto);
}

View File

@@ -25,6 +25,8 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.device.enums.DeviceType;
import org.nl.common.exception.BadRequestException;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -53,6 +55,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
@Autowired
private InstructionService instructionService;
@Autowired
private LuceneExecuteLogService luceneExecuteLogService;
@Autowired
private AgvWaitUtil agvWaitUtil;
@@ -251,6 +256,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo.put("blocks", createBlocksData(inst));
//运单优先级
jo.put("priority", inst.getPriority());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code("下发诺宝运单")
.content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发agv订单序列参数:"+jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo);
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -266,6 +276,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
//超时,毫秒
.timeout(20000)
.execute();
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code("诺宝运单响应")
.content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发诺宝订单序列反馈参数:"+jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto1);
log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body());
return result;
@@ -287,15 +302,19 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
String start_point_code = inst.getStart_point_code();
String next_device_code = inst.getNext_device_code();
String next_point_code = inst.getNext_point_code();
sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code);
sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code);
String start_device_code2 = inst.getStart_device_code2();
String start_point_code2 = inst.getStart_point_code2();
String next_device_code2 = inst.getNext_device_code2();
String next_point_code2 = inst.getNext_point_code2();
//起点1
sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code);
//终点1
sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code);
//起点2
if (StrUtil.isNotEmpty(start_device_code2)) {
sendStartDeviceOrder(ja, start_device_code2, start_point_code2, instruction_code);
}
String next_device_code2 = inst.getNext_device_code2();
String next_point_code2 = inst.getNext_point_code2();
//终点2
if (StrUtil.isNotEmpty(next_device_code2)) {
sendEndDeviceOrder(ja, start_device_code2, instruction_code, next_device_code2, next_point_code2);
}
@@ -337,31 +356,36 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo.put("script_args", script_args);
ja.add(jo);
}
//将货物顶起来
//将货物顶起来,机器识别提升高度
JSONObject jo1 = new JSONObject();
jo1.put("blockId", IdUtil.simpleUUID());
jo1.put("location", pointCode);
jo1.put("operation", "JackLoad");
jo1.put("operationArgs", new JSONObject() {{
put("recognize", true);
}});
ja.add(jo1);
//取货完成等待
JSONObject jo2 = new JSONObject();
jo2.put("blockId", IdUtil.simpleUUID());
jo2.put("location", pointCode + "OUTGET");
jo2.put("operation", "script");
jo2.put("id", pointCode + "OUTGET");
jo2.put("script_name", "userpy/interact.py");
JSONObject script_args2 = new JSONObject();
script_args2.put("addr", addr);
JSONObject data2 = new JSONObject();
JSONObject reach2 = new JSONObject();
reach2.put("task_code", instCode);
reach2.put("address", pointCode + "OUTGET");
data2.put("reach", reach2);
script_args2.put("data", data2);
script_args2.put("protocol", "HTTP");
jo2.put("script_args", script_args2);
ja.add(jo2);
if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) {
JSONObject jo2 = new JSONObject();
jo2.put("blockId", IdUtil.simpleUUID());
jo2.put("location", pointCode + "OUTGET");
jo2.put("operation", "script");
jo2.put("id", pointCode + "OUTGET");
jo2.put("script_name", "userpy/interact.py");
JSONObject script_args2 = new JSONObject();
script_args2.put("addr", addr);
JSONObject data2 = new JSONObject();
JSONObject reach2 = new JSONObject();
reach2.put("task_code", instCode);
reach2.put("address", pointCode + "OUTGET");
data2.put("reach", reach2);
script_args2.put("data", data2);
script_args2.put("protocol", "HTTP");
jo2.put("script_args", script_args2);
ja.add(jo2);
}
}
/**
@@ -397,7 +421,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
//放货前下发旋转角度
JSONObject json1 = new JSONObject();
/*JSONObject json1 = new JSONObject();
AcsPointAngle acsPointAngleDto = acsPointAngleService.findByCode(device_code, nextDeviceCode);
if (ObjectUtil.isNotEmpty(acsPointAngleDto)) {
log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString());
@@ -409,7 +433,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
json1.put("location", pointCode + "INPUT");
json1.put("operation_args", operation_args);
ja.add(json1);
}
}*/
//将货物放下
com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject();
@@ -732,4 +756,181 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@Override
public HttpResponse sendOrderSequencesToForklift(Instruction inst) {
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
jo.put("id", inst.getInstruction_code());
//运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块
jo.put("complete", true);
//动作块
jo.put("blocks", createBlocksForklift(inst));
//运单优先级
jo.put("priority", inst.getPriority());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code("下发叉车运单")
.content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发叉车订单序列参数:"+jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo);
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/setOrder";
log.info(agvurl);
HttpResponse result = HttpRequest.post(agvurl)
//表单内容
.body(String.valueOf(jo))
//超时,毫秒
.timeout(20000)
.execute();
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code("叉车运单响应")
.content("任务号:"+inst.getTask_code()+",指令号:"+inst.getInstruction_code()+",下发叉车订单序列反馈参数:"+jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto1);
log.info("任务号:{},指令号{},状态{},下发agv叉车订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body());
return result;
} else {
return null;
}
}
/**
* 叉车运单动作块
* @param inst
* @return
*/
private JSONArray createBlocksForklift(Instruction inst) {
JSONArray ja = new JSONArray();
//起点
Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code());
//忽略取货校验
if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) {
//取货前等待
JSONObject jo = new JSONObject();
//动作块id
jo.put("blockId", IdUtil.simpleUUID());
//目的地名称
jo.put("location", inst.getStart_point_code() + "INGET");
//执行脚本
jo.put("operation", "script");
jo.put("id", inst.getStart_point_code() + "INGET");
//通信脚本,动作前后与现场设备交互的场景
jo.put("script_name", "userpy/interact.py");
JSONObject script_args = new JSONObject();
//更改为现场设备IP及PORT
script_args.put("addr", addr);
JSONObject data = new JSONObject();
JSONObject reach = new JSONObject();
reach.put("task_code", inst.getInstruction_code());
reach.put("address", inst.getStart_point_code() + "INGET");
data.put("reach", reach);
script_args.put("data", data);
script_args.put("protocol", "HTTP");
jo.put("script_args", script_args);
ja.add(jo);
}
//货叉加载货物,会将叉车状态变成载货中
JSONObject jo1 = new JSONObject();
jo1.put("blockId", IdUtil.simpleUUID());
jo1.put("location", inst.getStart_point_code());
jo1.put("operation", "ForkLoad");
//行走高度
jo1.put("start_height", "0.1");
//取货高度
jo1.put("end_height", inst.getStart_height());
//升起信号
jo1.put("operationArgs", new JSONObject() {{
put("recognize", true);
}});
ja.add(jo1);
//取货完成等待
if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) {
JSONObject jo2 = new JSONObject();
jo2.put("blockId", IdUtil.simpleUUID());
jo2.put("location", inst.getStart_point_code() + "OUTGET");
jo2.put("operation", "script");
jo2.put("id", inst.getStart_point_code() + "OUTGET");
jo2.put("script_name", "userpy/interact.py");
JSONObject script_args2 = new JSONObject();
script_args2.put("addr", addr);
JSONObject data2 = new JSONObject();
JSONObject reach2 = new JSONObject();
reach2.put("task_code", inst.getInstruction_code());
reach2.put("address", inst.getStart_point_code() + "OUTGET");
data2.put("reach", reach2);
script_args2.put("data", data2);
script_args2.put("protocol", "HTTP");
jo2.put("script_args", script_args2);
ja.add(jo2);
}
//起点
Device nextDevice = deviceAppService.findDeviceByCode(inst.getNext_device_code());
//忽略放货校验
if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) {
//放货前等待
JSONObject jo3 = new JSONObject();
jo3.put("blockId", IdUtil.simpleUUID());
jo3.put("location", inst.getNext_point_code() + "INPUT");
jo3.put("operation", "script");
jo3.put("id", inst.getNext_point_code() + "INPUT");
jo3.put("script_name", "userpy/interact.py");
JSONObject script_args3 = new JSONObject();
script_args3.put("addr", addr);
JSONObject data3 = new JSONObject();
JSONObject reach3 = new JSONObject();
reach3.put("task_code", inst.getInstruction_code());
reach3.put("address", inst.getNext_point_code() + "INPUT");
data3.put("reach", reach3);
script_args3.put("data", data3);
script_args3.put("protocol", "HTTP");
jo3.put("script_args", script_args3);
ja.add(jo3);
}
//ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中)
JSONObject jo2 = new JSONObject();
jo2.put("blockId", IdUtil.simpleUUID());
jo2.put("location", inst.getStart_point_code());
jo2.put("operation", "ForkUnload");
//行走高度
jo2.put("start_height", "0.2");
//放货高度
jo2.put("end_height", inst.getNext_height());
ja.add(jo2);
//忽略放货校验
if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) {
//放货完成等待
com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject();
jo5.put("blockId", IdUtil.simpleUUID());
jo5.put("location", inst.getNext_point_code() + "OUTPUT");
jo5.put("operation", "script");
jo5.put("id", inst.getNext_point_code() + "OUTPUT");
jo5.put("script_name", "userpy/interact.py");
com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject();
script_args5.put("addr", addr);
com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject();
reach5.put("task_code", inst.getInstruction_code());
reach5.put("address", inst.getNext_point_code() + "OUTPUT");
data5.put("reach", reach5);
script_args5.put("data", data5);
script_args5.put("protocol", "HTTP");
jo5.put("script_args", script_args5);
ja.add(jo5);
}
return ja;
}
}

View File

@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.driver;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -99,7 +100,10 @@ public interface OpcDeviceDriver extends DeviceDriver {
* @return
*/
default Integer getIntegeregerValue(String protocol) {
return (Integer) this.getValue(protocol);
if(ObjectUtil.isEmpty(this.getValue(protocol)) && "heartbeat".equals(protocol)){
return null;
}
return (Integer) (ObjectUtil.isEmpty(this.getValue(protocol)) ? 0 : this.getValue(protocol));
}
/**

View File

@@ -157,7 +157,6 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
@@ -173,6 +172,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
to_onset = this.itemProtocol.getTo_onset();
weight = this.itemProtocol.getWeight();
barcode = this.itemProtocol.getBarcode();
iserror = this.itemProtocol.isError;
// 更新指令状态
@@ -521,7 +521,11 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
try {
this.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号:" + itemMap)
@@ -584,7 +588,9 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
} else if (this.getAction() == 4) {
action = "放货完成";
}
if(error == 0 && iserror){
message = "信号连接异常!";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.blank_manipulator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -99,9 +100,15 @@ public class ItemProtocol {
}
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isNull(value)){
isError = true;
}else if (item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);

View File

@@ -114,6 +114,8 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
move = this.itemProtocol.getItem_move();
action = this.itemProtocol.getItem_action();
error = this.itemProtocol.getItem_error();
iserror = this.itemProtocol.isError;
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
@@ -141,13 +143,12 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
// this.setIserror(true);
// message = "有报警";
// //无报警
} else {
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
}else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
message = "";
Instruction instruction = null;
List toInstructions;

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.green_foil_machine_button;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -44,9 +45,15 @@ public class ItemProtocol {
} ;
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isNull(value)){
isError = true;
}else if (item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -71,6 +71,7 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
public int last_action = 0;
public int last_error = 0;
public String last_task = "";
public String message = "";
Boolean isonline = true;
@@ -95,7 +96,6 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
@Override
public void execute() {
String message = null;
device_code = this.getDeviceCode();
heartbeat = itemProtocol.getItem_heartbeat();
mode = itemProtocol.getItem_mode();
@@ -103,6 +103,15 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
task = itemProtocol.getItem_task();
error = itemProtocol.getItem_error();
action = itemProtocol.getItem_action();
iserror = itemProtocol.isError;
if(mode == 0){
message = "未联机";
}else if (error > 0){
message = "有报警";
}else {
message = "";
}
}
@@ -155,6 +164,9 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
if(error == 0 && iserror){
message = "信号连接异常!";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode ==2 ? "待机": "脱机");
jo.put("action", action == 1 ? "允许取放": "不允许取放");

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -75,9 +76,15 @@ public class ItemProtocol {
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isNull(value)){
isError = true;
}else if (item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -156,6 +156,8 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
currentB = this.itemProtocol.getItem_currentB();
currentC = this.itemProtocol.getItem_currentC();
to_temperature = this.itemProtocol.getItem_to_temperature();
iserror = this.itemProtocol.isError;
if (door != last_door) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号door" + last_door + "->" + door);
}
@@ -266,7 +268,11 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
try {
this.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
@@ -301,6 +307,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
move = "有托盘有货";
jo.put("hasGoods", true);
}
if(error == 0 && iserror){
message = "信号连接异常!";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("temperature", temperature);
jo.put("finish", finish);
@@ -314,9 +323,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
// jo.put("isOnline", this.getIsonline());
// jo.put("error", this.getError());
// jo.put("isError", this.getIserror());
jo.put("message", message);
jo.put("task", this.getTask());
return jo;
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.hongxiang_device;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -123,9 +124,15 @@ public class ItemProtocol {
} ;
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isEmpty(value)){
isError = true;
}else if(item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -104,6 +104,9 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
error = this.itemProtocol.getItem_error();
qty = this.itemProtocol.getItem_qty();
type = this.itemProtocol.getItem_type();
iserror = this.itemProtocol.isError;
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -51,9 +52,15 @@ public class ItemProtocol {
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtils.isNull(value)){
isError = true;
}else if(item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -33,9 +34,15 @@ public class ItemProtocol {
}
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isEmpty(value)){
isError = true;
}else if(item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -58,10 +58,14 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
//工作模式
/**
* 工作模式
*/
int mode = 0;
int last_mode = 0;
//动作信号
/**
* 动作信号
*/
int action = 0;
int last_action = 0;
int heartbeat = 0;
@@ -71,6 +75,7 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
int to_command = 0;
int last_to_command = 0;
String message = "";
Boolean isonline = true;
@@ -95,11 +100,14 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getItem_mode();
heartbeat = this.itemProtocol.getItem_heartbeat();
action = this.itemProtocol.getItem_action();
iserror = this.itemProtocol.isError;
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 2) {
@@ -178,6 +186,9 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
if(iserror){
message = "信号连接异常!";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", "联机");
jo.put("action", action);

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.oven_manipulator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -99,9 +100,15 @@ public class ItemProtocol {
Boolean isonline;
Boolean device_status;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isEmpty(value)){
device_status = true;
}else if(item_heartbeat.equals(protocol)){
device_status = false;
}
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);

View File

@@ -40,6 +40,8 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
@@ -70,6 +72,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
private LimitRegionalService limitRegionalService=SpringContextHolder.getBean(LimitRegionalService.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
//工作模式
int mode = 0;
@@ -156,7 +160,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
@@ -172,6 +175,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
to_onset = this.itemProtocol.getTo_onset();
x_position = this.itemProtocol.getX_position();
y_position = this.itemProtocol.getY_position();
iserror = this.itemProtocol.device_status;
if (to_onset != last_to_onset) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + last_to_onset + "->" + to_onset);
@@ -578,7 +582,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
//创建指令后修改任务状态
@@ -590,19 +598,32 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!";
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(notCreateInstMessage)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!";
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(notCreateInstMessage)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
String msg = "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code());
+ ",指令终点:" + instdto.getNext_device_code();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(msg)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
List list = new ArrayList<>();
Map map = new HashMap();
map.put("code", "to_onset");
@@ -742,8 +763,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
} catch (Exception e) {
isClose = true;
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "检查烘箱是否关门时出现异常:" + e.getMessage());
notCreateInstMessage = "检查烘箱是否关门时出现异常:" + e.getMessage();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(notCreateInstMessage)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
return isClose;
}
@@ -784,7 +809,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int move = hongXiangConveyorDeviceDriver.getMove();
if (mode == 1 && door == 1 && action == 1 && error1 == 0 && move == 1) {
if (this.getNow_steps_type() == 2) {
this.writing("to_command", "2");
ArrayList list = new ArrayList();
Map map = new HashMap();
map.put("to_command", "2");
list.add(map);
this.writing(list);
this.setNow_steps_type(3);
}
} else {
@@ -809,7 +838,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
} else {
if (this.getNow_steps_type() == 2) {
this.writing("to_command", "2");
ArrayList list = new ArrayList();
Map map = new HashMap();
map.put("to_command", "2");
list.add(map);
this.writing(list);
this.setNow_steps_type(3);
}
}
@@ -844,7 +877,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
}
if (this.getNow_steps_type() == 3) {
this.writing("to_command", "3");
ArrayList list = new ArrayList();
Map map = new HashMap();
map.put("to_command", "3");
list.add(map);
this.writing(list);
this.setNow_steps_type(4);
}
}
@@ -966,7 +1003,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
if (lampDevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lampDevice.getDeviceDriver();
logServer.deviceExecuteLog(lampDevice.getDeviceDriver().getDeviceCode(), "", "", "下发报警灯" + lamp + "报警信号");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(lampDevice.getDeviceDriver().getDeviceCode())
.content("下发报警灯" + lamp + "报警信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
lampThreecolorDeviceDriver.writing("to_command", "1");
}
}
@@ -1017,24 +1058,24 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String action = "";
String walk_y = "";
if (this.getMode() == 0) {
mode = "脱机";
mode = LangProcess.msg("universal_off-line");
} else if (this.getMode() == 1) {
mode = "单机";
mode = LangProcess.msg("universal_stand-alone");
} else if (this.getMode() == 2) {
mode = "待机";
mode = LangProcess.msg("universal_standby");
} else if (this.getMode() == 3) {
mode = "运行中";
mode = LangProcess.msg("universal_operation");
}
if (this.getMove() == 0) {
move = "无货";
move = LangProcess.msg("universal_no");
} else if (this.getMove() == 1) {
move = "有货";
move = LangProcess.msg("universal_yes");
}
String requireSucess = "复位";
String requireSucess = LangProcess.msg("mark");
if (this.requireSucess) {
requireSucess = "未复位";
requireSucess = LangProcess.msg("no_mark");
}
jo.put("requireSucess", requireSucess);
if (this.getAction() == 1) {
@@ -1046,7 +1087,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} else if (this.getAction() == 4) {
action = "放货完成";
}
if(error == 0 && iserror){
this.setMessage(LangProcess.msg("universal_message4"));
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
@@ -1085,7 +1128,16 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Map<String, Object> itemMap = new HashMap<String, Object>();
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();
}
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.plug_pull_device_site;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -122,10 +123,17 @@ public class ItemProtocol {
public int getTo_location() {
return this.getOpcIntegerValue(item_to_location);
}
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtils.isNull(value)){
isError = true;
}else if (item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -26,6 +26,7 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.config.language.LangProcess;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -152,7 +153,6 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
@Override
public void execute() {
String message = null;
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
@@ -538,12 +538,16 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
move = "有托盘有货";
jo.put("hasGoods", true);
}
if(this.itemProtocol.getIsError() && error == 0){
this.setMessage(LangProcess.msg("universal_message4"));
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
return jo;
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.pull_head_manipulator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -141,11 +142,16 @@ public class ItemProtocol {
}
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isEmpty(value)){
isError = true;
}else if(item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);

View File

@@ -173,7 +173,6 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
@@ -600,7 +599,12 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} else if (this.getAction() == 4) {
action = "放货完成";
}
if(error == 0 && this.itemProtocol.isError){
message = "信号连接异常!";
iserror = true;
}else if(error == 0 && !this.itemProtocol.isError){
iserror = false;
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.pull_tail_manipulator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -104,11 +105,16 @@ public class ItemProtocol {
}
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isEmpty(value)){
isError = true;
}else if (item_heartbeat.equals(protocol)) {
isError = false;
}
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);

View File

@@ -152,7 +152,6 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
@@ -602,7 +601,12 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} else if (this.getAction() == 4) {
action = "放货完成";
}
if(error == 0 && this.itemProtocol.isError){
message = "信号连接异常!";
iserror = true;
}else if(error == 0 && !this.itemProtocol.isError){
iserror = false;
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.two_conveyor.slit_two_manipulator;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -116,11 +117,16 @@ public class ItemProtocol {
}
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtils.isNull(value)){
isError = true;
}else if(item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);

View File

@@ -29,6 +29,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -147,7 +148,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
@Override
public synchronized void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
@@ -193,6 +193,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} else {
this.setIsonline(true);
this.setIserror(false);
message = "运行中";
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
@@ -709,8 +710,15 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (this.requireSucess) {
requireSucess = CommonFinalParam.ONE;
}
if(error == 0){
if(this.itemProtocol.isError){
this.setMessage(LangProcess.msg("universal_message4"));
iserror = true;
}else{
iserror = false;
}
}
jo.put("requireSucess", requireSucess);
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move_1", move_1);
@@ -723,6 +731,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
jo.put("isError", this.getIserror());
jo.put("is_disable1", this.getIs_disable());
jo.put("is_disable", is_disable);
jo.put("message", message);
jo.put("is_click", true);
jo.put("driver_type", "slit_two_manipulator");
jo.put("notCreateTaskMessage", notCreateTaskMessage);

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.two_conveyor.sub_roll_conveyor_site;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -78,9 +79,15 @@ public class ItemProtocol {
}
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtils.isNull(value)){
isError = true;
}else if(item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -123,7 +123,6 @@ public class SubRollConveyorSiteDeviceDriver extends AbstractOpcDeviceDriver imp
@Override
public void execute() {
String message = null;
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
@@ -241,6 +240,14 @@ public class SubRollConveyorSiteDeviceDriver extends AbstractOpcDeviceDriver imp
move = "有货";
jo.put("hasGoods", true);
}
if(error == 0){
if(this.itemProtocol.isError){
iserror = true;
message = "信号连接异常!";
}else{
iserror = false;
}
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.subvolume_weighing_station;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -48,9 +49,15 @@ public class ItemProtocol {
} ;
Boolean isonline;
Boolean isError;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isNull(value)){
isError = true;
}else if(item_heartbeat.equals(protocol)){
isError = false;
}
if (value == null) {
setIsonline(false);
} else {

View File

@@ -32,7 +32,9 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
@@ -343,12 +345,19 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override
public Instruction findByTaskid(String id, String wherecaluse) {
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
/*LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InstructionMybatis::getTask_id, id);
wrapper.apply(StringUtils.isNotBlank(wherecaluse), wherecaluse);
InstructionMybatis ins = instructionMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(ins)) {
return ConvertUtil.convert(ins, Instruction.class);
}*/
if(instructions.size() > 0){
List<Instruction> collect = instructions.stream().filter(instruction -> instruction.getTask_id().equals(id)
&& Integer.parseInt(instruction.getInstruction_status()) < 2).collect(Collectors.toList());
if(collect.size() > 0){
return collect.get(0);
}
}
return null;
}
@@ -358,7 +367,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
dto = foramte(dto);
String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code);
if(regional(dto.getStart_device_code(), dto.getNext_device_code())){
throw new BadRequestException(LangProcess.msg("error_regional_max"));
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
@@ -440,7 +451,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException(LangProcess.msg("error_isNull", "route"));
}
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.TWO)) {
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
if (!StrUtil.equals(task.getAgv_system_type(), "0")
&& ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
@@ -470,7 +481,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
}
//判断是否是仙工AGV
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "3")) {
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.ONE)) {
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code());
if (StrUtil.equals(task.getRequest_again_success(), "1")) {
//追加订单
HttpResponse result = xiangGongAgvService.addOrderSequences(dto);
@@ -479,6 +491,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else {
dto.setSend_status("1");
}
//仙工叉车
} else if (deviceByCode.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto);
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
dto.setSend_status("2");
} else {
dto.setSend_status("1");
}
} else {
//创建运单序列
HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto);
@@ -489,9 +509,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
}
}
Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
String startRegion = startdevice.getRegion();
String nextRegion = nextdevice.getRegion();
} catch (Exception e) {
dto.setSend_status("2");
e.printStackTrace();
@@ -1715,5 +1732,84 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.isEmpty();
}
private boolean regional( String start_device_code, String next_device_code) {
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
String startRegion = startdevice.getRegion();
String nextRegion = nextdevice.getRegion();
int count = 0;
boolean startRegionalExit = true;
boolean nextRegionalExit = true;
//控制指令生成
LimitRegionalDto limitRegionalDtos = limitRegionalService.selectByReging(startRegion, nextRegion);
if (ObjectUtil.isNotEmpty(limitRegionalDtos)) {
String next_exclude_device = limitRegionalDtos.getNext_exclude_device();
if (StrUtil.isNotEmpty(next_exclude_device)) {
String content = next_exclude_device.substring(1, next_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list1 = Arrays.asList(array);
for (String s : list1) {
if (s.equals(next_device_code)) {
nextRegionalExit = false;
}
}
}
String start_exclude_device = limitRegionalDtos.getStart_exclude_device();
if (StrUtil.isNotEmpty(start_exclude_device)) {
String content = start_exclude_device.substring(1, start_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list1 = Arrays.asList(array);
for (String s : list1) {
if (s.equals(start_device_code)) {
startRegionalExit = false;
}
}
}
}
if (ObjectUtil.isNotEmpty(limitRegionalDtos) && (startRegionalExit || nextRegionalExit)) {
List<Instruction> instructiones = instructions.stream().filter(instruction -> Integer.parseInt(instruction.getInstruction_status()) <= 1).collect(Collectors.toList());
for (Instruction instructionMybati : instructiones) {
Device startDevice = deviceAppService.findDeviceByCode(instructionMybati.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instructionMybati.getNext_device_code());
if ((StrUtil.isNotEmpty(startDevice.getRegion()) ? startDevice.getRegion() : "0").equals(startRegion) && (StrUtil.isNotEmpty(nextDevice.getRegion()) ? nextDevice.getRegion() : "0").equals(nextRegion)) {
String start_exclude_device = limitRegionalDtos.getStart_exclude_device();
if (StrUtil.isNotEmpty(start_exclude_device)) {
String content = start_exclude_device.substring(1, start_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list1 = Arrays.asList(array);
for (String s : list1) {
if (s.equals(instructionMybati.getStart_device_code())) {
startRegionalExit = false;
}
}
}
String next_exclude_device = limitRegionalDtos.getNext_exclude_device();
if (StrUtil.isNotEmpty(next_exclude_device)) {
String content = next_exclude_device.substring(1, next_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list2 = Arrays.asList(array);
for (String s : list2) {
if (s.equals(instructionMybati.getNext_device_code())) {
nextRegionalExit = false;
}
}
}
if (startRegionalExit || nextRegionalExit) {
++count;
}
if (count >= Integer.parseInt(limitRegionalDtos.getMax_num())) {
log.info("同区域指令数量过多,等待指令完成再此创建");
return true;
}
}
}
}
return false;
}
}

View File

@@ -199,9 +199,12 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
if (true) {
this.logItemChanged(itemId, accessor_value, value, itemDto);
}
if(!ObjectUtil.isEmpty(value)){
if(!ObjectUtil.isEmpty(value) || "".equals(value)){
accessor_value.setValue(itemId, value);
}
if(ObjectUtil.isEmpty(value) && !"".equals(value)){
accessor_value.removeValue(itemId);
}
}
}

View File

@@ -29,6 +29,12 @@ public interface UnifiedDataAccessor {
*/
void setValue(String key, Object value);
/**
* 删除值
* @param key
*/
void removeValue(String key);
/**
* 获取统一数据
*

View File

@@ -39,6 +39,11 @@ public class UnifiedDataAccessorImpl implements UnifiedDataAccessor {
this.unifiedDataAppService.setValue(this.unified_key, key, value);
}
@Override
public void removeValue( String key) {
this.unifiedDataAppService.removeValue(this.unified_key, key);
}
@Override
public void setValueWithPersistence(String key, Object value) {
this.unifiedDataAppService.setValueWithPersistence(this.unified_key, key, value);

View File

@@ -25,6 +25,9 @@ import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.lucene.service.impl.LuceneExecuteLogServiceImpl;
import org.springframework.stereotype.Component;
import java.util.Arrays;
@@ -47,6 +50,7 @@ public class AutoCreateInst {
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
LimitRegionalService limitRegionalService = SpringContextHolder.getBean(LimitRegionalService.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogServiceImpl.class);
List<TaskDto> list = taskserver.queryAllByStatus("0");
for (int i = 0; i < list.size(); i++) {
TaskDto acsTask = list.get(i);
@@ -96,7 +100,7 @@ public class AutoCreateInst {
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && !StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.TWO)) {
continue;
}
@@ -182,86 +186,16 @@ public class AutoCreateInst {
} else {
instdto.setAgv_inst_type("4");
}
Device startdevice = appService.findDeviceByCode(start_device_code);
Device nextdevice = appService.findDeviceByCode(next_device_code);
String startRegion = startdevice.getRegion();
String nextRegion = nextdevice.getRegion();
int count = 0;
boolean startRegionalExit = true;
boolean nextRegionalExit = true;
//控制指令生成
LimitRegionalDto limitRegionalDtos = limitRegionalService.selectByReging(startRegion, nextRegion);
if (ObjectUtil.isNotEmpty(limitRegionalDtos)) {
String next_exclude_device = limitRegionalDtos.getNext_exclude_device();
if (StrUtil.isNotEmpty(next_exclude_device)) {
String content = next_exclude_device.substring(1, next_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list1 = Arrays.asList(array);
for (String s : list1) {
if (s.equals(next_device_code)) {
nextRegionalExit = false;
}
}
}
String start_exclude_device = limitRegionalDtos.getStart_exclude_device();
if (StrUtil.isNotEmpty(start_exclude_device)) {
String content = start_exclude_device.substring(1, start_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list1 = Arrays.asList(array);
for (String s : list1) {
if (s.equals(start_device_code)) {
startRegionalExit = false;
}
}
}
}
if (ObjectUtil.isNotEmpty(limitRegionalDtos) && (startRegionalExit || nextRegionalExit)) {
List<InstructionMybatis> instructionMybatis = instructionService.list(Wrappers.lambdaQuery(InstructionMybatis.class).le(InstructionMybatis::getInstruction_status, 1));
for (InstructionMybatis instructionMybati : instructionMybatis) {
Device startDevice = appService.findDeviceByCode(instructionMybati.getStart_device_code());
Device nextDevice = appService.findDeviceByCode(instructionMybati.getNext_device_code());
if ((StrUtil.isNotEmpty(startDevice.getRegion()) ? startDevice.getRegion() : "0").equals(startRegion) && (StrUtil.isNotEmpty(nextDevice.getRegion()) ? nextDevice.getRegion() : "0").equals(nextRegion)) {
String start_exclude_device = limitRegionalDtos.getStart_exclude_device();
if (StrUtil.isNotEmpty(start_exclude_device)) {
String content = start_exclude_device.substring(1, start_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list1 = Arrays.asList(array);
for (String s : list1) {
if (s.equals(instructionMybati.getStart_device_code())) {
startRegionalExit = false;
}
}
}
String next_exclude_device = limitRegionalDtos.getNext_exclude_device();
if (StrUtil.isNotEmpty(next_exclude_device)) {
String content = next_exclude_device.substring(1, next_exclude_device.length() - 1);
boolean contains = content.contains(",");
String[] array = contains ? content.split(",") : new String[]{content};
List<String> list2 = Arrays.asList(array);
for (String s : list2) {
if (s.equals(instructionMybati.getNext_device_code())) {
nextRegionalExit = false;
}
}
}
if (startRegionalExit || nextRegionalExit) {
++count;
}
if (count >= Integer.parseInt(limitRegionalDtos.getMax_num())) {
log.info("同区域指令数量过多,等待指令完成再此创建");
return;
}
}
}
}
try {
instructionService.create(instdto);
} catch (Exception e) {
acsTask.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(acsTask);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code("定时创建指令失败")
.content(e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
continue;
}
//创建指令后修改任务状态

View File

@@ -26,3 +26,4 @@ error_sysLimit=\u8BBF\u95EE\u6B21\u6570\u9650\u5236\!
zh_device_name_isNotNull = \u4E2D\u6587\u8BBE\u5907\u540D\u79F0\u4E0D\u80FD\u4F4D\u7A7A
error_not_configured=\u5B57\u5178\u8868\u672A\u914D\u7F6E\u5BF9\u5E94\u7684\u62A5\u8B66\u4FE1\u606F
error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF\uFF01
error_regional_max=\u533A\u57DF\u6307\u4EE4\u6570\u91CF\u5DF2\u6700\u5927\u503C

View File

@@ -26,4 +26,5 @@ error_sysLimit=Access limit\!
zh_device_name_isNotNull = Chinese device name cannot be empty\!
error_not_configured=The dictionary table is not configured with alarm information
error_creat_route=The route already exists!
error_regional_max=Maximum limit for regional instructions reached

View File

@@ -26,3 +26,4 @@ error_sysLimit=Batas akses\!
zh_device_name_isNotNull= Nama perangkat dalam bahasa Cina tidak boleh kosong!
error_not_configured=Informasi alarm tak dikonfigurasi dari tabel kamus
error_creat_route=Itu sudah ada!
error_regional_max=Jumlah maksimum instruksi wilayah telah tercapai

View File

@@ -26,4 +26,5 @@ error_sysLimit=\u8BBF\u95EE\u6B21\u6570\u9650\u5236\!
zh_device_name_isNotNull = \u4E2D\u6587\u8BBE\u5907\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A
error_not_configured=\u5B57\u5178\u8868\u672A\u914D\u7F6E\u5BF9\u5E94\u7684\u62A5\u8B66\u4FE1\u606F
error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF\uFF01
error_regional_max=\u533A\u57DF\u6307\u4EE4\u6570\u91CF\u5DF2\u6700\u5927\u503C

View File

@@ -18,11 +18,14 @@ universal_notCreateInstMessage=\u672A\u627E\u5230\u5173\u8054\u8BBE\u5907\u7684\
universal_message1=\u653E\u8D27\u5B8C\u6210
universal_message2=\u653E\u8D27\u5931\u8D25
universal_message3=\u6709\u62A5\u8B66
universal_message4=信号连接异常!
universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001
universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001
universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001
universal_feedMessage4=\u5F53\u524D\u4E0A\u62A5\u4EFB\u52A1\u53F7(task)\u4E0D\u5E94\u8BE5\u4E3A0
universal_feedMessage5=\u884C\u67B6\u673A\u68B0\u624B
mark=复位
no_mark=未复位

View File

@@ -18,8 +18,11 @@ universal_notCreateInstMessage=Instructions cannot be created because the task f
universal_message1=Release completed
universal_message2=Delivery failure
universal_message3=Have an alarm
universal_message4=Signal connection abnormal
universal_feedMessage1=mode is not in the running state
universal_feedMessage2=action signal (action signal) is not a release completed status
universal_feedMessage3=Photoelectric signal (move) is not out of stock
universal_feedMessage4=The current report task number (task) should not be 0
universal_feedMessage5=Gantry manipulator
mark=Reset
no_mark=Unreset

View File

@@ -18,8 +18,11 @@ universal_notCreateInstMessage=Misi untuk divais yang diasosiasikan tidak ditemu
universal_message1=Pengiriman selesai
universal_message2=Gagal memasukkan barang
universal_message3=Alarm berbunyi
universal_message4=Koneksi sinyal abnormal
universal_feedMessage1=Mode kerja tidak untuk mode dalam mode
universal_feedMessage2=Sinyal aksi tidak lengkap untuk penempatan
universal_feedMessage3=tidak ada status pengiriman
universal_feedMessage4=Tugaskan tugaskan tugaskan bukan hanya 0
universal_feedMessage5=Pengemudi-mekanik line
mark=Setel ulang
no_mark=Belum diatur ulang

View File

@@ -18,8 +18,11 @@ universal_notCreateInstMessage=\u672A\u627E\u5230\u5173\u8054\u8BBE\u5907\u7684\
universal_message1=\u653E\u8D27\u5B8C\u6210
universal_message2=\u653E\u8D27\u5931\u8D25
universal_message3=\u6709\u62A5\u8B66
universal_message4=信号连接异常!
universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001
universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001
universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001
universal_feedMessage4=\u5F53\u524D\u4E0A\u62A5\u4EFB\u52A1\u53F7(task)\u4E0D\u5E94\u8BE5\u4E3A0
universal_feedMessage5=\u884C\u67B6\u673A\u68B0\u624B
mark=复位
no_mark=未复位