#
luxiaotao1123
2021-12-15 1f7585d8c4cc86f0a1e6d3d62188e88698b57089
static/js/object/CrnTask.js
@@ -1,5 +1,5 @@
// 堆垛机当前运行状态对象
function CrnTask(crnData) {
function CrnTask(crnData, object) {
    let that = this;
    that.crnNo = 0;
@@ -21,6 +21,10 @@
    that.position = null;
    that.forkPos = -1;
    that.crnBody = null;
    that.curve = null;
    that.progress = 0;
    let init = function () {
        that.crnNo = crnData.crnNo;
        that.bay = crnData.bay;
@@ -30,6 +34,8 @@
        that.z = crnData.position.z;
        that.position = crnData.position;
        that.forkPos = crnData.forkPos;
        that.crnBody = getArrVal(object.objects, "name", that.crnNo + "-body")
    };
    init();
@@ -57,12 +63,27 @@
            that.position = crnData.position;
            that.forkPos = crnData.forkPos;
            // create Route ------------------------------------------------
            let bodyRoute = new Route([that.prePosition, that.position]);    // body
            that.curve = new Route([that.prePosition, that.position]);    // body
            // new Route();    // load
            // console.log(bodyRoute);
            // console.log("pre" + JSON.stringify(that.prePosition));
            // console.log(JSON.stringify(that.position));
            // that.run = true;
            console.log("pre" + JSON.stringify(that.prePosition));
            console.log(JSON.stringify(that.position));
            that.run = true;
        }
    }
    that.move = function (object) {
        if (that.curve) {
            that.progress += 0.001;
            if (that.progress>1.0) {
                that.curve = null;
            } else {
                let point = that.curve.getPoint(that.progress);
                if(point && point.x){
                    that.crnBody.position.set(point.x,point.y,point.z);
                }
            }
        }
    }