From 6b8f5b27be57413aae81b3505878b71097b0751e Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 23 一月 2024 16:09:21 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java | 43 ++-
springboot-vue3/.idea/libraries/Maven__com_google_code_gson_gson_2_8_9.xml | 13
springboot-vue3/src/main/java/com/example/springboot/component/ExcelToJsonConverter.java | 86 ++++++
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 2
springboot-vue3/src/main/resources/Alarm.json | 123 ++++++++
springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java | 8
springboot-vue3/springboot-vue3.iml | 1
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 62 ++--
CanadaMes-ui/src/layout/index.vue | 3
CanadaMes-ui/src/lang/locales/zh-CN.json | 2
springboot-vue3/JsonFile/PlcSign.json | 10
springboot-vue3/JsonFile/state.json | 227 ++++++++++++++++
springboot-vue3/pom.xml | 6
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java | 176 ++++++------
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java | 19 -
springboot-vue3/JsonFile/state.xlsx | 0
CanadaMes-ui/src/views/Electrical/ServoManualone.vue | 17 +
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java | 17
18 files changed, 650 insertions(+), 165 deletions(-)
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index 0591804..51c8d80 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -173,7 +173,7 @@
"Parameter": "鍙傛暟璁剧疆",
"Action": "寮�鍏虫帶鍒�",
"Sign": "IO鐘舵��",
- "State": "璁惧鐘舵��",
+ "State": "鐘舵��",
"Alarm": "鎶ヨ淇℃伅",
"Distribute": "涓嬪彂",
"Search": "鎼滅储",
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index 0ca9cdd..25a28ce 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -131,7 +131,6 @@
// import store from '../store';
let socket;
let timer;
-
export default {
name: "Layout",
// store,
@@ -313,8 +312,8 @@
},
//45绉掑浣嶅�掓暟璁℃椂
CountDown() {
- let count = 60;
clearInterval(timer);
+ let count = 45;
timer = setInterval(
() => {
if (this.EmergencyStop == true) {
diff --git a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
index 956ea14..3eae7c3 100644
--- a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
+++ b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -801,6 +801,23 @@
}
}
+
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj2 = arr[j];
+ if (
+ obj2.button &&
+ (obj2.button.name === "鍥為浂" || obj2.button.name === "Home")
+ ) {
+ obj2.button.value = obj.huiling[0][i];
+ // console.log(obj2.button.value)
+ }
+ }
+ }
+
+
+
//鏈洖闆舵洿鏂�
jsonData2[2][3].button.value = weihuiling[0][0];
diff --git a/springboot-vue3/.idea/libraries/Maven__com_google_code_gson_gson_2_8_9.xml b/springboot-vue3/.idea/libraries/Maven__com_google_code_gson_gson_2_8_9.xml
new file mode 100644
index 0000000..f93f971
--- /dev/null
+++ b/springboot-vue3/.idea/libraries/Maven__com_google_code_gson_gson_2_8_9.xml
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+ <library name="Maven: com.google.code.gson:gson:2.8.9">
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar!/" />
+ </CLASSES>
+ <JAVADOC>
+ <root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.9/gson-2.8.9-javadoc.jar!/" />
+ </JAVADOC>
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.9/gson-2.8.9-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component>
\ No newline at end of file
diff --git a/springboot-vue3/JsonFile/PlcSign.json b/springboot-vue3/JsonFile/PlcSign.json
index 6a40941..3d1bc04 100644
--- a/springboot-vue3/JsonFile/PlcSign.json
+++ b/springboot-vue3/JsonFile/PlcSign.json
@@ -1,6 +1,6 @@
{
"plcAddressBegin":"DB100.0.0",
- "plcAddressLenght":"20",
+ "plcAddressLenght":"10",
"dataType":"bit",
"parameteInfor":[
{
@@ -29,19 +29,19 @@
},
{
"codeId": "A01A02TURNPOSVelocityAUTO",
- "addressIndex":"12"
+ "addressIndex":"7"
},
{
"codeId": "A01A02TURNPOSVelocitymanual",
- "addressIndex":"14"
+ "addressIndex":"8"
},
{
"codeId": "A01A02TRAVELPOSVelocityAUTO",
- "addressIndex":"16"
+ "addressIndex":"9"
},
{
"codeId": "DO1id",
- "addressIndex":"18"
+ "addressIndex":"10"
}
]
}
diff --git a/springboot-vue3/JsonFile/state.json b/springboot-vue3/JsonFile/state.json
new file mode 100644
index 0000000..4f5fb1e
--- /dev/null
+++ b/springboot-vue3/JsonFile/state.json
@@ -0,0 +1,227 @@
+[
+ {
+ "codeId": "D01.State",
+ "unit": "",
+ "addressIndex": "0"
+ },
+ {
+ "codeId": "D02.State",
+ "unit": "",
+ "addressIndex": "2"
+ },
+ {
+ "codeId": "B01.State",
+ "unit": "",
+ "addressIndex": "4"
+ },
+ {
+ "codeId": "B02.State",
+ "unit": "",
+ "addressIndex": "6"
+ },
+ {
+ "codeId": "A01.State",
+ "unit": "",
+ "addressIndex": "8"
+ },
+ {
+ "codeId": "A02.State",
+ "unit": "",
+ "addressIndex": "10"
+ },
+ {
+ "codeId": "D03.State",
+ "unit": "",
+ "addressIndex": "12"
+ },
+ {
+ "codeId": "D04.State",
+ "unit": "",
+ "addressIndex": "14"
+ },
+ {
+ "codeId": "D05.State",
+ "unit": "",
+ "addressIndex": "16"
+ },
+ {
+ "codeId": "D06.State",
+ "unit": "",
+ "addressIndex": "18"
+ },
+ {
+ "codeId": "A01tavelActualPosition",
+ "unit": "",
+ "addressIndex": "20"
+ },
+ {
+ "codeId": "A01turnActualangle",
+ "unit": "",
+ "addressIndex": "22"
+ },
+ {
+ "codeId": "A02tavelActualPosition",
+ "unit": "",
+ "addressIndex": "24"
+ },
+ {
+ "codeId": "A02turnActualangle",
+ "unit": "",
+ "addressIndex": "26"
+ },
+ {
+ "codeId": "B01tavelActualPosition",
+ "unit": "",
+ "addressIndex": "28"
+ },
+ {
+ "codeId": "B02tavelActualPosition",
+ "unit": "",
+ "addressIndex": "30"
+ },
+ {
+ "codeId": "A01CurrentGrid",
+ "unit": "",
+ "addressIndex": "32"
+ },
+ {
+ "codeId": "A02CurrentGrid",
+ "unit": "",
+ "addressIndex": "34"
+ },
+ {
+ "codeId": "B01CurrentGrid",
+ "unit": "",
+ "addressIndex": "36"
+ },
+ {
+ "codeId": "B01TargetGrid",
+ "unit": "",
+ "addressIndex": "38"
+ },
+ {
+ "codeId": "B02CurrentGrid",
+ "unit": "",
+ "addressIndex": "40"
+ },
+ {
+ "codeId": "B02TargetGrid",
+ "unit": "",
+ "addressIndex": "42"
+ },
+ {
+ "codeId": "D01ID",
+ "unit": "",
+ "addressIndex": "44"
+ },
+ {
+ "codeId": "D02ID",
+ "unit": "",
+ "addressIndex": "58"
+ },
+ {
+ "codeId": "D03ID",
+ "unit": "",
+ "addressIndex": "72"
+ },
+ {
+ "codeId": "D04ID",
+ "unit": "",
+ "addressIndex": "86"
+ },
+ {
+ "codeId": "D05ID",
+ "unit": "",
+ "addressIndex": "100"
+ },
+ {
+ "codeId": "D06ID",
+ "unit": "",
+ "addressIndex": "114"
+ },
+ {
+ "codeId": "A01ID1",
+ "unit": "",
+ "addressIndex": "128"
+ },
+ {
+ "codeId": "A01ID2",
+ "unit": "",
+ "addressIndex": "142"
+ },
+ {
+ "codeId": "A02ID1",
+ "unit": "",
+ "addressIndex": "156"
+ },
+ {
+ "codeId": "A02ID2",
+ "unit": "",
+ "addressIndex": "170"
+ },
+ {
+ "codeId": "B01ID1",
+ "unit": "",
+ "addressIndex": "184"
+ },
+ {
+ "codeId": "B01ID2",
+ "unit": "",
+ "addressIndex": "198"
+ },
+ {
+ "codeId": "B02ID1",
+ "unit": "",
+ "addressIndex": "212"
+ },
+ {
+ "codeId": "B02ID2",
+ "unit": "",
+ "addressIndex": "226"
+ },
+ {
+ "codeId": "A01conveyorFaultcodes",
+ "unit": "",
+ "addressIndex": "240"
+ },
+ {
+ "codeId": "A01turnservoFaultcodes",
+ "unit": "",
+ "addressIndex": "242"
+ },
+ {
+ "codeId": "A01travelservoFaultcodes",
+ "unit": "",
+ "addressIndex": "244"
+ },
+ {
+ "codeId": "A02conveyorFaultcodes",
+ "unit": "",
+ "addressIndex": "246"
+ },
+ {
+ "codeId": "A02turnservoFaultcodes",
+ "unit": "",
+ "addressIndex": "248"
+ },
+ {
+ "codeId": "A02travelservoFaultcodes",
+ "unit": "",
+ "addressIndex": "250"
+ },
+ {
+ "codeId": "B01travelservoFaultcodes",
+ "unit": "",
+ "addressIndex": "252"
+ },
+ {
+ "codeId": "B02travelservoFaultcodes",
+ "unit": "",
+ "addressIndex": "254"
+ },
+ {
+ "codeId": "",
+ "unit": "",
+ "addressIndex": ""
+ }
+]
\ No newline at end of file
diff --git a/springboot-vue3/JsonFile/state.xlsx b/springboot-vue3/JsonFile/state.xlsx
new file mode 100644
index 0000000..d52d6a6
--- /dev/null
+++ b/springboot-vue3/JsonFile/state.xlsx
Binary files differ
diff --git a/springboot-vue3/pom.xml b/springboot-vue3/pom.xml
index c4a06f2..04328bd 100644
--- a/springboot-vue3/pom.xml
+++ b/springboot-vue3/pom.xml
@@ -138,6 +138,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.8.9</version>
+ </dependency>
</dependencies>
<build>
diff --git a/springboot-vue3/springboot-vue3.iml b/springboot-vue3/springboot-vue3.iml
index 1581352..473e79f 100644
--- a/springboot-vue3/springboot-vue3.iml
+++ b/springboot-vue3/springboot-vue3.iml
@@ -182,5 +182,6 @@
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-websocket:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.github.xingshuangs:iot-communication:1.4.2" level="project" />
+ <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.9" level="project" />
</component>
</module>
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/ExcelToJsonConverter.java b/springboot-vue3/src/main/java/com/example/springboot/component/ExcelToJsonConverter.java
new file mode 100644
index 0000000..d1098ba
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/ExcelToJsonConverter.java
@@ -0,0 +1,86 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONObject;
+import com.google.gson.Gson;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class ExcelToJsonConverter {
+ public static void main(String[] args) {
+ String excelFilePath = "JsonFile/state.xlsx";
+ String sheetName = "Sheet1";
+ int addressColumnIndex = 0;
+ int nameColumnIndex = 1;
+
+ int unitColumnIndex = 2;
+ String outputFilePath = "JsonFile/state.json";
+
+ try (Workbook workbook = new HSSFWorkbook(new FileInputStream(excelFilePath))) {
+ Sheet sheet = workbook.getSheet(sheetName);
+
+ List<JSONObject> jsonList = new ArrayList<>();
+
+ Iterator<Row> rowIterator = sheet.iterator();
+ // Skip the header row
+ if (rowIterator.hasNext()) {
+ rowIterator.next();
+ }
+
+ while (rowIterator.hasNext()) {
+ Row row = rowIterator.next();
+
+ Cell nameCell = row.getCell(nameColumnIndex);
+ Cell addressCell = row.getCell(addressColumnIndex);
+ Cell unitCell = row.getCell(unitColumnIndex);
+
+ String name = nameCell.getStringCellValue();
+ String address = addressCell.getStringCellValue();
+ String unit = unitCell.getStringCellValue();
+
+ String addressIndex = extractAddressIndex(address);
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("codeId", name);
+ jsonObject.put("addressIndex", addressIndex);
+
+ jsonObject.put("unit", unit);
+
+ jsonList.add(jsonObject);
+ }
+
+ Gson gson = new Gson();
+ String jsonOutput = gson.toJson(jsonList);
+
+ try (FileWriter fileWriter = new FileWriter(outputFilePath)) {
+ fileWriter.write(jsonOutput);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static String extractAddressIndex(String address) {
+ // Assuming the address format is "DB103.DBW0" or "DB103.DBB100~DBB113"
+ if (address.startsWith("DB") && address.contains(".DBW")) {
+ int startIndex = address.indexOf(".DBW") + 4;
+ int endIndex = address.length();
+ return address.substring(startIndex, endIndex);
+ } else if (address.startsWith("DB") && address.contains(".DBB")) {
+ int startIndex2 = address.indexOf(".DBB") + 4;
+ int endIndex2 = address.indexOf("~");
+ return address.substring(startIndex2, endIndex2);
+ }
+ return "";
+ }
+
+
+}
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
index 31a404a..19d4b56 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
@@ -89,7 +89,7 @@
String addressList2 = "DB100.18";
String addressList3 = "DB100.22";
String addressList4 = "DB100.14";
-
+System.out.println(plcParameterObject.getPlcParameterValues(Autoaddresses));
@@ -108,7 +108,7 @@
JSONObject jsonObject = new JSONObject();
// new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
// new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
-System.out.println(plcParameterObject.getPlcParameterValues(addresses));
+//System.out.println(plcParameterObject.getPlcParameterValues(addresses));
jsonObject.append("params", plcParameterObject.getPlcParameterValues(addresses));
jsonObject.append("dache1", plcParameterObject.getPlcParameter("A01A02TRAVELPOSVelocityAUTO").getValue());
jsonObject.append("xiaoche", plcParameterObject.getPlcParameter("B01B02TRAVELPOSVelocityAUTO").getValue());
@@ -118,94 +118,94 @@
jsonObject.append("xiaoche2", plcParameterObject.getPlcParameter("B01B02TRAVELJOGVelocity").getValue());
ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("AutomaticParameterSetting");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.sendMessage(jsonObject.toString());
+// if (sendwServer != null) {
+// for (WebSocketServer webserver : sendwServer) {
+// webserver.sendMessage(jsonObject.toString());
// WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("AutomaticParameterSetting");
- if (webserver != null) {
- List<String> messages = webserver.getMessages();
-
-
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- String lastMessage = messages.get(messages.size() - 1);
- // System.out.println("lastMessage锛�" + lastMessage);
- JSONArray messageArray = new JSONArray(lastMessage);
-
- // 鏁村悎绗� 1 鍒� 2 涓暟缁勫苟鍘绘帀 null 鍏冪礌
- List<Short> mergedList = new ArrayList<>();
- for (int i = 0; i < 2; i++) {
- JSONArray sublist = messageArray.getJSONArray(i);
- for (int j = 0; j < sublist.size(); j++) {
- Object value = sublist.get(j);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short sValue = Short.parseShort(cleanedValue.trim());
- mergedList.add(sValue);
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- }
- System.out.println(messageArray);
- // 鍐欏叆绗竴涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList2,2);
- // 鍐欏叆绗簩涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList3,3);
- // 鍐欏叆绗笁涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList4,4);
- // 鍐欏叆绗洓涓湴鍧�
- if (!mergedList.isEmpty()) {
- S7control.getinstance().WriteWord(addressList1, mergedList);
- System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList1);
- }
-
- //List<String> waddresses1 = Arrays.asList(config.getProperty("Auto.shusong").split(","));
- String addressList22 = "DB100.8";
- String addressList33 = "DB100.12";
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
- List<Short> mergedList2 = new ArrayList<>();
- for (int i = 5; i < 8; i++) {
- JSONArray sublist = messageArray.getJSONArray(i);
- for (int j = 0; j < sublist.size(); j++) {
- Object value = sublist.get(j);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short sValue = Short.parseShort(cleanedValue.trim());
- mergedList2.add(sValue);
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- }
-
- // 鍐欏叆绗紞涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList22,8);
- // 鍐欏叆绗叚涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList33,9);
- // 鍐欏叆绗竷涓湴鍧�
- // plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index)
- if (!mergedList2.isEmpty()) {
- //S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter(Autoaddresses), mergedList2);
- // System.out.println("messageValue锛�" + mergedList2 + " written to PLC at address " + waddresses1);
- }
- // 娓呯┖娑堟伅鍒楄〃
- webserver.clearMessages();
- }
- }
- }
-
- }
- }
+// if (webserver != null) {
+// List<String> messages = webserver.getMessages();
+//
+//
+// if (!messages.isEmpty()) {
+// // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+// String lastMessage = messages.get(messages.size() - 1);
+// // System.out.println("lastMessage锛�" + lastMessage);
+// JSONArray messageArray = new JSONArray(lastMessage);
+//
+// // 鏁村悎绗� 1 鍒� 2 涓暟缁勫苟鍘绘帀 null 鍏冪礌
+// List<Short> mergedList = new ArrayList<>();
+// for (int i = 0; i < 2; i++) {
+// JSONArray sublist = messageArray.getJSONArray(i);
+// for (int j = 0; j < sublist.size(); j++) {
+// Object value = sublist.get(j);
+// if (value != null && !value.toString().equals("null")) {
+// try {
+// String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+// short sValue = Short.parseShort(cleanedValue.trim());
+// mergedList.add(sValue);
+// } catch (NumberFormatException e) {
+// // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+// System.err.println("Could not parse value: " + value);
+// }
+// }
+// }
+// }
+// System.out.println(messageArray);
+// // 鍐欏叆绗竴涓湴鍧�
+// customS7Control.WriteWordsToPLC(messageArray, addressList2,2);
+// // 鍐欏叆绗簩涓湴鍧�
+// customS7Control.WriteWordsToPLC(messageArray, addressList3,3);
+// // 鍐欏叆绗笁涓湴鍧�
+// customS7Control.WriteWordsToPLC(messageArray, addressList4,4);
+// // 鍐欏叆绗洓涓湴鍧�
+// if (!mergedList.isEmpty()) {
+// S7control.getinstance().WriteWord(addressList1, mergedList);
+// System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList1);
+// }
+//
+// //List<String> waddresses1 = Arrays.asList(config.getProperty("Auto.shusong").split(","));
+// String addressList22 = "DB100.8";
+// String addressList33 = "DB100.12";
+// if (!messages.isEmpty()) {
+// // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+// // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
+// List<Short> mergedList2 = new ArrayList<>();
+// for (int i = 5; i < 8; i++) {
+// JSONArray sublist = messageArray.getJSONArray(i);
+// for (int j = 0; j < sublist.size(); j++) {
+// Object value = sublist.get(j);
+// if (value != null && !value.toString().equals("null")) {
+// try {
+// String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+// short sValue = Short.parseShort(cleanedValue.trim());
+// mergedList2.add(sValue);
+// } catch (NumberFormatException e) {
+// // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+// System.err.println("Could not parse value: " + value);
+// }
+// }
+// }
+// }
+//
+// // 鍐欏叆绗紞涓湴鍧�
+// customS7Control.WriteWordsToPLC(messageArray, addressList22,8);
+// // 鍐欏叆绗叚涓湴鍧�
+// customS7Control.WriteWordsToPLC(messageArray, addressList33,9);
+// // 鍐欏叆绗竷涓湴鍧�
+// // plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index)
+// if (!mergedList2.isEmpty()) {
+// //S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter(Autoaddresses), mergedList2);
+// // System.out.println("messageValue锛�" + mergedList2 + " written to PLC at address " + waddresses1);
+// }
+// // 娓呯┖娑堟伅鍒楄〃
+// webserver.clearMessages();
+// }
+// }
+// }
+//
+// }
+// }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
index 458ccf8..72d225b 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
@@ -124,6 +124,32 @@
short[] combinedBinaryShortArray = PLCBooleanConverter.convertListsToBinaryShortArray(
A01readstart, A02readstart
);
+ // 鏁呴殰鍦板潃
+ List<String> waddresses3 = new ArrayList<>();
+ waddresses3.add("DB103.242");
+ waddresses3.add("DB103.248");
+
+ // 澶嶄綅鍦板潃
+ List<String> waddresses4 = new ArrayList<>();
+ waddresses4.add("DB101.3.6");
+ waddresses4.add("DB101.4.1");
+
+ // 鍥為浂鍦板潃
+ List<String> waddresses5 = new ArrayList<>();
+ waddresses5.add("DB101.3.7");
+ waddresses5.add("DB101.4.2");
+
+
+
+ List<Boolean> readreast = S7control.getinstance().readBits(waddresses4);
+ short[] reast6 = PlcManualonePosition.PLCBooleanConverter.convertListsToBinaryShortArray(readreast);
+
+
+
+ List<Boolean> readhuiling = S7control.getinstance().readBits(waddresses5);
+ short[] huiling7 = PlcManualonePosition.PLCBooleanConverter.convertListsToBinaryShortArray(readhuiling);
+
+
JSONObject jsonObject = new JSONObject();
@@ -132,6 +158,9 @@
jsonObject.append("guzhang", params2);
jsonObject.append("weihuiling", params3);
jsonObject.append("qidong", combinedBinaryShortArray);
+ jsonObject.append("fuwei", reast6);
+ jsonObject.append("huiling", huiling7);
+
// System.out.println(jsonObject);
// WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualonePosition2");
// if (sendwServer != null) {
@@ -155,20 +184,6 @@
waddresses2.add("DB100.192");
- // 鏁呴殰鍦板潃
- List<String> waddresses3 = new ArrayList<>();
- waddresses3.add("DB103.242");
- waddresses3.add("DB103.248");
-
- // 澶嶄綅鍦板潃
- List<String> waddresses4 = new ArrayList<>();
- waddresses4.add("DB101.3.6");
- waddresses4.add("DB101.4.1");
-
- // 鍥為浂鍦板潃
- List<String> waddresses5 = new ArrayList<>();
- waddresses5.add("DB101.3.7");
- waddresses5.add("DB101.4.2");
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java
index fbfba3c..787b0d2 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java
@@ -93,17 +93,20 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
- byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
- plcParameterObject.setPlcParameterList(getplcvlues);
+ // byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
+
+ byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02};
+
+ plcParameterObject.setPlcParameterList(getplcvlues);
// int index = plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddressIndex();
// S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index), (short) 100);
List<String> addresses = new ArrayList<>();
- addresses.add("conveyorVelocity(AutoFAST)");
- addresses.add("conveyorVelocity(AutoSLOW)");
- addresses.add("conveyorVelocity(Manual)");
- addresses.add("A01A02TURNJOGVelocity");
- addresses.add("A01A02TRAVELJOGVelocity");
+ addresses.add("A01A02TURNPOSVelocityAUTO");
+// addresses.add("conveyorVelocity(AutoSLOW)");
+// addresses.add("conveyorVelocity(Manual)");
+// addresses.add("A01A02TURNJOGVelocity");
+// addresses.add("A01A02TRAVELJOGVelocity");
System.out.println(plcParameterObject.getPlcParameterValues(addresses));
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
index 1388c26..e393f1c 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
@@ -141,6 +141,12 @@
A01readBstart, A01readstart, A02readsBtart, A02readstart
);
+
+ // 鍥為浂鍦板潃
+
+ List<Boolean> readhuiling = S7control.getinstance().readBits(waddresses4);
+ short[] huiling7 = PlcManualonePosition.PLCBooleanConverter.convertListsToBinaryShortArray(readhuiling);
+
// System.out.println(A01readBstart);
// 鎵�鏈夋晠闅滄寜閽浆鎹负1鍜�0
@@ -224,6 +230,8 @@
jsonObject.append("qupianid", queueid2);
jsonObject.append("fuwei", rReset);
jsonObject.append("qidong", combinedBinaryShortArray);
+ jsonObject.append("huiling", huiling7);
+
jsonObject.append("resumeTasks", resumeTask);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
index 7b334f5..2d0c98d 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -28,7 +28,7 @@
FileInputStream fileInputStream;
try {
// 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
- fileInputStream = new FileInputStream("D:/Documents/canadames/Alarm.json");
+ fileInputStream = new FileInputStream("D:/canadames/Alarm.json");
// 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
// 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index 0850abc..ba8ef60 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -122,36 +122,38 @@
// List<Short> listd17 = S7control.getinstance().ReadWord("DB17.0",10);
// String id=spianService.queGlassid("DB17.10", 14).toString();
//
- // // 閾濇绾夸氦浜�
- // try {
- // if (CurrentFrame != null) {
- // spianService.outmesid(CurrentFrame.getBarCode(), "DB17.0");
- // }
- // List<Short> framerequests = S7control.getinstance().ReadWord("閾濇id璇锋眰瀛楀湴鍧�", 1);
- // for (Short framerequest : framerequests) {
- // if (framerequest == 1) {
- // // 閾濇id
- // String franmeno = spianService.queGlassid("DB17.10", 14).toString();
- // String position;
- // try {
- // position = dbserve.SelectPositionByFrameBarcode(franmeno);
- // } catch (SQLException e) {
- // // TODO Auto-generated catch block
- // position = "0";
- // e.printStackTrace();
- // }
- // Short send;
- // if (position == "0") {
- // send = 0;
- // } else {
- // send = 1;
- // }
- // S7control.getinstance().WriteWord("閾濇缈昏浆鍙戦�佸湴鍧�", (short) send);
- // }
- // }
- // } catch (Exception e) {
- // // TODO: handle exception
- // }
+
+ // 閾濇绾夸氦浜�
+ try {
+ if (CurrentFrame != null) {
+ spianService.outmesid(CurrentFrame.getBarCode(), "DB17.0");
+ }
+
+ List<Short> framerequests = S7control.getinstance().ReadWord("閾濇id璇锋眰瀛楀湴鍧�", 1);
+ for (Short framerequest : framerequests) {
+ if (framerequest == 1) {
+ // 閾濇id
+ String franmeno = spianService.queGlassid("DB17.10", 14).toString();
+ String position;
+ try {
+ position = dbserve.SelectPositionByFrameBarcode(franmeno);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ position = "0";
+ e.printStackTrace();
+ }
+ Short send;
+ if (position == "0") {
+ send = 0;
+ } else {
+ send = 1;
+ }
+ S7control.getinstance().WriteWord("閾濇缈昏浆鍙戦�佸湴鍧�", (short) send);
+ }
+ }
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
if (S7control.getinstance().CheckConnected() == true) {
// 鑾峰彇褰撳墠鎵爜鏂瑰紡
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java
index 56a0230..5e5abc9 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java
@@ -69,14 +69,14 @@
/**
* 鏍规嵁鍙傛暟鏍囪瘑 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
*
- * @param codeid 鍙傛暟鏍囪瘑
+ * @param codeids 鍙傛暟鏍囪瘑
* @return 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
*/
public List<String> getPlcParameterValues(List<String> codeids) {
List<String> arrayList = new ArrayList();
if (plcParameterList != null) {
for (PlcParameterInfo plcParameterInfo : plcParameterList) {
- if (codeids.contains(plcParameterInfo.getCodeId().toString()))
+ if (codeids.contains(plcParameterInfo.getCodeId()))
arrayList.add(plcParameterInfo.getValue());
}
}
@@ -84,20 +84,7 @@
}
- public List<String> getPlcAddressList(String codeid) {
- List<String> addressList = new ArrayList<>();
- if (plcParameterList != null) {
- for (PlcParameterInfo plcParameterInfo : plcParameterList) {
- if (plcParameterInfo.getCodeId().equals(codeid)) {
- int plcAddress = plcParameterInfo.getPlcAddress();
- if (!addressList.contains(plcAddress)) {
- addressList.add(String.valueOf(plcAddress));
- }
- }
- }
- }
- return addressList;
- }
+
diff --git a/springboot-vue3/src/main/resources/Alarm.json b/springboot-vue3/src/main/resources/Alarm.json
index 89bf615..e6d4d0c 100644
--- a/springboot-vue3/src/main/resources/Alarm.json
+++ b/springboot-vue3/src/main/resources/Alarm.json
@@ -497,11 +497,132 @@
"type": "3",
"page": "1"
}
+ ,{
+ "name": "B02.SR right in pos error",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A01 servo turn homed",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A02 servo turn homed",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A01 servo travel homed",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A02 servo travel homed",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "B01 servo travel homed",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "B02 servo travel homed",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "resetDelay",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A01 travel Negative limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A01 travel Positive limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A01 turn up limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A01 turn down limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A02 travel Negative limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A02 travel Positive limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A02 turn up limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ } ,{
+ "name": "A02 turn down limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ },{
+ "name": "B01 travel Negative limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ },{
+ "name": "B01 travel Positive limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ },{
+ "name": "B02 travel Negative limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ },{
+ "name": "B02 travel Positive limit",
+ "value": "1",
+ "state": "1",
+ "type": "3",
+ "page": "1"
+ }
],
"address": [
{
"name": "DB104.0.0",
- "count": 71
+ "count": 91
}
]
}
\ No newline at end of file
--
Gitblit v1.8.0