From 28ded8102d83cf74bc232d1cdfc89b7f22c41952 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 03 十二月 2024 09:09:31 +0800
Subject: [PATCH] 增加点击防抖事件 增加笼子使用详情的计算优化。 增加数据推送时的报错处理 测量台交互逻辑增加 参数界面增加翻转加减速度

---
 springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java |  208 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 207 insertions(+), 1 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 c7a5a08..6f8a991 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
@@ -1,6 +1,7 @@
 package com.example.springboot.controller;
 
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -16,11 +17,17 @@
 import com.example.springboot.service.OutSliceServive;
 import com.example.springboot.service.SpianService;
 import com.example.springboot.service.StorageCageService;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+
+import cn.hutool.core.lang.Console;
 
 import com.example.springboot.common.Result;
 import com.example.springboot.component.Plchome;
 import com.example.springboot.component.S7control;
 import com.example.springboot.entity.CarPosition;
+import com.example.springboot.entity.GlassInfo;
 import com.example.springboot.entity.StorageCage;
 import com.example.springboot.entity.alarmmg;
 import com.example.springboot.entity.north_glass_buffer1;
@@ -53,6 +60,43 @@
 
   @Autowired
   private JdbcConnections jdbcConnections;
+
+  @GetMapping("/WriteWord")
+  public Result WriteWord(String address, float value, String type) {
+
+    if ("0".equals(type)) {
+      System.err.println("鍐欏叆word" + address + "+" + value);
+      S7control.getinstance().WriteWord(address, (short) value);
+
+    } else if ("3".equals(type)) {
+      System.err.println("鍐欏叆time" + address + "+" + value);
+      S7control.getinstance().writetime(address, (long) value);
+    } else {
+      System.err.println("鍐欏叆float" + address + "+" + value);
+      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")
@@ -113,6 +157,7 @@
       map.put("message2", "500");
     } else {
       // 璋冪敤浼嶄笂鐗囧嚱鏁�
+      System.out.println("璋冪敤涓婄墖鍑芥暟");
       short results = spianService.selectAll(glassid);
       if (results == 200) {
         map.put("message2", "200");
@@ -275,7 +320,7 @@
   @PostMapping("/InsertQueueGlassId")
   public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) {
     return storageCageService.InsertQueueGlassId(id, queue);
-    
+
   }
 
   // 纭鎵爜浣嶇幓鐠冧俊鎭�
@@ -446,4 +491,165 @@
     return Result.success(map);
   }
 
+  // 鏇存敼绗煎瓙鏁伴噺
+  @PostMapping("/UpdateStroageCageByCell")
+  public Result UpdateStroageCageByCell(Integer cell, Integer num) {
+    return storageCageService.UpdateStroageCageByCells(cell, num);
+  }
+
+  @PostMapping("/AddOutGlass")
+  public Result AddOutGlass(Integer cell, Integer glasstype) {
+    return storageCageService.AddOutGlass(cell, glasstype);
+  }
+
+  // 鎵嬪姩瀹屾垚浠诲姟
+  @PostMapping("/FinishTask")
+  public Result FinishTask(Integer id) {
+    return storageCageService.FinishTask();
+  }
+
+  // 鎵嬪姩缁撴潫浠诲姟
+  @PostMapping("/TerminateTask")
+  public Result TerminateTask(Integer id) {
+    return storageCageService.TerminateTask(id);
+  }
+
+  // 鏌ヨ鐜荤拑淇℃伅
+  @PostMapping("/SelectGlassInfo")
+  public Result SelectGlassInfo(String width, String height, String thickness, String films, String tier) {
+    return storageCageService.SelectGlassInfo(width, height, thickness, films, tier);
+  }
+
+  // 娣诲姞鐜荤拑淇℃伅鍒扮瀛�
+  @PostMapping("/StorageCageAddGlass")
+  public Result StorageCageAddGlass(String cell, @RequestBody GlassInfo glassInfo) {
+    return storageCageService.StorageCageAddGlass(cell, glassInfo);
+  }
+
+  // 棰嗗彇/鏆傚仠浠诲姟
+  @PostMapping("/ClaimTasks")
+  public Result ClaimTasks(String flowcard, Integer state, Integer line) {
+    return storageCageService.ClaimTasks(flowcard, state, line);
+  }
+
+  // 淇敼鍑虹墖鏂瑰紡
+  @PostMapping("/ModeChange")
+  public Result ModeChange(String flowcard, Integer method) {
+    return storageCageService.ModeChange(flowcard, method);
+  }
+
+  // 娣诲姞鐜荤拑淇℃伅鍒版祴閲忎俊鎭�
+  @PostMapping("/UpdateQueue")
+  public Result UpdateQueue(@RequestBody GlassInfo glassInfo) {
+    return storageCageService.UpdateQueue(glassInfo);
+  }
+
+  // 浜哄伐鎷胯蛋
+  @PostMapping("/ManualTake")
+  public Result ManualTake(@RequestBody String glassInfo) {
+    return storageCageService.ManualTake(glassInfo);
+  }
+
+  // 寮�濮嬪伐绋�
+  @PostMapping("/StartChange")
+  public Result StartChange(String flowcard, Integer orderstate) {
+    return storageCageService.StartChange(flowcard, orderstate);
+  }
+
+  // 寮�濮�/鏆傚仠鍑虹墖闃熷垪
+  @PostMapping("/UpdateOutTask")
+  public Result UpdateOutTask(Integer id, Integer state) {
+    return storageCageService.UpdateOutTask(id, state);
+  }
+
+  // 閲嶆柊娴嬮噺
+  @PostMapping("/AnewMeasure")
+  public Result AnewMeasure(@RequestBody String glassInfo) {
+    return storageCageService.AnewMeasure(glassInfo);
+  }
+
+  // 瀵煎叆鏁版嵁 锛氭坊鍔犵幓鐠冧俊鎭�
+  @PostMapping("/importData")
+  public Result importData(@RequestBody List<Map> IportDataStr) {
+    return storageCageService.AddGlassinfo(IportDataStr);
+  }
+
+  // 鍒犻櫎璁㈠崟
+  @PostMapping("/deleteTasks")
+  public Result deleteTasks(@RequestBody Map num) {
+    System.out.println("鎺у埗鍣�:" + num);
+    return storageCageService.deleteTasks(num);
+  }
+
+  // 鍒犻櫎鍑虹墖闃熷垪
+  @PostMapping("/DeleteOutTask")
+  public Result DeleteOutTask(Integer id) {
+    System.out.println("鎺у埗鍣�:" + id);
+    return storageCageService.DeleteOutTask(id);
+  }
+
+  // 淇濆瓨鑶滅郴璁剧疆
+  @PostMapping("/SaveMeasure")
+  public Result SaveMeasure(String films, Integer thickness) {
+    System.out.println("鎺у埗鍣�:" + films + thickness);
+    return storageCageService.SaveMeasure(films, thickness);
+  }
+
+  @GetMapping("/writeValue")
+  public Result writeValue(String address, float value, String type) {
+
+    if ("0".equals(type)) {
+      System.err.println("鍐欏叆word" + address + "+" + value);
+      S7control.getinstance().WriteWord(address, (short) value);
+    } else if ("1".equals(type)) {
+      System.err.println("鍐欏叆float" + address + "+" + value);
+      S7control.getinstance().writeFloat32(address, value);
+    } else if ("2".equals(type)) {
+      Boolean boolvue;
+      if (value == 0) {
+        boolvue = false;
+      } else {
+        boolvue = true;
+      }
+      S7control.getinstance().WriteBit(address, boolvue);
+      System.err.println("鍐欏叆bit" + address + "+" + boolvue);
+    } else {
+      S7control.getinstance().writetime(address, (long) value);
+      System.err.println("鍐欏叆time" + address + "+" + value);
+    }
+
+    try {
+      TimeUnit.MILLISECONDS.sleep(300);
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+    }
+    // S7control.getinstance().WriteBit(address, false);
+
+    Map<String, Object> map = new HashMap<>();
+    map.put("message", "200");
+    return Result.success(map);
+  }
+
+  @GetMapping("/writeButton")
+  public Result writeButton(String address, float value, String type) {
+    String pd = String.valueOf(S7control.getinstance().ReadBits(address, 1).get(0));
+    if ("true".equals(pd)) {
+      System.err.println("鍐欏叆bit" + address + "+" + false);
+      S7control.getinstance().WriteBit(address, false);
+    } else {
+      System.err.println("鍐欏叆bit" + address + "+" + true);
+      S7control.getinstance().WriteBit(address, true);
+    }
+    if(value==0){
+    System.err.println("鍐欏叆bit" + address + "+" + false);
+    // S7control.getinstance().WriteBit(address, false);
+    }else{
+    System.err.println("鍐欏叆bit" + address + "+" + true);
+    // S7control.getinstance().WriteBit(address, true);
+    }
+
+    Map<String, Object> map = new HashMap<>();
+    map.put("message", "200");
+    return Result.success(map);
+  }
 }

--
Gitblit v1.8.0