fix: 二楼到一楼输送线修改

This commit is contained in:
2024-03-28 09:54:29 +08:00
parent 00830d1835
commit 1442d2d780
6 changed files with 86 additions and 43 deletions

View File

@@ -291,12 +291,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
applyAgvTask();
}
break;
case 6:
//二楼到一楼输送线申请行架任务
if (move == 1 && !requireSucess) {
applyManipulatorTask();
}
break;
default:
break;
@@ -320,34 +315,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
private void applyManipulatorTask() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("material_barcode", material_barcode);
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param);
String response = acsToWmsService.applyTowToOne(param);
JSONObject jo = JSON.parseObject(response);
if (response == null || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
public void writing(int command) {

View File

@@ -11,7 +11,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* 一楼木箱出入库站点
* 子卷下卷输送线工位(二楼下一楼区域)
*
*/
@Service
@@ -23,12 +23,12 @@ public class BoxStorageOutConveyorDefination implements OpcDeviceDriverDefinatio
@Override
public String getDriverName() {
return "一楼木箱出入库标准站点";
return "子卷下卷输送线工位(二楼下一楼区域)";
}
@Override
public String getDriverDescription() {
return "一楼木箱出入库标准站点";
return "子卷下卷输送线工位(二楼下一楼区域)";
}
@Override

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -37,6 +38,8 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server;
@@ -74,6 +77,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
//当前指令
Instruction inst = null;
@@ -114,6 +121,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
int to_height = 0;
int last_to_height = 0;
//子卷条码
String material_barcode = null;
String last_material_barcode = null;
int phase = 0;
int index = 0;
Boolean isonline = true;
@@ -174,6 +185,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task();
heartbeat = this.itemProtocol.getHeartbeat();
material_barcode = this.itemProtocol.getMaterialBarcode();
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
@@ -221,6 +233,12 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
instruction_require();
}
break;
case 4:
//二楼到一楼输送线申请行架任务
if (move == 1 && !requireSucess) {
applyManipulatorTask();
}
break;
}
}
last_mode = mode;
@@ -313,6 +331,35 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
private void applyManipulatorTask() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("material_barcode", material_barcode);
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param);
String response = acsToWmsService.applyTowToOne(param);
JSONObject jo = JSON.parseObject(response);
if (response == null || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
/**
* 请求指令

View File

@@ -65,6 +65,11 @@ public class ItemProtocol {
*/
public static String item_to_task = "to_task";
/**
* 子卷条码
*/
public static String item_material_barcode = "material_barcode";
private BoxStorageOutConveyorDeviceDriver driver;
@@ -82,6 +87,10 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_heartbeat);
}
public String getMaterialBarcode() {
return this.getOpcStringValue(item_material_barcode);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
@@ -134,6 +143,16 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isBlank(value)) {
} else {
return value;
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
@@ -146,6 +165,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7"));
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
list.add(new ItemDto(item_material_barcode, "子卷条码", "DB601.STRING1.50"));
return list;
}

View File

@@ -334,8 +334,6 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
TaskDto taskDtoIns = taskDtoInstruction.get(0);
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code());
String interactionJson = taskDtoIns.getInteraction_json();
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
String start_device_code = taskDtoIns.getStart_device_code();
String next_device_code = taskDtoIns.getNext_device_code();
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
@@ -363,7 +361,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
+ ",指令终点:" + instruction.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage());
+ ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage());
}
this.setRequireSucess(true);
return true;
@@ -397,10 +395,19 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
}
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver;
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriverStar;
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getMode() !=1) {
manipulatorCacheDeviceDriverStar = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriverStar.getMode() != 2 && manipulatorCacheDeviceDriverStar.getMode() !=1) {
notCreateInstMessage = "universal_notCreateInstMessage3";
return false;
}
}
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriverEnd;
if (nextDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriverEnd = (ManipulatorCacheDeviceDriver) nextDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriverEnd.getMode() != 2 && manipulatorCacheDeviceDriverEnd.getMode() !=1) {
notCreateInstMessage = "universal_notCreateInstMessage3";
return false;
}

View File

@@ -79,6 +79,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
//工作模式
int mode = 0;
int last_mode = 0;
//光电信号
int move = 0;
int last_move = 0;