82c36e2b434fa7a1c16b0448aa4cf1483107f79c..e1e1a2d934f6bd630abb67784ba18d38f6bea28e
4 天以前 Junjie
#
e1e1a2 对比 | 目录
4 天以前 Junjie
#
f89d2b 对比 | 目录
4 天以前 Junjie
#
736a25 对比 | 目录
4 天以前 Junjie
#
d594d7 对比 | 目录
4 天以前 Junjie
#
7451d4 对比 | 目录
4 天以前 Junjie
#
3c1f80 对比 | 目录
4 天以前 Junjie
#
46cf66 对比 | 目录
4 天以前 Junjie
#
fa9720 对比 | 目录
2个文件已添加
5个文件已修改
1 文件已重命名
1847 ■■■■■ 已修改文件
src/main/webapp/components/DevpCard.js 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/components/MapCanvas.js 995 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/components/WatchCrnCard.js 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/components/WatchRgvCard.js 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/locMap/locMap.html 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/watch/console.html 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/watch/console_html.html 554 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/watch/console_pixijs.html 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/components/DevpCard.js
@@ -17,8 +17,9 @@
                <div style="margin-bottom: 10px;"><el-button @click="controlCommand()" size="mini">下发</el-button></div>
            </div>
        </div>
        <el-collapse v-model="activeNames">
          <el-collapse-item v-for="(item) in stationList" :name="item.stationId">
        <div style="max-height: 55vh; overflow:auto;">
          <el-collapse v-model="activeNames" accordion>
            <el-collapse-item v-for="(item) in displayStationList" :name="item.stationId">
            <template slot="title">
                <div style="width: 100%;display: flex;">
                   <div style="width: 50%;">{{ item.stationId }}站</div>
@@ -42,8 +43,21 @@
                <el-descriptions-item label="条码">{{ item.barcode }}</el-descriptions-item>
                <el-descriptions-item label="故障代码">{{ item.error }}</el-descriptions-item>
            </el-descriptions>
          </el-collapse-item>
        </el-collapse>
            </el-collapse-item>
          </el-collapse>
        </div>
        <div style="display:flex; justify-content:flex-end; margin-top:8px;">
          <el-pagination
            small
            @current-change="handlePageChange"
            @size-change="handleSizeChange"
            :current-page="currentPage"
            :page-size="pageSize"
            :page-sizes="[10,20,50,100]"
            layout="total, prev, pager, next"
            :total="stationList.length">
          </el-pagination>
        </div>
    </div>
    `,
  props: ["param"],
@@ -58,12 +72,21 @@
        taskNo: "",
        targetStationId: "",
      },
      pageSize: 25,
      currentPage: 1,
    };
  },
  created() {
    setInterval(() => {
      this.getDevpStateInfo();
    }, 1000);
  },
  computed: {
    displayStationList() {
      const start = (this.currentPage - 1) * this.pageSize;
      const end = start + this.pageSize;
      return this.stationList.slice(start, end);
    }
  },
  watch: {
    param: {
@@ -78,6 +101,13 @@
    },
  },
  methods: {
    handlePageChange(page) {
      this.currentPage = page;
    },
    handleSizeChange(size) {
      this.pageSize = size;
      this.currentPage = 1;
    },
    getDevpStateInfo() {
      let that = this;
      $.ajax({
@@ -101,6 +131,7 @@
                }
              });
              that.stationList = tmp;
              that.currentPage = 1;
            }
          }
        },
src/main/webapp/components/MapCanvas.js
New file
@@ -0,0 +1,995 @@
Vue.component('map-canvas', {
  template: `
    <div style="width: 100%; height: 100%; position: relative;">
      <div ref="pixiView"></div>
      <div style="position: absolute; top: 20px; right: 50px;">
        <div>FPS:{{mapFps}}</div>
      </div>
    </div>
  `,
  props: ['lev', 'crnParam', 'rgvParam', 'devpParam', 'highlightOnParamChange'],
  data() {
    return {
      map: [],
      currentLev: 1,
      mapFps: 0,
      pixiApp: null,
      pixiStageList: [],
      pixiStaMap: new Map(),
      pixiCrnMap: new Map(),
      pixiRgvMap: new Map(),
      pixiShelfMap: new Map(),
      pixiTrackMap: new Map(),
      pixiDevpTextureMap: new Map(),
      pixiCrnColorTextureMap: new Map(),
      pixiDevpTextureMap: new Map(),
      pixiCrnColorTextureMap: new Map(),
      pixiRgvColorTextureMap: new Map(),
      crnList: [],
      rgvList: [],
      objectsContainer: null,
      objectsContainer2: null,
      tracksContainer: null,
      shelvesContainer: null,
      graphicsCrn: null,
      graphicsCrnTrack: null,
      graphicsRgvTrack: null,
      graphicsRgv: null,
      timer: null,
      adjustLabelTimer: null,
      isSwitchingFloor: false
    }
  },
  mounted() {
    this.currentLev = this.lev || 1;
    this.createMap();
    this.getMap(this.currentLev);
    this.timer = setInterval(() => {
      this.getCrnInfo();
      this.getSiteInfo();
      this.getRgvInfo();
    }, 1000);
  },
  beforeDestroy() {
    if (this.timer) { clearInterval(this.timer); }
    if (this.pixiApp) { this.pixiApp.destroy(true, { children: true }); }
    window.removeEventListener('resize', this.resizeToContainer);
  },
  watch: {
    lev(newLev) {
      if (newLev != null) { this.changeFloor(newLev); }
    },
    crnParam: {
      deep: true,
      handler(v) {
        if (!this.highlightOnParamChange) { return; }
        if (v && v.crnNo && this.pixiCrnMap) {
          const id = parseInt(v.crnNo, 10);
          const sprite = this.pixiCrnMap.get(id);
          if (sprite && window.gsap) {
            window.gsap.killTweensOf(sprite);
            window.gsap.fromTo(sprite, { alpha: 1 }, { alpha: 0.2, yoyo: true, repeat: 6, duration: 0.15 });
          }
        }
      }
    },
    rgvParam: {
      deep: true,
      handler(v) {
        if (!this.highlightOnParamChange) { return; }
        if (v && v.rgvNo && this.pixiRgvMap) {
          const id = parseInt(v.rgvNo, 10);
          const sprite = this.pixiRgvMap.get(id);
          if (sprite && window.gsap) {
            window.gsap.killTweensOf(sprite);
            window.gsap.fromTo(sprite, { alpha: 1 }, { alpha: 0.2, yoyo: true, repeat: 6, duration: 0.15 });
          }
        }
      }
    },
    devpParam: {
      deep: true,
      handler(v) {
        if (!this.highlightOnParamChange) { return; }
        if (v && v.stationId && this.pixiStaMap) {
          const id = parseInt(v.stationId, 10);
          const sprite = this.pixiStaMap.get(id);
          if (sprite && window.gsap) {
            window.gsap.killTweensOf(sprite);
            window.gsap.fromTo(sprite, { alpha: 1 }, { alpha: 0.2, yoyo: true, repeat: 6, duration: 0.15 });
          }
        }
      }
    }
  },
  methods: {
    createMap() {
      this.pixiApp = new PIXI.Application({ backgroundColor: 0xF5F7F9, antialias: false, powerPreference: 'high-performance', autoDensity: true, resolution: Math.min(window.devicePixelRatio || 1, 2) });
      PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.LINEAR;
      this.$refs.pixiView.appendChild(this.pixiApp.view);
      this.pixiApp.view.style.width = '100%';
      this.pixiApp.view.style.height = '100%';
      this.pixiApp.view.style.display = 'block';
      this.resizeToContainer();
      window.addEventListener('resize', this.resizeToContainer);
      this.graphicsCrnTrack = this.createTrackTexture(25,25);
      this.graphicsRgvTrack = this.createTrackTexture(25,25);
      this.objectsContainer = new PIXI.Container();
      this.objectsContainer2 = new PIXI.Container();
      this.tracksContainer = new PIXI.ParticleContainer(10000, { scale: true, position: true, rotation: false, uvs: false, alpha: false });
      this.shelvesContainer = new PIXI.ParticleContainer(10000, { scale: true, position: true, rotation: false, uvs: false, alpha: false });
      this.tracksContainer.autoResize = true;
      this.shelvesContainer.autoResize = true;
      this.pixiApp.stage.addChild(this.tracksContainer);
      this.pixiApp.stage.addChild(this.shelvesContainer);
      this.pixiApp.stage.addChild(this.objectsContainer);
      this.pixiApp.stage.addChild(this.objectsContainer2);
      this.pixiApp.renderer.roundPixels = true;
      //*******************拖动画布*******************
      let stageOriginalPos;
      let mouseDownPoint;
      let touchBlank = false;
      this.pixiApp.renderer.plugins.interaction.on('pointerdown', (event) => {
        const globalPos = event.data.global;
        stageOriginalPos = [this.pixiApp.stage.position.x, this.pixiApp.stage.position.y];
        mouseDownPoint = [globalPos.x, globalPos.y];
        if (!event.target) { touchBlank = true; }
      });
      this.pixiApp.renderer.plugins.interaction.on('pointermove', (event) => {
        const globalPos = event.data.global;
        if (touchBlank) {
          const dx = globalPos.x - mouseDownPoint[0];
          const dy = globalPos.y - mouseDownPoint[1];
          this.pixiApp.stage.position.set(stageOriginalPos[0] + dx, stageOriginalPos[1] + dy);
        }
      });
      this.pixiApp.renderer.plugins.interaction.on('pointerup', () => { touchBlank = false; });
      //*******************拖动画布*******************
      //*******************缩放画布*******************
      this.pixiApp.view.addEventListener('wheel', (event) => {
        event.stopPropagation();
        event.preventDefault();
        const rect = this.pixiApp.view.getBoundingClientRect();
        const sx = event.clientX - rect.left;
        const sy = event.clientY - rect.top;
        const oldZoom = this.pixiApp.stage.scale.x;
        const delta = event.deltaY;
        let newZoom = oldZoom * 0.999 ** delta;
        const worldX = (sx - this.pixiApp.stage.position.x) / oldZoom;
        const worldY = (sy - this.pixiApp.stage.position.y) / oldZoom;
        const newPosX = sx - worldX * newZoom;
        const newPosY = sy - worldY * newZoom;
        this.pixiApp.stage.setTransform(newPosX, newPosY, newZoom, newZoom, 0, 0, 0, 0, 0);
          this.scheduleAdjustLabels();
      });
      //*******************缩放画布*******************
      //*******************FPS*******************
      let g_Time = 0;
      this.pixiApp.ticker.add((delta) => {
        const timeNow = (new Date()).getTime();
        const timeDiff = timeNow - g_Time;
        g_Time = timeNow;
        const fps = 1000 / timeDiff;
        this.mapFps = parseInt(fps);
      });
      //*******************FPS*******************
    },
    resizeToContainer() {
      const w = this.$el.clientWidth || 0;
      const h = this.$el.clientHeight || 0;
      if (w > 0 && h > 0 && this.pixiApp) {
        this.pixiApp.renderer.resize(w, h);
      }
    },
    getMap() {
      $.ajax({
        url: baseUrl + "/basMap/lev/" + this.currentLev + "/auth",
        headers: { 'token': localStorage.getItem('token') },
        method: 'get',
        success: (res) => {
          const data = res.data;
          const mapData = JSON.parse(data);
          this.createMapData(mapData);
        }
      })
    },
    changeFloor(lev) {
      this.currentLev = lev;
      this.isSwitchingFloor = true;
      if (this.adjustLabelTimer) { clearTimeout(this.adjustLabelTimer); this.adjustLabelTimer = null; }
      this.objectsContainer.removeChildren();
      this.objectsContainer2.removeChildren();
      if (this.tracksContainer) { this.tracksContainer.removeChildren(); }
      if (this.shelvesContainer) { this.shelvesContainer.removeChildren(); }
      this.crnList = [];
      this.rgvList = [];
      this.pixiCrnMap = new Map();
      this.pixiRgvMap = new Map();
      this.pixiStaMap = new Map();
      this.pixiStageList = [];
      this.getMap();
    },
    createMapData(map) {
      this.pixiStageList = [map.length];
      this.pixiStaMap = new Map();
      this.objectsContainer.removeChildren();
      const bayHeightList = this.initHeight(map);
      const bayWidthList = this.initWidth(map);
      map.forEach((item, index) => {
        for (let idx = 0; idx < item.length; idx++) {
          let val = item[idx];
          if (val.cellHeight == undefined || val.cellHeight === '') { val.cellHeight = bayHeightList[index]; }
          if (val.cellWidth == undefined || val.cellWidth === '') { val.cellWidth = bayWidthList[idx]; }
        }
      });
      map.forEach((item, index) => {
        for (let idx = 0; idx < item.length; idx++) {
          let val = item[idx];
          let cellWidth = val.cellWidth / 40;
          let cellHeight = val.cellHeight / 8;
          val.width = cellWidth;
          val.height = cellHeight;
          let mergeHeight = cellHeight;
          if (val.rowSpan > 1) {
            for (let i = 1; i < val.rowSpan; i++) {
              let nextMerge = map[index + i][idx];
              if (nextMerge.type != 'merge') { continue; }
              let mergeCellHeight = nextMerge.cellHeight / 8;
              mergeHeight += mergeCellHeight;
            }
            val.height = mergeHeight;
          }
          let mergeWidth = cellWidth;
          if (val.colSpan > 1) {
            for (let i = 1; i < val.colSpan; i++) {
              let nextMerge = map[index][idx + i];
              if (!nextMerge) { continue; }
              let mergeCellWidth = nextMerge.cellWidth / 40;
              mergeWidth += mergeCellWidth;
              nextMerge.isMergedPart = true;
            }
            val.width = mergeWidth;
          }
        }
      });
      const rowHeightScaled = [];
      for (let r = 0; r < map.length; r++) {
        const h = bayHeightList[r];
        if (h != null && h !== -1) {
          rowHeightScaled[r] = h / 8;
        } else {
          let fallback = 0;
          for (let c = 0; c < map[r].length; c++) {
            const v = map[r][c];
            if (v && v.type !== 'merge' && v.height != null && v.height > 0) { fallback = v.height; break; }
          }
          rowHeightScaled[r] = fallback > 0 ? fallback : 25;
        }
      }
      let yOffsets = [];
      let yCursor = 0;
      for (let r = 0; r < map.length; r++) {
        yOffsets[r] = yCursor;
        yCursor += (rowHeightScaled[r] || 0);
      }
      map.forEach((row, rowIndex) => {
        let xCursor = 0;
        let anchorX = 0;
        for (let colIndex = 0; colIndex < row.length; colIndex++) {
          let val = row[colIndex];
          let cellWidth = val.width;
          let cellHeight = val.height;
          if (val.isMergedPart) {
            val.posX = anchorX;
            val.posY = yOffsets[rowIndex];
            continue;
          }
          val.posX = xCursor;
          val.posY = yOffsets[rowIndex];
          anchorX = xCursor;
          if (val.colSpan > 1) {
            for (let i = 1; i < val.colSpan; i++) {
              const next = row[colIndex + i];
              if (!next) { break; }
              next.posX = anchorX;
              next.posY = yOffsets[rowIndex];
            }
          }
          xCursor += cellWidth;
        }
      });
      map.forEach((item, index) => {
        this.pixiStageList[index] = [item.length];
        for (let idx = 0; idx < item.length; idx++) {
          let val = item[idx];
          if (val.type === 'merge') { continue; }
          if (val.type == undefined || val.type === 'none') { continue; }
          let sprite = this.getSprite(val, (e) => {
            //回调
          });
          if (sprite == null) { continue; }
          if (sprite._kind === 'shelf') {
            this.shelvesContainer.addChild(sprite);
          } else if (sprite._kind === 'crn-track' || sprite._kind === 'rgv-track') {
            this.tracksContainer.addChild(sprite);
          } else {
            this.objectsContainer.addChild(sprite);
          }
          this.pixiStageList[index][idx] = sprite;
        }
      });
      this.crnList.forEach((item) => {
        if (this.graphicsCrn == null) { this.graphicsCrn = this.createCrnTexture(item.width * 0.9, item.height * 0.9); }
        let sprite = new PIXI.Sprite(this.graphicsCrn);
        const deviceNo = this.getDeviceNo(item.value);
        const taskNo = this.getTaskNo(item.value);
        const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 12, fill: '#000000', stroke: '#ffffff', strokeThickness: 1 });
        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;
        sprite.position.set(item.posX, item.posY);
        sprite.interactive = true; // 必须要设置才能接收事件
        sprite.buttonMode = true; // 让光标在hover时变为手型指针
        sprite.on('pointerdown', () => {
          if (window.gsap) { window.gsap.killTweensOf(sprite); }
          sprite.alpha = 1;
          const id = parseInt(deviceNo, 10);
          this.$emit('crn-click', id);
        });
        let rowIndexForCrn = 0;
        for (let r = 0; r < map.length; r++) {
          if (map[r].length > 0) {
            const rowY = map[r][0].posY;
            if (Math.abs(rowY - item.posY) < 0.5) { rowIndexForCrn = r; break; }
          }
        }
        sprite.rowIndex = rowIndexForCrn;
        this.pixiCrnMap.set(parseInt(deviceNo), sprite);
        this.objectsContainer2.addChild(sprite);
      });
      this.rgvList.forEach((item) => {
        if (this.graphicsRgv == null) { this.graphicsRgv = this.createRgvTexture(item.width * 0.9, item.height * 0.9); }
        let sprite = new PIXI.Sprite(this.graphicsRgv);
        const deviceNo = this.getDeviceNo(item.value);
        const taskNo = this.getTaskNo(item.value);
        const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 12, fill: '#000000', stroke: '#ffffff', strokeThickness: 1 });
        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;
        sprite.position.set(item.posX, item.posY);
        sprite.interactive = true; // 必须要设置才能接收事件
        sprite.buttonMode = true; // 让光标在hover时变为手型指针
        sprite.on('pointerdown', () => {
          if (window.gsap) { window.gsap.killTweensOf(sprite); }
          sprite.alpha = 1;
          const id = parseInt(deviceNo, 10);
          this.$emit('rgv-click', id);
        });
        let rowIndexForRgv = 0;
        for (let r = 0; r < map.length; r++) {
          if (map[r].length > 0) {
            const rowY = map[r][0].posY;
            if (Math.abs(rowY - item.posY) < 0.5) { rowIndexForRgv = r; break; }
          }
        }
        sprite.rowIndex = rowIndexForRgv;
        this.pixiRgvMap.set(parseInt(deviceNo), sprite);
        this.objectsContainer2.addChild(sprite);
      });
      let contentW = 0;
      let contentH = 0;
      for (let r = 0; r < map.length; r++) {
        for (let c = 0; c < map[r].length; c++) {
          const cell = map[r][c];
          if (!cell || cell.type === 'merge') { continue; }
          const right = cell.posX + cell.width;
          const bottom = cell.posY + cell.height;
          if (right > contentW) { contentW = right; }
          if (bottom > contentH) { contentH = bottom; }
        }
      }
      const vw = this.pixiApp.view.width;
      const vh = this.pixiApp.view.height;
      let scale = Math.min(vw / contentW, vh / contentH) * 0.95;
      if (!isFinite(scale) || scale <= 0) { scale = 1; }
      const posX = (vw - contentW * scale) / 2;
      const posY = (vh - contentH * scale) / 2;
      this.pixiApp.stage.setTransform(posX, posY, scale, scale, 0, 0, 0, 0, 0);
      this.adjustLabelScale();
      this.map = map;
      this.isSwitchingFloor = false;
    },
    initWidth(map) {
      let maxRow = map.length;
      let maxBay = map[0].length;
      let bayWidthList = [];
      for (let bay = 0; bay < maxBay; bay++) {
        let bayWidth = -1;
        for (let row = 0; row < maxRow; row++) {
          let val = map[row][bay];
          if (val.cellWidth == undefined || val.cellWidth === '') { continue; }
          bayWidth = Math.max(bayWidth, val.cellWidth);
          break;
        }
        bayWidthList.push(bayWidth);
      }
      return bayWidthList;
    },
    initHeight(map) {
      let maxRow = map.length;
      let maxBay = map[0].length;
      let bayHeightList = [];
      for (let row = 0; row < maxRow; row++) {
        let bayHeight = -1;
        for (let bay = 0; bay < maxBay; bay++) {
          let val = map[row][bay];
          if (val.cellHeight == undefined || val.cellHeight === '') { continue; }
          bayHeight = Math.max(bayHeight, val.cellHeight);
          break;
        }
        bayHeightList.push(bayHeight);
      }
      return bayHeightList;
    },
    setSiteInfo(res) {
      let sites = Array.isArray(res) ? res : (res && res.code === 200 ? res.data : null);
      if (res && !Array.isArray(res)) {
        if (res.code === 403) { parent.location.href = baseUrl + "/login"; return; }
        if (res.code !== 200) { return; }
      }
      if (!sites) { return; }
      sites.forEach((item) => {
        let id = item.siteId != null ? item.siteId : item.stationId;
        let status = item.siteStatus != null ? item.siteStatus : item.stationStatus;
        let workNo = item.workNo != null ? item.workNo : item.taskNo;
        if (id == null) { return; }
        let sta = this.pixiStaMap.get(parseInt(id));
        if (sta == undefined) { return; }
        if (workNo != null && workNo > 0) { sta.textObj.text = id + "(" + workNo + ")"; } else { sta.textObj.text = String(id); }
        if (sta.statusObj) {
          this.objectsContainer.removeChild(sta.statusObj);
          sta.statusObj = null;
          if (sta.textObj.parent !== sta) { sta.addChild(sta.textObj); sta.textObj.position.set(sta.width / 2, sta.height / 2); }
        }
        if (status === "site-auto") {
          this.updateColor(sta, 0x78ff81);
        } else if (status === "site-auto-run" || status === "site-auto-run-id") {
          this.updateColor(sta, 0xfa51f6);
        } else if (status === "site-unauto") {
          this.updateColor(sta, 0xb8b8b8);
        } else if (status === "machine-pakin") {
          this.updateColor(sta, 0x30bffc);
        } else if (status === "machine-pakout") {
          this.updateColor(sta, 0x97b400);
        } else {
          this.updateColor(sta, 0xb8b8b8);
        }
      });
    },
    getCrnInfo() {
      if (this.isSwitchingFloor) { return; }
      $.ajax({
        url: baseUrl + "/console/latest/data/crn",
        headers: { 'token': localStorage.getItem('token') },
        method: 'POST',
        success: (res) => {
          if (res.code === 200) {
            var crns = res.data;
            for (var i = 0; i < crns.length; i++) {
              const id = parseInt(crns[i].crnId);
              const sprite = this.pixiCrnMap.get(id);
              if (!sprite) { continue; }
              const taskNo = crns[i].taskNo;
              if (taskNo != null && taskNo > 0) { sprite.textObj.text = id + "(" + taskNo + ")"; } else { sprite.textObj.text = String(id); }
              const status = crns[i].crnStatus;
              const statusColor = this.getCrnStatusColor(status);
              this.updateCrnTextureColor(sprite, statusColor);
              let bay = parseInt(crns[i].bay, 10);
              if (isNaN(bay) || bay < 1 || bay === -2) { bay = 1; }
              let rowIndex = (sprite.rowIndex != null) ? sprite.rowIndex : -1;
              if (rowIndex === -1) {
                for (let r = 0; r < this.map.length; r++) {
                  if (this.map[r].length > 0) {
                    const rowY = this.map[r][0].posY;
                    if (Math.abs(rowY - sprite.y) < 0.5) { rowIndex = r; break; }
                  }
                }
                if (rowIndex === -1) { rowIndex = 0; }
              }
              let targetCell = null;
              let crnCount = 0;
              for (let c = 0; c < this.map[rowIndex].length; c++) {
                const cell = this.map[rowIndex][c];
                if (cell && cell.type === 'crn') { crnCount++; if (crnCount === bay) { targetCell = cell; break; } }
              }
              if (!targetCell) {
                for (let c = this.map[rowIndex].length - 1; c >= 0; c--) {
                  const cell = this.map[rowIndex][c];
                  if (cell && cell.type === 'crn') { targetCell = cell; break; }
                }
              }
              if (!targetCell) { continue; }
              const targetX = targetCell.posX + (targetCell.width - sprite.width) / 2;
              const dx = Math.abs(targetX - sprite.x);
              if (dx < 1) {
              } else if (dx < 5) {
                sprite.x = targetX;
              } else if (window.gsap) {
                window.gsap.killTweensOf(sprite);
                window.gsap.to(sprite, { x: targetX, duration: 0.3, ease: "power1.inOut" });
              } else {
                sprite.x = targetX;
              }
            }
          }
          this.scheduleAdjustLabels();
        }
      });
    },
    getSiteInfo() {
      if (this.isSwitchingFloor) { return; }
      $.ajax({
        url: baseUrl + "/console/latest/data/station",
        headers: { 'token': localStorage.getItem('token') },
        method: 'POST',
        success: (res) => { this.setSiteInfo(res); }
      });
    },
    getRgvInfo() {
      if (this.isSwitchingFloor) { return; }
      $.ajax({
        url: baseUrl + "/console/latest/data/rgv",
        headers: { 'token': localStorage.getItem('token') },
        method: 'POST',
        success: (res) => {
          if (res.code === 200) {
            const rgvs = res.data;
            for (let i = 0; i < rgvs.length; i++) {
              const id = parseInt(rgvs[i].rgvNo, 10);
              const sprite = this.pixiRgvMap.get(id);
              if (!sprite) { continue; }
              const taskNo = rgvs[i].taskNo;
              if (sprite.textObj) { if (taskNo != null && taskNo > 0) { sprite.textObj.text = id + "(" + taskNo + ")"; } else { sprite.textObj.text = String(id); } }
              const statusColor = this.getRgvStatusColor(rgvs[i].rgvStatus);
              this.updateRgvTextureColor(sprite, statusColor);
              let trackSiteNo = parseInt(rgvs[i].trackSiteNo, 10);
              if (!trackSiteNo || trackSiteNo <= 0) { continue; }
              let rowIndex = (sprite.rowIndex != null) ? sprite.rowIndex : 0;
              let targetCell = null;
              for (let c = 0; c < this.map[rowIndex].length; c++) {
                const cell = this.map[rowIndex][c];
                if (!cell || cell.type !== 'rgv') { continue; }
                const ts = this.getTrackSiteNo(cell.value);
                if (ts === trackSiteNo) { targetCell = cell; break; }
              }
              if (!targetCell) {
                for (let c = this.map[rowIndex].length - 1; c >= 0; c--) {
                  const cell = this.map[rowIndex][c];
                  if (cell && cell.type === 'rgv') { targetCell = cell; break; }
                }
              }
              if (!targetCell) { continue; }
              const targetX = targetCell.posX + (targetCell.width - sprite.width) / 2;
              const dx = Math.abs(targetX - sprite.x);
              if (dx < 1) {
              } else if (dx < 5) {
                sprite.x = targetX;
              } else if (window.gsap) {
                window.gsap.killTweensOf(sprite);
                window.gsap.to(sprite, { x: targetX, duration: 0.3, ease: "power1.inOut" });
              } else {
                sprite.x = targetX;
              }
            }
          }
          this.scheduleAdjustLabels();
        }
      });
    },
    createShelfSprite(width, height) {
      let idx = width + "-" + height;
      let texture = this.pixiShelfMap.get(idx);
      if (texture == undefined) {
        let graphics = this.getContainer('shelf', width, height);
        texture = this.pixiApp.renderer.generateTexture(graphics);
        this.pixiShelfMap.set(idx, texture);
      }
      return new PIXI.Sprite(texture);
    },
    createTrackSprite(width, height) {
      let idx = width + "-" + height;
      let texture = this.pixiTrackMap.get(idx);
      if (texture == undefined) {
        texture = this.createTrackTexture(width, height);
        this.pixiTrackMap.set(idx, texture);
      }
      return new PIXI.Sprite(texture);
    },
    getContainer(type, width, height) {
      let graphics = new PIXI.Graphics();
      let drawBorder = true;
      if (type == 'shelf') { graphics.beginFill(0xb6e2e2); }
      else if (type == 'devp') { graphics.beginFill(0x00ff7f); graphics.visible = true; }
      else if (type == 'crn') { graphics.beginFill(0xaaffff); }
      if (drawBorder) { graphics.lineStyle(1, 0xffffff, 1); graphics.drawRect(0, 0, width, height); }
      graphics.endFill();
      return graphics;
    },
    createTrackTexture(width, height) {
      const g = new PIXI.Graphics();
      const t = Math.max(2, Math.round(height * 0.08));
      const gap = Math.round(height * 0.30);
      const mid = Math.round(height / 2);
      const y1 = mid - Math.round(gap / 2);
      const y2 = mid + Math.round(gap / 2);
      const tHalf = Math.round(t / 2);
      const topRailTopY = y1 - tHalf;
      const bottomRailTopY = y2 - tHalf;
      g.beginFill(0x666666);
      g.drawRect(0, topRailTopY, width, t);
      g.drawRect(0, bottomRailTopY, width, t);
      g.endFill();
      g.beginFill(0x777777);
      const sTop = topRailTopY + t;
      const sBottom = bottomRailTopY;
      const sHeight = Math.max(1, sBottom - sTop);
      for (let i = 0; i < width; i += 5) { g.drawRect(i, sTop, 2, sHeight); }
      g.endFill();
      const rt = PIXI.RenderTexture.create({ width: width, height: height });
      this.pixiApp.renderer.render(g, rt);
      return rt;
    },
    createCrnTexture(width, height) {
      const g = new PIXI.Graphics();
      const yTop = Math.round(height * 0.1);
      let deviceWidth = width * 2;
      g.beginFill(0x999999);
      g.drawRect(2, yTop, 3, height - yTop - 2);
      g.drawRect(deviceWidth - 5, yTop, 3, height - yTop - 2);
      g.endFill();
      g.beginFill(0x999999);
      g.drawRect(0, yTop, deviceWidth, 3);
      g.endFill();
      const cabW = Math.round(deviceWidth * 0.68);
      const cabH = Math.round(height * 0.38);
      const cabX = Math.round((deviceWidth - cabW) / 2);
      const cabY = Math.round(height * 0.52 - cabH / 2);
      g.beginFill(0x245a9a);
      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(deviceWidth * 0.8);
      const forkH = Math.max(2, Math.round(height * 0.08));
      const forkX = Math.round((deviceWidth - forkW) / 2);
      const forkY = cabY + cabH;
      g.beginFill(0x666666);
      g.drawRect(forkX, forkY, forkW, forkH);
      g.endFill();
      const rt = PIXI.RenderTexture.create({ width: deviceWidth, height: height });
      this.pixiApp.renderer.render(g, rt);
      return rt;
    },
    createCrnTextureColoredDevice(deviceWidth, height, color) {
      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(deviceWidth - 5, yTop, 3, height - yTop - 2);
      g.endFill();
      g.beginFill(0x999999);
      g.drawRect(0, yTop, deviceWidth, 3);
      g.endFill();
      const cabW = Math.round(deviceWidth * 0.68);
      const cabH = Math.round(height * 0.38);
      const cabX = Math.round((deviceWidth - cabW) / 2);
      const cabY = Math.round(height * 0.52 - cabH / 2);
      g.beginFill(color);
      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(deviceWidth * 0.8);
      const forkH = Math.max(2, Math.round(height * 0.08));
      const forkX = Math.round((deviceWidth - forkW) / 2);
      const forkY = cabY + cabH;
      g.beginFill(0x666666);
      g.drawRect(forkX, forkY, forkW, forkH);
      g.endFill();
      const rt = PIXI.RenderTexture.create({ width: deviceWidth, height: height });
      this.pixiApp.renderer.render(g, rt);
      return rt;
    },
    createDevpTextureColoredRect(width, height, color) {
      const g = new PIXI.Graphics();
      g.beginFill(color);
      g.lineStyle(1, 0xffffff, 1);
      g.drawRect(0, 0, width, height);
      g.endFill();
      const rt = PIXI.RenderTexture.create({ width: width, height: height });
      this.pixiApp.renderer.render(g, rt);
      return rt;
    },
    createRgvTexture(width, height) {
      const g = new PIXI.Graphics();
      const bodyW = Math.round(width * 0.8);
      const bodyH = Math.round(height * 0.55);
      const bodyX = Math.round((width - bodyW) / 2);
      const bodyY = Math.round((height - bodyH) / 2);
      g.beginFill(0x245a9a);
      g.drawRect(bodyX, bodyY, bodyW, bodyH);
      g.endFill();
      const winW = Math.round(bodyW * 0.55);
      const winH = Math.round(bodyH * 0.45);
      const winX = bodyX + Math.round((bodyW - winW) / 2);
      const winY = bodyY + Math.round((bodyH - winH) / 2);
      g.beginFill(0xd0e8ff);
      g.drawRect(winX, winY, winW, winH);
      g.endFill();
      const wheelW = Math.max(2, Math.round(width * 0.12));
      const wheelH = Math.max(2, Math.round(height * 0.1));
      const wheelY = bodyY + bodyH;
      const wheelGap = Math.round((width - wheelW * 2) / 3);
      const wheelX1 = wheelGap;
      const wheelX2 = width - wheelGap - wheelW;
      g.beginFill(0x333333);
      g.drawRect(wheelX1, wheelY - Math.round(wheelH / 2), wheelW, wheelH);
      g.drawRect(wheelX2, wheelY - Math.round(wheelH / 2), wheelW, wheelH);
      g.endFill();
      const rt = PIXI.RenderTexture.create({ width: width, height: height });
      this.pixiApp.renderer.render(g, rt);
      return rt;
    },
    createRgvTextureColoredDevice(width, height, color) {
      const g = new PIXI.Graphics();
      const bodyW = Math.round(width * 0.8);
      const bodyH = Math.round(height * 0.55);
      const bodyX = Math.round((width - bodyW) / 2);
      const bodyY = Math.round((height - bodyH) / 2);
      g.beginFill(color);
      g.drawRect(bodyX, bodyY, bodyW, bodyH);
      g.endFill();
      const winW = Math.round(bodyW * 0.55);
      const winH = Math.round(bodyH * 0.45);
      const winX = bodyX + Math.round((bodyW - winW) / 2);
      const winY = bodyY + Math.round((bodyH - winH) / 2);
      g.beginFill(0xd0e8ff);
      g.drawRect(winX, winY, winW, winH);
      g.endFill();
      const wheelW = Math.max(2, Math.round(width * 0.12));
      const wheelH = Math.max(2, Math.round(height * 0.1));
      const wheelY = bodyY + bodyH;
      const wheelGap = Math.round((width - wheelW * 2) / 3);
      const wheelX1 = wheelGap;
      const wheelX2 = width - wheelGap - wheelW;
      g.beginFill(0x333333);
      g.drawRect(wheelX1, wheelY - Math.round(wheelH / 2), wheelW, wheelH);
      g.drawRect(wheelX2, wheelY - Math.round(wheelH / 2), wheelW, wheelH);
      g.endFill();
      const rt = PIXI.RenderTexture.create({ width: width, height: height });
      this.pixiApp.renderer.render(g, rt);
      return rt;
    },
    updateRgvTextureColor(sprite, color) {
      const key = Math.round(sprite.width) + '-' + Math.round(sprite.height) + '-' + color;
      let tex = this.pixiRgvColorTextureMap.get(key);
      if (!tex) {
        tex = this.createRgvTextureColoredDevice(Math.round(sprite.width), Math.round(sprite.height), color);
        this.pixiRgvColorTextureMap.set(key, tex);
      }
      sprite.texture = tex;
      if (sprite.textObj) {
        const fill = this.getContrastColor(color);
        sprite.textObj.style.fill = fill;
        sprite.textObj.style.stroke = (fill === '#000000' ? '#ffffff' : '#000000');
        sprite.textObj.style.strokeThickness = 1;
      }
    },
    updateCrnTextureColor(sprite, color) {
      const key = Math.round(sprite.width) + '-' + Math.round(sprite.height) + '-' + color;
      let tex = this.pixiCrnColorTextureMap.get(key);
      if (!tex) {
        tex = this.createCrnTextureColoredDevice(Math.round(sprite.width), Math.round(sprite.height), color);
        this.pixiCrnColorTextureMap.set(key, tex);
      }
      sprite.texture = tex;
      if (sprite.textObj) {
        const fill = this.getContrastColor(color);
        sprite.textObj.style.fill = fill;
        sprite.textObj.style.stroke = (fill === '#000000' ? '#ffffff' : '#000000');
        sprite.textObj.style.strokeThickness = 1;
      }
    },
    getContrastColor(color) {
      const r = (color >> 16) & 0xFF;
      const g = (color >> 8) & 0xFF;
      const b = color & 0xFF;
      const brightness = (r * 299 + g * 587 + b * 114) / 1000;
      return brightness > 150 ? '#000000' : '#ffffff';
    },
    getCrnStatusColor(status) {
      if (status === "machine-auto") { return 0x21BA45; }
      if (status === "machine-un-auto") { return 0xBBBBBB; }
      if (status === "machine-error") { return 0xDB2828; }
      if (status === "machine-pakin") { return 0x30bffc; }
      if (status === "machine-pakout") { return 0x97b400; }
      return 0xBBBBBB;
    },
    getRgvStatusColor(status) {
      if (status === "idle") { return 0x21BA45; }
      if (status === "working") { return 0xffd60b; }
      if (status === "waiting") { return 0xffd60b; }
      if (status === "fetching") { return 0xffd60b; }
      if (status === "putting") { return 0xffd60b; }
      return 0xb8b8b8;
    },
    getSprite(item, pointerDownEvent) {
      let sprite;
      let value = item.value;
      if (item.type == 'shelf') {
        sprite = this.createShelfSprite(item.width, item.height);
        sprite._kind = 'shelf';
      } else if (item.type == 'devp') {
        const key = Math.round(item.width) + '-' + Math.round(item.height) + '-' + 0x00ff7f;
        let texture = this.pixiDevpTextureMap.get(key);
        if (!texture) {
          texture = this.createDevpTextureColoredRect(Math.round(item.width), Math.round(item.height), 0x00ff7f);
          this.pixiDevpTextureMap.set(key, texture);
        }
        sprite = new PIXI.Sprite(texture);
        sprite._kind = 'devp';
        let siteId = this.getStationId(value);
        if (siteId === -1) { siteId = item.data; }
        const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 10, fill: '#000000', stroke: '#ffffff', strokeThickness: 1 });
        const text = new PIXI.Text(String(siteId), style);
        text.anchor.set(0.5);
        text.position.set(sprite.width / 2, sprite.height / 2);
        sprite.addChild(text);
        sprite.textObj = text;
        if (siteId != null && siteId !== -1) { this.pixiStaMap.set(parseInt(siteId), sprite); }
        sprite.interactive = true;
        sprite.buttonMode = true;
        sprite.on('pointerdown', () => {
          if (window.gsap) { window.gsap.killTweensOf(sprite); }
          sprite.alpha = 1;
          const id = parseInt(siteId, 10);
          if (!isNaN(id)) { this.$emit('station-click', id); }
        });
      } else if (item.type == 'crn') {
        sprite = this.createTrackSprite(item.width, item.height);
        sprite._kind = 'crn-track';
        if (this.getDeviceNo(value) > 0) { this.crnList.push(item); }
      } else if (item.type == 'rgv') {
        sprite = this.createTrackSprite(item.width, item.height);
        sprite._kind = 'rgv-track';
        if (this.getDeviceNo(value) > 0) { this.rgvList.push(item); }
      } else {
        return null;
      }
      sprite.position.set(item.posX, item.posY);
      return sprite;
    },
    updateColor(sprite, color) {
      if (sprite && sprite._kind === 'devp') {
        const key = sprite.width + '-' + sprite.height + '-' + color;
        let texture = this.pixiDevpTextureMap.get(key);
        if (!texture) {
          texture = this.createDevpTextureColoredRect(Math.round(sprite.width), Math.round(sprite.height), color);
          this.pixiDevpTextureMap.set(key, texture);
        }
        const textObj = sprite.textObj;
        sprite.texture = texture;
        if (textObj) {
          if (textObj.parent !== sprite) { sprite.addChild(textObj); }
          textObj.position.set(sprite.width / 2, sprite.height / 2);
          const fill = this.getContrastColor(color);
          textObj.style.fill = fill;
          textObj.style.stroke = (fill === '#000000' ? '#ffffff' : '#000000');
          textObj.style.strokeThickness = 1;
        }
        return;
      }
      sprite.tint = color;
    },
    isJson(str) {
      try { JSON.parse(str); return true; } catch (e) { return false; }
    },
    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; }
    },
    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; }
    },
    getStationId(obj) {
      if (this.isJson(obj)) { let data = JSON.parse(obj); if (data.stationId == null || data.stationId == undefined) { return -1; } return data.stationId; } else { return -1; }
    },
    getTrackSiteNo(obj) {
      if (this.isJson(obj)) { let data = JSON.parse(obj); if (data.trackSiteNo == null || data.trackSiteNo == undefined) { return -1; } return data.trackSiteNo; } else { return -1; }
    },
    adjustLabelScale() {
      const s = this.pixiApp && this.pixiApp.stage ? (this.pixiApp.stage.scale.x || 1) : 1;
      const minPx = 14;
      const vw = this.pixiApp.view.width;
      const vh = this.pixiApp.view.height;
      const pos = this.pixiApp.stage.position;
      const margin = 50;
      this.pixiStaMap && this.pixiStaMap.forEach((sprite) => {
        const textObj = sprite && sprite.textObj;
        if (!textObj) { return; }
        const base = (textObj.style && textObj.style.fontSize) ? textObj.style.fontSize : 10;
        let scale = minPx / (base * s);
        if (!isFinite(scale)) { scale = 1; }
        scale = Math.max(0.8, Math.min(scale, 3));
        textObj.scale.set(scale);
        textObj.position.set(sprite.width / 2, sprite.height / 2);
        const sx = pos.x + sprite.x * s;
        const sy = pos.y + sprite.y * s;
        const on = sx >= -margin && sy >= -margin && sx <= vw + margin && sy <= vh + margin;
        textObj.visible = (s >= 0.25) && on;
      });
      this.pixiCrnMap && this.pixiCrnMap.forEach((sprite) => {
        const textObj = sprite && sprite.textObj;
        if (!textObj) { return; }
        const base = (textObj.style && textObj.style.fontSize) ? textObj.style.fontSize : 12;
        let scale = minPx / (base * s);
        if (!isFinite(scale)) { scale = 1; }
        scale = Math.max(0.8, Math.min(scale, 3));
        textObj.scale.set(scale);
        textObj.position.set(sprite.width / 2, sprite.height / 2);
        const sx = pos.x + sprite.x * s;
        const sy = pos.y + sprite.y * s;
        const on = sx >= -margin && sy >= -margin && sx <= vw + margin && sy <= vh + margin;
        textObj.visible = (s >= 0.25) && on;
      });
      this.pixiRgvMap && this.pixiRgvMap.forEach((sprite) => {
        const textObj = sprite && sprite.textObj;
        if (!textObj) { return; }
        const base = (textObj.style && textObj.style.fontSize) ? textObj.style.fontSize : 12;
        let scale = minPx / (base * s);
        if (!isFinite(scale)) { scale = 1; }
        scale = Math.max(0.8, Math.min(scale, 3));
        textObj.scale.set(scale);
        textObj.position.set(sprite.width / 2, sprite.height / 2);
        const sx = pos.x + sprite.x * s;
        const sy = pos.y * s + pos.y;
        const on = sx >= -margin && sy >= -margin && sx <= vw + margin && sy <= vh + margin;
        textObj.visible = (s >= 0.25) && on;
      });
    },
    scheduleAdjustLabels() {
      if (this.adjustLabelTimer) { clearTimeout(this.adjustLabelTimer); }
      this.adjustLabelTimer = setTimeout(() => {
        this.adjustLabelScale();
        this.adjustLabelTimer = null;
      }, 20);
    }
  }
});
src/main/webapp/components/WatchCrnCard.js
@@ -19,8 +19,9 @@
                <div style="margin-bottom: 10px;"><el-button @click="controlCommandTaskComplete()" size="mini">任务完成</el-button></div>
            </div>
        </div>
        <el-collapse v-model="activeNames">
          <el-collapse-item v-for="(item) in crnList" :name="item.crnNo">
        <div style="max-height: 55vh; overflow:auto;">
          <el-collapse v-model="activeNames" accordion>
            <el-collapse-item v-for="(item) in displayCrnList" :name="item.crnNo">
            <template slot="title">
                <div style="width: 100%;display: flex;">
                   <div style="width: 50%;">{{ item.crnNo }}号堆垛机</div>
@@ -55,8 +56,20 @@
                <el-descriptions-item label="故障代码">{{ item.warnCode }}</el-descriptions-item>
                <el-descriptions-item label="故障描述">{{ item.alarm }}</el-descriptions-item>
            </el-descriptions>
          </el-collapse-item>
        </el-collapse>
            </el-collapse-item>
          </el-collapse>
        </div>
        <div style="display:flex; justify-content:flex-end; margin-top:8px;">
          <el-pagination
            @current-change="handlePageChange"
            @size-change="handleSizeChange"
            :current-page="currentPage"
            :page-size="pageSize"
            :page-sizes="[10,20,50,100]"
            layout="total, prev, pager, next"
            :total="crnList.length">
          </el-pagination>
        </div>
    </div>
    `,
  props: ["param"],
@@ -71,6 +84,8 @@
        sourceLocNo: "",
        targetLocNo: "",
      },
      pageSize: 25,
      currentPage: 1,
    };
  },
  created() {
@@ -78,11 +93,20 @@
      this.getCrnStateInfo();
    }, 1000);
  },
  computed: {
    displayCrnList() {
      const start = (this.currentPage - 1) * this.pageSize;
      const end = start + this.pageSize;
      return this.crnList.slice(start, end);
    }
  },
  watch: {
    param: {
      handler(newVal, oldVal) {
        if (newVal.crnNo != 0) {
          this.activeNames = newVal.crnNo;
          const idx = this.crnList.findIndex(i => i.crnNo == newVal.crnNo);
          if (idx >= 0) { this.currentPage = Math.floor(idx / this.pageSize) + 1; }
        }
      },
      deep: true, // 深度监听嵌套属性
@@ -90,6 +114,13 @@
    },
  },
  methods: {
    handlePageChange(page) {
      this.currentPage = page;
    },
    handleSizeChange(size) {
      this.pageSize = size;
      this.currentPage = 1;
    },
    getCrnStateInfo() {
      let that = this;
      $.ajax({
@@ -113,6 +144,7 @@
                }
              });
              that.crnList = tmp;
              that.currentPage = 1;
            }
          }
        },
src/main/webapp/components/WatchRgvCard.js
@@ -22,8 +22,9 @@
                <div style="margin-bottom: 10px;"><el-button @click="controlCommandTaskComplete()" size="mini">任务完成</el-button></div>
            </div>
        </div>
        <el-collapse v-model="activeNames">
          <el-collapse-item v-for="(item) in rgvList" :name="item.rgvNo">
        <div style="max-height: 55vh; overflow:auto;">
          <el-collapse v-model="activeNames" accordion>
            <el-collapse-item v-for="(item) in displayRgvList" :name="item.rgvNo">
            <template slot="title">
                <div style="width: 100%;display: flex;">
                   <div style="width: 50%;">{{ item.rgvNo }}号RGV</div>
@@ -45,8 +46,20 @@
                <el-descriptions-item label="故障代码">{{ item.warnCode }}</el-descriptions-item>
                <el-descriptions-item label="故障描述">{{ item.alarm }}</el-descriptions-item>
            </el-descriptions>
          </el-collapse-item>
        </el-collapse>
            </el-collapse-item>
          </el-collapse>
        </div>
        <div style="display:flex; justify-content:flex-end; margin-top:8px;">
          <el-pagination
            @current-change="handlePageChange"
            @size-change="handleSizeChange"
            :current-page="currentPage"
            :page-size="pageSize"
            :page-sizes="[10,20,50,100]"
            layout="total, prev, pager, next"
            :total="rgvList.length">
          </el-pagination>
        </div>
    </div>
    `,
  props: ["param"],
@@ -60,7 +73,9 @@
        rgvNo: "",
        sourcePos: "",
        targetPos: ""
      }
      },
      pageSize: 25,
      currentPage: 1,
    };
  },
  created() {
@@ -68,11 +83,20 @@
      this.getRgvStateInfo();
    }, 1000);
  },
  computed: {
    displayRgvList() {
      const start = (this.currentPage - 1) * this.pageSize;
      const end = start + this.pageSize;
      return this.rgvList.slice(start, end);
    }
  },
  watch: {
    param: {
      handler(newVal) {
        if (newVal && newVal.rgvNo != 0) {
          this.activeNames = newVal.rgvNo;
          const idx = this.rgvList.findIndex(i => i.rgvNo == newVal.rgvNo);
          if (idx >= 0) { this.currentPage = Math.floor(idx / this.pageSize) + 1; }
        }
      },
      deep: true,
@@ -80,6 +104,13 @@
    },
  },
  methods: {
    handlePageChange(page) {
      this.currentPage = page;
    },
    handleSizeChange(size) {
      this.pageSize = size;
      this.currentPage = 1;
    },
    getRgvStateInfo() {
      let that = this;
      $.ajax({
@@ -101,6 +132,7 @@
                }
              });
              that.rgvList = tmp;
              that.currentPage = 1;
            }
          }
        },
@@ -185,4 +217,4 @@
      });
    },
  },
});
});
src/main/webapp/views/locMap/locMap.html
@@ -355,29 +355,16 @@
        pixiApp.view.addEventListener('wheel', (event) => {
          event.stopPropagation();
          event.preventDefault();
          // 因为画布是充满视窗的,所以clientX等于mouse point在renderer上的x坐标
          const globalPos = [event.clientX, event.clientY];
          const delta = event.deltaY;
          const sx = event.clientX;
          const sy = event.clientY;
          const oldZoom = pixiApp.stage.scale.x;
          const delta = event.deltaY;
          let newZoom = oldZoom * 0.999 ** delta;
          // const oldStageMatrix = app.stage.localTransform.clone();
          // const oldStagePos = oldStageMatrix.applyInverse(pointerGlobalPos);
          const oldStagePos = globalPos;
          const dx = oldStagePos[0] * oldZoom - oldStagePos[0] * newZoom;
          const dy = oldStagePos[1] * oldZoom - oldStagePos[1] * newZoom;
          pixiApp.stage.setTransform(
                  pixiApp.stage.position.x + dx,
                  pixiApp.stage.position.y + dy,
                  newZoom,
                  newZoom,
                  0,
                  0,
                  0,
                  0,
                  0
          );
          const worldX = (sx - pixiApp.stage.position.x) / oldZoom;
          const worldY = (sy - pixiApp.stage.position.y) / oldZoom;
          const newPosX = sx - worldX * newZoom;
          const newPosY = sy - worldY * newZoom;
          pixiApp.stage.setTransform(newPosX, newPosY, newZoom, newZoom, 0, 0, 0, 0, 0);
        });
        //*******************缩放画布*******************
@@ -462,10 +449,21 @@
            }
          });
          //视角居中
          let containerWidth = (pixiApp.view.width - objectsContainer.width) / 2;
          let containerHeight = (pixiApp.view.height - objectsContainer.height) / 2;
          pixiApp.stage.position.set(containerWidth, containerHeight);
          const b1 = objectsContainer.getLocalBounds();
          const b2 = objectsContainer2.getLocalBounds();
          const minX = Math.min(b1.x, b2.x);
          const minY = Math.min(b1.y, b2.y);
          const maxX = Math.max(b1.x + b1.width, b2.x + b2.width);
          const maxY = Math.max(b1.y + b1.height, b2.y + b2.height);
          const contentW = Math.max(0, maxX - minX);
          const contentH = Math.max(0, maxY - minY);
          const vw = pixiApp.view.width;
          const vh = pixiApp.view.height;
          let scale = Math.min(vw / contentW, vh / contentH) * 0.95;
          if (!isFinite(scale) || scale <= 0) { scale = 1; }
          const posX = (vw - contentW * scale) / 2 - minX * scale;
          const posY = (vh - contentH * scale) / 2 - minY * scale;
          pixiApp.stage.setTransform(posX, posY, scale, scale, 0, 0, 0, 0, 0);
        }else {
          let diff = this.findDiffList(this.map, map);
          diff.forEach((item, index) => {
src/main/webapp/views/watch/console.html
@@ -1,22 +1,24 @@
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>WCS控制中心</title>
        <link rel="stylesheet" href="../../static/css/animate.min.css">
        <link rel="stylesheet" href="../../static/vue/element/element.css">
        <link rel="stylesheet" href="../../static/css/watch/console_vue.css">
        <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
        <script type="text/javascript" src="../../static/layui/layui.js"></script>
        <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
        <script type="text/javascript" src="../../static/js/common.js"></script>
        <script type="text/javascript" src="../../static/vue/js/vue.min.js"></script>
        <script type="text/javascript" src="../../static/vue/element/element.js"></script>
    </head>
        <head>
            <meta charset="UTF-8">
            <title>WCS控制中心</title>
            <link rel="stylesheet" href="../../static/css/animate.min.css">
            <link rel="stylesheet" href="../../static/vue/element/element.css">
            <link rel="stylesheet" href="../../static/css/watch/console_vue.css">
            <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
            <script type="text/javascript" src="../../static/layui/layui.js"></script>
            <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
            <script type="text/javascript" src="../../static/js/common.js"></script>
            <script type="text/javascript" src="../../static/vue/js/vue.min.js"></script>
            <script type="text/javascript" src="../../static/vue/element/element.js"></script>
            <script src="../../static/js/gsap.min.js"></script>
            <script src="../../static/js/pixi-legacy.min.js"></script>
        </head>
    <body>
        <div id="app">
            <div style="display: flex;margin-top: 30px;margin-left: 20px;">
                <div style="width: 20%;height: 60vh;margin-right: 20px;">
            <div style="display: flex;margin-left: 20px;">
                <div style="width: 20%;height: 60vh;margin-right: 20px;margin-top: 30px;">
                    <el-tabs type="border-card" v-model="activateCard" @tab-click="handleCardClick">
                        <el-tab-pane label="堆垛机" name="crn">
                            <watch-crn-card :param="crnParam"></watch-crn-card>
@@ -27,53 +29,18 @@
                        <el-tab-pane label="RGV" name="rgv">
                            <watch-rgv-card :param="rgvParam"></watch-rgv-card>
                        </el-tab-pane>
                        <el-tab-pane label="地图配置" name="mapSetting">
                        <!-- <el-tab-pane label="地图配置" name="mapSetting">
                            <map-setting-card :param="mapSettingParam"></map-setting-card>
                        </el-tab-pane>
                        </el-tab-pane> -->
                    </el-tabs>
                </div>
                <map-canvas :lev="currentLev" :crn-param="crnParam" :rgv-param="rgvParam" :devp-param="devpParam" @crn-click="openCrn" @station-click="openSite" style="width: 80%; height: 100vh;"></map-canvas>
                <div style="position: absolute;top: 15px;left: 50%;display: flex;">
                    <div v-if="levList.length > 1" v-for="(lev,index) in levList" :key="index" style="margin-right: 10px;">
                        <el-button :type="currentLev == lev ? 'primary' : ''" @click="switchLev(lev)" size="mini">{{ lev }}F</el-button>
                    </div>
                </div>
                <div id="mapDataId" style="position: relative;margin-top: 50px;" :style="{zoom: mapSettingParam.zoom / 100}">
                    <table class="excel-table">
                        <tr v-for="(row,index) in map" :key="index">
                            <td
                                    v-for="(col,idx) in row" :key="idx"
                                    :rowspan="col.rowSpan"
                                    :colspan="col.colSpan"
                                    :style="{width: col.width}"
                                    v-if="col.type != 'merge'"
                            >
                                <div v-if="col.type == 'none'">
                                    <div class="item" style="visibility: hidden">{{idx}}</div>
                                </div>
                                <div v-else-if="col.type == 'shelf'">
                                    <div class="shelf">
                                        <div class="shelf-loc-info" v-if="getShelfLocInfo(index, idx)">{{getShelfLocInfo(index, idx)}}</div>
                                    </div>
                                </div>
                                <div v-else-if="col.type == 'devp'">
                                    <div class="site" :style="{height: col.rowPx}" :id="'site-' + getStationId(col.value)" @click="openSite(getStationId(col.value))">{{getStationId(col.value)}}</div>
                                </div>
                                <div v-else-if="col.type == 'rgv'" style="position: relative;">
                                    <div class="rgv-item" v-if="getDeviceNo(col.value) != -1" :style="{width: col.width}" :id="'rgv-' + getDeviceNo(col.value)" @click="openRgv(getDeviceNo(col.value))">{{getDeviceNo(col.value)}}</div>
                                    <div class="track-item" v-if="getTrackSiteNo(col.value) == -1"></div>
                                    <div class="track-item" v-else :id="'rgvTrackSiteNo-' + getTrackSiteNo(col.value)"></div>
                                </div>
                                <div v-else-if="col.type == 'crn'">
                                    <div class="crn-item" v-if="getDeviceNo(col.value) != -1" :style="{width: col.width}" :id="'crn-' + getDeviceNo(col.value)" @click="openCrn(getDeviceNo(col.value))">{{getDeviceNo(col.value)}}</div>
                                    <div class="track-item track-crn" v-if="getTrackSiteNo(col.value) == -1"></div>
                                    <div class="track-item track-crn" v-else :id="'crnTrackSiteNo-' + getTrackSiteNo(col.value)"></div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
@@ -83,6 +50,7 @@
        <script src="../../components/DevpCard.js"></script>
        <script src="../../components/MapSettingCard.js"></script>
        <script src="../../components/WatchRgvCard.js"></script>
        <script src="../../components/MapCanvas.js"></script>
        <script>
            var app = new Vue({
                el: '#app',
@@ -111,6 +79,8 @@
                created() {
                    this.init()
                },
                mounted() {
                },
                watch: {
                },
@@ -120,13 +90,8 @@
                        this.getSystemRunningStatus() //获取系统运行状态
                        this.getLevList() //获取地图层级列表
                        this.getLocMastData() //获取库位数据
                        this.consoleInterval = setInterval(() => {
                            this.getCrnInfo() //获取堆垛机数据
                            this.getSiteInfo() //获取输送站点数据
                            this.getRgvInfo() //获取RGV数据
                        }, 1000)
                    },
                    getLevList() {
                        let that = this;
                        $.ajax({
@@ -177,7 +142,7 @@
                    switchLev(lev) {
                        this.currentLev = lev;
                        this.getMap()
                        this.getLocMastData() //切换层级时重新获取库位数据
                        this.getLocMastData()
                    },
                    openCrn(id) {
                        this.crnParam.crnNo = id;
@@ -549,6 +514,6 @@
                    }
                }
            })
        </script>
    </body>
</html>
            </script>
        </body>
        </html>
src/main/webapp/views/watch/console_html.html
New file
@@ -0,0 +1,554 @@
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>WCS控制中心</title>
        <link rel="stylesheet" href="../../static/css/animate.min.css">
        <link rel="stylesheet" href="../../static/vue/element/element.css">
        <link rel="stylesheet" href="../../static/css/watch/console_vue.css">
        <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
        <script type="text/javascript" src="../../static/layui/layui.js"></script>
        <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
        <script type="text/javascript" src="../../static/js/common.js"></script>
        <script type="text/javascript" src="../../static/vue/js/vue.min.js"></script>
        <script type="text/javascript" src="../../static/vue/element/element.js"></script>
    </head>
    <body>
        <div id="app">
            <div style="display: flex;margin-top: 30px;margin-left: 20px;">
                <div style="width: 20%;height: 60vh;margin-right: 20px;">
                    <el-tabs type="border-card" v-model="activateCard" @tab-click="handleCardClick">
                        <el-tab-pane label="堆垛机" name="crn">
                            <watch-crn-card :param="crnParam"></watch-crn-card>
                        </el-tab-pane>
                        <el-tab-pane label="输送站" name="devp">
                            <devp-card :param="devpParam"></devp-card>
                        </el-tab-pane>
                        <el-tab-pane label="RGV" name="rgv">
                            <watch-rgv-card :param="rgvParam"></watch-rgv-card>
                        </el-tab-pane>
                        <el-tab-pane label="地图配置" name="mapSetting">
                            <map-setting-card :param="mapSettingParam"></map-setting-card>
                        </el-tab-pane>
                    </el-tabs>
                </div>
                <div style="position: absolute;top: 15px;left: 50%;display: flex;">
                    <div v-if="levList.length > 1" v-for="(lev,index) in levList" :key="index" style="margin-right: 10px;">
                        <el-button :type="currentLev == lev ? 'primary' : ''" @click="switchLev(lev)" size="mini">{{ lev }}F</el-button>
                    </div>
                </div>
                <div id="mapDataId" style="position: relative;margin-top: 50px;" :style="{zoom: mapSettingParam.zoom / 100}">
                    <table class="excel-table">
                        <tr v-for="(row,index) in map" :key="index">
                            <td
                                    v-for="(col,idx) in row" :key="idx"
                                    :rowspan="col.rowSpan"
                                    :colspan="col.colSpan"
                                    :style="{width: col.width}"
                                    v-if="col.type != 'merge'"
                            >
                                <div v-if="col.type == 'none'">
                                    <div class="item" style="visibility: hidden">{{idx}}</div>
                                </div>
                                <div v-else-if="col.type == 'shelf'">
                                    <div class="shelf">
                                        <div class="shelf-loc-info" v-if="getShelfLocInfo(index, idx)">{{getShelfLocInfo(index, idx)}}</div>
                                    </div>
                                </div>
                                <div v-else-if="col.type == 'devp'">
                                    <div class="site" :style="{height: col.rowPx}" :id="'site-' + getStationId(col.value)" @click="openSite(getStationId(col.value))">{{getStationId(col.value)}}</div>
                                </div>
                                <div v-else-if="col.type == 'rgv'" style="position: relative;">
                                    <div class="rgv-item" v-if="getDeviceNo(col.value) != -1" :style="{width: col.width}" :id="'rgv-' + getDeviceNo(col.value)" @click="openRgv(getDeviceNo(col.value))">{{getDeviceNo(col.value)}}</div>
                                    <div class="track-item" v-if="getTrackSiteNo(col.value) == -1"></div>
                                    <div class="track-item" v-else :id="'rgvTrackSiteNo-' + getTrackSiteNo(col.value)"></div>
                                </div>
                                <div v-else-if="col.type == 'crn'">
                                    <div class="crn-item" v-if="getDeviceNo(col.value) != -1" :style="{width: col.width}" :id="'crn-' + getDeviceNo(col.value)" @click="openCrn(getDeviceNo(col.value))">{{getDeviceNo(col.value)}}</div>
                                    <div class="track-item track-crn" v-if="getTrackSiteNo(col.value) == -1"></div>
                                    <div class="track-item track-crn" v-else :id="'crnTrackSiteNo-' + getTrackSiteNo(col.value)"></div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <script src="../../components/WatchCrnCard.js"></script>
        <script src="../../components/DevpCard.js"></script>
        <script src="../../components/MapSettingCard.js"></script>
        <script src="../../components/WatchRgvCard.js"></script>
        <script>
            var app = new Vue({
                el: '#app',
                data: {
                    map: [],//地图数据
                    levList: [],
                    currentLev: 1,
                    systemStatus: true,//系统运行状态
                    consoleInterval: null,//定时器存储变量
                    rgvPosition: [],
                    activateCard: 'crn',
                    crnParam: {
                        crnNo: 0
                    },
                    mapSettingParam: {
                        zoom: 70
                    },
                    devpParam: {
                        stationId: 0
                    },
                    rgvParam: {
                        rgvNo: 0
                    },
                    locMastData: []//库位数据
                },
                created() {
                    this.init()
                },
                watch: {
                },
                methods: {
                    init() {
                        this.getMap()
                        this.getSystemRunningStatus() //获取系统运行状态
                        this.getLevList() //获取地图层级列表
                        this.getLocMastData() //获取库位数据
                        this.consoleInterval = setInterval(() => {
                            this.getCrnInfo() //获取堆垛机数据
                            this.getSiteInfo() //获取输送站点数据
                            this.getRgvInfo() //获取RGV数据
                        }, 1000)
                    },
                    getLevList() {
                        let that = this;
                        $.ajax({
                            url: baseUrl + "/basMap/getLevList",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            method: "get",
                            success: (res) => {
                                let data = res.data;
                                that.levList = data;
                            }
                        })
                    },
                    //获取地图数据
                    getMap() {
                        let that = this
                        let rowPx = 35;
                        let colPx = 35;
                        $.ajax({
                            url: baseUrl + "/basMap/lev/" + this.currentLev + "/auth",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            method: "get",
                            success: (res) => {
                                let data = res.data;
                                let mapData = JSON.parse(data)
                                mapData.forEach((row) => {
                                    let shelfIdx = 1;
                                    row.forEach((col) => {
                                        if (col.type == 'shelf') {
                                            col.shelfIdx = shelfIdx;
                                            shelfIdx++;
                                        }
                                        col.rowPx = (col.rowSpan * rowPx) + "px";
                                        col.colPx = (col.colSpan * colPx) + "px";
                                        col.width = (col.cellWidth / 30) + "px";
                                    })
                                })
                                that.map = mapData;
                            }
                        })
                    },
                    switchLev(lev) {
                        this.currentLev = lev;
                        this.getMap()
                        this.getLocMastData() //切换层级时重新获取库位数据
                    },
                    openCrn(id) {
                        this.crnParam.crnNo = id;
                        this.activateCard = 'crn';
                    },
                    openRgv(id) {
                        this.rgvParam.rgvNo = id;
                        this.activateCard = 'rgv';
                    },
                    openSite(id) {
                        this.devpParam.stationId = id;
                        this.activateCard = 'devp';
                    },
                    getSiteInfo() {
                        //获取输送站点数据
                        $.ajax({
                            url: baseUrl + "/console/latest/data/station",
                            headers: {'token': localStorage.getItem('token')},
                            method: 'POST',
                            success: function (res) {
                                if (res.code === 200) {
                                    var sites = res.data;
                                    for (var i = 0; i < sites.length; i++){
                                        var siteEl = $("#site-"+sites[i].stationId);
                                        siteEl.attr("class", "site " + sites[i].stationStatus);
                                        if (sites[i].taskNo != null && sites[i].taskNo>0) {
                                            siteEl.html(sites[i].stationId + "[" + sites[i].taskNo + "]");
                                        } else {
                                            siteEl.html(sites[i].stationId);
                                        }
                                    }
                                } else if (res.code === 403) {
                                    parent.location.href = baseUrl + "/login";
                                } else {
                                    console.log(res.msg);
                                }
                            }
                        });
                    },
                    getCrnInfo() {
                        let that = this
                        //获取堆垛机数据
                        $.ajax({
                            url: baseUrl + "/console/latest/data/crn",
                            headers: {'token': localStorage.getItem('token')},
                            method: 'POST',
                            success: function (res) {
                                if (res.code === 200) {
                                    var crns = res.data;
                                    let crnList = []
                                    for (var i = 0; i < crns.length; i++) {
                                        var crnEl = $("#crn-" + crns[i].crnId);
                                        crnEl.attr("class", "crn-item " + crns[i].crnStatus);
                                        if (crns[i].taskNo != null && crns[i].taskNo > 0) {
                                            crnEl.html(crns[i].crnId + "[" + crns[i].taskNo + "]");
                                        } else {
                                            crnEl.html(crns[i].crnId);
                                        }
                                        let bay = parseInt(crns[i].bay, 10);
                                        if (isNaN(bay) || bay < 1 || bay === -2) {
                                            bay = 1;
                                        }
                                        // 根据列值定位到当前行的目标单元格,避免随机偏移导致的误差
                                        let targetCell = that.getCrnTargetCell(crnEl, bay);
                                        if (!targetCell || targetCell.length === 0) {
                                            continue;
                                        }
                                        if (targetCell.offset() == undefined) {
                                            continue;
                                        }
                                        if (crnEl.offsetParent().offset() == undefined) {
                                            continue;
                                        }
                                        let parentLeft = crnEl.offsetParent().offset().left;
                                        let cellLeft = targetCell.offset().left - parentLeft;
                                        let offsetWithinCell = (targetCell.outerWidth() - crnEl.outerWidth()) / 2;
                                        let zoomFactor = that.mapSettingParam.zoom ? (that.mapSettingParam.zoom / 100) : 1;
                                        if (zoomFactor <= 0) { zoomFactor = 1; }
                                        let finalOffset = (cellLeft + offsetWithinCell) / zoomFactor;
                                        if(finalOffset < 0) {
                                            finalOffset = 0;
                                        }
                                        crnEl.animate({left: finalOffset + 'px'}, 500);
                                        crnList.push({
                                            crnNo: crns[i].crnId,
                                            crnStatus: crns[i].crnStatus
                                        })
                                    }
                                } else if (res.code === 403) {
                                    parent.location.href = baseUrl + "/login";
                                } else {
                                    console.log(res.msg);
                                }
                            }
                        });
                    },
                    getRgvInfo() {
                        let that = this
                        //获取RGV数据
                        $.ajax({
                            url: baseUrl + "/console/latest/data/rgv",
                            headers: {'token': localStorage.getItem('token')},
                            method: 'POST',
                            success: function (res) {
                                if (res.code === 200) {
                                    var rgvs = res.data;
                                    if (that.rgvPosition.length == 0) {
                                        let position = []
                                        for (var i = 0; i < rgvs.length; i++) {
                                            var rgvEl = $("#rgv-" + rgvs[i].rgvNo);
                                            if(rgvEl.offset() == undefined) {
                                                continue;
                                            }
                                            position.push({
                                                id: rgvs[i].rgvNo,
                                                trackSiteNo: rgvs[i].trackSiteNo,
                                                initLeft: rgvEl.offset().left
                                            })
                                        }
                                        that.rgvPosition = position
                                        return;
                                    }
                                    for (var i = 0; i < rgvs.length; i++) {
                                        var rgvEl = $("#rgv-" + rgvs[i].rgvNo);
                                        if (rgvs[i].rgvStatus == 'idle') {
                                            rgvEl.attr("class", "rgv-item");
                                        }else if (rgvs[i].rgvStatus == 'working') {
                                            rgvEl.attr("class", "rgv-item machine-working");
                                        }else if (rgvs[i].rgvStatus == 'waiting') {
                                            rgvEl.attr("class", "rgv-item machine-working");
                                        }else {
                                            rgvEl.attr("class", "rgv-item machine-un-auto");
                                        }
                                        let trackSiteNo = rgvs[i].trackSiteNo;
                                        let trackSiteEl = $("#rgvTrackSiteNo-" + trackSiteNo);
                                        if(rgvEl.offsetParent().offset() == undefined) {
                                            continue;
                                        }
                                        let parentLeft = rgvEl.offsetParent().offset().left;
                                        let targetPosition = trackSiteEl.parent().parent().offset().left - parentLeft;
                                        let rgvPosition = rgvEl.position().left;
                                        let zoomFactor = that.mapSettingParam.zoom ? (that.mapSettingParam.zoom / 100) : 1;
                                        if (zoomFactor <= 0) { zoomFactor = 1; }
                                        let finalOffset = targetPosition / zoomFactor;
                                        rgvEl.animate({left: finalOffset + "px"}, 500);
                                    }
                                } else if (res.code === 403) {
                                    parent.location.href = baseUrl + "/login";
                                } else {
                                    console.log(res.msg);
                                }
                            }
                        });
                    },
                    systemSwitch() {
                        // 系统开关
                        let that = this
                        if (this.systemStatus) {
                            this.$prompt('请输入口令,并停止WCS系统', '提示', {
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                            }).then(({
                                value
                            }) => {
                                that.doSwitch(0, value)
                            }).catch(() => {
                            });
                        } else {
                            this.doSwitch(1)
                        }
                    },
                    doSwitch(operatorType, password) {
                        let that = this
                        $.ajax({
                            url: baseUrl + "/console/system/switch",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            data: {
                                operatorType: operatorType,
                                password: password
                            },
                            method: 'POST',
                            success: function(res) {
                                if (res.code === 200) {
                                    if (res.data.status) {
                                        $('#system-toggle-checked').attr("checked", true);
                                        $('#system-run-desc').html("系统运行中...");
                                        that.systemStatus = true;
                                        parent.systemRunning = true;
                                    } else {
                                        $('#system-toggle-checked').attr("checked", false);
                                        $('#system-run-desc').html("系统已停止!");
                                        that.systemStatus = false;
                                        parent.systemRunning = false;
                                    }
                                } else if (res.code === 403) {
                                    parent.location.href = baseUrl + "/login";
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        });
                    },
                    getSystemRunningStatus() {
                        // 获取wcs系统运行状态
                        let that = this
                        $.ajax({
                            url: baseUrl + "/console/system/running/status",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            method: 'POST',
                            success: function(res) {
                                if (res.code === 200) {
                                    if (res.data.status) {
                                        $('#system-toggle-checked').attr("checked", true);
                                        $('#system-run-desc').html("系统运行中...");
                                        that.systemStatus = true;
                                        parent.systemRunning = true;
                                    } else {
                                        $('#system-toggle-checked').attr("checked", false);
                                        $('#system-run-desc').html("系统已停止!");
                                        that.systemStatus = false;
                                        parent.systemRunning = false;
                                    }
                                } else if (res.code === 403) {
                                    parent.location.href = baseUrl + "/login";
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        });
                    },
                    getCrnTargetCell(crnEl, bay) {
                        if (!crnEl || bay == null) {
                            return null;
                        }
                        let rowEl = crnEl.closest('tr');
                        if (!rowEl || rowEl.length === 0) {
                            return null;
                        }
                        let targetCell = null;
                        let colCounter = 0;
                        let startCount = false;
                        rowEl.find('td').each(function () {
                            // 以当前行中首次出现的track-item为起点进行列计数
                            const isTrackCrn = $(this).find('.track-crn').length > 0;
                            if (!startCount && !isTrackCrn) {
                                return;
                            }
                            let span = parseInt($(this).attr('colspan'), 10);
                            if (isNaN(span) || span < 1) {
                                span = 1;
                            }
                            if (!startCount && isTrackCrn) {
                                startCount = true;
                            }
                            colCounter += span;
                            if (targetCell == null && colCounter >= bay) {
                                targetCell = $(this);
                                return false;
                            }
                        });
                        return targetCell;
                    },
                    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;
                        }
                    },
                    getStationId(obj) {
                        if (this.isJson(obj)) {
                            let data = JSON.parse(obj)
                            if (data.stationId == null || data.stationId == undefined) {
                                return -1;
                            }
                            return data.stationId;
                        }else {
                            return -1;
                        }
                    },
                    getTrackSiteNo(obj) {
                        if (this.isJson(obj)) {
                            let data = JSON.parse(obj)
                            if (data.trackSiteNo == null || data.trackSiteNo == undefined) {
                                return -1;
                            }
                            return data.trackSiteNo;
                        }else {
                            return -1;
                        }
                    },
                    isJson(str) {
                        try {
                            JSON.parse(str);
                            return true;
                        } catch (e) {
                            return false;
                        }
                    },
                    handleCardClick(tab, event) {
                    },
                    //获取库位数据
                    getLocMastData() {
                        let that = this;
                        $.ajax({
                            url: baseUrl + "/console/map/locList",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            method: "get",
                            data: {},
                            success: (res) => {
                                if (res.code === 200) {
                                    that.locMastData = res.data;
                                }
                            }
                        })
                    },
                    //根据地图坐标获取库位的排列信息
                    getShelfLocInfo(rowIdx, colIdx) {
                        if (!this.locMastData || this.locMastData.length === 0) {
                            return '';
                        }
                        // 在locMastData中查找匹配的库位
                        // locType字段存储的是地图坐标信息
                        let locInfo = this.locMastData.find(loc => {
                            if (!loc.locType) return false;
                            // locType格式类似 "0-1-1" (mapX-mapY-lev)
                            let parts = loc.locType.split('-');
                            if (parts.length >= 2) {
                                return parseInt(parts[0]) === rowIdx && parseInt(parts[1]) === colIdx;
                            }
                            return false;
                        });
                        if (locInfo && locInfo.row1 && locInfo.bay1) {
                            return locInfo.row1 + '-' + locInfo.bay1;
                        }
                        return '';
                    }
                }
            })
        </script>
    </body>
</html>
src/main/webapp/views/watch/console_pixijs.html
File was renamed from src/main/webapp/views/watch/console2.html
@@ -79,9 +79,6 @@
  <script>
    let pixiApp;
    let pixiStageList = [];
    let pixiShuttleMap = new Map();
    let pixiShuttleMoveAdvancePathMap = new Map();
    let pixiShuttleMoveAdvancePathList = [];
    let pixiStaMap = new Map();
    let pixiCrnMap = new Map();
    let pixiRgvMap = new Map();
@@ -199,13 +196,15 @@
        },
        changeFloor(lev) {
          this.currentLev = lev
          this.currentLevShuttleList = []
          this.getMap(lev)
          //清空预计路径
          objectsContainer.removeChildren();
          objectsContainer2.removeChildren();
          pixiShuttleMoveAdvancePathMap = new Map();
          pixiShuttleMoveAdvancePathList = []
          crnList = []
          rgvList = []
          pixiCrnMap = new Map()
          pixiRgvMap = new Map()
          pixiStaMap = new Map()
          pixiStageList = []
          this.getMap(lev)
        },
        createMap() {
          //Create a Pixi Application
@@ -331,7 +330,7 @@
              }
            }
          })
          map.forEach((item, index) => {
            for(let idx = 0;idx < item.length;idx++){
              let val = item[idx]
@@ -372,7 +371,20 @@
            }
          })
          const rowHeightScaled = bayHeightList.map(h => (h != null && h !== -1) ? (h / 8) : (height));
          const rowHeightScaled = [];
          for (let r = 0; r < map.length; r++) {
            const h = bayHeightList[r];
            if (h != null && h !== -1) {
              rowHeightScaled[r] = h / 8;
            } else {
              let fallback = 0;
              for (let c = 0; c < map[r].length; c++) {
                const v = map[r][c];
                if (v && v.type !== 'merge' && v.height != null && v.height > 0) { fallback = v.height; break; }
              }
              rowHeightScaled[r] = fallback > 0 ? fallback : 25;
            }
          }
          let yOffsets = [];
          let yCursor = 0;
          for (let r = 0; r < map.length; r++) {