#
luxiaotao1123
2022-07-01 16ef20e7d39ecc946f97bbf405c0325ef9f00f01
static/js/object/StaTask.js
@@ -1,26 +1,68 @@
import {InitPallet, InitGoods} from './StoreGoods.js';
// 输送线当前运行状态对象
function StaTask(staData, object) {
    let that = this;
    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;
    that.position = null;
    let init = function () {
        that.no = staData.no;
        that.inlet = staData.inlet;
        that.outlet = staData.outlet;
        let item = getArrVal(conveyObjects.objects, "no", that.no+"");
        if (!that.position && item) {
            that.position = item.position;
        }
        if (!item) {
            that.isDel = true;
        }
    }
    init();
    that.modify = function (staData) {
        if (that.no === 0 && !that.isDel) {
            return;
        }
    }
        if (staData.loaded === 1 && staData.wrkNo && staData.wrkNo !== '0' && that.wrkNo !== staData.wrkNo) {
            if (that.loaded === 1) {
    that.change = function () {
        console.log(1)
                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 (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.wrkNo = staData.wrkNo;
    }
}
export {StaTask}