#
luxiaotao1123
2022-01-04 0d0d52d7b35e41335cf2a8dcce8e1e3cef96811e
#
5个文件已修改
2个文件已添加
12645 ■■■■■ 已修改文件
static/js/app.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/data/Asrs.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/StoreGoods.js 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/StoreShelf.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/model/obj/pallet.mtl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/model/obj/pallet.obj 12478 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
views/index.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/app.js
@@ -11,7 +11,7 @@
import {StoreShelf} from './object/StoreShelf.js';
import {StoreCrn} from './object/StoreCrn.js';
import {StoreConvey} from './object/StoreConvey.js';
import {StoreGoods} from './object/StoreGoods.js';
var APP = {
@@ -328,11 +328,14 @@
        this.initStoreObjects = function (object) {
            if (this.firstTime === 1) {
                if (Store3DData !== undefined && Store3DData !== null) {
                    for(var group of Store3DData.data.store.groups) {
                    for(let group of Store3DData.data.store.groups) {
                        new StoreCrn(group.crn, object);
                        for (var line of group.lines) {
                        for (let line of group.lines) {
                            let shelf = new StoreShelf(line);
                            object.addObject(shelf);
                            object.addObject(shelf.mesh);
                            if (line.bins !== null) {
                                new StoreGoods(object, line.bins, shelf);
                            }
                            //显示库位上的货物
                            // for (var bin of line.bins) {
                            //     let existGoods=this.getExistedGoodType(bin.State);
static/js/data/Asrs.js
@@ -22,8 +22,8 @@
var Store3DData;
function initStore() {
    $.ajax({
        url: 'http://47.97.1.152:58080/jkwcs/three/init/store/v1',
        // url: 'http://localhost:9090/jkwcs/three/init/store/v1',
        // url: 'http://47.97.1.152:58080/jkwcs/three/init/store/v1',
        url: 'http://localhost:9090/jkwcs/three/init/store/v1',
        type: "POST",
        data: {},
        // async: false,
static/js/object/StoreGoods.js
@@ -1,85 +1,61 @@
/**
 * 获取类
 * @param optionGroup
 * @param optionBin
 * @constructor
 */
function StoreGoods(optionGroup,optionBin) {
import {MTLLoader} from "../lib/MTLLoader.js";
import {OBJLoader} from "../lib/OBJLoader.js";
import * as THREE from '../three.module.js';
    if(!CommonFunction.hasObj(optionGroup)||!CommonFunction.hasObj(optionBin))
        return;
    let col=optionBin.Col;
    let layer=optionBin.Layer;
    /*
        支架的高=最底层的高度+(库位数-1)*库位的高度
     */
    let shelfHeight=optionGroup.BottomHeight+(optionGroup.BinYNum)*optionGroup.BinHeight;
    /*
     支架的宽=库位数乘以库位的宽度
     */
    let shelfWidth=optionGroup.BinZNum*optionGroup.BinWidth;
function StoreGoods(object, data, shelf) {
    let that = this;
    that.data = data;
    that.object = object;
    that.shelf = shelf;
    let palletList = [];
    let goodsList = [];
    this.positionX=optionGroup.Position.X;
    this.positionY=optionGroup.Position.Y-shelfHeight/2+optionGroup.BinHeight/2+(layer-1)*optionGroup.BinHeight+optionGroup.BottomHeight;
    this.positionZ=optionGroup.Position.Z+shelfWidth/2-optionGroup.BinWidth/2-(col-1)*optionGroup.BinWidth;
    this.no=optionBin.No;
    this.name=optionBin.Name;
    this.length=optionGroup.BinLength-6;
    this.width=optionGroup.BinWidth-6;
    this.height=optionGroup.BinHeight-6;
    if(optionBin.State=="1")
    {
        this.color=0x46C191;
        this.opacity=0.8;
    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);
        }
    }
    else if(optionBin.State=="2")
    {
        this.color=0xF0CD3F;
        this.opacity=0.8;
    }
    else if(optionBin.State=="3")
    {
        this.color=0xF55E35;
        this.opacity=0.8;
    }
    else
    {
        this.color=0x46C191;
        this.opacity=0.1;
    }
    const manager = new THREE.LoadingManager();
    new MTLLoader(manager)
        .setPath( '../static/model/obj/' )
        .load( 'pallet.mtl', function ( materials ) {
            materials.preload();
            new OBJLoader( manager )
                .setMaterials( materials )
                .setPath( '../static/model/obj/' )
                .load( 'pallet.obj', function ( obj ) {
                    obj.traverse (function (child) {
                        child.castShadow = true;
                        if (child instanceof THREE.Mesh) {
                            child.material = new THREE.MeshLambertMaterial({
                                color: 0x2F4F4F
                            });
                        }
                    });
                    obj.scale.set(4, 4, 3.5);
                    obj.position.x = -1;
                    obj.position.y = 22;
                    obj.position.z = -46;
                    palletList.map(item => {
                        var clone = obj.clone();
                        let positionX = that.shelf.positionX || 0;
                        let positionY = that.shelf.positionY || 0;
                        let positionZ = that.shelf.positionZ || 0;
                        clone.position.x = -18 + positionX;
                        clone.position.y = 22 + positionY;
                        clone.position.z = -46 + positionZ;
                        that.object.addObject(clone);
                    })
                }, null, null );
        });
}
StoreGoods.prototype.create=function () {
    let optionCube = {
        length: this.length,
        width: this.width,
        height: this.height,
        position: {
            x: this.positionX,
            y: this.positionY,
            z: this.positionZ
        },
        style: {
            transparent:1,
            opacity:this.opacity,
            color: this.color,
            depthTest:1
        },
    };
    let cube = new Cube(optionCube);
    cube.uuid=this.no;
    cube.name=this.name;
    cube.type="StoreGoods";
    return cube;
}
StoreGoods.prototype.clone=function (object) {
   let goods=object.clone();
   goods.position.set(this.positionX,this.positionY,this.positionZ);
   goods.uuid=this.no;
   goods.name=this.name;
   return goods;
}
export {StoreGoods}
static/js/object/StoreShelf.js
@@ -13,6 +13,7 @@
    this.positionZ = option.position.z||0;//库位位置
    this.rackLengh = 3;//支架的长度,默认设动为3
    this.rackWidth = 3;//支架的宽度,默认设定为3
    this.mesh = null;
    // 材质
    let shelfMat = new THREE.MeshPhysicalMaterial({
@@ -92,9 +93,10 @@
    }
    let mergedGeometry = BufferGeometryUtils.mergeBufferGeometries(geometries);
    var mesh = new THREE.Mesh(mergedGeometry, shelfMat);
    let mesh = new THREE.Mesh(mergedGeometry, shelfMat);
    mesh.castShadow = true;
    return mesh;
    this.mesh = mesh;
    return this;
}
export {StoreShelf}
static/model/obj/pallet.mtl
New file
@@ -0,0 +1,5 @@
# WaveFront *.mtl file (generated by CINEMA 4D)
newmtl default
Kd 1 1 1
static/model/obj/pallet.obj
New file
Diff too large
views/index.html
@@ -19,7 +19,6 @@
    <script type="text/javascript" src="../static/js/object/StoreArea.js"></script>
    <script type="text/javascript" src="../static/js/object/Store.js"></script>
    <script type="text/javascript" src="../static/js/object/StoreGroup.js"></script>
    <script type="text/javascript" src="../static/js/object/StoreGoods.js"></script>
    <script type="text/javascript" src="../static/js/object/Route.js"></script>
    <script type="text/javascript" src="../static/js/object/CrnTask.js"></script>
    <script type="text/javascript" src="../static/js/object/Floor.js"></script>
@@ -235,8 +234,8 @@
    var speedDom = document.getElementById("speed");
    var timer = setInterval(function () {
        if (percent < 100.00) {
            percent += 0.04;
            // percent += 1;
            // percent += 0.04;
            percent += 1;
            speedDom.innerText = percent.toFixed(2);
        } else {
            speedDom.innerText = '100.00';