ソースを参照

上位机框架修改

master
pry 2年前
コミット
9cb8a9e521
39個のファイルの変更377行の追加220行の削除
  1. +3
    -2
      HBLConsole.Attribute/CircuitAttribute.cs
  2. +11
    -0
      HBLConsole.Attribute/HBLConsole.Attributes.csproj
  3. +4
    -4
      HBLConsole.Business/AlarmHelper.cs
  4. +47
    -0
      HBLConsole.Business/Devices/MORKD.cs
  5. +31
    -63
      HBLConsole.Business/Devices/MORKS.cs
  6. +7
    -7
      HBLConsole.Business/HeartbeatReport.cs
  7. +1
    -1
      HBLConsole.Business/M2MqttHelper.cs
  8. +10
    -10
      HBLConsole.Business/MessageServer/Base.cs
  9. +1
    -1
      HBLConsole.Business/ServerData.cs
  10. +47
    -0
      HBLConsole.Communication/ConnectHelper.cs
  11. +2
    -1
      HBLConsole.Communication/ModbusTcpHelper.cs
  12. +1
    -1
      HBLConsole.Communication/MqttHelper.cs
  13. +1
    -0
      HBLConsole.Factory/HBLConsole.Factory.csproj
  14. +8
    -3
      HBLConsole.Factory/SimpleFactory.cs
  15. +1
    -0
      HBLConsole.GVL/Device/MORKS.cs
  16. +13
    -4
      HBLConsole.GVL/GeneralConfig.cs
  17. +1
    -0
      HBLConsole.GVL/HBLConsole.GVL.csproj
  18. +15
    -15
      HBLConsole.GVL/InternetInfo.cs
  19. +18
    -0
      HBLConsole.Interface/IControl.cs
  20. +11
    -11
      HBLConsole.MainConsole/Main.cs
  21. +0
    -0
      HBLConsole.Model/CommunicationPar/SerialDeviceBase.cs
  22. +0
    -0
      HBLConsole.Model/CommunicationPar/TcpDeviceBase.cs
  23. +0
    -0
      HBLConsole.Model/CommunicationPar/UniversalBase.cs
  24. +25
    -0
      HBLConsole.Model/Condition.cs
  25. +24
    -0
      HBLConsole.Model/Enums/EDeviceType.cs
  26. +21
    -10
      HBLConsole.Model/ProcessConditions.cs
  27. +8
    -8
      HBLConsole.Model/ProcessData.cs
  28. +1
    -1
      HBLConsole.Service/ActionManagerment.cs
  29. +12
    -12
      HBLConsole.Service/Json.cs
  30. +6
    -0
      HBLConsole.sln
  31. +1
    -1
      HBLConsole/App.config
  32. +2
    -2
      HBLConsole/App.xaml.cs
  33. +2
    -2
      HBLConsole/DialogWindow/View/DeviceManagermentSetView.xaml.cs
  34. +7
    -7
      HBLConsole/DialogWindow/ViewModel/ListDialogViewModel.cs
  35. +1
    -1
      HBLConsole/View/DebugView.xaml
  36. +12
    -11
      HBLConsole/ViewModel/DebugViewModel.cs
  37. +6
    -27
      HBLConsole/ViewModel/DeviceManageViewModel.cs
  38. +3
    -3
      HBLConsole/ViewModel/MainViewModel.cs
  39. +13
    -12
      HBLConsole/ViewModel/ProcessMonitoringViewModel.cs

HBLConsole.GVL/CircuitAttribute.cs → HBLConsole.Attribute/CircuitAttribute.cs ファイルの表示

@@ -1,10 +1,11 @@
using System;
using HBLConsole.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HBLConsole.GVL
namespace HBLConsole.Attributes
{
[AttributeUsage(AttributeTargets.Property)]
public class CircuitAttribute : Attribute

+ 11
- 0
HBLConsole.Attribute/HBLConsole.Attributes.csproj ファイルの表示

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\HBLConsole.Model\HBLConsole.Model.csproj" />
</ItemGroup>

</Project>

+ 4
- 4
HBLConsole.Business/AlarmHelper.cs ファイルの表示

@@ -16,7 +16,7 @@ namespace HBLConsole.Business
public static AlarmHelper GetInstance => _Instance ?? (_Instance = new AlarmHelper());
private AlarmHelper()
{
Json<AlarmHzParameter>.GetInstance.Read();
Json<AlarmHzParameter>.Read();
colorValue.TryAdd(AlarmLevel.一般报警.ToString(), Color.FromArgb(1, 255, 216, 0));
colorValue.TryAdd(AlarmLevel.严重报警.ToString(), Color.FromArgb(1, 255, 0, 0));
}
@@ -67,10 +67,10 @@ namespace HBLConsole.Business
Alarms.Add(new AlarmInfo() { AlarmInfomation = AlarmInfo, date = DateTime.Now.ToString("HH:mm:ss"), AlarmLevel = alarmLevel.ToString() });

//报警频率计算
if (Json<AlarmHzParameter>.GetInstance.Base.AlarmHz.ContainsKey(AlarmInfo))
Json<AlarmHzParameter>.GetInstance.Base.AlarmHz[AlarmInfo]++;
if (Json<AlarmHzParameter>.Data.AlarmHz.ContainsKey(AlarmInfo))
Json<AlarmHzParameter>.Data.AlarmHz[AlarmInfo]++;
else
Json<AlarmHzParameter>.GetInstance.Base.AlarmHz.TryAdd(AlarmInfo, 1);
Json<AlarmHzParameter>.Data.AlarmHz.TryAdd(AlarmInfo, 1);

if (AddAction != null) AddAction(AlarmInfo);//添加报警通知
if (ChangeAction != null) ChangeAction();//更改报警通知


+ 47
- 0
HBLConsole.Business/Devices/MORKD.cs ファイルの表示

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HBLConsole.Interface;

namespace HBLConsole.Business.Devices
{
public class MORKD : IControl
{

private volatile static MORKD _Instance;
public static MORKD GetInstance => _Instance ?? (_Instance = new MORKD());
private MORKD() { }

public void DataParse<T>(T order)
{

}

public void Init()
{

}

public void Main()
{

}

public void ReadData()
{

}

public void SimOrder()
{

}

public void ConnectOk()
{

}
}
}

+ 31
- 63
HBLConsole.Business/Devices/MORKS.cs ファイルの表示

@@ -16,7 +16,7 @@ using BPA.Models;

namespace HBLConsole.Business.Devices
{
public class MORKS : IBusiness
public class MORKS : IControl
{
private volatile static MORKS _Instance;
public static MORKS GetInstance => _Instance ?? (_Instance = new MORKS());
@@ -26,47 +26,18 @@ namespace HBLConsole.Business.Devices

public void Init()
{
//Modbus TCP连接成功
ActionManagerment.GetInstance.Register(new Action(() =>
{
WriteRecipeBoms();
ReadPlcData();
DataParse();
Main();
//ResetProgram();
}), "ConnectOk");

//获取物料信息
SimpleFactory.GetInstance.GetBatchingInfo();

//Modbus Tcp 连接
//ModbusTcpHelper.GetInstance.ModbusTcpConnect("192.168.1.11", 508);
ModbusTcpHelper.GetInstance.ModbusTcpConnect("127.0.0.1");

//模拟订单
SimOrder();
Test();
Heartbeat();
MessageLog.GetInstance.Show("MORKS 设备初始化完成");
}

List<BatchingInfo> batchingInfos = new List<BatchingInfo>();

/// <summary>
/// 心跳状态
/// </summary>
private void Heartbeat()
public void ConnectOk()
{
HeartbeatReport.GetInstance.GetMessage = new Action(() =>
{
HeartbeatReport.GetInstance.deviceStatus.BatchingInfo = batchingInfos;
#if test
HeartbeatReport.GetInstance.deviceStatus.Healthy = DeviceHealthy.UnHealth;
#else
HeartbeatReport.GetInstance.deviceStatus.Healthy = mORKS.AllowRun ? DeviceHealthy.UnHealth : DeviceHealthy.Health;
#endif

});
WriteRecipeBoms();
ReadData();
Main();
//ResetProgram();
MessageLog.GetInstance.Show("MORKS 设备初始化完成");
}

/// <summary>
@@ -146,7 +117,7 @@ namespace HBLConsole.Business.Devices
/// <summary>
/// 数据读取
/// </summary>
private void ReadPlcData()
public void ReadData()
{
ThreadManagerment.GetInstance.StartLong(new Action(() =>
{
@@ -198,7 +169,7 @@ namespace HBLConsole.Business.Devices

public ushort NoodleLoc { get; set; }
public ushort BowlLoc { get; set; }
private void SimOrder()
public void SimOrder()
{
ActionManagerment.GetInstance.Register(new Action<object>((o) =>
{
@@ -228,32 +199,31 @@ namespace HBLConsole.Business.Devices
/// <summary>
/// 数据解析
/// </summary>
private void DataParse()
public void DataParse<T>(T order)
{
ActionManagerment.GetInstance.Register(new Action<object>((o) =>
if (order is MorkOrderPush morkOrderPush)
{
if (o is MorkOrderPush morkOrderPush)
foreach (var item in morkOrderPush.GoodBatchings)
{
foreach (var item in morkOrderPush.GoodBatchings)
var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
var res = Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
if (loc >= 1 && loc <= 5)
{
if (loc >= 1 && loc <= 5)
{
mORKS.RBTakeNoodleTask.Enqueue(new GVL.OrderLocInfo() { Loc = loc, SuborderId = morkOrderPush.SuborderId, BatchingId = res.BatchingId });
}
else if (loc >= 10 && loc <= 11)
{
mORKS.TakeBowlTask.Enqueue(new GVL.OrderLocInfo() { Loc = loc, SuborderId = morkOrderPush.SuborderId, RecipeNumber = (ushort)morkOrderPush.RecipeId });
}
mORKS.RBTakeNoodleTask.Enqueue(new GVL.OrderLocInfo() { Loc = loc, SuborderId = morkOrderPush.SuborderId, BatchingId = res.BatchingId });
}
else if (loc >= 10 && loc <= 11)
{
int index = Array.FindIndex(Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds.ToArray(), p => p.RecipeId == morkOrderPush.RecipeId);
index++;
mORKS.TakeBowlTask.Enqueue(new GVL.OrderLocInfo() { Loc = loc, SuborderId = morkOrderPush.SuborderId, RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 });
}
}
}
}
}), "MorksParse");
}
}

#region 临时变量
@@ -284,7 +254,7 @@ namespace HBLConsole.Business.Devices

#endregion

private void Main()
public void Main()
{
ThreadManagerment.GetInstance.StartLong(new Action(() =>
{
@@ -345,7 +315,7 @@ namespace HBLConsole.Business.Devices

if (!mORKS.TurntableInterlock)
{
var result = Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
var result = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
if (result != null)
{
foreach (var item in result)
@@ -362,7 +332,7 @@ namespace HBLConsole.Business.Devices
}
}
}
MessageLog.GetInstance.Show("缺少指定物料");
MessageLog.GetInstance.Show("转台位置缺少物料");
}
}
}
@@ -386,11 +356,9 @@ namespace HBLConsole.Business.Devices
SetTurntableLoc(orderLocInfo.Loc);
//设置倒面位置

//if (loc >= 0 && loc <= 5)
//{
CookNodelId[loc] = orderLocInfo.SuborderId;
SetFallNoodleLoc((ushort)(loc + 1));
//}
//机器人开始取面
RobotTakeNoodle();
SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
@@ -455,10 +423,10 @@ namespace HBLConsole.Business.Devices
{
SimpleFactory.GetInstance.OrderChanged(OutMealId, ORDER_STATUS.COMPLETED_TAKE);
MessageLog.GetInstance.Show($"订单【{OutMealId}】取餐完成");
var RemoveItem = Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.FirstOrDefault(p => p.OrderPush.SuborderId == OutMealId);
var RemoveItem = Json<MorkOrderPushPar>.Data.morkOrderPushes.FirstOrDefault(p => p.OrderPush.SuborderId == OutMealId);
if (RemoveItem != null)
{
Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Remove(RemoveItem);
Json<MorkOrderPushPar>.Data.morkOrderPushes.Remove(RemoveItem);
}
ResetCookComplete();
OutMealId = string.Empty;
@@ -493,7 +461,7 @@ namespace HBLConsole.Business.Devices
private void WriteRecipeBoms()
{
List<ushort> recipeBoms = new List<ushort>();
foreach (var item in Json<BatchingInfoPar>.GetInstance.Base.recipeBoms.RecipeIds)
foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds)
{
foreach (var rec in item.Recipes)
{


+ 7
- 7
HBLConsole.Business/HeartbeatReport.cs ファイルの表示

@@ -27,21 +27,21 @@ namespace HBLConsole.Business

public Action GetMessage { get; set; }

public DeviceStatus deviceStatus = new DeviceStatus();
DeviceStatus deviceStatus = new DeviceStatus();
string Topic = string.Empty;

public void Init()
{
deviceStatus.DeviceType = GeneralConfig.GetInstance.DeviceType;
deviceStatus.BatchingInfo = new List<BatchingInfo>();
deviceStatus.Healthy = DeviceHealthy.UnHealth;
Topic = TOPIC.GetInstance.GetHeatbeatTopic(GeneralConfig.GetInstance.DeviceType);
deviceStatus.DeviceType = GeneralConfig.DeviceType;
Topic = TOPIC.GetInstance.GetHeatbeatTopic(GeneralConfig.DeviceType);

ThreadManagerment.GetInstance.StartLong(new Action(() =>
{
deviceStatus.BatchingInfo = GeneralConfig.BatchingInfos;
deviceStatus.Healthy = GeneralConfig.Healthy ? DeviceHealthy.Health : DeviceHealthy.UnHealth;
if (GetMessage != null) GetMessage();
MessagePackage.ClientId = InternetInfo.GetInstance.ClientId;
MessagePackage.ClientType = GeneralConfig.GetInstance.DeviceType;
MessagePackage.ClientId = InternetInfo.ClientId;
MessagePackage.ClientType = GeneralConfig.DeviceType;
MessagePackage.MessageId = MessageID.MORK_HEART_BEAT;
MessagePackage.MessageVersion = 0x01;
MessagePackage.Timestamp = DateTime.Now;


+ 1
- 1
HBLConsole.Business/M2MqttHelper.cs ファイルの表示

@@ -52,7 +52,7 @@ namespace HBLConsole.Business

#region 报警频率显示
lowerComputerStateInfoClass.AlarmHzObj.Clear();
foreach (var item in Json<AlarmHzParameter>.GetInstance.Base.AlarmHz)
foreach (var item in Json<AlarmHzParameter>.Data.AlarmHz)
{
lowerComputerStateInfoClass.AlarmHzObj.Add(new AlarmHz() { Count = item.Value, Name = item.Key });
}


+ 10
- 10
HBLConsole.Business/MessageServer/Base.cs ファイルの表示

@@ -21,14 +21,14 @@ namespace HBLConsole.Business.MessageServer
if (orderInfo == null) return;
if (orderInfo is MorkOrderPush morkOrderpush)
{
Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Add(new OrderData()
Json<MorkOrderPushPar>.Data.morkOrderPushes.Add(new OrderData()
{
OrderStatus = ORDER_STATUS.WAIT,
IsSelected = true,
OrderPush = morkOrderpush
});
ActionManagerment.GetInstance.Send("AddOrder", morkOrderpush);
ActionManagerment.GetInstance.Send("MorksParse", morkOrderpush);
ActionManagerment.GetInstance.Send("DataParse", morkOrderpush);
}
}

@@ -42,7 +42,7 @@ namespace HBLConsole.Business.MessageServer
if (batchingInfo == null) return;
if (batchingInfo is OrderMaterialDelivery BatchingInfos)
{
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = BatchingInfos;
Json<BatchingInfoPar>.Data.orderMaterialDelivery = BatchingInfos;
MessageLog.GetInstance.Show("收到推送的物料信息");
}
}
@@ -57,18 +57,18 @@ namespace HBLConsole.Business.MessageServer
try
{
var jsondata = new { ClientId };
string header = $"[{InternetInfo.GetInstance.StockServer}/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.StockServer}/GetItemInfo";
string header = $"[{InternetInfo.StockServer}/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.ApiAddress}{InternetInfo.StockServer}/GetItemInfo";
result = APIHelper.GetInstance.HttpRequest(url, header, jsondata, RequestType.POST);
}
catch (Exception ex)
{
MessageLog.GetInstance.Show(ex.ToString());
}
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = JsonConvert.DeserializeObject<OrderMaterialDelivery>(result);
Json<BatchingInfoPar>.Data.orderMaterialDelivery = JsonConvert.DeserializeObject<OrderMaterialDelivery>(result);

MessageLog.GetInstance.Show("【物料信息】");
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery?.BatchingInfo?.ForEach(x =>
Json<BatchingInfoPar>.Data.orderMaterialDelivery?.BatchingInfo?.ForEach(x =>
{
MessageLog.GetInstance.Show($"{x.BatchingLoc}号位置:{x.BatchingCount}");
});
@@ -84,7 +84,7 @@ namespace HBLConsole.Business.MessageServer
if (recipeBomInfo == null) return;
if (recipeBomInfo is RecipeBoms recipeBom)
{
Json<BatchingInfoPar>.GetInstance.Base.recipeBoms = recipeBom;
Json<BatchingInfoPar>.Data.recipeBoms = recipeBom;
}
MessageLog.GetInstance.Show("接收到辅料信息");
}
@@ -101,8 +101,8 @@ namespace HBLConsole.Business.MessageServer
OrderStatusChange orderStatusChange = new OrderStatusChange() { CookingStatus = status, SuborderId = subOrderId };
try
{
string header = $"[{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange";
string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.ApiAddress}{InternetInfo.OrderServer}/order/robotstatuschange";
result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST);
}
catch (Exception ex)


+ 1
- 1
HBLConsole.Business/ServerData.cs ファイルの表示

@@ -31,7 +31,7 @@ namespace HBLConsole.Business
if (receives.TryDequeue(out string msg))
{
var package = BPAPackage.Deserialize(msg);
if (package?.ClientId == InternetInfo.GetInstance.ClientId)
if (package?.ClientId == InternetInfo.ClientId)
{
if (package.Message != null)
{


+ 47
- 0
HBLConsole.Communication/ConnectHelper.cs ファイルの表示

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HBLConsole.Service;
using HBLConsole.Model;

namespace HBLConsole.Communication
{
public class ConnectHelper
{

private volatile static ConnectHelper _Instance;
public static ConnectHelper GetInstance => _Instance ?? (_Instance = new ConnectHelper());
private ConnectHelper() { }

public void Init()
{
Json<CommunicationPar>.Read();
foreach (var item in Json<CommunicationPar>.Data.communicationSets)
{
if (item.IsActive)
{
switch (item.deviceType)
{
case EDeviceType.Siemens:
break;
case EDeviceType.ModbusRtu:
break;
case EDeviceType.ModbusTcp:
if (item.Device is ModbusTcp modbus)
{
ModbusTcpHelper.GetInstance.ModbusTcpConnect(modbus.IP, modbus.PortNum);
}
break;
case EDeviceType.SerialPort:
break;
default:
break;
}
}
}
}

}
}

+ 2
- 1
HBLConsole.Communication/ModbusTcpHelper.cs ファイルの表示

@@ -39,6 +39,7 @@ namespace HBLConsole.Communication
/// <param name="port">端口号,默认502</param>
public void ModbusTcpConnect(string ip, int port = 502)
{
MessageLog.GetInstance.Show($"设备【{ip}:{port}】连接中。。。。");
IPAdress = ip;
Port = port;
modbusFactory = new ModbusFactory();
@@ -46,8 +47,8 @@ namespace HBLConsole.Communication
master.Transport.ReadTimeout = 2000;//读取超时时间
master.Transport.WriteTimeout = 2000;//写入超时时间
master.Transport.Retries = 10;//重试次数

ActionManagerment.GetInstance.Send("ConnectOk");
MessageLog.GetInstance.Show($"设备【{ip}:{port}】连接成功");
}




+ 1
- 1
HBLConsole.Communication/MqttHelper.cs ファイルの表示

@@ -83,7 +83,7 @@ namespace HBLConsole.Communication
UseDisconnectedAction = new Action(() =>
{
Thread.Sleep(2000);
while (!InternetInfo.GetInstance.NetworkConnectState)
while (!InternetInfo.NetworkConnectState)
{
Thread.Sleep(2000);
}


+ 1
- 0
HBLConsole.Factory/HBLConsole.Factory.csproj ファイルの表示

@@ -6,6 +6,7 @@

<ItemGroup>
<ProjectReference Include="..\HBLConsole.Abstract\HBLConsole.Abstract.csproj" />
<ProjectReference Include="..\HBLConsole.Communication\HBLConsole.Communication.csproj" />
<ProjectReference Include="..\HBLConsole.GVL\HBLConsole.GVL.csproj" />
<ProjectReference Include="..\HBLConsole.Interface\HBLConsole.Interface.csproj" />
</ItemGroup>


+ 8
- 3
HBLConsole.Factory/SimpleFactory.cs ファイルの表示

@@ -6,6 +6,7 @@ using BPA.Message.Enum;
using HBLConsole.GVL;
using BPA.Message;
using HBLConsole.Service;
using HBLConsole.Communication;

namespace HBLConsole.Factory
{
@@ -19,7 +20,7 @@ namespace HBLConsole.Factory
public AbstractMessageServer GetAbsMessageServer => _GetAbsMessageServer ?? (_GetAbsMessageServer = GetAbstractMessageServer());
private AbstractMessageServer _GetAbsMessageServer;

private string DeviceType => GeneralConfig.GetInstance.DeviceType.ToString();
private string DeviceType => GeneralConfig.DeviceType.ToString();

public void MqttMessage(IMessage message)
{
@@ -33,7 +34,7 @@ namespace HBLConsole.Factory
/// </summary>
public void GetBatchingInfo()
{
GetAbsMessageServer.GetBatchingInfo(InternetInfo.GetInstance.ClientId);
GetAbsMessageServer.GetBatchingInfo(InternetInfo.ClientId);
}

/// <summary>
@@ -72,8 +73,12 @@ namespace HBLConsole.Factory
{
string NameSpace = "HBLConsole.Business";//Load 加载的是dll的名称,GetType获取的是全命名空间下的类
Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.Devices.{DeviceType}");
IBusiness business = (IBusiness)type?.GetProperty("GetInstance").GetValue(null);
IControl business = (IControl)type?.GetProperty("GetInstance").GetValue(null);
GetBatchingInfo();
business?.Init();
ActionManagerment.GetInstance.Register(new Action<object>((o) => { business?.DataParse(o); }), "DataParse");
ActionManagerment.GetInstance.Register(new Action(() => { business?.ConnectOk(); }), "ConnectOk");
ConnectHelper.GetInstance.Init();
}

public IGvl GetGvl()


HBLConsole.GVL/MORKS.cs → HBLConsole.GVL/Device/MORKS.cs ファイルの表示

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using HBLConsole.Interface;
using System.Collections.Concurrent;
using HBLConsole.Attributes;

namespace HBLConsole.GVL
{

+ 13
- 4
HBLConsole.GVL/GeneralConfig.cs ファイルの表示

@@ -3,18 +3,27 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Message;
using BPA.Message.Enum;

namespace HBLConsole.GVL
{
public class GeneralConfig
{
/// <summary>
/// 客户端设备类型
/// </summary>
public static DeviceClientType DeviceType { get; set; }

private volatile static GeneralConfig _Instance;
public static GeneralConfig GetInstance => _Instance ?? (_Instance = new GeneralConfig());
private GeneralConfig() { }
/// <summary>
/// 心跳上报的物料信息
/// </summary>
public static List<BatchingInfo> BatchingInfos { get; set; } = new List<BatchingInfo>();

public DeviceClientType DeviceType { get; set; }
/// <summary>
/// 心跳健康状态
/// </summary>
public static bool Healthy { get; set; }

}
}

+ 1
- 0
HBLConsole.GVL/HBLConsole.GVL.csproj ファイルの表示

@@ -13,6 +13,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\HBLConsole.Attribute\HBLConsole.Attributes.csproj" />
<ProjectReference Include="..\HBLConsole.Interface\HBLConsole.Interface.csproj" />
<ProjectReference Include="..\HBLConsole.Service\HBLConsole.Service.csproj" />
</ItemGroup>


+ 15
- 15
HBLConsole.GVL/InternetInfo.cs ファイルの表示

@@ -18,14 +18,14 @@ namespace HBLConsole.GVL
/// </summary>
public class InternetInfo
{
private volatile static InternetInfo _Instance;
public static InternetInfo GetInstance => _Instance ?? (_Instance = new InternetInfo());
private InternetInfo() { }
//private volatile static InternetInfo _Instance;
//public static InternetInfo GetInstance => _Instance ?? (_Instance = new InternetInfo());
//private InternetInfo() { }

/// <summary>
/// 配置初始化
/// </summary>
public void ConfigInit()
public static void ConfigInit()
{
NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState();
while (!NetworkConnectState)
@@ -64,43 +64,43 @@ namespace HBLConsole.GVL
/// <summary>
/// Consul 地址
/// </summary>
public string ConsulAddress { get; set; }
public static string ConsulAddress { get; set; }

/// <summary>
/// 网络连接状态
/// </summary>
public bool NetworkConnectState { get; set; }
public static bool NetworkConnectState { get; set; }

/// <summary>
/// 广告地址
/// </summary>
public Uri SorbetesAddress { get; set; }
public static Uri SorbetesAddress { get; set; }

/// <summary>
/// 客户端ID
/// </summary>
public int ClientId { get; set; }
public static int ClientId { get; set; }

#region MQTT连接信息
/// <summary>
/// mqtt 服务地址
/// </summary>
public string MqttAddress { get; set; }
public static string MqttAddress { get; set; }

/// <summary>
/// mqtt 用户名
/// </summary>
public string MqttUserName { get; set; }
public static string MqttUserName { get; set; }

/// <summary>
/// mqtt 密码
/// </summary>
public string MqttPassword { get; set; }
public static string MqttPassword { get; set; }

/// <summary>
/// mqtt 端口号
/// </summary>
public int MqttPort { get; set; }
public static int MqttPort { get; set; }
#endregion

#region API地址
@@ -108,17 +108,17 @@ namespace HBLConsole.GVL
/// <summary>
/// Api 网关地址
/// </summary>
public string ApiAddress { get; set; }
public static string ApiAddress { get; set; }

/// <summary>
/// 订单服务
/// </summary>
public string OrderServer { get; set; }
public static string OrderServer { get; set; }

/// <summary>
/// 库存服务
/// </summary>
public string StockServer { get; set; }
public static string StockServer { get; set; }
#endregion

}


+ 18
- 0
HBLConsole.Interface/IControl.cs ファイルの表示

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HBLConsole.Interface
{
public interface IControl
{
void Main();
void Init();
void ReadData();
void SimOrder();
void DataParse<T>(T order);
void ConnectOk();
}
}

+ 11
- 11
HBLConsole.MainConsole/Main.cs ファイルの表示

@@ -24,14 +24,14 @@ namespace HBLConsole.MainConsole

public void DataInit()
{
Json<MorkOrderPushPar>.GetInstance.Read();
Json<BatchingInfoPar>.GetInstance.Read();
Json<MorkOrderPushPar>.Read();
Json<BatchingInfoPar>.Read();
}

public void DataSave()
{
Json<MorkOrderPushPar>.GetInstance.Save();
Json<BatchingInfoPar>.GetInstance.Save();
Json<MorkOrderPushPar>.Save();
Json<BatchingInfoPar>.Save();
TextHelper.GetInstance.SaveLogInfo(MessageLog.GetInstance.LogInfo, "LogInfo");
}

@@ -39,11 +39,11 @@ namespace HBLConsole.MainConsole
{
ThreadManagerment.GetInstance.Start(new Action(() =>
{
InternetInfo.GetInstance.ConfigInit();//从 consul 获取配置数据
InternetInfo.ConfigInit();//从 consul 获取配置数据

Topics.Clear();
Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.GetInstance.DeviceType, InternetInfo.GetInstance.ClientId));
Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.GetInstance.DeviceType, InternetInfo.GetInstance.ClientId));
Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));
Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));

SimpleFactory.GetInstance.DeviceInit();//设备初始化

@@ -67,10 +67,10 @@ namespace HBLConsole.MainConsole
MqttHelper.GetInstance.Reconnection = new Action(() => { MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray()); });

//MQTT 连接
MqttHelper.GetInstance.MqttInitAsync(InternetInfo.GetInstance.MqttUserName,
InternetInfo.GetInstance.MqttPassword,
InternetInfo.GetInstance.MqttAddress,
InternetInfo.GetInstance.MqttPort,
MqttHelper.GetInstance.MqttInitAsync(InternetInfo.MqttUserName,
InternetInfo.MqttPassword,
InternetInfo.MqttAddress,
InternetInfo.MqttPort,
DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"));
}), "业务逻辑初始化");
}


HBLConsole.Model/SerialDeviceBase.cs → HBLConsole.Model/CommunicationPar/SerialDeviceBase.cs ファイルの表示


HBLConsole.Model/TcpDeviceBase.cs → HBLConsole.Model/CommunicationPar/TcpDeviceBase.cs ファイルの表示


HBLConsole.Model/UniversalBase.cs → HBLConsole.Model/CommunicationPar/UniversalBase.cs ファイルの表示


+ 25
- 0
HBLConsole.Model/Condition.cs ファイルの表示

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace HBLConsole.Model
{
public class Condition:ObservableObject
{
public bool ConditionMet { get { return _mConditionMet; } set { _mConditionMet = value; OnPropertyChanged(); } }
private bool _mConditionMet;

public string propertyIllustrate { get { return _mpropertyIllustrate; } set { _mpropertyIllustrate = value; OnPropertyChanged(); } }
private string _mpropertyIllustrate;

public string ToolTip { get { return _mToolTip; } set { _mToolTip = value; OnPropertyChanged(); } }
private string _mToolTip;


public bool IsNot { get; set; }

}
}

+ 24
- 0
HBLConsole.Model/Enums/EDeviceType.cs ファイルの表示

@@ -8,9 +8,33 @@ namespace HBLConsole.Model
{
public enum EDeviceType
{
/// <summary>
/// 西门子设备
/// </summary>
Siemens,
/// <summary>
/// Modbus RTU 设备
/// </summary>
ModbusRtu,
/// <summary>
/// Modbus TCP 设备
/// </summary>
ModbusTcp,
/// <summary>
/// 串口设备
/// </summary>
SerialPort,
/// <summary>
/// 博士咖啡机设备
/// </summary>
Coffee,
/// <summary>
/// 冰淇淋设备
/// </summary>
IceCream,
/// <summary>
/// 节卡机器人
/// </summary>
JAKA
}
}

+ 21
- 10
HBLConsole.Model/ProcessConditions.cs ファイルの表示

@@ -24,21 +24,32 @@ namespace HBLConsole.Model

}

public class Condition : ObservableObject
{
//public class Condition : ObservableObject
//{

public bool ConditionMet { get { return _mConditionMet; } set { _mConditionMet = value; OnPropertyChanged(); } }
private bool _mConditionMet;
// public bool ConditionMet { get { return _mConditionMet; } set { _mConditionMet = value; OnPropertyChanged(); } }
// private bool _mConditionMet;

public string ConditionName { get { return _mConditionName; } set { _mConditionName = value; OnPropertyChanged(); } }
private string _mConditionName;
// public string ConditionName { get { return _mConditionName; } set { _mConditionName = value; OnPropertyChanged(); } }
// private string _mConditionName;

public string ToolTip { get { return _mToolTip; } set { _mToolTip = value; OnPropertyChanged(); } }
private string _mToolTip;
// public string ToolTip { get { return _mToolTip; } set { _mToolTip = value; OnPropertyChanged(); } }
// private string _mToolTip;


// public bool IsNot { get; set; }
//}

//public class Condition
//{
// public bool ConditionMet { get; set; }
// public string propertyIllustrate { get; set; }

// public string ToolTip { get; set; }
// public bool IsNot { get; set; }
//}


public bool IsNot { get; set; }
}


}

HBLConsole.GVL/ProcessData.cs → HBLConsole.Model/ProcessData.cs ファイルの表示

@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;

namespace HBLConsole.GVL
namespace HBLConsole.Model
{
public class ProcessData
{
@@ -18,12 +18,12 @@ namespace HBLConsole.GVL

}

public class Condition
{
public bool ConditionMet { get; set; }
public string propertyIllustrate { get; set; }
//public class Condition
//{
// public bool ConditionMet { get; set; }
// public string propertyIllustrate { get; set; }

public string ToolTip { get; set; }
public bool IsNot { get; set; }
}
// public string ToolTip { get; set; }
// public bool IsNot { get; set; }
//}
}

+ 1
- 1
HBLConsole.Service/ActionManagerment.cs ファイルの表示

@@ -26,7 +26,7 @@ namespace HBLConsole.Service
/// 注销委托
/// </summary>
/// <param name="name"></param>
public void LogOut(string name)
public void CancelRegister(string name)
{
if (actions.ContainsKey(name))
{


+ 12
- 12
HBLConsole.Service/Json.cs ファイルの表示

@@ -10,9 +10,9 @@ namespace HBLConsole.Service
/// </summary>
public class Json<T> where T : class, new()
{
private volatile static Json<T> _Instance;
public static Json<T> GetInstance => _Instance ?? (_Instance = new Json<T>());
private Json() { }
//private volatile static Json<T> _Instance;
//public static Json<T> GetInstance => _Instance ?? (_Instance = new Json<T>());
//private Json() { }

static string path
{
@@ -23,45 +23,45 @@ namespace HBLConsole.Service
}
}

public T Base { get; set; } = new T();
public static T Data { get; set; } = new T();

/// <summary>
/// 保存数据
/// </summary>
public void Save()
public static void Save()
{
string outjson = JsonConvert.SerializeObject(Base);
string outjson = JsonConvert.SerializeObject(Data);
File.WriteAllText(path, outjson);
}

/// <summary>
/// 获取保存的数据
/// </summary>
public void Read()
public static void Read()
{
if (File.Exists(path))
{
string JsonString = File.ReadAllText(path);
var result = JsonConvert.DeserializeObject<T>(JsonString);
if (result != null) { Base = result; }
if (result != null) { Data = result; }
}
}

/// <summary>
/// 保存带接口的对象
/// </summary>
public void SaveInterface()
public static void SaveInterface()
{
var settings = new JsonSerializerSettings();
settings.TypeNameHandling = TypeNameHandling.Objects;
string outjson = JsonConvert.SerializeObject(Base, Formatting.Indented, settings);
string outjson = JsonConvert.SerializeObject(Data, Formatting.Indented, settings);
File.WriteAllText(path, outjson);
}

/// <summary>
/// 获取带接口对象的字符串
/// </summary>
public void ReadInterface()
public static void ReadInterface()
{
if (File.Exists(path))
{
@@ -69,7 +69,7 @@ namespace HBLConsole.Service
settings.TypeNameHandling = TypeNameHandling.Objects;
string JsonString = File.ReadAllText(path);
var result = JsonConvert.DeserializeObject<T>(JsonString, settings);
if (result != null) { Base = result; }
if (result != null) { Data = result; }
}
}



+ 6
- 0
HBLConsole.sln ファイルの表示

@@ -25,6 +25,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLConsole.Abstract", "HBLC
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLConsole.Factory", "HBLConsole.Factory\HBLConsole.Factory.csproj", "{1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HBLConsole.Attributes", "HBLConsole.Attribute\HBLConsole.Attributes.csproj", "{9F022DDD-B69C-4AC9-AFB0-0A688EAA1F64}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +77,10 @@ Global
{1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}.Release|Any CPU.Build.0 = Release|Any CPU
{9F022DDD-B69C-4AC9-AFB0-0A688EAA1F64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F022DDD-B69C-4AC9-AFB0-0A688EAA1F64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F022DDD-B69C-4AC9-AFB0-0A688EAA1F64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F022DDD-B69C-4AC9-AFB0-0A688EAA1F64}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE


+ 1
- 1
HBLConsole/App.config ファイルの表示

@@ -11,7 +11,7 @@

<!--客户端ID-->
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13-->
<add key="ClientId" value="2"/>
<add key="ClientId" value="8"/>


</appSettings>

+ 2
- 2
HBLConsole/App.xaml.cs ファイルの表示

@@ -26,13 +26,13 @@ namespace HBLConsole
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
GeneralConfig.GetInstance.DeviceType = DeviceClientType.MORKS;
GeneralConfig.DeviceType = DeviceClientType.MORKS;
SystemHelper.GetInstance.AutoStart(false);
SystemHelper.GetInstance.CreateDesktopShortcut();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
MainConsole.Main.GetInstance.DataInit();
mainView.Show();
if (Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Count > 0)
if (Json<MorkOrderPushPar>.Data.morkOrderPushes.Count > 0)
{
listDialogView = new ListDialogView();
listDialogView.ShowDialog();


+ 2
- 2
HBLConsole/DialogWindow/View/DeviceManagermentSetView.xaml.cs ファイルの表示

@@ -38,7 +38,7 @@ namespace HBLConsole.DialogWindow.View
{
this.Tag = s;
this.DialogResult = false;
ActionManagerment.GetInstance.LogOut("Cancel");
ActionManagerment.GetInstance.CancelRegister("Cancel");
this.Close();

}), "Cancel");
@@ -47,7 +47,7 @@ namespace HBLConsole.DialogWindow.View
{
this.Tag = s;
this.DialogResult = true;
ActionManagerment.GetInstance.LogOut("Confirm");
ActionManagerment.GetInstance.CancelRegister("Confirm");
this.Close();

}), "Confirm");


+ 7
- 7
HBLConsole/DialogWindow/ViewModel/ListDialogViewModel.cs ファイルの表示

@@ -46,14 +46,14 @@ namespace HBLConsole.DialogWindow.ViewModel

CloseCommand = new RelayCommand(() =>
{
Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Clear();
Json<MorkOrderPushPar>.Data.morkOrderPushes.Clear();
orderStatusLists.Clear();
WeakReferenceMessenger.Default.Send("false", "Close");
});

CancelCommand = new RelayCommand(() =>
{
Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Clear();
Json<MorkOrderPushPar>.Data.morkOrderPushes.Clear();
orderStatusLists.Clear();
WeakReferenceMessenger.Default.Send("false", "Close");
});
@@ -64,23 +64,23 @@ namespace HBLConsole.DialogWindow.ViewModel
{
if (!item.IsSelected)
{
var reslut = Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.FirstOrDefault(p => p.OrderPush.SuborderId == item.OrderPush.SuborderId);
if (reslut != null) Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Remove(reslut);
var reslut = Json<MorkOrderPushPar>.Data.morkOrderPushes.FirstOrDefault(p => p.OrderPush.SuborderId == item.OrderPush.SuborderId);
if (reslut != null) Json<MorkOrderPushPar>.Data.morkOrderPushes.Remove(reslut);
}
}
foreach (var item in Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes)
foreach (var item in Json<MorkOrderPushPar>.Data.morkOrderPushes)
{
orderStatusLists.Add(new OrderData() { IsSelected = true, OrderPush = item.OrderPush, OrderStatus = item.OrderStatus });
}
WeakReferenceMessenger.Default.Send("true", "Close");
});

foreach (var item in Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes)
foreach (var item in Json<MorkOrderPushPar>.Data.morkOrderPushes)
{
orderStatusLists.Add(new OrderData() { IsSelected = true, OrderPush = item.OrderPush, OrderStatus = item.OrderStatus });
}

if (Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Count > 0)
if (Json<MorkOrderPushPar>.Data.morkOrderPushes.Count > 0)
{
ThreadManagerment.GetInstance.Start(new Action(() =>
{


+ 1
- 1
HBLConsole/View/DebugView.xaml ファイルの表示

@@ -292,7 +292,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<ToggleButton
Content="{Binding ConditionName}"
Content="{Binding propertyIllustrate}"
IsChecked="{Binding ConditionMet}"
Style="{StaticResource ToggleButStyle}"
ToolTip="{Binding ToolTip}" />


+ 12
- 11
HBLConsole/ViewModel/DebugViewModel.cs ファイルの表示

@@ -13,6 +13,7 @@ using HBLConsole.Communication;
using HBLConsole.Model;
using System.Reflection;
using System.Collections.Concurrent;
using HBLConsole.Attributes;

namespace HBLConsole.ViewModel
{
@@ -51,20 +52,20 @@ namespace HBLConsole.ViewModel
{
if (item.CustomAttributes.Count() > 0)
{
string? propertyInfo = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction;
string? propertyInfo = item.GetCustomAttribute<CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<CircuitAttribute>()?.Classifiaction;
if (Classifiactions != null)
{
foreach (var itemClassifiactions in Classifiactions)
{
if (GVL.ProcessData.GetInstance.Conditions.ContainsKey(itemClassifiactions))
if (ProcessData.GetInstance.Conditions.ContainsKey(itemClassifiactions))
{
if (propertyInfo != null)
{
int index = Array.FindIndex(GVL.ProcessData.GetInstance.Conditions[itemClassifiactions].ToArray(), p => p.propertyIllustrate == propertyInfo);
int index = Array.FindIndex(ProcessData.GetInstance.Conditions[itemClassifiactions].ToArray(), p => p.propertyIllustrate == propertyInfo);
if (index >= 0)
{
GVL.ProcessData.GetInstance.Conditions[itemClassifiactions].ElementAt(index).ToolTip = item.Name;
ProcessData.GetInstance.Conditions[itemClassifiactions].ElementAt(index).ToolTip = item.Name;
}
}
}
@@ -72,7 +73,7 @@ namespace HBLConsole.ViewModel
}
}
}
var Conditions = GVL.ProcessData.GetInstance.Conditions;
var Conditions = ProcessData.GetInstance.Conditions;
if (Conditions != null)
{
foreach (var item in Conditions)
@@ -81,7 +82,7 @@ namespace HBLConsole.ViewModel
process.ProcessTitl = item.Key;
foreach (var values in item.Value)
{
process.Conditions.Add(new Condition() { ConditionName = values.propertyIllustrate });
process.Conditions.Add(new Condition() { propertyIllustrate = values.propertyIllustrate });
}
processConditions.Add(process);
}
@@ -95,20 +96,20 @@ namespace HBLConsole.ViewModel
{
if (item.CustomAttributes.Count() > 0)
{
string? propertyInfo = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction;
string? propertyInfo = item.GetCustomAttribute<CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<CircuitAttribute>()?.Classifiaction;
if (Classifiactions != null)
{
foreach (string? Titles in Classifiactions)
{
if (Titles != null && propertyInfo != null)
{
bool? isNot = GVL.ProcessData.GetInstance.Conditions[Titles]?.FirstOrDefault(p => p.propertyIllustrate == propertyInfo)?.IsNot;
bool? isNot = ProcessData.GetInstance.Conditions[Titles]?.FirstOrDefault(p => p.propertyIllustrate == propertyInfo)?.IsNot;
int index = Array.FindIndex(processConditions.ToArray(), p => p.ProcessTitl == Titles);

if (index >= 0)
{
int PropertyIndex = Array.FindIndex(processConditions.ElementAt(index).Conditions.ToArray(), p => p.ConditionName == propertyInfo);
int PropertyIndex = Array.FindIndex(processConditions.ElementAt(index).Conditions.ToArray(), p => p.propertyIllustrate == propertyInfo);
if (PropertyIndex >= 0)
{
var res = type.GetProperty(item.Name)?.GetValue(MORKS.GetInstance.mORKS, null);


+ 6
- 27
HBLConsole/ViewModel/DeviceManageViewModel.cs ファイルの表示

@@ -24,19 +24,19 @@ namespace HBLConsole.ViewModel

ActionManagerment.GetInstance.Register(new Action(() =>
{
Json<CommunicationPar>.GetInstance.Base.communicationSets.Clear();
Json<CommunicationPar>.Data.communicationSets.Clear();
foreach (var item in communicationSets)
{
item.RemoveAction = null;
Json<CommunicationPar>.GetInstance.Base.communicationSets.Add(item);
Json<CommunicationPar>.Data.communicationSets.Add(item);
}
Json<CommunicationPar>.GetInstance.Save();
Json<CommunicationPar>.Save();

}), "DataSave");

Json<CommunicationPar>.GetInstance.Read();
Json<CommunicationPar>.Read();
communicationSets.Clear();
foreach (var item in Json<CommunicationPar>.GetInstance.Base.communicationSets)
foreach (var item in Json<CommunicationPar>.Data.communicationSets)
{
item.RemoveAction = RemoveDevice;
communicationSets.Add(item);
@@ -85,31 +85,10 @@ namespace HBLConsole.ViewModel
{
communicationObj.Device = (IDeviceType)Activator.CreateInstance(type);
}
communicationObj.DeviceName = ResultTag.DeviceName;
communicationObj.DeviceName = $"{ResultTag.DeviceName}【{eDeviceType}】";
communicationObj.deviceType = eDeviceType;
communicationObj.RemoveAction = RemoveDevice;
communicationSets.Add(communicationObj);



//switch (eDeviceType)
//{
// case EDeviceType.Siemens:
// //communicationObj.CommSiemens = new Siemens();
// //communicationObj.CommSiemens.IsVisible = true;
// break;
// case EDeviceType.ModbusRtu:
// //communicationObj.CommModbusRtu.IsVisible = true;
// break;
// case EDeviceType.ModbusTcp:
// //communicationObj.CommModbusTcp.IsVisible = true;
// break;
// case EDeviceType.SerialPort:
// break;
// default:
// break;
//}

}
}
}


+ 3
- 3
HBLConsole/ViewModel/MainViewModel.cs ファイルの表示

@@ -24,9 +24,9 @@ namespace HBLConsole.ViewModel
NavChangedCommand = new RelayCommand<object>(DoNavChanged);
ThreadManagerment.GetInstance.StartLong(new Action(() =>
{
InternetInfo.GetInstance.NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState();
NetworkConnectState = InternetInfo.GetInstance.NetworkConnectState;
OrderCount = Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Count;
InternetInfo.NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState();
NetworkConnectState = InternetInfo.NetworkConnectState;
OrderCount = Json<MorkOrderPushPar>.Data.morkOrderPushes.Count;
Thread.Sleep(1000);
}), "界面状态监控");
}


+ 13
- 12
HBLConsole/ViewModel/ProcessMonitoringViewModel.cs ファイルの表示

@@ -1,4 +1,5 @@
using HBLConsole.Business.Devices;
using HBLConsole.Attributes;
using HBLConsole.Business.Devices;
using HBLConsole.Model;
using HBLConsole.Service;
using System;
@@ -29,20 +30,20 @@ namespace HBLConsole.ViewModel
{
if (item.CustomAttributes.Count() > 0)
{
string? propertyInfo = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction;
string? propertyInfo = item.GetCustomAttribute<CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<CircuitAttribute>()?.Classifiaction;
if (Classifiactions != null)
{
foreach (var itemClassifiactions in Classifiactions)
{
if (GVL.ProcessData.GetInstance.Conditions.ContainsKey(itemClassifiactions))
if (ProcessData.GetInstance.Conditions.ContainsKey(itemClassifiactions))
{
if (propertyInfo != null)
{
int index = Array.FindIndex(GVL.ProcessData.GetInstance.Conditions[itemClassifiactions].ToArray(), p => p.propertyIllustrate == propertyInfo);
int index = Array.FindIndex(ProcessData.GetInstance.Conditions[itemClassifiactions].ToArray(), p => p.propertyIllustrate == propertyInfo);
if (index >= 0)
{
GVL.ProcessData.GetInstance.Conditions[itemClassifiactions].ElementAt(index).ToolTip = item.Name;
ProcessData.GetInstance.Conditions[itemClassifiactions].ElementAt(index).ToolTip = item.Name;
}
}
}
@@ -51,7 +52,7 @@ namespace HBLConsole.ViewModel
}
}

var Conditions = GVL.ProcessData.GetInstance.Conditions;
var Conditions = ProcessData.GetInstance.Conditions;
if (Conditions != null)
{
foreach (var item in Conditions)
@@ -60,7 +61,7 @@ namespace HBLConsole.ViewModel
process.ProcessTitl = item.Key;
foreach (var values in item.Value)
{
process.Conditions.Add(new Condition() { ConditionName = values.propertyIllustrate });
process.Conditions.Add(new Condition() { propertyIllustrate = values.propertyIllustrate });
}
processConditions.Add(process);
}
@@ -74,20 +75,20 @@ namespace HBLConsole.ViewModel
{
if (item.CustomAttributes.Count() > 0)
{
string? propertyInfo = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction;
string? propertyInfo = item.GetCustomAttribute<CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<CircuitAttribute>()?.Classifiaction;
if (Classifiactions != null)
{
foreach (string? Titles in Classifiactions)
{
if (Titles != null && propertyInfo != null)
{
bool? isNot = GVL.ProcessData.GetInstance.Conditions[Titles]?.FirstOrDefault(p => p.propertyIllustrate == propertyInfo)?.IsNot;
bool? isNot = ProcessData.GetInstance.Conditions[Titles]?.FirstOrDefault(p => p.propertyIllustrate == propertyInfo)?.IsNot;
int index = Array.FindIndex(processConditions.ToArray(), p => p.ProcessTitl == Titles);

if (index >= 0)
{
int PropertyIndex = Array.FindIndex(processConditions.ElementAt(index).Conditions.ToArray(), p => p.ConditionName == propertyInfo);
int PropertyIndex = Array.FindIndex(processConditions.ElementAt(index).Conditions.ToArray(), p => p.propertyIllustrate == propertyInfo);
if (PropertyIndex >= 0)
{
var res = type.GetProperty(item.Name)?.GetValue(MORKS.GetInstance.mORKS, null);


読み込み中…
キャンセル
保存