From 7fac117d5b0217be53bdf7945bcfb3c1715b5bbb Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 22 一月 2024 08:28:11 +0800
Subject: [PATCH] 代码测试后更新
---
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index 54de033..b270a74 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -1,5 +1,6 @@
package com.example.springboot.component;
+import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.service.JdbcConnections;
@@ -29,7 +30,8 @@
// \\ TODO Auto-generated catch block
e.printStackTrace();
}
- if (S7control.getinstance().CheckConnected() == false) {
+
+ // if (S7control.getinstance().CheckConnected() == false) {
spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
@@ -82,6 +84,8 @@
if (outstate == true) {// 褰撳嚭鐗囪溅绌洪棽鏃�,涓斿嚭鐗囧惎鍔ㄤ负1鏃讹紝浠诲姟鍚姩鏀逛负0
if (outstate1 == true) {
S7control.getinstance().WriteWord("DB105.18", (short) 0);// 鍑虹墖浠诲姟鍚姩鏀逛负0
+ System.out.println("鍏抽棴鍚姩"+LocalDateTime.now());
+
}
}
}
@@ -99,22 +103,31 @@
// 褰撹繘鐗囧皬杞﹀畬鎴愪换鍔℃椂
if (B01backs == true) {
- // 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬� 涓�1
+ //鍒ゆ柇鏄惁姹囨姤姝g‘鐨刬d
+ int HB=spianMapper.SelectHB(B01glassid.toString());
+ if(HB>0){
+ // 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬� 涓�1
spianService.overtask(B01glassid.toString());// 瀹屾垚浠诲姟
S7control.getinstance().WriteWord("DB106.60", (short) 0);// 鎭㈠B01灏忚溅搴旂瓟鏀逛负0
boolean yingda = spianService.listbool("DB106.60");// b01姹囨姤
System.out.println("姹囨姤鏃禕01|绗�" + aaa + "娆�" + B01glassid + "搴旂瓟" + yingda);
aaa += 1;
+ }
+
}
// 褰撳嚭鐗囧皬杞﹀畬鎴愪换鍔℃椂
if (B02backs == true) {
+ //鍒ゆ柇鏄惁姹囨姤姝g‘鐨刬d
+ int HB=spianMapper.SelectHB(B02glassid.toString());
+ if(HB>0){
// 褰揃02灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负0
spianService.overtask(B02glassid.toString());// 瀹屾垚浠诲姟
S7control.getinstance().WriteWord("DB106.62", (short) 0);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负0
System.out.println("姹囨姤鏃禕02|" + B02glassid);
boolean yingda = spianService.listbool("DB106.62");// b02姹囨姤
System.out.println("姹囨姤鏃禕02|绗�" + aaa + "娆�" + B02glassid + "搴旂瓟" + yingda);
+ }
}
// 鑾峰彇DO1鏁版嵁
@@ -165,7 +178,7 @@
// 鏌ヨ鏁版嵁搴�
// 鎺ㄩ�佸埌鍓嶇
- }
+ // }
}
}
--
Gitblit v1.8.0