This commit is contained in:
USER-20220102CG\noblelift
2022-10-27 16:55:02 +08:00
parent 1b7a2db6ea
commit d191833f50
28 changed files with 633 additions and 134 deletions

View File

@@ -15,15 +15,13 @@ public interface AcsConfig {
//撤销任务检查
String CANCELTASKCHECK = "cancelTaskCheck";
//二楼agv系统接口地址
String AGVURL = "agvurl";
String AGVURL2 = "agvurl2";
//一楼agv系统接口地址
String AGVURL2 = "agvurl";
//双工AGV系统端口
String AGVURL = "agvurl";
//AGV系统端口
String AGVPORT = "agvport";
//单工agv系统接口地址
String ONEAGVURL = "oneagvurl";
//单工AGV系统端口
String ONEAGVPORT = "oneagvport";
//二楼AGV系统端口
String AGVPORT2 = "agvport2";
//指定AGV系统
String AGVTYPE = "agvType";
//WMS系统接口地址

View File

@@ -3,6 +3,7 @@ package org.nl.acs.agv.server.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -15,6 +16,7 @@ import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.Empty
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver;
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.LokiLog;
@@ -22,6 +24,8 @@ import org.nl.acs.log.LokiLogType;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.stereotype.Service;
@@ -37,11 +41,14 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
JSONObject jo = new JSONObject();
String start_point_code = inst.getStart_point_code();
String next_point_code = inst.getNext_point_code();
//1、叠盘架追加任务2、养生区需要追加任务在缓存点等待3、二楼普通任务4、一楼普通任务
//1楼AGV普通任务
//2楼AGV普通任务
//2楼AGV起点追加任务
//2楼AGV终点追加任务
String task_type = inst.getInstruction_type();
jo.put("deadline", AgvUtil.getNextDay(1));
//判断是否追加任务
if (task_type.equals("2") || task_type.equals("1")) {
if (task_type.equals("3") || task_type.equals("4")) {
jo.put("complete", "false");
} else {
jo.put("complete", "true");
@@ -49,31 +56,32 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("task_code", inst.getInstruction_code());
//根据任务,下发指令类型
JSONArray destinations = new JSONArray();
if (task_type.equals("1")) {
if (task_type.equals("3")) {
destinations.add(destination(start_point_code, "Wait", "5", "1"));
} else if (task_type.equals("4")) {
destinations.add(destination(start_point_code, "Load", "1", "1"));
destinations.add(destination(next_point_code, "Wait", "5", "1"));
} else {
destinations.add(destination(start_point_code, "Load", "1", "1"));
if (task_type.equals("2")) {
destinations.add(destination(next_point_code, "Wait", "5", "1"));
} else {
destinations.add(destination(next_point_code, "Unload", "5", "1"));
}
destinations.add(destination(next_point_code, "Unload", "1", "1"));
}
jo.put("destinations", destinations);
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String url = "";
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvurl2 = paramService.findByCode(AcsConfig.AGVURL2).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
String agvport2 = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
//不同楼层下发不同的agv系统
if (task_type.equals("8")) {
url = agvurl2;
if (task_type.equals("1")) {
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code();
} else {
url = agvurl;
agvurl = agvurl2 + ":" + agvport2 + "/v1/transportOrders/" + inst.getInstruction_code();
}
url = url + ":" + agvport + "v1/transportOrders/" + inst.getInstruction_code();
log.info("下发agv任务请求:{}", url);
log.info("下发agv任务请求:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(jo))//表单内容
@@ -92,16 +100,17 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
public HttpResponse queryAgvInstStatus(String type) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String agvurl = "";
String agvport = "";
if (type.equals("1")) {
agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
}
if (type.equals("2")) {
agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue();
agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
}
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/transportOrders";
agvurl = agvurl + ":" + agvport + "/v1/transportOrders";
HttpResponse result = HttpRequest.get(agvurl)
.timeout(20000)//超时,毫秒
.execute();
@@ -128,8 +137,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
address = address.substring(0, address.indexOf("-"));
}
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
Instruction inst = instructionService.findByCodeFromCache(jobno);
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
Instruction inst = instructionService.findByCodeFromCache(jobno);
TaskDto task = taskService.findByCode(inst.getTask_code());
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device addressdevice = appService.findDeviceByCode(address);
@@ -233,35 +245,43 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
JSONArray destinations = new JSONArray();
String inst_type = inst.getInstruction_type();
//如果任务类型为1在点位进行等待则查询当前叠盘位的数量取当前数量的层数进行追加任务
if ("1".equals(inst_type)) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber();
if (current_num > 12) {
log.info("当前叠盘架:" + jobno + "已放满!");
return null;
}
String start_point_code = inst.getStart_point_code();
String next_point_code = inst.getNext_point_code();
start_point_code = start_point_code + "." + (current_num + 1);
destinations.add(destination(start_point_code, "Load", "1", "1"));
destinations.add(destination(next_point_code, "Unload", "1", "1"));
// if ("1".equals(inst_type)) {
// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
// int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber();
// if (current_num > 12) {
// log.info("当前叠盘架:" + jobno + "已放满!");
// return null;
// }
// String start_point_code = inst.getStart_point_code();
// String next_point_code = inst.getNext_point_code();
// start_point_code = start_point_code + "." + (current_num + 1);
// destinations.add(destination(start_point_code, "Load", "1", "1"));
// destinations.add(destination(next_point_code, "Unload", "1", "1"));
//
// }
String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code());
JSONObject respjson = JSONObject.parseObject(resp);
if(StrUtil.equals(inst.getInstruction_type(),"3")){
//2楼AGV起点追加任务
String start_device_code = respjson.getString("device_code");
String next_device_code = inst.getNext_device_code();
destinations.add(destination(start_device_code, "load", "1", "1"));
destinations.add(destination(next_device_code, "Unload", "1", "1"));
} else if(StrUtil.equals(inst.getInstruction_type(),"4")){
//2楼AGV终点追加任务
String next_device_code = respjson.getString("device_code");
destinations.add(destination(next_device_code, "Unload", "1", "1"));
}
//如果任务类型为2在点位进行等待则调用LMS的货位申请接口
if ("2".equals(inst_type)) {
String next_point_code = "";
//调用LMS接口
destinations.add(destination(next_point_code, "Unload", "5", "1"));
}
jo.put("destinations", destinations);
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
String url = agvurl + ":" + agvport + "addDestinations";
String url = agvurl + ":" + agvport + "/addDestinations";
log.info("下发agv任务请求:{}", url);
HttpResponse result = HttpRequest.post(url)

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;
@@ -20,6 +21,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
@@ -39,7 +41,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
@@ -310,4 +312,54 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getAction() == 0) {
action = "禁止取放";
} else if (this.getAction() == 1) {
action = "允许取货";
} else if (this.getAction() == 2) {
action = "允许放货";
} else if (this.getAction() == 3) {
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("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -15,6 +16,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
@@ -35,7 +37,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@@ -191,4 +193,46 @@ public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceD
itemMap.put(to_command, value);
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
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("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -15,6 +15,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
@@ -34,7 +35,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@@ -224,4 +225,47 @@ public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver im
itemMap.put(to_command, value);
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
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("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -18,6 +18,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
@@ -38,7 +39,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class HaoKaiAutoConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class HaoKaiAutoConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@@ -233,4 +234,47 @@ public class HaoKaiAutoConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
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("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -15,6 +15,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
@@ -34,7 +35,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@@ -257,4 +258,46 @@ public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implement
itemMap.put(to_command, value);
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
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("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
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.ext.wms.service.impl.AcsToWmsServiceImpl;
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.WcsConfig;
@@ -42,7 +43,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@@ -435,4 +436,46 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
public synchronized boolean apply_InEmpty() throws Exception {
return false;
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
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("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -20,6 +20,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
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.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.WcsConfig;
@@ -42,7 +43,7 @@ import java.util.*;
@Slf4j
@Data
@RequiredArgsConstructor
public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
@@ -835,5 +836,47 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
}
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
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("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -72,7 +72,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
//当前指令
Instruction inst = null;
int heartbeat = 0;
int mode = 0;
int move = 0;
@@ -92,7 +93,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
int last_error = 0;
int last_task = 0;
String last_container;
String inst_message;
String device_code;
String message;
@@ -132,7 +133,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
ScannerDeviceDriver scanner = this.getScanner();
scanner.cleanBarcode();
}
public synchronized boolean finish_instruction() throws Exception {
instructionService.finish(inst);
return true;
}
private ScannerDeviceDriver getScanner() throws Exception {
String scanner_code = (String) this.getDevice().getExtraValue().get(StandardConveyorWithScannerConfig.relation_scanner);
@@ -183,6 +187,21 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (error != last_error) {
}
if (mode == 2 && move != 0 && task > 0) {
//inst_message
inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst != null) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
finish_instruction();
}
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
inst.setInstruction_status("1");
instructionService.update(inst);
}
}
}
} catch (Exception var17) {
return;
}
@@ -552,27 +571,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String io_action = "";
String move = "";
String status = "";
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 = "申请入库";
} else if (this.getMode() == 7) {
mode = "码垛完成";
} else if (this.getMode() == 8) {
mode = "码垛强制完成";
} else if (this.getMode() == 9) {
mode = "工单完成";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getAction() == 0) {
@@ -588,17 +595,18 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (this.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("status", status);
jo.put("io_action", io_action);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());

View File

@@ -15,6 +15,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.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;
@@ -40,7 +41,7 @@ import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@@ -437,5 +438,45 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
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("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_ordinary_site;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -16,6 +17,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
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;
@@ -31,7 +33,7 @@ import java.util.Date;
@Slf4j
@Data
@RequiredArgsConstructor
public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired
@@ -181,5 +183,47 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
}
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
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.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("isOnline", true);
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -1,11 +1,13 @@
package org.nl.acs.device_driver.basedriver.standard_scanner;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.socket.SocketConfig;
import org.nl.acs.udw.UnifiedDataAccessor;
import org.nl.acs.udw.UnifiedDataAccessorFactory;
@@ -15,7 +17,7 @@ import org.nl.acs.udw.UnifiedDataAccessorFactory;
*/
@Slf4j
@Data
public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements ScannerDeviceDriver, DeviceDriver {
public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements ScannerDeviceDriver, DeviceDriver, DeviceStageMonitor {
UnifiedDataAccessor accessor_value;
@@ -59,5 +61,22 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
}
}
@Override
public JSONObject getDeviceStatusName() throws Exception {
JSONObject jo = new JSONObject();
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("isOnline", true);
jo.put("device_type", device.getDevice_type());
//点击弹出
jo.put("is_click", true);
jo.put("ip", this.getIp());
jo.put("container", StrUtil.isEmpty(this.readBarcode()) ? "" : this.readBarcode());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -2,6 +2,7 @@
package org.nl.acs.ext.wms.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -31,6 +32,7 @@ public class WmsToAcsController {
@PostMapping("/task")
@Log("接收WMS任务")
@ApiOperation("接收WMS任务")
@SaIgnore
public ResponseEntity<Object> createFromWms(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.createFromWms(whereJson), HttpStatus.OK);
}

View File

@@ -202,9 +202,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address));
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("task_id", task_id);
jo.put("vehicle_code", vehicle_code);
String result2 = null;
AddressDto addressDto = addressService.findByCode("requestTaskAgain");

View File

@@ -290,15 +290,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
dto.setStart_parent_code(task.getStart_parent_code());
dto.setNext_parent_code(task.getNext_parent_code());
if (StrUtil.equals(task.getTask_type(), "1")) {
dto.setAgv_inst_type("1");
} else if (StrUtil.equals(task.getTask_type(), "2")) {
dto.setAgv_inst_type("2");
} else if (StrUtil.equals(task.getTask_type(), "3")) {
dto.setAgv_inst_type("3");
} else if (StrUtil.equals(task.getTask_type(), "4")) {
dto.setAgv_inst_type("4");
if(ObjectUtil.isNotEmpty(task.getTask_type())){
dto.setInstruction_type(task.getTask_type());
}
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@@ -501,16 +494,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
// != 0 为agv任务
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
/**
* 1 双工agv双任务
* 2 双工agv但认为
* 3 单入-单任务
* 4 双入-双任务
* 5 点对点任务
* 6 称重平台称重PS20 agvtype:1
* 7 不去称重平台称重PS20 agvtype:2
* 8 RT20 agvtype:3
*/
if (StrUtil.equals("1", dto.getInstruction_type())) {
ndcAgvService.sendAgvTwoInstToNDC(dto, dto2);
dto.setSend_status("1");

View File

@@ -12,7 +12,7 @@ public interface DeviceStageMonitor {
* 根据设备获取设备状态(中文名:如故障、联机等)
* @return
*/
public JSONObject getDeviceStatusName();
public JSONObject getDeviceStatusName() throws Exception;
/**
* 根据舞台数据修改设备驱动状态

View File

@@ -31,7 +31,7 @@ public class DeviceStageMonitorController {
@Log("获取舞台设备信息")
@ApiOperation("获取舞台设备信息")
@PostMapping("/getDeviceByCodes")
public ResponseEntity<Object> getDeviceByCodes(@RequestBody String json) {
public ResponseEntity<Object> getDeviceByCodes(@RequestBody String json) throws Exception {
JSONArray jsonArray = JSONArray.parseArray(json);
return new ResponseEntity<>(deviceStageMonitorService.getData(jsonArray), HttpStatus.OK);
}

View File

@@ -14,5 +14,5 @@ public interface DeviceStageMonitorService {
* @param jsonArray 前端传来设备编号和节点的id
* @return
*/
public JSONArray getData(JSONArray jsonArray);
public JSONArray getData(JSONArray jsonArray) throws Exception;
}

View File

@@ -24,7 +24,7 @@ public class DeviceStageMonitorServiceImpl implements DeviceStageMonitorService
@Override
public JSONArray getData(JSONArray jsonArray) {
public JSONArray getData(JSONArray jsonArray) throws Exception {
JSONArray arr = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject obj = new JSONObject();

View File

@@ -829,7 +829,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String compound_task = acsTask.getCompound_task();
String next_point_code = acsTask.getNext_point_code();
String next_device_code = acsTask.getNext_device_code();
String maxInstnumber = paramService.findByCode(AcsConfig.MAXINSTNUMBER).getValue();
/**
* 开始平均分解校验

View File

@@ -58,37 +58,38 @@ public class AutoCreateInst {
if(StrUtil.equals(is_send,"0")){
continue;
}
//校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList)) {
acsTask.setRemark("路由不通无法生成指令");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
continue;
}
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
if(StrUtil.equals(acsTask.getTask_type(),"1") || StrUtil.equals(acsTask.getTask_type(),"2")){
//校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList)) {
acsTask.setRemark("路由不通无法生成指令");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
}
next_device_code = pathlist.get(index);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
continue;
}
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathlist.get(index);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
}
Instruction instdto = new Instruction();

View File

@@ -98,7 +98,7 @@ public class QueryZDAgvTaskStatus {
HttpResponse response2 = agvService.queryAgvInstStatus("2");
//查询AGV指令列表
JSONArray inst_rows2 = JSONArray.parseArray(response.body());
JSONArray inst_rows2 = JSONArray.parseArray(response2.body());
for (int i = 0; i < inst_rows2.size(); i++) {
JSONObject inst_jo = inst_rows2.getJSONObject(i);
String inst_code = inst_jo.getString("task_code");