fix: 现场联调

This commit is contained in:
2024-03-20 09:01:40 +08:00
parent 6903bdfa6d
commit 2eac4ea4e3
15 changed files with 162 additions and 105 deletions

View File

@@ -47,6 +47,7 @@ import java.util.Map;
public class XianGongAgvServiceImpl implements XianGongAgvService { public class XianGongAgvServiceImpl implements XianGongAgvService {
private final DeviceAppService deviceAppService; private final DeviceAppService deviceAppService;
private final ISysParamService paramService; private final ISysParamService paramService;
@Autowired
private final AcsToWmsService acsToWmsService; private final AcsToWmsService acsToWmsService;
@Autowired @Autowired

View File

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.map.ListOrderedMap; import org.apache.commons.collections4.map.ListOrderedMap;
import org.apache.commons.lang.LocaleUtils; import org.apache.commons.lang.LocaleUtils;
import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.auto.initial.ApplicationAutoInitial;
@@ -1228,6 +1229,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
JSONArray w_arry = new JSONArray(); JSONArray w_arry = new JSONArray();
List<ItemDto> writeableItemDtos = opcDeviceDriverDefination.getWriteableItemDtos(); List<ItemDto> writeableItemDtos = opcDeviceDriverDefination.getWriteableItemDtos();
List<JSONObject> writeableItemJsons = new ArrayList<>(); List<JSONObject> writeableItemJsons = new ArrayList<>();
if (CollectionUtils.isNotEmpty(writeableItemDtos)) {
for (int i = 0; i < writeableItemDtos.size(); i++) { for (int i = 0; i < writeableItemDtos.size(); i++) {
ItemDto itemDto = writeableItemDtos.get(i); ItemDto itemDto = writeableItemDtos.get(i);
JSONObject writeableItemJson = new JSONObject(); JSONObject writeableItemJson = new JSONObject();
@@ -1236,6 +1238,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
//writeableItemJson.put("db",itemDto.getDb()); //writeableItemJson.put("db",itemDto.getDb());
writeableItemJsons.add(writeableItemJson); writeableItemJsons.add(writeableItemJson);
} }
}
for (int i = 0; i < ws.size(); i++) { for (int i = 0; i < ws.size(); i++) {
String extra_code = ws.getJSONObject(i).getString("extra_code"); String extra_code = ws.getJSONObject(i).getString("extra_code");
final String[] split = extra_code.split("\\."); final String[] split = extra_code.split("\\.");
@@ -1260,6 +1263,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
jsonObject.put("name", wJson.getString("name")); jsonObject.put("name", wJson.getString("name"));
warry.add(jsonObject); warry.add(jsonObject);
} }
if (CollectionUtils.isNotEmpty(writeableItemDtos)) {
for (int i = 0; i < writeableItemDtos.size(); i++) { for (int i = 0; i < writeableItemDtos.size(); i++) {
ItemDto itemDto = writeableItemDtos.get(i); ItemDto itemDto = writeableItemDtos.get(i);
JSONObject writeableItemJson = new JSONObject(); JSONObject writeableItemJson = new JSONObject();
@@ -1270,6 +1274,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
w_arry.add(writeableItemJson); w_arry.add(writeableItemJson);
} }
} }
}
if (!r_arry.isEmpty()) { if (!r_arry.isEmpty()) {
result.put("rs", r_arry); result.put("rs", r_arry);
} }

View File

@@ -18,6 +18,8 @@ public class ItemProtocol {
//动作信号 //动作信号
public static String item_action = "action"; public static String item_action = "action";
public static String item_to_command = "to_command";
private ManipulatorCacheDeviceDriver driver; private ManipulatorCacheDeviceDriver driver;
public ItemProtocol(ManipulatorCacheDeviceDriver driver) { public ItemProtocol(ManipulatorCacheDeviceDriver driver) {
@@ -49,6 +51,7 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>(); ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_to_command, "作业命令", "DB200.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1")); list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
list.add(new ItemDto(item_action, "动作信号", "DB1.B3")); list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));

View File

@@ -42,6 +42,8 @@ public class ManipulatorCacheDeviceDriver extends AbstractOpcDeviceDriver implem
int action = 0; int action = 0;
int last_action = 0; int last_action = 0;
@Override @Override
public Device getDevice() { public Device getDevice() {
return this.device; return this.device;

View File

@@ -19,6 +19,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver; import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.DeviceErrorLogService;
@@ -78,11 +79,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int task = 0; int task = 0;
int last_task = 0; int last_task = 0;
// x坐标 // x坐标
float x_position = 0; float x = 0.0f;
float last_x_position = 0; float last_x = 0.0f;
// y坐标 // y坐标
float y_position = 0; float y = 0.0f;
float last_y_position = 0; float last_y = 0.0f;
int heartbeat = 0; int heartbeat = 0;
int last_heartbeat = 0; int last_heartbeat = 0;
@@ -169,8 +170,8 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
to_target = this.itemProtocol.getTo_target(); to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task(); to_task = this.itemProtocol.getTo_task();
to_onset = this.itemProtocol.getTo_onset(); to_onset = this.itemProtocol.getTo_onset();
x_position = this.itemProtocol.getX_position(); x = this.itemProtocol.getX();
y_position = this.itemProtocol.getY_position(); y = this.itemProtocol.getY();
to_seq = this.itemProtocol.getTo_seq(); to_seq = this.itemProtocol.getTo_seq();
to_max_no = this.itemProtocol.getTo_max_no(); to_max_no = this.itemProtocol.getTo_max_no();
to_direction = this.itemProtocol.getTo_direction(); to_direction = this.itemProtocol.getTo_direction();
@@ -247,8 +248,6 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
last_to_command = to_command; last_to_command = to_command;
last_to_target = to_target; last_to_target = to_target;
last_to_onset = to_onset; last_to_onset = to_onset;
last_x_position = x_position;
last_y_position = y_position;
last_to_seq = to_seq; last_to_seq = to_seq;
last_to_last = to_last; last_to_last = to_last;
last_to_direction = to_direction; last_to_direction = to_direction;
@@ -390,10 +389,10 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
} }
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { if (nextDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver(); boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) nextDevice.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() != 1) { if (boxSubvolumesConveyorDeviceDriver.getMove() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage2"; notCreateInstMessage = "universal_notCreateInstMessage2";
return false; return false;
} }
@@ -402,7 +401,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver; ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver;
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) { if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver(); manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getMode() !=1) { if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getAction() !=1) {
notCreateInstMessage = "universal_notCreateInstMessage3"; notCreateInstMessage = "universal_notCreateInstMessage3";
return false; return false;
} }
@@ -493,8 +492,8 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) { if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) {
map8.put("code", "to_barcode"); map9.put("code", "to_barcode");
map8.put("value", interactionJsonDTO.getBarcode()); map9.put("value", interactionJsonDTO.getBarcode());
list.add(map9); list.add(map9);
} }
} }
@@ -613,8 +612,8 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("driver_type", "siemens_conveyor"); jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true); jo.put("is_click", true);
jo.put("x", x_position); jo.put("x", x);
jo.put("y", y_position); jo.put("y", y);
return jo; return jo;
} }

View File

@@ -43,11 +43,11 @@ public class ItemProtocol {
/** /**
* x轴坐标 * x轴坐标
*/ */
public static String item_x_position = "x_position"; public static String item_x = "x";
/** /**
* y轴坐标 * y轴坐标
*/ */
public static String item_y_position = "y_position"; public static String item_y= "y";
/** /**
@@ -96,6 +96,10 @@ public class ItemProtocol {
* 下发是否最后子卷 * 下发是否最后子卷
*/ */
public static String item_to_last_one = "to_last_one"; public static String item_to_last_one = "to_last_one";
/**
*下发木箱条码
*/
public static String item_to_barcode = "to_barcode";
private BoxPackageManipulatorDeviceDriver driver; private BoxPackageManipulatorDeviceDriver driver;
@@ -148,12 +152,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_target); return this.getOpcIntegerValue(item_to_target);
} }
public float getX_position() { public float getX() {
return this.getOpcFloatValue(item_x_position); return this.getOpcFloatValue(item_x);
} }
public float getY_position() { public float getY() {
return this.getOpcFloatValue(item_y_position); return this.getOpcFloatValue(item_y);
} }
public int getTo_seq(){ public int getTo_seq(){
@@ -186,6 +190,10 @@ public class ItemProtocol {
} }
public String getTo_barcode() {
return this.getOpcStringValue(item_to_barcode);
}
public String getOpcStringValue(String protocol) { public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol); String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) { if (StrUtil.isEmpty(value)) {
@@ -218,8 +226,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6")); list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10")); list.add(new ItemDto(item_x, "x坐标", "DB1.REAL10"));
list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14")); list.add(new ItemDto(item_y, "y坐标", "DB1.REAL14"));
list.add(new ItemDto(item_position, "木箱位置", "DB1.REAL16")); list.add(new ItemDto(item_position, "木箱位置", "DB1.REAL16"));
list.add(new ItemDto(item_number, "木箱数量", "DB1.REAL18")); list.add(new ItemDto(item_number, "木箱数量", "DB1.REAL18"));
return list; return list;
@@ -235,6 +243,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_direction, "子卷摆放方向", "DB2.D10")); list.add(new ItemDto(item_to_direction, "子卷摆放方向", "DB2.D10"));
list.add(new ItemDto(item_to_seq, "下发木箱工位顺序", "DB2.W12")); list.add(new ItemDto(item_to_seq, "下发木箱工位顺序", "DB2.W12"));
list.add(new ItemDto(item_to_last_one, "下发是否最后子卷", "DB2.W14")); list.add(new ItemDto(item_to_last_one, "下发是否最后子卷", "DB2.W14"));
list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB601.STRING1.50"));
return list; return list;
} }
} }

View File

@@ -16,6 +16,7 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver;
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.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
@@ -390,10 +391,10 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
notCreateInstMessage = "universal_notCreateInstMessage1"; notCreateInstMessage = "universal_notCreateInstMessage1";
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
} }
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; BeltConveyorDeviceDriver beltConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver(); beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() != 1) { if (beltConveyorDeviceDriver.getMove() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage2"; notCreateInstMessage = "universal_notCreateInstMessage2";
return false; return false;
} }

View File

@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.common.value.qual.StringVal;
import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device.enums.DeviceType;
@@ -33,7 +32,6 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.domain.Task;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.utils.RedisUtils; import org.nl.common.utils.RedisUtils;
@@ -481,18 +479,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction inst = checkInst(); Instruction inst = checkInst();
try { try {
finish_instruction(inst); finish_instruction(inst);
// if (ObjectUtil.isNotEmpty(redisUtils.get(REDIS_MOVE_BOX))){ if (ObjectUtil.isNotEmpty(redisUtils.get(REDIS_MOVE_BOX))){
// String taskRedis = redisUtils.get(REDIS_MOVE_BOX).toString(); String taskRedis = redisUtils.get(REDIS_MOVE_BOX).toString();
// task = Integer.valueOf(taskRedis); task = Integer.valueOf(taskRedis);
// Instruction instOld = checkInst(); Instruction instOld = checkInst();
// List list1 = new ArrayList(); List list1 = new ArrayList();
// pakageCommand(list1, taskRedis); pakageCommand(list1, taskRedis);
// pakagePlc(instOld, list1); pakagePlc(instOld, list1);
// if (ObjectUtil.isNotNull(list1)) { if (ObjectUtil.isNotNull(list1)) {
// this.writing(list1); this.writing(list1);
// } }
// } list.remove(0);
// list.remove(0); }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -605,11 +603,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) { if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) {
updateData1(poinCode, instruction, point, split); updateData1(poinCode, instruction, point, split);
pakageData(point, split); List list = new ArrayList();
pakageData(list,point, split);
} }
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) { if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) {
updateData2(poinCode, instruction, point, split); updateData2(poinCode, instruction, point, split);
pakageData(point, split); List list = new ArrayList();
pakageData(list,point, split);
} }
} }
if (StrUtil.isNotEmpty(jo.getString("task_id"))) { if (StrUtil.isNotEmpty(jo.getString("task_id"))) {
@@ -618,11 +618,17 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
//存缓存 //存缓存
redisUtils.set(REDIS_MOVE_BOX, task); redisUtils.set(REDIS_MOVE_BOX, task);
TaskDto taskId = taskserver.findById(jo.getString("task_id")); TaskDto taskId = taskserver.findById(jo.getString("task_id"));
Instruction instructionDDJ = instructionService.creatDDJInstruction(taskId.getTask_id());
List list = new ArrayList();
if (ObjectUtil.isNotEmpty(taskId)) { if (ObjectUtil.isNotEmpty(taskId)) {
if (StrUtil.isNotEmpty(instructionDDJ.getInstruction_code())) {
task = Integer.valueOf(instructionDDJ.getInstruction_code());
pakageCommand(list,instructionDDJ.getInstruction_code());
}
String poinCodeMove = taskId.getStart_point_code(); String poinCodeMove = taskId.getStart_point_code();
String[] split = poinCodeMove.split("-"); String[] split = poinCodeMove.split("-");
Device point = deviceAppService.findDeviceByCode(split[0]); Device point = deviceAppService.findDeviceByCode(split[0]);
pakageData(point, split); pakageData(list, point, split);
} }
} }
} }
@@ -642,8 +648,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
} }
private void pakageData( Device point, String[] split) { private void pakageData(List list, Device point, String[] split) {
List list = new ArrayList();
String x = point.getExtraValue().get("x").toString(); String x = point.getExtraValue().get("x").toString();
String y = split[1]; String y = split[1];
String z = split[2]; String z = split[2];

View File

@@ -587,8 +587,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("device_code", boxManipulatorDeviceDriver.getDevice().getDevice_code()); jo.put("device_code", boxManipulatorDeviceDriver.getDevice().getDevice_code());
jo.put("device_name", boxManipulatorDeviceDriver.getDevice().getDevice_name()); jo.put("device_name", boxManipulatorDeviceDriver.getDevice().getDevice_name());
jo.put("status", Math.min(3, boxManipulatorDeviceDriver.getMode())); jo.put("status", Math.min(3, boxManipulatorDeviceDriver.getMode()));
jo.put("x", boxManipulatorDeviceDriver.getX_position()); jo.put("x", boxManipulatorDeviceDriver.getX());
jo.put("y", boxManipulatorDeviceDriver.getY_position()); jo.put("y", boxManipulatorDeviceDriver.getY());
jo.put("mode", boxManipulatorDeviceDriver.getMode()); jo.put("mode", boxManipulatorDeviceDriver.getMode());
jo.put("move", boxManipulatorDeviceDriver.getMove()); jo.put("move", boxManipulatorDeviceDriver.getMove());
jo.put("action", boxManipulatorDeviceDriver.getAction()); jo.put("action", boxManipulatorDeviceDriver.getAction());

View File

@@ -184,6 +184,9 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
*/ */
void create(Instruction dto) throws Exception; void create(Instruction dto) throws Exception;
Instruction creatDDJInstruction(String taskId);
/** /**
* 创建2 * 创建2
* *

View File

@@ -1,7 +1,6 @@
package org.nl.acs.instruction.service.impl; package org.nl.acs.instruction.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
@@ -12,9 +11,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
@@ -360,6 +359,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void create(Instruction dto) { public void create(Instruction dto) {
dto = foramte(dto); dto = foramte(dto);
String task_code = dto.getTask_code(); String task_code = dto.getTask_code();
@@ -367,13 +367,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (regional(dto.getStart_device_code(), dto.getNext_device_code())) { if (regional(dto.getStart_device_code(), dto.getNext_device_code())) {
throw new BadRequestException(LangProcess.msg("error_regional_max")); throw new BadRequestException(LangProcess.msg("error_regional_max"));
} }
if(StrUtil.isNotEmpty(dto.getTask_code())){
InstructionMybatis instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class)
.eq(InstructionMybatis::getTask_code, dto.getTask_code())).get(0);
if(ObjectUtil.isNotEmpty(instructionMybatis) && instructionMybatis.getStart_device_code().equals(dto.getStart_device_code())){
return;
}
}
String currentUsername = SecurityUtils.getCurrentNickName(); String currentUsername = SecurityUtils.getCurrentNickName();
String now = DateUtil.now(); String now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) { if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
@@ -523,6 +517,35 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
instructions.add(dto); instructions.add(dto);
} }
@Override
public Instruction creatDDJInstruction(String taskId) {
TaskDto task = taskService.findByCodeFromCache(taskId);
Instruction instdto = new Instruction();
instdto.setInstruction_type(task.getTask_type());
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(task.getRoute_plan_code());
instdto.setTask_id(taskId);
instdto.setTask_code(task.getTask_code());
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(task.getStart_device_code());
instdto.setStart_point_code(task.getStart_point_code());
instdto.setNext_device_code(task.getNext_device_code());
instdto.setNext_point_code(task.getNext_point_code());
instdto.setPriority("2");
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(task.getStart_point_code());
instdto.setFrom_x(task.getFrom_x());
instdto.setFrom_z(task.getFrom_z());
instdto.setFrom_y(task.getFrom_y());
instdto.setTo_x(task.getTo_x());
instdto.setTo_z(task.getTo_z());
instdto.setTo_y(task.getTo_y());
create(instdto);
return instdto;
}
@Override @Override
public void create2(Instruction dto) throws Exception { public void create2(Instruction dto) throws Exception {
dto = foramte(dto); dto = foramte(dto);
@@ -1818,8 +1841,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
private boolean regional(String start_device_code, String next_device_code) { private boolean regional(String start_device_code, String next_device_code) {
Device startdevice = deviceAppService.findDeviceByCode(start_device_code); Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code); Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);

View File

@@ -161,6 +161,8 @@ public class OpcUtl {
return jiVariant.getObject(); return jiVariant.getObject();
} else if (e instanceof Float) { } else if (e instanceof Float) {
return jiVariant.getObject(); return jiVariant.getObject();
} else if (e instanceof Double) {
return jiVariant.getObject();
} else { } else {
System.err.println(id + "不明类型" + e.getClass()); System.err.println(id + "不明类型" + e.getClass());
if (jiVariant.getType() == 0) { if (jiVariant.getType() == 0) {

View File

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import groovy.lang.Lazy;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
@@ -97,6 +98,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
private TaskFeedbackService taskFeedbackService; private TaskFeedbackService taskFeedbackService;
@Autowired @Autowired
private ISysParamService paramService; private ISysParamService paramService;
@Lazy
@Autowired @Autowired
private XianGongAgvService agvService; private XianGongAgvService agvService;
@Autowired @Autowired
@@ -1109,7 +1111,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
CommonFinalParam commonFinalParam = new CommonFinalParam(); CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) { if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) {
String[] start_point = start_point_code.split(commonFinalParam.getBARRE()); String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
task.setFrom_x(start_point[0]); Device starPoint = deviceAppService.findDeviceByCode(start_point[0]);
task.setFrom_x(starPoint.getExtraValue().get("x").toString());
task.setStart_device_code(start_point[0]); task.setStart_device_code(start_point[0]);
if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) { if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) {
from_y = "0" + start_point[1]; from_y = "0" + start_point[1];
@@ -1161,7 +1164,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
} else { } else {
from_z = task.getFrom_z(); from_z = task.getFrom_z();
} }
task.setFrom_x(start_point_code); Device starPoint = deviceAppService.findDeviceByCode(start_point_code);
task.setFrom_x(starPoint.getExtraValue().get("x").toString());
task.setStart_point_code(start_point_code + commonFinalParam.getBARRE() + from_y + commonFinalParam.getBARRE() + from_z); task.setStart_point_code(start_point_code + commonFinalParam.getBARRE() + from_y + commonFinalParam.getBARRE() + from_z);
task.setStart_device_code(start_point_code); task.setStart_device_code(start_point_code);
} }

View File

@@ -189,6 +189,7 @@ public class AutoCreateInst {
} }
try { try {
instructionService.create(instdto); instructionService.create(instdto);
} catch (Exception e) { } catch (Exception e) {
acsTask.setRemark(e.getMessage()); acsTask.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(acsTask); taskserver.updateByCodeFromCache(acsTask);

View File

@@ -3,7 +3,7 @@ window.g = {
VUE_APP_BASE_API: 'http://127.0.0.1:8011' VUE_APP_BASE_API: 'http://127.0.0.1:8011'
}, },
prod: { prod: {
VUE_APP_BASE_API: 'http://127.0.0.1:8011' VUE_APP_BASE_API: 'http://10.1.3.96:8011'
} }
} }