From 09fe50d59e2f1e2261d376eb49ad6c40301f25b4 Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期五, 10 五月 2024 16:08:59 +0800 Subject: [PATCH] 修改IP与数据库连接 --- springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java | 47 +---------------------------------------------- 1 files changed, 1 insertions(+), 46 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java index 2182ee9..93d2696 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java +++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java @@ -10,53 +10,7 @@ import java.util.List; public class PlcPositioning2 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("Positioning2"); - 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() { @@ -73,6 +27,7 @@ // System.out.println(stt); //B01鏍间綅缃� 鍦板潃璇诲彇 + List<Short> arraylist = S7control.getinstance().ReadWord("DB100.88", 10); // Short[] values1 = { 1,2, 3, 4, 5 , 11, 12,13,14,15}; -- Gitblit v1.8.0