浏览代码

基础模块配置

master
pry 1年前
父节点
当前提交
2bb6be209a
共有 6 个文件被更改,包括 60 次插入9 次删除
  1. +2
    -1
      BPASmartClient.Device/BaseDevice.cs
  2. +2
    -0
      BPASmartClient.Device/IDevice.cs
  3. +29
    -0
      BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs
  4. +14
    -8
      BPASmartClient.MorkS/View/ParSet.xaml
  5. +7
    -0
      BPASmartClient.Peripheral/BasePeripheral.cs
  6. +6
    -0
      BPASmartClient.Peripheral/IPeripheral.cs

+ 2
- 1
BPASmartClient.Device/BaseDevice.cs 查看文件

@@ -122,6 +122,7 @@ namespace BPASmartClient.Device
public IAlarm InterfaceAlarm { get; set; }
public AlarmHelper alarmHelper { get; set; } = new AlarmHelper();
public IStatus InterfaceStatus { get; set; }
public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();

#endregion

@@ -284,7 +285,7 @@ namespace BPASmartClient.Device
foreach (var faces in res)
{
if (faces.Name == "IStatus")
{
{
InterfaceStatus = item.GetValue(this) as IStatus;
GetMonitorData(InterfaceStatus);
}


+ 2
- 0
BPASmartClient.Device/IDevice.cs 查看文件

@@ -62,6 +62,8 @@ namespace BPASmartClient.Device
/// </summary>
ObservableCollection<VariableMonitor> variableMonitors { get; set; }

ObservableCollection<Variable> variables { get; set; }

/// <summary>
/// 设备报警信息集合
/// </summary>


+ 29
- 0
BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs 查看文件

@@ -41,6 +41,23 @@ namespace BPASmartClient.PLC
}
}
}

//foreach (var par in tempVar)
//{
// if (par.Value?.Address.Length > 0)
// {
// var res = modbusTcp.Read(par.Value.Address, (ushort)par.Value.ReadLeng);
// if (status.ContainsKey(par.Value.Address))
// {
// status[par.Value.Address] = res;
// }
// else
// {
// status.TryAdd(par.Value.Address, res);
// }
// }
//}

Thread.Sleep(100);
}
Thread.Sleep(1000);
@@ -78,6 +95,18 @@ namespace BPASmartClient.PLC
modbusTcp.Write(address, value);
}

public override void AddVarInfo(string add, int len)
{
if (!tempVar.ContainsKey(add) && !string.IsNullOrEmpty(add) && len > 0)
{
tempVar.TryAdd(add, new Variable()
{
Address = add,
ReadLeng = len
});
}
}

protected override void InitStatus()
{



+ 14
- 8
BPASmartClient.MorkS/View/ParSet.xaml 查看文件

@@ -129,8 +129,8 @@

<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock
Margin="40,0,0,0"
FontSize="21"
Margin="40 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="加汤时间:" />
<TextBox
@@ -145,13 +145,13 @@
Foreground="#ff34f7f7"
Text="{Binding AddSoup}" />
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Margin="10 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="(秒)" />
<TextBlock
Margin="40,0,0,0"
FontSize="21"
Margin="40 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="清洗加汤管道时间:" />
<TextBox
@@ -166,15 +166,21 @@
Foreground="#ff34f7f7"
Text="{Binding DelayTime}" />
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Margin="10 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="(秒)" />
<Button Content="启动" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5" Foreground="Aqua"
Style="{StaticResource ButtonStyle}" Command="{Binding CommandStart}" />
<Button
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding CommandStart}"
Content="启动"
Foreground="Aqua"
Style="{StaticResource ButtonStyle}" />
<TextBlock
Margin="40,0,0,0"
FontSize="21"
Margin="40 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="倒面条件,煮面口使用数量:" />
<TextBox
@@ -189,8 +195,8 @@
Foreground="#ff34f7f7"
Text="{Binding OpenUseNumber}" />
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Margin="10 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="(个)" />
</StackPanel>


+ 7
- 0
BPASmartClient.Peripheral/BasePeripheral.cs 查看文件

@@ -29,6 +29,7 @@ namespace BPASmartClient.Peripheral
public CommunicationPar communicationPar { get; set; } = new CommunicationPar();
public ConcurrentDictionary<string, object> status { get; set; } = new ConcurrentDictionary<string, object>();
public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();
public ConcurrentDictionary<string, Variable> tempVar { get; set; } = new();

/// <summary>q
/// 外设状态集合
@@ -65,10 +66,16 @@ namespace BPASmartClient.Peripheral

public abstract void WriteData(string address, object value);

public abstract void AddVarInfo(string add, int len);

public ConcurrentDictionary<string, object> GetAllStatus()
{
return status;
}

public ConcurrentDictionary<string, Variable> GetVariable()
{
return tempVar;
}
}
}

+ 6
- 0
BPASmartClient.Peripheral/IPeripheral.cs 查看文件

@@ -53,8 +53,14 @@ namespace BPASmartClient.Peripheral
/// </summary>
ConcurrentDictionary<string, object> status { get; set; }

ConcurrentDictionary<string, Variable> tempVar { get; set; }

ConcurrentDictionary<string, Variable> GetVariable();

void WriteData(string address, object value);

void AddVarInfo(string add, int len);

//void ReadData(string address);

/// <summary>


正在加载...
取消
保存