|  |  |  | 
|---|
|  |  |  | this.initLight(); | 
|---|
|  |  |  | this.initFloor(); | 
|---|
|  |  |  | this.initModel(); | 
|---|
|  |  |  | this.initModel0(); | 
|---|
|  |  |  | this.initStoreObjects(this); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.animate = function () { | 
|---|
|  |  |  | 
|---|
|  |  |  | initStore(); | 
|---|
|  |  |  | if (Store3DData !== null) { | 
|---|
|  |  |  | for(var group of Store3DData.data.store.groups) { | 
|---|
|  |  |  | let crn = new StoreCrn(group.crn, object); | 
|---|
|  |  |  | for (var line of group.lines) { | 
|---|
|  |  |  | let shelf = new StoreShelf(line); | 
|---|
|  |  |  | object.addObject(shelf); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.initModel0 = function () { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.getExistedGoodType=function(state){ | 
|---|
|  |  |  | for (let i=0;i<this.goodTypes.length;i++) { | 
|---|
|  |  |  | let type=this.goodTypes[i]; | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | function StoreCrn(option, object) { | 
|---|
|  |  |  | console.log(option); | 
|---|
|  |  |  | this.crnLength = option.crnBody.length||50;//库位长度 | 
|---|
|  |  |  | this.crnWidth = option.crnBody.width||50;//库位宽 | 
|---|
|  |  |  | this.crnHeight = option.crnBody.height||500;//库位高 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 立柱 | 
|---|
|  |  |  | var a = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnLength, this.crnHeight, this.crnWidth), new THREE.MeshBasicMaterial({ | 
|---|
|  |  |  | color: 0x00ffff, | 
|---|
|  |  |  | transparent: true, | 
|---|
|  |  |  | opacity: .8 | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | a.position.x = option.crnBody.position.x; | 
|---|
|  |  |  | a.position.y = option.crnBody.position.y + this.crnHeight/2; | 
|---|
|  |  |  | a.position.z = option.crnBody.position.z - this.crnWidth/2; | 
|---|
|  |  |  | object.addObject(a); | 
|---|
|  |  |  | // 载货台 | 
|---|
|  |  |  | var b = new THREE.Mesh(new THREE.BoxBufferGeometry(10,10,10), new THREE.MeshBasicMaterial({ | 
|---|
|  |  |  | color: 0x0000ff, | 
|---|
|  |  |  | transparent: true, | 
|---|
|  |  |  | opacity: 1 | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | b.position.x = option.crnLoad.position.x; | 
|---|
|  |  |  | b.position.y = 0; | 
|---|
|  |  |  | b.position.z = 0; | 
|---|
|  |  |  | object.addObject(b); | 
|---|
|  |  |  | // 叉牙 | 
|---|
|  |  |  | var c = new THREE.Mesh(new THREE.BoxBufferGeometry(5,5,5), new THREE.MeshBasicMaterial({ | 
|---|
|  |  |  | color: 0xff00ff, | 
|---|
|  |  |  | transparent: true, | 
|---|
|  |  |  | opacity: 1 | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | c.position.x = option.crnFork.position.x; | 
|---|
|  |  |  | c.position.y = 0; | 
|---|
|  |  |  | c.position.z = 0; | 
|---|
|  |  |  | object.addObject(c); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | let group = new THREE.Group(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 货架总高 | 
|---|
|  |  |  | let shelfHeight=this.bottomHight+(this.binYNum-1)*this.binHeight; | 
|---|
|  |  |  | let shelfHeight=this.bottomHight+(this.binYNum)*this.binHeight; | 
|---|
|  |  |  | // 货架总宽 | 
|---|
|  |  |  | let shelfWidth=this.binZNum*this.binWidth; | 
|---|
|  |  |  | // 支架模型 + 材质 | 
|---|
|  |  |  | 
|---|
|  |  |  | // 初始化支架模型 | 
|---|
|  |  |  | for(let i=0;i<=this.binZNum;i++) { | 
|---|
|  |  |  | let leftRack = rackObject.clone(); | 
|---|
|  |  |  | let positionZ = this.positionZ - shelfWidth/2 + i*this.binWidth; | 
|---|
|  |  |  | let positionZ = - ( this.positionZ + i*this.binWidth ); | 
|---|
|  |  |  | leftRack.position.set(leftPositionX,positionY,positionZ); | 
|---|
|  |  |  | leftRack.updateMatrix(); | 
|---|
|  |  |  | group.add(leftRack); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 初始化托板模型 | 
|---|
|  |  |  | for(let i = 0;i < this.binZNum;i++) { | 
|---|
|  |  |  | for (let j = 0;j < this.binYNum;j++) { | 
|---|
|  |  |  | for (let j = 0;j <= this.binYNum;j++) { | 
|---|
|  |  |  | let plane = planeObject.clone(); | 
|---|
|  |  |  | let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1; | 
|---|
|  |  |  | let positionZ= this.positionZ - shelfWidth/2 + i * this.binWidth + this.binWidth/2; | 
|---|
|  |  |  | let positionZ= - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); | 
|---|
|  |  |  | plane.position.set(this.positionX-this.rackLengh/2,positionY,positionZ); | 
|---|
|  |  |  | plane.updateMatrix(); | 
|---|
|  |  |  | group.add(plane); | 
|---|