From 7923c73fd7910957114024c76b356c378fc0e60e Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 08 七月 2022 08:40:42 +0800
Subject: [PATCH] Merge branches 'local' and 'master' of http://47.97.1.152:5880/r/ASRS-3D into local

---
 static/js/app.js                    |    8 
 static/js/data/ConveyData.js        |  199 ++++++++--------
 static/js/object/CrnTask.js         |   12 
 static/js/object/ObjectSelect.js    |    2 
 static/js/object/StaTask.js         |   59 ++--
 static/js/object/StoreGoods.js      |   76 +++---
 static/js/object/StoreShelf.js      |   55 ++--
 static/js/object/StaTask0.js        |   99 ++++++++
 static/js/object/StoreGoods_Copy.js |  182 +++++++++++++++
 static/js/data/BuildingData.js      |    2 
 10 files changed, 483 insertions(+), 211 deletions(-)

diff --git a/static/js/app.js b/static/js/app.js
index 508fc82..cf1bd8b 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -73,7 +73,6 @@
 			this.queryCrn();
 			this.crnMove();
 			this.querySta();
-			this.staChange();
 		}
 		this.initScene = function () {
 			this.scene = new THREE.Scene();
@@ -370,16 +369,11 @@
 					if (null == staTask) {
 						this.staTasks.push(new StaTask(staData, this));
 					} else {
-						if(!staTask.run) {
+						if(!staTask.run && !staTask.isDel) {
 							staTask.modify(staData);
 						}
 					}
 				}
-			}
-		}
-		this.staChange = function () {
-			for (let staTask of this.staTasks) {
-				staTask.change();
 			}
 		}
 
diff --git a/static/js/data/BuildingData.js b/static/js/data/BuildingData.js
index 47c25ef..aa1973d 100644
--- a/static/js/data/BuildingData.js
+++ b/static/js/data/BuildingData.js
@@ -29,7 +29,7 @@
             style:{
                 color: 0x5F7480,
                 transparent:1,
-                opacity:0.8
+                opacity:0.35
             }
         }
     ]
diff --git a/static/js/data/ConveyData.js b/static/js/data/ConveyData.js
index 6b228db..90d0460 100644
--- a/static/js/data/ConveyData.js
+++ b/static/js/data/ConveyData.js
@@ -195,7 +195,7 @@
         },
         // 閾炬潯杈撻�佹満 1F 绗�2鍒� --------------------------------------------------------------------------------------------
         {
-            no: '1',
+            no: '172',
             objectType: 'chain',
             position: {
                 x: 48 + 57,
@@ -203,7 +203,7 @@
             }
         },
         {
-            no: '1',
+            no: '170',
             objectType: 'chain',
             position: {
                 x: 48 + 146,
@@ -211,7 +211,7 @@
             }
         },
         {
-            no: '1',
+            no: '168',
             objectType: 'chain',
             position: {
                 x: 48 + 287,
@@ -219,7 +219,7 @@
             }
         },
         {
-            no: '1',
+            no: '166',
             objectType: 'chain',
             position: {
                 x: 48 + 376,
@@ -227,7 +227,7 @@
             }
         },
         {
-            no: '1',
+            no: '164',
             objectType: 'chain',
             position: {
                 x: 48 + 517,
@@ -235,7 +235,7 @@
             }
         },
         {
-            no: '1',
+            no: '162',
             objectType: 'chain',
             position: {
                 x: 48 + 606,
@@ -243,7 +243,7 @@
             }
         },
         {
-            no: '1',
+            no: '160',
             objectType: 'chain',
             position: {
                 x: 48 + 747,
@@ -251,7 +251,7 @@
             }
         },
         {
-            no: '1',
+            no: '158',
             objectType: 'chain',
             position: {
                 x: 48 + 836,
@@ -259,7 +259,7 @@
             }
         },
         {
-            no: '1',
+            no: '155',
             objectType: 'chain',
             position: {
                 x: 48 + 977,
@@ -267,7 +267,7 @@
             }
         },
         {
-            no: '1',
+            no: '153',
             objectType: 'chain',
             position: {
                 x: 48 + 1066,
@@ -275,7 +275,7 @@
             }
         },
         {
-            no: '1',
+            no: '151',
             objectType: 'chain',
             position: {
                 x: 48 + 1207,
@@ -283,7 +283,7 @@
             }
         },
         {
-            no: '1',
+            no: '149',
             objectType: 'chain',
             position: {
                 x: 48 + 1296,
@@ -291,7 +291,7 @@
             }
         },
         {
-            no: '1',
+            no: '147',
             objectType: 'chain',
             position: {
                 x: 48 + 1437,
@@ -299,7 +299,7 @@
             }
         },
         {
-            no: '1',
+            no: '145',
             objectType: 'chain',
             position: {
                 x: 48 + 1526,
@@ -307,7 +307,7 @@
             }
         },
         {
-            no: '1',
+            no: '143',
             objectType: 'chain',
             position: {
                 x: 48 + 1667,
@@ -315,7 +315,7 @@
             }
         },
         {
-            no: '1',
+            no: '141',
             objectType: 'chain',
             position: {
                 x: 48 + 1756,
@@ -323,7 +323,7 @@
             }
         },
         {
-            no: '1',
+            no: '138',
             objectType: 'chain',
             position: {
                 x: 48 + 1897,
@@ -331,7 +331,7 @@
             }
         },
         {
-            no: '1',
+            no: '136',
             objectType: 'chain',
             position: {
                 x: 48 + 1986,
@@ -339,7 +339,7 @@
             }
         },
         {
-            no: '1',
+            no: '134',
             objectType: 'chain',
             position: {
                 x: 48 + 2127,
@@ -347,7 +347,7 @@
             }
         },
         {
-            no: '1',
+            no: '132',
             objectType: 'chain',
             position: {
                 x: 48 + 2216,
@@ -355,7 +355,7 @@
             }
         },
         {
-            no: '1',
+            no: '130',
             objectType: 'chain',
             position: {
                 x: 48 + 2357,
@@ -363,7 +363,7 @@
             }
         },
         {
-            no: '1',
+            no: '128',
             objectType: 'chain',
             position: {
                 x: 48 + 2446,
@@ -371,7 +371,7 @@
             }
         },
         {
-            no: '1',
+            no: '126',
             objectType: 'chain',
             position: {
                 x: 48 + 2587,
@@ -379,7 +379,7 @@
             }
         },
         {
-            no: '1',
+            no: '124',
             objectType: 'chain',
             position: {
                 x: 48 + 2676,
@@ -388,7 +388,7 @@
         },
         // 閾炬潯杈撻�佹満 1F 绗�3鍒� --------------------------------------------------------------------------------------------
         {
-            no: '1',
+            no: '174',
             objectType: 'chain',
             position: {
                 x: 48 + 146,
@@ -396,7 +396,7 @@
             }
         },
         {
-            no: '1',
+            no: '177',
             objectType: 'chain',
             position: {
                 x: 48 + 287,
@@ -404,7 +404,7 @@
             }
         },
         {
-            no: '1',
+            no: '181',
             objectType: 'chain',
             position: {
                 x: 48 + 517,
@@ -412,7 +412,7 @@
             }
         },
         {
-            no: '1',
+            no: '186',
             objectType: 'chain',
             position: {
                 x: 48 + 836,
@@ -420,7 +420,7 @@
             }
         },
         {
-            no: '1',
+            no: '190',
             objectType: 'chain',
             position: {
                 x: 48 + 977,
@@ -428,7 +428,7 @@
             }
         },
         {
-            no: '1',
+            no: '195',
             objectType: 'chain',
             position: {
                 x: 48 + 1296,
@@ -436,7 +436,7 @@
             }
         },
         {
-            no: '1',
+            no: '199',
             objectType: 'chain',
             position: {
                 x: 48 + 1526,
@@ -444,7 +444,7 @@
             }
         },
         {
-            no: '1',
+            no: '203',
             objectType: 'chain',
             position: {
                 x: 48 + 1756,
@@ -452,7 +452,7 @@
             }
         },
         {
-            no: '1',
+            no: '207',
             objectType: 'chain',
             position: {
                 x: 48 + 1897,
@@ -460,7 +460,7 @@
             }
         },
         {
-            no: '1',
+            no: '212',
             objectType: 'chain',
             position: {
                 x: 48 + 2127,
@@ -468,7 +468,7 @@
             }
         },
         {
-            no: '1',
+            no: '216',
             objectType: 'chain',
             position: {
                 x: 48 + 2216,
@@ -476,7 +476,7 @@
             }
         },
         {
-            no: '1',
+            no: '220',
             objectType: 'chain',
             position: {
                 x: 48 + 2357,
@@ -484,7 +484,7 @@
             }
         },
         {
-            no: '1',
+            no: '224',
             objectType: 'chain',
             position: {
                 x: 48 + 2446,
@@ -492,7 +492,7 @@
             }
         },
         {
-            no: '1',
+            no: '227',
             objectType: 'chain',
             position: {
                 x: 48 + 2587,
@@ -501,7 +501,7 @@
         },
         // 閾炬潯杈撻�佹満 2F 绗�1鍒� --------------------------------------------------------------------------------------------
         {
-            no: '1',
+            no: '321',
             objectType: 'chain',
             position: {
                 x: 48 + 146,
@@ -510,7 +510,7 @@
             }
         },
         {
-            no: '1',
+            no: '320',
             objectType: 'chain',
             position: {
                 x: 48 + 287,
@@ -520,7 +520,7 @@
         },
 
         {
-            no: '1',
+            no: '319',
             objectType: 'chain',
             position: {
                 x: 48 + 606,
@@ -529,7 +529,7 @@
             }
         },
         {
-            no: '1',
+            no: '318',
             objectType: 'chain',
             position: {
                 x: 48 + 747,
@@ -539,7 +539,7 @@
         },
 
         {
-            no: '1',
+            no: '317',
             objectType: 'chain',
             position: {
                 x: 48 + 1066,
@@ -548,7 +548,7 @@
             }
         },
         {
-            no: '1',
+            no: '316',
             objectType: 'chain',
             position: {
                 x: 48 + 1207,
@@ -558,7 +558,7 @@
         },
 
         {
-            no: '1',
+            no: '315',
             objectType: 'chain',
             position: {
                 x: 48 + 1526,
@@ -567,7 +567,7 @@
             }
         },
         {
-            no: '1',
+            no: '314',
             objectType: 'chain',
             position: {
                 x: 48 + 1667,
@@ -576,7 +576,7 @@
             }
         },
         {
-            no: '1',
+            no: '313',
             objectType: 'chain',
             position: {
                 x: 48 + 1897,
@@ -585,7 +585,7 @@
             }
         },
         {
-            no: '1',
+            no: '312',
             objectType: 'chain',
             position: {
                 x: 48 + 1986,
@@ -594,7 +594,7 @@
             }
         },
         {
-            no: '1',
+            no: '311',
             objectType: 'chain',
             position: {
                 x: 48 + 2127,
@@ -603,7 +603,7 @@
             }
         },
         {
-            no: '1',
+            no: '310',
             objectType: 'chain',
             position: {
                 x: 48 + 2216,
@@ -612,7 +612,7 @@
             }
         },
         {
-            no: '1',
+            no: '309',
             objectType: 'chain',
             position: {
                 x: 48 + 2357,
@@ -621,7 +621,7 @@
             }
         },
         {
-            no: '1',
+            no: '308',
             objectType: 'chain',
             position: {
                 x: 48 + 2446,
@@ -630,7 +630,7 @@
             }
         },
         {
-            no: '1',
+            no: '307',
             objectType: 'chain',
             position: {
                 x: 48 + 2587,
@@ -639,7 +639,7 @@
             }
         },
         {
-            no: '1',
+            no: '306',
             objectType: 'chain',
             position: {
                 x: 48 + 2676,
@@ -649,7 +649,7 @@
         },
         // 婊氱瓛杈撻�佹満 1F 绗�1鍒� --------------------------------------------------------------------------------------------
         {
-            no: '1',
+            no: '171',
             objectType: 'roller',
             position: {
                 x: -2 + 100,
@@ -662,7 +662,7 @@
             }
         },
         {
-            no: '1',
+            no: '169',
             objectType: 'roller',
             position: {
                 x: -2 + 213,
@@ -675,7 +675,7 @@
             }
         },
         {
-            no: '1',
+            no: '167',
             objectType: 'roller',
             position: {
                 x: -2 + 330,
@@ -688,7 +688,7 @@
             }
         },
         {
-            no: '1',
+            no: '165',
             objectType: 'roller',
             position: {
                 x: -2 + 442,
@@ -702,7 +702,7 @@
         },
 
         {
-            no: '1',
+            no: '163',
             objectType: 'roller',
             position: {
                 x: -2 + 560,
@@ -715,7 +715,7 @@
             }
         },
         {
-            no: '1',
+            no: '161',
             objectType: 'roller',
             position: {
                 x: -2 + 673,
@@ -728,7 +728,7 @@
             }
         },
         {
-            no: '1',
+            no: '159',
             objectType: 'roller',
             position: {
                 x: -2 + 790,
@@ -740,8 +740,9 @@
                 }
             }
         },
+        // 157
         {
-            no: '1',
+            no: '156',
             objectType: 'roller',
             position: {
                 x: -2 + 902,
@@ -754,8 +755,9 @@
             }
         },
 
+
         {
-            no: '1',
+            no: '154',
             objectType: 'roller',
             position: {
                 x: -2 + 1020,
@@ -768,7 +770,7 @@
             }
         },
         {
-            no: '1',
+            no: '152',
             objectType: 'roller',
             position: {
                 x: -2 + 1133,
@@ -781,7 +783,7 @@
             }
         },
         {
-            no: '1',
+            no: '150',
             objectType: 'roller',
             position: {
                 x: -2 + 1250,
@@ -794,7 +796,7 @@
             }
         },
         {
-            no: '1',
+            no: '148',
             objectType: 'roller',
             position: {
                 x: -2 + 1362,
@@ -808,7 +810,7 @@
         },
 
         {
-            no: '1',
+            no: '146',
             objectType: 'roller',
             position: {
                 x: -2 + 1480,
@@ -821,7 +823,7 @@
             }
         },
         {
-            no: '1',
+            no: '144',
             objectType: 'roller',
             position: {
                 x: -2 + 1593,
@@ -834,7 +836,7 @@
             }
         },
         {
-            no: '1',
+            no: '142',
             objectType: 'roller',
             position: {
                 x: -2 + 1710,
@@ -846,8 +848,9 @@
                 }
             }
         },
+        // 140
         {
-            no: '1',
+            no: '139',
             objectType: 'roller',
             position: {
                 x: -2 + 1822,
@@ -861,7 +864,7 @@
         },
 
         {
-            no: '1',
+            no: '137',
             objectType: 'roller',
             position: {
                 x: -2 + 1940,
@@ -874,7 +877,7 @@
             }
         },
         {
-            no: '1',
+            no: '135',
             objectType: 'roller',
             position: {
                 x: -2 + 2053,
@@ -887,7 +890,7 @@
             }
         },
         {
-            no: '1',
+            no: '133',
             objectType: 'roller',
             position: {
                 x: -2 + 2170,
@@ -900,7 +903,7 @@
             }
         },
         {
-            no: '1',
+            no: '131',
             objectType: 'roller',
             position: {
                 x: -2 + 2282,
@@ -914,7 +917,7 @@
         },
 
         {
-            no: '1',
+            no: '129',
             objectType: 'roller',
             position: {
                 x: -2 + 2400,
@@ -927,7 +930,7 @@
             }
         },
         {
-            no: '1',
+            no: '127',
             objectType: 'roller',
             position: {
                 x: -2 + 2513,
@@ -940,7 +943,7 @@
             }
         },
         {
-            no: '1',
+            no: '125',
             objectType: 'roller',
             position: {
                 x: -2 + 2630,
@@ -954,7 +957,7 @@
         },
         // 婊氱瓛杈撻�佹満 1F 绗�2鍒� --------------------------------------------------------------------------------------------
         {
-            no: '1',
+            no: '175',
             objectType: 'roller',
             position: {
                 x: -2 + 212,
@@ -968,7 +971,7 @@
         },
 
         {
-            no: '1',
+            no: '178',
             objectType: 'roller',
             position: {
                 x: -2 + 349,
@@ -981,7 +984,7 @@
             }
         },
         {
-            no: '1',
+            no: '179',
             objectType: 'roller',
             position: {
                 x: -2 + 450,
@@ -995,7 +998,7 @@
         },
 
         {
-            no: '1',
+            no: '182',
             objectType: 'roller',
             position: {
                 x: -2 + 598,
@@ -1007,8 +1010,9 @@
                 }
             }
         },
+        // 183
         {
-            no: '1',
+            no: '184',
             objectType: 'roller',
             position: {
                 x: -2 + 744,
@@ -1022,7 +1026,7 @@
         },
 
         {
-            no: '1',
+            no: '187',
             objectType: 'roller',
             position: {
                 x: -2 + 903,
@@ -1034,9 +1038,10 @@
                 }
             }
         },
+        // 188
 
         {
-            no: '1',
+            no: '191',
             objectType: 'roller',
             position: {
                 x: -2 + 1058,
@@ -1048,8 +1053,9 @@
                 }
             }
         },
+        // 192
         {
-            no: '1',
+            no: '193',
             objectType: 'roller',
             position: {
                 x: -2 + 1204,
@@ -1063,7 +1069,7 @@
         },
 
         {
-            no: '1',
+            no: '196',
             objectType: 'roller',
             position: {
                 x: -2 + 1357,
@@ -1076,7 +1082,7 @@
             }
         },
         {
-            no: '1',
+            no: '197',
             objectType: 'roller',
             position: {
                 x: -2 + 1458,
@@ -1090,7 +1096,7 @@
         },
 
         {
-            no: '1',
+            no: '200',
             objectType: 'roller',
             position: {
                 x: -2 + 1587,
@@ -1103,7 +1109,7 @@
             }
         },
         {
-            no: '1',
+            no: '201',
             objectType: 'roller',
             position: {
                 x: -2 + 1688,
@@ -1117,7 +1123,7 @@
         },
 
         {
-            no: '1',
+            no: '204',
             objectType: 'roller',
             position: {
                 x: -2 + 1822,
@@ -1129,9 +1135,10 @@
                 }
             }
         },
+        // 205
 
         {
-            no: '1',
+            no: '208',
             objectType: 'roller',
             position: {
                 x: -2 + 1958,
@@ -1144,7 +1151,7 @@
             }
         },
         {
-            no: '1',
+            no: '209',
             objectType: 'roller',
             position: {
                 x: -2 + 2059,
@@ -1158,7 +1165,7 @@
         },
 
         {
-            no: '1',
+            no: '213',
             objectType: 'roller',
             position: {
                 x: -2 + 2170,
@@ -1172,7 +1179,7 @@
         },
 
         {
-            no: '1',
+            no: '217',
             objectType: 'roller',
             position: {
                 x: -2 + 2282,
@@ -1186,7 +1193,7 @@
         },
 
         {
-            no: '1',
+            no: '221',
             objectType: 'roller',
             position: {
                 x: -2 + 2400,
@@ -1201,7 +1208,7 @@
 
 
         {
-            no: '1',
+            no: '225',
             objectType: 'roller',
             position: {
                 x: -2 + 2512,
diff --git a/static/js/object/CrnTask.js b/static/js/object/CrnTask.js
index ea833f3..de21fd6 100644
--- a/static/js/object/CrnTask.js
+++ b/static/js/object/CrnTask.js
@@ -11,13 +11,13 @@
 const yOffset1 = -116;
 const zOffset1 = -475;
 
-const palletX = -18;
-const palletY = 2;
-const palletZ = -46;
+const palletX = -2;
+const palletY = 0;
+const palletZ = -25;
 
-const goodsX = -17;
-const goodsY = 5;
-const goodsZ = -6;
+const goodsX = -2;
+const goodsY = 22;
+const goodsZ = -25;
 
 // 鍫嗗灈鏈哄綋鍓嶈繍琛岀姸鎬佸璞�
 function CrnTask(crnData, object) {
diff --git a/static/js/object/ObjectSelect.js b/static/js/object/ObjectSelect.js
index d53e610..28738d8 100644
--- a/static/js/object/ObjectSelect.js
+++ b/static/js/object/ObjectSelect.js
@@ -29,7 +29,7 @@
             $("#label").attr("style", "display:none;");
             return;
         }
-
+        console.log(intersects[0].object)
         let objName = intersects[0].object.name;
         if (objName) {
             let dest = objName.split("-")[0];
diff --git a/static/js/object/StaTask.js b/static/js/object/StaTask.js
index 6680755..4c72efc 100644
--- a/static/js/object/StaTask.js
+++ b/static/js/object/StaTask.js
@@ -7,6 +7,9 @@
     that.object = object;
 
     that.no = 0;
+    that.objectType = null;
+    that.isDel = false;
+    that.readyIn = false;
     that.run = false;
     that.loaded = 0;
     that.wrkNo = null;
@@ -23,58 +26,46 @@
 
         let item = getArrVal(conveyObjects.objects, "no", that.no+"");
         if (!that.position && item) {
+            that.objectType = item.objectType;
             that.position = item.position;
+        }
+        if (!item) {
+            that.isDel = true;
         }
     }
     init();
 
     that.modify = function (staData) {
-        if (that.run || that.no === 0) {
-            console.error(staData.no + "鍙疯緭閫佺嚎鏇存柊澶辫触");
+        if (that.no === 0) {
             return;
         }
 
-        if (that.loaded === 0 && staData.loaded === 1) {
-            // 鏃犺揣 ===>> 鏈夎揣
-
-            // 1.鍏ュ簱绗竴绔� 銆愭柊澧炪��
-            if (that.inlet === 1) {
-                InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
-                InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
-            // 2.鏉ヨ嚜鍏朵粬绔欑偣鐨勮揣鐗� 銆愮Щ鍔ㄣ��
-            } else {
-
-            }
-
-        }
-        if (that.loaded === 1 && staData.loaded === 0) {
-            // 鏈夎揣 ===>> 鏃犺揣
-
-            // 1.鍑哄簱鏈�鍚庝竴绔� 銆愮Щ闄ゃ��
-            if (that.outlet === 1) {
-                let pallet = getArrVal(that.object.objects, "name", that.wrkNo + "-Pallet");
-                if (pallet != null) {
+        // 娣诲姞
+        if (staData.loaded === 1 && staData.wrkNo && staData.wrkNo !== '0' && that.wrkNo !== staData.wrkNo) {
+            if (that.outlet !== 1) {     // 鐢卞爢鍨涙満鍑哄簱锛屼笉闇�瑕佹坊鍔爉odel
+                if (that.loaded === 1) {
+                    console.log("sta_" + that.no + " remove锛�" + that.wrkNo + "-Pallet锛� " + that.wrkNo + "-Goods");
                     that.object.removeObject(that.wrkNo + "-Pallet");
+                    that.object.removeObject(that.wrkNo + "-Goods");
                 }
-                let goods = getArrVal(that.object.objects, "name", that.wrkNo + "-Goods");
-                if (goods != null) {
+
+                InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position, objectType: that.objectType}, 2);
+                InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position, objectType: that.objectType}, 2);
+            }
+        }
+
+        // 绉婚櫎
+        if (staData.loaded === 0) {
+            if (that.loaded === 1 && that.wrkNo && that.wrkNo !== '0') {
+                if (that.inlet !== 1) {     // 鍫嗗灈鏈洪渶瑕佹惉杩愶紝涓嶈兘鐩存帴绉婚櫎
+                    that.object.removeObject(that.wrkNo + "-Pallet");
                     that.object.removeObject(that.wrkNo + "-Goods");
                 }
             }
-
         }
 
-        // 瀹炴椂鏇存柊
         that.loaded = staData.loaded;
         that.wrkNo = staData.wrkNo;
-        // that.run = true;
-
-    }
-
-    that.change = function () {
-
-
-
     }
 
 }
diff --git a/static/js/object/StaTask0.js b/static/js/object/StaTask0.js
new file mode 100644
index 0000000..a41c262
--- /dev/null
+++ b/static/js/object/StaTask0.js
@@ -0,0 +1,99 @@
+import {InitPallet, InitGoods} from './StoreGoods.js';
+
+// 杈撻�佺嚎褰撳墠杩愯鐘舵�佸璞�
+function StaTask(staData, object) {
+    let that = this;
+
+    that.object = object;
+
+    that.no = 0;
+    that.readyIn = false;
+    that.run = false;
+    that.loaded = 0;
+    that.wrkNo = null;
+
+    that.inlet = -1;
+    that.outlet = -1;
+
+    that.position = null;
+
+    let init = function () {
+        that.no = staData.no;
+        that.inlet = staData.inlet;
+        that.outlet = staData.outlet;
+
+        let item = getArrVal(conveyObjects.objects, "no", that.no+"");
+        if (!that.position && item) {
+            that.position = item.position;
+        }
+    }
+    init();
+
+    that.modify = function (staData) {
+        if (that.run || that.no === 0) {
+            console.error(staData.no + "鍙疯緭閫佺嚎鏇存柊澶辫触");
+            return;
+        }
+
+        // 椤甸潰鍒囨崲瀵艰嚧璐х墿瑕嗙洊
+        if (that.loaded === 1 && staData.loaded === 1 && staData.wrkNo > 0 && that.wrkNo > 0 && that.wrkNo !== staData.wrkNo) {
+            if (that.inlet === 1) {
+                // remove
+                console.log("sta_" + that.no + " remove锛�" + that.wrkNo + "-Pallet锛� " + that.wrkNo + "-Goods");
+                that.object.removeObject(that.wrkNo + "-Pallet");
+                that.object.removeObject(that.wrkNo + "-Goods");
+                // add
+                console.log("sta_" + that.no + " add锛�" + staData.wrkNo + "-Pallet + Goods锛� [up]");
+                InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
+                InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
+            }
+
+            that.readyIn = false;
+        }
+
+        if (that.loaded === 0 && staData.loaded === 1) {
+            that.readyIn = true;
+        }
+        if (that.readyIn && staData.wrkNo && staData.wrkNo !== '0') {
+            // 鏃犺揣 ===>> 鏈夎揣
+
+            // 1.鍏ュ簱绗竴绔� 銆愭柊澧炪��
+            if (that.inlet === 1) {
+                console.log("sta_" + that.no + " add锛�" + staData.wrkNo + "-Pallet + Goods锛� [down]");
+                InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
+                InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2);
+
+            // 2.鏉ヨ嚜鍏朵粬绔欑偣鐨勮揣鐗� 銆愮Щ鍔ㄣ��
+            } else {
+
+            }
+            that.readyIn = false;
+        }
+
+        if (that.loaded === 1 && staData.loaded === 0) {
+            // 鏈夎揣 ===>> 鏃犺揣
+
+            // 1.鍑哄簱鏈�鍚庝竴绔� 銆愮Щ闄ゃ��
+            if (that.outlet === 1) {
+                let pallet = getArrVal(that.object.objects, "name", that.wrkNo + "-Pallet");
+                if (pallet != null) {
+                    that.object.removeObject(that.wrkNo + "-Pallet");
+                }
+                let goods = getArrVal(that.object.objects, "name", that.wrkNo + "-Goods");
+                if (goods != null) {
+                    that.object.removeObject(that.wrkNo + "-Goods");
+                }
+            }
+            that.readyIn = false;
+        }
+
+        // 瀹炴椂鏇存柊
+        that.loaded = staData.loaded;
+        that.wrkNo = staData.wrkNo;
+        // that.run = true;
+
+    }
+
+}
+
+export {StaTask}
diff --git a/static/js/object/StoreGoods.js b/static/js/object/StoreGoods.js
index 24b85a7..f8b85aa 100644
--- a/static/js/object/StoreGoods.js
+++ b/static/js/object/StoreGoods.js
@@ -1,14 +1,12 @@
-import {MTLLoader} from "../lib/MTLLoader.js";
-import {OBJLoader} from "../lib/OBJLoader.js";
 import * as THREE from '../three.module.js';
 import * as BufferGeometryUtils from '../utils/BufferGeometryUtils.js';
 
 const palletX = -2;
-const palletY = 23 - 20 - 3;
+const palletY = 0;
 const palletZ = -25;
 
 const goodsX = -2;
-const goodsY = 40 - 18;
+const goodsY = 22;
 const goodsZ = -25;
 
 /**
@@ -63,27 +61,30 @@
                 positionZ = (item.bay1-1)*-ref.binHeight || 0;
 
                 clone.name = item.loc_no + "-" + "Pallet";
-                clone.traverse (function (child) {
-                    if (child instanceof THREE.Mesh) {
-                        child.name = item.loc_no + "-" + child.name;
-                    }
-                })
                 break;
             case 2:
-                positionX = ref.position.x || 0;
-                positionY = ref.position.y || 0;
-                positionZ = ref.position.z || 0;
+                switch (ref.objectType) {
+                    case 'chain':
+                        positionX = ref.position.x || 0;
+                        positionY = ref.position.y || 0;
+                        positionZ = ref.position.z || 0;
 
-                positionX -= 48 - 1;
-                positionY += 20;
-                positionZ -= 138 + 20;
+                        positionX -= 48 - 1;
+                        positionY += 20;
+                        positionZ -= 138 + 20;
+                        break
+                    case 'roller':
+                        positionX = ref.position.x || 0;
+                        positionY = ref.position.y || 0;
+                        positionZ = ref.position.z || 0;
+
+                        positionY += 20;
+                        break
+                    default:
+                        break
+                }
 
                 clone.name = item.wrkNo + "-" + "Pallet";
-                clone.traverse (function (child) {
-                    if (child instanceof THREE.Mesh) {
-                        child.name = item.wrkNo + "-" + child.name;
-                    }
-                })
                 break;
             default:
                 console.error("InitPallet param[type] error ===>> " + type);
@@ -124,27 +125,30 @@
                 positionZ = (item.bay1-1)*-ref.binHeight || 0;
 
                 clone.name = item.loc_no + "-" + "Goods";
-                clone.traverse (function (child) {
-                    if (child instanceof THREE.Mesh) {
-                        child.name = item.loc_no + "-" + child.name;
-                    }
-                })
                 break;
             case 2:
-                positionX = ref.position.x || 0;
-                positionY = ref.position.y || 0;
-                positionZ = ref.position.z || 0;
+                switch (ref.objectType) {
+                    case 'chain':
+                        positionX = ref.position.x || 0;
+                        positionY = ref.position.y || 0;
+                        positionZ = ref.position.z || 0;
 
-                positionX -= 48 - 1;
-                positionY += 20;
-                positionZ -= 138 + 20;
+                        positionX -= 48 - 1;
+                        positionY += 20;
+                        positionZ -= 138 + 20;
+                        break
+                    case 'roller':
+                        positionX = ref.position.x || 0;
+                        positionY = ref.position.y || 0;
+                        positionZ = ref.position.z || 0;
+
+                        positionY += 20;
+                        break
+                    default:
+                        break
+                }
 
                 clone.name = item.wrkNo + "-" + "Goods";
-                clone.traverse (function (child) {
-                    if (child instanceof THREE.Mesh) {
-                        child.name = item.wrkNo + "-" + child.name;
-                    }
-                })
                 break;
             default:
                 console.error("InitGoods param[type] error ===>> " + type);
diff --git a/static/js/object/StoreGoods_Copy.js b/static/js/object/StoreGoods_Copy.js
new file mode 100644
index 0000000..b83ff8d
--- /dev/null
+++ b/static/js/object/StoreGoods_Copy.js
@@ -0,0 +1,182 @@
+import {MTLLoader} from "../lib/MTLLoader.js";
+import {OBJLoader} from "../lib/OBJLoader.js";
+import * as THREE from '../three.module.js';
+
+const palletX = -18;
+const palletY = 2;
+const palletZ = -46;
+
+const goodsX = -17;
+const goodsY = 5;
+const goodsZ = -6;
+
+/**
+ * 鍒濆鍖栨墭鐩樻ā鍨�
+ * @param scene 鍦烘櫙
+ * @param palletList 鎵樼洏鏁版嵁鍒楄〃
+ * @param ref 鍙傜収鐗�
+ * @param type 鍙傜収鐗╃被鍨嬶細1 - 璐ф灦锛�    2 - 杈撻�佺嚎
+ */
+function InitPallet(scene, palletList, ref, type) {
+    const manager = new THREE.LoadingManager();
+    new OBJLoader( manager )
+        .setPath( '../static/model/obj/' )
+        .load( 'pallet.obj', function ( obj ) {
+            obj.traverse (function (child) {
+                child.castShadow = true;
+                if (child instanceof THREE.Mesh) {
+                    child.material = new THREE.MeshLambertMaterial({
+                        color: 0x708090
+                    });
+                }
+            });
+            obj.scale.set(4, 4, 3.5);
+
+            palletList.map(item => {
+                let clone = obj.clone();
+                let positionX;
+                let positionY;
+                let positionZ;
+                switch (type) {
+                    case 1:
+                        positionX = ref.positionX || 0;
+                        positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
+                        positionZ = (item.bay1-1)*-ref.binHeight || 0;
+
+                        clone.name = item.loc_no + "-" + "Pallet";
+                        clone.traverse (function (child) {
+                            if (child instanceof THREE.Mesh) {
+                                child.name = item.loc_no + "-" + child.name;
+                            }
+                        })
+                        break;
+                    case 2:
+                        positionX = ref.position.x || 0;
+                        positionY = ref.position.y || 0;
+                        positionZ = ref.position.z || 0;
+
+                        positionX -= 48 - 1;
+                        positionY += 20;
+                        positionZ -= 138 + 20;
+
+                        clone.name = item.wrkNo + "-" + "Pallet";
+                        clone.traverse (function (child) {
+                            if (child instanceof THREE.Mesh) {
+                                child.name = item.wrkNo + "-" + child.name;
+                            }
+                        })
+                        break;
+                    default:
+                        console.error("InitPallet param[type] error ===>> " + type);
+                }
+
+                clone.position.x = palletX + positionX;
+                clone.position.y = palletY + positionY;
+                clone.position.z = palletZ + positionZ;
+                scene.addObject(clone);
+            })
+        });
+}
+
+/**
+ * 鍒濆鍖栬揣鐗╂ā鍨�
+ * @param scene 鍦烘櫙
+ * @param goodsList 璐х墿鏁版嵁鍒楄〃
+ * @param ref 鍙傜収鐗�
+ * @param type 鍙傜収鐗╃被鍨嬶細1 - 璐ф灦锛�    2 - 杈撻�佺嚎
+ */
+function InitGoods(scene, goodsList, ref, type) {
+    const manager = new THREE.LoadingManager();
+    const goodsWrapImg = new THREE.TextureLoader( manager ).load( '../static/img/goodsWrap.jpg' );
+    const goodsImg = new THREE.TextureLoader( manager ).load( '../static/img/goods.jpg' );
+    new OBJLoader( manager ).load( '../static/model/obj/goods.obj', function ( obj ) {
+        obj.traverse (function (child) {
+            child.castShadow = true;
+            if (child instanceof THREE.Mesh) {
+                if (child.name === 'goods') {
+                    child.material.map = goodsImg;
+                } else if (child.name === "goods_wrap") {
+                    child.material.map = goodsWrapImg;
+                }
+            }
+        });
+        obj.scale.set(1, 1.2, 1.2);
+
+        goodsList.map(item => {
+            let clone = obj.clone();
+            let positionX;
+            let positionY;
+            let positionZ;
+            switch (type) {
+                case 1:
+                    positionX = ref.positionX || 0;
+                    positionY = ref.bottomHight + (item.lev1-1)*ref.binHeight || 0;
+                    positionZ = (item.bay1-1)*-ref.binHeight || 0;
+
+                    clone.name = item.loc_no + "-" + "Goods";
+                    clone.traverse (function (child) {
+                        if (child instanceof THREE.Mesh) {
+                            child.name = item.loc_no + "-" + child.name;
+                        }
+                    })
+                    break;
+                case 2:
+                    positionX = ref.position.x || 0;
+                    positionY = ref.position.y || 0;
+                    positionZ = ref.position.z || 0;
+
+                    positionX -= 48 - 1;
+                    positionY += 20;
+                    positionZ -= 138 + 20;
+
+                    clone.name = item.wrkNo + "-" + "Goods";
+                    clone.traverse (function (child) {
+                        if (child instanceof THREE.Mesh) {
+                            child.name = item.wrkNo + "-" + child.name;
+                        }
+                    })
+                    break;
+                default:
+                    console.error("InitGoods param[type] error ===>> " + type);
+            }
+
+            clone.position.x = goodsX + positionX;
+            clone.position.y = goodsY + positionY;
+            clone.position.z = goodsZ + positionZ;
+            scene.addObject(clone);
+        })
+    });
+}
+
+function StoreGoods(object, data, shelf) {
+    let that = this;
+
+    that.data = data;
+    that.object = object;
+    that.shelf = shelf;
+
+    let palletList = [];
+    let goodsList = [];
+
+    let init = function () {
+        for (let i=0;i<that.data.length;i++) {
+            let obj = that.data[i];
+            if (obj.loc_sts === 'D') {
+                palletList.push(obj);
+            } else if (obj.loc_sts === 'F') {
+                palletList.push(obj);
+                goodsList.push(obj);
+            }
+        }
+        if (palletList.length > 0) {
+            InitPallet(that.object, palletList, that.shelf, 1);
+        }
+        if (goodsList.length > 0) {
+            InitGoods(that.object, goodsList, that.shelf, 1);
+        }
+    }
+    init();
+
+}
+
+// export {StoreGoods, InitPallet, InitGoods}
diff --git a/static/js/object/StoreShelf.js b/static/js/object/StoreShelf.js
index b1761e0..cf49404 100644
--- a/static/js/object/StoreShelf.js
+++ b/static/js/object/StoreShelf.js
@@ -21,19 +21,14 @@
         transparent: false,
         opacity: 0.7
     });
-    //瀹氫箟涓�涓粍鍚堜綋
-    // let group = new THREE.Group();
 
     // 璐ф灦鎬婚珮
     let shelfHeight=this.bottomHight+(this.binYNum)*this.binHeight;
-    // 璐ф灦鎬诲
-    let shelfWidth=this.binZNum*this.binWidth;
     // 鏀灦妯″瀷 + 鏉愯川
     let rackBoxGeometry=new THREE.BoxGeometry(this.rackLengh,shelfHeight,this.rackWidth);
-    let rackObject=new THREE.Mesh(rackBoxGeometry, shelfMat, 0);
     // 鎵樻澘妯″瀷 + 鏉愯川
     let planeBoxGeometry = new THREE.BoxGeometry(this.binLength, 2, this.binWidth+this.rackWidth);  // 瑕嗙洊澶氫竴鏍规敮鏋跺搴�
-    let planeObject=new THREE.Mesh(planeBoxGeometry, shelfMat, 0);
+    let planeRackBoxGeometry = new THREE.BoxGeometry(3, 2, this.binWidth+this.rackWidth);
 
     // Y杞村畾浣�
     let positionY = this.positionY + shelfHeight / 2;
@@ -47,17 +42,6 @@
     let transform = new THREE.Object3D();
     // 鍒濆鍖栨敮鏋舵ā鍨�
     for(let i=0;i<=this.binZNum;i++) {
-        // let leftRack = rackObject.clone();
-        // let positionZ = - ( this.positionZ + i*this.binWidth );
-        // leftRack.position.set(leftPositionX,positionY,positionZ);
-        // leftRack.updateMatrix();
-        // group.add(leftRack);
-        //
-        // let rightRack = rackObject.clone();
-        // rightRack.position.set(rightPositionX,positionY,positionZ);
-        // rightRack.updateMatrix();
-        // group.add(rightRack);
-
         let positionZ = - ( this.positionZ + i*this.binWidth );
         // -----
         let leftClone = rackBoxGeometry.clone();
@@ -75,20 +59,31 @@
     // 鍒濆鍖栨墭鏉挎ā鍨�
     for(let i = 0;i < this.binZNum;i++) {
         for (let j = 0;j <= this.binYNum;j++) {
-            // let plane = planeObject.clone();
-            // let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1;
-            // let positionZ= - ( this.positionZ + i * this.binWidth + this.binWidth/2 );
-            // plane.position.set(this.positionX-this.rackLengh/2,positionY,positionZ);
-            // plane.updateMatrix();
-            // group.add(plane);
+            if (j !== this.binYNum) {
+                let leftClone = planeRackBoxGeometry.clone();
+                let positionY = this.positionY + this.bottomHight + j*this.binHeight + 1;
+                let positionZ = - ( this.positionZ + i * this.binWidth + this.binWidth/2 );
+                transform.position.set(this.positionX - 16, positionY, positionZ);
+                transform.updateMatrix();
+                leftClone.applyMatrix4(transform.matrix);
+                geometries.push(leftClone);
 
-            let clone = planeBoxGeometry.clone();
-            let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1;
-            let positionZ= - ( this.positionZ + i * this.binWidth + this.binWidth/2 );
-            transform.position.set(this.positionX-this.rackLengh/2,positionY,positionZ);
-            transform.updateMatrix();
-            clone.applyMatrix4(transform.matrix);
-            geometries.push(clone);
+                let rightClone = planeRackBoxGeometry.clone();
+                positionY = this.positionY + this.bottomHight + j*this.binHeight + 1;
+                positionZ = - ( this.positionZ + i * this.binWidth + this.binWidth/2 );
+                transform.position.set(this.positionX + 13, positionY, positionZ);
+                transform.updateMatrix();
+                rightClone.applyMatrix4(transform.matrix);
+                geometries.push(rightClone);
+            } else {
+                let clone = planeBoxGeometry.clone();
+                let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1;
+                let positionZ= - ( this.positionZ + i * this.binWidth + this.binWidth/2 );
+                transform.position.set(this.positionX-this.rackLengh/2,positionY,positionZ);
+                transform.updateMatrix();
+                clone.applyMatrix4(transform.matrix);
+                geometries.push(clone);
+            }
         }
     }
 

--
Gitblit v1.9.1