From 689b10dd99adf31b5e2737f5c949fc5c132f8001 Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期四, 14 十二月 2023 14:04:25 +0800 Subject: [PATCH] 修改倒计时显示,添加显示急停状态,等待复位 --- springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java | 54 +++--------------------------------------------------- 1 files changed, 3 insertions(+), 51 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java index 9ec4c88..250a8a2 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java +++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java @@ -17,53 +17,7 @@ import org.apache.commons.io.FileUtils; public class PlcPositioning1 extends Thread { - String name = ""; - Integer count = 0; - public static String readFileToString(String filePath) throws IOException { - File file = new File(filePath); - return FileUtils.readFileToString(file, "UTF-8"); - } - - public void readValue() { - String str = ""; - BufferedReader bufferedReader = null; - FileInputStream fileInputStream; - try { - // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream - fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json"); - // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗� - InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8"); - // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader - bufferedReader = new BufferedReader(inputStreamReader); - String line = null; - // 灏� bufferedReader 鍐呭涓�琛屼竴琛岃祴鍊肩粰str - while ((line = bufferedReader.readLine()) != null) { - str += line; - } - - // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son - JSONObject jsonObject = new JSONObject(str); - - // 鑾峰彇json涓殑鍊� - JSONArray address = jsonObject.getJSONArray("Positioning1"); - for (int i = 0; i < address.size(); i++) { - JSONObject ress = (JSONObject) address.get(i); - - this.name = ress.getStr("name"); - this.count = ress.getInt("count"); - System.out.println("messageValues锛�" + this.name); - System.out.println("messageValues锛�" + this.count); - } - - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } @Override public void run() { @@ -74,13 +28,11 @@ } catch (InterruptedException e) { e.printStackTrace(); } -// this.readValue(); -// String PlcAddress = this.name; -// Integer Plccount = this.count; + // System.out.println(stt); //瀛樼墖鏍� 鍑虹墖鏍艰鍙� - List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 23); + List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 33); // System.out.println(arraylist); // Short[] 瀛樼墖 = { 1 }; // List<Short> 瀛樼墖1 = new ArrayList<>(Arrays.asList(瀛樼墖)); @@ -122,7 +74,7 @@ // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌 List<Short> mergedList = new ArrayList<>(); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 7; i++) { JSONArray sublist = messageArray.getJSONArray(i); for (int j = 0; j < sublist.size(); j++) { Object value = sublist.get(j); -- Gitblit v1.8.0