Merge branches 'local' and 'master' of http://47.97.1.152:5880/r/ASRS-3D into local
| | |
| | | this.queryCrn(); |
| | | this.crnMove(); |
| | | this.querySta(); |
| | | this.staChange(); |
| | | } |
| | | this.initScene = function () { |
| | | this.scene = new THREE.Scene(); |
| | |
| | | if (null == staTask) { |
| | | this.staTasks.push(new StaTask(staData, this)); |
| | | } else { |
| | | if(!staTask.run) { |
| | | if(!staTask.run && !staTask.isDel) { |
| | | staTask.modify(staData); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.staChange = function () { |
| | | for (let staTask of this.staTasks) { |
| | | staTask.change(); |
| | | } |
| | | } |
| | | |
| | |
| | | style:{ |
| | | color: 0x5F7480, |
| | | transparent:1, |
| | | opacity:0.8 |
| | | opacity:0.35 |
| | | } |
| | | } |
| | | ] |
| | |
| | | }, |
| | | // 链条输送机 1F 第2列 -------------------------------------------------------------------------------------------- |
| | | { |
| | | no: '1', |
| | | no: '172', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 57, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '170', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 146, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '168', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 287, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '166', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 376, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '164', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 517, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '162', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 606, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '160', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 747, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '158', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 836, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '155', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 977, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '153', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1066, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '151', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1207, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '149', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1296, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '147', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1437, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '145', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1526, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '143', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1667, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '141', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1756, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '138', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1897, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '136', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1986, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '134', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2127, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '132', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2216, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '130', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2357, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '128', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2446, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '126', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2587, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '124', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2676, |
| | |
| | | }, |
| | | // 链条输送机 1F 第3列 -------------------------------------------------------------------------------------------- |
| | | { |
| | | no: '1', |
| | | no: '174', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 146, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '177', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 287, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '181', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 517, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '186', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 836, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '190', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 977, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '195', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1296, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '199', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1526, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '203', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1756, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '207', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1897, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '212', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2127, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '216', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2216, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '220', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2357, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '224', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2446, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '227', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2587, |
| | |
| | | }, |
| | | // 链条输送机 2F 第1列 -------------------------------------------------------------------------------------------- |
| | | { |
| | | no: '1', |
| | | no: '321', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 146, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '320', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 287, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '319', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 606, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '318', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 747, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '317', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1066, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '316', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1207, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '315', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1526, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '314', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1667, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '313', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1897, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '312', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 1986, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '311', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2127, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '310', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2216, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '309', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2357, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '308', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2446, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '307', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2587, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '306', |
| | | objectType: 'chain', |
| | | position: { |
| | | x: 48 + 2676, |
| | |
| | | }, |
| | | // 滚筒输送机 1F 第1列 -------------------------------------------------------------------------------------------- |
| | | { |
| | | no: '1', |
| | | no: '171', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 100, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '169', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 213, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '167', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 330, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '165', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 442, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '163', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 560, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '161', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 673, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '159', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 790, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 157 |
| | | { |
| | | no: '1', |
| | | no: '156', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 902, |
| | |
| | | } |
| | | }, |
| | | |
| | | |
| | | { |
| | | no: '1', |
| | | no: '154', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1020, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '152', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1133, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '150', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1250, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '148', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1362, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '146', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1480, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '144', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1593, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '142', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1710, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 140 |
| | | { |
| | | no: '1', |
| | | no: '139', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1822, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '137', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1940, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '135', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2053, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '133', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2170, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '131', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2282, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '129', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2400, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '127', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2513, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '125', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2630, |
| | |
| | | }, |
| | | // 滚筒输送机 1F 第2列 -------------------------------------------------------------------------------------------- |
| | | { |
| | | no: '1', |
| | | no: '175', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 212, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '178', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 349, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '179', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 450, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '182', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 598, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 183 |
| | | { |
| | | no: '1', |
| | | no: '184', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 744, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '187', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 903, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 188 |
| | | |
| | | { |
| | | no: '1', |
| | | no: '191', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1058, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 192 |
| | | { |
| | | no: '1', |
| | | no: '193', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1204, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '196', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1357, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '197', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1458, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '200', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1587, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '201', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1688, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '204', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1822, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 205 |
| | | |
| | | { |
| | | no: '1', |
| | | no: '208', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 1958, |
| | |
| | | } |
| | | }, |
| | | { |
| | | no: '1', |
| | | no: '209', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2059, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '213', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2170, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '217', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2282, |
| | |
| | | }, |
| | | |
| | | { |
| | | no: '1', |
| | | no: '221', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2400, |
| | |
| | | |
| | | |
| | | { |
| | | no: '1', |
| | | no: '225', |
| | | objectType: 'roller', |
| | | position: { |
| | | x: -2 + 2512, |
| | |
| | | const yOffset1 = -116; |
| | | const zOffset1 = -475; |
| | | |
| | | const palletX = -18; |
| | | const palletY = 2; |
| | | const palletZ = -46; |
| | | const palletX = -2; |
| | | const palletY = 0; |
| | | const palletZ = -25; |
| | | |
| | | const goodsX = -17; |
| | | const goodsY = 5; |
| | | const goodsZ = -6; |
| | | const goodsX = -2; |
| | | const goodsY = 22; |
| | | const goodsZ = -25; |
| | | |
| | | // 堆垛机当前运行状态对象 |
| | | function CrnTask(crnData, object) { |
| | |
| | | $("#label").attr("style", "display:none;"); |
| | | return; |
| | | } |
| | | |
| | | console.log(intersects[0].object) |
| | | let objName = intersects[0].object.name; |
| | | if (objName) { |
| | | let dest = objName.split("-")[0]; |
| | |
| | | that.object = object; |
| | | |
| | | that.no = 0; |
| | | that.objectType = null; |
| | | that.isDel = false; |
| | | that.readyIn = false; |
| | | that.run = false; |
| | | that.loaded = 0; |
| | | that.wrkNo = null; |
| | |
| | | |
| | | let item = getArrVal(conveyObjects.objects, "no", that.no+""); |
| | | if (!that.position && item) { |
| | | that.objectType = item.objectType; |
| | | that.position = item.position; |
| | | } |
| | | if (!item) { |
| | | that.isDel = true; |
| | | } |
| | | } |
| | | init(); |
| | | |
| | | that.modify = function (staData) { |
| | | if (that.run || that.no === 0) { |
| | | console.error(staData.no + "号输送线更新失败"); |
| | | if (that.no === 0) { |
| | | return; |
| | | } |
| | | |
| | | if (that.loaded === 0 && staData.loaded === 1) { |
| | | // 无货 ===>> 有货 |
| | | |
| | | // 1.入库第一站 【新增】 |
| | | if (that.inlet === 1) { |
| | | InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); |
| | | InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); |
| | | // 2.来自其他站点的货物 【移动】 |
| | | } else { |
| | | |
| | | } |
| | | |
| | | } |
| | | if (that.loaded === 1 && staData.loaded === 0) { |
| | | // 有货 ===>> 无货 |
| | | |
| | | // 1.出库最后一站 【移除】 |
| | | if (that.outlet === 1) { |
| | | let pallet = getArrVal(that.object.objects, "name", that.wrkNo + "-Pallet"); |
| | | if (pallet != null) { |
| | | // 添加 |
| | | if (staData.loaded === 1 && staData.wrkNo && staData.wrkNo !== '0' && that.wrkNo !== staData.wrkNo) { |
| | | if (that.outlet !== 1) { // 由堆垛机出库,不需要添加model |
| | | if (that.loaded === 1) { |
| | | console.log("sta_" + that.no + " remove:" + that.wrkNo + "-Pallet; " + that.wrkNo + "-Goods"); |
| | | that.object.removeObject(that.wrkNo + "-Pallet"); |
| | | that.object.removeObject(that.wrkNo + "-Goods"); |
| | | } |
| | | let goods = getArrVal(that.object.objects, "name", that.wrkNo + "-Goods"); |
| | | if (goods != null) { |
| | | |
| | | InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position, objectType: that.objectType}, 2); |
| | | InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position, objectType: that.objectType}, 2); |
| | | } |
| | | } |
| | | |
| | | // 移除 |
| | | if (staData.loaded === 0) { |
| | | if (that.loaded === 1 && that.wrkNo && that.wrkNo !== '0') { |
| | | if (that.inlet !== 1) { // 堆垛机需要搬运,不能直接移除 |
| | | that.object.removeObject(that.wrkNo + "-Pallet"); |
| | | that.object.removeObject(that.wrkNo + "-Goods"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // 实时更新 |
| | | that.loaded = staData.loaded; |
| | | that.wrkNo = staData.wrkNo; |
| | | // that.run = true; |
| | | |
| | | } |
| | | |
| | | that.change = function () { |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | import {InitPallet, InitGoods} from './StoreGoods.js'; |
| | | |
| | | // 输送线当前运行状态对象 |
| | | function StaTask(staData, object) { |
| | | let that = this; |
| | | |
| | | that.object = object; |
| | | |
| | | that.no = 0; |
| | | that.readyIn = false; |
| | | that.run = false; |
| | | that.loaded = 0; |
| | | that.wrkNo = null; |
| | | |
| | | 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(); |
| | | |
| | | that.modify = function (staData) { |
| | | if (that.run || that.no === 0) { |
| | | console.error(staData.no + "号输送线更新失败"); |
| | | return; |
| | | } |
| | | |
| | | // 页面切换导致货物覆盖 |
| | | if (that.loaded === 1 && staData.loaded === 1 && staData.wrkNo > 0 && that.wrkNo > 0 && that.wrkNo !== staData.wrkNo) { |
| | | if (that.inlet === 1) { |
| | | // remove |
| | | console.log("sta_" + that.no + " remove:" + that.wrkNo + "-Pallet; " + that.wrkNo + "-Goods"); |
| | | that.object.removeObject(that.wrkNo + "-Pallet"); |
| | | that.object.removeObject(that.wrkNo + "-Goods"); |
| | | // add |
| | | console.log("sta_" + that.no + " add:" + staData.wrkNo + "-Pallet + Goods; [up]"); |
| | | InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); |
| | | InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); |
| | | } |
| | | |
| | | that.readyIn = false; |
| | | } |
| | | |
| | | if (that.loaded === 0 && staData.loaded === 1) { |
| | | that.readyIn = true; |
| | | } |
| | | if (that.readyIn && staData.wrkNo && staData.wrkNo !== '0') { |
| | | // 无货 ===>> 有货 |
| | | |
| | | // 1.入库第一站 【新增】 |
| | | if (that.inlet === 1) { |
| | | console.log("sta_" + that.no + " add:" + staData.wrkNo + "-Pallet + Goods; [down]"); |
| | | InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); |
| | | InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); |
| | | |
| | | // 2.来自其他站点的货物 【移动】 |
| | | } else { |
| | | |
| | | } |
| | | that.readyIn = false; |
| | | } |
| | | |
| | | if (that.loaded === 1 && staData.loaded === 0) { |
| | | // 有货 ===>> 无货 |
| | | |
| | | // 1.出库最后一站 【移除】 |
| | | if (that.outlet === 1) { |
| | | let pallet = getArrVal(that.object.objects, "name", that.wrkNo + "-Pallet"); |
| | | if (pallet != null) { |
| | | that.object.removeObject(that.wrkNo + "-Pallet"); |
| | | } |
| | | let goods = getArrVal(that.object.objects, "name", that.wrkNo + "-Goods"); |
| | | if (goods != null) { |
| | | that.object.removeObject(that.wrkNo + "-Goods"); |
| | | } |
| | | } |
| | | that.readyIn = false; |
| | | } |
| | | |
| | | // 实时更新 |
| | | that.loaded = staData.loaded; |
| | | that.wrkNo = staData.wrkNo; |
| | | // that.run = true; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | export {StaTask} |
| | |
| | | import {MTLLoader} from "../lib/MTLLoader.js"; |
| | | import {OBJLoader} from "../lib/OBJLoader.js"; |
| | | import * as THREE from '../three.module.js'; |
| | | import * as BufferGeometryUtils from '../utils/BufferGeometryUtils.js'; |
| | | |
| | | const palletX = -2; |
| | | const palletY = 23 - 20 - 3; |
| | | const palletY = 0; |
| | | const palletZ = -25; |
| | | |
| | | const goodsX = -2; |
| | | const goodsY = 40 - 18; |
| | | const goodsY = 22; |
| | | const goodsZ = -25; |
| | | |
| | | /** |
| | |
| | | positionZ = (item.bay1-1)*-ref.binHeight || 0; |
| | | |
| | | clone.name = item.loc_no + "-" + "Pallet"; |
| | | clone.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.loc_no + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | case 2: |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | switch (ref.objectType) { |
| | | case 'chain': |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | |
| | | positionX -= 48 - 1; |
| | | positionY += 20; |
| | | positionZ -= 138 + 20; |
| | | positionX -= 48 - 1; |
| | | positionY += 20; |
| | | positionZ -= 138 + 20; |
| | | break |
| | | case 'roller': |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | |
| | | positionY += 20; |
| | | break |
| | | default: |
| | | break |
| | | } |
| | | |
| | | clone.name = item.wrkNo + "-" + "Pallet"; |
| | | clone.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.wrkNo + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | default: |
| | | console.error("InitPallet param[type] error ===>> " + type); |
| | |
| | | positionZ = (item.bay1-1)*-ref.binHeight || 0; |
| | | |
| | | clone.name = item.loc_no + "-" + "Goods"; |
| | | clone.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.loc_no + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | case 2: |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | switch (ref.objectType) { |
| | | case 'chain': |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | |
| | | positionX -= 48 - 1; |
| | | positionY += 20; |
| | | positionZ -= 138 + 20; |
| | | positionX -= 48 - 1; |
| | | positionY += 20; |
| | | positionZ -= 138 + 20; |
| | | break |
| | | case 'roller': |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | |
| | | positionY += 20; |
| | | break |
| | | default: |
| | | break |
| | | } |
| | | |
| | | clone.name = item.wrkNo + "-" + "Goods"; |
| | | clone.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.wrkNo + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | default: |
| | | console.error("InitGoods param[type] error ===>> " + type); |
| New file |
| | |
| | | import {MTLLoader} from "../lib/MTLLoader.js"; |
| | | import {OBJLoader} from "../lib/OBJLoader.js"; |
| | | import * as THREE from '../three.module.js'; |
| | | |
| | | const palletX = -18; |
| | | const palletY = 2; |
| | | const palletZ = -46; |
| | | |
| | | const goodsX = -17; |
| | | 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 ) |
| | | .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: 0x708090 |
| | | }); |
| | | } |
| | | }); |
| | | obj.scale.set(4, 4, 3.5); |
| | | |
| | | palletList.map(item => { |
| | | let clone = obj.clone(); |
| | | 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.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.loc_no + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | case 2: |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | |
| | | positionX -= 48 - 1; |
| | | positionY += 20; |
| | | positionZ -= 138 + 20; |
| | | |
| | | clone.name = item.wrkNo + "-" + "Pallet"; |
| | | clone.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.wrkNo + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | default: |
| | | console.error("InitPallet param[type] error ===>> " + type); |
| | | } |
| | | |
| | | clone.position.x = palletX + positionX; |
| | | clone.position.y = palletY + positionY; |
| | | clone.position.z = palletZ + positionZ; |
| | | scene.addObject(clone); |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 初始化货物模型 |
| | | * @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' ); |
| | | const goodsImg = new THREE.TextureLoader( manager ).load( '../static/img/goods.jpg' ); |
| | | new OBJLoader( manager ).load( '../static/model/obj/goods.obj', function ( obj ) { |
| | | obj.traverse (function (child) { |
| | | child.castShadow = true; |
| | | if (child instanceof THREE.Mesh) { |
| | | if (child.name === 'goods') { |
| | | child.material.map = goodsImg; |
| | | } else if (child.name === "goods_wrap") { |
| | | child.material.map = goodsWrapImg; |
| | | } |
| | | } |
| | | }); |
| | | obj.scale.set(1, 1.2, 1.2); |
| | | |
| | | goodsList.map(item => { |
| | | let clone = obj.clone(); |
| | | 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.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.loc_no + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | case 2: |
| | | positionX = ref.position.x || 0; |
| | | positionY = ref.position.y || 0; |
| | | positionZ = ref.position.z || 0; |
| | | |
| | | positionX -= 48 - 1; |
| | | positionY += 20; |
| | | positionZ -= 138 + 20; |
| | | |
| | | clone.name = item.wrkNo + "-" + "Goods"; |
| | | clone.traverse (function (child) { |
| | | if (child instanceof THREE.Mesh) { |
| | | child.name = item.wrkNo + "-" + child.name; |
| | | } |
| | | }) |
| | | break; |
| | | default: |
| | | console.error("InitGoods param[type] error ===>> " + type); |
| | | } |
| | | |
| | | clone.position.x = goodsX + positionX; |
| | | clone.position.y = goodsY + positionY; |
| | | clone.position.z = goodsZ + positionZ; |
| | | scene.addObject(clone); |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | 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, 1); |
| | | } |
| | | if (goodsList.length > 0) { |
| | | InitGoods(that.object, goodsList, that.shelf, 1); |
| | | } |
| | | } |
| | | init(); |
| | | |
| | | } |
| | | |
| | | // export {StoreGoods, InitPallet, InitGoods} |
| | |
| | | transparent: false, |
| | | opacity: 0.7 |
| | | }); |
| | | //定义一个组合体 |
| | | // let group = new THREE.Group(); |
| | | |
| | | // 货架总高 |
| | | let shelfHeight=this.bottomHight+(this.binYNum)*this.binHeight; |
| | | // 货架总宽 |
| | | let shelfWidth=this.binZNum*this.binWidth; |
| | | // 支架模型 + 材质 |
| | | let rackBoxGeometry=new THREE.BoxGeometry(this.rackLengh,shelfHeight,this.rackWidth); |
| | | let rackObject=new THREE.Mesh(rackBoxGeometry, shelfMat, 0); |
| | | // 托板模型 + 材质 |
| | | let planeBoxGeometry = new THREE.BoxGeometry(this.binLength, 2, this.binWidth+this.rackWidth); // 覆盖多一根支架宽度 |
| | | let planeObject=new THREE.Mesh(planeBoxGeometry, shelfMat, 0); |
| | | let planeRackBoxGeometry = new THREE.BoxGeometry(3, 2, this.binWidth+this.rackWidth); |
| | | |
| | | // Y轴定位 |
| | | let positionY = this.positionY + shelfHeight / 2; |
| | |
| | | let transform = new THREE.Object3D(); |
| | | // 初始化支架模型 |
| | | for(let i=0;i<=this.binZNum;i++) { |
| | | // let leftRack = rackObject.clone(); |
| | | // let positionZ = - ( this.positionZ + i*this.binWidth ); |
| | | // leftRack.position.set(leftPositionX,positionY,positionZ); |
| | | // leftRack.updateMatrix(); |
| | | // group.add(leftRack); |
| | | // |
| | | // let rightRack = rackObject.clone(); |
| | | // rightRack.position.set(rightPositionX,positionY,positionZ); |
| | | // rightRack.updateMatrix(); |
| | | // group.add(rightRack); |
| | | |
| | | let positionZ = - ( this.positionZ + i*this.binWidth ); |
| | | // ----- |
| | | let leftClone = rackBoxGeometry.clone(); |
| | |
| | | // 初始化托板模型 |
| | | for(let i = 0;i < this.binZNum;i++) { |
| | | 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 + i * this.binWidth + this.binWidth/2 ); |
| | | // plane.position.set(this.positionX-this.rackLengh/2,positionY,positionZ); |
| | | // plane.updateMatrix(); |
| | | // group.add(plane); |
| | | if (j !== this.binYNum) { |
| | | let leftClone = planeRackBoxGeometry.clone(); |
| | | let positionY = this.positionY + this.bottomHight + j*this.binHeight + 1; |
| | | let positionZ = - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); |
| | | transform.position.set(this.positionX - 16, positionY, positionZ); |
| | | transform.updateMatrix(); |
| | | leftClone.applyMatrix4(transform.matrix); |
| | | geometries.push(leftClone); |
| | | |
| | | let clone = planeBoxGeometry.clone(); |
| | | let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1; |
| | | let positionZ= - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); |
| | | transform.position.set(this.positionX-this.rackLengh/2,positionY,positionZ); |
| | | transform.updateMatrix(); |
| | | clone.applyMatrix4(transform.matrix); |
| | | geometries.push(clone); |
| | | let rightClone = planeRackBoxGeometry.clone(); |
| | | positionY = this.positionY + this.bottomHight + j*this.binHeight + 1; |
| | | positionZ = - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); |
| | | transform.position.set(this.positionX + 13, positionY, positionZ); |
| | | transform.updateMatrix(); |
| | | rightClone.applyMatrix4(transform.matrix); |
| | | geometries.push(rightClone); |
| | | } else { |
| | | let clone = planeBoxGeometry.clone(); |
| | | let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1; |
| | | let positionZ= - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); |
| | | transform.position.set(this.positionX-this.rackLengh/2,positionY,positionZ); |
| | | transform.updateMatrix(); |
| | | clone.applyMatrix4(transform.matrix); |
| | | geometries.push(clone); |
| | | } |
| | | } |
| | | } |
| | | |