no message

main
bbl\baobl 2024-05-22 09:45:22 +08:00
parent b7f35ac7a6
commit 305932e79f
8 changed files with 63 additions and 12 deletions

View File

@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.RestController;
@Api(hidden = true) @Api(hidden = true)
@SpringBootApplication @SpringBootApplication
@EnableTransactionManagement @EnableTransactionManagement
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class}) //@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
@EnableJpaAuditing(auditorAwareRef = "auditorAware") @EnableJpaAuditing(auditorAwareRef = "auditorAware")
public class AppRun { public class AppRun {

View File

@ -38,10 +38,10 @@ public class PlcController {
@Log("PLC扫描容器") @Log("PLC扫描容器")
@ApiOperation("PLC扫描容器") @ApiOperation("PLC扫描容器")
public ResponseEntity<Object> scanMo(@RequestBody String moJson) { public ResponseEntity<Object> scanMo(@RequestBody String moJson) {
/*S7Connector connector = S7ConnectorUtils.connect(); S7Connector connector = S7ConnectorUtils.connect();
if (connector == null) { if (connector == null) {
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "PLC连接失败", ""), HttpStatus.BAD_REQUEST); return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "PLC连接失败", ""), HttpStatus.BAD_REQUEST);
}*/ }
try { try {
JSONObject json = JSONObject.parseObject(moJson); JSONObject json = JSONObject.parseObject(moJson);
if (json == null) { if (json == null) {

View File

@ -15,6 +15,7 @@ import com.youchain.businessdata.service.*;
import com.youchain.modules.system.domain.Dept; import com.youchain.modules.system.domain.Dept;
import com.youchain.modules.system.service.DeptService; import com.youchain.modules.system.service.DeptService;
import com.youchain.utils.*; import com.youchain.utils.*;
import com.youchain.utils.BaseCode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -47,8 +48,8 @@ public class MlsServiceImpl implements MlsService {
@Override @Override
public String getToKen() { public String getToKen() {
String toKen = ""; String toKen = "";
String mlsUser = "WMS"; String mlsUser = BaseCode.MLS_UN;
String mlsPwd = "EDlsFOvn3xaJm*EH"; String mlsPwd = BaseCode.MLS_PW;
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>()); JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
Map<String, Object> objMap = new LinkedHashMap<>(); Map<String, Object> objMap = new LinkedHashMap<>();
objMap.put("mlsUser", mlsUser);//快码代码 objMap.put("mlsUser", mlsUser);//快码代码

View File

@ -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");
}
}

View File

@ -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));
}
}

View File

@ -25,8 +25,8 @@ public class S7ConnectorUtils {
try { try {
s7Connector = S7ConnectorFactory s7Connector = S7ConnectorFactory
.buildTCPConnector() .buildTCPConnector()
.withHost("192.168.56.188")//设置PLC的IP地址 .withHost(BaseCode.PLC_IP)//设置PLC的IP地址
.withPort(102)//设置PLC的端口号 .withPort(BaseCode.PLC_PORT)//设置PLC的端口号
.withTimeout(10000)//设置连接超时时间 .withTimeout(10000)//设置连接超时时间
.withRack(0)//设置PLC的机架号 .withRack(0)//设置PLC的机架号
.withSlot(2)//设置PLC的插槽号 .withSlot(2)//设置PLC的插槽号

View File

@ -34,13 +34,12 @@ public class UrlApi {
/** /**
* ToKen * ToKen
*/ */
public static String extSignIn="https://apiuat.midea.com/mls/system/extSignIn"; public static String extSignIn="https://"+BaseCode.MLS_IP+"/mls/system/extSignIn";
/** /**
* MLS * MLS
* https://apiuat.midea.com/mls/mlsapi/public/publicApi * https://apiuat.midea.com/mls/mlsapi/public/publicApi
* https://apisit.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";
} }

View File

@ -1,12 +1,12 @@
server: server:
port: 8010 port: 8000
spring: spring:
main: main:
allow-circular-references: true allow-circular-references: true
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: prod active: dev
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data: