diff --git a/CapMachine.Core/CapMachine.Core.csproj b/CapMachine.Core/CapMachine.Core.csproj
index 3971803..572049e 100644
--- a/CapMachine.Core/CapMachine.Core.csproj
+++ b/CapMachine.Core/CapMachine.Core.csproj
@@ -8,7 +8,7 @@
true
-
+
diff --git a/CapMachine.Core/ConfigHelper.cs b/CapMachine.Core/ConfigHelper.cs
new file mode 100644
index 0000000..a361eaa
--- /dev/null
+++ b/CapMachine.Core/ConfigHelper.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Core
+{
+ public class ConfigHelper
+ {
+ Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
+ ///
+ /// 根据Key取Value值
+ ///
+ ///
+ public static string GetValue(string key)
+ {
+ return ConfigurationManager.AppSettings[key].ToString().Trim();
+ }
+
+ ///
+ /// 根据Key修改Value
+ ///
+ /// 要修改的Key
+ /// 要修改为的值
+ public static void SetValue(string key, string value)
+ {
+ //ConfigurationManager.AppSettings.Set(key, value);
+ //cfa.AppSettings.Settings[key].Value = value;
+ //cfa.Save();
+
+ Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
+ configuration.AppSettings.Settings[key].Value = value;
+ configuration.Save();
+ ConfigurationManager.RefreshSection("appSettings");
+ }
+
+ ///
+ /// 添加新的Key ,Value键值对
+ ///
+ /// Key
+ /// Value
+ public static void Add(string key, string value)
+ {
+ ConfigurationManager.AppSettings.Add(key, value);
+ }
+
+ ///
+ /// 根据Key删除项
+ ///
+ /// Key
+ public static void Remove(string key)
+ {
+ ConfigurationManager.AppSettings.Remove(key);
+ }
+
+ }
+}
diff --git a/CapMachine.Core/DeepCopyHelper.cs b/CapMachine.Core/DeepCopyHelper.cs
new file mode 100644
index 0000000..4adcd0a
--- /dev/null
+++ b/CapMachine.Core/DeepCopyHelper.cs
@@ -0,0 +1,277 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+
+namespace CapMachine.Core
+{
+ public class DeepCopyHelper
+ {
+ // 用一个字典来存放每个对象的反射次数来避免反射代码的循环递归
+ static readonly Dictionary TypereflectionCountDic = new Dictionary();
+ //static object _deepCopyDemoClasstypeRef = null;
+ // 利用反射实现深拷贝
+ public static T DeepCopyWithReflection(T obj)
+ {
+ Type type = obj.GetType();
+ // 如果是字符串或值类型则直接返回
+ if (obj is string || type.IsValueType) return obj;
+ if (type.IsArray)
+ {
+ if (type.FullName != null)
+ {
+ Type elementType = Type.GetType(type.FullName.Replace("[]", string.Empty));
+ var array = obj as Array;
+ if (array != null)
+ {
+ Array copied = Array.CreateInstance(elementType ?? throw new InvalidOperationException(), array.Length);
+ for (int i = 0; i < array.Length; i++)
+ {
+ copied.SetValue(DeepCopyWithReflection(array.GetValue(i)), i);
+ }
+ return (T)Convert.ChangeType(copied, obj.GetType());
+ }
+ }
+ }
+
+ object retval = Activator.CreateInstance(obj.GetType());
+
+ PropertyInfo[] properties = obj.GetType().GetProperties(
+ BindingFlags.Public | BindingFlags.NonPublic
+ | BindingFlags.Instance | BindingFlags.Static);
+ foreach (var property in properties)
+ {
+ var propertyValue = property.GetValue(obj, null);
+ if (propertyValue == null)
+ continue;
+ property.SetValue(retval, DeepCopyWithReflection(propertyValue), null);
+ }
+ return (T)retval;
+ }
+
+
+
+ public static T DeepCopyWithReflection_Second(T obj)
+ {
+ Type type = obj.GetType();
+
+ // 如果是字符串或值类型则直接返回
+ if (obj is string || type.IsValueType) return obj;
+ if (type.IsArray)
+ {
+ if (type.FullName != null)
+ {
+ Type elementType = Type.GetType(type.FullName.Replace("[]", string.Empty));
+ var array = obj as Array;
+ if (array != null)
+ {
+ Array copied = Array.CreateInstance(elementType ?? throw new InvalidOperationException(), array.Length);
+ for (int i = 0; i < array.Length; i++)
+ {
+ copied.SetValue(DeepCopyWithReflection_Second(array.GetValue(i)), i);
+ }
+ return (T)Convert.ChangeType(copied, obj.GetType());
+ }
+ }
+ }
+
+ // 对于类类型开始记录对象反射的次数
+ int reflectionCount = Add(TypereflectionCountDic, obj.GetType());
+ if (reflectionCount > 1)
+ return obj;
+
+ object retval = Activator.CreateInstance(obj.GetType());
+
+ PropertyInfo[] properties = obj.GetType().GetProperties(
+ BindingFlags.Public | BindingFlags.NonPublic
+ | BindingFlags.Instance | BindingFlags.Static);
+ foreach (var property in properties)
+ {
+ var propertyValue = property.GetValue(obj, null);
+ if (propertyValue == null)
+ continue;
+ property.SetValue(retval, DeepCopyWithReflection_Second(propertyValue), null);
+ }
+ return (T)retval;
+ }
+
+
+
+ //public static T DeepCopyWithReflection_Third(T obj)
+ //{
+ // Type type = obj.GetType();
+ // // 如果是字符串或值类型则直接返回
+ // if (obj is string || type.IsValueType) return obj;
+ // if (type.IsArray)
+ // {
+ // Type elementType = Type.GetType(type.FullName.Replace("[]", string.Empty));
+ // var array = obj as Array;
+ // Array copied = Array.CreateInstance(elementType, array.Length);
+ // for (int i = 0; i < array.Length; i++)
+ // {
+ // copied.SetValue(DeepCopyWithReflection_Second(array.GetValue(i)), i);
+ // }
+ // return (T) Convert.ChangeType(copied, obj.GetType());
+ // }
+ // int reflectionCount = Add(typereflectionCountDic, obj.GetType());
+ // if (reflectionCount > 1 && obj.GetType() == typeof(DeepCopyDemoClass))
+ // return (T) DeepCopyDemoClasstypeRef; // 返回deepCopyClassB对象
+ // object retval = Activator.CreateInstance(obj.GetType());
+ // if (retval.GetType() == typeof(DeepCopyDemoClass))
+ // DeepCopyDemoClasstypeRef = retval; // 保存一开始创建的DeepCopyDemoClass对象
+ // PropertyInfo[] properties = obj.GetType().GetProperties(
+ // BindingFlags.Public | BindingFlags.NonPublic
+ // | BindingFlags.Instance | BindingFlags.Static);
+ // foreach (var property in properties)
+ // {
+ // var propertyValue = property.GetValue(obj, null);
+ // if (propertyValue == null)
+ // continue;
+ // property.SetValue(retval, DeepCopyWithReflection_Third(propertyValue), null);
+ // }
+ // return (T) retval;
+ //}
+
+ //private static T SetArrayObject(T arrayObj)
+ //{
+ // Type elementType = Type.GetType(arrayObj.GetType().FullName.Replace("[]", string.Empty));
+ // var array = arrayObj as Array;
+ // Array copied = Array.CreateInstance(elementType, array.Length);
+ // for (int i = 0; i < array.Length; i++)
+ // {
+ // copied.SetValue(DeepCopyWithReflection_Third(array.GetValue(i)), i);
+ // }
+ // return (T) Convert.ChangeType(copied, arrayObj.GetType());
+ //}
+
+ private static int Add(Dictionary dict, Type key)
+ {
+ if (key == typeof(string) || key.IsValueType) return 0;
+ if (!dict.ContainsKey(key))
+ {
+ dict.Add(key, 1);
+ return dict[key];
+ }
+ dict[key] += 1;
+ return dict[key];
+ }
+
+ // 利用XML序列化和反序列化实现
+ public static T DeepCopyWithXmlSerializer(T obj)
+ {
+ object retval;
+ using (MemoryStream ms = new MemoryStream())
+ {
+ XmlSerializer xml = new XmlSerializer(typeof(T));
+ xml.Serialize(ms, obj);
+ ms.Seek(0, SeekOrigin.Begin);
+ retval = xml.Deserialize(ms);
+ ms.Close();
+ }
+ return (T)retval;
+ }
+
+ // 利用二进制序列化和反序列实现(亲测有用)
+ public static T DeepCopyWithBinarySerialize(T obj)
+ {
+ object retval;
+ using (MemoryStream ms = new MemoryStream())
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ // 序列化成流
+ bf.Serialize(ms, obj);
+ ms.Seek(0, SeekOrigin.Begin);
+ // 反序列化成对象
+ retval = bf.Deserialize(ms);
+ ms.Close();
+ }
+ return (T)retval;
+ }
+
+ // 利用DataContractSerializer序列化和反序列化实现
+ //public static T DeepCopy(T obj)
+ //{
+ // object retval;
+ // using (MemoryStream ms = new MemoryStream())
+ // {
+ // DataContractSerializer ser = new DataContractSerializer(typeof(T));
+ // ser.WriteObject(ms, obj);
+ // ms.Seek(0, SeekOrigin.Begin);
+ // retval = ser.ReadObject(ms);
+ // ms.Close();
+ // }
+ // return (T) retval;
+ //}
+ // 表达式树实现
+ // ....
+ public static class TransExpV2
+ {
+ private static readonly Func cache = GetFunc();
+ private static Func GetFunc()
+ {
+ ParameterExpression parameterExpression = Expression.Parameter(typeof(TIn), "p");
+ List memberBindingList = new List();
+
+ foreach (var item in typeof(TOut).GetProperties())
+ {
+ if (!item.CanWrite)
+ continue;
+
+ MemberExpression property =
+ Expression.Property(parameterExpression, typeof(TIn).GetProperty(item.Name));
+
+ MemberBinding memberBinding = Expression.Bind(item, property);
+ memberBindingList.Add(memberBinding);
+ }
+ MemberInitExpression memberInitExpression =
+ Expression.MemberInit(Expression.New(typeof(TOut)), memberBindingList.ToArray());
+
+ Expression> lambda = Expression.Lambda>(memberInitExpression,
+ new ParameterExpression[] { parameterExpression });
+ return lambda.Compile();
+ }
+
+ public static TOut Trans(TIn tIn)
+ {
+ return cache(tIn);
+ }
+ }
+ }
+
+ //public static class TransExpV2
+ //{
+
+ // private static readonly Func cache = GetFunc();
+ // private static Func GetFunc()
+ // {
+ // ParameterExpression parameterExpression = Expression.Parameter(typeof(TIn), "p");
+ // List memberBindingList = new List();
+
+ // foreach (var item in typeof(TOut).GetProperties())
+ // {
+ // if (!item.CanWrite) continue;
+ // MemberExpression property = Expression.Property(parameterExpression, typeof(TIn).GetProperty(item.Name));
+ // MemberBinding memberBinding = Expression.Bind(item, property);
+ // memberBindingList.Add(memberBinding);
+ // }
+
+ // MemberInitExpression memberInitExpression = Expression.MemberInit(Expression.New(typeof(TOut)), memberBindingList.ToArray());
+ // Expression> lambda = Expression.Lambda>(memberInitExpression, new ParameterExpression[] { parameterExpression });
+
+ // return lambda.Compile();
+ // }
+
+ // public static TOut Trans(TIn tIn)
+ // {
+ // return cache(tIn);
+ // }
+
+ //}
+
+}
diff --git a/CapMachine.Model/CapMachine.Model.csproj b/CapMachine.Model/CapMachine.Model.csproj
index c61bce4..1851f75 100644
--- a/CapMachine.Model/CapMachine.Model.csproj
+++ b/CapMachine.Model/CapMachine.Model.csproj
@@ -6,6 +6,6 @@
enable
-
+
diff --git a/CapMachine.Model/MeterConfig/MeterCom.cs b/CapMachine.Model/MeterConfig/MeterCom.cs
new file mode 100644
index 0000000..3628724
--- /dev/null
+++ b/CapMachine.Model/MeterConfig/MeterCom.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Model.MeterConfig
+{
+ ///
+ /// 公共部分
+ ///
+ public class MeterCom
+ {
+ ///
+ /// 程序步骤序号
+ ///
+ public int StepNo { get; set; }
+
+ ///
+ /// 开始值
+ ///
+ public double StartValue { get; set; }
+
+ ///
+ /// 结束值
+ ///
+ public double EndValue { get; set; }
+
+ ///
+ /// 维持时间
+ ///
+ public int KeepTime { get; set; }
+
+ ///
+ /// 配置值类型
+ ///
+ public ConfigValueType ValueType { get; set; }
+
+ ///
+ /// 常值
+ /// 在ValueType为常值时会使用
+ ///
+ public double Constant { get; set; }
+ }
+}
diff --git a/CapMachine.Model/MeterConfig/MeterCond1Temp.cs b/CapMachine.Model/MeterConfig/MeterCond1Temp.cs
index 27d1e18..4dbc97c 100644
--- a/CapMachine.Model/MeterConfig/MeterCond1Temp.cs
+++ b/CapMachine.Model/MeterConfig/MeterCond1Temp.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterCondPress.cs b/CapMachine.Model/MeterConfig/MeterCond2Press.cs
similarity index 93%
rename from CapMachine.Model/MeterConfig/MeterCondPress.cs
rename to CapMachine.Model/MeterConfig/MeterCond2Press.cs
index 0248e1f..ec37fa8 100644
--- a/CapMachine.Model/MeterConfig/MeterCondPress.cs
+++ b/CapMachine.Model/MeterConfig/MeterCond2Press.cs
@@ -10,8 +10,8 @@ namespace CapMachine.Model
///
/// COND2压力 表设置
///
- [Table(Name = "MeterCondPress")]
- public class MeterCondPress
+ [Table(Name = "MeterCond2Press")]
+ public class MeterCond2Press
{
///
/// 主键
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterCond2Temp.cs b/CapMachine.Model/MeterConfig/MeterCond2Temp.cs
index 869d470..ad638e9 100644
--- a/CapMachine.Model/MeterConfig/MeterCond2Temp.cs
+++ b/CapMachine.Model/MeterConfig/MeterCond2Temp.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterEVAPExpTemp.cs b/CapMachine.Model/MeterConfig/MeterEVAPExpTemp.cs
index 46383b0..0439494 100644
--- a/CapMachine.Model/MeterConfig/MeterEVAPExpTemp.cs
+++ b/CapMachine.Model/MeterConfig/MeterEVAPExpTemp.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterTestBoxRH.cs b/CapMachine.Model/MeterConfig/MeterEnvRH.cs
similarity index 93%
rename from CapMachine.Model/MeterConfig/MeterTestBoxRH.cs
rename to CapMachine.Model/MeterConfig/MeterEnvRH.cs
index 358f04f..a0621fe 100644
--- a/CapMachine.Model/MeterConfig/MeterTestBoxRH.cs
+++ b/CapMachine.Model/MeterConfig/MeterEnvRH.cs
@@ -10,8 +10,8 @@ namespace CapMachine.Model
///
/// 试验箱湿度 表设置
///
- [Table(Name = "MeterTestBoxRH")]
- public class MeterTestBoxRH
+ [Table(Name = "MeterEnvRH")]
+ public class MeterEnvRH
{
///
/// 主键
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterTestBoxTemp.cs b/CapMachine.Model/MeterConfig/MeterEnvTemp.cs
similarity index 93%
rename from CapMachine.Model/MeterConfig/MeterTestBoxTemp.cs
rename to CapMachine.Model/MeterConfig/MeterEnvTemp.cs
index 4a15bcc..a988b0a 100644
--- a/CapMachine.Model/MeterConfig/MeterTestBoxTemp.cs
+++ b/CapMachine.Model/MeterConfig/MeterEnvTemp.cs
@@ -10,8 +10,8 @@ namespace CapMachine.Model
///
/// 试验箱温度 表设置
///
- [Table(Name = "MeterTestBoxTemp")]
- public class MeterTestBoxTemp
+ [Table(Name = "MeterEnvTemp")]
+ public class MeterEnvTemp
{
///
/// 主键
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterExPress.cs b/CapMachine.Model/MeterConfig/MeterExPress.cs
index b278787..8b3a16f 100644
--- a/CapMachine.Model/MeterConfig/MeterExPress.cs
+++ b/CapMachine.Model/MeterConfig/MeterExPress.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace CapMachine.Model
{
///
- /// 排气压力设置
+ /// 排气压力 设置
///
[Table(Name = "MeterExPress")]
public class MeterExPress
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterHVVol.cs b/CapMachine.Model/MeterConfig/MeterHVVol.cs
index b123d1e..0e920e1 100644
--- a/CapMachine.Model/MeterConfig/MeterHVVol.cs
+++ b/CapMachine.Model/MeterConfig/MeterHVVol.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterInhPress.cs b/CapMachine.Model/MeterConfig/MeterInhPress.cs
index 8d98cb2..47f8053 100644
--- a/CapMachine.Model/MeterConfig/MeterInhPress.cs
+++ b/CapMachine.Model/MeterConfig/MeterInhPress.cs
@@ -36,7 +36,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterInhTemp.cs b/CapMachine.Model/MeterConfig/MeterInhTemp.cs
index 316a9d3..1a513df 100644
--- a/CapMachine.Model/MeterConfig/MeterInhTemp.cs
+++ b/CapMachine.Model/MeterConfig/MeterInhTemp.cs
@@ -36,7 +36,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterLVVol.cs b/CapMachine.Model/MeterConfig/MeterLVVol.cs
index 19eb742..904ebf9 100644
--- a/CapMachine.Model/MeterConfig/MeterLVVol.cs
+++ b/CapMachine.Model/MeterConfig/MeterLVVol.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterLoPress.cs b/CapMachine.Model/MeterConfig/MeterLubePress.cs
similarity index 93%
rename from CapMachine.Model/MeterConfig/MeterLoPress.cs
rename to CapMachine.Model/MeterConfig/MeterLubePress.cs
index 1f7eb3b..cf7b13c 100644
--- a/CapMachine.Model/MeterConfig/MeterLoPress.cs
+++ b/CapMachine.Model/MeterConfig/MeterLubePress.cs
@@ -10,8 +10,8 @@ namespace CapMachine.Model
///
/// 润滑油压力 设置
///
- [Table(Name = "MeterLoPress")]
- public class MeterLoPress
+ [Table(Name = "MeterLubePress")]
+ public class MeterLubePress
{
///
/// 主键
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterOCR.cs b/CapMachine.Model/MeterConfig/MeterOCR.cs
index bf44daf..ae09d1e 100644
--- a/CapMachine.Model/MeterConfig/MeterOCR.cs
+++ b/CapMachine.Model/MeterConfig/MeterOCR.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterOS1Temp.cs b/CapMachine.Model/MeterConfig/MeterOS1Temp.cs
index b767e9a..06677c8 100644
--- a/CapMachine.Model/MeterConfig/MeterOS1Temp.cs
+++ b/CapMachine.Model/MeterConfig/MeterOS1Temp.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterOS2Temp.cs b/CapMachine.Model/MeterConfig/MeterOS2Temp.cs
index e9f01b7..18b60b0 100644
--- a/CapMachine.Model/MeterConfig/MeterOS2Temp.cs
+++ b/CapMachine.Model/MeterConfig/MeterOS2Temp.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterPTCEntTemp.cs b/CapMachine.Model/MeterConfig/MeterPTCEntTemp.cs
index 242e871..372496b 100644
--- a/CapMachine.Model/MeterConfig/MeterPTCEntTemp.cs
+++ b/CapMachine.Model/MeterConfig/MeterPTCEntTemp.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterPTCFlow.cs b/CapMachine.Model/MeterConfig/MeterPTCFlow.cs
index 4f765fc..1e45881 100644
--- a/CapMachine.Model/MeterConfig/MeterPTCFlow.cs
+++ b/CapMachine.Model/MeterConfig/MeterPTCFlow.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterPTCPw.cs b/CapMachine.Model/MeterConfig/MeterPTCPw.cs
index e215c8f..04eb459 100644
--- a/CapMachine.Model/MeterConfig/MeterPTCPw.cs
+++ b/CapMachine.Model/MeterConfig/MeterPTCPw.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
diff --git a/CapMachine.Model/MeterConfig/MeterPd.cs b/CapMachine.Model/MeterConfig/MeterPd.cs
deleted file mode 100644
index 7930ee8..0000000
--- a/CapMachine.Model/MeterConfig/MeterPd.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using FreeSql.DataAnnotations;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CapMachine.Model
-{
- ///
- /// Pd表设置
- ///
- [Table(Name = "MeterPd")]
- public class MeterPd
- {
- ///
- /// 主键
- ///
- [Column(IsPrimary = true, IsIdentity = true)]
- public long Id { get; set; }
-
- ///
- /// 程序步骤序号
- ///
- [Column(Name = "StepNo")]
- public int StepNo { get; set; }
-
- ///
- /// 开始值
- ///
- [Column(Name = "StartValue")]
- public double StartValue { get; set; }
-
- ///
- /// 结束值
- ///
- [Column(Name = "EndValue")]
- public double EndValue { get; set; }
-
- ///
- /// 维持时间
- ///
- [Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
-
- ///
- /// 配置值类型
- ///
- [Column(MapType = typeof(int))]
- public ConfigValueType ValueType { get; set; }
-
- ///
- /// 常值
- /// 在ValueType为常值时会使用
- ///
- [Column(Name = "Constant")]
- public double Constant { get; set; }
-
-
- [Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
- public DateTime CreateTime { get; set; }
-
- ///
- /// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
- ///
-
- public long ProStepId { get; set; }
- public ProStep? ProStep { get; set; }
- }
-}
diff --git a/CapMachine.Model/MeterConfig/MeterPs.cs b/CapMachine.Model/MeterConfig/MeterPs.cs
deleted file mode 100644
index b6f1cdf..0000000
--- a/CapMachine.Model/MeterConfig/MeterPs.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using FreeSql.DataAnnotations;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CapMachine.Model
-{
- ///
- /// Ps表设置
- ///
- [Table(Name = "MeterPs")]
- public class MeterPs
- {
- ///
- /// 主键
- ///
- [Column(IsPrimary = true, IsIdentity = true)]
- public long Id { get; set; }
-
- ///
- /// 程序步骤序号
- ///
- [Column(Name = "StepNo")]
- public int StepNo { get; set; }
-
- ///
- /// 开始值
- ///
- [Column(Name = "StartValue")]
- public double StartValue { get; set; }
-
- ///
- /// 结束值
- ///
- [Column(Name = "EndValue")]
- public double EndValue { get; set; }
-
- ///
- /// 维持时间
- ///
- [Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
-
- ///
- /// 配置值类型
- ///
- [Column(MapType = typeof(int))]
- public ConfigValueType ValueType { get; set; }
-
- ///
- /// 常值
- /// 在ValueType为常值时会使用
- ///
- [Column(Name = "Constant")]
- public double Constant { get; set; }
-
-
- [Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
- public DateTime CreateTime { get; set; }
-
- ///
- /// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
- ///
-
- public long ProStepId { get; set; }
- public ProStep? ProStep { get; set; }
- }
-}
diff --git a/CapMachine.Model/MeterConfig/MeterSpeed.cs b/CapMachine.Model/MeterConfig/MeterSpeed.cs
index 8d6a941..a4eeb37 100644
--- a/CapMachine.Model/MeterConfig/MeterSpeed.cs
+++ b/CapMachine.Model/MeterConfig/MeterSpeed.cs
@@ -41,7 +41,7 @@ namespace CapMachine.Model
/// 维持时间
///
[Column(Name = "KeepTime")]
- public double KeepTime { get; set; }
+ public int KeepTime { get; set; }
///
/// 配置值类型
@@ -56,7 +56,54 @@ namespace CapMachine.Model
[Column(Name = "Constant")]
public double Constant { get; set; }
-
+ ///
+ /// ///////////////////////////////////////////跟随速度小步骤的常量数据///////////////////////////////////////////////////////
+ ///
+
+
+ ///
+ /// 输出锁定(0/1)
+ /// 跟随速度步骤的常值数据
+ ///
+ [Column(Name = "OutLock")]
+ public bool OutLock { get; set; }
+
+ ///
+ ///参数编号(1~16)
+ /// 跟随速度步骤的常值数据
+ ///
+ [Column(Name = "ParNo")]
+ public int ParNo { get; set; }
+
+ ///
+ ///EV(1~4)
+ /// 跟随速度步骤的常值数据
+ ///
+ [Column(Name = "Ev")]
+ public int Ev { get; set; }
+
+ //
+ /// 压缩机使能(0/1)
+ /// 跟随速度步骤的常值数据
+ ///
+ [Column(Name = "CapEnable")]
+ public bool CapEnable { get; set; }
+
+ //
+ /// 吸排气阀(0/1)
+ /// 跟随速度步骤的常值数据
+ ///
+ [Column(Name = "InhExhValve")]
+ public bool InhExhValve { get; set; }
+
+ //
+ /// 加热器使能(0/1)
+ /// 跟随速度步骤的常值数据
+ ///
+ [Column(Name = "HeatEnable")]
+ public bool HeatEnable { get; set; }
+
+
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
diff --git a/CapMachine.Model/PLCParsModel/PlcBlockData.cs b/CapMachine.Model/PLCParsModel/PlcBlockData.cs
new file mode 100644
index 0000000..7576e88
--- /dev/null
+++ b/CapMachine.Model/PLCParsModel/PlcBlockData.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Model
+{
+ public class PlcBlockData
+ {
+ ///
+ /// 开始地址
+ ///
+ public string? StartAddress { get; set; }
+
+ ///
+ /// 值集合
+ ///
+ public short[]? ArrValue { get; set; }
+ }
+}
diff --git a/CapMachine.Model/PLCParsModel/PlcMeterStepCell.cs b/CapMachine.Model/PLCParsModel/PlcMeterStepCell.cs
new file mode 100644
index 0000000..ed5b35e
--- /dev/null
+++ b/CapMachine.Model/PLCParsModel/PlcMeterStepCell.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Model
+{
+ ///
+ /// 步骤的PLC数据单元
+ ///
+ public class PlcMeterStepCell
+ {
+ ///
+ /// 步骤序号
+ /// 从1开始
+ ///
+ public int Step { get; set; }
+
+ ///
+ /// 时间-分
+ ///
+ public int TimeMin { get; set; }
+
+ ///
+ /// 时间-秒
+ ///
+ public int TimeSec { get; set; }
+
+ ///
+ /// 循环
+ ///
+ public int Cycle { get; set; }
+
+ ///
+ /// 值
+ ///
+ public double? Value { get; set; }
+
+ /////
+ ///// 地址
+ /////
+ //public string? Address { get; set; }
+
+
+ ///
+ /// 值地址
+ ///
+ public string? ValueAddress { get; set; }
+
+ ///
+ /// 分钟地址
+ ///
+ public string? MinAddress { get; set; }
+
+ ///
+ /// 秒地址
+ ///
+ public string? SecAddress { get; set; }
+
+ ///
+ /// 循环地址
+ ///
+ public string? CycleAddress { get; set; }
+
+ }
+}
diff --git a/CapMachine.Model/PLCParsModel/PlcParsData.cs b/CapMachine.Model/PLCParsModel/PlcParsData.cs
new file mode 100644
index 0000000..98f837d
--- /dev/null
+++ b/CapMachine.Model/PLCParsModel/PlcParsData.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Model
+{
+ ///
+ /// PLC 解析信息数据
+ ///
+ public class PlcParsData
+ {
+ public PlcParsData()
+ {
+
+ Steps=new List ();
+ Unit = "";
+ }
+
+
+ ///
+ /// 名称
+ ///
+ public string? Name { get; set; }
+
+ ///
+ /// Model 名称/英文名称
+ ///
+ public string? EnName { get; set; }
+
+ ///
+ /// 单位
+ ///
+ public string? Unit { get; set; }
+
+ ///
+ /// 分辨率
+ ///
+ public int? Ratio { get; set; }
+
+ ///
+ /// 步骤集合信息
+ ///
+ public List Steps { get; set; }
+
+ ///
+ /// 值首地址
+ ///
+ public int? ValueStartAddress { get; set; }
+
+ ///
+ /// 分钟首地址
+ ///
+ public int? MinStartAddress { get; set; }
+
+ ///
+ /// 秒首地址
+ ///
+ public int? SecStartAddress { get; set; }
+
+ ///
+ /// 循环首地址
+ ///
+ public int? CycleStartAddress { get; set; }
+
+ }
+}
diff --git a/CapMachine.Model/ProSegRun.cs b/CapMachine.Model/ProSegRun.cs
new file mode 100644
index 0000000..785e0e3
--- /dev/null
+++ b/CapMachine.Model/ProSegRun.cs
@@ -0,0 +1,36 @@
+using FreeSql.DataAnnotations;
+
+namespace CapMachine.Model
+{
+ ///
+ /// 选中运行的程序名称
+ ///
+ [Table(Name = "ProSegRun")]
+ public class ProSegRun
+ {
+ ///
+ /// 主键
+ ///
+ [Column(IsPrimary = true, IsIdentity = true)]
+ public long Id { get; set; }
+
+ ///
+ /// 运行程序序号
+ ///
+ [Column(Name = "StepNo")]
+ public int StepNo { get; set; }
+
+ ///
+ /// 程序名称
+ /// 工况名称
+ ///
+ [Column(Name = "Name", IsNullable = false, StringLength = 50)]
+ public string? Name { get; set; }
+
+ ///
+ /// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
+ ///
+ public long ProgramSegId { get; set; }
+ public ProgramSeg? ProgramSeg { get; set; }
+ }
+}
diff --git a/CapMachine.Model/ProStep.cs b/CapMachine.Model/ProStep.cs
index 9f67167..f6823a1 100644
--- a/CapMachine.Model/ProStep.cs
+++ b/CapMachine.Model/ProStep.cs
@@ -12,7 +12,7 @@ namespace CapMachine.Model
/// 步骤
///
[Table(Name = "ProStep")]
- public class ProStep
+ public class ProStep
{
///
/// 主键
@@ -47,33 +47,35 @@ namespace CapMachine.Model
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
+ ///
+ /// 速度内部步骤的循环次数
+ ///
+ [Column(Name = "SpeedCycle")]
+ public int SpeedCycle { get; set; }
///
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
///
- public ICollection? MeterSpeeds { get; set; }
- public ICollection? MeterCond1Temps { get; set; }
- public ICollection? MeterCond2Temps { get; set; }
- public ICollection? MeterCondPresss { get; set; }
- public ICollection? MeterEVAPExpTemps { get; set; }
- public ICollection? MeterExPresss { get; set; }
- public ICollection? MeterHVVols { get; set; }
- public ICollection? MeterInhPresss { get; set; }
- public ICollection? MeterInhTemps { get; set; }
- public ICollection? MeterLoPresss { get; set; }
- public ICollection? MeterLVVols { get; set; }
- public ICollection? MeterOCRs { get; set; }
- public ICollection? MeterOS1Temps { get; set; }
- public ICollection? MeterOS2Temps { get; set; }
- public ICollection? MeterPTCEntTemps { get; set; }
- public ICollection? MeterPTCFlows { get; set; }
- public ICollection? MeterPTCPws { get; set; }
- public ICollection? MeterTestBoxRHs { get; set; }
- public ICollection? MeterTestBoxTemps { get; set; }
-
- //public ICollection? MeterPds { get; set; }
- //public ICollection? MeterPss { get; set; }
+ public List? MeterSpeeds { get; set; }=new List();
+ public List? MeterCond1Temps { get; set; }=new List();
+ public List? MeterCond2Temps { get; set; }= new List();
+ public List? MeterCond2Presss { get; set; } = new List();
+ public List? MeterEVAPExpTemps { get; set; }=new List();
+ public List? MeterExPresss { get; set; }=new List();
+ public List? MeterHVVols { get; set; } = new List();
+ public List? MeterInhPresss { get; set; } = new List();
+ public List? MeterInhTemps { get; set; } = new List();
+ public List? MeterLubePresss { get; set; } = new List();
+ public List? MeterLVVols { get; set; } = new List();
+ public List? MeterOCRs { get; set; }=new List();
+ public List? MeterOS1Temps { get; set; }=new List();
+ public List? MeterOS2Temps { get; set; }=new List();
+ public List? MeterPTCEntTemps { get; set; }=new List();
+ public List? MeterPTCFlows { get; set; }=new List();
+ public List? MeterPTCPws { get; set; } = new List();
+ public List? MeterEnvRHs { get; set; }=new List();
+ public List? MeterEnvTemps { get; set; }=new List();
///
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
diff --git a/CapMachine.Model/ProStepDto.cs b/CapMachine.Model/ProStepDto.cs
deleted file mode 100644
index 1d4d04f..0000000
--- a/CapMachine.Model/ProStepDto.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CapMachine.Model
-{
- public class ProStepDto
- {
- ///
- /// 主键
- ///
- public long Id { get; set; }
-
- ///
- /// 程序步骤序号
- ///
- public int StepNo { get; set; }
-
- ///
- /// 程序循环次数
- ///
- public int StepRepeat { get; set; }
-
- ///
- /// 压缩机转速信息
- ///
- public string? SpeedInfo { get; set; }
-
- ///
- /// PID信息
- ///
- public string? PID { get; set; }
-
- ///
- /// PID输出限幅信息
- ///
- public string? PIDOutLimit { get; set; }
-
- ///
- /// Ps信息
- ///
- public string? Ps { get; set; }
-
- ///
- /// Pd信息
- ///
- public string? PdInfo{ get; set; }
- }
-}
diff --git a/CapMachine.Model/ProgramSeg.cs b/CapMachine.Model/ProgramSeg.cs
index 8d87e17..94ddd6e 100644
--- a/CapMachine.Model/ProgramSeg.cs
+++ b/CapMachine.Model/ProgramSeg.cs
@@ -1,6 +1,4 @@
using FreeSql.DataAnnotations;
-using System;
-using System.Collections.Generic;
namespace CapMachine.Model
{
@@ -23,6 +21,13 @@ namespace CapMachine.Model
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
public string? Name { get; set; }
+ ///
+ /// 程序名称
+ /// 分类
+ ///
+ [Column(Name = "Category", IsNullable = true, StringLength = 50)]
+ public string? Category { get; set; }
+
///
/// 程序段反复
///
@@ -49,7 +54,7 @@ namespace CapMachine.Model
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
///
- public ICollection? ProSteps { get; set; }
+ public List? ProSteps { get; set; }
}
}
diff --git a/CapMachine.Model/QuickMeterConfig/QuickMeterStep.cs b/CapMachine.Model/QuickMeterConfig/QuickMeterStep.cs
new file mode 100644
index 0000000..9833bd1
--- /dev/null
+++ b/CapMachine.Model/QuickMeterConfig/QuickMeterStep.cs
@@ -0,0 +1,161 @@
+using FreeSql.DataAnnotations;
+
+namespace CapMachine.Model.QuickMeterConfig
+{
+ ///
+ /// 快速的步骤信息 QuickMeterStep
+ ///
+ [Table(Name = "QuickMeterStep")]
+ public class QuickMeterStep
+ {
+ ///
+ /// 主键
+ ///
+ [Column(IsPrimary = true, IsIdentity = true)]
+ public long Id { get; set; }
+
+ ///
+ /// 步骤序号
+ ///
+ [Column(Name = "StepNo")]
+ public int StepNo { get; set; }
+
+ ///
+ /// 时间-分钟
+ ///
+ [Column(Name = "TimeMin")]
+ public int TimeMin { get; set; }
+
+ ///
+ /// 时间-秒
+ ///
+ [Column(Name = "TimeSec")]
+ public int TimeSec { get; set; }
+
+ ///
+ /// 时间-循环
+ ///
+ [Column(Name = "Cycle")]
+ public int Cycle { get; set; }
+
+ ///
+ /// 速度
+ ///
+ [Column(Name = "Speed")]
+ public double Speed { get; set; }
+
+ ///
+ /// 排气压力
+ ///
+ [Column(Name = "ExPress")]
+ public double ExPress { get; set; }
+
+ ///
+ /// 吸气压力
+ ///
+ [Column(Name = "InhPress")]
+ public double InhPress { get; set; }
+
+ ///
+ /// 吸气温度
+ ///
+ [Column(Name = "InhTemp")]
+ public double InhTemp { get; set; }
+
+ ///
+ /// COND1温度
+ ///
+ [Column(Name = "Cond1Temp")]
+ public double Cond1Temp { get; set; }
+
+ ///
+ /// 润滑油压力
+ ///
+ [Column(Name = "LubePress")]
+ public double LubePress { get; set; }
+
+ ///
+ /// COND2压力
+ ///
+ [Column(Name = "Cond2Press")]
+ public double Cond2Press { get; set; }
+
+ ///
+ /// OCR
+ ///
+ [Column(Name = "OCR")]
+ public double OCR { get; set; }
+
+ ///
+ /// HV电压
+ ///
+ [Column(Name = "HVVol")]
+ public double HVVol { get; set; }
+
+ ///
+ /// LV电压
+ ///
+ [Column(Name = "LVVol")]
+ public double LVVol { get; set; }
+
+ ///
+ /// 环境湿度
+ ///
+ [Column(Name = "EnvRH")]
+ public double EnvRH { get; set; }
+
+ ///
+ /// 环境温度
+ ///
+ [Column(Name = "EnvTemp")]
+ public double EnvTemp { get; set; }
+
+ ///
+ /// OS1温度
+ ///
+ [Column(Name = "OS1Temp")]
+ public double OS1Temp { get; set; }
+
+ ///
+ /// OS2温度
+ ///
+ [Column(Name = "OS2Temp")]
+ public double OS2Temp { get; set; }
+
+ ///
+ /// PTC入口温度
+ ///
+ [Column(Name = "PTCEntTemp")]
+ public double PTCEntTemp { get; set; }
+
+ ///
+ /// PTC流量
+ ///
+ [Column(Name = "PTCFlow")]
+ public double PTCFlow { get; set; }
+
+ ///
+ /// PTC功率
+ ///
+ [Column(Name = "PTCPw")]
+ public double PTCPw { get; set; }
+
+ ///
+ /// EVAP出口温度
+ ///
+ [Column(Name = "EVAPExpTemp")]
+ public double EVAPExpTemp { get; set; }
+
+ ///
+ /// COND2温度
+ ///
+ [Column(Name = "Cond2Temp")]
+ public double Cond2Temp { get; set; }
+
+ /////
+ ///// xxxx
+ /////
+ //[Column(Name = "xxxx")]
+ //public double xxxx { get; set; }
+ }
+}
diff --git a/CapMachine.Shared/Controls/BoolNgConvert.cs b/CapMachine.Shared/Controls/BoolNgConvert.cs
new file mode 100644
index 0000000..b44cee3
--- /dev/null
+++ b/CapMachine.Shared/Controls/BoolNgConvert.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace CapMachine.Shared.Controls
+{
+ public class BoolNgConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is bool booleanValue)
+ {
+ return !booleanValue;
+ }
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is bool booleanValue)
+ {
+ return !booleanValue;
+ }
+ return value;
+ }
+ }
+}
diff --git a/CapMachine.Shared/Controls/MeterConfig.xaml b/CapMachine.Shared/Controls/MeterConfig.xaml
index 1773aa8..5817bd5 100644
--- a/CapMachine.Shared/Controls/MeterConfig.xaml
+++ b/CapMachine.Shared/Controls/MeterConfig.xaml
@@ -8,10 +8,12 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="MeterConfigInstance"
- d:DesignHeight="330"
- d:DesignWidth="360"
+ d:DesignHeight="400"
+ d:DesignWidth="300"
mc:Ignorable="d">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+ 常值数据
+
+
+
+
-
-
-
+ Margin="0,0,20,0"
+ Command="{Binding ElementName=MeterConfigInstance, Path=ConstantSaveCommand}"
+ Content="确定"
+ Foreground="White" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
+
+
+
+
+
+
+
diff --git a/CapMachine.Shared/Controls/MeterConfig.xaml.cs b/CapMachine.Shared/Controls/MeterConfig.xaml.cs
index 1a522d5..7ec1758 100644
--- a/CapMachine.Shared/Controls/MeterConfig.xaml.cs
+++ b/CapMachine.Shared/Controls/MeterConfig.xaml.cs
@@ -27,6 +27,44 @@ namespace CapMachine.Shared.Controls
InitializeComponent();
}
+ //ConstSlopSelectedIndex
+ ///
+ /// TabControl选择的Index
+ ///
+ public int ConstSlopSelectedIndex
+ {
+ get
+ {
+ return (int)base.GetValue(MeterConfig.ConstSlopSelectedIndexProperty);
+ }
+ set
+ {
+ base.SetValue(MeterConfig.ConstSlopSelectedIndexProperty, value);
+ }
+ }
+ public static readonly DependencyProperty ConstSlopSelectedIndexProperty = DependencyProperty.Register("ConstSlopSelectedIndex", typeof(int), typeof(MeterConfig), new PropertyMetadata(1));
+
+
+ ///
+ /// 常量数据
+ ///
+ public double ConstantValue
+ {
+ get
+ {
+ return (double)base.GetValue(MeterConfig.ConstantValueProperty);
+ }
+ set
+ {
+ base.SetValue(MeterConfig.ConstantValueProperty, value);
+ }
+ }
+ public static readonly DependencyProperty ConstantValueProperty = DependencyProperty.Register("ConstantValue", typeof(double), typeof(MeterConfig), new PropertyMetadata(0.0));
+
+
+ ///
+ /// 仪表名称
+ ///
public string MeterName
{
get
@@ -38,7 +76,7 @@ namespace CapMachine.Shared.Controls
base.SetValue(MeterConfig.MeterNameProperty, value);
}
}
- public static readonly DependencyProperty MeterNameProperty = DependencyProperty.Register("MeterName", typeof(string), typeof(MeterConfig), new PropertyMetadata("速度"));
+ public static readonly DependencyProperty MeterNameProperty = DependencyProperty.Register("MeterName", typeof(string), typeof(MeterConfig), new PropertyMetadata("变量"));
//MeterSlopCell
@@ -107,7 +145,7 @@ namespace CapMachine.Shared.Controls
//MeterSelectedChangedCmd
///
- /// Add 命令
+ /// MeterSelectedChanged 命令
///
public ICommand MeterSelectedChangedCmd
{
@@ -118,5 +156,96 @@ namespace CapMachine.Shared.Controls
DependencyProperty.Register("MeterSelectedChangedCmd", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
+ ///
+ /// Constant 保存 命令
+ ///
+ public ICommand ConstantSaveCommand
+ {
+ get { return (ICommand)GetValue(ConstantSaveCommandProperty); }
+ set { SetValue(ConstantSaveCommandProperty, value); }
+ }
+ public static readonly DependencyProperty ConstantSaveCommandProperty =
+ DependencyProperty.Register("ConstantSaveCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
+
+
+
+ ///
+ /// Constant/Slop 常值和斜率切换 命令
+ ///
+ public ICommand SwitchConstSlopCommand
+ {
+ get { return (ICommand)GetValue(SwitchConstSlopCommandProperty); }
+ set { SetValue(SwitchConstSlopCommandProperty, value); }
+ }
+ public static readonly DependencyProperty SwitchConstSlopCommandProperty =
+ DependencyProperty.Register("SwitchConstSlopCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
+
+ /////
+ ///// Constant/Slop 切换命令的参数值
+ /////
+ //public bool SwitchConstSlopPar
+ //{
+ // get
+ // {
+ // return (bool)base.GetValue(MeterConfig.SwitchConstSlopParProperty);
+ // }
+ // set
+ // {
+ // base.SetValue(MeterConfig.SwitchConstSlopParProperty, value);
+ // }
+ //}
+ //public static readonly DependencyProperty SwitchConstSlopParProperty = DependencyProperty.Register("SwitchConstSlopPar", typeof(bool), typeof(MeterConfig), new PropertyMetadata(true));
+
+
+ ///
+ /// 斜率列表总时间
+ ///
+ public int TotalSlopTime
+ {
+ get
+ {
+ return (int)base.GetValue(MeterConfig.TotalSlopTimeProperty);
+ }
+ set
+ {
+ base.SetValue(MeterConfig.TotalSlopTimeProperty, value);
+ }
+ }
+ public static readonly DependencyProperty TotalSlopTimeProperty = DependencyProperty.Register("TotalSlopTime", typeof(int), typeof(MeterConfig), new PropertyMetadata(0));
+
+
+ ///
+ /// 斜率循环的次数
+ ///
+ public double Cycle
+ {
+ get
+ {
+ return (double)base.GetValue(MeterConfig.CycleProperty);
+ }
+ set
+ {
+ base.SetValue(MeterConfig.CycleProperty, value);
+ }
+ }
+ public static readonly DependencyProperty CycleProperty = DependencyProperty.Register("Cycle", typeof(double), typeof(MeterConfig), new PropertyMetadata(1.0));
+
+
+ ///
+ /// 斜率列表 是否满足要求
+ ///
+ public bool IsTimeOk
+ {
+ get
+ {
+ return (bool)base.GetValue(MeterConfig.IsTimeOkProperty);
+ }
+ set
+ {
+ base.SetValue(MeterConfig.IsTimeOkProperty, value);
+ }
+ }
+ public static readonly DependencyProperty IsTimeOkProperty = DependencyProperty.Register("IsTimeOk", typeof(bool), typeof(MeterConfig), new PropertyMetadata(false));
+
}
}
diff --git a/CapMachine.Shared/Controls/SecToStrConvert.cs b/CapMachine.Shared/Controls/SecToStrConvert.cs
new file mode 100644
index 0000000..d4dba28
--- /dev/null
+++ b/CapMachine.Shared/Controls/SecToStrConvert.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace CapMachine.Shared.Controls
+{
+ ///
+ /// 秒到字符串类型的展示
+ ///
+ public class SecToStrConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ return null;
+
+ return SecToString((int)value);
+
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ return null;
+
+ return StringToSec((string)value);
+ }
+
+ ///
+ /// 秒时间到 00:00:00字符串
+ ///
+ ///
+ private string SecToString(int TotalSec)
+ {
+ try
+ {
+ TimeSpan TimeInfo = TimeSpan.FromSeconds(TotalSec);
+ return TimeInfo.ToString();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("请检查输入时间数据!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand);
+ return "00:00:00";
+ }
+
+ }
+
+ ///
+ /// 00:00:00到秒时间
+ ///
+ ///
+ private int StringToSec(string timeString)
+ {
+ try
+ {
+ TimeSpan TimeInfo = TimeSpan.Parse(timeString);
+ return (int)TimeInfo.TotalSeconds;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("请按照时间样式输入时间数据!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand);
+ return 0;
+ }
+
+
+ }
+ }
+}
diff --git a/CapMachine.Wpf/App.config b/CapMachine.Wpf/App.config
index bf9a94b..0187521 100644
--- a/CapMachine.Wpf/App.config
+++ b/CapMachine.Wpf/App.config
@@ -3,6 +3,8 @@
+
+
\ No newline at end of file
diff --git a/CapMachine.Wpf/App.xaml.cs b/CapMachine.Wpf/App.xaml.cs
index d13b483..ca44b9b 100644
--- a/CapMachine.Wpf/App.xaml.cs
+++ b/CapMachine.Wpf/App.xaml.cs
@@ -1,4 +1,5 @@
using AutoMapper;
+using CapMachine.Core;
using CapMachine.Core.IService;
using CapMachine.Wpf.MapperProfile;
using CapMachine.Wpf.Services;
@@ -65,12 +66,21 @@ namespace CapMachine.Wpf
containerRegistry.RegisterSingleton();
containerRegistry.Register(typeof(IMapper), GetMapper);
+ string strsqllite = System.AppDomain.CurrentDomain.BaseDirectory+ @"Db\CapMachine.db";
+ string strslocaldb = System.AppDomain.CurrentDomain.BaseDirectory+ @"Db\CapMachineDb";
+ //string assemblyPath = Assembly.GetExecutingAssembly().Location;
+ var Con = ConfigHelper.GetValue("connecting5").Replace("@Address@", strsqllite);
+ var LocalDb = @"Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=@Address@.mdf;Integrated Security=True;Connect Timeout=30;";
+ var LocalDbStr = LocalDb.Replace("@Address@", strslocaldb);
+
//注册IFreeSql实例 单例
containerRegistry.RegisterSingleton(() =>
{
IFreeSql Fsql = new FreeSqlBuilder()
//.UseConnectionString(DataType.SqlServer, "Data Source=CT-PC;user instance=false;Initial Catalog=KylinEMS;Encrypt=True;TrustServerCertificate=True;User ID=sa;Password=12345678")
- .UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=CT-PC;user instance=false;Initial Catalog=CapMachine;Encrypt=True;TrustServerCertificate=True;User ID=sa;Password=12345678")
+ //.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=CT-PC;user instance=false;Initial Catalog=CapMachine;Encrypt=True;TrustServerCertificate=True;User ID=sa;Password=12345678")
+ .UseConnectionString(FreeSql.DataType.SqlServer, LocalDbStr)
+ //.UseConnectionString(FreeSql.DataType.Sqlite, Con)
.UseAutoSyncStructure(true)
.Build();
return Fsql;
diff --git a/CapMachine.Wpf/CapMachine.Wpf.csproj b/CapMachine.Wpf/CapMachine.Wpf.csproj
index cf26f1c..02a961d 100644
--- a/CapMachine.Wpf/CapMachine.Wpf.csproj
+++ b/CapMachine.Wpf/CapMachine.Wpf.csproj
@@ -1,7 +1,7 @@
- Exe
+ WinExe
net6.0-windows
enable
enable
@@ -20,9 +20,11 @@
-
-
-
+
+
+
+
+
@@ -65,5 +67,16 @@
PreserveNewest
+
+
+ Always
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
diff --git a/CapMachine.Wpf/Converts/MeterSlopCycleConver.cs b/CapMachine.Wpf/Converts/MeterSlopCycleConver.cs
new file mode 100644
index 0000000..f2c5145
--- /dev/null
+++ b/CapMachine.Wpf/Converts/MeterSlopCycleConver.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace CapMachine.Wpf.Converts
+{
+ ///
+ /// 循环次数的显示
+ ///
+ public class MeterSlopCycleConver : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ return null;
+
+ return " ×" + value.ToString();
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value;
+ }
+ }
+}
diff --git a/CapMachine.Wpf/Converts/SecToStrConvert.cs b/CapMachine.Wpf/Converts/SecToStrConvert.cs
new file mode 100644
index 0000000..a133c66
--- /dev/null
+++ b/CapMachine.Wpf/Converts/SecToStrConvert.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using static ICSharpCode.SharpZipLib.Zip.ZipEntryFactory;
+
+namespace CapMachine.Wpf.Converts
+{
+ ///
+ /// 秒到字符串类型的展示
+ ///
+ public class SecToStrConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ return null;
+
+ return SecToString((int)value);
+
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ return null;
+
+ return StringToSec((string)value);
+ }
+
+ ///
+ /// 秒时间到 00:00:00字符串
+ ///
+ ///
+ private string SecToString(int TotalSec)
+ {
+ TimeSpan TimeInfo = TimeSpan.FromSeconds(TotalSec);
+ return TimeInfo.ToString();
+ }
+
+ ///
+ /// 00:00:00到秒时间
+ ///
+ ///
+ private int StringToSec(string timeString)
+ {
+ try
+ {
+ TimeSpan TimeInfo = TimeSpan.Parse(timeString);
+ return (int)TimeInfo.TotalSeconds;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("时间格式输入不正确");
+ return (int)0;
+ }
+
+
+ }
+ }
+}
diff --git a/CapMachine.Wpf/Db/CapMachine.db b/CapMachine.Wpf/Db/CapMachine.db
new file mode 100644
index 0000000..87bfe8e
Binary files /dev/null and b/CapMachine.Wpf/Db/CapMachine.db differ
diff --git a/CapMachine.Wpf/Dtos/CycleInfoDto.cs b/CapMachine.Wpf/Dtos/CycleInfoDto.cs
new file mode 100644
index 0000000..ee0e72f
--- /dev/null
+++ b/CapMachine.Wpf/Dtos/CycleInfoDto.cs
@@ -0,0 +1,33 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Dtos
+{
+ public class CycleInfoDto : BindableBase
+ {
+ private int _Cycle;
+ ///
+ /// 速度循环个数 信息
+ ///
+ public int Cycle
+ {
+ get { return _Cycle; }
+ set { _Cycle = value; RaisePropertyChanged(); }
+ }
+
+ private bool _IsSlop;
+ ///
+ /// 是否是斜率 信息
+ ///
+ public bool IsSlop
+ {
+ get { return _IsSlop; }
+ set { _IsSlop = value; RaisePropertyChanged(); }
+ }
+
+ }
+}
diff --git a/CapMachine.Wpf/Dtos/MeterExInfoDto.cs b/CapMachine.Wpf/Dtos/MeterExInfoDto.cs
new file mode 100644
index 0000000..a7db1ed
--- /dev/null
+++ b/CapMachine.Wpf/Dtos/MeterExInfoDto.cs
@@ -0,0 +1,65 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Dtos
+{
+ ///
+ /// 仪表拓展信息
+ ///
+ public class MeterExInfoDto : BindableBase
+ {
+ public MeterExInfoDto()
+ {
+ SlopCycle = 1;
+ }
+
+ private int _TotalSlopTime;
+ ///
+ /// 斜率列表总时间
+ ///
+ public int TotalSlopTime
+ {
+ get { return _TotalSlopTime; }
+ set { _TotalSlopTime = value; RaisePropertyChanged(); }
+ }
+
+ private int _SlopTime;
+ ///
+ /// 斜率列表时间
+ ///
+ public int SlopTime
+ {
+ get { return _SlopTime; }
+ set { _SlopTime = value; RaisePropertyChanged(); }
+ }
+
+ private double _SlopCycle;
+ ///
+ /// 斜率循环次数
+ ///
+ public double SlopCycle
+ {
+ get { return _SlopCycle; }
+ set
+ {
+ _SlopCycle = value;
+ //TotalSlopTime = SlopTime * (int)value;
+ RaisePropertyChanged();
+ }
+ }
+
+ private bool _IsTimeOk;
+ ///
+ /// 斜率列表 是否满足要求
+ ///
+ public bool IsTimeOk
+ {
+ get { return _IsTimeOk; }
+ set { _IsTimeOk = value; RaisePropertyChanged(); }
+ }
+ }
+}
diff --git a/CapMachine.Wpf/Dtos/ProStepDto.cs b/CapMachine.Wpf/Dtos/ProStepDto.cs
new file mode 100644
index 0000000..f5cd4fe
--- /dev/null
+++ b/CapMachine.Wpf/Dtos/ProStepDto.cs
@@ -0,0 +1,232 @@
+using CapMachine.Wpf.Dtos;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Model
+{
+ ///
+ /// 程序步骤的模型
+ ///
+ public class ProStepDto : BindableBase
+ {
+ ///
+ /// 主键
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// 程序步骤序号
+ ///
+ public int StepNo { get; set; }
+
+ ///
+ /// 程序循环次数
+ ///
+ public int StepRepeat { get; set; }
+
+ private CycleInfoDto? _SpeedCycle=new CycleInfoDto();
+ ///
+ /// 速度循环信息
+ ///
+ public CycleInfoDto? SpeedCycle
+ {
+ get { return _SpeedCycle; }
+ set { _SpeedCycle = value; RaisePropertyChanged(); }
+ }
+
+ private string? _SpeedInfo;
+ ///
+ /// 压缩机转速 信息
+ ///
+ public string? SpeedInfo
+ {
+ get { return _SpeedInfo; }
+ set { _SpeedInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterCond1TempInfo;
+ ///
+ /// MeterCond1Temp 信息
+ ///
+ public string? MeterCond1TempInfo
+ {
+ get { return _MeterCond1TempInfo; }
+ set { _MeterCond1TempInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterCond2TempInfo;
+ ///
+ /// MeterCond2Temp 信息
+ ///
+ public string? MeterCond2TempInfo
+ {
+ get { return _MeterCond2TempInfo; }
+ set { _MeterCond2TempInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterCond2PressInfo;
+ ///
+ /// MeterCond2Press 信息
+ ///
+ public string? MeterCond2PressInfo
+ {
+ get { return _MeterCond2PressInfo; }
+ set { _MeterCond2PressInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterEVAPExpTempInfo;
+ ///
+ /// MeterEVAPExpTemp 信息
+ ///
+ public string? MeterEVAPExpTempInfo
+ {
+ get { return _MeterEVAPExpTempInfo; }
+ set { _MeterEVAPExpTempInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterExPressInfo;
+ ///
+ /// MeterExPress 信息
+ ///
+ public string? MeterExPressInfo
+ {
+ get { return _MeterExPressInfo; }
+ set { _MeterExPressInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterHVVolInfo;
+ ///
+ /// MeterHVVol 信息
+ ///
+ public string? MeterHVVolInfo
+ {
+ get { return _MeterHVVolInfo; }
+ set { _MeterHVVolInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterInhPressInfo;
+ ///
+ /// MeterInhPress 信息
+ ///
+ public string? MeterInhPressInfo
+ {
+ get { return _MeterInhPressInfo; }
+ set { _MeterInhPressInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterInhTempInfo;
+ ///
+ /// MeterInhTemp 信息
+ ///
+ public string? MeterInhTempInfo
+ {
+ get { return _MeterInhTempInfo; }
+ set { _MeterInhTempInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterLubePressInfo;
+ ///
+ /// MeterLubePress 信息
+ ///
+ public string? MeterLubePressInfo
+ {
+ get { return _MeterLubePressInfo; }
+ set { _MeterLubePressInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterLVVolInfo;
+ ///
+ /// MeterLVVol 信息
+ ///
+ public string? MeterLVVolInfo
+ {
+ get { return _MeterLVVolInfo; }
+ set { _MeterLVVolInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterOCRInfo;
+ ///
+ /// MeterOCR 信息
+ ///
+ public string? MeterOCRInfo
+ {
+ get { return _MeterOCRInfo; }
+ set { _MeterOCRInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterOS1TempInfo;
+ ///
+ /// MeterOS1Temp 信息
+ ///
+ public string? MeterOS1TempInfo
+ {
+ get { return _MeterOS1TempInfo; }
+ set { _MeterOS1TempInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterOS2TempInfo;
+ ///
+ /// MeterOS2Temp 信息
+ ///
+ public string? MeterOS2TempInfo
+ {
+ get { return _MeterOS2TempInfo; }
+ set { _MeterOS2TempInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterPTCEntTempInfo;
+ ///
+ /// MeterPTCEntTemp 信息
+ ///
+ public string? MeterPTCEntTempInfo
+ {
+ get { return _MeterPTCEntTempInfo; }
+ set { _MeterPTCEntTempInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterPTCFlowInfo;
+ ///
+ /// MeterPTCFlow 信息
+ ///
+ public string? MeterPTCFlowInfo
+ {
+ get { return _MeterPTCFlowInfo; }
+ set { _MeterPTCFlowInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterPTCPwInfo;
+ ///
+ /// MeterPTCPw 信息
+ ///
+ public string? MeterPTCPwInfo
+ {
+ get { return _MeterPTCPwInfo; }
+ set { _MeterPTCPwInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterEnvRHInfo;
+ ///
+ /// MeterTestBoxRH 信息
+ ///
+ public string? MeterEnvRHInfo
+ {
+ get { return _MeterEnvRHInfo; }
+ set { _MeterEnvRHInfo = value; RaisePropertyChanged(); }
+ }
+
+ private string? _MeterEnvTempInfo;
+ ///
+ /// MeterTestBoxTemp 信息
+ ///
+ public string? MeterEnvTempInfo
+ {
+ get { return _MeterEnvTempInfo; }
+ set { _MeterEnvTempInfo = value; RaisePropertyChanged(); }
+ }
+
+ }
+}
diff --git a/CapMachine.Wpf/Dtos/QuickMeterStepDto.cs b/CapMachine.Wpf/Dtos/QuickMeterStepDto.cs
new file mode 100644
index 0000000..e68658a
--- /dev/null
+++ b/CapMachine.Wpf/Dtos/QuickMeterStepDto.cs
@@ -0,0 +1,244 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Dtos
+{
+ public class QuickMeterStepDto : BindableBase
+ {
+
+ private int _StepNo;
+ ///
+ /// 步骤序号
+ ///
+ public int StepNo
+ {
+ get { return _StepNo; }
+ set { _StepNo = value; RaisePropertyChanged(); }
+ }
+
+ private int _TimeMin;
+ ///
+ /// 时间-分钟
+ ///
+ public int TimeMin
+ {
+ get { return _TimeMin; }
+ set { _TimeMin = value; RaisePropertyChanged(); }
+ }
+
+ private int _TimeSec;
+ ///
+ /// 时间-秒
+ ///
+ public int TimeSec
+ {
+ get { return _TimeSec; }
+ set { _TimeSec = value; RaisePropertyChanged(); }
+ }
+
+ private int _Cycle;
+ ///
+ /// 循环
+ ///
+ public int Cycle
+ {
+ get { return _Cycle; }
+ set { _Cycle = value; RaisePropertyChanged(); }
+ }
+
+ private double _Speed;
+ ///
+ /// 速度 信息
+ ///
+ public double Speed
+ {
+ get { return _Speed; }
+ set { _Speed = value; RaisePropertyChanged(); }
+ }
+
+ private double _Cond1Temp;
+ ///
+ /// COND1温度 信息
+ ///
+ public double Cond1Temp
+ {
+ get { return _Cond1Temp; }
+ set { _Cond1Temp = value; RaisePropertyChanged(); }
+ }
+
+ private double _Cond2Temp;
+ ///
+ /// COND2温度 信息
+ ///
+ public double Cond2Temp
+ {
+ get { return _Cond2Temp; }
+ set { _Cond2Temp = value; RaisePropertyChanged(); }
+ }
+
+ private double _Cond2Press;
+ ///
+ /// COND2压力 信息
+ ///
+ public double Cond2Press
+ {
+ get { return _Cond2Press; }
+ set { _Cond2Press = value; RaisePropertyChanged(); }
+ }
+
+ private double _EVAPExpTemp;
+ ///
+ /// EVAP出口温度 信息
+ ///
+ public double EVAPExpTemp
+ {
+ get { return _EVAPExpTemp; }
+ set { _EVAPExpTemp = value; RaisePropertyChanged(); }
+ }
+
+ private double _ExPress;
+ ///
+ /// 排气压力 信息
+ ///
+ public double ExPress
+ {
+ get { return _ExPress; }
+ set { _ExPress = value; RaisePropertyChanged(); }
+ }
+
+ private double _HVVol;
+ ///
+ /// HV电压 信息
+ ///
+ public double HVVol
+ {
+ get { return _HVVol; }
+ set { _HVVol = value; RaisePropertyChanged(); }
+ }
+
+ private double _InhPress;
+ ///
+ /// 吸气压力 信息
+ ///
+ public double InhPress
+ {
+ get { return _InhPress; }
+ set { _InhPress = value; RaisePropertyChanged(); }
+ }
+
+ private double _InhTemp;
+ ///
+ /// 吸气温度 信息
+ ///
+ public double InhTemp
+ {
+ get { return _InhTemp; }
+ set { _InhTemp = value; RaisePropertyChanged(); }
+ }
+
+ private double _LubePress;
+ ///
+ /// 润滑油压力 信息
+ ///
+ public double LubePress
+ {
+ get { return _LubePress; }
+ set { _LubePress = value; RaisePropertyChanged(); }
+ }
+
+ private double _LVVol;
+ ///
+ /// LV电压 信息
+ ///
+ public double LVVol
+ {
+ get { return _LVVol; }
+ set { _LVVol = value; RaisePropertyChanged(); }
+ }
+
+ private double _OCR;
+ ///
+ /// OCR 信息
+ ///
+ public double OCR
+ {
+ get { return _OCR; }
+ set { _OCR = value; RaisePropertyChanged(); }
+ }
+
+ private double _OS1Temp;
+ ///
+ /// OS1温度 信息
+ ///
+ public double OS1Temp
+ {
+ get { return _OS1Temp; }
+ set { _OS1Temp = value; RaisePropertyChanged(); }
+ }
+
+ private double _OS2Temp;
+ ///
+ /// OS2温度 信息
+ ///
+ public double OS2Temp
+ {
+ get { return _OS2Temp; }
+ set { _OS2Temp = value; RaisePropertyChanged(); }
+ }
+
+ private double _PTCEntTemp;
+ ///
+ /// PTC入口温度 信息
+ ///
+ public double PTCEntTemp
+ {
+ get { return _PTCEntTemp; }
+ set { _PTCEntTemp = value; RaisePropertyChanged(); }
+ }
+
+ private double _PTCFlow;
+ ///
+ /// PTC流量 信息
+ ///
+ public double PTCFlow
+ {
+ get { return _PTCFlow; }
+ set { _PTCFlow = value; RaisePropertyChanged(); }
+ }
+
+ private double _PTCPw;
+ ///
+ /// PTC功率 信息
+ ///
+ public double PTCPw
+ {
+ get { return _PTCPw; }
+ set { _PTCPw = value; RaisePropertyChanged(); }
+ }
+
+ private double _EnvRH;
+ ///
+ /// 压缩机环境湿度 信息
+ ///
+ public double EnvRH
+ {
+ get { return _EnvRH; }
+ set { _EnvRH = value; RaisePropertyChanged(); }
+ }
+
+ private double _EnvTemp;
+ ///
+ /// 压缩机环境温度 信息
+ ///
+ public double EnvTemp
+ {
+ get { return _EnvTemp; }
+ set { _EnvTemp = value; RaisePropertyChanged(); }
+ }
+
+ }
+}
diff --git a/CapMachine.Wpf/EnvSupport/SqlLocalDB.msi b/CapMachine.Wpf/EnvSupport/SqlLocalDB.msi
new file mode 100644
index 0000000..d7c805b
Binary files /dev/null and b/CapMachine.Wpf/EnvSupport/SqlLocalDB.msi differ
diff --git a/CapMachine.Wpf/EnvSupport/windowsdesktop-runtime-6.0.33-win-x64.exe b/CapMachine.Wpf/EnvSupport/windowsdesktop-runtime-6.0.33-win-x64.exe
new file mode 100644
index 0000000..390383f
Binary files /dev/null and b/CapMachine.Wpf/EnvSupport/windowsdesktop-runtime-6.0.33-win-x64.exe differ
diff --git a/CapMachine.Wpf/MapperProfile/ActionLogProfile.cs b/CapMachine.Wpf/MapperProfile/ActionLogProfile.cs
index 107f9f1..c3b634a 100644
--- a/CapMachine.Wpf/MapperProfile/ActionLogProfile.cs
+++ b/CapMachine.Wpf/MapperProfile/ActionLogProfile.cs
@@ -2,11 +2,6 @@
using CapMachine.Model;
using CapMachine.Wpf.Dtos;
using CapMachine.Wpf.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace CapMachine.Wpf.MapperProfile
{
diff --git a/CapMachine.Wpf/MapperProfile/QuickMeterStepProfile.cs b/CapMachine.Wpf/MapperProfile/QuickMeterStepProfile.cs
new file mode 100644
index 0000000..d6b2ad4
--- /dev/null
+++ b/CapMachine.Wpf/MapperProfile/QuickMeterStepProfile.cs
@@ -0,0 +1,15 @@
+using AutoMapper;
+using CapMachine.Model;
+using CapMachine.Model.QuickMeterConfig;
+using CapMachine.Wpf.Dtos;
+
+namespace CapMachine.Wpf.MapperProfile
+{
+ public class QuickMeterStepProfile : Profile
+ {
+ public QuickMeterStepProfile()
+ {
+ CreateMap().ReverseMap();
+ }
+ }
+}
diff --git a/CapMachine.Wpf/Models/ComEnum.cs b/CapMachine.Wpf/Models/ComEnum.cs
new file mode 100644
index 0000000..93a348c
--- /dev/null
+++ b/CapMachine.Wpf/Models/ComEnum.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Models
+{
+ public class ComEnum
+ {
+ ///
+ /// 标签类型
+ ///
+ public enum TagType
+ {
+ ///
+ /// 仪表数据
+ ///
+ Meter = 1,
+
+ ///
+ /// 通讯的数据,来自于通信
+ ///
+ Comms = 2,
+
+ ///
+ /// 普通的标签数据
+ ///
+ Tag = 3,
+ }
+
+ ///
+ /// 数据类型
+ ///
+ public enum DataType
+ {
+ ///
+ /// 字
+ ///
+ Short = 1,
+
+ ///
+ /// 浮点数
+ ///
+ Double = 2,
+
+ ///
+ /// 字符串
+ ///
+ String = 3,
+
+ ///
+ /// 字节
+ ///
+ Byte = 0,
+ }
+ }
+}
diff --git a/CapMachine.Wpf/Models/Meter/MeterRtDataModel.cs b/CapMachine.Wpf/Models/Meter/MeterRtDataModel.cs
index 9585bd1..0f848cf 100644
--- a/CapMachine.Wpf/Models/Meter/MeterRtDataModel.cs
+++ b/CapMachine.Wpf/Models/Meter/MeterRtDataModel.cs
@@ -147,20 +147,20 @@ namespace CapMachine.Wpf.Models
///
public string RtAddressSV;
- ///
- /// MV值的UI展示名称
- ///
- public string RtMVUIControlIndex;
+ /////
+ ///// MV值的UI展示名称
+ /////
+ //public string RtMVUIControlIndex;
- ///
- /// PV值的UI展示名称
- ///
- public string RtPVUIControlIndex;
+ /////
+ ///// PV值的UI展示名称
+ /////
+ //public string RtPVUIControlIndex;
- ///
- /// SV值的UI展示名称
- ///
- public string RtSVUIControlIndex;
+ /////
+ ///// SV值的UI展示名称
+ /////
+ //public string RtSVUIControlIndex;
///
/// UI展示名称标题
@@ -180,16 +180,22 @@ namespace CapMachine.Wpf.Models
//////////////////////////////////////////////////
#region 仪表整体信息
+
///
/// 仪表连接状态
///
public bool LinkState { get; set; }
///
- /// 仪表名称
+ /// 仪表名称 中文
///
public string MeterName { get; set; }
+ ///
+ /// 仪表名称 英文
+ ///
+ public string MeterEnName { get; set; }
+
///
/// 仪表站号
///
@@ -208,7 +214,7 @@ namespace CapMachine.Wpf.Models
///
/// 精度
///
- public Int16 Accuracy { get; set; }
+ public short Precision { get; set; }
///
/// 单位
diff --git a/CapMachine.Wpf/Models/Tag/BaseTag.cs b/CapMachine.Wpf/Models/Tag/BaseTag.cs
new file mode 100644
index 0000000..6dfc29e
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/BaseTag.cs
@@ -0,0 +1,101 @@
+using HslCommunication;
+using ImTools;
+using NPOI.SS.Formula.Functions;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static CapMachine.Wpf.Models.ComEnum;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ ///
+ /// 基础模型
+ ///
+ public abstract class BaseTag : BindableBase
+ {
+ ///
+ /// 实例化函数
+ ///
+ ///
+ ///
+ ///
+ public BaseTag(string name, string enName, string unit, TagType tagType)
+ {
+ TagTypeInfo = tagType;
+ Name = name;
+ Unit = unit;
+ EnName = enName;
+
+ }
+
+ ///
+ /// 名称 中文
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 名称 英文
+ ///
+ public string EnName { get; set; }
+
+
+ /////
+ ///// 实时值
+ /////
+ public abstract IRegisterValue RtValue { get; set; }
+
+ ///////
+ /////// 原始值实时值
+ ///////
+ //public abstract OperateResult OperateResultSource { get; set; } //
+
+ ///
+ /// 标签类型信息
+ ///
+ public TagType TagTypeInfo { get; set; }
+
+ ///
+ /// 数据类型信息
+ ///
+ public abstract DataType DataTypeInfo { get; set; }
+
+ ///
+ /// 地址信息
+ ///
+ public string Address { get; set; }
+
+ ///
+ /// 地址信息 Index
+ ///
+ public string Index { get; set; }
+
+ ///
+ /// 最大值
+ ///
+ public double MaxValue { get; set; }
+
+ ///
+ /// 最小值
+ ///
+ public double MinValue { get; set; }
+
+ ///
+ /// 精度
+ /// 小数点
+ ///
+ public short Precision { get; set; }
+
+ ///
+ /// 单位
+ ///
+ public string? Unit { get; set; }
+
+ ///
+ /// 采样周期
+ ///
+ public int SamplingPeriod { get; set; }
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/ByteTag.cs b/CapMachine.Wpf/Models/Tag/ByteTag.cs
new file mode 100644
index 0000000..d7eb3f1
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/ByteTag.cs
@@ -0,0 +1,77 @@
+using HslCommunication;
+using NPOI.SS.Formula.Functions;
+using Prism.Mvvm;
+using static CapMachine.Wpf.Models.ComEnum;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ ///
+ /// 字节变量模型
+ ///
+ public class ByteTag /*: BaseTag*/
+ {
+ /////
+ ///// 实例化函数
+ /////
+ /////
+ /////
+ /////
+ /////
+ //public ByteTag(string name, string enName, string unit, ComEnum.TagType tagType, T registerValue) : base(name, enName, unit, tagType)
+ //{
+ // //IRegisterValue registerValue = new RegisterValue();
+
+ // //RtValue = registerValue;
+ //}
+
+
+
+ public string Name { get; set; }
+ //T BaseTag.RtValue { get; set; }
+
+ //private IRegisterValue _RtValue;
+ /////
+ ///// 实时值
+ /////
+ //public override IRegisterValue RtValue
+ //{
+ // get { return _RtValue; }
+ // set { _RtValue = value; RaisePropertyChanged(); }
+ //}
+
+ //public override IRegisterValue RtValue { set => throw new NotImplementedException(); }
+
+ //private OperateResult _OperateResultSource;
+ /////
+ ///// 原始值
+ /////
+ //public override OperateResult OperateResultSource
+ //{
+ // get { return _OperateResultSource; }
+ // set
+ // {
+ // if (value != _OperateResultSource)
+ // {
+ // RtValue = value.Content;
+ // }
+ // _OperateResultSource = value;
+ // }
+ //}
+
+ //private DataType _DataTypeInfo;
+ /////
+ ///// 数据类型信息
+ /////
+ //public override DataType DataTypeInfo
+ //{
+ // get { return _DataTypeInfo; }
+ // set { _DataTypeInfo = value; RaisePropertyChanged(); }
+ //}
+
+ //public override IRegisterValue RtValue { set => throw new NotImplementedException(); }
+
+ //public override IRegisterValue RtValue => throw new NotImplementedException();
+
+
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/IRegisterValue.cs b/CapMachine.Wpf/Models/Tag/IRegisterValue.cs
new file mode 100644
index 0000000..0e4b1e6
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/IRegisterValue.cs
@@ -0,0 +1,15 @@
+using HslCommunication;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ public interface IRegisterValue
+ {
+ T Value { get; set; }
+ OperateResult OperateResultSource { get; set; }
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/ITag.cs b/CapMachine.Wpf/Models/Tag/ITag.cs
new file mode 100644
index 0000000..00545ae
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/ITag.cs
@@ -0,0 +1,17 @@
+using NPOI.SS.Formula.Functions;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ public interface ITag
+ {
+ string Name { get; set; }
+
+ T RtValue { get; set; }
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/RegisterValue.cs b/CapMachine.Wpf/Models/Tag/RegisterValue.cs
new file mode 100644
index 0000000..7859dbc
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/RegisterValue.cs
@@ -0,0 +1,15 @@
+using HslCommunication;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ public class RegisterValue : IRegisterValue
+ {
+ public byte Value { get; set; }
+ public OperateResult? OperateResultSource { get; set; }
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/RtDataModel.cs b/CapMachine.Wpf/Models/Tag/RtDataModel.cs
new file mode 100644
index 0000000..77a4957
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/RtDataModel.cs
@@ -0,0 +1,59 @@
+using HslCommunication;
+using static CapMachine.Wpf.Models.ComEnum;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ ///
+ /// 实时数据模型
+ ///
+ public class RtDataModel : TagInfo
+ {
+ ///
+ /// 实例化函数
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RtDataModel(string name, string enName, string unit, TagType tagType, bool IsChart) : base(name, enName, unit, tagType)
+ {
+ IsChartShow = IsChart;
+
+ }
+
+ ///
+ /// 分类信息
+ ///
+ public string Category { get; set; }
+
+ ///
+ /// 通信结果 实时值
+ ///
+ private OperateResult _OperateResultRtValue;
+ public OperateResult OperateResultRtValue
+ {
+ get { return _OperateResultRtValue; }
+ set { _OperateResultRtValue = value; }
+ }
+
+ private double _RtValue;
+ ///
+ /// 实时值
+ ///
+ public double RtValue
+ {
+ get { return _RtValue; }
+ set { _RtValue = value; RaisePropertyChanged(); }
+ }
+
+ ///
+ /// 实时值的地址
+ ///
+ public string RtValueAddress { get; set; }
+
+ ///
+ /// 是否曲线显示
+ ///
+ public bool IsChartShow { get; set; }
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/ShortTag.cs b/CapMachine.Wpf/Models/Tag/ShortTag.cs
new file mode 100644
index 0000000..c59f52d
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/ShortTag.cs
@@ -0,0 +1,55 @@
+using HslCommunication;
+using NPOI.SS.Formula.Functions;
+using static CapMachine.Wpf.Models.ComEnum;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ /////
+ ///// 字变量模型
+ /////
+ //public class ShortTag: BaseTag
+ //{
+ // public ShortTag(string name, string enName, string unit, ComEnum.TagType tagType) : base(name, enName, unit, tagType)
+ // {
+
+ // }
+
+ // private short _RtValue;
+ // ///
+ // /// 实时值
+ // ///
+ // public override short RtValue
+ // {
+ // get { return _RtValue; }
+ // set { _RtValue = value; RaisePropertyChanged(); }
+ // }
+
+ // private OperateResult _OperateResultSource;
+ // ///
+ // /// 原始值
+ // ///
+ // public override OperateResult OperateResultSource
+ // {
+ // get { return _OperateResultSource; }
+ // set
+ // {
+ // if (value != _OperateResultSource)
+ // {
+ // RtValue= value.Content;
+ // }
+ // _OperateResultSource = value;
+ // }
+ // }
+
+ // private DataType _DataTypeInfo;
+ // ///
+ // /// 数据类型信息
+ // ///
+ // public override DataType DataTypeInfo
+ // {
+ // get { return _DataTypeInfo; }
+ // set { _DataTypeInfo = value; RaisePropertyChanged(); }
+ // }
+
+ //}
+}
diff --git a/CapMachine.Wpf/Models/Tag/TagHelper.cs b/CapMachine.Wpf/Models/Tag/TagHelper.cs
new file mode 100644
index 0000000..ed0c5d7
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/TagHelper.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ ///
+ /// 标签帮助类
+ ///
+ public class TagHelper
+ {
+ private void ParseData(List tagInfos)
+ {
+ //分组数据
+ var GroupData = tagInfos.GroupBy(x => x.DataTypeInfo).ToList();
+ foreach (var group in GroupData)
+ {
+ var key = group.Key;
+ var TagListData = group.ToList();
+ switch (group.Key)
+ {
+ case ComEnum.DataType.Short:
+
+ break;
+ case ComEnum.DataType.Double:
+
+ break;
+ case ComEnum.DataType.String:
+
+ break;
+ case ComEnum.DataType.Byte:
+
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/TagInfo.cs b/CapMachine.Wpf/Models/Tag/TagInfo.cs
new file mode 100644
index 0000000..0167d5e
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/TagInfo.cs
@@ -0,0 +1,93 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static CapMachine.Wpf.Models.ComEnum;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ ///
+ /// 标签的信息
+ ///
+ public abstract class TagInfo : BindableBase
+ {
+ ///
+ /// 实例化函数
+ ///
+ ///
+ ///
+ ///
+ public TagInfo(string name,string enName, string unit,TagType tagType)
+ {
+ TagTypeInfo = tagType;
+ Name = name;
+ Unit = unit;
+ EnName = enName;
+
+ //ListRtDataModel=new List();
+ }
+
+
+ //public List ListRtDataModel { get; set; }
+
+ ///
+ /// 名称 中文
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 名称 英文
+ ///
+ public string EnName { get; set; }
+
+ ///
+ /// 标签类型信息
+ ///
+ public TagType TagTypeInfo { get; set; }
+
+ ///
+ /// 数据类型信息
+ ///
+ public DataType DataTypeInfo { get; set; }
+
+ ///
+ /// 地址信息
+ ///
+ public string Address { get; set; }
+
+ ///
+ /// 地址信息 Index
+ ///
+ public string Index { get; set; }
+
+ ///
+ /// 最大值
+ ///
+ public double MaxValue { get; set; }
+
+ ///
+ /// 最小值
+ ///
+ public double MinValue { get; set; }
+
+ ///
+ /// 精度
+ /// 小数点
+ ///
+ public short Precision { get; set; }
+
+ ///
+ /// 单位
+ ///
+ public string? Unit { get; set; }
+
+ ///
+ /// 采样周期
+ ///
+ public int SamplingPeriod { get; set; }
+
+
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/TagManager.cs b/CapMachine.Wpf/Models/Tag/TagManager.cs
new file mode 100644
index 0000000..354a69b
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/TagManager.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ ///
+ /// 标签管理中心
+ ///
+ public class TagManager
+ {
+ public TagManager()
+ {
+
+ }
+
+ ///
+ /// 标签集合数据
+ ///
+ public List ListTag = new List();
+
+ /////
+ ///// 增加标签
+ /////
+ //public void AddTag(BaseTag baseTag)
+ //{
+ // ListTag.Add(baseTag);
+ //}
+
+ /////
+ ///// 增加集合标签
+ /////
+ /////
+ //public void AddRange(List> baseTags)
+ //{
+ // ListTag.AddRange(baseTags);
+ //}
+
+ }
+}
diff --git a/CapMachine.Wpf/Models/Tag/VarTag.cs b/CapMachine.Wpf/Models/Tag/VarTag.cs
new file mode 100644
index 0000000..bb9f796
--- /dev/null
+++ b/CapMachine.Wpf/Models/Tag/VarTag.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static CapMachine.Wpf.Models.ComEnum;
+
+namespace CapMachine.Wpf.Models.Tag
+{
+ /////
+ ///// 一般的处理方法
+ /////
+ /////
+ //public class VarTag : BaseTag
+ //{
+ // public VarTag(string name, string enName, string unit, ComEnum.TagType tagType) : base(name, enName, unit, tagType)
+ // {
+
+ // }
+
+ // private object _RtValue;
+ // ///
+ // /// 实时值
+ // ///
+ // public override object RtValue
+ // {
+ // get { return _RtValue; }
+ // set { _RtValue = (T)Convert.ChangeType(value, typeof(T)); RaisePropertyChanged(); }
+ // }
+
+
+ // private DataType _DataTypeInfo;
+ // ///
+ // /// 数据类型信息
+ // ///
+ // public override DataType DataTypeInfo
+ // {
+ // get { return _DataTypeInfo; }
+ // set { _DataTypeInfo = value; RaisePropertyChanged(); }
+ // }
+ //}
+}
diff --git a/CapMachine.Wpf/ProPars/ProParsHelper.cs b/CapMachine.Wpf/ProPars/ProParsHelper.cs
new file mode 100644
index 0000000..56a5cb7
--- /dev/null
+++ b/CapMachine.Wpf/ProPars/ProParsHelper.cs
@@ -0,0 +1,2103 @@
+using CapMachine.Model;
+using CapMachine.Model.MeterConfig;
+using HslCommunication.Profinet.Siemens;
+using SharpDX;
+using System.Windows.Controls;
+
+namespace CapMachine.Wpf.ProPars
+{
+ ///
+ /// 程序解析方法
+ ///
+ public class ProParsHelper
+ {
+
+ ///
+ /// 获取PLC步骤信息
+ ///
+ ///
+ ///
+ public static List GetPlcParsData(List proSteps, int Cycle)
+ {
+ //取得的PLC步骤数据,提前预设好
+ List ListPlcParsData = new List()
+ {
+ new PlcParsData(){ Name="速度",EnName="Speed",Steps=new List(),Ratio=1,Unit="",ValueStartAddress=1006,MinStartAddress=1000,SecStartAddress=1002,CycleStartAddress=1004 },
+ new PlcParsData(){ Name="COND1温度 ",EnName="Cond1Temp",Steps=new List(),Ratio=1,Unit="",ValueStartAddress=1014,MinStartAddress=1068,SecStartAddress=1070,CycleStartAddress=1098 },
+ new PlcParsData(){ Name="COND2温度",EnName="Cond2Temp",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1034,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="COND2压力",EnName="Cond2Press",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1018,MinStartAddress=1076,SecStartAddress=1078,CycleStartAddress=0 },
+ new PlcParsData(){ Name="EVAP出口温度",EnName="EVAPExpTemp",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1036,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="排气压力",EnName="ExPress",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1008,MinStartAddress=1058,SecStartAddress=1058,CycleStartAddress=1092 },
+
+ new PlcParsData(){ Name="HV电压",EnName="HVVol",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1022,MinStartAddress=1080,SecStartAddress=1082,CycleStartAddress=0 },
+
+ new PlcParsData(){ Name="吸气压力",EnName="InhPress",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1010,MinStartAddress=1060,SecStartAddress=1062,CycleStartAddress=1094 },
+
+ new PlcParsData(){ Name="吸气温度",EnName="InhTemp",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1012,MinStartAddress=1064,SecStartAddress=1066,CycleStartAddress=1096 },
+
+ new PlcParsData(){ Name="润滑油压力",EnName="LubePress",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1016,MinStartAddress=1072,SecStartAddress=1074,CycleStartAddress=0 },
+
+ new PlcParsData(){ Name="LV电压",EnName="LVVol",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1024,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+
+ new PlcParsData(){ Name="OCR",EnName="OCR",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1020,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+
+ new PlcParsData(){ Name="OS1温度",EnName="OS1Temp",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1030,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="OS2温度",EnName="OS2Temp",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1032,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+
+ new PlcParsData(){ Name="PTC入口温度",EnName="PTCEntTemp",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1054,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="PTC流量",EnName="PTCFlow",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1052,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="PTC功率",EnName="PTCPw",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1050,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+
+ new PlcParsData(){ Name="压缩机环境湿度",EnName="EnvRH",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1028,MinStartAddress=1088,SecStartAddress=1090,CycleStartAddress=0 },
+ new PlcParsData(){ Name="压缩机环境温度",EnName="EnvTemp",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=1026,MinStartAddress=1084,SecStartAddress=1086,CycleStartAddress=0 },
+
+ new PlcParsData(){ Name="输出锁定",EnName="OutLock",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=0,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="参数编号",EnName="ParNo",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=0,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="EV",EnName="Ev",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=0,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="压缩机使能",EnName="CapEnable",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=0,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="吸排气阀",EnName="InhExhValve",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=0,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+ new PlcParsData(){ Name="加热器使能",EnName="HeatEnable",Steps=new List(),Ratio=1,Unit="" ,ValueStartAddress=0,MinStartAddress=0,SecStartAddress=0,CycleStartAddress=0 },
+
+ //new PlcParsData(){ Name="加热器功率",EnName="HeatPw",Steps=new List(),Ratio=1,Unit="" },
+ //new PlcParsData(){ Name="加热器流量",EnName="HeatFlow",Steps=new List(),Ratio=1,Unit="" },
+ //new PlcParsData(){ Name="加热器入口水温",EnName="HeatInWatTemp",Steps=new List(),Ratio=1,Unit="" },
+ };
+
+ for (int i = 0; i < Cycle; i++)//大循环
+ {
+ foreach (ProStep proStep in proSteps)//小循环
+ {
+ //每个步骤里面包含多个参数的设置
+ ListPlcParsData = LoadPlcParsData(proStep, ListPlcParsData);//内部循环
+ }
+ }
+
+ //装载地址 VW1000
+ ListPlcParsData = LoadPlcCellAddress(ListPlcParsData);
+ //var datga = LoadPlcBlockAddress(ListPlcParsData, 1000);
+
+ return ListPlcParsData;
+ }
+
+
+ ///
+ /// 加载数据到PLC
+ ///
+ public static void LoadDataToPLC(SiemensS7Net siemensS7NetStance, List plcParsDatas)
+ {
+ foreach (var item in plcParsDatas)
+ {
+ foreach (var itemStep in item.Steps)
+ {
+ if (!string.IsNullOrEmpty(itemStep.ValueAddress))
+ {
+ var Result = siemensS7NetStance.Write(itemStep.ValueAddress, (short)itemStep.Value);
+ if (!Result.IsSuccess)
+ {
+ var data1 = 1;
+ }
+ }
+ if (!string.IsNullOrEmpty(itemStep.MinAddress))
+ {
+ var Result = siemensS7NetStance.Write(itemStep.MinAddress, (short)itemStep.TimeMin);
+ if (!Result.IsSuccess)
+ {
+ var data1 = 1;
+ }
+ }
+ if (!string.IsNullOrEmpty(itemStep.SecAddress))
+ {
+ var Result = siemensS7NetStance.Write(itemStep.SecAddress, (short)itemStep.TimeSec);
+ if (!Result.IsSuccess)
+ {
+ var data1 = 1;
+ }
+ }
+ if (!string.IsNullOrEmpty(itemStep.CycleAddress))
+ {
+ var Result = siemensS7NetStance.Write(itemStep.CycleAddress, (short)itemStep.Cycle);
+ if (!Result.IsSuccess)
+ {
+ var data1 = 1;
+ }
+ }
+ }
+ }
+
+ var data = 1;
+ //siemensS7NetStance.Write();
+ }
+
+ ///
+ /// 单步骤程序解析
+ /// 单步骤里面包括多个仪表参数的配置信息
+ ///
+ ///
+ ///
+ ///
+ private static List LoadPlcParsData(ProStep proStep, List plcParsDatas)
+ {
+ if (proStep != null && proStep.MeterSpeeds != null)
+ {
+ //速度
+ GetStepsByMeterSpeeds(proStep.MeterSpeeds, plcParsDatas.Find(a => a.EnName == "Speed")!, proStep.SpeedCycle);
+ //跟速度绑定的数据
+
+ GetStepsByMeterCond1Temps(proStep.MeterCond1Temps, plcParsDatas.Find(a => a.EnName == "Cond1Temp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterCond1Temps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterCond2Temps(proStep.MeterCond2Temps, plcParsDatas.Find(a => a.EnName == "Cond2Temp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterCond2Temps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterCond2Presss(proStep.MeterCond2Presss, plcParsDatas.Find(a => a.EnName == "Cond2Press")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterCond2Presss!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterEVAPExpTemps(proStep.MeterEVAPExpTemps, plcParsDatas.Find(a => a.EnName == "EVAPExpTemp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterEVAPExpTemps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterExPresss(proStep.MeterExPresss, plcParsDatas.Find(a => a.EnName == "ExPress")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterExPresss!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterHVVols(proStep.MeterHVVols, plcParsDatas.Find(a => a.EnName == "HVVol")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterHVVols!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterInhPresss(proStep.MeterInhPresss, plcParsDatas.Find(a => a.EnName == "InhPress")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterInhPresss!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterInhTemps(proStep.MeterInhTemps, plcParsDatas.Find(a => a.EnName == "InhTemp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterInhTemps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterLubePresss(proStep.MeterLubePresss, plcParsDatas.Find(a => a.EnName == "LubePress")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterLubePresss!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterLVVols(proStep.MeterLVVols, plcParsDatas.Find(a => a.EnName == "LVVol")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterLVVols!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterOCRs(proStep.MeterOCRs, plcParsDatas.Find(a => a.EnName == "OCR")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterOCRs!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterOS1Temps(proStep.MeterOS1Temps, plcParsDatas.Find(a => a.EnName == "OS1Temp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterOS1Temps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterOS2Temps(proStep.MeterOS2Temps, plcParsDatas.Find(a => a.EnName == "OS2Temp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterOS2Temps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterPTCEntTemps(proStep.MeterPTCEntTemps, plcParsDatas.Find(a => a.EnName == "PTCEntTemp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterPTCEntTemps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterPTCFlows(proStep.MeterPTCFlows, plcParsDatas.Find(a => a.EnName == "PTCFlow")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterPTCFlows!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterPTCPws(proStep.MeterPTCPws, plcParsDatas.Find(a => a.EnName == "PTCPw")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterPTCPws!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterEnvRHs(proStep.MeterEnvRHs, plcParsDatas.Find(a => a.EnName == "EnvRH")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterEnvRHs!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+ GetStepsByMeterEnvTemps(proStep.MeterEnvTemps, plcParsDatas.Find(a => a.EnName == "EnvTemp")!,
+ GetCycleBySpeed(proStep.MeterSpeeds, proStep.SpeedCycle, proStep.MeterEnvTemps!.Select(p => new MeterCom { Constant = p.Constant, EndValue = p.EndValue, KeepTime = p.KeepTime, StartValue = p.StartValue, StepNo = p.StepNo, ValueType = p.ValueType }).ToList()));
+
+
+ return plcParsDatas;
+ }
+ return plcParsDatas;
+ }
+
+ ///
+ /// 根据速度表时间获取循环的次数
+ ///
+ ///
+ ///
+ private static int GetCycleBySpeed(List meterSpeeds, int SpeedCycle, List meterComs)
+ {
+ if (meterComs != null && meterComs.Count > 0)
+ {
+ if (meterComs.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ if (meterSpeeds != null && meterSpeeds.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ var TotalTime = meterSpeeds.Sum(a => a.KeepTime) * SpeedCycle;
+ var MeterSlopTime = meterComs.Sum(a => a.KeepTime);
+ if (MeterSlopTime != 0)
+ {
+ return TotalTime / MeterSlopTime;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ //速度是常值
+ var TotalTime = meterSpeeds.FirstOrDefault()!.KeepTime;
+ var MeterSlopTime = meterComs.Sum(a => a.KeepTime);
+ if (MeterSlopTime != 0)
+ {
+ return TotalTime / MeterSlopTime;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+ else
+ {
+ // meterComs 常值 就一步了,没有循环
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+
+ }
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 Speed
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterSpeeds(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterSpeedsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterSpeedsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 Cond1Temp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterCond1Temps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterCond1TempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterCond1TempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 Cond2Temp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterCond2Temps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterCond2TempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterCond2TempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 Cond2Press
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterCond2Presss(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterCond2PresssOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterCond2PresssOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 EVAPExpTemp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterEVAPExpTemps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterEVAPExpTempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterEVAPExpTempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 ExPress
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterExPresss(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterExPresssOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterExPresssOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 HVVol
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterHVVols(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterHVVolsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterHVVolsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 InhPress
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterInhPresss(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterInhPresssOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterInhPresssOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 InhTemp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterInhTemps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterInhTempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterInhTempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 LubePress
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterLubePresss(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterLubePresssOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterLubePresssOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 LVVol
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterLVVols(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterLVVolsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterLVVolsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 OCR
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterOCRs(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterOCRsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterOCRsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 OS1Temp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterOS1Temps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterOS1TempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterOS1TempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 OS2Temp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterOS2Temps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterOS2TempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterOS2TempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 PTCEntTemp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterPTCEntTemps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterPTCEntTempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterPTCEntTempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 PTCFlow
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterPTCFlows(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterPTCFlowsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterPTCFlowsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 PTCPw
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterPTCPws(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterPTCPwsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterPTCPwsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 EnvRH
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterEnvRHs(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterEnvRHsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterEnvRHsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+ ///
+ /// 单步(内部多个小步骤)解析 单个仪表参数
+ /// 获取 步骤信息 EnvTemp
+ ///
+ ///
+ ///
+ private static PlcParsData GetStepsByMeterEnvTemps(ICollection? MeterDatas, PlcParsData PLCParsData, int Cycle)
+ {
+ if (MeterDatas != null && MeterDatas.Count > 0)
+ {
+ if (MeterDatas.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0)
+ {
+ //排序
+ var MeterEnvTempsOrder = MeterDatas.OrderBy(a => a.StepNo).ToList();
+ var ListCount = MeterDatas.Count;
+ var Index = 0;
+
+ foreach (var item in MeterEnvTempsOrder)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = item.EndValue;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(item.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(item.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = GetCycleCount(Cycle, Index, ListCount);
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ Index++;
+ }
+
+ return PLCParsData;
+ }
+ else//常值
+ {
+ var Data = MeterDatas.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
+ if (Data != null)
+ {
+ PlcMeterStepCell plcMeterStepCell = new PlcMeterStepCell();
+
+ plcMeterStepCell.Value = Data.Constant;
+ plcMeterStepCell.TimeMin = GetKeepTimeMin(Data.KeepTime);
+ plcMeterStepCell.TimeSec = GetKeepTimeSec(Data.KeepTime);
+ plcMeterStepCell.Step = GetStep(PLCParsData);
+ plcMeterStepCell.Cycle = 0;
+
+ //增加步骤信息
+ PLCParsData.Steps.Add(plcMeterStepCell);
+
+ return PLCParsData;
+ }
+
+ return PLCParsData;
+ }
+ }
+ else
+ {
+ return PLCParsData;
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+ ///
+ /// 获取KeepTime分钟信息
+ ///
+ ///
+ private static int GetKeepTimeMin(int keeptime)
+ {
+ return keeptime / 60;
+ }
+
+ ///
+ /// 获取KeepTime 秒信息
+ ///
+ ///
+ private static int GetKeepTimeSec(int keeptime)
+ {
+ return keeptime % 60;
+ }
+
+
+ ///
+ /// 获取步骤信息
+ ///
+ ///
+ ///
+ ///
+ private static int GetStep(PlcParsData plcParsData)
+ {
+ if (plcParsData.Steps != null && plcParsData.Steps.Any())
+ {
+ return plcParsData.Steps.Count + 1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+
+
+ ///
+ /// 获取Cycle信息
+ ///
+ ///
+ private static int GetCycleCount(int Cycle, int Index, int ListCount)
+ {
+ if (ListCount > 1)
+ {
+ //步骤ProStep内部有循环
+ if (Index == 0)
+ {
+ //循环开始
+ return -1;
+ }
+ if (ListCount == Index + 1)
+ {
+ //循环结束
+ return Cycle;
+ }
+ //循环中间
+ return 0;
+ }
+ else
+ {
+ //步骤ProStep内部就一个步序,没有循环,则直接返回步骤的Cycle
+ //单步骤,没有循环
+ return 0;
+ }
+ }
+
+ ///
+ /// 加载PLC的地址
+ /// 单元分割
+ ///
+ ///
+ private static List LoadPlcCellAddress(List plcParsDatas)
+ {
+ //单步长度
+ int StepLengh = 100;
+
+ foreach (var itemMeter in plcParsDatas)
+ {
+ //var Stepaddress = StartAddress + Index * StepLengh;
+
+ //循环Index
+ int Index = 0;
+
+ //循环内部的步骤信息
+ foreach (var itemStep in itemMeter.Steps.OrderBy(a => a.Step))
+ {
+ if (itemMeter.ValueStartAddress != 0)
+ {
+ var StepValueAddress = itemMeter.ValueStartAddress + Index * StepLengh;
+ itemStep.ValueAddress = "V" + StepValueAddress;
+ }
+ if (itemMeter.MinStartAddress != 0)
+ {
+ var StepMinAddress = itemMeter.MinStartAddress + Index * StepLengh;
+ itemStep.MinAddress = "V" + StepMinAddress;
+ }
+ if (itemMeter.SecStartAddress != 0)
+ {
+ var StepSecAddress = itemMeter.SecStartAddress + Index * StepLengh;
+ itemStep.SecAddress = "V" + StepSecAddress;
+ }
+ if (itemMeter.CycleStartAddress != 0)
+ {
+ var StepCycleAddress = itemMeter.CycleStartAddress + Index * StepLengh;
+ itemStep.CycleAddress = "V" + StepCycleAddress;
+ }
+
+ Index++;
+ }
+
+ }
+
+ return plcParsDatas;
+ }
+
+ ///
+ /// 加载PLC块地址信息
+ ///
+ ///
+ ///
+ ///
+ private static List LoadPlcBlockAddress(List plcParsDatas, int start)
+ {
+ //开始地址
+ int StartAddress = start;
+ //单步长度
+ int StepLengh = 100;
+ //循环Index
+ int Index = 0;
+ //数据集合
+ List BlockDatas = new List();
+
+ foreach (var item in plcParsDatas)
+ {
+ var StepAddress = StartAddress + Index * StepLengh;
+
+ //每个步骤封装成一个PlcBlockData
+ short[] shorts = new short[19];//看有多少个字段
+ //shorts[item.Speed!.Index - 1] = (short)item.Speed!.Value!;
+ //shorts[item.Cond1Temp!.Index - 1] = (short)item.Cond1Temp!.Value!;
+ //shorts[item.Cond2Temp!.Index - 1] = (short)item.Cond2Temp!.Value!;
+ //shorts[item.CondPress!.Index - 1] = (short)item.CondPress!.Value!;
+ //shorts[item.EVAPExpTemp!.Index - 1] = (short)item.EVAPExpTemp!.Value!;
+ //shorts[item.ExPress!.Index - 1] = (short)item.ExPress!.Value!;
+ //shorts[item.HVVol!.Index - 1] = (short)item.HVVol!.Value!;
+ //shorts[item.InhPress!.Index - 1] = (short)item.InhPress!.Value!;
+ //shorts[item.InhTemp!.Index - 1] = (short)item.InhTemp!.Value!;
+ //shorts[item.LoPress!.Index - 1] = (short)item.LoPress!.Value!;
+ //shorts[item.LVVol!.Index - 1] = (short)item.LVVol!.Value!;
+ //shorts[item.OCR!.Index - 1] = (short)item.OCR!.Value!;
+ //shorts[item.OS1Temp!.Index - 1] = (short)item.OS1Temp!.Value!;
+ //shorts[item.OS2Temp!.Index - 1] = (short)item.OS2Temp!.Value!;
+ //shorts[item.PTCEntTemp!.Index - 1] = (short)item.PTCEntTemp!.Value!;
+ //shorts[item.PTCFlow!.Index - 1] = (short)item.PTCFlow!.Value!;
+ //shorts[item.PTCPw!.Index - 1] = (short)item.PTCPw!.Value!;
+ //shorts[item.TestBoxRH!.Index - 1] = (short)item.TestBoxRH!.Value!;
+ //shorts[item.TestBoxTemp!.Index - 1] = (short)item.TestBoxTemp!.Value!;
+
+ BlockDatas.Add(new PlcBlockData()
+ {
+ StartAddress = "VW" + StepAddress.ToString(),
+ ArrValue = shorts
+ });
+
+ Index++;
+ }
+
+ return BlockDatas;
+ }
+
+ ///
+ /// 根据名称获取Index信息
+ ///
+ ///
+ public static int GetIndexByName(DataGridColumn dataGridColumn)
+ {
+ var headerText = (dataGridColumn.Header as TextBlock).Text;
+ if (headerText.Contains("COND1温度 "))
+ {
+ return 0;
+ }
+ else if (headerText.Contains("COND2温度"))
+ {
+ return 1;
+ }
+ else if (headerText.Contains("COND2压力"))
+ {
+ return 2;
+ }
+ else if (headerText.Contains("EVAP出口温度"))
+ {
+ return 3;
+ }
+ else if (headerText.Contains("排气压力"))
+ {
+ return 4;
+ }
+ else if (headerText.Contains("HV电压"))
+ {
+ return 5;
+ }
+ else if (headerText.Contains("吸气压力"))
+ {
+ return 6;
+ }
+ else if (headerText.Contains("吸气温度"))
+ {
+ return 7;
+ }
+ else if (headerText.Contains("润滑油压力"))
+ {
+ return 8;
+ }
+ else if (headerText.Contains("LV电压"))
+ {
+ return 9;
+ }
+ else if (headerText.Contains("OCR"))
+ {
+ return 10;
+ }
+ else if (headerText.Contains("OS1温度"))
+ {
+ return 11;
+ }
+ else if (headerText.Contains("OS2温度"))
+ {
+ return 12;
+ }
+ else if (headerText.Contains("PTC入口温度"))
+ {
+ return 13;
+ }
+ else if (headerText.Contains("PTC流量"))
+ {
+ return 14;
+ }
+ else if (headerText.Contains("PTC功率"))
+ {
+ return 15;
+ }
+ else if (headerText.Contains("试验箱湿度"))
+ {
+ return 16;
+ }
+ else if (headerText.Contains("试验箱温度"))
+ {
+ return 17;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ #region 获取数据
+
+ ///
+ /// 获取 MeterCellByMeterCond1Temps
+ ///
+ ///
+ private static double GetMeterCellByMeterCond1Temps(ICollection meterCond1Temps, int Index)
+ {
+ try
+ {
+ if (meterCond1Temps.Count() >= (Index + 1))
+ {
+ return meterCond1Temps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterCond1Temps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterCond2Temps
+ ///
+ ///
+ private static double GetMeterCellByMeterCond2Temps(ICollection meterCond2Temps, int Index)
+ {
+ try
+ {
+ if (meterCond2Temps.Count() >= (Index + 1))
+ {
+ return meterCond2Temps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterCond2Temps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterCondPresss
+ ///
+ ///
+ private static double GetMeterCellByMeterCondPresss(ICollection meterCondPresss, int Index)
+ {
+ try
+ {
+ if (meterCondPresss.Count() >= (Index + 1))
+ {
+ return meterCondPresss.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterCondPresss.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterEVAPExpTemps
+ ///
+ ///
+ private static double GetMeterCellByMeterEVAPExpTemps(ICollection meterEVAPExpTemps, int Index)
+ {
+ try
+ {
+ if (meterEVAPExpTemps.Count() >= (Index + 1))
+ {
+ return meterEVAPExpTemps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterEVAPExpTemps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterExPresss
+ ///
+ ///
+ private static double GetMeterCellByMeterExPresss(ICollection meterExPresss, int Index)
+ {
+ try
+ {
+ if (meterExPresss.Count() >= (Index + 1))
+ {
+ return meterExPresss.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterExPresss.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterHVVols
+ ///
+ ///
+ private static double GetMeterCellByMeterHVVols(ICollection meterHVVols, int Index)
+ {
+ try
+ {
+ if (meterHVVols.Count() >= (Index + 1))
+ {
+ return meterHVVols.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterHVVols.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterInhPresss
+ ///
+ ///
+ private static double GetMeterCellByMeterInhPresss(ICollection meterInhPresss, int Index)
+ {
+ try
+ {
+ if (meterInhPresss.Count() >= (Index + 1))
+ {
+ return meterInhPresss.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterInhPresss.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterInhTemps
+ ///
+ ///
+ private static double GetMeterCellByMeterInhTemps(ICollection meterInhTemps, int Index)
+ {
+ try
+ {
+ if (meterInhTemps.Count() >= (Index + 1))
+ {
+ return meterInhTemps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterInhTemps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterLoPresss
+ ///
+ ///
+ private static double GetMeterCellByMeterLoPresss(ICollection meterLoPresss, int Index)
+ {
+ try
+ {
+ if (meterLoPresss.Count() >= (Index + 1))
+ {
+ return meterLoPresss.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterLoPresss.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterLVVols
+ ///
+ ///
+ private static double GetMeterCellByMeterLVVols(ICollection meterLVVols, int Index)
+ {
+ try
+ {
+ if (meterLVVols.Count() >= (Index + 1))
+ {
+ return meterLVVols.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterLVVols.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterOCRs
+ ///
+ ///
+ private static double GetMeterCellByMeterOCRs(ICollection meterOCRs, int Index)
+ {
+ try
+ {
+ if (meterOCRs.Count() >= (Index + 1))
+ {
+ return meterOCRs.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterOCRs.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterOS1Temps
+ ///
+ ///
+ private static double GetMeterCellByMeterOS1Temps(ICollection meterOS1Temps, int Index)
+ {
+ try
+ {
+ if (meterOS1Temps.Count() >= (Index + 1))
+ {
+ return meterOS1Temps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterOS1Temps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterOS2Temps
+ ///
+ ///
+ private static double GetMeterCellByMeterOS2Temps(ICollection meterOS2Temps, int Index)
+ {
+ try
+ {
+ if (meterOS2Temps.Count() >= (Index + 1))
+ {
+ return meterOS2Temps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterOS2Temps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterPTCEntTemps
+ ///
+ ///
+ private static double GetMeterCellByMeterPTCEntTemps(ICollection meterPTCEntTemps, int Index)
+ {
+ try
+ {
+ if (meterPTCEntTemps.Count() >= (Index + 1))
+ {
+ return meterPTCEntTemps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterPTCEntTemps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterPTCFlows
+ ///
+ ///
+ private static double GetMeterCellByMeterPTCFlows(ICollection meterPTCFlows, int Index)
+ {
+ try
+ {
+ if (meterPTCFlows.Count() >= (Index + 1))
+ {
+ return meterPTCFlows.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterPTCFlows.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterPTCPws
+ ///
+ ///
+ private static double GetMeterCellByMeterPTCPws(ICollection meterPTCPws, int Index)
+ {
+ try
+ {
+ if (meterPTCPws.Count() >= (Index + 1))
+ {
+ return meterPTCPws.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterPTCPws.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterTestBoxRHs
+ ///
+ ///
+ private static double GetMeterCellByMeterTestBoxRHs(ICollection meterTestBoxRHs, int Index)
+ {
+ try
+ {
+ if (meterTestBoxRHs.Count() >= (Index + 1))
+ {
+ return meterTestBoxRHs.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterTestBoxRHs.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+ ///
+ /// 获取 MeterCellByMeterTestBoxTemps
+ ///
+ ///
+ private static double GetMeterCellByMeterTestBoxTemps(ICollection meterTestBoxTemps, int Index)
+ {
+ try
+ {
+ if (meterTestBoxTemps.Count() >= (Index + 1))
+ {
+ return meterTestBoxTemps.ToList()[Index].EndValue;
+ }
+ //找不到的话,则返回第一个值
+ return meterTestBoxTemps.FirstOrDefault()!.EndValue;
+ }
+ catch (Exception ex)
+ {
+ return 0.0;
+ }
+ }
+
+ #endregion
+
+ }
+}
diff --git a/CapMachine.Wpf/Services/MachineRtDataService.cs b/CapMachine.Wpf/Services/MachineRtDataService.cs
index fd860c2..af05c1a 100644
--- a/CapMachine.Wpf/Services/MachineRtDataService.cs
+++ b/CapMachine.Wpf/Services/MachineRtDataService.cs
@@ -1,7 +1,12 @@
using AutoMapper.Internal;
+using CapMachine.Core;
using CapMachine.Wpf.Models;
+using CapMachine.Wpf.Models.Tag;
using CapMachine.Wpf.PrismEvent;
+using HslCommunication;
+using HslCommunication.Profinet.Siemens;
using Microsoft.Extensions.Caching.Memory;
+using NPOI.SS.Formula.Atp;
using Prism.Events;
using Prism.Mvvm;
using System;
@@ -11,6 +16,8 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows;
+using static CapMachine.Wpf.Models.ComEnum;
namespace CapMachine.Wpf.Services
{
@@ -24,16 +31,41 @@ namespace CapMachine.Wpf.Services
///
private IEventAggregator _EventAggregator { get; set; }
+ ///
+ /// PLCScanTask扫描Task
+ ///
+ private static Task PLCScanTask { get; set; }
+
///
/// ScanTask扫描Task
///
- static Task ScanTask { get; set; }
+ private static Task ScanTask { get; set; }
+
+ ///
+ /// 西门子连接驱动程序
+ ///
+ public SiemensS7Net SiemensDrive { get; set; }
+
+ ///
+ /// PLC连接状态
+ ///
+ public bool SiemensS7LinkState { get; set; }
///
/// 仪表数据集合
///
public List ListMeterRtData { get; set; }
+ /////
+ ///// Tag数据集合
+ /////
+ //public List ListRtDataModel { get; set; }
+
+ ///
+ /// 标签管理中心
+ ///
+ public TagManager TagManger { get; set; } = new TagManager();
+
///
/// 扫描线程使能
///
@@ -52,8 +84,6 @@ namespace CapMachine.Wpf.Services
{
//ConcurrentDictionary keyValuePairs = new ConcurrentDictionary();
-
-
//Stopwatch stopwatch = new Stopwatch();
////第一次计时
//stopwatch.Start(); //启动Stopwatch
@@ -80,126 +110,266 @@ namespace CapMachine.Wpf.Services
//事件服务
_EventAggregator = eventAggregator;
+ //TagManger.AddTag(new ByteTag("转速", "Speed", "rpm", ComEnum.TagType.Tag));
+
+ //dynamic dad=10;
+
+ //TagManger.AddRange(new List()
+ //{
+ // new ByteTag("转速","Speed","rpm",ComEnum.TagType.Tag, (byte)10),
+ // new ShortTag("排气压力","ExPress","BarA",ComEnum.TagType.Tag),
+ // new ShortTag("吸气压力","InhPress","BarA",ComEnum.TagType.Tag),
+ // new ShortTag("吸气温度","InhTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("COND1温度","Cond1Temp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("润滑油压力","LubePress","BarA",ComEnum.TagType.Tag),
+ // new ShortTag("COND2压力","Cond2Press","BarA",ComEnum.TagType.Tag),
+ // new ShortTag("OCR","OCR","%",ComEnum.TagType.Tag),
+ // new ShortTag("HV","HV","V",ComEnum.TagType.Tag),
+ // new ShortTag("HV","HVCur","A",ComEnum.TagType.Tag),
+ // new ShortTag("HV","HV","W",ComEnum.TagType.Tag),
+ // new ShortTag("LV","LV","V",ComEnum.TagType.Tag),
+ // new ShortTag("LV","LVCur","A",ComEnum.TagType.Tag),
+ // new ShortTag("环境温度","EnvTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("环境湿度","EnvRH","%",ComEnum.TagType.Tag),
+ // new ShortTag("OS1温度","OS1Temp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("OS2温度","OS2Temp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("COND2温度","Cond2Temp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("EVAP出口温度","EVAPExpTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("冷媒流量","VRV","L/min",ComEnum.TagType.Tag),
+ // new ShortTag("润滑油流量","LubeFlow","L/min",ComEnum.TagType.Tag),
+ // new ShortTag("排气温度","ExTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("膨胀阀前压力","TxvFrPress","BarA",ComEnum.TagType.Tag),
+ // new ShortTag("膨胀阀前温度","TxvFrTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("EVAP出口压力","EVAPExpPress","BarA",ComEnum.TagType.Tag),
+ // new ShortTag("腔内压力","IntrplPress","BarA",ComEnum.TagType.Tag),
+ // new ShortTag("压缩机表面温度","CapSurfTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("PTC流量","PTCFlow","L/min",ComEnum.TagType.Tag),
+ // new ShortTag("PTC入水温度","PTCEntTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("PTC出水温度","PTCExpTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("通讯Cmp母线电流","ComCapBusCur","A",ComEnum.TagType.Tag),
+ // new ShortTag("通讯Cmp母线电压","ComCapBusVol","V",ComEnum.TagType.Tag),
+ // new ShortTag("通讯Cmp逆变器温度","ComCapInvTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("通讯Cmp相电流","ComCapPhCur","A",ComEnum.TagType.Tag),
+ // new ShortTag("通讯Cmp功率","ComCapPw","W",ComEnum.TagType.Tag),
+ // new ShortTag("通讯Cmp芯片温度","ComCapChipTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("通讯PTC入水温度","ComPTCEntTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("通讯PTC出水温度","ComPTCExpTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("通讯PTC峰值电流","ComPTCPeakCur","A",ComEnum.TagType.Tag),
+ // new ShortTag("通讯PTC母线电流","ComPTCBusCur","A",ComEnum.TagType.Tag),
+ // new ShortTag("通讯PTC膜温","ComPTCFlmTemp","℃",ComEnum.TagType.Tag),
+ // new ShortTag("通讯PTC模块温度","ComPTCMdTemp","℃",ComEnum.TagType.Tag),
+ //});
+
+
+ #region ListMeterRtData实例化
//实例化集合
- ListMeterRtData = new List()
- {
- new MeterRtDataModel(){
- MeterName = "EVA风量",
- RtUIControlTitle="EVA风量" + Environment.NewLine + "m³/h",
- RtUIControlTitleIndex="Title5",
- Station = 1,
- RtAddressPV = "101",
- RtAddressMV = "105",
- RtMVUIControlIndex="MV5",
- RtSVUIControlIndex="SV5",
- RtPVUIControlIndex="PV5",
- MaxValue=500,
- MinValue=0,
- Accuracy=1,
- Unit="m³/h",
- MeterEnableStatePLCAddress="V30.3",
- },
- new MeterRtDataModel(){//目前是DB表
- MeterName = "中间轴转速",//原来中间轴转速,先全部改为电机转速-开发过程中某个时刻中间轴转速改为电机转速
- RtUIControlTitle="中间轴转速" + Environment.NewLine + "(r/min)",
- RtUIControlTitleIndex="Title3",
- Station = 2,
- RtAddressPV = "101",
- RtAddressMV = "105",
- RtMVUIControlIndex="MV3",
- RtSVUIControlIndex="SV3",
- RtPVUIControlIndex="PV3",
- MaxValue=4000,
- MinValue=0,
- Accuracy=0,
- Unit="(r/min)",
- MeterEnableStatePLCAddress="",
- },
- new MeterRtDataModel(){
- MeterName = "加热电力",//加热电力
- RtUIControlTitle="加热电力" + Environment.NewLine + "(KW)",
- RtUIControlTitleIndex="Title7",
- Station = 3,
- RtAddressPV = "101",
- RtAddressMV = "105",
- RtMVUIControlIndex="MV7",
- RtSVUIControlIndex="SV7",
- RtPVUIControlIndex="PV7",
- MaxValue=30,
- MinValue=0,
- Accuracy=2,
- Unit="(KW)",
- MeterEnableStatePLCAddress="V30.4",
- },
- new MeterRtDataModel(){
- MeterName = "加湿电力",
- RtUIControlTitle="加湿电力" + Environment.NewLine + "(KW)",
- RtUIControlTitleIndex="Title8",
- Station = 4,
- RtAddressPV = "101",
- RtAddressMV = "105",
- RtMVUIControlIndex="MV8",
- RtSVUIControlIndex="SV8",
- RtPVUIControlIndex="PV8",
- MaxValue=18,
- MinValue=0,
- Accuracy=2,
- Unit="(KW)",
- MeterEnableStatePLCAddress="V30.5",
- },
- new MeterRtDataModel(){//目前是DB表
- MeterName = "EMPCV电流",//EMPCV电力
- RtUIControlTitle="EMPCV电流" + Environment.NewLine + "(A)",
- RtUIControlTitleIndex="Title9",
- Station = 5,
- RtAddressPV = "101",
- RtAddressMV = "105",
- RtMVUIControlIndex="MV9",
- RtSVUIControlIndex="SV9",
- RtPVUIControlIndex="PV9",
- MaxValue=1,
- MinValue=0,
- Accuracy=2,
- Unit="(A)",
- MeterEnableStatePLCAddress="V30.6",
- },
- new MeterRtDataModel(){
- MeterName = "INJ压力",
- RtUIControlTitle="INJ压力" + Environment.NewLine + "(MPa)",
- RtUIControlTitleIndex="Title10",
- Station = 6,
- RtAddressPV = "101",
- RtAddressMV = "105",
- RtMVUIControlIndex="MV10",
- RtSVUIControlIndex="SV10",
- RtPVUIControlIndex="PV10",
- MaxValue=5,
- MinValue=0,
- Accuracy=3,
- Unit="(MPa)",
- MeterEnableStatePLCAddress="V30.7",
- },
- new MeterRtDataModel(){
- MeterName = "冷媒流量",
- RtUIControlTitle="冷媒流量" + Environment.NewLine + "(kg/h)",
- RtUIControlTitleIndex="Title11",
- Station = 7,
- RtAddressPV = "101",
- RtAddressMV = "105",
- RtMVUIControlIndex="MV11",
- RtSVUIControlIndex="SV11",
- RtPVUIControlIndex="PV11",
- MaxValue=500,
- MinValue=0,
- Accuracy=1,
- Unit="(kg/h)",
- MeterEnableStatePLCAddress="V31.0",
- },
- };
+ //ListMeterRtData = new List()
+ //{
+ // new MeterRtDataModel(){
+ // MeterName = "EVA风量",
+ // RtUIControlTitle="EVA风量" + Environment.NewLine + "m³/h",
+ // RtUIControlTitleIndex="Title5",
+ // Station = 1,
+ // RtAddressPV = "101",
+ // RtAddressMV = "105",
+ // RtMVUIControlIndex="MV5",
+ // RtSVUIControlIndex="SV5",
+ // RtPVUIControlIndex="PV5",
+ // MaxValue=500,
+ // MinValue=0,
+ // Accuracy=1,
+ // Unit="m³/h",
+ // MeterEnableStatePLCAddress="V30.3",
+ // },
+ // new MeterRtDataModel(){//目前是DB表
+ // MeterName = "中间轴转速",//原来中间轴转速,先全部改为电机转速-开发过程中某个时刻中间轴转速改为电机转速
+ // RtUIControlTitle="中间轴转速" + Environment.NewLine + "(r/min)",
+ // RtUIControlTitleIndex="Title3",
+ // Station = 2,
+ // RtAddressPV = "101",
+ // RtAddressMV = "105",
+ // RtMVUIControlIndex="MV3",
+ // RtSVUIControlIndex="SV3",
+ // RtPVUIControlIndex="PV3",
+ // MaxValue=4000,
+ // MinValue=0,
+ // Accuracy=0,
+ // Unit="(r/min)",
+ // MeterEnableStatePLCAddress="",
+ // },
+ // new MeterRtDataModel(){
+ // MeterName = "加热电力",//加热电力
+ // RtUIControlTitle="加热电力" + Environment.NewLine + "(KW)",
+ // RtUIControlTitleIndex="Title7",
+ // Station = 3,
+ // RtAddressPV = "101",
+ // RtAddressMV = "105",
+ // RtMVUIControlIndex="MV7",
+ // RtSVUIControlIndex="SV7",
+ // RtPVUIControlIndex="PV7",
+ // MaxValue=30,
+ // MinValue=0,
+ // Accuracy=2,
+ // Unit="(KW)",
+ // MeterEnableStatePLCAddress="V30.4",
+ // },
+ // new MeterRtDataModel(){
+ // MeterName = "加湿电力",
+ // RtUIControlTitle="加湿电力" + Environment.NewLine + "(KW)",
+ // RtUIControlTitleIndex="Title8",
+ // Station = 4,
+ // RtAddressPV = "101",
+ // RtAddressMV = "105",
+ // RtMVUIControlIndex="MV8",
+ // RtSVUIControlIndex="SV8",
+ // RtPVUIControlIndex="PV8",
+ // MaxValue=18,
+ // MinValue=0,
+ // Accuracy=2,
+ // Unit="(KW)",
+ // MeterEnableStatePLCAddress="V30.5",
+ // },
+ // new MeterRtDataModel(){//目前是DB表
+ // MeterName = "EMPCV电流",//EMPCV电力
+ // RtUIControlTitle="EMPCV电流" + Environment.NewLine + "(A)",
+ // RtUIControlTitleIndex="Title9",
+ // Station = 5,
+ // RtAddressPV = "101",
+ // RtAddressMV = "105",
+ // RtMVUIControlIndex="MV9",
+ // RtSVUIControlIndex="SV9",
+ // RtPVUIControlIndex="PV9",
+ // MaxValue=1,
+ // MinValue=0,
+ // Accuracy=2,
+ // Unit="(A)",
+ // MeterEnableStatePLCAddress="V30.6",
+ // },
+ // new MeterRtDataModel(){
+ // MeterName = "INJ压力",
+ // RtUIControlTitle="INJ压力" + Environment.NewLine + "(MPa)",
+ // RtUIControlTitleIndex="Title10",
+ // Station = 6,
+ // RtAddressPV = "101",
+ // RtAddressMV = "105",
+ // RtMVUIControlIndex="MV10",
+ // RtSVUIControlIndex="SV10",
+ // RtPVUIControlIndex="PV10",
+ // MaxValue=5,
+ // MinValue=0,
+ // Accuracy=3,
+ // Unit="(MPa)",
+ // MeterEnableStatePLCAddress="V30.7",
+ // },
+ // new MeterRtDataModel(){
+ // MeterName = "冷媒流量",
+ // RtUIControlTitle="冷媒流量" + Environment.NewLine + "(kg/h)",
+ // RtUIControlTitleIndex="Title11",
+ // Station = 7,
+ // RtAddressPV = "101",
+ // RtAddressMV = "105",
+ // RtMVUIControlIndex="MV11",
+ // RtSVUIControlIndex="SV11",
+ // RtPVUIControlIndex="PV11",
+ // MaxValue=500,
+ // MinValue=0,
+ // Accuracy=1,
+ // Unit="(kg/h)",
+ // MeterEnableStatePLCAddress="V31.0",
+ // },
+ //};
+
+ #endregion
+
+ InitialPLCCom();
PubRtDataStart();
}
+
+ ///
+ /// 初始化PLC通信
+ ///
+ private void InitialPLCCom()
+ {
+ var IPInfo = ConfigHelper.GetValue("PLCIP");
+
+ SiemensDrive = new SiemensS7Net(SiemensPLCS.S200Smart, IPInfo);
+ // 连接对象
+ OperateResult connect = SiemensDrive.ConnectServer();
+ if (!connect.IsSuccess)//连接失败
+ {
+ SiemensS7LinkState = false;
+ Console.WriteLine("connect failed:" + connect.Message);
+ MessageBox.Show($"PLC连接失败:{IPInfo}");
+ return;
+ }
+ else//连接成功
+ {
+ SiemensS7LinkState = true;
+ }
+
+ //扫描线程成功
+ RtScanDeviceStart();
+
+ }
+
+
+ ///
+ /// PLC扫描线程
+ ///
+ private void RtScanDeviceStart()
+ {
+ PLCScanTask = Task.Run(async () =>
+ {
+ while (ThreadEnable)
+ {
+ await Task.Delay(50);
+
+ //DiagnosticsTime.Reset();
+ //DiagnosticsTime.Start();
+ try
+ {
+ //RT TODO
+ //SiemensDrive.Read("VW1", 2);
+
+ foreach (var itemTag in TagManger.ListTag)
+ {
+ switch (itemTag.DataTypeInfo)
+ {
+ //case DataType.Byte:
+ // itemTag.OperateResultSource = SiemensDrive.ReadByte(itemTag.Address);
+ // break;
+ //case DataType.Short:
+ // itemTag.OperateResultSource = SiemensDrive.ReadInt16(itemTag.Address);
+ // break;
+ //case DataType.String:
+ // itemTag.OperateResultSource = SiemensDrive.ReadString(itemTag.Address);
+ // break;
+ //case DataType.Double:
+ // itemTag.OperateResultSource = SiemensDrive.ReadDouble(itemTag.Address);
+ // break;
+ default:
+ break;
+ }
+
+ }
+ }
+ catch (Exception ex)
+ {
+ //LogService.Info($"时间:{DateTime.Now.ToString()}-【Meter】-{ex.Message}");
+
+ }
+
+
+ //DiagnosticsTime.Stop();
+ //ScanRtTimeinfo = $"电表:{DiagnosticsTime.Elapsed.TotalMilliseconds.ToString()}";
+ }
+ });
+ }
+
+
+
private Random random = new Random();
///
diff --git a/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs b/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
index 561406c..b4a7ff0 100644
--- a/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
+++ b/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
@@ -1,13 +1,21 @@
using CapMachine.Core;
using CapMachine.Model;
+using CapMachine.Model.MeterConfig;
+using CapMachine.Wpf.Dtos;
using CapMachine.Wpf.PrismEvent;
+using CapMachine.Wpf.ProPars;
+using CapMachine.Wpf.Services;
using CapMachine.Wpf.Views;
+using Force.DeepCloner;
+using ImTools;
using MaterialDesignThemes.Wpf;
+using NPOI.SS.Formula.Functions;
using Prism.Commands;
using Prism.Events;
using Prism.Regions;
using Prism.Services.Dialogs;
using System.Collections.ObjectModel;
+using System.Data;
using System.Text;
using System.Windows;
@@ -15,18 +23,38 @@ namespace CapMachine.Wpf.ViewModels
{
public class ProConfigViewModel : NavigationViewModel
{
- public ProConfigViewModel(IDialogService dialogService, IFreeSql freeSql,IEventAggregator eventAggregator, IRegionManager regionManager)
+ public ProConfigViewModel(IDialogService dialogService, IFreeSql freeSql, IEventAggregator eventAggregator, IRegionManager regionManager, MachineRtDataService machineRtDataService)
{
//LogService = logService;
FreeSql = freeSql;
EventAggregator = eventAggregator;
RegionManager = regionManager;
+ this.MachineRtDataService = machineRtDataService;
//MachineDataService = machineDataService;
DialogService = dialogService;
- ListMeterSpeedItems = new ObservableCollection();
- ListMeterPsItems = new ObservableCollection();
+ ListSlopMeterSpeedItems = new ObservableCollection();
+ //ListMeterPsItems = new ObservableCollection();
+
+ Cond1TempInit();
+ Cond2TempInit();
+ Cond2PressInit();
+ EVAPExpTempInit();
+ ExPressInit();
+ HVVolInit();
+ InhPressInit();
+ InhTempInit();
+ LubePressInit();
+ LVVolInit();
+ OCRInit();
+ OS1TempInit();
+ OS2TempInit();
+ PTCEntTempInit();
+ PTCFlowInit();
+ PTCPwInit();
+ EnvRHInit();
+ EnvTempInit();
ListProStepDtoItems = new ObservableCollection();
ListProStep = new List();
@@ -35,10 +63,13 @@ namespace CapMachine.Wpf.ViewModels
RefreshProSeg();
//各个单独仪表的初始化
- SelectedMeterSpeed = new MeterSpeed();
- SelectedPs = new MeterPs();
+ SelectedSlopMeterSpeed = new MeterSpeed();
+ //SelectedPs = new MeterPs();
+
+ //当前选中的数据
+ var CurSelectedData = FreeSql.Select().ToList();
+ ProSegRunListViewItems.AddRange(CurSelectedData);
-
}
///
@@ -47,6 +78,7 @@ namespace CapMachine.Wpf.ViewModels
public IFreeSql FreeSql { get; }
public IEventAggregator EventAggregator { get; }
public IRegionManager RegionManager { get; }
+ private MachineRtDataService MachineRtDataService { get; }
///
/// 弹窗服务
@@ -54,260 +86,9 @@ namespace CapMachine.Wpf.ViewModels
public IDialogService DialogService { get; }
-
- #region 速度表操作
-
- private ObservableCollection _ListMeterSpeedItems;
///
- /// MeterSpeedp数据集合
+ /// tEST
///
- public ObservableCollection ListMeterSpeedItems
- {
- get { return _ListMeterSpeedItems; }
- set { _ListMeterSpeedItems = value; RaisePropertyChanged(); }
- }
-
- ///
- /// MeterSpeed集合数据
- ///
- public List ListMeterSpeed { get; set; }
-
- private MeterSpeed _SelectedMeterSpeed;
- ///
- /// 当前选中的程序速度
- ///
- public MeterSpeed SelectedMeterSpeed
- {
- get { return _SelectedMeterSpeed; }
- set { _SelectedMeterSpeed = value; RaisePropertyChanged(); }
- }
-
-
-
-
- private DelegateCommand