add : 测试

This commit is contained in:
2024-01-26 13:56:15 +08:00
parent bb99c99e68
commit c27c42de8b
11 changed files with 308 additions and 301 deletions

View File

@@ -36,6 +36,8 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
@@ -232,62 +234,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (container_direction != last_container_direction) {
logServer.deviceItemValue(this.device_code, "carrier_direction", String.valueOf(container_direction));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_direction" + last_container_direction + "->" + container_direction);
}
if (container_type != last_container_type) {
logServer.deviceItemValue(this.device_code, "container_type", String.valueOf(container_type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_type" + last_container_type + "->" + container_type);
}
if (container_no != last_container_no) {
logServer.deviceItemValue(this.device_code, "container_no", String.valueOf(container_no));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_no" + last_container_no + "->" + container_no);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (to_command != last_to_command) {
logServer.deviceItemValue(this.device_code, "to_command", String.valueOf(to_command));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceItemValue(this.device_code, "to_target", String.valueOf(to_target));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceItemValue(this.device_code, "to_task", String.valueOf(to_task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (to_container_no != last_to_container_no) {
logServer.deviceItemValue(this.device_code, "to_container_no", String.valueOf(to_container_no));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_container_no" + last_to_container_no + "->" + to_container_no);
}
if (to_container_type != last_to_container_type) {
logServer.deviceItemValue(this.device_code, "to_container_type", String.valueOf(to_container_type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_container_type" + last_to_container_type + "->" + to_container_type);
}
if (error != last_error) {
if (error != 0) {
DeviceErrorLogDto acsDeviceErrorLog = new DeviceErrorLogDto();
acsDeviceErrorLog.setDevice_code(this.device_code);
acsDeviceErrorLog.setError_code(String.valueOf(error));
String errorInfo = ErrorUtil.getDictDetail(ErrorType.CONVEYOR_ERROR.getErrorType(), String.valueOf(error));
acsDeviceErrorLog.setError_info(errorInfo);
errorLogServer.create(acsDeviceErrorLog);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (move != 0 && task > 0) {
@@ -346,6 +292,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
applyManipulatorTask();
}
break;
case 7:
//申请空托盘到叠盘位的任务
//TODO 申请行架任务
if (move == 1 && !requireSucess) {
applyEmpotyTask();
}
break;
default:
break;
}
@@ -367,6 +320,16 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
private void applyEmpotyTask() {
JSONObject param = new JSONObject();
param.put("device_code", device_code);
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param);
HttpResponse response = acsToWmsService.shipDeviceUpdate(param);
if (response == null || response.getStatus() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,接口返回:" + response.body());
}
}
private void applyManipulatorTask() {
JSONObject param = new JSONObject();
@@ -488,19 +451,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
public void writing(Map<String, Object> map) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}
/*public synchronized void request_for_shipment(String mode, String item_out_seq_arr, int[] item_out_qty_arr) {
@@ -591,13 +541,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isEmpty(inst)) {
return false;
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_target", next_addr);
map.put("to_task", inst.getInstruction_code());
map.put("to_command", CommonFinalParam.ONE);
map.put("to_container_type", CommonFinalParam.ONE);
map.put("to_container_no", CommonFinalParam.ONE);
this.writing(map);
List list = new ArrayList();
writeData(next_addr, list, inst);
led_message = getLedMessage(inst);
requireSucess = true;
return true;
@@ -607,7 +552,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isNull(taskdto)) {
return false;
}
if (ObjectUtil.isNotNull(taskdto) && CommonFinalParam.ONE.equals(taskdto.getTask_type())) {
if (ObjectUtil.isNotNull(taskdto) && TaskTypeEnum.Conveyor_Task.getIndex().equals(taskdto.getTask_type())) {
//判断指令的起点和当前的设备号相同
if (!taskdto.getStart_device_code().equals(device_code)) {
return false;
@@ -658,23 +603,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
next_point_code = next_device_code;
}
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(taskdto.getRemark());
instdto.setMaterial(taskdto.getMaterial());
instdto.setQuantity(taskdto.getQuantity());
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
packageData(instdto, route_plan_code, taskdto, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority);
log.error("=================================,{}", instdto.getCreate_by());
try {
instructionService.create(instdto);
@@ -683,17 +612,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
log.error("指令创建失败!,{}", e.getMessage());
return false;
}
taskdto.setTask_status(CommonFinalParam.ONE);
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskserver.update(taskdto);
requireSucess = true;
Map<String, Object> map = new LinkedHashMap<>();
String next_addr = nextdevice.getExtraValue().get("address").toString();
map.put("to_target", next_addr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_command", CommonFinalParam.ONE);
map.put("to_container_type", CommonFinalParam.ONE);
map.put("to_container_no", CommonFinalParam.ONE);
this.writing(map);
List list = new ArrayList();
writeData(next_addr, list, instdto);
led_message = getLedMessage(instdto);
requireSucess = true;
return true;
@@ -703,6 +627,51 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
}
private void writeData(String next_addr, List list, Instruction inst) {
Map map = new HashMap();
map.put("code", "to_target");
map.put("value", next_addr);
list.add(map);
Map map1 = new HashMap();
map1.put("code", "to_task");
map1.put("value", inst.getInstruction_code());
list.add(map1);
Map map2 = new HashMap();
map2.put("code", "to_command");
map2.put("value", "1");
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_container_type");
map3.put("value", "1");
list.add(map3);
Map map4 = new HashMap();
map4.put("code", "to_container_no");
map4.put("value", "1");
list.add(map4);
this.writing(list);
}
private static void packageData(Instruction instdto, String route_plan_code, TaskDto taskdto, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code, String priority) {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(taskdto.getRemark());
instdto.setMaterial(taskdto.getMaterial());
instdto.setQuantity(taskdto.getQuantity());
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
}
public void writeData(String next_addr, Instruction instdto, Map map) {
}
@@ -821,7 +790,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
}
//当货物到达b点,实现完成指令
if (StrUtil.equals(inst.getInstruction_status(), CommonFinalParam.ONE) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
inst.setExecute_device_code(this.device_code);
finish_instruction();

View File

@@ -173,7 +173,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
if (move != 0 && task > 0) {
if (move != 0 && task > 0) {
update_instruction_status();
}

View File

@@ -19,6 +19,7 @@ import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.enums.InstructionStatusEnum;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
@@ -130,6 +131,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
String vehicle_code;
String inst_message;
String task_code = null;
List<String> getDeviceCodeList = null;
@@ -161,69 +165,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
container_type = this.itemProtocol.getContainer_type();
carrier_direction = this.itemProtocol.getCarrier_direction();
if (to_container_type != last_to_container_type) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_container_type" + last_to_container_type + "->" + to_container_type);
}
if (container_type != last_container_type) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_type" + last_container_type + "->" + container_type);
}
if (qty != last_qty) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号qty" + last_qty + "->" + qty);
}
if (carrier_direction != last_carrier_direction) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction" + last_carrier_direction + "->" + carrier_direction);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
// 更新指令状态
if (mode == 3 && task > 0) {
Date date = new Date();
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
} else {
this.instruction_update_time = date;
//更改指令状态
if (task > 0) {
Instruction inst = checkInst();
if (inst != null) {
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
inst.setInstruction_status(CommonFinalParam.ONE);
inst.setExecute_device_code(this.device_code);
instructionService.update(inst);
}
}
}
}
if (move != 0 && task > 0) {
update_instruction_status();
}
} catch (Exception var17) {
@@ -360,6 +304,53 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
}
}
/**
* 更新指令状态
*/
public synchronized void update_instruction_status() throws Exception {
Date date = new Date();
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
} else {
this.instruction_update_time = date;
inst = checkInst();
if (inst != null) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
vehicle_code = inst.getVehicle_code();
task_code = inst.getTask_code();
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
inst.setExecute_device_code(this.device_code);
instructionService.update(inst);
logServer.deviceExecuteLog(device_code, "", "", "纸箱入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code());
}
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
inst.setExecute_device_code(this.device_code);
if (mode == 2) {
finish_instruction();
}
logServer.deviceExecuteLog(device_code, "", "", "纸箱入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code());
} else {
}
}
} else {
// message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成";
inst_message = null;
}
}
}
public synchronized boolean finish_instruction() throws Exception {
instructionService.finish(inst);
return true;
}
@Override
public JSONObject feedLmsRealFailedInfo() {
JSONObject jo = new JSONObject();

View File

@@ -379,7 +379,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
String vehiclecode = taskdto.getVehicle_code();
String priority = taskdto.getPriority();
Instruction instdto = new Instruction();
if (TaskTypeEnum.AGV_Task.equals(taskdto.getTask_type())){
if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())){
String route_plan_code = taskdto.getRoute_plan_code();
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskdto.getStart_device_code(), taskdto.getNext_device_code(), route_plan_code);

View File

@@ -354,9 +354,6 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -379,29 +376,31 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getSeq())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_seq");
map5.put("value", interactionJsonDTO.getSeq());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLastOne())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_last_one");
map6.put("value", interactionJsonDTO.getLastOne());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getDirection())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_direction");
map7.put("value", interactionJsonDTO.getDirection());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getMaxNo())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_max_no");
map8.put("value", interactionJsonDTO.getMaxNo());
list.add(map8);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getSeq())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_seq");
map5.put("value", interactionJsonDTO.getSeq());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLastOne())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_last_one");
map6.put("value", interactionJsonDTO.getLastOne());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getDirection())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_direction");
map7.put("value", interactionJsonDTO.getDirection());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getMaxNo())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_max_no");
map8.put("value", interactionJsonDTO.getMaxNo());
list.add(map8);
}
}
try {

View File

@@ -336,7 +336,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO);
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -359,35 +359,37 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
map5.put("value", interactionJsonDTO.getWeight());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_length");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeight())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_height");
map7.put("value", interactionJsonDTO.getHeight());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_barcode");
map8.put("value", interactionJsonDTO.getBarcode());
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLayer())) {
Map<String, Object> map9 = new HashMap<>();
map9.put("code", "to_layer");
map9.put("value", interactionJsonDTO.getLayer());
list.add(map9);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
map5.put("value", interactionJsonDTO.getWeight());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_length");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeight())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_height");
map7.put("value", interactionJsonDTO.getHeight());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_barcode");
map8.put("value", interactionJsonDTO.getBarcode());
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLayer())) {
Map<String, Object> map9 = new HashMap<>();
map9.put("code", "to_layer");
map9.put("value", interactionJsonDTO.getLayer());
list.add(map9);
}
}
try {

View File

@@ -333,7 +333,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO);
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -356,35 +356,37 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
map5.put("value", interactionJsonDTO.getWeight());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_length");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeight())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_height");
map7.put("value", interactionJsonDTO.getHeight());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_barcode");
map8.put("value", interactionJsonDTO.getBarcode());
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getContainerType())) {
Map<String, Object> map9 = new HashMap<>();
map9.put("code", "to_container_type");
map9.put("value", interactionJsonDTO.getContainerType());
list.add(map9);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
map5.put("value", interactionJsonDTO.getWeight());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_length");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeight())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_height");
map7.put("value", interactionJsonDTO.getHeight());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_barcode");
map8.put("value", interactionJsonDTO.getBarcode());
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getContainerType())) {
Map<String, Object> map9 = new HashMap<>();
map9.put("code", "to_container_type");
map9.put("value", interactionJsonDTO.getContainerType());
list.add(map9);
}
}
try {

View File

@@ -332,7 +332,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO);
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -355,35 +355,37 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
map5.put("value", interactionJsonDTO.getWeight());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_length");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeight())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_height");
map7.put("value", interactionJsonDTO.getHeight());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTemplate())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_template");
map8.put("value", interactionJsonDTO.getTemplate());
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTemplate())) {
Map<String, Object> map9 = new HashMap<>();
map9.put("code", "to_last_one");
map9.put("value", interactionJsonDTO.getIsLastOne());
list.add(map9);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
map5.put("value", interactionJsonDTO.getWeight());
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_length");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeight())) {
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_height");
map7.put("value", interactionJsonDTO.getHeight());
list.add(map7);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTemplate())) {
Map<String, Object> map8 = new HashMap<>();
map8.put("code", "to_template");
map8.put("value", interactionJsonDTO.getTemplate());
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTemplate())) {
Map<String, Object> map9 = new HashMap<>();
map9.put("code", "to_last_one");
map9.put("value", interactionJsonDTO.getIsLastOne());
list.add(map9);
}
}
try {
this.writing(list);

View File

@@ -456,7 +456,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_type, "物料类型", "DB100.B3"));
list.add(new ItemDto(item_to_task, "任务号", "DB100.D4"));
list.add(new ItemDto(item_to_z, "作业排", "DB100.B8"));
list.add(new ItemDto(item_to_x, "作业列", "DN100.B9"));
list.add(new ItemDto(item_to_x, "作业列", "DB100.B9"));
list.add(new ItemDto(item_to_y, "作业层", "DB100.B10"));
list.add(new ItemDto(item_to_trayCode, "托盘号", "DB100.B11.20"));
return list;

View File

@@ -347,7 +347,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
} else {
Map<String, Object> map = new LinkedHashMap<>();
List list = new ArrayList();
switch (command) {
case 0:
boolean b = applyTask();
@@ -365,28 +366,52 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("z"))) {
map.put("to_x", nextDevice.getExtraValue().get("z"));
Map map = new HashMap();
map.put("code", "to_x");
map.put("value", nextDevice.getExtraValue().get("z"));
list.add(map);
}
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("x"))) {
map.put("to_z", nextDevice.getExtraValue().get("x"));
Map<String, Object> map = new HashMap<>();
map.put("code", "to_z");
map.put("value", nextDevice.getExtraValue().get("x"));
list.add(map);
}
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("y"))) {
map.put("to_y", nextDevice.getExtraValue().get("y"));
Map<String, Object> map = new HashMap<>();
map.put("code", "to_y");
map.put("value", nextDevice.getExtraValue().get("y"));
list.add(map);
}
}
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) {
String pattern = "\\d+";
Pattern compile = Pattern.compile(pattern);
map.put("to_y", inst.getTo_z());
Map<String, Object> map = new HashMap<>();
map.put("code", "to_y");
map.put("value", inst.getTo_z());
list.add(map);
if (inst.getTo_x().length() > 1 && !compile.matcher(inst.getTo_x()).matches()) {
String substring = inst.getTo_x().substring(1);
map.put("to_z", substring);
Map<String, Object> map1 = new HashMap<>();
map1.put("code", "to_z");
map1.put("value", substring);
list.add(map1);
} else {
map.put("to_z", inst.getTo_x());
Map<String, Object> map2 = new HashMap<>();
map2.put("code", "to_z");
map2.put("value", inst.getTo_x());
list.add(map2);
}
map.put("to_x", inst.getTo_y());
Map<String, Object> map3 = new HashMap<>();
map3.put("code", "to_x");
map3.put("value", inst.getTo_y());
list.add(map3);
}
map.put("to_command", 2);
Map<String, Object> map4 = new HashMap<>();
map4.put("code", "to_command");
map4.put("value", 2);
list.add(map4);
requireSucess = true;
break;
case 3:
@@ -408,13 +433,19 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return;
}
}
map.put("to_command", 3);
Map<String, Object> map = new HashMap<>();
map.put("code", "to_command");
map.put("value", 4);
list.add(map);
}
requireSucess = true;
break;
case 5:
message = "放货完成";
map.put("to_command", 5);
Map<String, Object> map = new HashMap<>();
map.put("code", "to_command");
map.put("value", 5);
list.add(map);
Instruction inst = checkInst();
try {
finish_instruction(inst);
@@ -425,17 +456,26 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
break;
case 6:
message = "取货准备(会库位台)";
map.put("to_command", 6);
Map<String, Object> map1 = new HashMap<>();
map1.put("code", "to_command");
map1.put("value", 6);
list.add(map1);
requireSucess = true;
break;
case 7:
message = "召回";
map.put("to_command", 7);
Map<String, Object> map2 = new HashMap<>();
map2.put("code", "to_command");
map2.put("value", 7);
list.add(map2);
requireSucess = true;
break;
case 8:
message = "急停";
map.put("to_command", 8);
Map<String, Object> map3 = new HashMap<>();
map3.put("code", "to_command");
map3.put("value", 8);
list.add(map3);
requireSucess = true;
break;
default:
@@ -443,8 +483,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = true;
break;
}
if (ObjectUtil.isNotNull(map)) {
this.writing(map);
if (ObjectUtil.isNotNull(list)) {
this.writing(list);
}
}

View File

@@ -21,6 +21,7 @@ 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.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
@@ -49,7 +50,7 @@ public class AutoCreateInst {
List<TaskDto> list = taskserver.queryAllByStatus("0");
for (int i = 0; i < list.size(); i++) {
TaskDto acsTask = list.get(i);
if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.AGV_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
continue;
}
String taskid = acsTask.getTask_id();