add:三色灯
This commit is contained in:
@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api(tags = "仙工AGV")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
@RequestMapping("/api")
|
||||
public class XianGongAgvController {
|
||||
|
||||
private final XianGongAgvService agvService;
|
||||
@@ -33,4 +34,20 @@ public class XianGongAgvController {
|
||||
public ResponseEntity<JSONObject> xgAGVWaitPointRequest(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(agvService.xgAGVWaitPointRequest(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping ("/acquireBlockGroup")
|
||||
@Log("占用互斥组")
|
||||
@ApiOperation("占用互斥组")
|
||||
public ResponseEntity<JSONObject> getBlockGroup(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(agvService.getBlockGroup(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping ("/releaseBlockGroup")
|
||||
@Log("释放互斥组")
|
||||
@ApiOperation("释放互斥组")
|
||||
public ResponseEntity<JSONObject> releaseBlockGroup(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(agvService.releaseBlockGroup(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||
import org.nl.acs.device_driver.sdk.PhotoelectricDetectionDeviceDriver;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -25,6 +27,8 @@ public class AgvWaitUtil {
|
||||
private DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
private DeviceExecuteLogService deviceExecuteLogService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
//取货前等待
|
||||
public JSONObject waitInGet(String deviceCode) {
|
||||
@@ -36,9 +40,13 @@ public class AgvWaitUtil {
|
||||
throw new BadRequestException("请求失败,未找到设备!");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof PhotoelectricDetectionDeviceDriver) {
|
||||
PhotoelectricDetectionDeviceDriver driver = (PhotoelectricDetectionDeviceDriver) device.getDeviceDriver();
|
||||
if (driver.getMove() == 1) {
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
// 标准版输送线驱动
|
||||
StandardCoveyorControlDeviceDriver driver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
// 通知输送线申请取货-1
|
||||
driver.writing(1);
|
||||
// 判断是否满足条件:action = 1(允许取货) && move = 1(有货)
|
||||
if (driver.getMove() == 1 && driver.getAction() == 1) {
|
||||
String message = "允许AGV取货。";
|
||||
driver.setMessage(message);
|
||||
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
|
||||
@@ -71,8 +79,11 @@ public class AgvWaitUtil {
|
||||
throw new BadRequestException("请求失败,未找到设备!");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof PhotoelectricDetectionDeviceDriver) {
|
||||
PhotoelectricDetectionDeviceDriver driver = (PhotoelectricDetectionDeviceDriver) device.getDeviceDriver();
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
// 标准版输送线驱动
|
||||
StandardCoveyorControlDeviceDriver driver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
// 通知输送线取货完成-2
|
||||
driver.writing(2);
|
||||
if (driver.getMove() == 0) {
|
||||
String message = "允许AGV取货后离开。";
|
||||
driver.setMessage(message);
|
||||
@@ -99,7 +110,7 @@ public class AgvWaitUtil {
|
||||
}
|
||||
|
||||
//放货前等待
|
||||
public JSONObject waitInPut(String deviceCode) {
|
||||
public JSONObject waitInPut(String deviceCode,TaskDto taskDto) {
|
||||
log.info("仙工AGV请求放货,设备号 - {}", deviceCode);
|
||||
boolean flag = false;
|
||||
|
||||
@@ -108,17 +119,26 @@ public class AgvWaitUtil {
|
||||
throw new BadRequestException("请求失败,未找到设备!");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof PhotoelectricDetectionDeviceDriver) {
|
||||
PhotoelectricDetectionDeviceDriver driver = (PhotoelectricDetectionDeviceDriver) device.getDeviceDriver();
|
||||
if (driver.getMove() == 0) {
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
// 标准版输送线驱动
|
||||
StandardCoveyorControlDeviceDriver driver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
// 通知输送线申请放货-3
|
||||
driver.writing(3);
|
||||
// 判断是否满足条件:action = 2(允许放货) && move = 0(无货)
|
||||
if (driver.getMove() == 0 && driver.getAction() == 2) {
|
||||
String message = "允许AGV放货。";
|
||||
driver.setMessage(message);
|
||||
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
|
||||
flag = true;
|
||||
|
||||
if (taskDto.getIs_vehicle().equals("1")) {
|
||||
// 获取当前母载具号
|
||||
taskDto.setVehicle_code(driver.getBarcode());
|
||||
taskService.update(taskDto);
|
||||
}
|
||||
|
||||
} else {
|
||||
String message = "光电信号有货,不允许放货!";
|
||||
driver.setMessage(message);
|
||||
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
|
||||
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", "光电信号为:" + driver.getMove());
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
@@ -146,15 +166,20 @@ public class AgvWaitUtil {
|
||||
throw new BadRequestException("请求失败,未找到设备!");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof PhotoelectricDetectionDeviceDriver) {
|
||||
PhotoelectricDetectionDeviceDriver driver = (PhotoelectricDetectionDeviceDriver) device.getDeviceDriver();
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
// 标准版输送线驱动
|
||||
StandardCoveyorControlDeviceDriver driver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
// 通知输送线放货完成-4
|
||||
driver.writing(4);
|
||||
if (driver.getMove() == 1) {
|
||||
String message = "允许AGV放货完成离开。";
|
||||
String message = "允许AGV放货后离开。";
|
||||
driver.setMessage(message);
|
||||
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
|
||||
flag = true;
|
||||
} else {
|
||||
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", "光电信号为:" + driver.getMove() + ",不允许AGV放货完成离开!");
|
||||
String message = "光电信号有货,不允许AGV放货后离开。";
|
||||
driver.setMessage(message);
|
||||
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.nl.acs.agv.server;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
@@ -91,10 +90,9 @@ public interface XianGongAgvService {
|
||||
* 占用互斥组
|
||||
*
|
||||
* @param reqParam
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T> UnifiedResponse<T> getBlockGroup(JSONObject reqParam);
|
||||
JSONObject getBlockGroup(JSONObject reqParam);
|
||||
|
||||
/**
|
||||
* 查询互斥组状态
|
||||
@@ -110,10 +108,9 @@ public interface XianGongAgvService {
|
||||
* 释放互斥组
|
||||
*
|
||||
* @param reqParam
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T> UnifiedResponse<T> releaseBlockGroup(JSONObject reqParam);
|
||||
JSONObject releaseBlockGroup(JSONObject reqParam);
|
||||
|
||||
|
||||
/**
|
||||
@@ -167,4 +164,14 @@ public interface XianGongAgvService {
|
||||
* @return
|
||||
*/
|
||||
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam);
|
||||
|
||||
/**
|
||||
* 下发运单急停
|
||||
*
|
||||
* @param requestParam
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public <T> UnifiedResponse<T> sendOrderStopToXZ(JSONObject requestParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ import org.nl.acs.agv.server.AgvWaitUtil;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.xg.XgHttpUtil;
|
||||
@@ -130,15 +132,78 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> UnifiedResponse<T> getBlockGroup(JSONObject reqParam) {
|
||||
String path = "/getBlockGroup";
|
||||
return xgHttpUtil.sendPostRequest(path, reqParam);
|
||||
public JSONObject getBlockGroup(JSONObject reqParam) {
|
||||
log.info("getBlockGroup收到AGV请求参数:{}", reqParam.toString());
|
||||
// 需返回参数
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// 根据设备号获取对应的设备
|
||||
Device device = deviceAppService.findDeviceByCode(reqParam.getString("block_group_id"));
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("设备号 " + reqParam.getString("block_group_id") + " 不存在!");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
|
||||
// 三色灯驱动
|
||||
LampThreecolorDeviceDriver driver = (LampThreecolorDeviceDriver) device.getDeviceDriver();
|
||||
// 给三色灯写入进入命令0-离开,1-进入
|
||||
driver.writing(1,3);
|
||||
|
||||
// 判断是否允许进入 1-允许,0-不允许
|
||||
if (driver.getAction() == 1) {
|
||||
// 记录车号
|
||||
driver.setCar_no(reqParam.getString("robot_name"));
|
||||
|
||||
result.put("code", 200);
|
||||
result.put("message", "ok");
|
||||
} else {
|
||||
result.put("code", 400);
|
||||
result.put("message", "ok");
|
||||
}
|
||||
} else {
|
||||
result.put("code", 400);
|
||||
result.put("message", "ok");
|
||||
}
|
||||
log.info("getBlockGroup反馈AGV输出参数:{}", result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> UnifiedResponse<T> releaseBlockGroup(JSONObject reqParam) {
|
||||
String path = "/releaseBlockGroup";
|
||||
return xgHttpUtil.sendPostRequest(path, reqParam);
|
||||
public JSONObject releaseBlockGroup(JSONObject reqParam) {
|
||||
log.info("releaseBlockGroup收到AGV请求参数:{}", reqParam.toString());
|
||||
// 需返回参数
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// 根据设备号获取对应的设备
|
||||
Device device = deviceAppService.findDeviceByCode(reqParam.getString("block_group_id"));
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("设备号 " + reqParam.getString("block_group_id") + " 不存在!");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
|
||||
// 三色灯驱动
|
||||
LampThreecolorDeviceDriver driver = (LampThreecolorDeviceDriver) device.getDeviceDriver();
|
||||
// 给三色灯写入进入命令0-离开,1-进入
|
||||
driver.writing(0,Integer.parseInt(device.getExtraValue().get("color").toString()));
|
||||
|
||||
// 判断是否允许离开 1-允许,0-不允许
|
||||
if (driver.getAction() == 1) {
|
||||
// 判断是否清楚车号
|
||||
if (device.getExtraValue().get("color").toString().equals("1")) {
|
||||
driver.setCar_no("");
|
||||
}
|
||||
result.put("code", 200);
|
||||
result.put("message", "ok");
|
||||
} else {
|
||||
result.put("code", 400);
|
||||
result.put("message", "ok");
|
||||
}
|
||||
} else {
|
||||
result.put("code", 400);
|
||||
result.put("message", "ok");
|
||||
}
|
||||
log.info("releaseBlockGroup反馈AGV输出参数:{}", result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -830,7 +895,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
if (address.contains("GET")) {
|
||||
return agvWaitUtil.waitInGet(deviceCodeNow);
|
||||
} else if (address.contains("PUT")) {
|
||||
return agvWaitUtil.waitInPut(deviceCodeNow);
|
||||
return agvWaitUtil.waitInPut(deviceCodeNow,task);
|
||||
}
|
||||
}
|
||||
if (address.contains("OUT")) {
|
||||
@@ -849,6 +914,12 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> UnifiedResponse<T> sendOrderStopToXZ(JSONObject json) {
|
||||
String path = "/gotoSitePause";
|
||||
return xgHttpUtil.sendPostRequest(path, json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 叉车运单动作块
|
||||
*
|
||||
|
||||
@@ -15,7 +15,8 @@ public enum DriverTypeEnum {
|
||||
XIANGONG_AGV_DEVICE_DRIVER(4, "xg_agv", "仙工AGV", "agv"),
|
||||
RGV_DEVICE_DRIVER(5, "rgv_station", "RGV", "rgv"),
|
||||
ELEVATOR_DRIVER(6, "standard_elevator", "电梯", "elevator"),
|
||||
CONVEYOR_CONTROL(7, "standard_conveyor_control", "标准版-输送线", "conveyor");
|
||||
CONVEYOR_CONTROL(7, "standard_conveyor_control", "标准版-输送线", "conveyor"),
|
||||
CONVEYOR_COLOR(8, "lamp_three_color", "标准版-三色灯", "color");
|
||||
//驱动索引
|
||||
private int index;
|
||||
//驱动编码
|
||||
|
||||
@@ -23,6 +23,7 @@ public class ItemProtocol {
|
||||
public static String item_direction = "direction";
|
||||
public static String item_operation_type = "operation_type";
|
||||
public static String item_task = "task";
|
||||
public static String item_barcode = "barcode";
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
@@ -39,6 +40,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public String getBarcode() {
|
||||
return this.getOpcStringValue(item_barcode);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
@@ -95,6 +100,15 @@ public class ItemProtocol {
|
||||
return 0;
|
||||
|
||||
}
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (value == null) {
|
||||
//throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)});
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static List<ItemDTO> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
@@ -79,6 +79,8 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int move = 0;
|
||||
int action = 0;
|
||||
String barcode = null;
|
||||
int task = 0;
|
||||
//出入库模式
|
||||
int operation_type = 0;
|
||||
@@ -155,6 +157,8 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
task = this.itemProtocol.getTask();
|
||||
action = this.itemProtocol.getAction();
|
||||
barcode = this.itemProtocol.getBarcode();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
operation_type = this.itemProtocol.getOperation_type();
|
||||
if (mode != last_mode) {
|
||||
@@ -169,7 +173,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
if (error != last_error) {
|
||||
}
|
||||
|
||||
if (mode == 2 && move != 0 && task > 0) {
|
||||
/* if (mode == 2 && move != 0 && task > 0) {
|
||||
//inst_message
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
@@ -182,7 +186,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
@@ -214,9 +218,6 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
break;
|
||||
case 2:
|
||||
//申请任务
|
||||
if (!StrUtil.isBlank(material) && !StrUtil.isBlank(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
||||
this.instruction_require(container);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
||||
@@ -227,18 +228,9 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
break;
|
||||
case 5:
|
||||
//申请空盘
|
||||
if (move == 0 && !requireSucess) {
|
||||
apply_OutEmpty();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
//申请入库
|
||||
if (move != 0 && !applySucess) {
|
||||
instruction_apply();
|
||||
}
|
||||
if (move != 0 && !requireSucess) {
|
||||
apply_InEmpty();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ public class ItemProtocol {
|
||||
public static String item_mode = "mode";
|
||||
public static String item_action = "action";
|
||||
public static String item_error = "error";
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_command = "toCommand";
|
||||
public static String item_to_color = "toColor";
|
||||
public static String item_color = "color";
|
||||
|
||||
|
||||
private LampThreecolorDeviceDriver driver;
|
||||
@@ -25,6 +27,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.getOpcIntegerValue(item_color);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
@@ -57,14 +63,16 @@ public class ItemProtocol {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDTO(item_heartbeat, "心跳", "DB51.B0"));
|
||||
list.add(new ItemDTO(item_mode, "工作模式", "DB51.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDTO(item_action, "动作信号", "DB51.B2"));
|
||||
list.add(new ItemDTO(item_action, "是否允许进入", "DB51.B2"));
|
||||
list.add(new ItemDTO(item_error, "报警信号", "DB51.B4"));
|
||||
list.add(new ItemDTO(item_color, "颜色", "DB51.B5"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDTO> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDTO(item_to_command, "作业命令", "DB52.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDTO(item_to_color, "颜色", "DB52.W3", Boolean.valueOf(true)));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,12 +55,7 @@ public class LampThreecolorDefinition implements OpcDeviceDriverDefinition {
|
||||
}
|
||||
|
||||
public static List<ItemDTO> getReadableItemDtos2() {
|
||||
List<ItemDTO> list = new ArrayList();
|
||||
list.add(new ItemDTO(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
|
||||
list.add(new ItemDTO(ItemProtocol.item_mode, "工作模式", "DB600.B1", true));
|
||||
list.add(new ItemDTO(ItemProtocol.item_action, "动作信号", "DB600.B2"));
|
||||
list.add(new ItemDTO(ItemProtocol.item_error, "报警信号", "DB600.B4"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,11 +5,13 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
@@ -18,9 +20,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
@@ -50,6 +50,8 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
String devicecode;
|
||||
int mode = 0;
|
||||
int action = 0;
|
||||
int heartbeat = 0;
|
||||
int color = 0;
|
||||
int error = 0;
|
||||
int move = 0;
|
||||
int task = 0;
|
||||
@@ -59,6 +61,8 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
int last_move = 0;
|
||||
int last_task = 0;
|
||||
|
||||
String car_no = "";
|
||||
|
||||
boolean hasVehicle = false;
|
||||
boolean isReady = false;
|
||||
protected int instruction_num = 0;
|
||||
@@ -97,9 +101,11 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
String message = null;
|
||||
|
||||
String device_code = this.getDevice().getDevice_code();
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
mode = this.itemProtocol.getMode();
|
||||
action = this.itemProtocol.getAction();
|
||||
error = this.itemProtocol.getError();
|
||||
color = this.itemProtocol.getColor();
|
||||
if (mode != last_mode) {
|
||||
}
|
||||
if (action != last_action) {
|
||||
@@ -109,8 +115,22 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
last_action = action;
|
||||
last_mode = mode;
|
||||
last_error = error;
|
||||
//message = StringFormatUtl.format("设备报警:{}", new Object[]{});
|
||||
|
||||
if (error == 1) {
|
||||
String[] carArr = {car_no};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
// 请求下发agv急停
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
UnifiedResponse<JSONObject> response = xianGongAgv.sendOrderStopToXZ(json);
|
||||
|
||||
if (!response.isSuccess()) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
//message = StringFormatUtl.format("设备报警:{}", new Object[]{});
|
||||
// String manual_create_task = this.getDevice().getExtraValue().get("manual_create_task").toString();
|
||||
|
||||
|
||||
@@ -150,10 +170,29 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
|
||||
}
|
||||
|
||||
public void writing(int command,int color) {
|
||||
String toCommand = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
|
||||
String toColor = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_color;
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(toCommand, command);
|
||||
itemMap.put(toColor, color);
|
||||
ReadUtil.write(itemMap, server);
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
log.info("下发PLC信号:{},{}", toCommand, command);
|
||||
log.info("下发PLC信号:{},{}", toColor, color);
|
||||
System.out.println("设备:" + devicecode + ",下发PLC信号:" + toCommand + ",value:" + command);
|
||||
System.out.println("设备:" + devicecode + ",下发PLC信号:" + toColor + ",value:" + color);
|
||||
}
|
||||
|
||||
public synchronized void OpenOrClose(String type) {
|
||||
|
||||
writing(Integer.parseInt(type));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String task_type = task.getTask_type();
|
||||
String remark = task.getRemark();
|
||||
String params = task.getParams();
|
||||
String is_vehicle = task.getIs_vehicle();
|
||||
// 双工RGV任务 后工位任务
|
||||
String start_point_code2 = task.getStart_device_code2();
|
||||
String next_point_code2 = task.getNext_device_code2();
|
||||
@@ -223,6 +224,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("remark", remark);
|
||||
jo.put("is_vehicle", is_vehicle);
|
||||
jo.put("params", params);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
jo.put("direction", direction);
|
||||
|
||||
@@ -457,7 +457,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
return;
|
||||
}
|
||||
|
||||
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||
/* LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||
|
||||
|
||||
//变更三色灯状态
|
||||
@@ -469,7 +469,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lamddevice.getDeviceDriver();
|
||||
lampThreecolorDeviceDriver.writing(0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,8 @@ public enum DeviceType {
|
||||
shadow("影子设备", 20),
|
||||
other("其他设备", 14),
|
||||
safetydoor("安全门", 17),
|
||||
elevator("电梯", 21);
|
||||
elevator("电梯", 21),
|
||||
color("三色灯", 22);
|
||||
|
||||
private String description;
|
||||
private int order;
|
||||
|
||||
@@ -282,4 +282,9 @@ public class TaskDto implements Serializable {
|
||||
* 放货设备编号(覆膜机)
|
||||
*/
|
||||
private String put_device_code;
|
||||
|
||||
/**
|
||||
* 是否需要载具
|
||||
*/
|
||||
private String is_vehicle;
|
||||
}
|
||||
|
||||
@@ -493,6 +493,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return this.tasks
|
||||
.stream()
|
||||
.filter(taskDto -> "0".equals(taskDto.getTask_status()))
|
||||
.sorted(Comparator.comparing(TaskDto::getPriority).reversed())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -790,6 +791,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
request.setTask_id(dto.getExt_task_uuid());
|
||||
request.setTask_code(dto.getTask_code());
|
||||
request.setTask_status(dto.getTask_status());
|
||||
request.setVehicle_code(dto.getVehicle_code());
|
||||
request.setCar_no("");
|
||||
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||
acstowmsService.apply(request);
|
||||
|
||||
Reference in New Issue
Block a user