diff --git a/pom.xml b/pom.xml index 6df9d6b5..7216adbf 100644 --- a/pom.xml +++ b/pom.xml @@ -943,7 +943,11 @@ nimbus-jose-jwt 6.0 - + + com.github.dathlin + HslCommunication + 3.3.0 + diff --git a/src/main/java/test/JeecgOneGUI.java b/src/main/java/test/JeecgOneGUI.java index daa39265..c2f5aa52 100644 --- a/src/main/java/test/JeecgOneGUI.java +++ b/src/main/java/test/JeecgOneGUI.java @@ -1,5 +1,10 @@ package test; +import HslCommunication.BasicFramework.SoftBasic; +import HslCommunication.Core.Types.OperateResult; +import HslCommunication.Core.Types.OperateResultExOne; +import HslCommunication.Profinet.Siemens.SiemensPLCS; +import HslCommunication.Profinet.Siemens.SiemensS7Net; import com.sap.conn.jco.JCoTable; import com.zzjee.sap.SapRFC; import org.jeecgframework.codegenerate.window.CodeWindow; @@ -21,23 +26,50 @@ import java.util.Map; public class JeecgOneGUI { public static void main(String[] args) throws ParseException { -// CodeWindow codeWindow = new CodeWindow(); -// codeWindow.pack(); -// try { -// SapRFC saprfc = SapRFC.getInstance(); -// saprfc.prepare("ZZKMES_FM_PP112"); -// saprfc.execCall(); -//// saprfc.getParamTableList() -// JCoTable tab = saprfc.getParamTableList("ES_OUTPUT"); -// System.out.print("rows:" + tab.getNumRows()); -// } catch (Exception e) { -// System.out.print(e.getMessage()); + SiemensPLCS siemensPLCS = SiemensPLCS.S200Smart; + SiemensS7Net siemensS7Net = null; + String defaultAddress = "M5.0"; + siemensS7Net = new SiemensS7Net(siemensPLCS); + siemensS7Net.setIpAddress("192.168.1.99"); + siemensS7Net.setPort(102); + OperateResult connect = siemensS7Net.ConnectServer(); + if(connect.IsSuccess){ + System.out.println("connect success"); + }else{ + System.out.println("connect error"); + } +// OperateResultExOne floatOperateResultExOne = siemensS7Net.ReadFloat(defaultAddress); +// if(floatOperateResultExOne.IsSuccess){ +// System.out.println("read success"); +// System.out.println(floatOperateResultExOne.Content); +// }else{ +// System.out.println(floatOperateResultExOne.Content); // } +// defaultAddress = "M5.0"; +// siemensS7Net.Write(defaultAddress,false); +// defaultAddress = "VD320"; +// float speed = (float) 5.00; +// siemensS7Net.Write(defaultAddress,speed); +// defaultAddress = "VD300"; +// float position = (float) -50.00;//方向 +// siemensS7Net.Write(defaultAddress,position); +// defaultAddress = "M5.0"; +// siemensS7Net.Write(defaultAddress,true); + + + + + defaultAddress = "M7.0"; + siemensS7Net.Write(defaultAddress,false); + defaultAddress = "VD420"; + float speed = (float) 5.00; + siemensS7Net.Write(defaultAddress,speed); + defaultAddress = "VD400"; + float position = (float) 50.00;//换向 + siemensS7Net.Write(defaultAddress,position); + defaultAddress = "M7.0"; + siemensS7Net.Write(defaultAddress,true); - Calendar now = DateUtils.getCalendar(); - Calendar scrq = DateUtils.parseCalendar("2021-04-05","yyyy-MM-dd"); - int rq = DateUtils.dateDiff('d',now,scrq); - System.out.println(rq); } }