You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

321 lines
6.9 KiB

/**
* LCC 物流控制中心客户端 API 声明
*/
declare interface LCC {
/**
* 打印日志
*/
log(message: string, ...args: any[]): void
/**
* 延时函数
*/
sleep(timeOfMs: number = 1000): Promise<void>
/**
* 读取当前项目所有库存, 并放到 Model 上
*/
queryInv(option: InvQueryCondition = {}): Promise<ServerResponse<InvVo[]>>
/**
* 创造库存
* @param lpn 容器号
* @param targetStore 目标存储位置 rack3/0/0/0
*/
createInv(lpn: string, targetStore: string): Promise<ServerResponse<void>>
/**
* 转移库存
* @param lpn 容器号
* @param targetStore 目标存储位置 rack3/0/0/0
*/
moveInv(lpn: string, targetStore: string): Promise<ServerResponse<void>>
/**
* 删除库存
* @param lpn 容器号
*/
deleteInv(lpn: string): Promise<ServerResponse<void>>
/**
* 保存当前项目所有脚本
* @param scriptList
*/
saveScripts(scriptList: { name: string, content: string }[]): Promise<ServerResponse<void>>
/**
* 同步当前项目所有脚本
*/
syncScripts(): Promise<ServerResponse<{ name: string, content: string }[]>>
/**
* 获取所有设备状态
*/
queryDeviceInfoList(): Promise<ServerResponse<AgvStatusVo[]>>
/**
* 获取服务器状态信息
*/
queryServerState(option: { projectUUID?: string, envId?: string } = {}): Promise<ServerResponse<ServerStatusVo[]>>
/**
* 获取服务器状态信息
*/
startServer(projectUUID: string, envId: string): Promise<ServerResponse<String>>
/**
* 停止服务器
*/
stopServer(projectUUID: string, envId: string): Promise<ServerResponse<String>>
/**
* 连接到服务器, 根据 worldModel 当前选中的服务器和环境进行连接
*/
connectServer(): Promise<void>
/**
* 断开连接
*/
disconnectServer(): Promise<void>
/**
* 等待服务端授权
*/
getAuthorizationConfig(): Promise<ServerResponse<ServerAuthorizationConfigVo>>
}
/**
* 后端消息主题
*/
type BackendTopicType = 'ServerState' | 'ClientState' | 'TaskUpdate' | 'InvUpdate' |
'DeviceStatus' | 'DeviceAlive' | 'Logs' | 'Alarm' | 'ScriptUpdate'
type DeviceAliveFn = (type: BackendTopicType, topic: string, body: DeviceAliveVo) => void
type DeviceStatusFn = (type: BackendTopicType, topic: string, body: AgvStatusVo) => void
type ServerStateFn = (type: BackendTopicType, topic: string, body: ServerStatusVo) => void
type InvUpdateFn = (type: BackendTopicType, topic: string, body: InvUpdateVo) => void
type StopSubscribe = () => void
interface InvQueryCondition {
lpn?: string
locCode?: string
wayPoint?: string
wayDirection?: LLCDirection
catalogCode?: string
rack?: string
bay?: number
level?: number
cell?: number
}
interface ServerAuthorizationConfigVo {
/**
* 授权码
*/
authorizationCode: string
/**
* 授权过期时间戳
*/
expirationTime: number
/**
* 前端推送服务器配置
*/
frontendMqtt: {
brokerUrl: string
username: string
password: string
websocket: string
}
}
/**
* 后端消息回调
*/
type BackendMessageHandler = (type: BackendTopicType, topic: string, message: any) => void
type ContainerT = 'pallet' | 'tote' | 'carton' | 'box'
interface DeviceAliveVo {
id: string
type: string
online: boolean
}
interface AgvStatusVo {
// 设备 ID
id: string
// 设备类型
type: string
// 是否在线
isOnline: boolean
// 是否系统托管
isSystemManaged: boolean
// 设备x,y,z坐标
x: number
y: number
z: number
// 设备逻辑坐标x,y
logicX: number
logicY: number
// 设备姿态(up/down/left/right)
direction: string
// 设备旋转角度
orientation: number
// 电池电量
soc: number
// 工作模式:
// AMR_FREE_MODE=空闲模式;
// AMR_INIT_MODE=初始化模式;
// AMR_TASK_MODE=任务模式;
// AMR_SINGLE_ACTION_MODE=单动作模式;
// AMR_MANUAL_MODE=手动模式;
// AMR_HANDSET_MODE=遥控器模式;
// AMR_CHARGE_MODE=充电模式;
// AMR_TASK_INTERRUPT_MODE=任务被中断模式;
// AMR_CUSTOMIZE_MODE=自定义模式;
mode: 'AMR_FREE_MODE' | 'AMR_INIT_MODE' | 'AMR_TASK_MODE' | 'AMR_SINGLE_ACTION_MODE' | 'AMR_MANUAL_MODE' | 'AMR_HANDSET_MODE' | 'AMR_CHARGE_MODE' | 'AMR_TASK_INTERRUPT_MODE' | 'AMR_CUSTOMIZE_MODE'
// 任务状态 ID: IDLE / PAUSED / EXECUTING
taskStatus: string
// 是否阻挡
isBlocked: boolean
// 已完成任务数
taskCompleted: number
// 总共任务数,通过 taskCompleted/taskTotalCount 可以计算出完成率
taskTotalCount: number
// 业务任务ID
bizTaskId: string
// 业务任务类型: 移动任务 / 充电任务 / 搬运任务 / 装载任务 / 卸载任务
bizTaskType: '' | 'MOVE' | 'CHARGE' | 'CARRY' | 'LOAD' | 'UNLOAD'
// 业务任务类型: 待调度 / 设备执行中 / 暂停执行 / 调度异常 / 规划异常 / 设备执行异常
bizTaskStatus: 'WAITING_FOR_DISPATCH' | 'DEVICE_EXECUTING' | 'PAUSED' | 'DISPATCH_ERROR' | 'PLANNING_ERROR' | 'DEVICE_ERROR'
// 比如 WAY_1_1 Rack1/0/0/0
bizTaskFrom: string
// 比如 WAY_1_1 Rack1/0/0/0 charge1
bizTaskTo: string
// 搬运托盘号
bizLpn: string
virtualLocationAt: string; // 车所在的标记位置,及方向 11_4:RIGHT
virtualExecutorPayload: string; // 车的虚拟执行器负载
loadBasLocationVo: BasLocationVo | null
unloadBasLocationVo: BasLocationVo | null
}
interface BasLocationVo {
/**
* 位置编码
*/
locCode: string
/**
* 货位类型
*/
locType: string
/**
* 货位
*/
rack: string
/**
* 列
*/
bay: number
/**
* 层
*/
level: number
/**
* 格
*/
cell: number
}
interface InvUpdateVo {
lpn: string
before: BasLocationVo | null
after: BasLocationVo | null
qty: number
}
/**
* 服务器状态信息
*/
interface ServerStatusVo {
projectUuid: string;
envId: number;
isVirtual: boolean;
serverId: string;
isRunning: boolean;
startTime: number;
stopTime: number;
timeRate: number;
subSystemList: string[];
cpuUsage: number;
memoryUsage: number;
diskIoLoad: number;
/**
* 空闲内存,单位GB
*/
freeMemory: number;
/**
* 磁盘剩余空间,单位GB
*/
diskFreeSpace: number;
envConfig: EnvConfigVo;
projectLabel: string;
}
interface InvVo {
lpn: string
container_type: ContainerT
loc_code: string
rack: string
bay: number
level: number
cell: number
way_point: string
loc_direction: LLCDirection
catalog_code: string
is_lock: boolean
is_frozen: boolean
}
interface ExecutorVo {
executor_id: string
virtual_floor_code: string
virtual_executor_payload: any
virtual_location_at: string
}
interface LccProjectVo {
projectUuid: string
projectLabel: string
projectFileLocation: string
directoryData: CatalogGroupVo[]
otherData: any
}
interface CatalogGroupVo {
label: string,
items: CatalogItem[]
}
interface CatalogItem {
catalogCode: string
label: string
}
/**
* LCC 物流控制中心服务端 API 接口
*/
declare const LCC: LCC