|
|
|
@ -92,17 +92,34 @@ export default class LCCScript implements LCC { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
saveAndSyncScripts(scriptList: { name: string; content: string }[]): Promise<ServerResponse<{ name: string; content: string }[]>> { |
|
|
|
/** |
|
|
|
* 保存当前项目所有脚本 |
|
|
|
* @param scriptList |
|
|
|
*/ |
|
|
|
saveScripts(scriptList: { name: string, content: string }[]): Promise<ServerResponse<void>>{ |
|
|
|
if (!worldModel.state.project_uuid) { |
|
|
|
return Promise.reject(new Error('Project UUID or Environment ID is not set.')) |
|
|
|
return Promise.reject(new Error('Project UUID is not set.')) |
|
|
|
} |
|
|
|
|
|
|
|
return Request.request.post('/api/workbench/LccController@saveAndSyncScripts', { |
|
|
|
return Request.request.post('/api/workbench/LccController@saveScripts', { |
|
|
|
projectUUID: worldModel.state.project_uuid, |
|
|
|
scriptList: scriptList |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 同步当前项目所有脚本 |
|
|
|
*/ |
|
|
|
syncScripts(): Promise<ServerResponse<{ name: string, content: string }[]>>{ |
|
|
|
if (!worldModel.state.project_uuid) { |
|
|
|
return Promise.reject(new Error('Project UUID is not set.')) |
|
|
|
} |
|
|
|
|
|
|
|
return Request.request.post('/api/workbench/LccController@syncScripts', { |
|
|
|
projectUUID: worldModel.state.project_uuid, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
queryDeviceInfoList(): Promise<ServerResponse<AgvStatusVo[]>> { |
|
|
|
return Request.request.post('/api/workbench/LccController@queryDeviceInfoList', { |
|
|
|
projectUUID: worldModel.state.project_uuid, |
|
|
|
@ -110,53 +127,6 @@ export default class LCCScript implements LCC { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// // 从后台读取所有车
|
|
|
|
// async loadExecutor(): Promise<ExecutorVo> {
|
|
|
|
// const res = await Request.request.post('/api/workbench/LccController@loadExecutor', {
|
|
|
|
// projectUuid: worldModel.state.project_uuid,
|
|
|
|
// envId: worldModel.state.runState.currentEnvId
|
|
|
|
// })
|
|
|
|
//
|
|
|
|
// for (const row of res.data) {
|
|
|
|
// const executor_id = row.executor_id
|
|
|
|
// const payload = JSON.parse(row.virtual_executor_payload)
|
|
|
|
// // 车所在的标记位置,及方向 11_4:RIGHT
|
|
|
|
// const [wayPointId, direction] = _.split(row.virtual_location_at, ':')
|
|
|
|
//
|
|
|
|
// if (window['Model']) {
|
|
|
|
// const point = Model.find(wayPointId)
|
|
|
|
// if (!point) {
|
|
|
|
// console.error(`Waypoint with ID ${wayPointId} not found for executor ${executor_id}.`)
|
|
|
|
// continue
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// const item = _.cloneDeep(payload)
|
|
|
|
// item.id = executor_id
|
|
|
|
// item.tf[0] = _.cloneDeep(point.tf[0])
|
|
|
|
// switch (_.toLower(direction)) {
|
|
|
|
// // right=0/left=180/up=90/down=-90
|
|
|
|
// case 'right':
|
|
|
|
// item.tf[1][1] = 0 // 右侧
|
|
|
|
// break
|
|
|
|
// case 'left':
|
|
|
|
// item.tf[1][1] = 180 // 左侧
|
|
|
|
// break
|
|
|
|
// case 'down':
|
|
|
|
// item.tf[1][1] = -90 // 下方
|
|
|
|
// break
|
|
|
|
// case 'up':
|
|
|
|
// item.tf[1][1] = 90 // 上方
|
|
|
|
// break
|
|
|
|
// }
|
|
|
|
// if (row.virtual_floor_code === worldModel.state.catalogCode) {
|
|
|
|
// Model.createExecutor(item)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return res.data
|
|
|
|
// }
|
|
|
|
|
|
|
|
/** |
|
|
|
* 脚本打印日志 |
|
|
|
* @param from 系统(Worker)来源 |
|
|
|
|