From ef9d846de18b685d61197c73c3eab07d2b801dc1 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 23 一月 2024 16:08:30 +0800
Subject: [PATCH] 增加握手协议和增加Json文件
---
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 99 +++++++++++++++++++------------------------------
1 files changed, 39 insertions(+), 60 deletions(-)
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 019d969..0850abc 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
@@ -121,48 +121,57 @@
// 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);
- // }
- // }
+ // 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
+ // // TODO: handle exception
// }
if (S7control.getinstance().CheckConnected() == true) {
// 鑾峰彇褰撳墠鎵爜鏂瑰紡
- List<Short> Scanningmethod = S7control.getinstance().ReadWord("DB103.255", 1);
- jsonObject.append("Scanningmethod", Scanningmethod);
+
+ List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
+ if (Scanningmethods != null) {
+ for (Boolean Scanningmethod : Scanningmethods) {
+ jsonObject.append("Scanningmethod", Scanningmethod);
+ }
+ }
+
+ String CurrrentGlassId = spianService.queGlassid("DB103.256", 14).toString();
+ jsonObject.append("CurrrentGlassId", CurrrentGlassId);
+
// 鑾峰彇D01-D06,A01,A02,B01,B02鐘舵��
List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
jsonObject.append("DeviceList", DeviceList);
// 鑾峰彇D01-D06,A01,A02,B01,B02鐜荤拑id
List<String> GlassIdList = new ArrayList<String>();
- GlassIdList.add(spianService.queGlassid("DB103.40", 14).toString());
+ GlassIdList.add(spianService.queGlassid("DB103.44", 14).toString());
GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
@@ -255,36 +264,6 @@
for (Boolean emergencystop : emergencystops) {
jsonObject.append("emergencystop", emergencystop);
}
-
- // // 缁堟缁х画鎸夐挳
- // List<String> niuanaddressList3 =
- // Arrays.asList(config.getProperty("Parameter2.stop").split(","));
- // List<Boolean> anniuread =
- // S7control.getinstance().readBits(niuanaddressList3);
- // // Boolean[] value4 = { false, false};
- // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
- // Boolean[] value5 = { true };
- // List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
- // short[] anniuparams = new short[anniuread.size()];
- // for (int i = 0; i < anniuread.size(); i++) {
- // boolean value = anniuread.get(i);
- // anniuparams[i] = value ? (short) 1 : (short) 0;
- // }
-
- // short[] resets2 = new short[resets.size()];
- // for (int i = 0; i < resets.size(); i++) {
- // boolean value = resets.get(i);
- // resets2[i] = value ? (short) 1 : (short) 0;
- // }
-
- // for (short number : resets2) {
-
- // if (number == 1) {
- // jsonObject.append("Abort", anniuparams);
-
- // }
-
- // }
}
storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
--
Gitblit v1.8.0