From cc6d5f5fb6bbb23e88a95752a6e5265323d1c7d9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 17 十二月 2021 09:00:03 +0800
Subject: [PATCH] #

---
 static/js/app.js |   69 ++++++++++++++++++++++++++++++----
 1 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/static/js/app.js b/static/js/app.js
index 9b020f1..d21848e 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -14,6 +14,10 @@
 		this.firstTime = 1;
 		this.stats = null;
 		this.goodTypes=[];//瀛樺偍鎵�鏈夌殑搴撲綅绫诲瀷
+		this.wrkTasks = [];// 浠诲姟鍒楄〃
+		this.crnTasks = [];// 鍫嗗灈鏈哄垪琛�
+		this.time = 0;//鏍囪鍫嗗灈鏈鸿繍琛岀殑鏃堕棿
+		this.progress = 0;
 
 		this.start = function () {
 			this.initMain();
@@ -29,7 +33,6 @@
 			this.initLight();
 			this.initFloor();
 			this.initModel();
-			this.queryTask();
 			this.initStoreObjects(this);
 		}
 		this.animate = function () {
@@ -37,7 +40,10 @@
 			this.stats.begin();
 			this.renderer.render(this.scene, this.camera);
 			this.stats.end();
-			this.modelMove();
+			// this.queryTask();
+			this.queryCrn();
+			// this.modelMove();
+			this.crnMove();
 		}
 		this.initScene = function () {
 			this.scene = new THREE.Scene();
@@ -186,7 +192,7 @@
 				initStore();
 				if (Store3DData !== null) {
 					for(var group of Store3DData.data.store.groups) {
-						let crn = new StoreCrn(group.crn, object);
+						new StoreCrn(group.crn, object);
 						for (var line of group.lines) {
 							let shelf = new StoreShelf(line);
 							object.addObject(shelf);
@@ -261,9 +267,28 @@
 			}
 		}
 		this.queryTask = function () {
-			if (this.firstTime === 1) {
-				queryTaskCurrent();
-				console.log(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.queryCrn = function () {
+			if (CrnDatas !== null) {
+				for (let crnData of CrnDatas) {
+					let crnTask = getArrVal(this.crnTasks, "crnNo", crnData.crnNo);
+					if (null == crnTask) {
+						this.crnTasks.push(new CrnTask(crnData, this));
+					} else {
+						if(!crnTask.run) {
+							// console.log(2)
+							crnTask.modify(crnData);
+						}
+					}
+				}
 			}
 		}
 		this.getExistedGoodType=function(state){
@@ -344,17 +369,45 @@
 						.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 );
 				});
 		}
-		this.modelMove = function () {
+		this.initModelMove = function () {
+			console.log(this.crnTasks)
+			// for (var wrkMast of this.wrkTasks) {
+			// 	this.crnBody = getArrVal(this.objects, "name", wrkMast.crnNo + "-body");
+			// 	// 鍙栬揣鐐瑰畾浣�
+			// 	let sourceLocPosition = getBinPosition(wrkMast.sourceLocNo);
+			// 	let points = [new THREE.Vector3(this.crnBody.position.x, this.crnBody.position.y, this.crnBody.position.z), sourceLocPosition];
+			// 	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) {
+				crnTask.move();
+			}
+		}
 	},
-
 
 };
 

--
Gitblit v1.9.1