diff --git a/src/apis/scene/type.ts b/src/apis/scene/type.ts
index 61527e7..8984de1 100644
--- a/src/apis/scene/type.ts
+++ b/src/apis/scene/type.ts
@@ -158,3 +158,43 @@ export interface StorageLocationClientMessage {
type: 'get_status';
timestamp: string;
}
+
+// 库位任务相关类型定义
+export interface BinTaskOperation {
+ operation: string;
+ recfile?: string;
+ recognize?: boolean;
+ use_down_pgv?: boolean;
+ use_pgv?: boolean;
+ pgv_x_adjust?: boolean;
+}
+
+export interface BinTaskItem {
+ Load?: BinTaskOperation;
+ Unload?: BinTaskOperation;
+}
+
+export interface BinLocationProperty {
+ key: string;
+ type: string;
+ stringValue: string;
+}
+
+export interface BinLocationItem {
+ className: string;
+ instanceName: string;
+ pointName: string;
+ pos: {
+ x: number;
+ y: number;
+ };
+ property: BinLocationProperty[];
+}
+
+export interface BinLocationGroup {
+ binLocationList: BinLocationItem[];
+}
+
+export interface BinLocationsList {
+ binLocationsList: BinLocationGroup[];
+}
diff --git a/src/components/card/point-detail-card.vue b/src/components/card/point-detail-card.vue
index ffd3aa5..76031b5 100644
--- a/src/components/card/point-detail-card.vue
+++ b/src/components/card/point-detail-card.vue
@@ -1,51 +1,11 @@
diff --git a/src/services/editor.service.ts b/src/services/editor.service.ts
index 27a656e..d8b117b 100644
--- a/src/services/editor.service.ts
+++ b/src/services/editor.service.ts
@@ -13,6 +13,8 @@ import {
} from '@api/map';
import type { RobotGroup, RobotInfo, RobotRealtimeInfo, RobotType } from '@api/robot';
import type {
+ BinLocationGroup,
+ BinLocationItem,
GroupSceneDetail,
SceneData,
StandardScene,
@@ -106,6 +108,106 @@ export class EditorService extends Meta2d {
return (this.#originalSceneData as Record)?.binLocationsList;
}
+ /**
+ * 获取并验证库位组数据
+ * @returns 库位组数组,如果数据无效则返回空数组
+ */
+ private getBinLocationGroups(): BinLocationGroup[] {
+ const rawData = this.getBinLocationsList();
+ if (!rawData) return [];
+
+ const binLocationGroups = Array.isArray(rawData)
+ ? (rawData as BinLocationGroup[])
+ : (rawData as { binLocationsList: BinLocationGroup[] })?.binLocationsList;
+
+ return Array.isArray(binLocationGroups) ? binLocationGroups : [];
+ }
+
+ /**
+ * 检查库位项是否存在
+ * @param pointName 动作点名称
+ * @param locationName 库位名称
+ * @returns 如果库位项存在则返回true,否则返回false
+ */
+ private checkBinLocationExists(pointName: string, locationName: string): boolean {
+ const binLocationGroups = this.getBinLocationGroups();
+
+ return binLocationGroups.some(
+ (group) =>
+ group &&
+ Array.isArray(group.binLocationList) &&
+ group.binLocationList.some(
+ (item) => item && item.pointName === pointName && item.instanceName === locationName,
+ ),
+ );
+ }
+
+ /**
+ * 更新库位任务配置中的库位名称
+ * @param pointName 动作点名称
+ * @param oldLocationName 旧的库位名称
+ * @param newLocationName 新的库位名称
+ */
+ public updateBinLocationName(pointName: string, oldLocationName: string, newLocationName: string): void {
+ // 预检查:确保要更新的库位项存在
+ if (!this.checkBinLocationExists(pointName, oldLocationName)) {
+ return;
+ }
+
+ const binLocationGroups = this.getBinLocationGroups();
+ if (binLocationGroups.length === 0) return;
+
+ // 遍历所有库位组,查找匹配的库位并更新名称
+ binLocationGroups.forEach((group) => {
+ if (group && Array.isArray(group.binLocationList)) {
+ group.binLocationList.forEach((item: BinLocationItem) => {
+ if (item && item.pointName === pointName && item.instanceName === oldLocationName) {
+ item.instanceName = newLocationName;
+ }
+ });
+ }
+ });
+
+ // 更新原始场景数据
+ if (!this.#originalSceneData) {
+ this.#originalSceneData = {};
+ }
+ (this.#originalSceneData as Record).binLocationsList = binLocationGroups;
+ }
+
+ /**
+ * 删除库位任务配置中的库位
+ * @param pointName 动作点名称
+ * @param locationName 要删除的库位名称
+ */
+ public removeBinLocation(pointName: string, locationName: string): void {
+ // 预检查:确保要删除的库位项存在
+ if (!this.checkBinLocationExists(pointName, locationName)) {
+ return;
+ }
+
+ const binLocationGroups = this.getBinLocationGroups();
+ if (binLocationGroups.length === 0) return;
+
+ // 遍历所有库位组,查找匹配的库位并删除
+ binLocationGroups.forEach((group) => {
+ if (group && Array.isArray(group.binLocationList)) {
+ const index = group.binLocationList.findIndex(
+ (item: BinLocationItem) => item && item.pointName === pointName && item.instanceName === locationName,
+ );
+ if (index !== -1) {
+ group.binLocationList.splice(index, 1);
+ }
+ }
+ });
+
+ // 更新原始场景数据
+ if (!this.#originalSceneData) {
+ this.#originalSceneData = {};
+ }
+ (this.#originalSceneData as Record).binLocationsList = binLocationGroups;
+ }
+
/**
* 加载机器人数据到编辑器
* @param groups 机器人组列表