From ca2a90a7f488e234363db54bb0cf784fc78dc1b5 Mon Sep 17 00:00:00 2001 From: erzhongxmu Date: Fri, 22 Dec 2023 21:50:56 +0800 Subject: [PATCH] =?UTF-8?q?PLC=20=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zzjee/plc/controller/WmsPlcController.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/zzjee/plc/controller/WmsPlcController.java b/src/main/java/com/zzjee/plc/controller/WmsPlcController.java index 1a2cd4ba..5677054d 100644 --- a/src/main/java/com/zzjee/plc/controller/WmsPlcController.java +++ b/src/main/java/com/zzjee/plc/controller/WmsPlcController.java @@ -151,7 +151,7 @@ public class WmsPlcController extends BaseController { systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); } catch (Exception e) { e.printStackTrace(); - throw new BusinessException(e.getMessage()); + throw new BusinessException(e.getMessage()); } j.setMsg(message); return j; @@ -174,11 +174,13 @@ public class WmsPlcController extends BaseController { } } catch (Exception e) { e.printStackTrace(); - throw new BusinessException(e.getMessage()); + throw new BusinessException(e.getMessage()); } j.setMsg(message); return j; } + + //U型指令运转 public void runu() { WmsPlcEntity wmsPlc = null; String hql = ""; @@ -197,6 +199,7 @@ public class WmsPlcController extends BaseController { } } + public void run(String id, String comNo, String stepNum) { System.out.println("id:" + id + ";comNo:" + comNo + ";stepNum:" + stepNum); if (stepNum.equals("0")) { @@ -217,7 +220,7 @@ public class WmsPlcController extends BaseController { } } if (wmsPlc != null) { - SiemensPLCS siemensPLCS = SiemensPLCS.S200Smart; + SiemensPLCS siemensPLCS = SiemensPLCS.S200Smart; SiemensS7Net siemensS7Net = null; siemensS7Net = new SiemensS7Net(siemensPLCS); siemensS7Net.setIpAddress(wmsPlc.getPlcIp()); @@ -236,7 +239,7 @@ public class WmsPlcController extends BaseController { String comCons = wmsPlc.getComCons(); String query01 = wmsPlc.getQuery01(); String query02 = wmsPlc.getQuery02(); - Float stepNumrun ; + Float stepNumrun; if (StringUtil.isNotEmpty(stepNum)) { stepNumrun = Float.parseFloat(stepNum); } else { @@ -284,7 +287,7 @@ public class WmsPlcController extends BaseController { } catch (Exception e) { e.printStackTrace(); } - } + } } /** @@ -331,7 +334,6 @@ public class WmsPlcController extends BaseController { systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); } catch (Exception e) { e.printStackTrace(); - message = "PLC指令添加失败"; throw new BusinessException(e.getMessage()); } j.setMsg(message); @@ -356,7 +358,6 @@ public class WmsPlcController extends BaseController { systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); } catch (Exception e) { e.printStackTrace(); - message = "PLC指令更新失败"; throw new BusinessException(e.getMessage()); } j.setMsg(message);