#
luxiaotao1123
2021-12-15 4d317e08d281b9e5e2cf742788c3d4b5b6bb9b38
#
4个文件已修改
58 ■■■■■ 已修改文件
static/js/app.js 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/data/Asrs.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/CrnTask.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/Route.js 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/app.js
@@ -280,7 +280,6 @@
                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) {
@@ -378,14 +377,14 @@
                });
        }
        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 () {
static/js/data/Asrs.js
@@ -25,7 +25,6 @@
        url: 'http://localhost:9090/jkwcs/three/query/crn/cache/v1',
        type: "GET",
        data: {},
        async: false,
        success: function (res) {
            CrnDatas = res.data;
        }
static/js/object/CrnTask.js
@@ -2,7 +2,6 @@
function CrnTask(crnData) {
    let that = this;
    // 访问公有属性,需要在变量名前加上this.
    that.crnNo = 0;
    that.run = false;
    // 上一数据
@@ -11,6 +10,7 @@
    that.preX = 0;
    that.preY = 0;
    that.preZ = 0;
    that.prePosition = null;
    that.preForkPos = -1;    // -1, "不在定位" 0, "货叉原位" 1, "货叉在左侧远" 2, "货叉在左侧" 3, "货叉在右侧"  4, "货叉在右侧远"
    // 当前数据
    that.bay = 1 ;
@@ -18,9 +18,9 @@
    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;
@@ -28,21 +28,25 @@
        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;
@@ -50,12 +54,15 @@
            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;
        }
    }
static/js/object/Route.js
@@ -33,11 +33,22 @@
    // 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);