From 4d317e08d281b9e5e2cf742788c3d4b5b6bb9b38 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期三, 15 十二月 2021 13:48:55 +0800
Subject: [PATCH] #

---
 static/js/object/CrnTask.js |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/static/js/object/CrnTask.js b/static/js/object/CrnTask.js
index 3670542..ce2ed87 100644
--- a/static/js/object/CrnTask.js
+++ b/static/js/object/CrnTask.js
@@ -2,7 +2,6 @@
 function CrnTask(crnData) {
     let that = this;
 
-    // 璁块棶鍏湁灞炴�э紝闇�瑕佸湪鍙橀噺鍚嶅墠鍔犱笂this.
     that.crnNo = 0;
     that.run = false;
     // 涓婁竴鏁版嵁
@@ -11,6 +10,7 @@
     that.preX = 0;
     that.preY = 0;
     that.preZ = 0;
+    that.prePosition = null;
     that.preForkPos = -1;    // -1, "涓嶅湪瀹氫綅" 0, "璐у弶鍘熶綅" 1, "璐у弶鍦ㄥ乏渚ц繙" 2, "璐у弶鍦ㄥ乏渚�" 3, "璐у弶鍦ㄥ彸渚�"  4, "璐у弶鍦ㄥ彸渚ц繙"
     // 褰撳墠鏁版嵁
     that.bay = 1 ;
@@ -18,9 +18,9 @@
     that.x = 0;
     that.y = 0;
     that.z = 0;
+    that.position = null;
     that.forkPos = -1;
 
-    // 鏋勯�犲嚱鏁�
     let init = function () {
         that.crnNo = crnData.crnNo;
         that.bay = crnData.bay;
@@ -28,21 +28,25 @@
         that.x = crnData.position.x;
         that.y = crnData.position.y;
         that.z = crnData.position.z;
+        that.position = crnData.position;
         that.forkPos = crnData.forkPos;
     };
     init();
 
-    // 瀵瑰鍑芥暟
     that.modify = function (crnData) {
         if (that.run || that.crnNo === 0) {
             console.error(that.crnNo + "鍙峰爢鍨涙満鏇存柊澶辫触");
         } else {
+            if (JSON.stringify(crnData.position) === JSON.stringify(that.position)) {
+                return;
+            }
             // 涓婁竴娆�
             that.preBay = that.bay;
             that.preLev = that.lev;
             that.preX = that.x;
             that.preY = that.y;
             that.preY = that.y;
+            that.prePosition = JSON.parse(JSON.stringify(that.position));
             that.preForkPos = that.forkPos;
             // 褰撳墠
             that.bay = crnData.bay;
@@ -50,12 +54,15 @@
             that.x = crnData.position.x;
             that.y = crnData.position.y;
             that.z = crnData.position.z;
+            that.position = crnData.position;
             that.forkPos = crnData.forkPos;
             // create Route ------------------------------------------------
-            //  new Route();    // body
+            let bodyRoute = new Route([that.prePosition, that.position]);    // body
             // new Route();    // load
-            that.run = true;
-            console.log(that);
+            // console.log(bodyRoute);
+            // console.log("pre" + JSON.stringify(that.prePosition));
+            // console.log(JSON.stringify(that.position));
+            // that.run = true;
         }
     }
 

--
Gitblit v1.9.1