no message
parent
b7f35ac7a6
commit
305932e79f
|
|
@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@Api(hidden = true)
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
|
||||
//@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
|
||||
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
||||
|
||||
public class AppRun {
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ public class PlcController {
|
|||
@Log("PLC扫描容器")
|
||||
@ApiOperation("PLC扫描容器")
|
||||
public ResponseEntity<Object> scanMo(@RequestBody String moJson) {
|
||||
/*S7Connector connector = S7ConnectorUtils.connect();
|
||||
S7Connector connector = S7ConnectorUtils.connect();
|
||||
if (connector == null) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "PLC连接失败", ""), HttpStatus.BAD_REQUEST);
|
||||
}*/
|
||||
}
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(moJson);
|
||||
if (json == null) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.youchain.businessdata.service.*;
|
|||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.modules.system.service.DeptService;
|
||||
import com.youchain.utils.*;
|
||||
import com.youchain.utils.BaseCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -47,8 +48,8 @@ public class MlsServiceImpl implements MlsService {
|
|||
@Override
|
||||
public String getToKen() {
|
||||
String toKen = "";
|
||||
String mlsUser = "WMS";
|
||||
String mlsPwd = "EDlsFOvn3xaJm*EH";
|
||||
String mlsUser = BaseCode.MLS_UN;
|
||||
String mlsPwd = BaseCode.MLS_PW;
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||
objMap.put("mlsUser", mlsUser);//快码代码
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.youchain.modules.quartz.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.utils.BaseCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class configTask {
|
||||
public void configBaseCode(String req) {
|
||||
JSONObject body=JSONObject.parseObject(req);
|
||||
BaseCode.MLS_PW=body.getString("MLS_PW");
|
||||
BaseCode.MLS_UN=body.getString("MLS_UN");
|
||||
BaseCode.MLS_IP=body.getString("MLS_IP");
|
||||
BaseCode.PLC_PORT=body.getIntValue("PLC_PORT");
|
||||
BaseCode.PLC_IP=body.getString("PLC_IP");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import com.youchain.modules.quartz.service.QuartzJobService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 加载配置信息
|
||||
**/
|
||||
@Component
|
||||
public class BaseCode {
|
||||
/** PLC IP*/
|
||||
public static String PLC_IP = "";
|
||||
/** PLC 端口号*/
|
||||
public static int PLC_PORT = 0;
|
||||
public static String MLS_IP = "";
|
||||
/** sap 获取token账号*/
|
||||
public static String MLS_UN="";
|
||||
/** sap 获取token账号*/
|
||||
public static String MLS_PW="";
|
||||
@Autowired
|
||||
private QuartzJobService quartzJobService;
|
||||
public BaseCode() {
|
||||
System.out.println("加载配置文件");
|
||||
}
|
||||
@PostConstruct
|
||||
public void getConfigBaseCode(){
|
||||
quartzJobService.execution(quartzJobService.findById(1l));
|
||||
}
|
||||
}
|
||||
|
|
@ -25,8 +25,8 @@ public class S7ConnectorUtils {
|
|||
try {
|
||||
s7Connector = S7ConnectorFactory
|
||||
.buildTCPConnector()
|
||||
.withHost("192.168.56.188")//设置PLC的IP地址
|
||||
.withPort(102)//设置PLC的端口号
|
||||
.withHost(BaseCode.PLC_IP)//设置PLC的IP地址
|
||||
.withPort(BaseCode.PLC_PORT)//设置PLC的端口号
|
||||
.withTimeout(10000)//设置连接超时时间
|
||||
.withRack(0)//设置PLC的机架号
|
||||
.withSlot(2)//设置PLC的插槽号
|
||||
|
|
|
|||
|
|
@ -34,13 +34,12 @@ public class UrlApi {
|
|||
/**
|
||||
* 获取ToKen
|
||||
*/
|
||||
public static String extSignIn="https://apiuat.midea.com/mls/system/extSignIn";
|
||||
public static String extSignIn="https://"+BaseCode.MLS_IP+"/mls/system/extSignIn";
|
||||
|
||||
/**
|
||||
* MLS接口
|
||||
* https://apiuat.midea.com/mls/mlsapi/public/publicApi
|
||||
* https://apisit.midea.com/mls/mlsapi/public/publicApi
|
||||
*/
|
||||
public static String publicApi="https://apisit.midea.com/mls/mlsapi/public/publicApi";
|
||||
|
||||
public static String publicApi="https://"+BaseCode.MLS_IP+"/mls/mlsapi/public/publicApi";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
server:
|
||||
port: 8010
|
||||
port: 8000
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
|
|
|||
Loading…
Reference in New Issue