|  |  | 
 |  |  |                 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) { | 
 |  |  | 
 |  |  |                 }); | 
 |  |  |         } | 
 |  |  |         this.initModelMove = function () { | 
 |  |  |             console.log(this.wrkTasks) | 
 |  |  |             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); | 
 |  |  |             } | 
 |  |  |             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 () { | 
 
 |  |  | 
 |  |  |         url: 'http://localhost:9090/jkwcs/three/query/crn/cache/v1', | 
 |  |  |         type: "GET", | 
 |  |  |         data: {}, | 
 |  |  |         async: false, | 
 |  |  |         success: function (res) { | 
 |  |  |             CrnDatas = res.data; | 
 |  |  |         } | 
 
 |  |  | 
 |  |  | function CrnTask(crnData) { | 
 |  |  |     let that = this; | 
 |  |  |  | 
 |  |  |     // 访问公有属性,需要在变量名前加上this. | 
 |  |  |     that.crnNo = 0; | 
 |  |  |     that.run = false; | 
 |  |  |     // 上一数据 | 
 |  |  | 
 |  |  |     that.preX = 0; | 
 |  |  |     that.preY = 0; | 
 |  |  |     that.preZ = 0; | 
 |  |  |     that.prePosition = null; | 
 |  |  |     that.preForkPos = -1;    // -1, "不在定位" 0, "货叉原位" 1, "货叉在左侧远" 2, "货叉在左侧" 3, "货叉在右侧"  4, "货叉在右侧远" | 
 |  |  |     // 当前数据 | 
 |  |  |     that.bay = 1 ; | 
 |  |  | 
 |  |  |     that.x = 0; | 
 |  |  |     that.y = 0; | 
 |  |  |     that.z = 0; | 
 |  |  |     that.position = null; | 
 |  |  |     that.forkPos = -1; | 
 |  |  |  | 
 |  |  |     // 构造函数 | 
 |  |  |     let init = function () { | 
 |  |  |         that.crnNo = crnData.crnNo; | 
 |  |  |         that.bay = crnData.bay; | 
 |  |  | 
 |  |  |         that.x = crnData.position.x; | 
 |  |  |         that.y = crnData.position.y; | 
 |  |  |         that.z = crnData.position.z; | 
 |  |  |         that.position = crnData.position; | 
 |  |  |         that.forkPos = crnData.forkPos; | 
 |  |  |     }; | 
 |  |  |     init(); | 
 |  |  |  | 
 |  |  |     // 对外函数 | 
 |  |  |     that.modify = function (crnData) { | 
 |  |  |         if (that.run || that.crnNo === 0) { | 
 |  |  |             console.error(that.crnNo + "号堆垛机更新失败"); | 
 |  |  |         } else { | 
 |  |  |             if (JSON.stringify(crnData.position) === JSON.stringify(that.position)) { | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             // 上一次 | 
 |  |  |             that.preBay = that.bay; | 
 |  |  |             that.preLev = that.lev; | 
 |  |  |             that.preX = that.x; | 
 |  |  |             that.preY = that.y; | 
 |  |  |             that.preY = that.y; | 
 |  |  |             that.prePosition = JSON.parse(JSON.stringify(that.position)); | 
 |  |  |             that.preForkPos = that.forkPos; | 
 |  |  |             // 当前 | 
 |  |  |             that.bay = crnData.bay; | 
 |  |  | 
 |  |  |             that.x = crnData.position.x; | 
 |  |  |             that.y = crnData.position.y; | 
 |  |  |             that.z = crnData.position.z; | 
 |  |  |             that.position = crnData.position; | 
 |  |  |             that.forkPos = crnData.forkPos; | 
 |  |  |             // create Route ------------------------------------------------ | 
 |  |  |             //  new Route();    // body | 
 |  |  |             let bodyRoute = new Route([that.prePosition, that.position]);    // body | 
 |  |  |             // new Route();    // load | 
 |  |  |             that.run = true; | 
 |  |  |             console.log(that); | 
 |  |  |             // console.log(bodyRoute); | 
 |  |  |             // console.log("pre" + JSON.stringify(that.prePosition)); | 
 |  |  |             // console.log(JSON.stringify(that.position)); | 
 |  |  |             // that.run = true; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     // 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 | 
 |  |  |     )); | 
 |  |  |     // return new THREE.LineCurve3(option[0],new THREE.Vector3( | 
 |  |  |     //     option[0].x, | 
 |  |  |     //     option[0].y, | 
 |  |  |     //     option[1].z | 
 |  |  |     // )); | 
 |  |  |  | 
 |  |  |     for (let i = 0;i<option.length;i++) { | 
 |  |  |         curvePoints.push( | 
 |  |  |             new THREE.Vector3( | 
 |  |  |                 option[i].x, | 
 |  |  |                 option[i].y, | 
 |  |  |                 option[i].z | 
 |  |  |             ) | 
 |  |  |         ); | 
 |  |  |     } | 
 |  |  |     return new THREE.CatmullRomCurve3(curvePoints,false,'centripetal',0.000000001); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  |