From e1921a8bf98c9bd612f7093628c3a4bc7bef6e5a Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 09 四月 2024 13:56:38 +0800
Subject: [PATCH] 添加手动界面,IO界面

---
 springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
index 22af7d8..b2fa075 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -61,6 +61,39 @@
   @Autowired
   private JdbcConnections jdbcConnections;
 
+  // 鍐欏叆word
+  @GetMapping("/WriteWord")
+  public Result WriteWord(String address,float value)  {
+    System.err.println("鍐欏叆word"+address+"+"+value);
+    if(address.equals("DB10.224")||address.equals("DB10.226")||address.equals("DB10.228")||address.equals("DB10.230")){
+      
+      S7control.getinstance().WriteWord(address, (short)value);
+    }else{
+      S7control.getinstance().writeFloat32(address, value);
+    }
+    
+    Map<String, Object> map = new HashMap<>();
+    map.put("message", "200");
+    return Result.success(map);
+  }
+
+  // 鍐欏叆bit
+  @GetMapping("/WriteBit")
+  public Result WriteBit(String address,short value)  {
+    
+    boolean values;
+    if (value == 0) {
+      values=false;
+    }else{
+      values=true;
+    }
+    S7control.getinstance().WriteBit(address, values);
+    System.err.println("鍐欏叆bit"+address+"+"+values);
+    Map<String, Object> map = new HashMap<>();
+    map.put("message", "200");
+    return Result.success(map);
+  }
+
   // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛鏉冮檺
   @GetMapping("/SelectPermissionByUserName")
   public Result SelectPermissionByUserName(String username) throws SQLException {

--
Gitblit v1.8.0