From 9233b9a9c7c2e760d519d4ca0ccf0868b57fb1cd Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期一, 13 十二月 2021 15:14:49 +0800
Subject: [PATCH] #
---
static/js/app.js | 17 +++++++++++------
static/js/data/Task.js | 6 +++---
views/index.html | 2 +-
static/js/utils.js | 10 ++++++----
4 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/static/js/app.js b/static/js/app.js
index a7723c5..796ffe3 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -31,7 +31,6 @@
this.initLight();
this.initFloor();
this.initModel();
- this.queryTask();
this.initStoreObjects(this);
}
this.animate = function () {
@@ -39,7 +38,8 @@
this.stats.begin();
this.renderer.render(this.scene, this.camera);
this.stats.end();
- this.modelMove();
+ this.queryTask();
+ // this.modelMove();
}
this.initScene = function () {
this.scene = new THREE.Scene();
@@ -263,9 +263,13 @@
}
}
this.queryTask = function () {
- if (this.firstTime === 1) {
- queryTaskCurrent();
- this.wrkTasks = TaskData;
+ if (TaskDatas !== null) {
+ for (let TaskData of TaskDatas) {
+ let wrkTask = getArrVal(this.wrkTasks, "wrkNo", TaskData.wrkNo);
+ if (null == wrkTask) {
+ this.wrkTasks.push(TaskData);
+ }
+ }
}
}
this.getExistedGoodType=function(state){
@@ -353,8 +357,10 @@
});
}
this.initModelMove = function () {
+ console.log(this.wrkTasks)
for (var wrkMast of this.wrkTasks) {
let crnBody = getArrVal(this.objects, "name", wrkMast.crnNo + "-body");
+ console.log(crnBody)
// 鍙栬揣鐐瑰畾浣�
let sourceLocPosition = getBinPosition(wrkMast.sourceLocNo);
let points = [crnBody.position, sourceLocPosition];
@@ -378,7 +384,6 @@
}
}
},
-
};
diff --git a/static/js/data/Task.js b/static/js/data/Task.js
index cf108a8..05a2352 100644
--- a/static/js/data/Task.js
+++ b/static/js/data/Task.js
@@ -1,5 +1,5 @@
-
+setInterval("queryTaskCurrent()",1000);
function queryTaskCurrent() {
$.ajax({
// url: 'http://47.97.1.152:58080/jkwcs/three/init/store/v1',
@@ -8,9 +8,9 @@
data: {},
async: false,
success: function (res) {
- TaskData = res.data;
+ TaskDatas = res.data;
}
})
}
-var TaskData;
+var TaskDatas = null;
diff --git a/static/js/utils.js b/static/js/utils.js
index 6f3299e..6488db8 100644
--- a/static/js/utils.js
+++ b/static/js/utils.js
@@ -4,10 +4,12 @@
if (!arrObj instanceof Array) {
return null;
}
- for (var i = 0;i<arrObj.length;i++) {
- let element = arrObj[i];
- if (element[key] === condition) {
- return element;
+ if (arrObj == null || arrObj.length === 0) {
+ return null;
+ }
+ for (let obj of arrObj) {
+ if (obj[key] === condition) {
+ return obj;
}
}
return null;
diff --git a/views/index.html b/views/index.html
index 7d41ee1..37b841d 100644
--- a/views/index.html
+++ b/views/index.html
@@ -82,7 +82,7 @@
document.getElementById("print").addEventListener('click', function () {
console.log(player.objects);
- player.modelMove();
+ player.initModelMove();
}, false);
</script>
--
Gitblit v1.9.1