From b4c8d1d1778e548c568b6d3a527ecc6b2cd19b60 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期二, 02 十二月 2025 08:57:54 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/watch/console2.html |   79 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 68 insertions(+), 11 deletions(-)

diff --git a/src/main/webapp/views/watch/console2.html b/src/main/webapp/views/watch/console2.html
index deea72b..7cf707c 100644
--- a/src/main/webapp/views/watch/console2.html
+++ b/src/main/webapp/views/watch/console2.html
@@ -105,6 +105,7 @@
     let pixiShuttleMoveAdvancePathMap = new Map();
     let pixiShuttleMoveAdvancePathList = [];
     let pixiStaMap = new Map();
+    let pixiCrnMap = new Map();
     let objectsContainer;
     let objectsContainer2;
     let graphicsShelf;
@@ -252,7 +253,7 @@
           // 浠嶨raphics瀵硅薄鍒涘缓涓�涓汗鐞�
           graphicsShelf = pixiApp.renderer.generateTexture(getContainer('shelf'));
           graphicsDevp = pixiApp.renderer.generateTexture(getContainer('devp'));
-          graphicsCrn = pixiApp.renderer.generateTexture(getContainer('crn'));
+          graphicsCrn = createCrnTexture();
           graphicsCrnTrack = createTrackTexture();
 
           // 鍒涘缓涓�涓鍣ㄦ潵绠$悊澶ф壒閲忕殑鏄剧ず瀵硅薄
@@ -874,6 +875,42 @@
       return rt;
     }
 
+    function createCrnTexture() {
+      const g = new PIXI.Graphics();
+      const yTop = Math.round(height * 0.1);
+      g.beginFill(0x999999);
+      g.drawRect(2, yTop, 3, height - yTop - 2);
+      g.drawRect(width - 5, yTop, 3, height - yTop - 2);
+      g.endFill();
+      g.beginFill(0x999999);
+      g.drawRect(0, yTop, width, 3);
+      g.endFill();
+      const cabW = Math.round(width * 0.42);
+      const cabH = Math.round(height * 0.38);
+      const cabX = Math.round((width - cabW) / 2);
+      const cabY = Math.round(height * 0.52 - cabH / 2);
+      g.beginFill(0x3a78c2);
+      g.drawRect(cabX, cabY, cabW, cabH);
+      g.endFill();
+      const winW = Math.round(cabW * 0.6);
+      const winH = Math.round(cabH * 0.45);
+      const winX = cabX + Math.round((cabW - winW) / 2);
+      const winY = cabY + Math.round((cabH - winH) / 2);
+      g.beginFill(0xd0e8ff);
+      g.drawRect(winX, winY, winW, winH);
+      g.endFill();
+      const forkW = Math.round(width * 0.5);
+      const forkH = Math.max(2, Math.round(height * 0.08));
+      const forkX = Math.round((width - forkW) / 2);
+      const forkY = cabY + cabH;
+      g.beginFill(0x666666);
+      g.drawRect(forkX, forkY, forkW, forkH);
+      g.endFill();
+      const rt = PIXI.RenderTexture.create({ width: width, height: height });
+      pixiApp.renderer.render(g, rt);
+      return rt;
+    }
+
     function getContainerWithSize(value, w, h) {
       let graphics = new PIXI.Graphics();
       if (value === 0) {
@@ -925,9 +962,17 @@
           sprite = new PIXI.Sprite(graphicsCrnTrack);
         } else {
           sprite = new PIXI.Sprite(graphicsCrn);
+          const deviceNo = getDeviceNo(value);
+          const taskNo = getTaskNo(value);
+          const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 10, fill: '#000000' });
+          const txt = taskNo > 0 ? (deviceNo + "(" + taskNo + ")") : String(deviceNo);
+          const text = new PIXI.Text(txt, style);
+          text.anchor.set(0.5);
+          text.position.set(sprite.width / 2, sprite.height / 2);
+          sprite.addChild(text);
+          sprite.textObj = text;
+          pixiCrnMap.set(parseInt(deviceNo), sprite);
         }
-      } else if (item.type == 'crnTrack') {
-        sprite = new PIXI.Sprite(graphicsCrnTrack);
       } else {
         return null;
       }
@@ -985,17 +1030,29 @@
       }
     }
 
-    function getDeviceNo(obj) {
-      if (this.isJson(obj)) {
-        let data = JSON.parse(obj)
-        if (data.deviceNo == null || data.deviceNo == undefined) {
-          return -1;
-        }
-        return data.deviceNo;
-      } else {
+  function getDeviceNo(obj) {
+    if (this.isJson(obj)) {
+      let data = JSON.parse(obj)
+      if (data.deviceNo == null || data.deviceNo == undefined) {
         return -1;
       }
+      return data.deviceNo;
+    } else {
+      return -1;
     }
+  }
+
+  function getTaskNo(obj) {
+    if (this.isJson(obj)) {
+      let data = JSON.parse(obj)
+      if (data.taskNo == null || data.taskNo == undefined) {
+        return -1;
+      }
+      return data.taskNo;
+    } else {
+      return -1;
+    }
+  }
 
     function getStationId(obj) {
       if (this.isJson(obj)) {

--
Gitblit v1.9.1