Parcourir la source

流程更新

master
pry il y a 2 ans
Parent
révision
545dfcdb42
9 fichiers modifiés avec 116 ajouts et 52 suppressions
  1. +2
    -1
      HBLConsole.Business/Devices/MORKS.cs
  2. +3
    -0
      HBLConsole.Business/HBLConsole.Business.csproj
  3. +1
    -0
      HBLConsole.Business/HeartbeatReport.cs
  4. +41
    -14
      HBLConsole.GVL/CircuitAttribute.cs
  5. +5
    -5
      HBLConsole.GVL/MORKS.cs
  6. +3
    -1
      HBLConsole.GVL/ProcessData.cs
  7. +4
    -0
      HBLConsole.Model/ProcessConditions.cs
  8. +2
    -1
      HBLConsole/View/DebugView.xaml
  9. +55
    -30
      HBLConsole/ViewModel/DebugViewModel.cs

+ 2
- 1
HBLConsole.Business/Devices/MORKS.cs Voir le fichier

@@ -12,6 +12,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPA.Message.Enum;
using BPA.Models;

namespace HBLConsole.Business.Devices
{
@@ -59,7 +60,7 @@ namespace HBLConsole.Business.Devices

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



+ 3
- 0
HBLConsole.Business/HBLConsole.Business.csproj Voir le fichier

@@ -18,6 +18,9 @@
<Reference Include="BPA.Message">
<HintPath>D:\BPACommon_output\net5.0\BPA.Message.dll</HintPath>
</Reference>
<Reference Include="BPA.Models">
<HintPath>D:\BPACommon_output\net5.0\BPA.Models.dll</HintPath>
</Reference>
<Reference Include="BPA.Utility">
<HintPath>D:\BPACommon_output\net5.0\BPA.Utility.dll</HintPath>
</Reference>


+ 1
- 0
HBLConsole.Business/HeartbeatReport.cs Voir le fichier

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

namespace HBLConsole.Business
{


+ 41
- 14
HBLConsole.GVL/CircuitAttribute.cs Voir le fichier

@@ -10,13 +10,15 @@ namespace HBLConsole.GVL
public class CircuitAttribute : Attribute
{
/// <summary>
/// 流程特性
/// 流程属性特性
/// </summary>
/// <param name="Classification">分类主题名称</param>
/// <param name="PropertyIllustrate">属性说明</param>
/// <param name="isNot">条件是否取反</param>
/// <param name="classification">字符串数组格式,属于哪一个业务流程</param>
/// <param name="propertyIllustrate">属性说明</param>
/// <param name="isNot">布尔数组,是否对结果取反</param>
public CircuitAttribute(string[] classification, string propertyIllustrate, bool[] isNot)
{
Classifiaction = classification;
PropertyIllustrate = propertyIllustrate;
int index = -1;
foreach (var item in classification)
{
@@ -25,49 +27,74 @@ namespace HBLConsole.GVL
{
ProcessData.GetInstance.Conditions.TryAdd(item, new List<Condition>());
}
ProcessData.GetInstance.Conditions[item].Add(new Condition() { ConditionName = propertyIllustrate, IsNot = isNot[index] });
if (ProcessData.GetInstance.Conditions[item].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
{
ProcessData.GetInstance.Conditions[item].Add(new Condition() { propertyIllustrate = propertyIllustrate, IsNot = isNot[index] });
}


}
}

/// <summary>
/// 流程属性特性
/// </summary>
/// <param name="classification">字符串数组格式,属于哪一个业务流程</param>
/// <param name="propertyIllustrate">属性说明</param>
public CircuitAttribute(string[] classification, string propertyIllustrate)
{
Classifiaction = classification;
PropertyIllustrate = propertyIllustrate;
foreach (var item in classification)
{
if (!ProcessData.GetInstance.Conditions.ContainsKey(item))
{
ProcessData.GetInstance.Conditions.TryAdd(item, new List<Condition>());
}
ProcessData.GetInstance.Conditions[item].Add(new Condition() { ConditionName = propertyIllustrate });
if (ProcessData.GetInstance.Conditions[item].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
{
ProcessData.GetInstance.Conditions[item].Add(new Condition() { propertyIllustrate = propertyIllustrate });
}


}
}

/// <summary>
/// 流程属性特性
/// </summary>
/// <param name="classification">业务流程名称</param>
/// <param name="propertyIllustrate">属性说明</param>
/// <param name="isNot">是否对结果取反</param>
public CircuitAttribute(string classification, string propertyIllustrate, bool isNot = false)
{

Classifiaction = new string[1] { classification };
PropertyIllustrate = propertyIllustrate;
if (!ProcessData.GetInstance.Conditions.ContainsKey(classification))
{
ProcessData.GetInstance.Conditions.TryAdd(classification, new List<Condition>());
}
ProcessData.GetInstance.Conditions[classification].Add(new Condition() { ConditionName = propertyIllustrate, IsNot = isNot });
if (ProcessData.GetInstance.Conditions[classification].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
{
ProcessData.GetInstance.Conditions[classification].Add(new Condition() { propertyIllustrate = propertyIllustrate, IsNot = isNot });
}
}

/// <summary>
/// 分类主题集合
/// </summary>
public string[] Classifiaction { get; set; }
public string[] Classifiaction { get; set; } = new string[0];

/// <summary>
/// 属性说明
/// </summary>
public string PropertyIllustrate { get; set; }

/// <summary>
/// 条件是否取反
/// </summary>
public bool IsNot { get; set; }


}





}

+ 5
- 5
HBLConsole.GVL/MORKS.cs Voir le fichier

@@ -44,31 +44,31 @@ namespace HBLConsole.GVL
/// <summary>
/// //机器人任务互锁信号
/// </summary>
[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人互锁")]
[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人互锁", new bool[] { true, false })]
public bool RobotTaskInterlock { get; set; }

/// <summary>
/// 取碗互锁信号
/// </summary>
[Circuit(new string[] { "取碗控制" }, "取碗互锁")]
[Circuit("取碗控制", "取碗互锁", true)]
public bool TakeBowlInterlock { get; set; }

/// <summary>
/// 取面互锁信号
/// </summary>
[Circuit(new string[] { "机器人取面", "出面控制" }, "取面互锁信号")]
[Circuit(new string[] { "机器人取面", "出面控制" }, "取面互锁信号", new bool[] { true, true })]
public bool TakeNoodleInterlock { get; set; }

/// <summary>
/// 出面中
/// </summary>
[Circuit(new string[] { "机器人取面" }, "出面中")]
[Circuit("机器人取面", "出面中", true)]
public bool OutNoodleing { get; set; }

/// <summary>
/// 允许取面
/// </summary>
[Circuit(new string[] { "转台控制", "机器人取面" }, "允许取面")]
[Circuit(new string[] { "转台控制", "机器人取面" }, "允许取面", new bool[] { true, false })]
public bool AllowTakeNoodle { get; set; }

/// <summary>


+ 3
- 1
HBLConsole.GVL/ProcessData.cs Voir le fichier

@@ -21,7 +21,9 @@ namespace HBLConsole.GVL
public class Condition
{
public bool ConditionMet { get; set; }
public string ConditionName { get; set; }
public string propertyIllustrate { get; set; }

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

+ 4
- 0
HBLConsole.Model/ProcessConditions.cs Voir le fichier

@@ -33,6 +33,10 @@ namespace HBLConsole.Model
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 bool IsNot { get; set; }
}



+ 2
- 1
HBLConsole/View/DebugView.xaml Voir le fichier

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


+ 55
- 30
HBLConsole/ViewModel/DebugViewModel.cs Voir le fichier

@@ -54,25 +54,42 @@ namespace HBLConsole.ViewModel
{
if (item.CustomAttributes.Count() > 0)
{
foreach (var Titles in item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction)
string? propertyInfo = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate;
string[]? Classifiactions = item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction;
if (Classifiactions != null)
{
int index = Array.FindIndex(processConditions.ToArray(), p => p.ProcessTitl == Titles);
ProcessConditions process = new ProcessConditions();
if (index < 0)
foreach (var itemClassifiactions in Classifiactions)
{
process.ProcessTitl = Titles;
process.Conditions.Add(new Condition() { ConditionName = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate });
processConditions.Add(process);
}
else if (index >= 0)
{
processConditions.ElementAt(index).Conditions.Add(new Condition() { ConditionName = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate });
if (GVL.ProcessData.GetInstance.Conditions.ContainsKey(itemClassifiactions))
{
if (propertyInfo != null)
{
int index = Array.FindIndex(GVL.ProcessData.GetInstance.Conditions[itemClassifiactions].ToArray(), p => p.propertyIllustrate == propertyInfo);
if (index >= 0)
{
GVL.ProcessData.GetInstance.Conditions[itemClassifiactions].ElementAt(index).ToolTip = item.Name;
}
}
}
}

}

}
}
var Conditions = GVL.ProcessData.GetInstance.Conditions;
if (Conditions != null)
{
foreach (var item in Conditions)
{
ProcessConditions process = new ProcessConditions();
process.ProcessTitl = item.Key;
foreach (var values in item.Value)
{
process.Conditions.Add(new Condition() { ConditionName = values.propertyIllustrate });
}
processConditions.Add(process);
}
}


//更新流程监控图
ThreadManagerment.GetInstance.StartLong(new Action(() =>
@@ -82,33 +99,41 @@ namespace HBLConsole.ViewModel
if (item.CustomAttributes.Count() > 0)
{
string? propertyInfo = item.GetCustomAttribute<GVL.CircuitAttribute>()?.PropertyIllustrate;
bool? isNot = item.GetCustomAttribute<GVL.CircuitAttribute>()?.IsNot;
foreach (string? Titles in item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction)
string[]? Classifiactions = item.GetCustomAttribute<GVL.CircuitAttribute>()?.Classifiaction;
if (Classifiactions != null)
{
if (Titles != null && propertyInfo != null && isNot != null)
foreach (string? Titles in Classifiactions)
{
int index = Array.FindIndex(processConditions.ToArray(), p => p.ProcessTitl == Titles);

if (index >= 0)
if (Titles != null && propertyInfo != null)
{
int PropertyIndex = Array.FindIndex(processConditions.ElementAt(index).Conditions.ToArray(), p => p.ConditionName == propertyInfo);
if (PropertyIndex >= 0)
bool? isNot = GVL.ProcessData.GetInstance.Conditions[Titles]?.FirstOrDefault(p => p.propertyIllustrate == propertyInfo)?.IsNot;
int index = Array.FindIndex(processConditions.ToArray(), p => p.ProcessTitl == Titles);

if (index >= 0)
{
var res = type.GetProperty(item.Name)?.GetValue(MORKS.GetInstance.mORKS, null);
if (res != null)
int PropertyIndex = Array.FindIndex(processConditions.ElementAt(index).Conditions.ToArray(), p => p.ConditionName == propertyInfo);
if (PropertyIndex >= 0)
{
if (res is bool blen)
{
processConditions.ElementAt(index).Conditions.ElementAt(PropertyIndex).ConditionMet = (bool)isNot ? !blen : blen;
}
else if (res is ConcurrentQueue<GVL.OrderLocInfo> OrderLocInfoS)
var res = type.GetProperty(item.Name)?.GetValue(MORKS.GetInstance.mORKS, null);
if (res != null)
{
processConditions.ElementAt(index).Conditions.ElementAt(PropertyIndex).ConditionMet = OrderLocInfoS.Count > 0;
if (res is bool blen)
{
if (isNot != null)
{
processConditions.ElementAt(index).Conditions.ElementAt(PropertyIndex).ConditionMet = (bool)isNot ? !blen : blen;
}

}
else if (res is ConcurrentQueue<GVL.OrderLocInfo> OrderLocInfoS)
{
processConditions.ElementAt(index).Conditions.ElementAt(PropertyIndex).ConditionMet = OrderLocInfoS.Count > 0;
}
}

}

}

}
}
}


Chargement…
Annuler
Enregistrer