From 4c72c2172ac6573e0ce9fcc3a6402e1518723833 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 15 八月 2020 16:13:57 +0800
Subject: [PATCH] #
---
src/main/webapp/views/crn.html | 13 --
src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java | 122 +++--------------------------
src/main/java/com/zy/asrs/controller/CrnController.java | 44 +++++++----
src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java | 3
4 files changed, 46 insertions(+), 136 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/CrnController.java b/src/main/java/com/zy/asrs/controller/CrnController.java
index da1edef..bacf4b6 100644
--- a/src/main/java/com/zy/asrs/controller/CrnController.java
+++ b/src/main/java/com/zy/asrs/controller/CrnController.java
@@ -79,10 +79,10 @@
if (crnProtocol.getTaskNo()>0) {
WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo());
if (wrkMast != null) {
- vo.setStatusType(CrnStatusType.process(wrkMast.getIoType())); // 妯″紡鐘舵��
+ vo.setStatusType(CrnStatusType.process(wrkMast.getIoType()).getDesc()); // 妯″紡鐘舵��
}
} else {
- vo.setStatusType(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.AUTO: CrnStatusType.UN_AUTO); // 妯″紡鐘舵��
+ vo.setStatusType(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.AUTO.getDesc(): CrnStatusType.UN_AUTO.getDesc()); // 妯″紡鐘舵��
}
vo.setStatus(crnProtocol.getStatusType().desc); // 鐘舵��
vo.setWarn(""); // 鎶ヨ todo
@@ -100,25 +100,37 @@
@ManagerAuth(memo = "鍫嗗灈鏈烘暟鎹〃")
public R crnMsgTable(){
List<CrnMsgTableVo> list = new ArrayList<>();
- for (int i=1;i<=4;i++){
+ for (CrnSlave crn : slaveProperties.getCrn()) {
+ // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+ CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
+ if (crnThread == null) {
+ log.error("{}鍙峰爢鍨涙満杩炴帴澶辫触", crn.getId());
+ continue;
+ }
+ CrnProtocol crnProtocol = crnThread.getCrnProtocol();
+ if (crnProtocol == null) {
+ log.error("{}鍙峰爢鍨涙満杩炴帴澶辫触", crn.getId());
+ continue;
+ }
+ // 琛ㄦ牸琛�
CrnMsgTableVo vo = new CrnMsgTableVo();
- vo.setCrnNo(String.valueOf(i));
- vo.setCommand("28283E23132D23");
- vo.setError("");
- vo.setLocNo("0601812");
- vo.setOrigin("0");
- vo.setSourceLocNo("");
- vo.setSourceStaNo("0");
- vo.setStaNo("2112");
- vo.setStatus("绌洪棽");
- if (integer.get()%5 == 0) {
- vo.setWorkNo("0000");
+ vo.setCrnNo(crn.getId()); // 鍫嗗灈鏈哄彿
+ vo.setWorkNo(crnProtocol.getTaskNo()); // 浠诲姟鍙�
+ if (crnProtocol.getTaskNo()>0) {
+ WrkMast wrkMast = wrkMastService.selectById(crnProtocol.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.setWorkNo("9998");
+ vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.AUTO.getDesc(): CrnStatusType.UN_AUTO.getDesc()); // 妯″紡鐘舵��
}
list.add(vo);
+
}
- integer.getAndIncrement();
return R.ok().add(list);
}
diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java
index 35e96c8..25e5472 100644
--- a/src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java
+++ b/src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java
@@ -1,133 +1,41 @@
package com.zy.asrs.domain.vo;
+import lombok.Data;
+
/**
* Created by vincent on 2020-06-02
*/
+@Data
public class CrnMsgTableVo {
// 鍫嗗灈鏈哄彿
- private String crnNo;
-
- // 鐘舵��
- private String status;
+ private Integer crnNo;
// 宸ヤ綔鍙�
- private String workNo;
+ private Short workNo;
+
+ // 鐘舵��
+ private String status = "";
// 婧愮珯
- private String sourceStaNo;
+ private String sourceStaNo = "";
// 鐩爣绔�
- private String staNo;
+ private String staNo = "";
// 婧愬簱浣�
- private String sourceLocNo;
+ private String sourceLocNo = "";
// 鐩爣搴撲綅
- private String locNo;
+ private String locNo = "";
// 寮傚父
- private String error;
+ private String error = "";
// 鍘熺偣
- private String origin;
+ private String origin = "";
// 鍛戒护
- private String command;
+ private String command = "";
- public CrnMsgTableVo() {
- }
-
- public CrnMsgTableVo(String crnNo, String status, String workNo, String sourceStaNo, String staNo, String sourceLocNo, String locNo, String error, String origin, String command) {
- this.crnNo = crnNo;
- this.status = status;
- this.workNo = workNo;
- this.sourceStaNo = sourceStaNo;
- this.staNo = staNo;
- this.sourceLocNo = sourceLocNo;
- this.locNo = locNo;
- this.error = error;
- this.origin = origin;
- this.command = command;
- }
-
- public String getCrnNo() {
- return crnNo;
- }
-
- public void setCrnNo(String crnNo) {
- this.crnNo = crnNo;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getWorkNo() {
- return workNo;
- }
-
- public void setWorkNo(String workNo) {
- this.workNo = workNo;
- }
-
- public String getSourceStaNo() {
- return sourceStaNo;
- }
-
- public void setSourceStaNo(String sourceStaNo) {
- this.sourceStaNo = sourceStaNo;
- }
-
- public String getStaNo() {
- return staNo;
- }
-
- public void setStaNo(String staNo) {
- this.staNo = staNo;
- }
-
- public String getSourceLocNo() {
- return sourceLocNo;
- }
-
- public void setSourceLocNo(String sourceLocNo) {
- this.sourceLocNo = sourceLocNo;
- }
-
- public String getLocNo() {
- return locNo;
- }
-
- public void setLocNo(String locNo) {
- this.locNo = locNo;
- }
-
- public String getError() {
- return error;
- }
-
- public void setError(String error) {
- this.error = error;
- }
-
- public String getOrigin() {
- return origin;
- }
-
- public void setOrigin(String origin) {
- this.origin = origin;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
}
diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java
index 53f6d49..b11c90b 100644
--- a/src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java
+++ b/src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java
@@ -1,6 +1,5 @@
package com.zy.asrs.domain.vo;
-import com.zy.asrs.domain.enums.CrnStatusType;
import lombok.Data;
/**
@@ -13,7 +12,7 @@
private Integer crnNo;
// 妯″紡
- private CrnStatusType statusType;
+ private String statusType;
// 鎶ヨ
private String warn;
diff --git a/src/main/webapp/views/crn.html b/src/main/webapp/views/crn.html
index 7ba4b80..f59a72b 100644
--- a/src/main/webapp/views/crn.html
+++ b/src/main/webapp/views/crn.html
@@ -61,15 +61,12 @@
<thead>
<tr>
<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>
@@ -282,15 +279,12 @@
for (var i=1;i<=table.length;i++){
var tr = tableEl.find("tr").eq(i);
setVal(tr.children("td").eq(0), table[i-1].crnNo);
- setVal(tr.children("td").eq(1), table[i-1].status);
setVal(tr.children("td").eq(2), table[i-1].workNo);
+ setVal(tr.children("td").eq(1), 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].error);
- setVal(tr.children("td").eq(8), table[i-1].origin);
- setVal(tr.children("td").eq(9), table[i-1].command);
}
} else if (res.code === 403){
window.location.href = baseUrl+"/login";
@@ -463,9 +457,6 @@
var html = "";
for (var i = 0; i < line; i ++){
html += " <tr>\n" +
- " <td></td>\n" +
- " <td></td>\n" +
- " <td></td>\n" +
" <td></td>\n" +
" <td></td>\n" +
" <td></td>\n" +
--
Gitblit v1.9.1