feat():补充opc通讯开关配置
This commit is contained in:
@@ -10,7 +10,9 @@ import com.kangaroohy.milo.service.MiloService;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@@ -22,8 +24,9 @@ import java.util.Map;
|
|||||||
import static com.fizz.business.service.manager.OpcMessageIdsManager.*;
|
import static com.fizz.business.service.manager.OpcMessageIdsManager.*;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
//@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ConditionalOnProperty(prefix = "kangaroohy.milo", name = "enabled", havingValue = "true")
|
||||||
public class MessageReceiveSchedule extends BaseSchedule {
|
public class MessageReceiveSchedule extends BaseSchedule {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -31,7 +34,7 @@ public class MessageReceiveSchedule extends BaseSchedule {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OpcReceiverHandler opcReceiverHandler;
|
private OpcReceiverHandler opcReceiverHandler;
|
||||||
// @Scheduled(fixedDelay = 1000)
|
@Scheduled(fixedDelay = 1000)
|
||||||
public void L1L2LineMeasure() {
|
public void L1L2LineMeasure() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.apache.commons.beanutils.BeanUtils;
|
|||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -26,8 +27,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
|
|
||||||
import static com.fizz.business.service.manager.OpcMessageIdsManager.*;
|
import static com.fizz.business.service.manager.OpcMessageIdsManager.*;
|
||||||
|
|
||||||
//@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ConditionalOnProperty(prefix = "kangaroohy.milo", name = "enabled", havingValue = "true")
|
||||||
public class MessageSubscriptionRunner implements ApplicationRunner {
|
public class MessageSubscriptionRunner implements ApplicationRunner {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -87,7 +89,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
|
|||||||
writeMessage( msg,entryMoveIds);
|
writeMessage( msg,entryMoveIds);
|
||||||
log.info("接收入口移动信号:从 {} 移动到 {} ", msg.getMaterialPlaceSource(), msg.getMaterialPlaceDestination());
|
log.info("接收入口移动信号:从 {} 移动到 {} ", msg.getMaterialPlaceSource(), msg.getMaterialPlaceDestination());
|
||||||
logDataService.logInfo("TRACK","接收入口移动信号:从 {} 移动到 {} ", msg.getMaterialPlaceSource(), msg.getMaterialPlaceDestination());
|
logDataService.logInfo("TRACK","接收入口移动信号:从 {} 移动到 {} ", msg.getMaterialPlaceSource(), msg.getMaterialPlaceDestination());
|
||||||
//opcReceiverHandler.onMessageReceived(OpcMessageType.ENTRY_MOVEMENT,msg);
|
opcReceiverHandler.onMessageReceived(OpcMessageType.ENTRY_MOVEMENT,msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +101,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
|
|||||||
writeMessage( msg,exitCutIds);
|
writeMessage( msg,exitCutIds);
|
||||||
log.info("接收到出口剪切信号:剪切类型 {},剪切长度{} ", msg.getCutType().toString(), msg.getCutLength());
|
log.info("接收到出口剪切信号:剪切类型 {},剪切长度{} ", msg.getCutType().toString(), msg.getCutLength());
|
||||||
logDataService.logInfo("TRACK","接收到出口剪切信号:剪切类型 {},剪切长度{} ", msg.getCutType().toString(), msg.getCutLength());
|
logDataService.logInfo("TRACK","接收到出口剪切信号:剪切类型 {},剪切长度{} ", msg.getCutType().toString(), msg.getCutLength());
|
||||||
// opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_CUT,msg);
|
opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_CUT,msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +113,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
|
|||||||
writeMessage( msg,exitMoveIds);
|
writeMessage( msg,exitMoveIds);
|
||||||
log.info("接收出口移动信号:从 {} 移动到 {} ", msg.getExSrc(), msg.getExDesc());
|
log.info("接收出口移动信号:从 {} 移动到 {} ", msg.getExSrc(), msg.getExDesc());
|
||||||
logDataService.logInfo("TRACK","接收出口移动信号:从 {} 移动到 {} ", msg.getExSrc(), msg.getExDesc());
|
logDataService.logInfo("TRACK","接收出口移动信号:从 {} 移动到 {} ", msg.getExSrc(), msg.getExDesc());
|
||||||
// opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MOVEMENT,msg);
|
opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MOVEMENT,msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +125,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
|
|||||||
writeMessage(msg,exitMoveIds);
|
writeMessage(msg,exitMoveIds);
|
||||||
log.info("接收出口称重信号:重量 {} ", msg.getWeight());
|
log.info("接收出口称重信号:重量 {} ", msg.getWeight());
|
||||||
logDataService.logInfo("TRACK","接收出口称重信号:重量 {} ", msg.getWeight());
|
logDataService.logInfo("TRACK","接收出口称重信号:重量 {} ", msg.getWeight());
|
||||||
// opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MEASURE,msg);
|
opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MEASURE,msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.kangaroohy.milo.service.MiloService;
|
|||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -18,8 +19,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
import static com.fizz.business.service.manager.OpcMessageIdsManager.pdiSetupIds;
|
import static com.fizz.business.service.manager.OpcMessageIdsManager.pdiSetupIds;
|
||||||
|
|
||||||
//@Service
|
@Service
|
||||||
@Log4j2
|
@Log4j2
|
||||||
|
@ConditionalOnProperty(prefix = "kangaroohy.milo", name = "enabled", havingValue = "true")
|
||||||
public class OpcMessageSend {
|
public class OpcMessageSend {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ spring:
|
|||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# 密码 abcd1234 fe2b3cef78b74d3692909bdcbdf46331 KeLunPu123!
|
# 密码 abcd1234 fe2b3cef78b74d3692909bdcbdf46331 KeLunPu123!
|
||||||
# password: KeLunPu123!
|
password:
|
||||||
password: abcd1234
|
#password:
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
lettuce:
|
lettuce:
|
||||||
@@ -140,10 +140,10 @@ xss:
|
|||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
#rocketmq:
|
#rocketmq:
|
||||||
#name-server: 127.0.0.1:9876
|
#name-server: 127.0.0.1:9876
|
||||||
#producer:
|
#producer:
|
||||||
#group: test
|
#group: test
|
||||||
|
|
||||||
springdoc:
|
springdoc:
|
||||||
api-docs:
|
api-docs:
|
||||||
@@ -173,7 +173,7 @@ kangaroohy:
|
|||||||
primary: default
|
primary: default
|
||||||
config:
|
config:
|
||||||
default:
|
default:
|
||||||
endpoint: opc.tcp://127.0.0.1:49320
|
endpoint: opc.tcp://192.168.0.196:49320
|
||||||
security-policy: none
|
security-policy: none
|
||||||
pool:
|
pool:
|
||||||
max-idle: 5
|
max-idle: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user