refactor(robot): 将机器人载货状态字段从isCarrying统一为isLoading以保持数据一致性

This commit is contained in:
xudan 2025-12-02 11:10:13 +08:00
parent f6cebf903d
commit 4d1b423ab7
4 changed files with 8 additions and 9 deletions

View File

@ -24,7 +24,7 @@ export type RobotPen = Pen & {
isWaring?: boolean;
isFault?: boolean;
isCharging?: boolean; // 是否充电中
isCarrying?: boolean; // 是否载货
isLoading?: 0 | 1; // 是否载货
path?: { x: number; y: number }[];
angle?: number;
};
@ -46,7 +46,6 @@ export interface RobotInfo {
targetPoint?: string; // 目标点位(名称)
isLoading?: 0 | 1; // 载货状态1载货0空载实时数据透传
isCharging?: boolean; // 是否充电中
isCarrying?: boolean; // 是否载货
}
export interface RobotDetail extends RobotInfo {
@ -69,7 +68,7 @@ export interface RobotRealtimeInfo extends RobotInfo {
isWaring?: boolean; // 是否告警
isFault?: boolean; // 是否故障
isCharging?: boolean; // 是否充电中
isCarrying?: boolean; // 是否载货
isLoading?: 0 | 1; // 是否载货
}
// AMR Redis状态接口 - 更新为实际返回的数据结构

View File

@ -17,7 +17,7 @@
{{ getRobotStatusText((robotInfo.state as any) || 'offline') }}
</div>
<div class="robot-extra-statuses">
<span v-if="robotInfo.isCarrying" class="extra-status-tag">载货中</span>
<span v-if="robotInfo.isLoading" class="extra-status-tag">载货中</span>
<span v-if="!robotInfo.canOrder" class="extra-status-tag">不接单</span>
<span v-if="robotInfo.isCharging" class="extra-status-tag">充电中</span>
</div>

View File

@ -32,7 +32,7 @@ export function useRobotRenderer(editorService: ShallowRef<EditorService | undef
isWaring,
isFault,
isCharging = 0,
isCarrying = 0,
isLoading = 0,
canOrder,
...rest
} = data;
@ -41,7 +41,7 @@ export function useRobotRenderer(editorService: ShallowRef<EditorService | undef
editor.updateRobot(id, {
...rest,
isCharging: isCharging as any,
isCarrying: isCarrying as any,
isLoading: isLoading as any,
canOrder: canOrder as any,
});
@ -61,7 +61,7 @@ export function useRobotRenderer(editorService: ShallowRef<EditorService | undef
if (isWaring !== undefined) robotState.isWaring = isWaring;
if (isFault !== undefined) robotState.isFault = isFault;
if (isCharging !== undefined) robotState.isCharging = isCharging;
if (isCarrying !== undefined) robotState.isCarrying = isCarrying;
if (isLoading !== undefined) robotState.isLoading = isLoading;
if (canOrder !== undefined) robotState.canOrder = canOrder;
if (Object.keys(robotState).length > 0) {

View File

@ -442,11 +442,11 @@ export class EditorRobotService {
const r1: any = pen.robot ?? {};
const r2 = this.getRobotById(pen.id || '');
const toBool = (v: any) => v === true || v === 1 || v === '1';
const isCarrying = toBool(r1?.isCarrying ?? r2?.isCarrying);
const isLoading = toBool(r1?.isLoading ?? r2?.isLoading);
const canOrder = toBool(r1?.canOrder ?? r2?.canOrder);
const isCharging = toBool(r1?.isCharging ?? r2?.isCharging);
if (isCarrying) return cargoIcon;
if (isLoading) return cargoIcon;
if (!canOrder) return notAcceptingOrdersIcon;
if (isCharging) return chargingIcon;
return null;