From e36b74525f9c7400da2d3438c5e4164622da059a Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期三, 24 一月 2024 13:14:21 +0800 Subject: [PATCH] 封装初始化方法为工具类,方便调用, getPlcParameterValues getPlcBitValues 方法codeid 按照传入参数的顺序遍历 来获取值 --- springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 61 +++++++++++++++++++----------- 1 files changed, 38 insertions(+), 23 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 4a86f46..ca448cd 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 @@ -275,16 +275,21 @@ @PostMapping("/InsertQueueGlassId") public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) { Map<String, Object> map = new HashMap<>(); + Short zhi=200; short result = homeMapper.SelectStorageByGlassId(queue.getglassId()); if (result > 0) { map.put("message", "300"); } else { - homeMapper.InsertQueueGlassId(queue, id); + if (id == 1) { // 璋冪敤浼嶅瓨鍌ㄨ繃绋� - spianService.selectAll(queue.getglassId()); + zhi=spianService.selectAll(queue.getglassId()); + if(zhi==200){ + homeMapper.InsertQueueGlassId(queue, id); + } } - map.put("message", "200"); + + map.put("message",zhi); } return Result.success(map); } @@ -330,11 +335,7 @@ // 鏍规嵁閾濇id鍒犻櫎鍑虹墖闃熷垪鐜荤拑 @PostMapping("/DeleteProductionQueueGlass") public Result DeleteProductionQueueGlass(String FrameNo) { - homeMapper.CompleteQueueByFrameNo(FrameNo); - - Map<String, Object> map = new HashMap<>(); - map.put("message", "200"); - return Result.success(map); + return outSliceServive.CompleteQueueByFrameNo(FrameNo); } // 娣诲姞閾濇id瀵瑰簲鐜荤拑鍒板嚭鐗囬槦鍒� @@ -400,8 +401,12 @@ // 鎵嬪姩鍐欏叆plc鎵爜浣嶇幓鐠僫d @PostMapping("/WriteGlassID") - public void WriteGlassID(String glassid) { + public Result WriteGlassID(String glassid) { // 鎵爜浣嶅啓鍏ョ幓鐠僫d + spianService.outmesid(glassid, "DB103.286"); + Map<String, Object> map = new HashMap<>(); + map.put("message", "200"); + return Result.success(map); } // 娓呴櫎鎸囧畾浣嶇疆id @@ -431,20 +436,30 @@ // 杞�ュ仠 @PostMapping("/SoftEmergencyStop") public Result SoftEmergencyStop(Short num) { - String position="DB101.11.3"; + String position = "DB101.11.3"; Map<String, Object> map = new HashMap<>(); - if (S7control.getinstance().CheckConnected() == true) { - S7control.getinstance().WriteBit(position, false); - try { - TimeUnit.MILLISECONDS.sleep(300); - } catch (InterruptedException e) { - e.printStackTrace(); - } - S7control.getinstance().WriteBit(position, true); - map.put("message", "200"); - } else { - map.put("message", "300"); - } - return Result.success(map); + if (S7control.getinstance().CheckConnected() == true) { + S7control.getinstance().WriteBit(position, false); + try { + TimeUnit.MILLISECONDS.sleep(300); + } catch (InterruptedException e) { + e.printStackTrace(); + } + S7control.getinstance().WriteBit(position, true); + map.put("message", "200"); + } else { + map.put("message", "300"); + } + return Result.success(map); } + + // 鍒囨崲PLC鑾峰彇浜岀淮鐮佹柟寮� + @PostMapping("/SwitchScanMethod") + public Result SwitchScanMethod(Boolean scansmethod) { + S7control.getinstance().WriteBit("DB101.11.4", scansmethod); + Map<String, Object> map = new HashMap<>(); + map.put("message", "200"); + return Result.success(map); + } + } -- Gitblit v1.8.0