| | |
| | | this.firstTime = 1; |
| | | this.stats = null; |
| | | this.goodTypes=[];//存储所有的库位类型 |
| | | this.wrkTasks = [];// 任务列表 |
| | | this.crnTasks = [];// 堆垛机列表 |
| | | this.time = 0;//标记堆垛机运行的时间 |
| | | this.progress = 0; |
| | | |
| | | this.start = function () { |
| | | this.initMain(); |
| | |
| | | this.stats.begin(); |
| | | this.renderer.render(this.scene, this.camera); |
| | | this.stats.end(); |
| | | // this.queryTask(); |
| | | this.queryCrn(); |
| | | this.modelMove(); |
| | | } |
| | | this.initScene = function () { |
| | |
| | | // this.camera.position.z = 600; |
| | | // //相机的朝向 |
| | | // this.camera.lookAt(0, 0, 0); |
| | | this.camera.position.set( - 550, 2070, 4550 ); |
| | | this.camera.position.set( - 350, 1070, 1550 ); |
| | | this.camera.lookAt( this.scene.position ); |
| | | //将相机放到场景中 |
| | | this.scene.add(this.camera); |
| | |
| | | initStore(); |
| | | if (Store3DData !== null) { |
| | | for(var group of Store3DData.data.store.groups) { |
| | | let crn = new StoreCrn(group.crn, object); |
| | | for (var line of group.lines) { |
| | | let shelf = new StoreShelf(line); |
| | | object.addObject(shelf); |
| | |
| | | // |
| | | // } |
| | | // } |
| | | this.firstTime = 0; |
| | | // this.firstTime = 0; |
| | | } |
| | | } |
| | | } |
| | | this.queryTask = function () { |
| | | if (TaskDatas !== null) { |
| | | for (let TaskData of TaskDatas) { |
| | | let wrkTask = getArrVal(this.wrkTasks, "wrkNo", TaskData.wrkNo); |
| | | if (null == wrkTask) { |
| | | this.wrkTasks.push(TaskData); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.queryCrn = function () { |
| | | if (CrnDatas !== null) { |
| | | for (let crnData of CrnDatas) { |
| | | let crnTask = getArrVal(this.crnTasks, "crnNo", crnData.crnNo); |
| | | if (null == crnTask) { |
| | | this.crnTasks.push(new CrnTask(crnData)); |
| | | } else { |
| | | if(!crnTask.run) { |
| | | crnTask.modify(crnData); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | .load( '堆垛机本体.obj', function ( object ) { |
| | | object.position.z = -500; |
| | | object.position.x = -2060; |
| | | // object.position.z = 0; |
| | | // object.position.x = 0; |
| | | // object.position.y = 0; |
| | | object.scale.set(0.025, 0.025, 0.025); |
| | | object.rotateY(- Math.PI / 2) |
| | | that.addObject( object ); |
| | | }, null, null ); |
| | | }); |
| | | } |
| | | this.modelMove = function () { |
| | | this.initModelMove = function () { |
| | | console.log(this.crnTasks) |
| | | // for (var wrkMast of this.wrkTasks) { |
| | | // this.crnBody = getArrVal(this.objects, "name", wrkMast.crnNo + "-body"); |
| | | // // 取货点定位 |
| | | // let sourceLocPosition = getBinPosition(wrkMast.sourceLocNo); |
| | | // let points = [new THREE.Vector3(this.crnBody.position.x, this.crnBody.position.y, this.crnBody.position.z), sourceLocPosition]; |
| | | // this.curve = new Route(points); |
| | | // } |
| | | |
| | | } |
| | | this.modelMove = function () { |
| | | if (this.curve) { |
| | | this.progress += 0.001; |
| | | if (this.progress>1.0) { |
| | | this.curve = null; |
| | | } else { |
| | | let point = this.curve.getPoint(this.progress); |
| | | if(point&&point.x){ |
| | | this.crnBody.position.set(point.x,point.y,point.z); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | |
| | | }; |
| | | |