#
luxiaotao1123
2022-07-01 16ef20e7d39ecc946f97bbf405c0325ef9f00f01
static/js/object/StaTask.js
@@ -7,8 +7,11 @@
    that.object = object;
    that.no = 0;
    that.isDel = false;
    that.readyIn = false;
    that.run = false;
    that.loaded = 0;
    that.wrkNo = null;
    that.inlet = -1;
    that.outlet = -1;
@@ -24,48 +27,39 @@
        if (!that.position && item) {
            that.position = item.position;
        }
        if (!item) {
            that.isDel = true;
        }
    }
    init();
    that.modify = function (staData) {
        if (that.run || that.no === 0) {
            console.error(staData.no + "号输送线更新失败");
        if (that.no === 0 && !that.isDel) {
            return;
        }
        if (that.loaded === 0 && staData.loaded === 1) {
            // 无货 ===>> 有货
        if (staData.loaded === 1 && staData.wrkNo && staData.wrkNo !== '0' && that.wrkNo !== staData.wrkNo) {
            if (that.loaded === 1) {
            // 1.入库第一站 【新增】
            if (that.inlet === 1) {
                InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
                InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
            // 2.来自其他站点的货物 【移动】
            } else {
                that.object.removeObject(that.wrkNo + "-Pallet");
                that.object.removeObject(that.wrkNo + "-Goods");
            }
            InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
            InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
        }
        if (that.loaded === 1 && staData.loaded === 0) {
            // 有货 ===>> 无货
            // 1.出库最后一站 【移除】
            if (that.outlet === 1) {
        if (staData.loaded === 0) {
            if (that.loaded === 1 && that.wrkNo && that.wrkNo !== '0') {
                that.object.removeObject(that.wrkNo + "-Pallet");
                that.object.removeObject(that.wrkNo + "-Goods");
            }
        }
        // 实时更新
        that.loaded = staData.loaded;
        // that.run = true;
    }
    that.change = function () {
        that.wrkNo = staData.wrkNo;
    }