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 {
private final DeviceAppService deviceAppService;
private final ISysParamService paramService;
@Autowired
private final AcsToWmsService acsToWmsService;
@Autowired
@@ -115,7 +116,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
@Override
public HttpResponse markComplete(String code) throws Exception {
@@ -141,7 +142,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
@Override
public HttpResponse queryXZAgvDeviceStatus() {
@@ -202,7 +203,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
@Override
public HttpResponse queryXZAgvInstStatus(String instCode) {
@@ -225,7 +226,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@Override
public HttpResponse deleteXZAgvInst(String instCode) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -245,7 +246,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@Override
public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception {
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
@@ -466,7 +467,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@Override
public HttpResponse addOrderSequences(Instruction inst) throws Exception {
JSONObject orderjo = createOrederData(inst, CommonFinalParam.ONE);
@@ -493,7 +494,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@Override
public String sendOrderSequencesParam(Instruction inst) throws Exception {
JSONObject jo = new JSONObject();
@@ -511,7 +512,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
return jo.toString();
}
@Override
public JSONObject createOrederData(Instruction inst, String inst_type) {
String inst_code = inst.getInstruction_code();
@@ -648,7 +649,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
return destinationOrder;
}
@Override
public String queryDoorStatus(String device) {
log.info("AGV查询自动门状态,参数:{}", device);

View File

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

View File

@@ -18,6 +18,8 @@ public class ItemProtocol {
//动作信号
public static String item_action = "action";
public static String item_to_command = "to_command";
private ManipulatorCacheDeviceDriver driver;
public ItemProtocol(ManipulatorCacheDeviceDriver driver) {
@@ -49,6 +51,7 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() {
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_action, "动作信号", "DB1.B3"));

View File

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

View File

@@ -43,11 +43,11 @@ public class ItemProtocol {
/**
* x轴坐标
*/
public static String item_x_position = "x_position";
public static String item_x = "x";
/**
* 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_barcode = "to_barcode";
private BoxPackageManipulatorDeviceDriver driver;
@@ -148,12 +152,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_target);
}
public float getX_position() {
return this.getOpcFloatValue(item_x_position);
public float getX() {
return this.getOpcFloatValue(item_x);
}
public float getY_position() {
return this.getOpcFloatValue(item_y_position);
public float getY() {
return this.getOpcFloatValue(item_y);
}
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) {
String value = this.driver.getStringValue(protocol);
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_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10"));
list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14"));
list.add(new ItemDto(item_x, "x坐标", "DB1.REAL10"));
list.add(new ItemDto(item_y, "y坐标", "DB1.REAL14"));
list.add(new ItemDto(item_position, "木箱位置", "DB1.REAL16"));
list.add(new ItemDto(item_number, "木箱数量", "DB1.REAL18"));
return list;
@@ -235,6 +243,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_direction, "子卷摆放方向", "DB2.D10"));
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_barcode, "下发木箱条码", "DB601.STRING1.50"));
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.FeedLmsRealFailed;
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.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
@@ -390,10 +391,10 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
notCreateInstMessage = "universal_notCreateInstMessage1";
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() != 1) {
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver();
if (beltConveyorDeviceDriver.getMove() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage2";
return false;
}

View File

@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.common.value.qual.StringVal;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
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.dto.RouteLineDto;
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.dto.TaskDto;
import org.nl.common.utils.RedisUtils;
@@ -481,18 +479,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction inst = checkInst();
try {
finish_instruction(inst);
// if (ObjectUtil.isNotEmpty(redisUtils.get(REDIS_MOVE_BOX))){
// String taskRedis = redisUtils.get(REDIS_MOVE_BOX).toString();
// task = Integer.valueOf(taskRedis);
// Instruction instOld = checkInst();
// List list1 = new ArrayList();
// pakageCommand(list1, taskRedis);
// pakagePlc(instOld, list1);
// if (ObjectUtil.isNotNull(list1)) {
// this.writing(list1);
// }
// }
// list.remove(0);
if (ObjectUtil.isNotEmpty(redisUtils.get(REDIS_MOVE_BOX))){
String taskRedis = redisUtils.get(REDIS_MOVE_BOX).toString();
task = Integer.valueOf(taskRedis);
Instruction instOld = checkInst();
List list1 = new ArrayList();
pakageCommand(list1, taskRedis);
pakagePlc(instOld, list1);
if (ObjectUtil.isNotNull(list1)) {
this.writing(list1);
}
list.remove(0);
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -605,11 +603,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) {
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())) {
updateData2(poinCode, instruction, point, split);
pakageData(point, split);
List list = new ArrayList();
pakageData(list,point, split);
}
}
if (StrUtil.isNotEmpty(jo.getString("task_id"))) {
@@ -618,11 +618,17 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
//存缓存
redisUtils.set(REDIS_MOVE_BOX, task);
TaskDto taskId = taskserver.findById(jo.getString("task_id"));
Instruction instructionDDJ = instructionService.creatDDJInstruction(taskId.getTask_id());
List list = new ArrayList();
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[] split = poinCodeMove.split("-");
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) {
List list = new ArrayList();
private void pakageData(List list, Device point, String[] split) {
String x = point.getExtraValue().get("x").toString();
String y = split[1];
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_name", boxManipulatorDeviceDriver.getDevice().getDevice_name());
jo.put("status", Math.min(3, boxManipulatorDeviceDriver.getMode()));
jo.put("x", boxManipulatorDeviceDriver.getX_position());
jo.put("y", boxManipulatorDeviceDriver.getY_position());
jo.put("x", boxManipulatorDeviceDriver.getX());
jo.put("y", boxManipulatorDeviceDriver.getY());
jo.put("mode", boxManipulatorDeviceDriver.getMode());
jo.put("move", boxManipulatorDeviceDriver.getMove());
jo.put("action", boxManipulatorDeviceDriver.getAction());

View File

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

View File

@@ -1,7 +1,6 @@
package org.nl.acs.instruction.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
@@ -12,9 +11,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
@@ -360,20 +359,15 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(Instruction dto) {
dto = foramte(dto);
String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code);
if(regional(dto.getStart_device_code(), dto.getNext_device_code())){
if (regional(dto.getStart_device_code(), dto.getNext_device_code())) {
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 now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
@@ -460,19 +454,19 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (!StrUtil.equals(task.getAgv_system_type(), "0")
&& ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
log.warn("下发AGV指令数据,"+ "指令号:" + dto.getInstruction_code() + ",AGV系统类型:"+ dto.getAgv_system_type()
+ ",AGV指令类型:" + dto.getInstruction_type() );
log.warn("下发AGV指令数据," + "指令号:" + dto.getInstruction_code() + ",AGV系统类型:" + dto.getAgv_system_type()
+ ",AGV指令类型:" + dto.getInstruction_type());
try {
if(StrUtil.isEmpty(dto.getAgv_inst_type()) || StrUtil.isEmpty(dto.getAgv_system_type())){
log.info("sendAgvInstToNDC 指令校验:" + dto.getInstruction_code() + ",inst_type:" +dto.getInstruction_type()
+",inst_system_type:" + dto.getAgv_system_type());
if (StrUtil.isEmpty(dto.getAgv_inst_type()) || StrUtil.isEmpty(dto.getAgv_system_type())) {
log.info("sendAgvInstToNDC 指令校验:" + dto.getInstruction_code() + ",inst_type:" + dto.getInstruction_type()
+ ",inst_system_type:" + dto.getAgv_system_type());
}
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
} catch (Exception e){
} catch (Exception e) {
dto.setSend_status("2");
dto.setRemark(e.getMessage());
e.printStackTrace();
log.warn("下发AGV指令异常:"+ e);
log.warn("下发AGV指令异常:" + e);
}
} else {
// Boolean result = createLkInst(task.getStorage_task_type(),dto);
@@ -523,12 +517,41 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
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
public void create2(Instruction dto) throws Exception {
dto = foramte(dto);
String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code);
if(regional(dto.getStart_device_code(), dto.getNext_device_code())){
if (regional(dto.getStart_device_code(), dto.getNext_device_code())) {
throw new BadRequestException(LangProcess.msg("error_regional_max"));
}
String currentUsername = SecurityUtils.getCurrentNickName();
@@ -870,9 +893,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.one();
// =0 则不用再次请求
if (StrUtil.equals(task.getRequest_again(), "0")) {
if(StrUtil.equals(task.getTask_type(),"8")){
if (StrUtil.equals(task.getTask_type(), "8")) {
//中转为空
if(StrUtil.isEmpty(task.getPut_device_code())){
if (StrUtil.isEmpty(task.getPut_device_code())) {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
} else {
@@ -881,7 +904,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(ConvertUtil.convert(entity, Instruction.class));
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
}
}
@@ -916,9 +939,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.one();
// =0 则不用再次请求
if (StrUtil.equals(task.getRequest_again(), "0")) {
if(StrUtil.equals(task.getTask_type(),"8")){
if (StrUtil.equals(task.getTask_type(), "8")) {
//中转为空
if(StrUtil.isEmpty(task.getPut_device_code())){
if (StrUtil.isEmpty(task.getPut_device_code())) {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
} else {
@@ -927,7 +950,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(ConvertUtil.convert(ins, Instruction.class));
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
}
}
@@ -1818,9 +1841,7 @@ 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 nextdevice = deviceAppService.findDeviceByCode(next_device_code);
String startRegion = startdevice.getRegion();
@@ -1828,7 +1849,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
int count = 0;
boolean startRegionalExit = true;
boolean nextRegionalExit = true;
if(StrUtil.isEmpty(startRegion) || StrUtil.isEmpty(nextRegion)){
if (StrUtil.isEmpty(startRegion) || StrUtil.isEmpty(nextRegion)) {
return false;
}
//控制指令生成

View File

@@ -161,6 +161,8 @@ public class OpcUtl {
return jiVariant.getObject();
} else if (e instanceof Float) {
return jiVariant.getObject();
} else if (e instanceof Double) {
return jiVariant.getObject();
} else {
System.err.println(id + "不明类型" + e.getClass());
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.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import groovy.lang.Lazy;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.nl.acs.AcsConfig;
@@ -97,6 +98,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
private TaskFeedbackService taskFeedbackService;
@Autowired
private ISysParamService paramService;
@Lazy
@Autowired
private XianGongAgvService agvService;
@Autowired
@@ -1109,7 +1111,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
CommonFinalParam commonFinalParam = new CommonFinalParam();
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());
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]);
if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) {
from_y = "0" + start_point[1];
@@ -1161,7 +1164,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
} else {
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_device_code(start_point_code);
}

View File

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