From 9acdc6158025f19c83d6f8d4144205b705625409 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 17 十二月 2021 14:40:00 +0800
Subject: [PATCH] #
---
static/js/app.js | 197 +++++++---------------------
static/js/data/Asrs.js | 14 --
static/js/object/CrnTask.js | 25 ++
views/index.html | 2
static/js/object/StoreCrn.js | 132 ++++++++++++++----
5 files changed, 171 insertions(+), 199 deletions(-)
diff --git a/static/js/app.js b/static/js/app.js
index 8d45283..ed4eedc 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -3,6 +3,7 @@
import {MTLLoader} from './lib/MTLLoader.js';
import {OBJLoader} from './lib/OBJLoader.js';
import {StoreShelf} from './object/StoreShelf.js';
+import {StoreCrn} from './object/StoreCrn.js';
var APP = {
@@ -41,9 +42,7 @@
this.stats.begin();
this.renderer.render(this.scene, this.camera);
this.stats.end();
- // this.queryTask();
this.queryCrn();
- // this.modelMove();
this.crnMove();
}
this.initScene = function () {
@@ -214,66 +213,6 @@
}
}
-
-
-
-
-
-
-
-
-
-
-
-
- //鏄剧ず浠撳簱鍖哄煙
- // for (let i = 0; i < Store3DData.Areas.length; i++) {
- // let optionArea = Store3DData.Areas[i];
- // let area = new StoreArea(optionArea);
- // object.addObject(area);
- // //鏄剧ず浠撳簱
- // for (let j = 0; j < optionArea.Stores.length; j++) {
- // let optionStore = optionArea.Stores[j];
- // optionStore.Position = CommonFunction.transPosition(optionStore.Position, optionArea.Position);
- // let store = new Store(optionStore);
- // // object.addObject(store);
- // //鏄剧ず姣忚淇℃伅
- // for (let k = 0; k < optionStore.Groups.length; k++) {
- // let optionGroup = optionStore.Groups[k];
- // optionGroup.Position = CommonFunction.transPosition(optionGroup.Position, optionStore.Position);
- // let shelf = new StoreShelf(optionGroup);
- // let group=new StoreGroup(optionGroup,1);
- // object.addObject(shelf);
- // // object.addObject(group);
- // //鏄剧ず搴撲綅涓婄殑璐х墿
- // for (let m = 0; m < optionGroup.Bins.length; m++) {
- // let optionBin = optionGroup.Bins[m];
- // let existGoods=this.getExistedGoodType(optionBin.State);
- // let storeGoods = new StoreGoods(optionGroup, optionBin);
- // if(existGoods==null) {
- // let goods=storeGoods.create();
- // object.addObject(goods);
- // this.goodTypes.push({type: optionBin.State, object: goods});
- // } else {
- // let goods= storeGoods.clone(existGoods);
- // object.addObject(goods);
- // }
- // }
- // }
- //
- // }
- // }
- // this.firstTime = 0;
- }
- }
- }
- this.queryTask = function () {
- if (TaskDatas !== null) {
- for (let TaskData of TaskDatas) {
- let wrkTask = getArrVal(this.wrkTasks, "wrkNo", TaskData.wrkNo);
- if (null == wrkTask) {
- this.wrkTasks.push(TaskData);
- }
}
}
}
@@ -303,81 +242,56 @@
}
this.initModel = function () {
let that = this;
- // let object;
- // const onProgress = function ( xhr ) {
- // if ( xhr.lengthComputable ) {
- // const percentComplete = xhr.loaded / xhr.total * 100;
- // console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
- // }
- // };
- // const onError = function () { };
- // function loadModel() {
- // object.traverse( function ( child ) {
- // if ( child.isMesh ) child.material.map = texture;
- // } );
- // object.position.y = 195;
- // that.addObject( object );
- // }
- // const manager = new THREE.LoadingManager(loadModel);
- // const textureLoader = new THREE.TextureLoader( manager );
- // const texture = textureLoader.load( '../static/model/obj/uv_grid_opengl.jpg' );
- // const loader = new OBJLoader( manager );
- // loader.load( '../static/model/obj/AGV.obj', function ( obj ) {
- // object = obj;
- // }, onProgress, onError );
const manager = new THREE.LoadingManager();
// manager.addHandler( /\.dds$/i, new DDSLoader() );
- new MTLLoader(manager)
- .setPath( '../static/model/obj/' )
- .load( '璐у弶.mtl', function ( materials ) {
- materials.preload();
- new OBJLoader( manager )
- .setMaterials( materials )
- .setPath( '../static/model/obj/' )
- .load( '璐у弶.obj', function ( object ) {
- object.position.z = -500;
- object.position.x = -2060;
- // object.position.z = 0;
- // object.position.x = 0;
- // object.position.y = 0;
- object.scale.set(0.025, 0.025, 0.025);
- object.rotateY(- Math.PI / 2)
- that.addObject( object );
- }, null, null );
- });
- new MTLLoader(manager)
- .setPath( '../static/model/obj/' )
- .load( '杞借揣鍙�.mtl', function ( materials ) {
- materials.preload();
- new OBJLoader( manager )
- .setMaterials( materials )
- .setPath( '../static/model/obj/' )
- .load( '杞借揣鍙�.obj', function ( object ) {
- object.position.z = -500;
- object.position.x = -2060;
- object.scale.set(0.025, 0.025, 0.025);
- object.rotateY(- Math.PI / 2)
- that.addObject( object );
- }, null, null );
- });
- new MTLLoader(manager)
- .setPath( '../static/model/obj/' )
- .load( '鍫嗗灈鏈烘湰浣�.mtl', function ( materials ) {
- materials.preload();
- new OBJLoader( manager )
- .setMaterials( materials )
- .setPath( '../static/model/obj/' )
- .load( '鍫嗗灈鏈烘湰浣�.obj', function ( object ) {
- object.position.z = -500;
- object.position.x = -2060;
- // object.position.z = 0;
- // object.position.x = 0;
- // object.position.y = 0;
- object.scale.set(0.025, 0.025, 0.025);
- object.rotateY(- Math.PI / 2)
- that.addObject( object );
- }, null, null );
- });
+ // new MTLLoader(manager)
+ // .setPath( '../static/model/obj/' )
+ // .load( '璐у弶.mtl', function ( materials ) {
+ // materials.preload();
+ // new OBJLoader( manager )
+ // .setMaterials( materials )
+ // .setPath( '../static/model/obj/' )
+ // .load( '璐у弶.obj', function ( object ) {
+ // object.position.z = -480;
+ // object.position.x = -1735;
+ // object.scale.set(0.03, 0.03, 0.03);
+ // object.rotateY(- Math.PI / 2)
+ // that.addObject( object );
+ // }, null, null );
+ // });
+ // new MTLLoader(manager)
+ // .setPath( '../static/model/obj/' )
+ // .load( '杞借揣鍙�.mtl', function ( materials ) {
+ // materials.preload();
+ // new OBJLoader( manager )
+ // .setMaterials( materials )
+ // .setPath( '../static/model/obj/' )
+ // .load( '杞借揣鍙�.obj', function ( object ) {
+ // object.position.z = -480;
+ // object.position.x = -1735;
+ // object.scale.set(0.03, 0.03, 0.03);
+ // object.rotateY(- Math.PI / 2)
+ // that.addObject( object );
+ // }, null, null );
+ // });
+ // new MTLLoader(manager)
+ // .setPath( '../static/model/obj/' )
+ // .load( '鍫嗗灈鏈烘湰浣�.mtl', function ( materials ) {
+ // materials.preload();
+ // new OBJLoader( manager )
+ // .setMaterials( materials )
+ // .setPath( '../static/model/obj/' )
+ // .load( '鍫嗗灈鏈烘湰浣�.obj', function ( object ) {
+ // object.position.z = -480;
+ // object.position.x = -1735;
+ // // object.position.z = 0;
+ // // object.position.x = 0;
+ // // object.position.y = 0;
+ // object.scale.set(0.03, 0.03, 0.03);
+ // object.rotateY(- Math.PI / 2)
+ // that.addObject( object );
+ // }, null, null );
+ // });
}
this.initModelMove = function () {
console.log(this.crnTasks)
@@ -389,19 +303,6 @@
// this.curve = new Route(points);
// }
- }
- this.modelMove = function () {
- if (this.curve) {
- this.progress += 0.001;
- if (this.progress>1.0) {
- this.curve = null;
- } else {
- let point = this.curve.getPoint(this.progress);
- if(point&&point.x){
- this.crnBody.position.set(point.x,point.y,point.z);
- }
- }
- }
}
this.crnMove = function (object) {
for (let crnTask of this.crnTasks) {
diff --git a/static/js/data/Asrs.js b/static/js/data/Asrs.js
index e540b02..4875c46 100644
--- a/static/js/data/Asrs.js
+++ b/static/js/data/Asrs.js
@@ -1,22 +1,8 @@
setInterval(function () {
- queryTaskCurrent();
queryCrnCurrent();
},1000);
-var TaskDatas = null;
-function queryTaskCurrent() {
- $.ajax({
- // url: 'http://47.97.1.152:58080/jkwcs/three/init/store/v1',
- url: 'http://localhost:9090/jkwcs/three/query/task/current/v1',
- type: "GET",
- data: {},
- async: false,
- success: function (res) {
- TaskDatas = res.data;
- }
- })
-}
var CrnDatas = null;
function queryCrnCurrent() {
diff --git a/static/js/object/CrnTask.js b/static/js/object/CrnTask.js
index 226d367..b85ef13 100644
--- a/static/js/object/CrnTask.js
+++ b/static/js/object/CrnTask.js
@@ -1,3 +1,16 @@
+
+const xOffset = -1735;
+const yOffset = -289;
+const zOffset = -480;
+
+const xOffset0 = -1735;
+const yOffset0 = -108;
+const zOffset0 = -480;
+
+const xOffset1 = -1735;
+const yOffset1 = -107;
+const zOffset1 = -475;
+
// 鍫嗗灈鏈哄綋鍓嶈繍琛岀姸鎬佸璞�
function CrnTask(crnData, object) {
let that = this;
@@ -44,8 +57,8 @@
init();
that.modify = function (crnData) {
- if (that.run || that.crnNo === 0) {
- console.error(that.crnNo + "鍙峰爢鍨涙満鏇存柊澶辫触");
+ if (that.run || that.crnNo === 0 || that.crnBody===null || that.crnLoad===null || that.crnFork==null) {
+ // console.log(that.crnNo + "鍙峰爢鍨涙満鏇存柊澶辫触");
} else {
if (JSON.stringify(crnData.position) === JSON.stringify(that.position)) {
return;
@@ -163,12 +176,12 @@
that.crnBody.position.set(point.x, point.y, point.z);
break
case 'load':
- that.crnBody.position.z = point.z;
- that.crnLoad.position.set(point.x, point.y, point.z);
- that.crnFork.position.set(point.x, point.y, point.z);
+ that.crnBody.position.z = point.z + zOffset;
+ that.crnLoad.position.set(point.x, point.y + yOffset0, point.z + zOffset0);
+ that.crnFork.position.set(point.x, point.y + yOffset1, point.z + zOffset1);
break
case 'fork':
- that.crnFork.position.set(point.x, point.y, point.z);
+ that.crnFork.position.set(point.x + xOffset1, point.y, point.z);
break
default:
break
diff --git a/static/js/object/StoreCrn.js b/static/js/object/StoreCrn.js
index ff57655..f7751a3 100644
--- a/static/js/object/StoreCrn.js
+++ b/static/js/object/StoreCrn.js
@@ -1,4 +1,20 @@
+import {MTLLoader} from "../lib/MTLLoader.js";
+import {OBJLoader} from "../lib/OBJLoader.js";
+
+const xOffset = -1735;
+const yOffset = -289;
+const zOffset = -480;
+
+const xOffset0 = -1735;
+const yOffset0 = -108;
+const zOffset0 = -480;
+
+const xOffset1 = -1735;
+const yOffset1 = -107;
+const zOffset1 = -475;
+
function StoreCrn(option, object) {
+ let that = this;
this.crnBodyLength = option.crnBody.length||50;//搴撲綅闀垮害
this.crnBodyWidth = option.crnBody.width||50;//搴撲綅瀹�
this.crnBodyHeight = option.crnBody.height||500;//搴撲綅楂�
@@ -10,37 +26,93 @@
this.crnForkHeight = option.crnFork.height||30;//搴撲綅楂�
// 绔嬫煴
- var a = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnBodyLength, this.crnBodyHeight, this.crnBodyWidth), new THREE.MeshBasicMaterial({
- color: 0xff0000,
- 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;
- object.addObject(a);
+ // var a = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnBodyLength, this.crnBodyHeight, this.crnBodyWidth), new THREE.MeshBasicMaterial({
+ // color: 0xff0000,
+ // 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;
+ // object.addObject(a);
// 杞借揣鍙�
- var b = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnLoadLength, this.crnLoadHeight, this.crnLoadWidth), new THREE.MeshBasicMaterial({
- color: 0x00ff00,
- 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;
- object.addObject(b);
+ // var b = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnLoadLength, this.crnLoadHeight, this.crnLoadWidth), new THREE.MeshBasicMaterial({
+ // color: 0x00ff00,
+ // 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;
+ // object.addObject(b);
// 鍙夌墮
- var c = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnForkLength, this.crnForkWidth, this.crnForkHeight), new THREE.MeshBasicMaterial({
- color: 0xff00ff,
- 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;
- object.addObject(c);
+ // var c = new THREE.Mesh(new THREE.BoxBufferGeometry(this.crnForkLength, this.crnForkWidth, this.crnForkHeight), new THREE.MeshBasicMaterial({
+ // color: 0xff00ff,
+ // 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;
+ // object.addObject(c);
+
+
+ const manager = new THREE.LoadingManager();
+ new MTLLoader(manager)
+ .setPath( '../static/model/obj/' )
+ .load( '鍫嗗灈鏈烘湰浣�.mtl', function ( materials ) {
+ materials.preload();
+ new OBJLoader( manager )
+ .setMaterials( materials )
+ .setPath( '../static/model/obj/' )
+ .load( '鍫嗗灈鏈烘湰浣�.obj', function ( obj ) {
+ obj.scale.set(0.03, 0.03, 0.03);
+ obj.rotateY(- Math.PI / 2);
+ obj.name = option.crnNo + "-body";
+ obj.position.x = option.crnBody.position.x + xOffset;
+ obj.position.y = option.crnBody.position.y + that.crnBodyHeight/2 + yOffset;
+ obj.position.z = option.crnBody.position.z - that.crnBodyWidth/2 + zOffset;
+ object.addObject( obj );
+ }, null, null );
+ });
+ new MTLLoader(manager)
+ .setPath( '../static/model/obj/' )
+ .load( '杞借揣鍙�.mtl', function ( materials ) {
+ materials.preload();
+ new OBJLoader( manager )
+ .setMaterials( materials )
+ .setPath( '../static/model/obj/' )
+ .load( '杞借揣鍙�.obj', function ( obj ) {
+ obj.scale.set(0.03, 0.03, 0.03);
+ obj.rotateY(- Math.PI / 2);
+ obj.name = option.crnNo + "-load";
+ obj.position.x = option.crnLoad.position.x + xOffset0;
+ obj.position.y = option.crnLoad.position.y + that.crnLoadHeight/2 + yOffset0;
+ obj.position.z = option.crnLoad.position.z - that.crnLoadWidth/2 + 5 + zOffset0;
+ object.addObject( obj );
+ }, null, null );
+ });
+ new MTLLoader(manager)
+ .setPath( '../static/model/obj/' )
+ .load( '璐у弶.mtl', function ( materials ) {
+ materials.preload();
+ new OBJLoader( manager )
+ .setMaterials( materials )
+ .setPath( '../static/model/obj/' )
+ .load( '璐у弶.obj', function ( obj ) {
+ obj.scale.set(0.03, 0.03, 0.03);
+ obj.rotateY(- Math.PI / 2);
+ obj.name = option.crnNo + "-fork";
+ obj.position.x = option.crnFork.position.x + xOffset1;
+ obj.position.y = option.crnFork.position.y + that.crnLoadHeight/2 + yOffset1;
+ obj.position.z = option.crnFork.position.z - that.crnLoadWidth/2 + zOffset1;
+ object.addObject( obj );
+ }, null, null );
+ });
}
+
+export {StoreCrn}
diff --git a/views/index.html b/views/index.html
index e812237..92ba2f6 100644
--- a/views/index.html
+++ b/views/index.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../static/js/object/StoreArea.js"></script>
<script type="text/javascript" src="../static/js/object/Store.js"></script>
<script type="text/javascript" src="../static/js/object/StoreGroup.js"></script>
- <script type="text/javascript" src="../static/js/object/StoreCrn.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>
--
Gitblit v1.9.1