| | |
| | | this.firstTime = 1; |
| | | this.stats = null; |
| | | this.goodTypes=[];//存储所有的库位类型 |
| | | this.wrkNo = 0; |
| | | this.wrkTasks = [];// 任务列表 |
| | | this.time = 0;//标记堆垛机运行的时间 |
| | | |
| | | this.start = function () { |
| | | this.initMain(); |
| | |
| | | this.initLight(); |
| | | this.initFloor(); |
| | | this.initModel(); |
| | | this.queryTask(); |
| | | this.initStoreObjects(this); |
| | | } |
| | | this.animate = function () { |
| | |
| | | this.stats.begin(); |
| | | this.renderer.render(this.scene, this.camera); |
| | | this.stats.end(); |
| | | this.queryTask(); |
| | | // this.modelMove(); |
| | | } |
| | | this.initScene = function () { |
| | |
| | | } |
| | | } |
| | | this.queryTask = function () { |
| | | if (this.firstTime === 1) { |
| | | queryTaskCurrent(); |
| | | if (this.wrkNo !== TaskData.wrkNo) { |
| | | this.wrkNo = TaskData.wrkNo; |
| | | if (TaskDatas !== null) { |
| | | for (let TaskData of TaskDatas) { |
| | | let wrkTask = getArrVal(this.wrkTasks, "wrkNo", TaskData.wrkNo); |
| | | if (null == wrkTask) { |
| | | this.wrkTasks.push(TaskData); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | }, null, null ); |
| | | }); |
| | | } |
| | | this.initModelMove = function () { |
| | | console.log(this.wrkTasks) |
| | | for (var wrkMast of this.wrkTasks) { |
| | | let crnBody = getArrVal(this.objects, "name", wrkMast.crnNo + "-body"); |
| | | console.log(crnBody) |
| | | // 取货点定位 |
| | | let sourceLocPosition = getBinPosition(wrkMast.sourceLocNo); |
| | | let points = [crnBody.position, sourceLocPosition]; |
| | | this.curve = new Route(points); |
| | | console.log(this.curve); |
| | | } |
| | | } |
| | | this.modelMove = function () { |
| | | // console.log(1) |
| | | let crnBody = getArrVal(this.objects, "name", "1-body"); |
| | | console.log(crnBody.position) |
| | | if (this.curve) { |
| | | this.time = this.time + 1; |
| | | let points = this.curve.getPoints(2000); |
| | | let point = points[this.time]; |
| | | let point1 = points[this.time+1]; |
| | | if(this.time >= 2000) { |
| | | this.time = 0; |
| | | } |
| | | if(point&&point.x){ |
| | | this.AgvCar.position.set(point.x,40,point.z); |
| | | this.AgvCar.lookAt(point1.x,40,point1.z); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | |
| | | }; |
| | | |