diff --git a/op-modules/op-sap/pom.xml b/op-modules/op-sap/pom.xml
new file mode 100644
index 00000000..22ccc618
--- /dev/null
+++ b/op-modules/op-sap/pom.xml
@@ -0,0 +1,100 @@
+
+
+
+ com.op
+ op-modules
+ 0.0.1
+
+ 4.0.0
+
+ op-modules-sap
+
+
+ op-modules-sap系统模块
+
+
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${swagger.fox.version}
+
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+
+ com.op
+ op-common-datasource
+
+
+
+
+ com.op
+ op-common-datascope
+
+
+
+
+ com.op
+ op-common-log
+
+
+
+
+ com.op
+ op-common-swagger
+
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/op-modules/op-sap/src/main/java/com/op/mes/SapApplication.java b/op-modules/op-sap/src/main/java/com/op/mes/SapApplication.java
new file mode 100644
index 00000000..21ae6143
--- /dev/null
+++ b/op-modules/op-sap/src/main/java/com/op/mes/SapApplication.java
@@ -0,0 +1,23 @@
+package com.op.mes;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import com.op.common.security.annotation.EnableCustomConfig;
+import com.op.common.security.annotation.EnableRyFeignClients;
+import com.op.common.swagger.annotation.EnableCustomSwagger2;
+
+/**
+ * 系统模块
+ *
+ * @author OP
+ */
+@EnableCustomConfig
+@EnableCustomSwagger2
+@EnableRyFeignClients
+@SpringBootApplication
+public class SapApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(SapApplication.class, args);
+ System.err.println("Sap服务启动成功");
+ }
+}
diff --git a/op-modules/op-sap/src/main/java/com/op/mes/util/SAPConnUtils.java b/op-modules/op-sap/src/main/java/com/op/mes/util/SAPConnUtils.java
new file mode 100644
index 00000000..8a03efad
--- /dev/null
+++ b/op-modules/op-sap/src/main/java/com/op/mes/util/SAPConnUtils.java
@@ -0,0 +1,80 @@
+package com.op.mes.util;
+
+import com.sap.conn.jco.JCoDestination;
+import com.sap.conn.jco.JCoDestinationManager;
+import com.sap.conn.jco.JCoException;
+import com.sap.conn.jco.ext.DestinationDataProvider;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Properties;
+
+public class SAPConnUtils {
+ private static final String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL";
+
+ /**
+ * 创建SAP接口属性文件。
+ * @param name ABAP管道名称
+ * @param suffix 属性文件后缀
+ * @param properties 属性文件内容
+ */
+ private static void createDataFile(String name, String suffix, Properties properties){
+ File cfg = new File(name+"."+suffix);
+ if(cfg.exists()){
+ cfg.deleteOnExit();
+ }
+ try{
+ FileOutputStream fos = new FileOutputStream(cfg, false);
+ properties.store(fos, "for tests only !");
+ fos.close();
+ }catch (Exception e){
+ System.out.println("Create Data file fault, error msg: " + e.toString());
+ throw new RuntimeException("Unable to create the destination file " + cfg.getName(), e);
+ }
+ }
+
+ /**
+ * 初始化SAP连接
+ */
+ private static void initProperties(SapConn sapConn) {
+ Properties connectProperties = new Properties();
+ // SAP服务器
+ connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, sapConn.getJCO_ASHOST());
+ // SAP系统编号
+ connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, sapConn.getJCO_SYSNR());
+ // SAP集团
+ connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, sapConn.getJCO_CLIENT());
+ // SAP用户名
+ connectProperties.setProperty(DestinationDataProvider.JCO_USER, sapConn.getJCO_USER());
+ // SAP密码
+ connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, sapConn.getJCO_PASSWD());
+ // SAP登录语言
+ connectProperties.setProperty(DestinationDataProvider.JCO_LANG, sapConn.getJCO_LANG());
+ // 最大连接数
+ connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, sapConn.getJCO_POOL_CAPACITY());
+ // 最大连接线程
+ connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, sapConn.getJCO_PEAK_LIMIT());
+ // SAP ROUTER
+ connectProperties.setProperty(DestinationDataProvider.JCO_SAPROUTER, sapConn.getJCO_SAPROUTER());
+
+ createDataFile(ABAP_AS_POOLED, "jcoDestination", connectProperties);
+ }
+
+ /**
+ * 获取SAP连接
+ * @return SAP连接对象
+ */
+ public static JCoDestination connect(SapConn sapConn){
+ System.out.println("正在连接至SAP...");
+ JCoDestination destination = null;
+ initProperties(sapConn);
+ try {
+ destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
+ destination.ping();
+ System.out.println("已成功建立sap的连接");
+ } catch (JCoException e) {
+ System.out.println("Connect SAP fault, error msg: " + e.toString());
+ }
+ return destination;
+ }
+}
diff --git a/op-modules/op-sap/src/main/java/com/op/mes/util/SapConn.java b/op-modules/op-sap/src/main/java/com/op/mes/util/SapConn.java
new file mode 100644
index 00000000..ef13634b
--- /dev/null
+++ b/op-modules/op-sap/src/main/java/com/op/mes/util/SapConn.java
@@ -0,0 +1,125 @@
+package com.op.mes.util;
+
+public class SapConn {
+ // SAP服务器
+ private String JCO_ASHOST;
+ // SAP系统编号
+ private String JCO_SYSNR;
+ // SAP集团
+ private String JCO_CLIENT;
+ // SAP用户名
+ private String JCO_USER;
+ // SAP密码
+ private String JCO_PASSWD;
+ // SAP登录语言
+ private String JCO_LANG;
+ // 最大连接数
+ private String JCO_POOL_CAPACITY;
+ // 最大连接线程
+ private String JCO_PEAK_LIMIT;
+ // SAP ROUTER
+ private String JCO_SAPROUTER;
+
+ public SapConn(String JCO_ASHOST, String JCO_SYSNR, String JCO_CLIENT, String JCO_USER,
+ String JCO_PASSWD, String JCO_LANG, String JCO_POOL_CAPACITY, String JCO_PEAK_LIMIT,
+ String JCO_SAPROUTER) {
+ this.JCO_ASHOST = JCO_ASHOST;
+ this.JCO_SYSNR = JCO_SYSNR;
+ this.JCO_CLIENT = JCO_CLIENT;
+ this.JCO_USER = JCO_USER;
+ this.JCO_PASSWD = JCO_PASSWD;
+ this.JCO_LANG = JCO_LANG;
+ this.JCO_POOL_CAPACITY = JCO_POOL_CAPACITY;
+ this.JCO_PEAK_LIMIT = JCO_PEAK_LIMIT;
+ this.JCO_SAPROUTER = JCO_SAPROUTER;
+ }
+
+ public SapConn() {}
+
+ public String getJCO_ASHOST() {
+ return JCO_ASHOST;
+ }
+
+ public void setJCO_ASHOST(String JCO_ASHOST) {
+ this.JCO_ASHOST = JCO_ASHOST;
+ }
+
+ public String getJCO_SYSNR() {
+ return JCO_SYSNR;
+ }
+
+ public void setJCO_SYSNR(String JCO_SYSNR) {
+ this.JCO_SYSNR = JCO_SYSNR;
+ }
+
+ public String getJCO_CLIENT() {
+ return JCO_CLIENT;
+ }
+
+ public void setJCO_CLIENT(String JCO_CLIENT) {
+ this.JCO_CLIENT = JCO_CLIENT;
+ }
+
+ public String getJCO_USER() {
+ return JCO_USER;
+ }
+
+ public void setJCO_USER(String JCO_USER) {
+ this.JCO_USER = JCO_USER;
+ }
+
+ public String getJCO_PASSWD() {
+ return JCO_PASSWD;
+ }
+
+ public void setJCO_PASSWD(String JCO_PASSWD) {
+ this.JCO_PASSWD = JCO_PASSWD;
+ }
+
+ public String getJCO_LANG() {
+ return JCO_LANG;
+ }
+
+ public void setJCO_LANG(String JCO_LANG) {
+ this.JCO_LANG = JCO_LANG;
+ }
+
+ public String getJCO_POOL_CAPACITY() {
+ return JCO_POOL_CAPACITY;
+ }
+
+ public void setJCO_POOL_CAPACITY(String JCO_POOL_CAPACITY) {
+ this.JCO_POOL_CAPACITY = JCO_POOL_CAPACITY;
+ }
+
+ public String getJCO_PEAK_LIMIT() {
+ return JCO_PEAK_LIMIT;
+ }
+
+ public void setJCO_PEAK_LIMIT(String JCO_PEAK_LIMIT) {
+ this.JCO_PEAK_LIMIT = JCO_PEAK_LIMIT;
+ }
+
+ public String getJCO_SAPROUTER() {
+ return JCO_SAPROUTER;
+ }
+
+ public void setJCO_SAPROUTER(String JCO_SAPROUTER) {
+ this.JCO_SAPROUTER = JCO_SAPROUTER;
+ }
+
+ @Override
+ public String toString() {
+ return "SapConn{" +
+ "JCO_ASHOST='" + JCO_ASHOST + '\'' +
+ ", JCO_SYSNR='" + JCO_SYSNR + '\'' +
+ ", JCO_CLIENT='" + JCO_CLIENT + '\'' +
+ ", JCO_USER='" + JCO_USER + '\'' +
+ ", JCO_PASSWD='" + JCO_PASSWD + '\'' +
+ ", JCO_LANG='" + JCO_LANG + '\'' +
+ ", JCO_POOL_CAPACITY='" + JCO_POOL_CAPACITY + '\'' +
+ ", JCO_PEAK_LIMIT='" + JCO_PEAK_LIMIT + '\'' +
+ ", JCO_SAPROUTER='" + JCO_SAPROUTER + '\'' +
+ '}';
+ }
+}
diff --git a/op-modules/op-sap/src/main/java/com/op/mes/util/SapConnConfig.java b/op-modules/op-sap/src/main/java/com/op/mes/util/SapConnConfig.java
new file mode 100644
index 00000000..fb5ecd7f
--- /dev/null
+++ b/op-modules/op-sap/src/main/java/com/op/mes/util/SapConnConfig.java
@@ -0,0 +1,106 @@
+package com.op.mes.util;
+
+import com.sap.conn.jco.*;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+public class SapConnConfig {
+ static List