#
luxiaotao1123
2022-04-06 0a6e149ec5684f243bdadb0b8ef780cb71000ace
#
2个文件已修改
76 ■■■■ 已修改文件
static/js/object/StaTask.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/StoreGoods.js 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/StaTask.js
@@ -1,8 +1,10 @@
import {StoreGoods} from './StoreGoods.js';
import {InitPallet, InitGoods} from './StoreGoods.js';
// 输送线当前运行状态对象
function StaTask(staData, object) {
    let that = this;
    that.object = object;
    that.no = 0;
    that.run = false;
@@ -11,10 +13,17 @@
    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;
        }
    }
    init();
@@ -23,11 +32,14 @@
            console.error(staData.no + "号输送线更新失败");
            return;
        }
        if (that.loaded === 0 && staData.loaded === 1) {
            // 无货 ===>> 有货
            // 1.入库第一站 【新增】
            if (that.inlet === 1) {
                InitPallet(that.object);
                InitGoods(that.object);
            // 2.来自其他站点的货物 【移动】
            } else {
static/js/object/StoreGoods.js
@@ -10,6 +10,13 @@
const goodsY = 5;
const goodsZ = -6;
/**
 * 初始化托盘模型
 * @param scene 场景
 * @param palletList 托盘数据列表
 * @param ref 参照物
 * @param type 参照物类型:1 - 货架;    2 - 输送线
 */
function InitPallet(scene, palletList, ref, type) {
    const manager = new THREE.LoadingManager();
    new OBJLoader( manager )
@@ -27,11 +34,24 @@
            palletList.map(item => {
                let clone = obj.clone();
                let positionX = ref.positionX || 0;
                let positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
                let positionZ = (item.bay1-1)*-ref.binHeight || 0;
                let positionX;
                let positionY;
                let positionZ;
                switch (type) {
                    case 1:
                        positionX = ref.positionX || 0;
                        positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
                        positionZ = (item.bay1-1)*-ref.binHeight || 0;
                clone.name = item.loc_no + "-" + "Pallet";
                        clone.name = item.loc_no + "-" + "Pallet";
                        break;
                    case 2:
                        break;
                    default:
                        console.error("InitPallet param[type] error ===>> " + type);
                }
                clone.position.x = palletX + positionX;
                clone.position.y = palletY + positionY;
                clone.position.z = palletZ + positionZ;
@@ -40,6 +60,13 @@
        });
}
/**
 * 初始化货物模型
 * @param scene 场景
 * @param goodsList 货物数据列表
 * @param ref 参照物
 * @param type 参照物类型:1 - 货架;    2 - 输送线
 */
function InitGoods(scene, goodsList, ref, type) {
    const manager = new THREE.LoadingManager();
    const goodsWrapImg = new THREE.TextureLoader( manager ).load( '../static/img/goodsWrap.jpg' );
@@ -59,11 +86,24 @@
        goodsList.map(item => {
            let clone = obj.clone();
            let positionX = ref.positionX || 0;
            let positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
            let positionZ = (item.bay1-1)*-ref.binHeight || 0;
            let positionX;
            let positionY;
            let positionZ;
            switch (type) {
                case 1:
                    positionX = ref.positionX || 0;
                    positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
                    positionZ = (item.bay1-1)*-ref.binHeight || 0;
            clone.name = item.loc_no + "-" + "Goods";
                    clone.name = item.loc_no + "-" + "Goods";
                    break;
                case 2:
                    break;
                default:
                    console.error("InitGoods param[type] error ===>> " + type);
            }
            clone.position.x = goodsX + positionX;
            clone.position.y = goodsY + positionY;
            clone.position.z = goodsZ + positionZ;
@@ -74,9 +114,11 @@
function StoreGoods(object, data, shelf) {
    let that = this;
    that.data = data;
    that.object = object;
    that.shelf = shelf;
    let palletList = [];
    let goodsList = [];
@@ -91,10 +133,10 @@
            }
        }
        if (palletList.length > 0) {
            InitPallet(that.object, palletList, that.shelf);
            InitPallet(that.object, palletList, that.shelf, 1);
        }
        if (goodsList.length > 0) {
            InitGoods(that.object, goodsList, that.shelf);
            InitGoods(that.object, goodsList, that.shelf, 1);
        }
    }
    init();