fix: 堆垛机联调

This commit is contained in:
2024-03-18 08:45:37 +08:00
parent f4e14eb6ba
commit 0783af09c2
19 changed files with 380 additions and 285 deletions

View File

@@ -1,6 +1,7 @@
package org.nl.acs.agv.rest;
import com.alibaba.fastjson.JSONObject;
import groovy.lang.Lazy;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.common.logging.annotation.Log;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
@Controller
public class XianGongAgvController {
@Lazy
@Autowired
private XianGongAgvService xianGongAgentService;

View File

@@ -271,14 +271,14 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
this.require_apply_strangulation_time = date;
// String vehicle_code = "";
//
// if (StrUtil.isEmpty(vehicle_code)) {
// message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
// return;
// }
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (StrUtil.isEmpty(inst.getVehicle_code())) {
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
return;
}
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("vehicle_code", material_barcode);
param.put("vehicle_code", inst.getVehicle_code());
param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType());
String response = acsToWmsService.deviceApplyTwo(param);
JSONObject jo = JSON.parseObject(response);
@@ -289,7 +289,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
// Map datas = applyLabelingAndBindingResponse.getData();
packagePLCData(jo.getString("body"));
packagePLCData(jo.getString("data"));
requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.manipulator_cache;
package org.nl.acs.device_driver.one_conveyor.manipulator_cache;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,49 +1,62 @@
package org.nl.acs.device_driver.manipulator_cache;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* 扫码器
*/
@Service
public class ManipulatorCacheDefination implements DeviceDriverDefination {
@Override
public String getDriverCode() {
return "manipulator_cache";
}
@Override
public String getDriverName() {
return "行架对接缓存位";
}
@Override
public String getDriverDescription() {
return "行架对接缓存位";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new ManipulatorCacheDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return ManipulatorCacheDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
}
package org.nl.acs.device_driver.one_conveyor.manipulator_cache;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* 行架对接缓存位
*/
@Service
public class ManipulatorCacheDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "manipulator_cache";
}
@Override
public String getDriverName() {
return "行架对接缓存位";
}
@Override
public String getDriverDescription() {
return "行架对接缓存位";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new ManipulatorCacheDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return null;
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return ManipulatorCacheDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
}

View File

@@ -1,113 +1,109 @@
package org.nl.acs.device_driver.manipulator_cache;
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.extern.slf4j.Slf4j;
import org.nl.acs.device.domain.Device;
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.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.config.language.LangProcess;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 标准版扫码器
*/
@Slf4j
@Data
public class ManipulatorCacheDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
protected ItemProtocol itemProtocol = new ItemProtocol(this);
//当前指令
Instruction inst = null;
private String error_type = "ssx_error_type";
//工作模式
int mode = 0;
int last_mode = 0;
//任务号
int action = 0;
int last_action = 0;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
action = this.itemProtocol.getAction();
mode = this.itemProtocol.getMode();
}
public boolean exe_business() {
return true;
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(int command) {
Map<String, Object> itemMap = new HashMap<String, Object>();
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String move = "";
if (this.getMode() == 0) {
mode = LangProcess.msg("universal_off-line");
} else if (this.getMode() == 1) {
mode = LangProcess.msg("universal_stand-alone");
} else if (this.getMode() == 2) {
mode = LangProcess.msg("universal_standby");
} else if (this.getMode() == 3) {
mode = LangProcess.msg("universal_operation");
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("action", action);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
@Override
public JSONObject feedLmsRealFailedInfo() {
return null;
}
}
package org.nl.acs.device_driver.one_conveyor.manipulator_cache;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.domain.Device;
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.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.config.language.LangProcess;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 行架对接缓存位
*/
@Slf4j
@Data
public class ManipulatorCacheDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
protected ItemProtocol itemProtocol = new ItemProtocol(this);
//当前指令
Instruction inst = null;
private String error_type = "ssx_error_type";
//工作模式
int mode = 0;
int last_mode = 0;
//任务号
int action = 0;
int last_action = 0;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
action = this.itemProtocol.getAction();
mode = this.itemProtocol.getMode();
}
public boolean exe_business() {
return true;
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(int command) {
Map<String, Object> itemMap = new HashMap<String, Object>();
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String move = "";
if (this.getMode() == 0) {
mode = LangProcess.msg("universal_off-line");
} else if (this.getMode() == 1) {
mode = LangProcess.msg("universal_stand-alone");
} else if (this.getMode() == 2) {
mode = LangProcess.msg("universal_standby");
} else if (this.getMode() == 3) {
mode = LangProcess.msg("universal_operation");
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("action", action);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
@Override
public JSONObject feedLmsRealFailedInfo() {
return null;
}
}

View File

@@ -1,7 +1,6 @@
package org.nl.acs.device_driver.one_manipulator.box_package_manipulator;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -20,8 +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.manipulator_cache.ManipulatorCacheDeviceDriver;
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;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;

View File

@@ -19,7 +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.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO;
import org.nl.acs.enums.VolumeTwoTypeEnum;
import org.nl.acs.history.ErrorUtil;
@@ -399,7 +399,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
}
}
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver;
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver();

View File

@@ -1,20 +1,17 @@
package org.nl.acs.device_driver.stacker.standard_stacker;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
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;
import org.nl.acs.device.enums.ErrorType;
import org.nl.acs.device.service.DeviceExtraService;
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
@@ -25,10 +22,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.domain.AcsDeviceErrorLog;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
@@ -42,6 +36,7 @@ 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;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
@@ -78,6 +73,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
public static final String REDIS_MOVE_BOX = "MOVE:MOVE_TASK";
@Autowired
private RedisUtils redisUtils;
/**
* 禁止入库
*/
@@ -286,6 +286,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction inst = null;
@Override
public Device getDevice() {
return this.device;
@@ -479,6 +481,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);
} catch (Exception e) {
e.printStackTrace();
}
@@ -565,29 +579,58 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return;
} else {
Instruction instruction = instructionService.findByCode(String.valueOf(task));
if (ObjectUtil.isNotEmpty(instruction)){
if (ObjectUtil.isEmpty(instruction)){
message = "one_message9";
return;
}
JSONObject param = new JSONObject();
param.put("task_code", instruction.getTask_code());
param.put("task_id", instruction.getTask_id());
param.put("type", type);
String response = acsToWmsService.applyUpdatePointCode(param);
JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
JSONObject pointCodeJson = JSON.parseObject(jo.getString("body"));
String poinCode = pointCodeJson.getString("poin_code").toString();
if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType()) || type.equals(StandarStirageErroEnum.VOIDANCE.getType())){
updateData1(poinCode, instruction);
}
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())){
updateData2(poinCode, instruction);
try {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
String poinCode = jo.getString("point_code");
if (StrUtil.isNotEmpty(poinCode)) {
String[] split = poinCode.split("-");
Device point = deviceAppService.findDeviceByCode(split[0]);
if (ObjectUtil.isEmpty(point)) {
message = "one_message18";
}
if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) {
updateData1(poinCode, instruction, point, split);
pakageData(point, split);
}
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) {
updateData2(poinCode, instruction, point, split);
pakageData(point, split);
}
}
if (StrUtil.isNotEmpty(jo.getString("task_id"))) {
//取货潜货位阻挡做完移库任务
if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType())) {
//存缓存
redisUtils.set(REDIS_MOVE_BOX, task);
TaskDto taskId = taskserver.findById(jo.getString("task_id"));
if (ObjectUtil.isNotEmpty(taskId)) {
String poinCodeMove = taskId.getStart_point_code();
String[] split = poinCodeMove.split("-");
Device point = deviceAppService.findDeviceByCode(split[0]);
pakageData(point, split);
}
}
}
}catch (Exception e){
this.requireSucess = true;
e.printStackTrace();
}
this.requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
@@ -599,47 +642,81 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
private void updateData2(String poinCode, Instruction instruction) {
Instruction instructionUpdate = new Instruction();
instructionUpdate.setNext_point_code(poinCode);
String[] split = poinCode.split("-");
Device endPoint = deviceAppService.findDeviceByCode(split[0]);
instructionUpdate.setTo_x(endPoint.getExtraValue().get("x").toString());
instructionUpdate.setNext_device_code(split[0]);
instructionUpdate.setTo_y(split[1]);
instructionUpdate.setTo_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
instructionService.updateByInstructionCode(instructionUpdate);
Task taskUpdate = new Task();
taskUpdate.setTo_x(endPoint.getExtraValue().get("x").toString());
taskUpdate.setNext_device_code(split[0]);
taskUpdate.setTo_y(split[1]);
taskUpdate.setTo_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
taskserver.updateByTaskCode(taskUpdate);
private void pakageData( Device point, String[] split) {
List list = new ArrayList();
String x = point.getExtraValue().get("x").toString();
String y = split[1];
String z = split[2];
HashMap map1 = new HashMap();
map1.put("code", "to_x");
map1.put("value", y);
list.add(map1);
HashMap map2 = new HashMap();
map2.put("code", "to_y");
map2.put("value", z);
list.add(map2);
HashMap map3 = new HashMap();
map3.put("code", "to_z");
map3.put("value", x);
list.add(map3);
if (ObjectUtil.isNotEmpty(list)) {
this.writing(list);
}
}
private void updateData1(String poinCode, Instruction instruction) {
Instruction instructionUpdate = new Instruction();
private void updateData2(String poinCode, Instruction instruction, Device point, String[] split) {
Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto();
instructionUpdate.setNext_point_code(poinCode);
instructionUpdate.setNext_device_code(split[0]);
taskUpdate.setNext_point_code(poinCode);
taskUpdate.setNext_device_code(split[0]);
taskUpdate.setTask_id(instructionUpdate.getTask_id());
pakageData2(instruction, instructionUpdate, point, split, taskUpdate);
instructionService.update(instructionUpdate);
taskserver.update(taskUpdate);
}
private void updateData1(String poinCode, Instruction instruction, Device point, String[] split) {
Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto();
instructionUpdate.setStart_point_code(poinCode);
String[] split = poinCode.split("-");
Device starPoint = deviceAppService.findDeviceByCode(split[0]);
instructionUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setStart_device_code(split[0]);
taskUpdate.setStart_point_code(poinCode);
taskUpdate.setStart_device_code(split[0]);
taskUpdate.setTask_id(instructionUpdate.getTask_id());
pakageData1(instruction, instructionUpdate, point, split, taskUpdate);
//更新缓存数据库
instructionService.update(instructionUpdate);
taskserver.update(taskUpdate);
}
private void pakageData1(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) {
instructionUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setFrom_y(split[1]);
instructionUpdate.setFrom_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
instructionService.updateByInstructionCode(instructionUpdate);
Task taskUpdate = new Task();
taskUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
taskUpdate.setStart_device_code(split[0]);
taskUpdate.setFrom_y(split[1]);
taskUpdate.setFrom_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
taskserver.updateByTaskCode(taskUpdate);
}
private void pakageData2(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) {
instructionUpdate.setTo_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setTo_y(split[1]);
instructionUpdate.setTo_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
taskUpdate.setTo_x(starPoint.getExtraValue().get("x").toString());
taskUpdate.setTo_y(split[1]);
taskUpdate.setTo_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
}
/**
* 申请任务
*
@@ -704,18 +781,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
List list = new ArrayList();
HashMap map1 = new HashMap();
map1.put("code", "to_device_code");
map1.put("value", this.getDevice().getAddress());
list.add(map1);
HashMap map2 = new HashMap();
map2.put("code", "to_command");
map2.put("value", 1);
list.add(map2);
HashMap map3 = new HashMap();
map3.put("code", "to_task");
list.add(map3);
map3.put("value", inst.getInstruction_code());
pakageCommand(list, inst.getInstruction_code());
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) {
HashMap map4 = new HashMap();
@@ -737,26 +804,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
HashMap map4 = new HashMap();
map4.put("code", "to_y");
map4.put("value", inst.getFrom_z());
list.add(map4);
if (inst.getFrom_x().length() > 1) {
String substring = inst.getFrom_x().substring(1);
HashMap map5 = new HashMap();
map5.put("code", "to_z");
map5.put("value", substring);
list.add(map5);
} else {
HashMap map6 = new HashMap();
map6.put("code", "to_z");
map6.put("value", inst.getFrom_x());
list.add(map6);
}
HashMap map7 = new HashMap();
map7.put("code", "to_x");
map7.put("value", inst.getFrom_y());
list.add(map7);
pakagePlc(inst, list);
}
if (ObjectUtil.isNotEmpty(list)) {
this.writing(list);
@@ -767,6 +815,44 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return true;
}
private void pakagePlc(Instruction inst, List list) {
HashMap map4 = new HashMap();
map4.put("code", "to_y");
map4.put("value", inst.getFrom_z());
list.add(map4);
if (inst.getFrom_x().length() > 1) {
String substring = inst.getFrom_x().substring(1);
HashMap map5 = new HashMap();
map5.put("code", "to_z");
map5.put("value", substring);
list.add(map5);
} else {
HashMap map6 = new HashMap();
map6.put("code", "to_z");
map6.put("value", inst.getFrom_x());
list.add(map6);
}
HashMap map7 = new HashMap();
map7.put("code", "to_x");
map7.put("value", inst.getFrom_y());
list.add(map7);
}
private void pakageCommand( List list, String inst) {
HashMap map1 = new HashMap();
map1.put("code", "to_device_code");
map1.put("value", this.getDevice().getAddress());
list.add(map1);
HashMap map2 = new HashMap();
map2.put("code", "to_command");
map2.put("value", 1);
list.add(map2);
HashMap map3 = new HashMap();
map3.put("code", "to_task");
map3.put("value", inst);
list.add(map3);
}
/**
* 将指令根据优先级和创建时间排序
*

View File

@@ -617,7 +617,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyUpdatePointCode");
AddressDto addressDto = addressService.findByCode("deviceApplyExceptional");
String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null;
try {

View File

@@ -445,5 +445,4 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
*/
Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode);
void updateByInstructionCode(Instruction instructionUpdate);
}

View File

@@ -1,11 +1,9 @@
package org.nl.acs.instruction.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.stream.CollectorUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -17,7 +15,6 @@ 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;
@@ -28,7 +25,6 @@ import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.domain.DeviceErpmapping;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
@@ -36,7 +32,6 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
@@ -1717,13 +1712,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.isEmpty();
}
@Override
public void updateByInstructionCode(Instruction instructionUpdate) {
InstructionMybatis entity = ConvertUtil.convert(instructionUpdate, InstructionMybatis.class);
UpdateWrapper<InstructionMybatis> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("instruction_code", instructionUpdate.getInstruction_code());
instructionMapper.update(entity,updateWrapper);
}
private boolean regional( String start_device_code, String next_device_code) {
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);

View File

@@ -511,5 +511,4 @@ public interface TaskService extends CommonService<Task> {
*/
TaskDto findByTaskCode(String task_code);
void updateByTaskCode(Task taskUpdate);
}

View File

@@ -2,13 +2,12 @@ package org.nl.acs.task.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -30,9 +29,6 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.dto.DeviceAssignedDto;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.RequestMethodEnum;
import org.nl.acs.ext.wms.data.one.BaseRequest;
import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.domain.InstructionMybatis;
@@ -48,7 +44,6 @@ import org.nl.acs.route.service.mapper.RoutePlanMapper;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskFeedbackService;
import org.nl.acs.task.service.dto.TaskFeedbackDto;
import org.nl.acs.common.base.PageInfo;
import org.nl.acs.common.base.QueryHelpMybatisPlus;
import org.nl.acs.common.base.impl.CommonServiceImpl;
@@ -75,7 +70,6 @@ import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Matcher;
@@ -1519,12 +1513,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return null;
}
@Override
public void updateByTaskCode(Task taskUpdate) {
UpdateWrapper<Task> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("task_code", taskUpdate.getTask_code());
taskMapper.update(taskUpdate,updateWrapper);
}
/**
* 把多个字符串拼接的inst_nextDevice_code解析成集合

View File

@@ -15,6 +15,10 @@
*/
package org.nl.system.service.secutiry.impl;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.config.SaCookieConfig;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaCookie;
import cn.dev33.satoken.secure.SaSecureUtil;
import cn.dev33.satoken.stp.SaLoginModel;
import cn.dev33.satoken.stp.StpUtil;
@@ -257,6 +261,19 @@ public class OnlineUserService {
.setDevice("PC")
.setExtra("loginInfo", user)
);
String tokenValue = StpUtil.getTokenValue();
SaCookieConfig cfg = SaManager.getConfig().getCookie();
SaCookie cookie = new SaCookie()
.setName(StpUtil.getTokenValue())
.setValue(tokenValue)
.setMaxAge(-1)
.setDomain(cfg.getDomain())
.setPath(cfg.getPath())
.setSecure(cfg.getSecure())
.setHttpOnly(cfg.getHttpOnly())
.setSameSite(cfg.getSameSite())
;
SaHolder.getResponse().addCookie(cookie);
// 返回 token 与 用户信息
JSONObject jsonObject = new JSONObject();