| | |
| | | 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/' ) |
| | |
| | | |
| | | 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 ) { |
| | |
| | | |
| | | 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} |