Browse Source

更新设备状态汇总

样式分支
fyf 2 years ago
parent
commit
6f6438620f
7 changed files with 24 additions and 14 deletions
  1. +4
    -1
      BPASmartClient.Device/BaseDevice.cs
  2. +0
    -6
      BPASmartClient.IoT/DataVClient.cs
  3. +5
    -1
      BPASmartClient.MORKSM.BK.PLC/MorksMachine.cs
  4. +1
    -0
      BPASmartClient.MorkT/Device_MorkT.cs
  5. +2
    -2
      BPASmartClient.Peripheral/BasePeripheral.cs
  6. +8
    -0
      BPASmartClient.Peripheral/IPeripheral.cs
  7. +4
    -4
      BPASmartClient/DeviceInfo.xml

+ 4
- 1
BPASmartClient.Device/BaseDevice.cs View File

@@ -71,10 +71,13 @@ namespace BPASmartClient.Device
{
foreach (var peripheral in peripherals)
{
string TypeName = peripheral.GetType().FullName.Replace("BPASmartClient.","");
Status.Update($"{TypeName}.IsConnected", peripheral.IsConnected);
Status.Update($"{TypeName}.IsWork", peripheral.IsWork);
foreach (var key in peripheral.GetAllStatus().Keys)
{
peripheralStatus[key] = peripheral.GetAllStatus()[key];
Status.Update(key, peripheral.GetAllStatus()[key]);
Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]);
}
}
Thread.Sleep(100);


+ 0
- 6
BPASmartClient.IoT/DataVClient.cs View File

@@ -139,11 +139,6 @@ namespace BPASmartClient.IoT
List<object> dataVNode = new List<object>();
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device =>
{
Dictionary<string, object> keys=new Dictionary<string, object>();
keys["电机"] = "正常";
keys["电机"] = "正常";
keys["电机"] = "正常";
keys["电机"] = "正常";
var obj =new
{
DeviceId=device.DeviceId,
@@ -156,7 +151,6 @@ namespace BPASmartClient.IoT
Status = device.Status.GetStatus(),
};
dataVNode.Add(obj);
dataVNode.Add(obj); dataVNode.Add(obj); dataVNode.Add(obj); dataVNode.Add(obj); dataVNode.Add(obj); dataVNode.Add(obj); dataVNode.Add(obj);
});
if (dataVNode.Count > 0)
{


+ 5
- 1
BPASmartClient.MORKSM.BK.PLC/MorksMachine.cs View File

@@ -26,8 +26,11 @@ namespace BPASmartClient.PLC

ThreadManage.GetInstance().StartLong(new Action(() =>
{
while (modbusTcp.Connected)
IsConnected = modbusTcp.Connected;
if (!IsConnected) IsWork = false;
while (IsConnected)
{
IsWork = true;
foreach (var par in plcReadParameters)
{
ushort address = (ushort)modbusTcp.GetAddress(par?.Address);
@@ -43,6 +46,7 @@ namespace BPASmartClient.PLC
}
status[par.Address] = readData;
}
Thread.Sleep(500);
}
Thread.Sleep(1000);


+ 1
- 0
BPASmartClient.MorkT/Device_MorkT.cs View File

@@ -14,6 +14,7 @@ namespace BPASmartClient.MorkT

public override void DoMain()
{

}

public override void Stop()


+ 2
- 2
BPASmartClient.Peripheral/BasePeripheral.cs View File

@@ -15,11 +15,11 @@ namespace BPASmartClient.Peripheral
/// <summary>
/// 是否已连接
/// </summary>
public bool IsConnected { get; protected set; }
public bool IsConnected { get; set; }
/// <summary>
/// 是否工作正常
/// </summary>
public bool IsWork { get; protected set; }
public bool IsWork { get; set; }
/// <summary>
/// 归属设备Id
/// </summary>


+ 8
- 0
BPASmartClient.Peripheral/IPeripheral.cs View File

@@ -12,6 +12,14 @@ namespace BPASmartClient.Peripheral
/// </summary>
public interface IPeripheral
{
/// <summary>
/// 是否已连接
/// </summary>
bool IsConnected { get; set; }
/// <summary>
/// 是否工作正常
/// </summary>
bool IsWork { get; set; }
/// <summary>
/// 设备ID
/// </summary>


+ 4
- 4
BPASmartClient/DeviceInfo.xml View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<BPADevices>
<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Peripherals>
<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<!--<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<HandSensor>1</HandSensor>
<OutputSingalValue>0</OutputSingalValue>
</Parameters>
</Peripheral>
</Peripheral>-->
<Peripheral Module="BPASmartClient.SCChip.ICChipMachine">
<Parameters>
@@ -17,7 +17,7 @@
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->
</Device>

<Device Name="MorkS" Module="BPASmartClient.MorkS.Control" DeviceId="2">
<!--<Parameters>


Loading…
Cancel
Save