diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 737e9a8781fb5021e7f42b8f2cee9dd109ea357a..0000000000000000000000000000000000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1574840092432 - - - 1574840585667 - - - 1574840864085 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.8 - - - - - - - - \ No newline at end of file diff --git a/3DProject.html b/3DProject.html index bc7070e5272e28e8e3fcb31eccd733ae9bcf1749..b7f19f458dfe0e68191ed30f14b14deba02436b6 100644 --- a/3DProject.html +++ b/3DProject.html @@ -67,14 +67,12 @@ // 初始化场景 function initScene() { scene = new THREE.Scene(); - scene.fog = new THREE.Fog(scene.background, 3000, 5000); } // 初始化相机 function initCamera() { camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 10000); - camera.position.set(0, 800, 1500); - camera.lookAt(new THREE.Vector3(0, 0, 0)); + camera.position.set(50, 50, 200); } // 初始化灯光 @@ -315,7 +313,7 @@ texture.format = THREE.RGBFormat; material.map = texture; var mesh = new THREE.Mesh(planeGeometry, material); - mesh.position.set(500, 100, -694); + mesh.position.set(0, 60, -690); scene.add(mesh); } @@ -327,9 +325,10 @@ // 视角最小距离 controls.minDistance = 100; // 视角最远距离 - controls.maxDistance = 5000; + controls.maxDistance = 1000; // 最大角度 controls.maxPolarAngle = Math.PI / 2.2; + controls.target = new THREE.Vector3(50,50,0); } function initEcharts(){ @@ -448,8 +447,9 @@ // 初始化 function init() { - initMat();//初始化材质信息 + initMat(); initScene(); + addSkybox( 10000, scene ); initCamera(); initRenderer(); initContent(); diff --git a/ThreeJs/Modules.js b/ThreeJs/Modules.js index 192dd466b8c1910738708f4e21c2dd79fac50c46..82e98f705203b2f21f3c77f3221454b60de8fcb0 100644 --- a/ThreeJs/Modules.js +++ b/ThreeJs/Modules.js @@ -180,6 +180,34 @@ function initMat() { RollTexture.wrapT=THREE.RepeatWrapping; } +//region 放置天空盒 +function addSkybox( size,scene ) { + urls = [ + './ThreeJs/images/skybox/远山_RT.jpg', // right + './ThreeJs/images/skybox/远山_LF.jpg', // left + './ThreeJs/images/skybox/远山_UP.jpg', // top + './ThreeJs/images/skybox/远山_DN.jpg', // bottom + './ThreeJs/images/skybox/远山_BK.jpg', // back + './ThreeJs/images/skybox/远山_FR.jpg' // front + ]; + var skyboxCubemap = new THREE.CubeTextureLoader().load( urls ); + skyboxCubemap.format = THREE.RGBFormat; + + var skyboxShader = THREE.ShaderLib['cube']; + skyboxShader.uniforms['tCube'].value = skyboxCubemap; + var obj = new THREE.Mesh( + new THREE.BoxGeometry( size, size, size ), + new THREE.ShaderMaterial({ + fragmentShader : skyboxShader.fragmentShader, + vertexShader : skyboxShader.vertexShader, + uniforms : skyboxShader.uniforms, + depthWrite : false, + side : THREE.BackSide + }) + ); + scene.add( obj ); +} +//endregion //region 滚动的物体 function addRollPlane(scene) { @@ -190,7 +218,6 @@ function addRollPlane(scene) { } //endregion - //region 矩形区域 /** */ function addPlane(x,z,width,length,scene) { diff --git "a/ThreeJs/images/skybox/\350\277\234\345\261\261_BK.jpg" "b/ThreeJs/images/skybox/\350\277\234\345\261\261_BK.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..b1878db21cceacab0ec3d432e06cc447781f6b1f Binary files /dev/null and "b/ThreeJs/images/skybox/\350\277\234\345\261\261_BK.jpg" differ diff --git "a/ThreeJs/images/skybox/\350\277\234\345\261\261_DN.jpg" "b/ThreeJs/images/skybox/\350\277\234\345\261\261_DN.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..922cf9953be08792ad56790dbf4b893a4e6a590e Binary files /dev/null and "b/ThreeJs/images/skybox/\350\277\234\345\261\261_DN.jpg" differ diff --git "a/ThreeJs/images/skybox/\350\277\234\345\261\261_FR.jpg" "b/ThreeJs/images/skybox/\350\277\234\345\261\261_FR.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..c6e10c21de815adbc97193169745d0e1c188a529 Binary files /dev/null and "b/ThreeJs/images/skybox/\350\277\234\345\261\261_FR.jpg" differ diff --git "a/ThreeJs/images/skybox/\350\277\234\345\261\261_LF.jpg" "b/ThreeJs/images/skybox/\350\277\234\345\261\261_LF.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..b48fee8ea0f4fb44d9db3db5deb581e97573de16 Binary files /dev/null and "b/ThreeJs/images/skybox/\350\277\234\345\261\261_LF.jpg" differ diff --git "a/ThreeJs/images/skybox/\350\277\234\345\261\261_RT.jpg" "b/ThreeJs/images/skybox/\350\277\234\345\261\261_RT.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..11e4271dc778b8dd409379849c3cdc2bad9f73f8 Binary files /dev/null and "b/ThreeJs/images/skybox/\350\277\234\345\261\261_RT.jpg" differ diff --git "a/ThreeJs/images/skybox/\350\277\234\345\261\261_UP.jpg" "b/ThreeJs/images/skybox/\350\277\234\345\261\261_UP.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..cad60f237fa229102eb9eaf194a6d12ff0955772 Binary files /dev/null and "b/ThreeJs/images/skybox/\350\277\234\345\261\261_UP.jpg" differ diff --git "a/ThreeJs/images/\344\270\255\351\227\264\345\223\201.png" "b/ThreeJs/images/\344\270\255\351\227\264\345\223\201.png" deleted file mode 100644 index b46ee9690cdde3aba51b9883bdfffa039c81d960..0000000000000000000000000000000000000000 Binary files "a/ThreeJs/images/\344\270\255\351\227\264\345\223\201.png" and /dev/null differ diff --git "a/ThreeJs/images/\345\205\266\344\273\226.png" "b/ThreeJs/images/\345\205\266\344\273\226.png" deleted file mode 100644 index a2cbf454bd95c8cfb305d08aee0d40b0bc84f4c2..0000000000000000000000000000000000000000 Binary files "a/ThreeJs/images/\345\205\266\344\273\226.png" and /dev/null differ diff --git "a/ThreeJs/images/\345\214\205\346\235\220.png" "b/ThreeJs/images/\345\214\205\346\235\220.png" deleted file mode 100644 index 1260c7a03a066c0b6b3915d4e561e8d44c7e5248..0000000000000000000000000000000000000000 Binary files "a/ThreeJs/images/\345\214\205\346\235\220.png" and /dev/null differ diff --git "a/ThreeJs/images/\345\214\226\345\267\245\345\223\201.png" "b/ThreeJs/images/\345\214\226\345\267\245\345\223\201.png" deleted file mode 100644 index 8d8640e34d156887929190ec3332184edb62dd05..0000000000000000000000000000000000000000 Binary files "a/ThreeJs/images/\345\214\226\345\267\245\345\223\201.png" and /dev/null differ diff --git "a/ThreeJs/images/\345\216\237\346\226\231.png" "b/ThreeJs/images/\345\216\237\346\226\231.png" deleted file mode 100644 index 5337e60e7100170753a550ec7cb3a6fd21dfb8b3..0000000000000000000000000000000000000000 Binary files "a/ThreeJs/images/\345\216\237\346\226\231.png" and /dev/null differ diff --git "a/ThreeJs/images/\346\210\220\345\223\201.png" "b/ThreeJs/images/\346\210\220\345\223\201.png" deleted file mode 100644 index 315db56d3bc352a2ae8aeed9a4f5a6602a0ab45b..0000000000000000000000000000000000000000 Binary files "a/ThreeJs/images/\346\210\220\345\223\201.png" and /dev/null differ diff --git "a/ThreeJs/images/\350\276\205\346\226\231.png" "b/ThreeJs/images/\350\276\205\346\226\231.png" deleted file mode 100644 index 69e70caaf055f520616716fe157b6aec46da4b97..0000000000000000000000000000000000000000 Binary files "a/ThreeJs/images/\350\276\205\346\226\231.png" and /dev/null differ diff --git a/ThreeJs/js/Modules.js b/ThreeJs/js/Modules.js deleted file mode 100644 index 51fa520c669609d65a3ebd39d263b2b45cdedfd5..0000000000000000000000000000000000000000 --- a/ThreeJs/js/Modules.js +++ /dev/null @@ -1,510 +0,0 @@ -/** - * Modules.js是3D库区图显示模型存放的地方 - * - * @author 谢宁, Created on 2018-06-07 - */ -/** ***************************************************************** */ -//模型材质信息 -var planeMat, RackMat, RackMat2, CargoMat, CargoMat_yuanliao, CargoMat_fuliao, CargoMat_baocai, CargoMat_zhongjian, CargoMat_huagong, CargoMat_chengpin, CargoMat_qita; -//库图环境配置信息 -var enable_composer, enable_pan, enable_rotate, enable_zoom; -//库区信息 -var storageZoneSize = 0, storageZoneList = []; -//货架信息 -var shelfSize = 0, shelfList = []; -//货位信息 -var storageUnitSize = 0, storageUnitList = []; -//货物信息 -var cargoSize = 0, cargoList = [], CargosExist; - -var PLANE_LENGTH = 24; -var PLANE_WIDTH = 55; -var PLANE_HEIGHT = 2; -var HOLDER_LENGTH = 2; -var HOLDER_WIDTH = 2; -var HOLDER_HEIGHT = 25; -var LAYER_NUM = 3; -var COLUMN_NUM = 2; - -//创建库区对象 -function storageZone(StorageZoneId,StorageZoneName, - coordinateX,coordinateZ, - width,length, - textColor,fontSize,textposition) -{ - this.StorageZoneId=StorageZoneId; - this.StorageZoneName=StorageZoneName; - this.coordinateX=coordinateX; - this.coordinateZ=coordinateZ; - this.width=width; - this.length=length; - this.textColor=textColor; - this.fontSize=fontSize; - this.textposition=textposition; -} - -//根据库区编码获取库区对象 -function getStorageZoneById(StorageZoneId) { - for(var i = 0; i < storageZoneSize; i++){ - if(storageZoneList[i].StorageZoneId == StorageZoneId){ - return storageZoneList[i]; - } - } -} - -//创建货架对象 -function shelf(storageZoneId, shelfId, shelfName, - planeLength , planeWidth , planeHeight , - holderLength , holderWidth , holderHeight , - positionX , positionY , positionZ , - layerNum , columnNum) -{ - this.storageZoneId=storageZoneId; - this.shelfId=shelfId; - this.shelfName=shelfName; - this.planeLength=planeLength; - this.planeWidth=planeWidth; - this.planeHeight=planeHeight; - this.holderLength=holderLength; - this.holderWidth=holderWidth; - this.holderHeight=holderHeight; - this.positionX=positionX; - this.positionY=positionY; - this.positionZ=positionZ; - this.layerNum=layerNum; - this.columnNum=columnNum; -} - -//根据货架编码获取货架对象 -function getShelfById(shelfId) { - for(var i = 0; i < shelfSize; i++){ - if(shelfList[i].shelfId == shelfId){ - return shelfList[i]; - } - } -} - -//创建货位对象 -function storageUnit(storageZoneId, shelfId, shelfName, - inLayerNum , inColumnNum , - positionX , positionY , positionZ, storageUnitId) -{ - this.storageZoneId=storageZoneId; - this.shelfId=shelfId; - this.shelfName=shelfName; - this.inLayerNum=inLayerNum; - this.inColumnNum=inColumnNum; - this.positionX=positionX; - this.positionY=positionY; - this.positionZ=positionZ; - this.storageUnitId=storageUnitId; -} - -//根据货架ID、层数、列数获取货位对象 -function getStorageUnitById(shelfId,inLayerNum,inColumnNum) { - for(var i = 0; i < storageUnitSize; i++){ - if(storageUnitList[i].shelfId == shelfId && storageUnitList[i].inLayerNum == inLayerNum && storageUnitList[i].inColumnNum == inColumnNum){ - return storageUnitList[i]; - } - } -} - -//根据库位编码获取货位对象 -function getStorageUnitByUnitId(storageUnitId) { - for(var i = 0; i < storageUnitSize; i++){ - if(storageUnitList[i].storageUnitId == storageUnitId){ - return storageUnitList[i]; - } - } -} - -//创建货物对象 -function cargo(batchNo, prodBatchNo, inBatchNo, - matId, matClassId, matName, - qty, qtyUom, qty2, - warehouseId, storageZoneId, storageUnitId, - positionX , positionY , positionZ, - length , width , height) -{ - this.batchNo=batchNo; - this.prodBatchNo=prodBatchNo; - this.inBatchNo=inBatchNo; - this.matId=matId; - this.matClassId=matClassId; - this.matName=matName; - this.qtyUom=qtyUom; - this.qty2=qty2; - this.warehouseId=warehouseId; - this.storageZoneId=storageZoneId; - this.storageUnitId=storageUnitId; - this.positionX=positionX; - this.positionY=positionY; - this.positionZ=positionZ; - this.length=length; - this.width=width; - this.height=height; -} - -/** 初始化材质信息 */ -function initMat() { - planeMat = new THREE.MeshLambertMaterial(); - RackMat = new THREE.MeshLambertMaterial(); - RackMat2 = new THREE.MeshPhongMaterial({color:0x1C86EE}); - CargoMat = new THREE.MeshLambertMaterial(); - CargoMat_yuanliao = new THREE.MeshLambertMaterial();//原料 - CargoMat_fuliao = new THREE.MeshLambertMaterial();//辅料 - CargoMat_baocai = new THREE.MeshLambertMaterial();//包材 - CargoMat_huagong = new THREE.MeshLambertMaterial();//化工品 - CargoMat_zhongjian = new THREE.MeshLambertMaterial();//中间品 - CargoMat_chengpin = new THREE.MeshLambertMaterial();//成品 - CargoMat_qita = new THREE.MeshLambertMaterial();//其他 - - new THREE.TextureLoader().load( './ThreeJs/images/plane.png', function( map ) { - planeMat.map = map; - planeMat.transparent = true; - planeMat.opacity = 0.8; - planeMat.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/rack.png", function( map ) { - RackMat.map = map; - RackMat.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/box.png", function( map ) { - CargoMat.map = map; - CargoMat.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/原料.png", function( map ) { - CargoMat_yuanliao.map = map; - CargoMat_yuanliao.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/辅料.png", function( map ) { - CargoMat_fuliao.map = map; - CargoMat_fuliao.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/包材.png", function( map ) { - CargoMat_baocai.map = map; - CargoMat_baocai.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/化工品.png", function( map ) { - CargoMat_huagong.map = map; - CargoMat_huagong.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/中间品.png", function( map ) { - CargoMat_zhongjian.map = map; - CargoMat_zhongjian.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/成品.png", function( map ) { - CargoMat_chengpin.map = map; - CargoMat_chengpin.needsUpdate = true; - } ); - new THREE.TextureLoader().load( "./ThreeJs/images/其他.png", function( map ) { - CargoMat_qita.map = map; - CargoMat_qita.needsUpdate = true; - } ); -} - -/* 放置天空盒 **/ -// function addSkybox( size,scene ) { -// urls = [ -// './BM2P/images/right.jpg', // right -// './BM2P/images/left.jpg', // left -// './BM2P/images/top.jpg', // top -// './BM2P/images/down.jpg', // bottom -// './BM2P/images/back.jpg', // back -// './BM2P/images/front.jpg' // front -// ]; -// var skyboxCubemap = new THREE.CubeTextureLoader().load( urls ); -// skyboxCubemap.format = THREE.RGBFormat; -// -// var skyboxShader = THREE.ShaderLib['cube']; -// skyboxShader.uniforms['tCube'].value = skyboxCubemap; -// var obj = new THREE.Mesh( -// new THREE.BoxGeometry( size, size, size ), -// new THREE.ShaderMaterial({ -// fragmentShader : skyboxShader.fragmentShader, -// vertexShader : skyboxShader.vertexShader, -// uniforms : skyboxShader.uniforms, -// depthWrite : false, -// side : THREE.BackSide -// }) -// ); -// scene.add( obj ); -// } - -//region 库区 -/** 放置虚线框区域和库区名称 */ -function addArea(x,z,width,length,scene,name,textColor,font_size,textposition) { - var geometry = new THREE.PlaneGeometry( width, length ); - var obj = new THREE.Mesh( geometry, planeMat ); - obj.position.set(x,1.5,z); - obj.rotation.x = -Math.PI / 2.0; - obj.name = "库区"+"$"+name.split("$")[1]; - scene.add( obj ); - - new THREE.FontLoader().load('./BM2P/js/FZYaoTi_Regular.json',function(font){ - ////加入立体文字 - var text= new THREE.TextGeometry(name.split("$")[1],{ - // 设定文字字体 - font:font, - //尺寸 - size:font_size, - //厚度 - height:0.01 - }); - text.computeBoundingBox(); - //3D文字材质 - var m = new THREE.MeshStandardMaterial({color:"#" + textColor}); - var mesh = new THREE.Mesh(text,m) - if(textposition == "左对齐"){ - mesh.position.x = x - width/2 + 10; - }else if(textposition == "居中"){ - mesh.position.x = x - 15; - }else if(textposition == "右对齐"){ - mesh.position.x = x + width/2 - 60; - } - mesh.position.y = 1.3; - mesh.position.z = z + length/2 - 20; - mesh.rotation.x = -Math.PI / 2.0; - scene.add(mesh); - }); -} - -/** 根据3D库图库区配置表添加库区和文字 */ -function addStorageZone(scene) { - var eiinfo = new EiInfo(); - var ajax_callback = { - onSuccess : function(eiinfo) { - storageZoneSize = eiinfo.get("size"); - for(var i = 0; i < storageZoneSize; i++){ - var storageZone_obj = new storageZone(eiinfo.get("StorageZoneId")[i], - eiinfo.get("StorageZoneName")[i], - eiinfo.get("coordinateX")[i], - eiinfo.get("coordinateZ")[i], - eiinfo.get("width")[i], - eiinfo.get("length")[i], - eiinfo.get("textColor")[i], - eiinfo.get("fontSize")[i], - eiinfo.get("textposition")[i]); - storageZoneList.push(storageZone_obj); - } - }, - onFail : function(eMsg) { - EFAlert( "加载库图配置失败:"+eMsg ,"错误" ); - } - }; - EiCommunicator.send("YMIQ083D", "queryStorageZoneConfig3D", eiinfo, ajax_callback); - - for(var i = 0;i < storageZoneSize; i++){ - addArea(storageZoneList[i].coordinateX,storageZoneList[i].coordinateZ,storageZoneList[i].width,storageZoneList[i].length,scene,storageZoneList[i].StorageZoneId+"$"+storageZoneList[i].StorageZoneName,storageZoneList[i].textColor,storageZoneList[i].fontSize,storageZoneList[i].textposition); - } -} -//endregion - -//region 货架货位 - -/** 放置单层货架 */ -/** x,y,z 整个模型在场景中的位置 */ -/** plane_x,plane_y,plane_z 货架板面的长高宽 */ -/** holder_x,holder_y,holder_z 货架支架的长高宽 */ -/** scene,name,num 要添加的场景,货架的名字,单层货架的库位数量 */ -function addRack(x,y,z,plane_x,plane_y,plane_z,holder_x,holder_y,holder_z,scene,name,num) { - var plane = new THREE.BoxGeometry( plane_x, plane_y, plane_z/num ); - var gz = []; - for(var i = 0; i < num; i++){ - gz.push( z + plane_z/num/2 + (plane_z/num)*i ); - var obj = new THREE.Mesh( plane, RackMat ); - obj.position.set(x , y, gz[i]) ; - var msg = name+"$"+(2-i); - - var eiinfo = new EiInfo(); - eiinfo.set("shelfId",msg.split("$")[1]); - eiinfo.set("inLayerNum",msg.split("$")[3]); - eiinfo.set("inColumnNum",msg.split("$")[4]); - var storageUnitId = ""; - var ajax_callback = { - onSuccess : function(eiinfo) { - storageUnitId = eiinfo.get("storageUnitId"); - }, - onFail : function(eMsg) { - EFAlert( "加载库图货架配置失败:"+eMsg ,"错误" ); - } - }; - EiCommunicator.send("YMIQ083D", "queryStorageUnit", eiinfo, ajax_callback); - - //添加货位 - var storageUnit_obj = new storageUnit(msg.split("$")[0], - msg.split("$")[1], - msg.split("$")[2], - msg.split("$")[3], - msg.split("$")[4], - x, y, gz[i], storageUnitId); - storageUnitList.push(storageUnit_obj); - storageUnitSize++; - - var Unit = getStorageUnitById(msg.split("$")[1],msg.split("$")[3],msg.split("$")[4]); - obj.name = "货位"+"$"+Unit.storageUnitId; - scene.add(obj); - } - - var holder = new THREE.BoxGeometry( holder_x, holder_y, holder_z ); - var obj2 = new THREE.Mesh( holder, RackMat2 ); - var obj3 = new THREE.Mesh( holder, RackMat2 ); - var obj4 = new THREE.Mesh( holder, RackMat2 ); - var obj5 = new THREE.Mesh( holder, RackMat2 ); - - obj2.position.set(x-plane_x/2+holder_x/2,y-holder_y/2-plane_y/2,z+holder_z/2); - obj3.position.set(x+plane_x/2-holder_x/2,y-holder_y/2-plane_y/2,z+holder_z/2); - obj4.position.set(x-plane_x/2+holder_x/2,y-holder_y/2-plane_y/2,z+plane_z-holder_z/2); - obj5.position.set(x+plane_x/2-holder_x/2,y-holder_y/2-plane_y/2,z+plane_z-holder_z/2); - scene.add(obj2);scene.add(obj3);scene.add(obj4);scene.add(obj5); -} - -/** 放置一叠货架 */ -/** stack_num 货架的叠数 */ -function addStackOfRack(x,y,z,plane_x,plane_y,plane_z,holder_x,holder_y,holder_z,scene,name,num,stack_num) { - for(var i = 0; i < stack_num; i++){ - addRack(x,y*(i+1),z,plane_x,plane_y,plane_z,holder_x,holder_y,holder_z,scene,name+"$"+(i+1),num); - } -} - -/** 根据3D库图货架配置表添加货架 */ -function addShelf(scene) { - var eiinfo = new EiInfo(); - var ajax_callback = { - onSuccess : function(eiinfo) { - shelfSize = eiinfo.get("size"); - for(var i = 0; i < shelfSize; i++){ - var shelf_obj = new shelf(eiinfo.get("StorageZoneId")[i], - eiinfo.get("shelfId")[i], - eiinfo.get("shelfName")[i], - PLANE_LENGTH,PLANE_WIDTH,PLANE_HEIGHT, - HOLDER_LENGTH,HOLDER_WIDTH,HOLDER_HEIGHT, - eiinfo.get("positionX")[i], - eiinfo.get("positionY")[i], - eiinfo.get("positionZ")[i], - LAYER_NUM,COLUMN_NUM); - shelfList.push(shelf_obj); - } - }, - onFail : function(eMsg) { - EFAlert( "加载库图货架配置失败:"+eMsg ,"错误" ); - } - }; - EiCommunicator.send("YMIQ083D", "queryShelfConfig3D", eiinfo, ajax_callback); - - for(var i = 0;i < shelfSize; i++){ - addStackOfRack(shelfList[i].positionX,shelfList[i].positionY,shelfList[i].positionZ,shelfList[i].planeLength,shelfList[i].planeHeight,shelfList[i].planeWidth,shelfList[i].holderLength,shelfList[i].holderHeight,shelfList[i].holderWidth,scene,shelfList[i].storageZoneId+"$"+shelfList[i].shelfId+"$"+shelfList[i].shelfName,shelfList[i].columnNum,shelfList[i].layerNum); - } -} - -//region 货物 -/** 放置单个货物 */ -function addCargo(x,y,z,box_x,box_y,box_z,scene,name) { - var geometry = new THREE.BoxGeometry( box_x, box_y, box_z ); - var obj = new THREE.Mesh( geometry, CargoMat ); - obj.position.set(x,y,z); - obj.name = name; - scene.add(obj); -} - -/** 放置单个货物 */ -function addOneCargo(num,floor,scene,name,matClassId) { - var geometry = new THREE.BoxGeometry( 180, 180, 180 ); - var x,y,z; - switch (num) { - case 1 : x=-200;y=150+(floor-1)*180;z=200;break; - case 2 : x=0;y=150+(floor-1)*180;z=200;break; - case 3 : x=200;y=150+(floor-1)*180;z=200;break; - case 4 : x=-200;y=150+(floor-1)*180;z=0;break; - case 5 : x=0;y=150+(floor-1)*180;z=0;break; - case 6 : x=200;y=150+(floor-1)*180;z=0;break; - case 7 : x=-200;y=150+(floor-1)*180;z=-200;break; - case 8 : x=0;y=150+(floor-1)*180;z=-200;break; - case 9 : x=200;y=150+(floor-1)*180;z=-200;break; - default : x=-200;y=150+(floor-1)*180;z=200; - } - var obj; - switch (matClassId) { - case "1" : obj = new THREE.Mesh( geometry, CargoMat_yuanliao );break; - case "2" : obj = new THREE.Mesh( geometry, CargoMat_fuliao );break; - case "3" : obj = new THREE.Mesh( geometry, CargoMat_baocai );break; - case "4" : obj = new THREE.Mesh( geometry, CargoMat_huagong );break; - case "5" : obj = new THREE.Mesh( geometry, CargoMat_zhongjian );break; - case "7" : obj = new THREE.Mesh( geometry, CargoMat_chengpin );break; - case "20" : obj = new THREE.Mesh( geometry, CargoMat_qita );break; - default : obj = new THREE.Mesh( geometry, CargoMat_yuanliao ) - } - obj.position.set(x,y,z); - obj.name = name; - scene.add(obj); -} - -/** 查询单个货位上的货物是否存在 */ -function queryCargosExist(storageZoneId,storageUnitId) { - var eiinfo = new EiInfo(); - eiinfo.set("storageZoneId",storageZoneId); - eiinfo.set("storageUnitId",storageUnitId); - var ajax_callback = { - onSuccess : function(eiinfo) { - CargosExist = eiinfo.get("flag") - } - }; - EiCommunicator.send("YMIQ083D", "queryCargosExist", eiinfo, ajax_callback); -} - -/** 查询单个货位上的货物 */ -function queryOneUnitCargos(storageUnitId) { - var eiinfo = new EiInfo(); - eiinfo.set("storageUnitId",storageUnitId); - var ajax_callback = { - onSuccess : function(eiinfo) { - cargoSize = eiinfo.get("size"); - for(var i = 0; i < cargoSize; i++){ - var cargo_obj = new cargo(eiinfo.get("batchNo")[i], - eiinfo.get("prodBatchNo")[i], - eiinfo.get("inBatchNo")[i], - eiinfo.get("matId")[i], - eiinfo.get("matClassId")[i], - eiinfo.get("matName")[i], - eiinfo.get("qty")[i], - eiinfo.get("qtyUom")[i], - eiinfo.get("qty2")[i], - eiinfo.get("warehouseId")[i], - eiinfo.get("storageZoneId")[i], - eiinfo.get("storageUnitId")[i]); - cargoList.push(cargo_obj); - } - }, - onFail : function(eMsg) { - EFAlert( "加载库图货架配置失败:"+eMsg ,"错误" ); - } - }; - EiCommunicator.send("YMIQ083DP", "queryOneUnitCargos", eiinfo, ajax_callback); -} - -/** 添加单个货位上的货物 */ -function addOneUnitCargos(shelfId,inLayerNum,inColumnNum,scene) { - var storageUnit = getStorageUnitById(shelfId,inLayerNum,inColumnNum); - var storageZoneId = storageUnit.storageZoneId; - var shelf = getShelfById(storageUnit.shelfId); - var storageUnitid = storageUnit.storageUnitId; - queryCargosExist(storageZoneId,storageUnitid); - if(CargosExist == "true"){ - var x = storageUnit.positionX; - var y = storageUnit.positionY + 8 + shelf.planeHeight/2; - var z = storageUnit.positionZ; - addCargo(x,y,z,16,16,16,scene,"货物"+"$"+storageUnitid) - } -} - -/** 添加货物详情 */ -function addCargoDetail(storageUnitId) { - queryOneUnitCargos(storageUnitId); - if(cargoList.length != 0){ - for(var i = 0; i < cargoSize; i++){ - addOneCargo(i+1-parseInt(i/9)*9,parseInt(i/9)+1,scene,"货物详情"+"$"+cargoList[i].batchNo,cargoList[i].matClassId) - } - cargoList = []; - } -} -//endregion \ No newline at end of file