From 9ee93c74e0de265b8a55454c621147b036fb0930 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期四, 25 八月 2022 11:08:32 +0800
Subject: [PATCH] #

---
 /dev/null                                                 |   37 ----
 src/main/java/com/zy/asrs/domain/vo/SteStateTableVo.java  |   84 +++++++++
 src/main/java/com/zy/core/thread/SteThread.java           |   14 
 src/main/java/com/zy/core/model/protocol/SteProtocol.java |   15 
 src/main/java/com/zy/asrs/controller/SteController.java   |  146 ++++++++++++++++
 src/main/java/com/zy/asrs/domain/vo/SteMsgTableVo.java    |   48 +++++
 src/main/webapp/views/ste.html                            |  114 ++++++++++-
 src/main/java/com/zy/core/cache/OutputQueue.java          |    3 
 src/main/resources/application.yml                        |   30 +-
 src/main/java/com/zy/core/ServerBootstrap.java            |    2 
 src/main/java/com/zy/core/enums/SteStatusType.java        |    2 
 11 files changed, 408 insertions(+), 87 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/CarController.java b/src/main/java/com/zy/asrs/controller/CarController.java
deleted file mode 100644
index cc72746..0000000
--- a/src/main/java/com/zy/asrs/controller/CarController.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.zy.asrs.controller;
-
-import com.zy.asrs.service.BasSteErrService;
-import com.zy.asrs.service.BasSteService;
-import com.zy.asrs.service.LocMastService;
-import com.zy.asrs.service.WrkMastService;
-import com.zy.asrs.service.impl.MainServiceImpl;
-import com.zy.core.properties.SlaveProperties;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 绌挎杞︽帴鍙�
- * Created by vincent on 2022/3/14
- */
-@Slf4j
-@RestController
-@RequestMapping("/car")
-public class CarController {
-
-    private SlaveProperties slaveProperties;
-    @Autowired
-    private WrkMastService wrkMastService;
-    @Autowired
-    private BasSteErrService basSteErrService;
-    @Autowired
-    private BasSteService basSteService;
-    @Autowired
-    private MainServiceImpl mainService;
-    @Autowired
-    private LocMastService locMastService;
-
-
-
-}
diff --git a/src/main/java/com/zy/asrs/controller/SteController.java b/src/main/java/com/zy/asrs/controller/SteController.java
new file mode 100644
index 0000000..803842b
--- /dev/null
+++ b/src/main/java/com/zy/asrs/controller/SteController.java
@@ -0,0 +1,146 @@
+package com.zy.asrs.controller;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.annotations.ManagerAuth;
+import com.core.common.Cools;
+import com.core.common.R;
+import com.zy.asrs.domain.enums.CrnStatusType;
+import com.zy.asrs.domain.vo.SteMsgTableVo;
+import com.zy.asrs.domain.vo.SteStateTableVo;
+import com.zy.asrs.entity.BasSte;
+import com.zy.asrs.entity.WrkMast;
+import com.zy.asrs.service.BasSteService;
+import com.zy.asrs.service.WrkMastService;
+import com.zy.core.cache.OutputQueue;
+import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.SlaveType;
+import com.zy.core.model.protocol.SteProtocol;
+import com.zy.core.properties.SlaveProperties;
+import com.zy.core.thread.SteThread;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 绌挎杞︽帴鍙�
+ * Created by vincent on 2022/3/14
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ste")
+public class SteController {
+
+    @Autowired
+    private SlaveProperties slaveProperties;
+    @Autowired
+    private BasSteService basSteService;
+    @Autowired
+    private WrkMastService wrkMastService;
+
+    @PostMapping("/table/ste/state")
+    @ManagerAuth(memo = "绌挎杞︿俊鎭〃")
+    public R steStateTable(){
+        List<SteStateTableVo> list = new ArrayList<>();
+        List<BasSte> stes = basSteService.selectList(new EntityWrapper<BasSte>().orderBy("ste_no"));
+        for (BasSte basSte : stes) {
+            // 琛ㄦ牸琛�
+            SteStateTableVo vo = new SteStateTableVo();
+            vo.setSteNo(basSte.getSteNo());   //  绌挎杞﹀彿
+            list.add(vo);
+            // 鑾峰彇绌挎杞︿俊鎭�
+            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo());
+            if (steThread == null) {
+                continue;
+            }
+            SteProtocol steProtocol = steThread.getSteProtocol();
+            if (steProtocol == null) {
+                continue;
+            }
+            vo.setTaskNo(steProtocol.getTaskNo());  //  浠诲姟鍙�
+            vo.setStatusType(steProtocol.mode == 0 ? "绂荤嚎" : "鍦ㄧ嚎");   //  妯″紡鐘舵��
+            if (!Cools.isEmpty(steProtocol.getStatus())) {
+                vo.setStatus(steProtocol.getStatusType().desc);     //  鐘舵��
+            }
+            if (!Cools.isEmpty(steProtocol.getLoad())) {
+                vo.setLoading(steProtocol.getLoad()==1?"鉁�":"脳");  //  鏈夌墿
+            }
+            if (!Cools.isEmpty(steProtocol.getWaiting())) {
+                vo.setWaiting(steProtocol.getWaiting()?"鉁�":"脳");
+            }
+            vo.setRow(steProtocol.getRow());
+            vo.setBay(steProtocol.getBay());
+            vo.setLev(steProtocol.getLev());
+            vo.setCharge(steProtocol.getCharge() + "%");
+            if (!Cools.isEmpty(steProtocol.getLoca())) {
+                vo.setLoca(steProtocol.getLocaType().desc);
+            }
+            vo.setSpeed(steProtocol.getSpeed());
+            vo.setCloser(steProtocol.getCloser());
+            if (!Cools.isEmpty(steProtocol.getPos())) {
+                vo.setPos(steProtocol.getPos()==0?"浣庝綅":"楂樹綅");
+            }
+            if (!Cools.isEmpty(steProtocol.getTrack())) {
+                vo.setTrack(steProtocol.getTrack()==0?"鉁�":"脳");
+            }
+        }
+        return R.ok().add(list);
+    }
+
+    @PostMapping("/table/ste/msg")
+    @ManagerAuth(memo = "绌挎杞︽暟鎹〃")
+    public R steMsgTable(){
+        List<SteMsgTableVo> list = new ArrayList<>();
+        List<BasSte> stes = basSteService.selectList(new EntityWrapper<BasSte>().orderBy("ste_no"));
+        for (BasSte basSte : stes) {
+            // 琛ㄦ牸琛�
+            SteMsgTableVo vo = new SteMsgTableVo();
+            vo.setSteNo(basSte.getSteNo());   //  绌挎杞﹀彿
+            list.add(vo);
+            // 鑾峰彇绌挎杞︿俊鎭�
+            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo());
+            if (steThread == null) {
+                continue;
+            }
+            SteProtocol steProtocol = steThread.getSteProtocol();
+            if (steProtocol == null) {
+                continue;
+            }
+
+            vo.setWorkNo(steProtocol.getTaskNo());  //  浠诲姟鍙�
+            if (steProtocol.getTaskNo() > 0) {
+                WrkMast wrkMast = wrkMastService.selectById(steProtocol.getTaskNo());
+                if (wrkMast != null) {
+                    vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc());   //  妯″紡鐘舵��
+                    vo.setSourceStaNo(wrkMast.getSourceStaNo$());    //  婧愮珯
+                    vo.setStaNo(wrkMast.getStaNo$());   //  鐩爣绔�
+                    vo.setSourceLocNo(wrkMast.getSourceLocNo());    //  婧愬簱浣�
+                    vo.setLocNo(wrkMast.getLocNo());    //  鐩爣搴撲綅
+                }
+            } else {
+                vo.setStatus(steProtocol.mode == 1? CrnStatusType.MACHINE_AUTO.getDesc(): CrnStatusType.MACHINE_UN_AUTO.getDesc());   //  妯″紡鐘舵��
+            }
+            vo.setSpeed(steProtocol.getSpeed());  // 閫熷害
+            vo.setCloser(steProtocol.getCloser());  // 杩戠偣璺濈
+        }
+        return R.ok().add(list);
+    }
+
+    @PostMapping("/output/ste")
+    @ManagerAuth
+    public R steOutput(){
+        StringBuilder str = new StringBuilder();
+        String s;
+        int i = 0;
+        while((s = OutputQueue.STE.poll()) != null && i <=10) {
+            str.append("\n").append(s);
+            i++;
+        }
+        return R.ok().add(str.toString());
+    }
+
+}
diff --git a/src/main/java/com/zy/asrs/domain/vo/SteMsgTableVo.java b/src/main/java/com/zy/asrs/domain/vo/SteMsgTableVo.java
new file mode 100644
index 0000000..414e6b5
--- /dev/null
+++ b/src/main/java/com/zy/asrs/domain/vo/SteMsgTableVo.java
@@ -0,0 +1,48 @@
+package com.zy.asrs.domain.vo;
+
+import lombok.Data;
+
+/**
+ * Created by vincent on 2020-06-02
+ */
+@Data
+public class SteMsgTableVo {
+
+    // 绌挎杞﹀彿
+    private Integer steNo;
+
+    // 宸ヤ綔鍙�
+    private Integer workNo = 0;
+
+    // 鐘舵��
+    private String status = "-";
+
+    // 婧愮珯
+    private String sourceStaNo = "-";
+
+    // 鐩爣绔�
+    private String staNo = "-";
+
+    // 婧愬簱浣�
+    private String sourceLocNo = "-";
+
+    // 鐩爣搴撲綅
+    private String locNo = "-";
+
+    // 寮傚父
+    private String error = "";
+
+    // 鍘熺偣
+    private String origin = "";
+
+    // 鍛戒护
+    private String command = "";
+
+    // 閫熷害
+    private Double speed = 0.0D;
+
+    // 杩戠偣璺濈
+    public Double closer = 0.0D;
+
+
+}
diff --git a/src/main/java/com/zy/asrs/domain/vo/SteStateTableVo.java b/src/main/java/com/zy/asrs/domain/vo/SteStateTableVo.java
new file mode 100644
index 0000000..79ec9b7
--- /dev/null
+++ b/src/main/java/com/zy/asrs/domain/vo/SteStateTableVo.java
@@ -0,0 +1,84 @@
+package com.zy.asrs.domain.vo;
+
+import lombok.Data;
+
+/**
+ * Created by vincent on 2020-06-02
+ */
+@Data
+public class SteStateTableVo {
+
+    // 绌挎杞﹀彿
+    private Integer steNo;
+
+    // 妯″紡
+    private String statusType = "-";
+
+    // 鐘舵��
+    private String status = "-";
+
+    // 鏈夌墿
+    private String loading = "-";
+
+    /**
+     * 浠诲姟鍙�
+     */
+    public Integer taskNo;
+
+    // 姝e湪鎵ц浠诲姟
+    private String execute;
+
+    // 浠诲姟瀹屾垚锛岀瓑寰匴CS纭
+    private String waiting;
+
+    // 鎺�
+    private Short row;
+
+    // 鍒�
+    private Short bay;
+
+    // 灞�
+    private Short lev;
+
+    // 寮傚父鐮�1
+    private String alarm1 = "-";
+
+    // 寮傚父鐮�2
+    private String alarm2 = "-";
+
+    /**
+     * 鐢垫睜鐢甸噺
+     */
+    public String charge = "-";
+
+    /**
+     * 鐢垫睜棣堢數
+     */
+    public String feed = "-";
+
+    /**
+     * 褰撳墠浣嶇疆     1锛岃繎鐐癸紝2杩滅偣锛�3A鐐癸紝4B鐐�
+     */
+    public String loca = "-";
+
+    /**
+     * 杩戠偣璺濈
+     */
+    public Double closer;
+
+    /**
+     * 褰撳墠閫熷害
+     */
+    public Double speed;
+
+    /**
+     * 楂樹綆浣� 0锛屼綆浣嶏紝1楂樹綅
+     */
+    public String pos = "-";
+
+    /**
+     * 鍦ㄨ建閬撲笂 0涓嶅湪锛�1鍦�
+     */
+    public String track = "-";
+
+}
diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java
index 7ce7369..950398b 100644
--- a/src/main/java/com/zy/core/ServerBootstrap.java
+++ b/src/main/java/com/zy/core/ServerBootstrap.java
@@ -87,7 +87,7 @@
         log.info("鍒濆鍖栫┛姊溅绾跨▼...................................................");
         for (SteSlave crn : slaveProperties.getSte()) {
             SteThread steThread = new SteThread(crn);
-            new Thread((Runnable) steThread).start();
+            new Thread(steThread).start();
             SlaveConnection.put(SlaveType.Ste, crn.getId(), steThread);
         }
         // 鍒濆鍖栬緭閫佺嚎绾跨▼
diff --git a/src/main/java/com/zy/core/cache/OutputQueue.java b/src/main/java/com/zy/core/cache/OutputQueue.java
index 63205e7..b8bf8fa 100644
--- a/src/main/java/com/zy/core/cache/OutputQueue.java
+++ b/src/main/java/com/zy/core/cache/OutputQueue.java
@@ -15,4 +15,7 @@
     public static ArrayBlockingQueue<String> DEVP = new ArrayBlockingQueue<>(32);
     // 鏉$爜鍣ㄨ緭鍑烘棩蹇�
     public static ArrayBlockingQueue<JSONObject> BARCODE = new ArrayBlockingQueue<>(32);
+    // 绌挎杞﹁緭鍑烘棩蹇�
+    public static ArrayBlockingQueue<String> STE = new ArrayBlockingQueue<>(32);
+
 }
diff --git a/src/main/java/com/zy/core/enums/SteStatusType.java b/src/main/java/com/zy/core/enums/SteStatusType.java
index a611f75..6c3fa55 100644
--- a/src/main/java/com/zy/core/enums/SteStatusType.java
+++ b/src/main/java/com/zy/core/enums/SteStatusType.java
@@ -5,7 +5,7 @@
     IDLE(0, "绌洪棽"),
     MOVING(1, "浣滀笟涓�"),
     SOS(2, "鎶ヨ"),
-    OFF_LINE(-1, "绂荤嚎"),
+    OFF_LINE(-1, "鏈煡"),
     ;
 
     public Integer id;
diff --git a/src/main/java/com/zy/core/model/protocol/SteProtocol.java b/src/main/java/com/zy/core/model/protocol/SteProtocol.java
index 8b0c9d6..90f2103 100644
--- a/src/main/java/com/zy/core/model/protocol/SteProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/SteProtocol.java
@@ -34,6 +34,11 @@
     public SteStatusType statusType;
 
     /**
+     * 浠诲姟鍙�
+     */
+    public Integer taskNo = 0;
+
+    /**
      * 姝e湪鎵ц浠诲姟
      */
     public Boolean execute;
@@ -58,7 +63,7 @@
     /**
      * 鐢垫睜鐢甸噺
      */
-    public Float charge;
+    public Float charge = 0.0F;
 
     /**
      * 婊$數
@@ -75,7 +80,6 @@
      */
     public Short feed;
 
-
     /**
      * 褰撳墠浣嶇疆     1锛岃繎鐐癸紝2杩滅偣锛�3A鐐癸紝4B鐐�
      */
@@ -91,7 +95,7 @@
     /**
      * 褰撳墠閫熷害
      */
-    public Double speed;
+    public Double speed = 0.0D;
 
     /**
      * 楂樹綆浣� 0锛屼綆浣嶏紝1楂樹綅
@@ -107,11 +111,6 @@
      * 鍦ㄨ建閬撲笂 0涓嶅湪锛�1鍦�
      */
     public Short track;
-
-    /**
-     * 浠诲姟鍙�
-     */
-    public Integer taskNo = 0;
 
     /**
      * 浠诲姟绫诲瀷
diff --git a/src/main/java/com/zy/core/thread/SteThread.java b/src/main/java/com/zy/core/thread/SteThread.java
index db370d0..1ba98de 100644
--- a/src/main/java/com/zy/core/thread/SteThread.java
+++ b/src/main/java/com/zy/core/thread/SteThread.java
@@ -108,10 +108,10 @@
         OperateResult connect = siemensS7Net.ConnectServer();
         if(connect.IsSuccess){
             result = true;
-            OutputQueue.CRN.offer(MessageFormat.format( "銆恵0}銆戠┛姊溅plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format( "銆恵0}銆戠┛姊溅plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.info("绌挎杞lc杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
         } else {
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戠┛姊溅plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆戠┛姊溅plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.error("绌挎杞lc杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
             initSte();
         }
@@ -169,7 +169,7 @@
                 steProtocol.setCrnStopFork(siemensS7Net.getByteTransform().TransInt16(result.Content, 40));
                 steProtocol.setCrnAllowRun(siemensS7Net.getByteTransform().TransInt16(result.Content, 42));
 
-                OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
+                OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
 
                 // 澶嶄綅淇″彿
                 if (steProtocol.getWaiting()) {
@@ -194,12 +194,12 @@
 
                 }
             } else {
-                OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆憑1}绌挎杞lc鐘舵�佷俊鎭け璐�",DateUtils.convert(new Date()), slave.getId()));
+                OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆憑1}绌挎杞lc鐘舵�佷俊鎭け璐�",DateUtils.convert(new Date()), slave.getId()));
                 throw new CoolException(MessageFormat.format( "绌挎杞lc鐘舵�佷俊鎭け璐� ===>> [id:{0}] [ip:{1}] [port:{2}]", slave.getId(), slave.getIp(), slave.getPort()));
             }
         } catch (Exception e) {
             e.printStackTrace();
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栫┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆戣鍙栫┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.error("璇诲彇绌挎杞lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
             initSte();
         }
@@ -296,10 +296,10 @@
             }
 
             log.info("绌挎杞﹀懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
             return true;
         } else {
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝啓鍏ョ┛姊溅plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆戝啓鍏ョ┛姊溅plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.error("鍐欏叆绌挎杞lc鏁版嵁澶辫触 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
             return false;
         }
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 1d1b9ac..c829b47 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -75,22 +75,20 @@
     port: 502
     rack: 0
     slot: 0
-    # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
-    demo: false
-    # 绌挎杞﹀叆搴撶珯鐐�
-    steInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 100
-      row: 2
-      bay: 1
-      lev: 1
-    # 绌挎杞﹀嚭搴撶珯鐐�
-    steOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 101
-      row: 3
-      bay: 1
-      lev: 1
+  # 绌挎杞�2
+  ste[1]:
+    id: 2
+    ip: 10.10.10.11
+    port: 502
+    rack: 0
+    slot: 0
+  # 绌挎杞�3
+  ste[2]:
+    id: 3
+    ip: 10.10.10.12
+    port: 502
+    rack: 0
+    slot: 0
   # 杈撻�佺嚎
   devp[0]:
     id: 1
diff --git a/src/main/webapp/views/ste.html b/src/main/webapp/views/ste.html
index 9734584..0c3da80 100644
--- a/src/main/webapp/views/ste.html
+++ b/src/main/webapp/views/ste.html
@@ -96,9 +96,8 @@
                                 <th>鎺�</th>
                                 <th>鍒�</th>
                                 <th>灞�</th>
-                                <th>璐у弶瀹氫綅</th>
-                                <th>杞借揣鍙板畾浣�</th>
-                                <th>璧拌鍦ㄥ畾浣�</th>
+                                <th>绛夊緟WCS纭</th>
+                                <th>瀹氫綅</th>
                                 <th>鎶ヨ淇℃伅1</th>
                                 <th>鎶ヨ淇℃伅2</th>
                             </tr>
@@ -114,20 +113,14 @@
                     <thead>
                         <tr>
                             <th>绌挎杞�</th>
-                            <th>浠诲姟鍙�</th>
-                            <th>浠诲姟绫诲瀷</th>
-                            <th>褰撳墠浣嶇疆</th>
+                            <th>宸ヤ綔鍙�</th>
+                            <th>鐘舵��</th>
+                            <th>婧愮珯</th>
+                            <th>鐩爣绔�</th>
+                            <th>婧愬簱浣�</th>
+                            <th>鐩爣搴撲綅</th>
+                            <th>閫熷害</th>
                             <th>杩戠偣璺濈</th>
-                            <th>褰撳墠閫熷害</th>
-                            <th>楂樹綆浣�</th>
-                            <th>杩囪处鎸囦护浠诲姟鍙�</th>
-                            <th>杩囪处鎸囦护鐘舵��</th>
-                            <th>鐩樼偣鏁伴噺</th>
-                            <th>绌挎鏉垮氨缁�</th>
-                            <th>鍏呯數妗╁彿</th>
-                            <th>鍫嗗灈鏈鸿繍琛�</th>
-                            <th>鍫嗗灈鏈轰几鍙�</th>
-                            <th>鍫嗗灈鏈烘惉绉�</th>
                         </tr>
                     </thead>
                     <tbody>
@@ -218,7 +211,12 @@
 
     setInterval(function () {
         getSteStateInfo()
+        getSteMsgInfo();
     },1000)
+    setInterval(function () {
+        getSteOutput();
+        operatorBlockShow();
+    },500);
 
     // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
     function operatorBlockShow() {
@@ -240,12 +238,94 @@
 
     // 绌挎杞︿俊鎭〃鑾峰彇 ---- 琛ㄤ竴
     function getSteStateInfo() {
-        let tableEl = $('ste-state-table');
+        let tableEl = $('#ste-state-table');
+        $.ajax({
+            url: baseUrl+ "/ste/table/ste/state",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    let table = res.data;
+                    if (table.length > steStateTableBlankRows && table.length !== steStateTableFullRows) {
+                        initSteStateTable(table.length-steStateTableBlankRows);
+                        steStateTableFullRows = table.length;
+                    }
+                    for (let i=1;i<=table.length;i++){
+                        let tr = tableEl.find("tr").eq(i);
+                        setVal(tr.children("td").eq(0), table[i-1].steNo);
+                        setVal(tr.children("td").eq(1), table[i-1].statusType);
+                        setVal(tr.children("td").eq(2), table[i-1].status);
+                        setVal(tr.children("td").eq(3), table[i-1].loading);
+                        setVal(tr.children("td").eq(4), table[i-1].track);
+                        setVal(tr.children("td").eq(5), table[i-1].charge);
+                        setVal(tr.children("td").eq(6), table[i-1].row);
+                        setVal(tr.children("td").eq(7), table[i-1].bay);
+                        setVal(tr.children("td").eq(8), table[i-1].lev);
+                        setVal(tr.children("td").eq(9), table[i-1].waiting);
+                        setVal(tr.children("td").eq(10), table[i-1].loca);
+                        setVal(tr.children("td").eq(11), table[i-1].alarm1);
+                        setVal(tr.children("td").eq(12), table[i-1].alarm2);
+                    }
+                } else if (res.code === 403){
+                    window.location.href = baseUrl+"/login";
+                }  else {
+                    console.log(res.msg);
+                }
+            }
+        });
     }
 
     // 绌挎杞︽暟鎹〃鑾峰彇 ---- 琛ㄤ簩
     function getSteMsgInfo() {
         let tableEl = $('#ste-msg-table');
+        $.ajax({
+            url: baseUrl+ "/ste/table/ste/msg",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    var table = res.data;
+                    if (table.length > steMsgTableBlankRows && table.length !== steMsgTableFullRows) {
+                        initSteMsgTable(table.length-steMsgTableBlankRows);
+                        steMsgTableFullRows = table.length;
+                    }
+                    for (var i=1;i<=table.length;i++){
+                        var tr = tableEl.find("tr").eq(i);
+                        setVal(tr.children("td").eq(0), table[i-1].steNo);
+                        setVal(tr.children("td").eq(1), table[i-1].workNo);
+                        setVal(tr.children("td").eq(2), table[i-1].status);
+                        setVal(tr.children("td").eq(3), table[i-1].sourceStaNo);
+                        setVal(tr.children("td").eq(4), table[i-1].staNo);
+                        setVal(tr.children("td").eq(5), table[i-1].sourceLocNo);
+                        setVal(tr.children("td").eq(6), table[i-1].locNo);
+                        setVal(tr.children("td").eq(7), table[i-1].speed);
+                        setVal(tr.children("td").eq(8), table[i-1].closer);
+                    }
+                } else if (res.code === 403){
+                    window.location.href = baseUrl+"/login";
+                }  else {
+                    console.log(res.msg);
+                }
+            }
+        });
+    }
+
+    // 绌挎杞︽棩蹇楄緭鍑� -----------------------------------------------------------------------
+    function getSteOutput() {
+        $.ajax({
+            url: baseUrl + "/ste/output/ste",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    steOutput(res.data);
+                } else if (res.code === 403) {
+                    window.location.href = baseUrl + "/login";
+                } else {
+                    console.log(res.msg);
+                }
+            }
+        })
     }
 
     // ------------------------------------------------------------------------------------------------

--
Gitblit v1.9.1