#1
luxiaotao1123
2022-04-06 a8b76a8b91cc0034aa05b50520ed8dcf74bedb21
#1
3个文件已修改
76 ■■■■■ 已修改文件
static/js/app.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/StaTask.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/StoreGoods.js 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/app.js
@@ -369,7 +369,6 @@
                for (let staData of StaDatas) {
                    let staTask = getArrVal(this.staTasks, "no", staData.no);
                    if (null == staTask) {
                        console.log(staTask)
                        this.staTasks.push(new StaTask(staData, this));
                    } else {
                        if(!staTask.run) {
static/js/object/StaTask.js
@@ -1,6 +1,4 @@
import {StoreGoods} from './StoreGoods.js';
// 输送线当前运行状态对象
function StaTask(staData, object) {
@@ -25,13 +23,11 @@
            console.error(staData.no + "号输送线更新失败");
            return;
        }
        if (that.loaded === 0 && staData.loaded === 1) {
            // 无货 ===>> 有货
            // 1.入库第一站 【新增】
            if (that.inlet === 1) {
            // 2.来自其他站点的货物 【移动】
            } else {
static/js/object/StoreGoods.js
@@ -10,24 +10,7 @@
const goodsY = 5;
const goodsZ = -6;
function StoreGoods(object, data, shelf) {
    let that = this;
    that.data = data;
    that.object = object;
    that.shelf = shelf;
    let palletList = [];
    let goodsList = [];
    for (let i=0;i<that.data.length;i++) {
        let obj = that.data[i];
        if (obj.loc_sts === 'D') {
            palletList.push(obj);
        } else if (obj.loc_sts === 'F') {
            palletList.push(obj);
            goodsList.push(obj);
        }
    }
function InitPallet(scene, palletList, ref, type) {
    const manager = new THREE.LoadingManager();
    new OBJLoader( manager )
        .setPath( '../static/model/obj/' )
@@ -44,18 +27,21 @@
            palletList.map(item => {
                let clone = obj.clone();
                let positionX = that.shelf.positionX || 0;
                let positionY = that.shelf.bottomHight + (item.lev1-1)*that.shelf.binHeight || 0;
                let positionZ = (item.bay1-1)*-that.shelf.binHeight || 0;
                let positionX = ref.positionX || 0;
                let positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
                let positionZ = (item.bay1-1)*-ref.binHeight || 0;
                clone.name = item.loc_no + "-" + "Pallet";
                clone.position.x = palletX + positionX;
                clone.position.y = palletY + positionY;
                clone.position.z = palletZ + positionZ;
                that.object.addObject(clone);
                scene.addObject(clone);
            })
        });
}
function InitGoods(scene, goodsList, ref, type) {
    const manager = new THREE.LoadingManager();
    const goodsWrapImg = new THREE.TextureLoader( manager ).load( '../static/img/goodsWrap.jpg' );
    const goodsImg = new THREE.TextureLoader( manager ).load( '../static/img/goods.jpg' );
    new OBJLoader( manager ).load( '../static/model/obj/goods.obj', function ( obj ) {
@@ -73,17 +59,46 @@
        goodsList.map(item => {
            let clone = obj.clone();
            let positionX = that.shelf.positionX || 0;
            let positionY = that.shelf.bottomHight + (item.lev1-1)*that.shelf.binHeight || 0;
            let positionZ = (item.bay1-1)*-that.shelf.binHeight || 0;
            let positionX = ref.positionX || 0;
            let positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
            let positionZ = (item.bay1-1)*-ref.binHeight || 0;
            clone.name = item.loc_no + "-" + "Goods";
            clone.position.x = goodsX + positionX;
            clone.position.y = goodsY + positionY;
            clone.position.z = goodsZ + positionZ;
            that.object.addObject(clone);
            scene.addObject(clone);
        })
    });
}
export {StoreGoods}
function StoreGoods(object, data, shelf) {
    let that = this;
    that.data = data;
    that.object = object;
    that.shelf = shelf;
    let palletList = [];
    let goodsList = [];
    let init = function () {
        for (let i=0;i<that.data.length;i++) {
            let obj = that.data[i];
            if (obj.loc_sts === 'D') {
                palletList.push(obj);
            } else if (obj.loc_sts === 'F') {
                palletList.push(obj);
                goodsList.push(obj);
            }
        }
        if (palletList.length > 0) {
            InitPallet(that.object, palletList, that.shelf);
        }
        if (goodsList.length > 0) {
            InitGoods(that.object, goodsList, that.shelf);
        }
    }
    init();
}
export {StoreGoods, InitPallet, InitGoods}