| | |
| | | this.firstTime = 1; |
| | | this.stats = null; |
| | | this.goodTypes=[];//存储所有的库位类型 |
| | | this.wrkNo = 0; |
| | | |
| | | this.start = function () { |
| | | this.initMain(); |
| | |
| | | this.stats.begin(); |
| | | this.renderer.render(this.scene, this.camera); |
| | | this.stats.end(); |
| | | this.modelMove(); |
| | | // this.modelMove(); |
| | | } |
| | | this.initScene = function () { |
| | | this.scene = new THREE.Scene(); |
| | |
| | | this.queryTask = function () { |
| | | if (this.firstTime === 1) { |
| | | queryTaskCurrent(); |
| | | console.log(TaskData); |
| | | if (this.wrkNo !== TaskData.wrkNo) { |
| | | this.wrkNo = TaskData.wrkNo; |
| | | } |
| | | } |
| | | } |
| | | this.getExistedGoodType=function(state){ |
| | |
| | | }); |
| | | } |
| | | this.modelMove = function () { |
| | | |
| | | // console.log(1) |
| | | let crnBody = getArrVal(this.objects, "name", "1-body"); |
| | | console.log(crnBody.position) |
| | | } |
| | | }, |
| | | |
| | |
| | | data: {}, |
| | | async: false, |
| | | success: function (res) { |
| | | TaskData = res; |
| | | TaskData = res.data; |
| | | } |
| | | }) |
| | | } |
New file |
| | |
| | | /** |
| | | * points:[ |
| | | {x:-100,y:1,z:50}, |
| | | {x:-500,y:1,z:50}, |
| | | {x:-800,y:1,z:50}, |
| | | {x:-800,y:1,z:420}, |
| | | {x:-1400,y:1,z:420}, |
| | | {x:-1400,y:1,z:480}, |
| | | {x:-100,y:1,z:480}, |
| | | {x:-100,y:1,z:50} |
| | | ] |
| | | */ |
| | | function Route(option) { |
| | | let curvePoints=[]; |
| | | for(let i=0;i<option.points.length;i++) { |
| | | let point=option.points[i]; |
| | | curvePoints.push(new THREE.Vector3(point.x, point.y, point.z)); |
| | | } |
| | | return new THREE.CatmullRomCurve3(curvePoints,false/*是否闭合*/,'catmullrom',0.000000001); |
| | | } |
New file |
| | |
| | | |
| | | // 将曲线显示出来 |
| | | function RouteLine(curve,option) { |
| | | let points = curve.getPoints(100); |
| | | let geometry = new THREE.Geometry(); |
| | | //geometry.vertices = curve.getSpacedPoints(100); |
| | | // 把从曲线轨迹上获得的顶点坐标赋值给几何体 |
| | | geometry.vertices = points; |
| | | var material = new THREE.LineBasicMaterial({ |
| | | color: 0x4488ff |
| | | }); |
| | | let line = new THREE.Line(geometry, material); |
| | | line.uuid=option.No; |
| | | line.name=option.Name; |
| | | line.type="Route"; |
| | | return line; |
| | | } |
| | |
| | | transparent: true, |
| | | opacity: .3 |
| | | })) |
| | | a.name = option.crnNo + "-body"; |
| | | a.position.x = option.crnBody.position.x; |
| | | a.position.y = option.crnBody.position.y + this.crnBodyHeight/2; |
| | | a.position.z = option.crnBody.position.z - this.crnBodyWidth/2; |
| | |
| | | transparent: true, |
| | | opacity: .5 |
| | | })) |
| | | b.name = option.crnNo + "-load"; |
| | | b.position.x = option.crnLoad.position.x; |
| | | b.position.y = option.crnLoad.position.y + this.crnLoadHeight/2; |
| | | b.position.z = option.crnLoad.position.z - this.crnLoadWidth/2 + 5; |
| | |
| | | transparent: true, |
| | | opacity: 1 |
| | | })) |
| | | c.name = option.crnNo + "-fork"; |
| | | c.position.x = option.crnFork.position.x; |
| | | c.position.y = option.crnFork.position.y + this.crnLoadHeight/2; |
| | | c.position.z = option.crnFork.position.z - this.crnLoadWidth/2; |
| | |
| | | |
| | | function getArrVal(arrObj, key, condition) { |
| | | if (!arrObj instanceof Array) { |
| | | return null; |
| | | } |
| | | for (var i = 0;i<arrObj.length;i++) { |
| | | let element = arrObj[i]; |
| | | if (element[key] === condition) { |
| | | return element; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | |
| | | <link rel="stylesheet" href="../static/css/main.css"> |
| | | <script type="text/javascript" src="../static/js/lib/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.2.2/dist/echarts.min.js"></script> |
| | | <script type="text/javascript" src="../static/js/utils.js"></script> |
| | | <script type="text/javascript" src="../static/js/common.js"></script> |
| | | <script type="text/javascript" src="../static/js/data/Warehouse.js"></script> |
| | | <script type="text/javascript" src="../static/js/data/Task.js"></script> |
| | |
| | | <script type="text/javascript" src="../static/js/object/StoreCrn.js"></script> |
| | | <script type="text/javascript" src="../static/js/object/StoreShelf.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/RouteLine.js"></script> |
| | | <script type="text/javascript" src="../static/js/lib/btnHide.js"></script> |
| | | </head> |
| | | <body style="position: relative"> |
| | | <div style="position: absolute;top: 0;right: 0"> |
| | | <button id="print">打印</button> |
| | | </div> |
| | | <div id="groundglass"></div> |
| | | <div id="sidebar"> |
| | | <p1>中扬-智能立体仓库</p1> |
| | |
| | | </div> |
| | | </div> |
| | | <div id="container"></div> |
| | | |
| | | <script type="module"> |
| | | |
| | | import * as THREE from '../static/js/three.module.js'; |
| | |
| | | // player.setSize( window.innerWidth, window.innerHeight ); |
| | | // } ); |
| | | |
| | | document.getElementById("print").addEventListener('click', function () { |
| | | console.log(player.objects); |
| | | player.modelMove(); |
| | | }, false); |
| | | |
| | | </script> |
| | | <script type="text/javascript"> |