diff --git a/src/modules/amr/ptr/PtrObject.ts b/src/modules/amr/ptr/PtrObject.ts index 57cfce1..211a73e 100644 --- a/src/modules/amr/ptr/PtrObject.ts +++ b/src/modules/amr/ptr/PtrObject.ts @@ -991,11 +991,15 @@ export default class PtrObject extends THREE.Object3D { this.animationUpFork(height).then( () => this.animationShowFork(1.35).then( () => { - // 将物品拾取到机械臂上 - const mesh = this.pickupItem(goodsId) - mesh.position.set(0, 0, -0.15) - mesh.rotation.set(0, THREE.MathUtils.degToRad(90), 0) - this.getArmObject().add(mesh) + try { + // 将物品拾取到机械臂上 + const mesh = this.pickupItem(goodsId) + mesh.position.set(0, 0, -0.15) + mesh.rotation.set(0, THREE.MathUtils.degToRad(90), 0) + this.getArmObject().add(mesh) + } catch (e) { + console.error(e) + } this.animationUpFork(height + 0.2).then( () => this.animationHideFork().then( @@ -1020,9 +1024,14 @@ export default class PtrObject extends THREE.Object3D { () => this.animationShowFork(1.35).then( ()=>this.animationUpFork(height).then( () => { - const a = this.agvStatusVo.unloadBasLocationVo - // 将物品从机械臂上卸下 - this.dropItem(goodsId, a.rack, a.bay, a.level, a.cell) + try { + const a = this.agvStatusVo.unloadBasLocationVo + // 将物品从机械臂上卸下 + this.dropItem(goodsId, a.rack, a.bay, a.level, a.cell) + } catch (e) { + console.error(e) + } + this.animationHideFork().then( () => this.animationDownFork().then(() => { @@ -1076,7 +1085,7 @@ export default class PtrObject extends THREE.Object3D { const item = this.viewport.entityManager.findItemById(id) const wrap = this.viewport.entityManager.findObjectById(id) as MeshWrap - if (wrap.type !== 'MeshWrap') { + if (!wrap || wrap.type !== 'MeshWrap') { throw new Error(`无法拾取物品 ${id},它不是一个有效的 MeshWrap`) } item.dt.storeAt = {