|  |  | 
 |  |  |         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.modelMove(); | 
 |  |  |             // this.queryTask(); | 
 |  |  |             this.queryCrn(); | 
 |  |  |             this.modelMove(); | 
 |  |  |         } | 
 |  |  |         this.initScene = function () { | 
 |  |  |             this.scene = new THREE.Scene(); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         this.queryCrn = function () { | 
 |  |  |             if (CrnDatas !== null) { | 
 |  |  |                 for (let crnData of CrnDatas) { | 
 |  |  |                     let crnTask = getArrVal(this.crnTasks, "crnNo", crnData.crnNo); | 
 |  |  |                     if (null == crnTask) { | 
 |  |  |                         // let crnFork = getArrVal(this.objects, "name", wrkMast.crnNo + "-fork"); | 
 |  |  |                         this.crnTasks.push(new CrnTask(crnData)); | 
 |  |  |                     } else { | 
 |  |  |                         if(!crnTask.run) { | 
 |  |  |                             crnTask.modify(crnData); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         this.getExistedGoodType=function(state){ | 
 |  |  |             for (let i=0;i<this.goodTypes.length;i++) { | 
 |  |  |                 let type=this.goodTypes[i]; | 
 |  |  | 
 |  |  |                         .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 ); | 
 |  |  | 
 |  |  |         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) | 
 |  |  |                 this.crnBody = getArrVal(this.objects, "name", wrkMast.crnNo + "-body"); | 
 |  |  |                 // 取货点定位 | 
 |  |  |                 let sourceLocPosition = getBinPosition(wrkMast.sourceLocNo); | 
 |  |  |                 let points = [crnBody.position, sourceLocPosition]; | 
 |  |  |                 let points = [new THREE.Vector3(this.crnBody.position.x, this.crnBody.position.y, this.crnBody.position.z), sourceLocPosition]; | 
 |  |  |                 this.curve = new Route(points); | 
 |  |  |                 console.log(this.curve); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         this.modelMove = function () { | 
 |  |  |             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); | 
 |  |  |                 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); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 
| New file | 
 |  |  | 
 |  |  |  | 
 |  |  | setInterval(function () { | 
 |  |  |     queryTaskCurrent(); | 
 |  |  |     queryCrnCurrent(); | 
 |  |  | },1000); | 
 |  |  |  | 
 |  |  | var TaskDatas = null; | 
 |  |  | function queryTaskCurrent() { | 
 |  |  |     $.ajax({ | 
 |  |  |         // url: 'http://47.97.1.152:58080/jkwcs/three/init/store/v1', | 
 |  |  |         url: 'http://localhost:9090/jkwcs/three/query/task/current/v1', | 
 |  |  |         type: "GET", | 
 |  |  |         data: {}, | 
 |  |  |         async: false, | 
 |  |  |         success: function (res) { | 
 |  |  |             TaskDatas = res.data; | 
 |  |  |         } | 
 |  |  |     }) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | var CrnDatas = null; | 
 |  |  | function queryCrnCurrent() { | 
 |  |  |     $.ajax({ | 
 |  |  |         // url: 'http://47.97.1.152:58080/jkwcs/three/init/store/v1', | 
 |  |  |         url: 'http://localhost:9090/jkwcs/three/query/crn/cache/v1', | 
 |  |  |         type: "GET", | 
 |  |  |         data: {}, | 
 |  |  |         async: false, | 
 |  |  |         success: function (res) { | 
 |  |  |             CrnDatas = res.data; | 
 |  |  |         } | 
 |  |  |     }) | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | // 堆垛机当前运行状态对象 | 
 |  |  | function CrnTask(crnData) { | 
 |  |  |     let that = this; | 
 |  |  |  | 
 |  |  |     // 访问公有属性,需要在变量名前加上this. | 
 |  |  |     that.crnNo = 0; | 
 |  |  |     that.run = false; | 
 |  |  |     // 上一数据 | 
 |  |  |     that.preBay = 1 ; | 
 |  |  |     that.preLev = 1 ; | 
 |  |  |     that.preX = 0; | 
 |  |  |     that.preY = 0; | 
 |  |  |     that.preZ = 0; | 
 |  |  |     that.preForkPos = -1;    // -1, "不在定位" 0, "货叉原位" 1, "货叉在左侧远" 2, "货叉在左侧" 3, "货叉在右侧"  4, "货叉在右侧远" | 
 |  |  |     // 当前数据 | 
 |  |  |     that.bay = 1 ; | 
 |  |  |     that.lev = 1 ; | 
 |  |  |     that.x = 0; | 
 |  |  |     that.y = 0; | 
 |  |  |     that.z = 0; | 
 |  |  |     that.forkPos = -1; | 
 |  |  |  | 
 |  |  |     // 构造函数 | 
 |  |  |     let init = function () { | 
 |  |  |         that.crnNo = crnData.crnNo; | 
 |  |  |         that.bay = crnData.bay; | 
 |  |  |         that.lev = crnData.lev; | 
 |  |  |         that.x = crnData.position.x; | 
 |  |  |         that.y = crnData.position.y; | 
 |  |  |         that.z = crnData.position.z; | 
 |  |  |         that.forkPos = crnData.forkPos; | 
 |  |  |     }; | 
 |  |  |     init(); | 
 |  |  |  | 
 |  |  |     // 对外函数 | 
 |  |  |     that.modify = function (crnData) { | 
 |  |  |         if (that.run || that.crnNo === 0) { | 
 |  |  |             console.error(that.crnNo + "号堆垛机更新失败"); | 
 |  |  |         } else { | 
 |  |  |             // 上一次 | 
 |  |  |             that.preBay = that.bay; | 
 |  |  |             that.preLev = that.lev; | 
 |  |  |             that.preX = that.x; | 
 |  |  |             that.preY = that.y; | 
 |  |  |             that.preY = that.y; | 
 |  |  |             that.preForkPos = that.forkPos; | 
 |  |  |             // 当前 | 
 |  |  |             that.bay = crnData.bay; | 
 |  |  |             that.lev = crnData.lev; | 
 |  |  |             that.x = crnData.position.x; | 
 |  |  |             that.y = crnData.position.y; | 
 |  |  |             that.z = crnData.position.z; | 
 |  |  |             that.forkPos = crnData.forkPos; | 
 |  |  |             // create Route ------------------------------------------------ | 
 |  |  |             //  new Route();    // body | 
 |  |  |             // new Route();    // load | 
 |  |  |             that.run = true; | 
 |  |  |             console.log(that); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  *  points:[ | 
 |  |  |      {x:-100,y:1,z:50}, | 
 |  |  | 
 |  |  |     let curvePoints=[]; | 
 |  |  |     // 1.去取货 ------------------------------------------------------------------------ | 
 |  |  |     // z轴 | 
 |  |  |     curvePoints.push(option[0]); | 
 |  |  |     curvePoints.push({ | 
 |  |  |         x: option[0].x, | 
 |  |  |         y: option[0].y, | 
 |  |  |         z: option[1].z | 
 |  |  |     }); | 
 |  |  |     return new THREE.CatmullRomCurve3(curvePoints,false,'catmullrom',0.000000001); | 
 |  |  |     // curvePoints.push(option[0]); | 
 |  |  |     // curvePoints.push( | 
 |  |  |     //     new THREE.Vector3( | 
 |  |  |     //         option[0].x, | 
 |  |  |     //         option[0].y, | 
 |  |  |     //         option[1].z/2 | 
 |  |  |     //     ) | 
 |  |  |     // ); | 
 |  |  |     // curvePoints.push( | 
 |  |  |     //     new THREE.Vector3( | 
 |  |  |     //         option[0].x, | 
 |  |  |     //         option[0].y, | 
 |  |  |     //         option[1].z | 
 |  |  |     //     ) | 
 |  |  |     // ); | 
 |  |  |     // return new THREE.CatmullRomCurve3(curvePoints,false,'centripetal',0.000000001); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     return new THREE.LineCurve3(option[0],new THREE.Vector3( | 
 |  |  |         option[0].x, | 
 |  |  |         option[0].y, | 
 |  |  |         option[1].z | 
 |  |  |     )); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     var a = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnBodyLength, this.crnBodyHeight, this.crnBodyWidth), new THREE.MeshBasicMaterial({ | 
 |  |  |         color: 0xff0000, | 
 |  |  |         transparent: true, | 
 |  |  |         opacity: .3 | 
 |  |  |         opacity: 1.3 | 
 |  |  |     })) | 
 |  |  |     a.name = option.crnNo + "-body"; | 
 |  |  |     a.position.x = option.crnBody.position.x; | 
 
| New file | 
 |  |  | 
 |  |  | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware | 
 |  |  | # 创建的文件:13.12.2021 16:30:26 | 
 |  |  |  | 
 |  |  | newmtl 02___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 1.0000 0.4706 0.0000 | 
 |  |  |     Ks 0.1569 0.1569 0.1569 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl Material__1 | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.4275 0.4275 0.4275 | 
 |  |  |     Ks 0.1922 0.1922 0.1922 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 09___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.5059 0.5059 0.5059 | 
 |  |  |     Ks 0.1333 0.1333 0.1333 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 01___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.0745 0.0745 0.9490 | 
 |  |  |     Ks 0.2353 0.2353 0.2353 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 04___Default | 
 |  |  |     Ns 10.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.7098 0.0000 0.0000 | 
 |  |  |     Kd 0.7098 0.0000 0.0000 | 
 |  |  |     Ks 0.0000 0.0000 0.0000 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 
| New file | 
 |  |  | 
 |  |  | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware | 
 |  |  | # 创建的文件:13.12.2021 16:49:31 | 
 |  |  |  | 
 |  |  | newmtl 02___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 1.0000 0.4706 0.0000 | 
 |  |  |     Ks 0.1569 0.1569 0.1569 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl Material__1 | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.4275 0.4275 0.4275 | 
 |  |  |     Ks 0.1922 0.1922 0.1922 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 09___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.5059 0.5059 0.5059 | 
 |  |  |     Ks 0.1333 0.1333 0.1333 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 01___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.0745 0.0745 0.9490 | 
 |  |  |     Ks 0.2353 0.2353 0.2353 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 04___Default | 
 |  |  |     Ns 10.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.7098 0.0000 0.0000 | 
 |  |  |     Kd 0.7098 0.0000 0.0000 | 
 |  |  |     Ks 0.0000 0.0000 0.0000 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 
| New file | 
 |  |  | 
 |  |  | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware | 
 |  |  | # 创建的文件:13.12.2021 16:56:27 | 
 |  |  |  | 
 |  |  | newmtl 02___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 1.0000 0.4706 0.0000 | 
 |  |  |     Ks 0.1569 0.1569 0.1569 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl Material__1 | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.4275 0.4275 0.4275 | 
 |  |  |     Ks 0.1922 0.1922 0.1922 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 09___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.5059 0.5059 0.5059 | 
 |  |  |     Ks 0.1333 0.1333 0.1333 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 01___Default | 
 |  |  |     Ns 100.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.0000 0.0000 0.0000 | 
 |  |  |     Kd 0.0745 0.0745 0.9490 | 
 |  |  |     Ks 0.2353 0.2353 0.2353 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 |  |  |  | 
 |  |  | newmtl 04___Default | 
 |  |  |     Ns 10.0000 | 
 |  |  |     Ni 1.5000 | 
 |  |  |     d 1.0000 | 
 |  |  |     Tr 0.0000 | 
 |  |  |     Tf 1.0000 1.0000 1.0000  | 
 |  |  |     illum 2 | 
 |  |  |     Ka 0.7098 0.0000 0.0000 | 
 |  |  |     Kd 0.7098 0.0000 0.0000 | 
 |  |  |     Ks 0.0000 0.0000 0.0000 | 
 |  |  |     Ke 0.0000 0.0000 0.0000 | 
 
 |  |  | 
 |  |  |         <script type="text/javascript" src="../static/js/utils.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/common.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/data/Warehouse.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/data/Task.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/data/Asrs.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/object/Cube.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/object/StoreArea.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/object/Store.js"></script> | 
 |  |  | 
 |  |  |         <script type="text/javascript" src="../static/js/object/StoreGoods.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/object/Route.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/object/RouteLine.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/object/CrnTask.js"></script> | 
 |  |  |         <script type="text/javascript" src="../static/js/lib/btnHide.js"></script> | 
 |  |  |     </head> | 
 |  |  |     <body style="position: relative"> |