diff --git a/business/src/main/java/com/fizz/business/comm/OPC/MessageReceiveSchedule.java b/business/src/main/java/com/fizz/business/comm/OPC/MessageReceiveSchedule.java index eccc0a6..1b2bfc8 100644 --- a/business/src/main/java/com/fizz/business/comm/OPC/MessageReceiveSchedule.java +++ b/business/src/main/java/com/fizz/business/comm/OPC/MessageReceiveSchedule.java @@ -10,7 +10,9 @@ import com.kangaroohy.milo.service.MiloService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.beanutils.BeanUtils; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -22,8 +24,9 @@ import java.util.Map; import static com.fizz.business.service.manager.OpcMessageIdsManager.*; @Slf4j -//@Component +@Component @AllArgsConstructor +@ConditionalOnProperty(prefix = "kangaroohy.milo", name = "enabled", havingValue = "true") public class MessageReceiveSchedule extends BaseSchedule { @Resource @@ -31,7 +34,7 @@ public class MessageReceiveSchedule extends BaseSchedule { @Resource private OpcReceiverHandler opcReceiverHandler; -// @Scheduled(fixedDelay = 1000) + @Scheduled(fixedDelay = 1000) public void L1L2LineMeasure() { try { diff --git a/business/src/main/java/com/fizz/business/comm/OPC/MessageSubscriptionRunner.java b/business/src/main/java/com/fizz/business/comm/OPC/MessageSubscriptionRunner.java index 989ea27..3db5332 100644 --- a/business/src/main/java/com/fizz/business/comm/OPC/MessageSubscriptionRunner.java +++ b/business/src/main/java/com/fizz/business/comm/OPC/MessageSubscriptionRunner.java @@ -13,6 +13,7 @@ import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.compress.utils.Lists; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,8 +27,9 @@ import java.util.concurrent.atomic.AtomicBoolean; import static com.fizz.business.service.manager.OpcMessageIdsManager.*; -//@Component +@Component @Slf4j +@ConditionalOnProperty(prefix = "kangaroohy.milo", name = "enabled", havingValue = "true") public class MessageSubscriptionRunner implements ApplicationRunner { @Resource @@ -87,7 +89,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner { writeMessage( msg,entryMoveIds); log.info("接收入口移动信号:从 {} 移动到 {} ", 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) { } } @@ -99,7 +101,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner { writeMessage( msg,exitCutIds); log.info("接收到出口剪切信号:剪切类型 {},剪切长度{} ", 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) { } } @@ -111,7 +113,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner { writeMessage( msg,exitMoveIds); log.info("接收出口移动信号:从 {} 移动到 {} ", 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) { } } @@ -123,7 +125,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner { writeMessage(msg,exitMoveIds); log.info("接收出口称重信号:重量 {} ", msg.getWeight()); logDataService.logInfo("TRACK","接收出口称重信号:重量 {} ", msg.getWeight()); -// opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MEASURE,msg); + opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MEASURE,msg); } catch (Exception e) { } } diff --git a/business/src/main/java/com/fizz/business/comm/OPC/OpcMessageSend.java b/business/src/main/java/com/fizz/business/comm/OPC/OpcMessageSend.java index f38ed45..3dc0614 100644 --- a/business/src/main/java/com/fizz/business/comm/OPC/OpcMessageSend.java +++ b/business/src/main/java/com/fizz/business/comm/OPC/OpcMessageSend.java @@ -8,6 +8,7 @@ import com.kangaroohy.milo.service.MiloService; import lombok.extern.log4j.Log4j2; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.compress.utils.Lists; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -18,8 +19,9 @@ import java.util.Map; import static com.fizz.business.service.manager.OpcMessageIdsManager.pdiSetupIds; -//@Service +@Service @Log4j2 +@ConditionalOnProperty(prefix = "kangaroohy.milo", name = "enabled", havingValue = "true") public class OpcMessageSend { @Resource diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 2aec294..d6004be 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -74,9 +74,9 @@ spring: port: 6379 # 数据库索引 database: 0 -# 密码 abcd1234 fe2b3cef78b74d3692909bdcbdf46331 KeLunPu123! -# password: KeLunPu123! - password: abcd1234 + # 密码 abcd1234 fe2b3cef78b74d3692909bdcbdf46331 KeLunPu123! + password: + #password: # 连接超时时间 timeout: 10s lettuce: @@ -140,10 +140,10 @@ xss: # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* - #rocketmq: - #name-server: 127.0.0.1:9876 - #producer: - #group: test +#rocketmq: + #name-server: 127.0.0.1:9876 + #producer: + #group: test springdoc: api-docs: @@ -173,7 +173,7 @@ kangaroohy: primary: default config: default: - endpoint: opc.tcp://127.0.0.1:49320 + endpoint: opc.tcp://192.168.0.196:49320 security-policy: none pool: max-idle: 5