Browse Source

agvCarry

master
修宁 6 months ago
parent
commit
c13654e17f
  1. 23
      servo/src/main/java/com/galaxis/rcs/common/entity/StoreLocation.java
  2. 16
      servo/src/main/java/com/yvan/workbench/controller/RcsController.java

23
servo/src/main/java/com/galaxis/rcs/common/entity/StoreLocation.java

@ -1,5 +1,7 @@
package com.galaxis.rcs.common.entity;
import org.clever.core.Conv;
/**
* 存储存储位信息
* <pre>
@ -21,4 +23,25 @@ public record StoreLocation(
public String toString() {
return rackId + "_" + bay + "_" + level + "_" + cell;
}
public static StoreLocation of(String rackPosition, String separator) {
// 从 'rack1/0/0/0' 解析为 'rack1_0_0_0'
if (rackPosition == null || rackPosition.isEmpty()) {
throw new RuntimeException("rackPosition cannot be null or empty");
}
String[] parts = rackPosition.split(separator);
if (parts.length == 1) {
return new StoreLocation(parts[0], 0, 0, 0);
}
if (parts.length != 4) {
throw new RuntimeException("Invalid rack position format: " + rackPosition);
}
String rackId = parts[0];
int bay = Conv.asInteger(parts[1]);
int level = Conv.asInteger(parts[2]);
int cell = Conv.asInteger(parts[3]);
return new StoreLocation(rackId, bay, level, cell);
}
}

16
servo/src/main/java/com/yvan/workbench/controller/RcsController.java

@ -172,11 +172,15 @@ public class RcsController {
}
LogisticsRuntime runtime = LogisticsRuntimeService.INSTANCE.getByProjectEnv(projectUUID, envId);
StaticItem sourceItem = runtime.getStaticItemById(fromStoreLoc);
StoreLocation sourceLocation = StoreLocation.of(fromStoreLoc, "/");
StoreLocation targetLocation = StoreLocation.of(targetStoreLoc, "/");
StaticItem sourceItem = runtime.getStaticItemById(sourceLocation.rackId());
if (sourceItem == null) {
return Model.newFail("fromStoreLoc storePoint not found!");
}
StaticItem targetItem = runtime.getStaticItemById(targetStoreLoc);
StaticItem targetItem = runtime.getStaticItemById(targetLocation.rackId());
if (targetItem == null) {
return Model.newFail("targetStoreLoc storePoint not found!");
}
@ -217,8 +221,8 @@ public class RcsController {
bizTask.setBizType(BizTaskType.MOVE.toString());
bizTask.setLpn("N/A");
bizTask.setPriority(Conv.asInteger(option.get("priority"), 1));
bizTask.setTaskFrom(sourceItem.getId());
bizTask.setTaskTo(targetItem.getId());
bizTask.setTaskFrom(fromStoreLoc);
bizTask.setTaskTo(targetStoreLoc);
bizTask.setAllocatedExecutorId(agvId);
bizTask.setBizTaskPayload("N/A");
bizTask.setBizTaskErrorInfo("N/A");
@ -229,8 +233,8 @@ public class RcsController {
CarryTask carryTask = new CarryTask(
agvId, "dummy", 1,
new StoreLocation("rack1", 0, 1, 0),
new StoreLocation("54", 0, 0, 0)
sourceLocation,
targetLocation
);
runtime.pathPlannerMap.get(executorItem.getT())

Loading…
Cancel
Save