@@ -1,5 +1,6 @@ | |||||
using BPA.ApolloClient; | using BPA.ApolloClient; | ||||
using BPA.Message; | using BPA.Message; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||
using System.Xml.Linq; | using System.Xml.Linq; | ||||
@@ -35,7 +36,6 @@ namespace BPASmartClient.Business | |||||
apolloUri = System.Configuration.ConfigurationManager.AppSettings["ApolloUri"].ToString(); | apolloUri = System.Configuration.ConfigurationManager.AppSettings["ApolloUri"].ToString(); | ||||
InternetInfo.OrderServer = System.Configuration.ConfigurationManager.AppSettings["OrderServiceUri"].ToString(); | InternetInfo.OrderServer = System.Configuration.ConfigurationManager.AppSettings["OrderServiceUri"].ToString(); | ||||
InternetInfo.StockServer = System.Configuration.ConfigurationManager.AppSettings["StockServiceUri"].ToString(); | InternetInfo.StockServer = System.Configuration.ConfigurationManager.AppSettings["StockServiceUri"].ToString(); | ||||
InitDeviceModel(); | InitDeviceModel(); | ||||
InitMQTT(); | InitMQTT(); | ||||
} | } | ||||
@@ -92,7 +92,6 @@ namespace BPASmartClient.Business | |||||
/// </summary> | /// </summary> | ||||
private void InitMQTT() | private void InitMQTT() | ||||
{ | { | ||||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); | IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); | ||||
configurationBuilder.AddApolloConfiguration(p => | configurationBuilder.AddApolloConfiguration(p => | ||||
{ | { | ||||
@@ -103,6 +102,7 @@ namespace BPASmartClient.Business | |||||
IConfiguration config = configurationBuilder.Build(); | IConfiguration config = configurationBuilder.Build(); | ||||
var mqttBroker = config.GetSection("BrokerHostSettings"); | var mqttBroker = config.GetSection("BrokerHostSettings"); | ||||
MQTT_Config = mqttBroker.Value.FromJSON<MQTT_Entity>(); | MQTT_Config = mqttBroker.Value.FromJSON<MQTT_Entity>(); | ||||
if (MQTT_Config == null) MessageLog.GetInstance.Show("获取配置数据为空!"); | |||||
} | } | ||||
public void Start() | public void Start() | ||||
@@ -1,5 +1,6 @@ | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPASmartClient.Helper; | using BPASmartClient.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.MQTT; | using BPASmartClient.MQTT; | ||||
using HBLConsole.Communication; | using HBLConsole.Communication; | ||||
using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||
@@ -56,6 +57,7 @@ namespace BPASmartClient.Business | |||||
{ | { | ||||
msg.Enqueue(message); | msg.Enqueue(message); | ||||
}); | }); | ||||
MessageLog.GetInstance.Show("准备连接MQTT"); | |||||
//MQTT 初始化 | //MQTT 初始化 | ||||
mqttProxy.Connect(Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config.Host, Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config.Port, | mqttProxy.Connect(Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config.Host, Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config.Port, | ||||
Guid.NewGuid().ToString()); | Guid.NewGuid().ToString()); | ||||
@@ -1,4 +1,4 @@ | |||||
//#define test | |||||
#define test | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPA.Message.Enum; | using BPA.Message.Enum; | ||||
using BPASmartClient.EventBus; | using BPASmartClient.EventBus; | ||||
@@ -127,7 +127,7 @@ namespace BPASmartClient.Business | |||||
try | try | ||||
{ | { | ||||
string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | ||||
string url = $"{InternetInfo.OrderServer}/order/robotstatuschange"; | |||||
string url = $"{InternetInfo.OrderServer}order/robotstatuschange"; | |||||
result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST); | result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST); | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -16,7 +16,9 @@ | |||||
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/> | <add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/> | ||||
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | <add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | ||||
<add key="ApolloUri" value="https://bpa.black-pa.com:28080"/> | |||||
<!--<add key="ApolloUri" value="https://bpa.black-pa.com:28080"/>--> | |||||
<add key="ApolloUri" value="http://10.2.1.21:28080"/> | |||||
<add key="OrderServiceUri" value="https://bpa.black-pa.com:21527/order/"/> | <add key="OrderServiceUri" value="https://bpa.black-pa.com:21527/order/"/> | ||||
<add key="StockServiceUri" value="https://bpa.black-pa.com:21527/stock/"/> | <add key="StockServiceUri" value="https://bpa.black-pa.com:21527/stock/"/> | ||||
@@ -27,8 +27,9 @@ | |||||
<Peripherals> | <Peripherals> | ||||
<Peripheral Module="BPASmartClient.PLC.MorksMachine"> | <Peripheral Module="BPASmartClient.PLC.MorksMachine"> | ||||
<Parameters> | <Parameters> | ||||
<IpAddress>192.168.1.11</IpAddress> | |||||
<Port>508</Port> | |||||
<!--<IpAddress>192.168.1.11</IpAddress>--> | |||||
<IpAddress>127.0.0.1</IpAddress> | |||||
<Port>502</Port> | |||||
<PLCReadAddress>M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress> | <PLCReadAddress>M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress> | ||||
</Parameters> | </Parameters> | ||||
</Peripheral> | </Peripheral> | ||||