Tag模型
This commit is contained in:
31
CapMachine.Model/PLCParsModel/PlcMeterStepCellQuick.cs
Normal file
31
CapMachine.Model/PLCParsModel/PlcMeterStepCellQuick.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 步骤的PLC数据单元
|
||||
/// </summary>
|
||||
public class PlcMeterStepCellQuick
|
||||
{
|
||||
/// <summary>
|
||||
/// 步骤序号
|
||||
/// 从1开始
|
||||
/// </summary>
|
||||
public int Step { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public double? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public string? Address { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
53
CapMachine.Model/PLCParsModel/PlcParsDataQuick.cs
Normal file
53
CapMachine.Model/PLCParsModel/PlcParsDataQuick.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model.PLCParsModel
|
||||
{
|
||||
public class PlcParsDataQuick
|
||||
{
|
||||
public PlcParsDataQuick()
|
||||
{
|
||||
Steps = new List<PlcMeterStepCellQuick>();
|
||||
Unit = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Model 名称/英文名称
|
||||
/// </summary>
|
||||
public string? EnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分辨率
|
||||
/// </summary>
|
||||
public int? Ratio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 步骤集合信息
|
||||
/// </summary>
|
||||
public List<PlcMeterStepCellQuick> Steps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值首地址
|
||||
/// </summary>
|
||||
public int ValueStartAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 步长
|
||||
/// </summary>
|
||||
public int Step { get; set; } = 100;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -157,5 +157,48 @@ namespace CapMachine.Model.QuickMeterConfig
|
||||
///// </summary>
|
||||
//[Column(Name = "xxxx")]
|
||||
//public double xxxx { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 输出锁定(0/1)
|
||||
/// 跟随速度步骤的常值数据
|
||||
/// </summary>
|
||||
[Column(Name = "OutLock")]
|
||||
public bool OutLock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///参数编号(1~16)
|
||||
/// 跟随速度步骤的常值数据
|
||||
/// </summary>
|
||||
[Column(Name = "ParNo")]
|
||||
public int ParNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///EV(1~4)
|
||||
/// 跟随速度步骤的常值数据
|
||||
/// </summary>
|
||||
[Column(Name = "Ev")]
|
||||
public int Ev { get; set; }
|
||||
|
||||
// <summary>
|
||||
/// 压缩机使能(0/1)
|
||||
/// 跟随速度步骤的常值数据
|
||||
/// </summary>
|
||||
[Column(Name = "CapEnable")]
|
||||
public bool CapEnable { get; set; }
|
||||
|
||||
// <summary>
|
||||
/// 吸排气阀(0/1)
|
||||
/// 跟随速度步骤的常值数据
|
||||
/// </summary>
|
||||
[Column(Name = "InhExhValve")]
|
||||
public bool InhExhValve { get; set; }
|
||||
|
||||
// <summary>
|
||||
/// 加热器使能(0/1)
|
||||
/// 跟随速度步骤的常值数据
|
||||
/// </summary>
|
||||
[Column(Name = "HeatEnable")]
|
||||
public bool HeatEnable { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ namespace CapMachine.Wpf
|
||||
containerRegistry.RegisterForNavigation<FooterView, FooterViewModel>();
|
||||
containerRegistry.RegisterForNavigation<ProStepConfigPsView, ProStepConfigPsViewModel>();
|
||||
containerRegistry.RegisterForNavigation<ProStepConfigMainView, ProStepConfigMainViewModel>();
|
||||
containerRegistry.RegisterForNavigation<QuickMeterStepView, QuickMeterStepViewModel>();
|
||||
|
||||
//注册Dialog视图时绑定VM
|
||||
containerRegistry.RegisterDialog<DialogCreateProView, DialogCreateProViewModel>();
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="DeepCloner" Version="0.10.4" />
|
||||
<PackageReference Include="ExcelMapper" Version="5.2.592" />
|
||||
<PackageReference Include="FreeSql" Version="3.2.833" />
|
||||
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.833" />
|
||||
<PackageReference Include="FreeSql.Provider.SqlServer" Version="3.2.833" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Prism.Mvvm;
|
||||
using Ganss.Excel;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,6 +15,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// 步骤序号
|
||||
/// </summary>
|
||||
[Column("步骤序号")]
|
||||
public int StepNo
|
||||
{
|
||||
get { return _StepNo; }
|
||||
@@ -24,6 +26,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// 时间-分钟
|
||||
/// </summary>
|
||||
[Column("时间(min)")]
|
||||
public int TimeMin
|
||||
{
|
||||
get { return _TimeMin; }
|
||||
@@ -34,6 +37,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// 时间-秒
|
||||
/// </summary>
|
||||
[Column("时间(sec)")]
|
||||
public int TimeSec
|
||||
{
|
||||
get { return _TimeSec; }
|
||||
@@ -42,8 +46,9 @@ namespace CapMachine.Wpf.Dtos
|
||||
|
||||
private int _Cycle;
|
||||
/// <summary>
|
||||
/// 循环
|
||||
/// 循环次数
|
||||
/// </summary>
|
||||
[Column("次数")]
|
||||
public int Cycle
|
||||
{
|
||||
get { return _Cycle; }
|
||||
@@ -54,16 +59,51 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// 速度 信息
|
||||
/// </summary>
|
||||
[Column("速度(r/min)")]
|
||||
public double Speed
|
||||
{
|
||||
get { return _Speed; }
|
||||
set { _Speed = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _InhPress;
|
||||
/// <summary>
|
||||
/// 吸气压力 信息
|
||||
/// </summary>
|
||||
[Column("吸气压力(MPa)")]
|
||||
public double InhPress
|
||||
{
|
||||
get { return _InhPress; }
|
||||
set { _InhPress = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _ExPress;
|
||||
/// <summary>
|
||||
/// 排气压力 信息
|
||||
/// </summary>
|
||||
[Column("排气压力(MPa)")]
|
||||
public double ExPress
|
||||
{
|
||||
get { return _ExPress; }
|
||||
set { _ExPress = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _InhTemp;
|
||||
/// <summary>
|
||||
/// 吸气温度 信息
|
||||
/// </summary>
|
||||
[Column("吸气温度(℃)")]
|
||||
public double InhTemp
|
||||
{
|
||||
get { return _InhTemp; }
|
||||
set { _InhTemp = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _Cond1Temp;
|
||||
/// <summary>
|
||||
/// COND1温度 信息
|
||||
/// </summary>
|
||||
[Column("COND1温度(℃)")]
|
||||
public double Cond1Temp
|
||||
{
|
||||
get { return _Cond1Temp; }
|
||||
@@ -74,6 +114,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// COND2温度 信息
|
||||
/// </summary>
|
||||
[Column("COND2温度(℃)")]
|
||||
public double Cond2Temp
|
||||
{
|
||||
get { return _Cond2Temp; }
|
||||
@@ -84,6 +125,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// COND2压力 信息
|
||||
/// </summary>
|
||||
[Column("COND2压力(MPa)")]
|
||||
public double Cond2Press
|
||||
{
|
||||
get { return _Cond2Press; }
|
||||
@@ -94,56 +136,29 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// EVAP出口温度 信息
|
||||
/// </summary>
|
||||
[Column("EVAP出口温度(℃)")]
|
||||
public double EVAPExpTemp
|
||||
{
|
||||
get { return _EVAPExpTemp; }
|
||||
set { _EVAPExpTemp = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _ExPress;
|
||||
/// <summary>
|
||||
/// 排气压力 信息
|
||||
/// </summary>
|
||||
public double ExPress
|
||||
{
|
||||
get { return _ExPress; }
|
||||
set { _ExPress = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _HVVol;
|
||||
/// <summary>
|
||||
/// HV电压 信息
|
||||
/// </summary>
|
||||
[Column("HV电压(V)")]
|
||||
public double HVVol
|
||||
{
|
||||
get { return _HVVol; }
|
||||
set { _HVVol = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _InhPress;
|
||||
/// <summary>
|
||||
/// 吸气压力 信息
|
||||
/// </summary>
|
||||
public double InhPress
|
||||
{
|
||||
get { return _InhPress; }
|
||||
set { _InhPress = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _InhTemp;
|
||||
/// <summary>
|
||||
/// 吸气温度 信息
|
||||
/// </summary>
|
||||
public double InhTemp
|
||||
{
|
||||
get { return _InhTemp; }
|
||||
set { _InhTemp = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _LubePress;
|
||||
/// <summary>
|
||||
/// 润滑油压力 信息
|
||||
/// </summary>
|
||||
[Column("润滑油压力(MPa)")]
|
||||
public double LubePress
|
||||
{
|
||||
get { return _LubePress; }
|
||||
@@ -154,6 +169,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// LV电压 信息
|
||||
/// </summary>
|
||||
[Column("LV电压(V)")]
|
||||
public double LVVol
|
||||
{
|
||||
get { return _LVVol; }
|
||||
@@ -164,6 +180,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// OCR 信息
|
||||
/// </summary>
|
||||
[Column("OCR(%)")]
|
||||
public double OCR
|
||||
{
|
||||
get { return _OCR; }
|
||||
@@ -174,6 +191,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// OS1温度 信息
|
||||
/// </summary>
|
||||
[Column("OS1温度(℃)")]
|
||||
public double OS1Temp
|
||||
{
|
||||
get { return _OS1Temp; }
|
||||
@@ -184,6 +202,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// OS2温度 信息
|
||||
/// </summary>
|
||||
[Column("OS2温度(℃)")]
|
||||
public double OS2Temp
|
||||
{
|
||||
get { return _OS2Temp; }
|
||||
@@ -194,6 +213,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// PTC入口温度 信息
|
||||
/// </summary>
|
||||
[Column("PTC入口温度(℃)")]
|
||||
public double PTCEntTemp
|
||||
{
|
||||
get { return _PTCEntTemp; }
|
||||
@@ -204,6 +224,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// PTC流量 信息
|
||||
/// </summary>
|
||||
[Column("PTC流量(L/min)")]
|
||||
public double PTCFlow
|
||||
{
|
||||
get { return _PTCFlow; }
|
||||
@@ -214,6 +235,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// PTC功率 信息
|
||||
/// </summary>
|
||||
[Column("PTC功率(W)")]
|
||||
public double PTCPw
|
||||
{
|
||||
get { return _PTCPw; }
|
||||
@@ -224,6 +246,7 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// 压缩机环境湿度 信息
|
||||
/// </summary>
|
||||
[Column("压缩机环境湿度(%)")]
|
||||
public double EnvRH
|
||||
{
|
||||
get { return _EnvRH; }
|
||||
@@ -234,11 +257,81 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// 压缩机环境温度 信息
|
||||
/// </summary>
|
||||
[Column("压缩机环境温度(℃)")]
|
||||
public double EnvTemp
|
||||
{
|
||||
get { return _EnvTemp; }
|
||||
set { _EnvTemp = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private bool _OutLock;
|
||||
/// <summary>
|
||||
/// 输出锁定
|
||||
/// </summary>
|
||||
[Column("输出锁定")]
|
||||
public bool OutLock
|
||||
{
|
||||
get { return _OutLock; }
|
||||
set { _OutLock = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private int _ParNo;
|
||||
/// <summary>
|
||||
/// 参数编号
|
||||
/// </summary>
|
||||
[Column("参数编号")]
|
||||
public int ParNo
|
||||
{
|
||||
get { return _ParNo; }
|
||||
set { _ParNo = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private int _EV;
|
||||
/// <summary>
|
||||
/// Ev
|
||||
/// </summary>
|
||||
[Column("Ev")]
|
||||
public int EV
|
||||
{
|
||||
get { return _EV; }
|
||||
set { _EV = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private bool _InhExhValve;
|
||||
/// <summary>
|
||||
/// 吸排气阀
|
||||
/// </summary>
|
||||
[Column("InhExhValve")]
|
||||
public bool InhExhValve
|
||||
{
|
||||
get { return _InhExhValve; }
|
||||
set { _InhExhValve = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private bool _CapEnable;
|
||||
/// <summary>
|
||||
/// 使能
|
||||
/// </summary>
|
||||
[Column("使能")]
|
||||
public bool CapEnable
|
||||
{
|
||||
get { return _CapEnable; }
|
||||
set { _CapEnable = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private bool _HeatEnable;
|
||||
/// <summary>
|
||||
/// 加热器使能
|
||||
/// </summary>
|
||||
[Column("加热器使能")]
|
||||
public bool HeatEnable
|
||||
{
|
||||
get { return _HeatEnable; }
|
||||
set { _HeatEnable = value; RaisePropertyChanged(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
using HslCommunication;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
public interface IRegisterValue<T>
|
||||
/// <summary>
|
||||
/// 寄存器类型
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IRegisterValue<T> : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
T Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值原始数据
|
||||
/// </summary>
|
||||
OperateResult<T> OperateResultSource { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -8,10 +7,19 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签的接口
|
||||
/// </summary>
|
||||
public interface ITag
|
||||
{
|
||||
/// <summary>
|
||||
/// 中文名称
|
||||
/// </summary>
|
||||
string Name { get; set; }
|
||||
|
||||
T RtValue { get; set; }
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
string EnName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
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<byte>
|
||||
{
|
||||
public byte Value { get; set; }
|
||||
public OperateResult<byte>? OperateResultSource { get; set; }
|
||||
}
|
||||
}
|
||||
31
CapMachine.Wpf/Models/Tag/ShortRegisterValue.cs
Normal file
31
CapMachine.Wpf/Models/Tag/ShortRegisterValue.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// Short类型的寄存器数据
|
||||
/// </summary>
|
||||
public class ShortRegisterValue :BindableBase, IRegisterValue<short>
|
||||
{
|
||||
private short _Value;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public short Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value;RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 寄存器原始数据
|
||||
/// </summary>
|
||||
public OperateResult<short>? OperateResultSource { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,32 +14,32 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
|
||||
// }
|
||||
|
||||
// private short _RtValue;
|
||||
// private TestType _RtValue;
|
||||
// /// <summary>
|
||||
// /// 实时值
|
||||
// /// </summary>
|
||||
// public override short RtValue
|
||||
// public override TestType RtValue
|
||||
// {
|
||||
// get { return _RtValue; }
|
||||
// set { _RtValue = value; RaisePropertyChanged(); }
|
||||
// }
|
||||
|
||||
// private OperateResult<short> _OperateResultSource;
|
||||
// /// <summary>
|
||||
// /// 原始值
|
||||
// /// </summary>
|
||||
// public override OperateResult<short> OperateResultSource
|
||||
// {
|
||||
// get { return _OperateResultSource; }
|
||||
// set
|
||||
// {
|
||||
// if (value != _OperateResultSource)
|
||||
// {
|
||||
// RtValue= value.Content;
|
||||
// }
|
||||
// _OperateResultSource = value;
|
||||
// }
|
||||
// }
|
||||
// //private OperateResult<short> _OperateResultSource;
|
||||
// ///// <summary>
|
||||
// ///// 原始值
|
||||
// ///// </summary>
|
||||
// //public override OperateResult<short> OperateResultSource
|
||||
// //{
|
||||
// // get { return _OperateResultSource; }
|
||||
// // set
|
||||
// // {
|
||||
// // if (value != _OperateResultSource)
|
||||
// // {
|
||||
// // RtValue = value.Content;
|
||||
// // }
|
||||
// // _OperateResultSource = value;
|
||||
// // }
|
||||
// //}
|
||||
|
||||
// private DataType _DataTypeInfo;
|
||||
// /// <summary>
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
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
|
||||
@@ -14,7 +7,7 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <summary>
|
||||
/// 基础模型
|
||||
/// </summary>
|
||||
public abstract class BaseTag : BindableBase
|
||||
public class Tag<T> : BindableBase, ITag
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
@@ -22,13 +15,16 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <param name="name"></param>
|
||||
/// <param name="enName"></param>
|
||||
/// <param name="tagType"></param>
|
||||
public BaseTag(string name, string enName, string unit, TagType tagType)
|
||||
public Tag(string name, string enName, string unit, TagType tagType, IRegisterValue<T> registerValue)
|
||||
{
|
||||
TagTypeInfo = tagType;
|
||||
Name = name;
|
||||
Unit = unit;
|
||||
EnName = enName;
|
||||
|
||||
//实例化
|
||||
RtValue = registerValue;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -41,16 +37,25 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// </summary>
|
||||
public string EnName { get; set; }
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 实时值
|
||||
///// </summary>
|
||||
public abstract IRegisterValue<T> RtValue { get; set; }
|
||||
//public abstract IRegisterValue<short> RtValue { get; set; }
|
||||
|
||||
/////// <summary>
|
||||
/////// 原始值实时值
|
||||
/////// </summary>
|
||||
//public abstract OperateResult<T> OperateResultSource { get; set; } //
|
||||
private IRegisterValue<T> _RtValue;
|
||||
/// <summary>
|
||||
/// 寄存器
|
||||
/// </summary>
|
||||
public IRegisterValue<T> RtValue
|
||||
{
|
||||
get { return _RtValue; }
|
||||
set { _RtValue = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原始值实时值
|
||||
/// </summary>
|
||||
public OperateResult<T> OperateResultSource { get; set; } //
|
||||
|
||||
/// <summary>
|
||||
/// 标签类型信息
|
||||
@@ -60,7 +65,7 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <summary>
|
||||
/// 数据类型信息
|
||||
/// </summary>
|
||||
public abstract DataType DataTypeInfo { get; set; }
|
||||
public DataType DataTypeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息
|
||||
@@ -98,4 +103,12 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// </summary>
|
||||
public int SamplingPeriod { get; set; }
|
||||
}
|
||||
|
||||
public struct TestType
|
||||
{
|
||||
public short shortValue { get; set; }
|
||||
public byte byteValue { get; set; }
|
||||
public double doubleValue { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using NPOI.SS.Formula.PTG;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -9,9 +10,13 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签管理中心
|
||||
/// 对标签的操作在这里进行
|
||||
/// </summary>
|
||||
public class TagManager
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public TagManager()
|
||||
{
|
||||
|
||||
@@ -20,24 +25,53 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <summary>
|
||||
/// 标签集合数据
|
||||
/// </summary>
|
||||
public List<BaseTag> ListTag = new List<BaseTag>();
|
||||
public Dictionary<string, ITag> DicTags = new Dictionary<string, ITag>();
|
||||
|
||||
///// <summary>
|
||||
///// 增加标签
|
||||
///// </summary>
|
||||
//public void AddTag(BaseTag baseTag)
|
||||
//{
|
||||
// ListTag.Add(baseTag);
|
||||
//}
|
||||
/// <summary>
|
||||
/// 增加标签
|
||||
/// </summary>
|
||||
public void AddTag<T>(Tag<T> baseTag)
|
||||
{
|
||||
DicTags[baseTag.Name] = baseTag;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 增加集合标签
|
||||
///// </summary>
|
||||
///// <param name="baseTags"></param>
|
||||
//public void AddRange(List<BaseTag<object>> baseTags)
|
||||
//{
|
||||
// ListTag.AddRange(baseTags);
|
||||
//}
|
||||
/// <summary>
|
||||
/// 获取标签信息
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public Tag<T>? GetTagByName<T>(string name)
|
||||
{
|
||||
//return ListTag.OfType<BaseTag<T>>()
|
||||
// .FirstOrDefault(t => t.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
// 尝试从字典中获取标签,并使用 as 关键字避免类型转换失败抛出异常
|
||||
if (DicTags.TryGetValue(name, out var FindTag))
|
||||
{
|
||||
return FindTag as Tag<T>;// 成功转换返回具体类型的标签,失败返回 null
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取标签的值
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public T? GetTagValueByName<T>(string name)
|
||||
{
|
||||
var FindTag = GetTagByName<T>(name);
|
||||
|
||||
// 如果找到标签,则返回其值,否则返回默认值
|
||||
if (FindTag != null)
|
||||
{
|
||||
return FindTag!.RtValue.Value;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
856
CapMachine.Wpf/ProPars/ProParsHelperQuick.cs
Normal file
856
CapMachine.Wpf/ProPars/ProParsHelperQuick.cs
Normal file
@@ -0,0 +1,856 @@
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Model.MeterConfig;
|
||||
using CapMachine.Model.PLCParsModel;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using HslCommunication.Profinet.Siemens;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CapMachine.Wpf.ProPars
|
||||
{
|
||||
/// <summary>
|
||||
/// 程序解析方法 Quick
|
||||
/// </summary>
|
||||
public class ProParsHelperQuick
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取PLC步骤信息
|
||||
/// </summary>
|
||||
/// <param name="proSteps"></param>
|
||||
/// <returns></returns>
|
||||
public static void GetPlcParsData(List<QuickMeterStepDto> proSteps, SiemensS7Net siemensS7NetStance)
|
||||
{
|
||||
//取得的PLC步骤数据,提前预设好
|
||||
List<PlcParsDataQuick> ListPlcParsDataQuick = new List<PlcParsDataQuick>()
|
||||
{
|
||||
new PlcParsDataQuick(){ Name="速度",EnName="Speed",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="",ValueStartAddress=1006, },
|
||||
new PlcParsDataQuick(){ Name="COND1温度 ",EnName="Cond1Temp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="",ValueStartAddress=1014, },
|
||||
new PlcParsDataQuick(){ Name="COND2温度",EnName="Cond2Temp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1034, },
|
||||
new PlcParsDataQuick(){ Name="COND2压力",EnName="Cond2Press",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1018, },
|
||||
new PlcParsDataQuick(){ Name="EVAP出口温度",EnName="EVAPExpTemp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1036, },
|
||||
new PlcParsDataQuick(){ Name="排气压力",EnName="ExPress",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1008, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="HV电压",EnName="HVVol",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1022, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="吸气压力",EnName="InhPress",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1010,},
|
||||
|
||||
new PlcParsDataQuick(){ Name="吸气温度",EnName="InhTemp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1012, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="润滑油压力",EnName="LubePress",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1016, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="LV电压",EnName="LVVol",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1024, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="OCR",EnName="OCR",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1020, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="OS1温度",EnName="OS1Temp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1030, },
|
||||
new PlcParsDataQuick(){ Name="OS2温度",EnName="OS2Temp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1032, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="PTC入口温度",EnName="PTCEntTemp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1054, },
|
||||
new PlcParsDataQuick(){ Name="PTC流量",EnName="PTCFlow",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1052, },
|
||||
new PlcParsDataQuick(){ Name="PTC功率",EnName="PTCPw",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1050, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="压缩机环境湿度",EnName="EnvRH",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1028, },
|
||||
new PlcParsDataQuick(){ Name="压缩机环境温度",EnName="EnvTemp",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1026, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="输出锁定",EnName="OutLock",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1038, },
|
||||
new PlcParsDataQuick(){ Name="参数编号",EnName="ParNo",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1040, },
|
||||
new PlcParsDataQuick(){ Name="EV",EnName="EV",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1042, },
|
||||
new PlcParsDataQuick(){ Name="压缩机使能",EnName="CapEnable",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1044, },
|
||||
new PlcParsDataQuick(){ Name="吸排气阀",EnName="InhExhValve",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1046, },
|
||||
new PlcParsDataQuick(){ Name="加热器使能",EnName="HeatEnable",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1048, },
|
||||
|
||||
new PlcParsDataQuick(){ Name="时间分钟",EnName="TimeMin",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1000, },
|
||||
new PlcParsDataQuick(){ Name="时间秒",EnName="TimeSec",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1002, },
|
||||
new PlcParsDataQuick(){ Name="次数",EnName="Cycle",Step=100,Steps=new List<PlcMeterStepCellQuick>(),Ratio=1,Unit="" ,ValueStartAddress=1004, },
|
||||
|
||||
//new PlcParsData(){ Name="加热器功率",EnName="HeatPw",Steps=new List<PlcMeterStepCell>(),Ratio=1,Unit="" },
|
||||
//new PlcParsData(){ Name="加热器流量",EnName="HeatFlow",Steps=new List<PlcMeterStepCell>(),Ratio=1,Unit="" },
|
||||
//new PlcParsData(){ Name="加热器入口水温",EnName="HeatInWatTemp",Steps=new List<PlcMeterStepCell>(),Ratio=1,Unit="" },
|
||||
};
|
||||
|
||||
var CurStep = 1;
|
||||
foreach (QuickMeterStepDto proStep in proSteps)//小循环
|
||||
{
|
||||
//每个步骤里面包含多个参数的设置
|
||||
ListPlcParsDataQuick = LoadPlcParsData(proStep, ListPlcParsDataQuick, CurStep);//内部循环
|
||||
|
||||
CurStep++;
|
||||
}
|
||||
|
||||
LoadDataToPLC(siemensS7NetStance, ListPlcParsDataQuick);
|
||||
//装载地址 VW1000
|
||||
|
||||
//var datga = LoadPlcBlockAddress(ListPlcParsData, 1000);
|
||||
|
||||
//return ListPlcParsData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载数据到PLC
|
||||
/// </summary>
|
||||
public static void LoadDataToPLC(SiemensS7Net siemensS7NetStance, List<PlcParsDataQuick> plcParsDatas)
|
||||
{
|
||||
foreach (var item in plcParsDatas)
|
||||
{
|
||||
foreach (var itemStep in item.Steps)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(itemStep.Address))
|
||||
{
|
||||
var Result = siemensS7NetStance.Write(itemStep.Address, (short)itemStep.Value);
|
||||
if (!Result.IsSuccess)
|
||||
{
|
||||
var data1 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var data = 1;
|
||||
//siemensS7NetStance.Write();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单步骤程序解析
|
||||
/// 单步骤里面包括多个仪表参数的配置信息
|
||||
/// </summary>
|
||||
/// <param name="proStep"></param>
|
||||
/// <param name="plcParsDatas"></param>
|
||||
/// <returns></returns>
|
||||
private static List<PlcParsDataQuick> LoadPlcParsData(QuickMeterStepDto proStep, List<PlcParsDataQuick> plcParsDatas,int CurStep)
|
||||
{
|
||||
if (proStep != null)
|
||||
{
|
||||
foreach (var item in plcParsDatas)
|
||||
{
|
||||
switch (item.EnName)
|
||||
{
|
||||
case "Speed":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.Speed, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "Cond1Temp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.Cond1Temp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "Cond2Temp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.Cond2Temp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "Cond2Press":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.Cond2Press, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "EVAPExpTemp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.EVAPExpTemp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "ExPress":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.ExPress, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "HVVol":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.HVVol, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "InhPress":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.InhPress, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "InhTemp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.InhTemp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "LubePress":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.LubePress, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "LVVol":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.LVVol, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "OCR":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.OCR, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "OS1Temp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.OS1Temp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "OS2Temp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.OS2Temp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "PTCEntTemp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.PTCEntTemp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "PTCFlow":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.PTCFlow, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "PTCPw":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.PTCPw, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "EnvRH":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.EnvRH, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "EnvTemp":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.EnvTemp, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "OutLock":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.OutLock == true ? 1 : 0, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "ParNo":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.ParNo, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "EV":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.EV, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "CapEnable":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.CapEnable == true ? 1 : 0, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "InhExhValve":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.InhExhValve == true ? 1 : 0, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "HeatEnable":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.HeatEnable == true ? 1 : 0 });
|
||||
break;
|
||||
|
||||
|
||||
case "TimeMin":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.TimeMin, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "TimeSec":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.TimeSec, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
case "Cycle":
|
||||
item.Steps.Add(new PlcMeterStepCellQuick() { Step = CurStep, Value = proStep.Cycle, Address = GetAddress(item.ValueStartAddress, CurStep, item.Step) });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return plcParsDatas;
|
||||
}
|
||||
return plcParsDatas;
|
||||
}
|
||||
|
||||
private static string GetAddress(int startAddress, int StepNo, int Step)
|
||||
{
|
||||
var CurStepValue = startAddress + (StepNo - 1) * Step;
|
||||
|
||||
return "V" + CurStepValue.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取KeepTime分钟信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static int GetKeepTimeMin(int keeptime)
|
||||
{
|
||||
return keeptime / 60;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取KeepTime 秒信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static int GetKeepTimeSec(int keeptime)
|
||||
{
|
||||
return keeptime % 60;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取步骤信息
|
||||
/// </summary>
|
||||
/// <param name="plcParsData"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
private static int GetStep(PlcParsData plcParsData)
|
||||
{
|
||||
if (plcParsData.Steps != null && plcParsData.Steps.Any())
|
||||
{
|
||||
return plcParsData.Steps.Count + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取Cycle信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载PLC的地址
|
||||
/// 单元分割
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static List<PlcParsData> LoadPlcCellAddress(List<PlcParsData> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载PLC块地址信息
|
||||
/// </summary>
|
||||
/// <param name="plcParsDatas"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <returns></returns>
|
||||
private static List<PlcBlockData> LoadPlcBlockAddress(List<PlcParsData> plcParsDatas, int start)
|
||||
{
|
||||
//开始地址
|
||||
int StartAddress = start;
|
||||
//单步长度
|
||||
int StepLengh = 100;
|
||||
//循环Index
|
||||
int Index = 0;
|
||||
//数据集合
|
||||
List<PlcBlockData> BlockDatas = new List<PlcBlockData>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据名称获取Index信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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 获取数据
|
||||
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterCond1Temps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterCond1Temps(ICollection<MeterCond1Temp> meterCond1Temps, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterCond1Temps.Count() >= (Index + 1))
|
||||
{
|
||||
return meterCond1Temps.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterCond1Temps.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterCond2Temps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterCond2Temps(ICollection<MeterCond2Temp> meterCond2Temps, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterCond2Temps.Count() >= (Index + 1))
|
||||
{
|
||||
return meterCond2Temps.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterCond2Temps.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterCondPresss
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterCondPresss(ICollection<MeterCond2Press> meterCondPresss, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterCondPresss.Count() >= (Index + 1))
|
||||
{
|
||||
return meterCondPresss.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterCondPresss.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterEVAPExpTemps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterEVAPExpTemps(ICollection<MeterEVAPExpTemp> meterEVAPExpTemps, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterEVAPExpTemps.Count() >= (Index + 1))
|
||||
{
|
||||
return meterEVAPExpTemps.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterEVAPExpTemps.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterExPresss
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterExPresss(ICollection<MeterExPress> meterExPresss, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterExPresss.Count() >= (Index + 1))
|
||||
{
|
||||
return meterExPresss.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterExPresss.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterHVVols
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterHVVols(ICollection<MeterHVVol> meterHVVols, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterHVVols.Count() >= (Index + 1))
|
||||
{
|
||||
return meterHVVols.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterHVVols.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterInhPresss
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterInhPresss(ICollection<MeterInhPress> meterInhPresss, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterInhPresss.Count() >= (Index + 1))
|
||||
{
|
||||
return meterInhPresss.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterInhPresss.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterInhTemps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterInhTemps(ICollection<MeterInhTemp> meterInhTemps, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterInhTemps.Count() >= (Index + 1))
|
||||
{
|
||||
return meterInhTemps.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterInhTemps.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterLoPresss
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterLoPresss(ICollection<MeterLubePress> meterLoPresss, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterLoPresss.Count() >= (Index + 1))
|
||||
{
|
||||
return meterLoPresss.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterLoPresss.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterLVVols
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterLVVols(ICollection<MeterLVVol> meterLVVols, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterLVVols.Count() >= (Index + 1))
|
||||
{
|
||||
return meterLVVols.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterLVVols.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterOCRs
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterOCRs(ICollection<MeterOCR> meterOCRs, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterOCRs.Count() >= (Index + 1))
|
||||
{
|
||||
return meterOCRs.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterOCRs.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterOS1Temps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterOS1Temps(ICollection<MeterOS1Temp> meterOS1Temps, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterOS1Temps.Count() >= (Index + 1))
|
||||
{
|
||||
return meterOS1Temps.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterOS1Temps.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterOS2Temps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterOS2Temps(ICollection<MeterOS2Temp> meterOS2Temps, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterOS2Temps.Count() >= (Index + 1))
|
||||
{
|
||||
return meterOS2Temps.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterOS2Temps.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterPTCEntTemps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterPTCEntTemps(ICollection<MeterPTCEntTemp> meterPTCEntTemps, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterPTCEntTemps.Count() >= (Index + 1))
|
||||
{
|
||||
return meterPTCEntTemps.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterPTCEntTemps.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterPTCFlows
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterPTCFlows(ICollection<MeterPTCFlow> meterPTCFlows, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterPTCFlows.Count() >= (Index + 1))
|
||||
{
|
||||
return meterPTCFlows.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterPTCFlows.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterPTCPws
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterPTCPws(ICollection<MeterPTCPw> meterPTCPws, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterPTCPws.Count() >= (Index + 1))
|
||||
{
|
||||
return meterPTCPws.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterPTCPws.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterTestBoxRHs
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterTestBoxRHs(ICollection<MeterEnvRH> meterTestBoxRHs, int Index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (meterTestBoxRHs.Count() >= (Index + 1))
|
||||
{
|
||||
return meterTestBoxRHs.ToList()[Index].EndValue;
|
||||
}
|
||||
//找不到的话,则返回第一个值
|
||||
return meterTestBoxRHs.FirstOrDefault()!.EndValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取 MeterCellByMeterTestBoxTemps
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static double GetMeterCellByMeterTestBoxTemps(ICollection<MeterEnvTemp> 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
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@ namespace CapMachine.Wpf.Services
|
||||
new NavigationItem("","系统配置","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("ShapeCirclePlus","日志文件",""),
|
||||
new NavigationItem("ShapeOutline","工况预设",""),
|
||||
new NavigationItem("","快速工况","QuickMeterStepView"),
|
||||
new NavigationItem("Clouds", "高速记录",""),
|
||||
new NavigationItem("ShapeOvalPlus","系统配置",""),
|
||||
}),
|
||||
@@ -56,6 +56,7 @@ namespace CapMachine.Wpf.Services
|
||||
MenuItems.Add(new NavigationItem("", "工艺曲线", "RealTimeChartView"));
|
||||
MenuItems.Add(new NavigationItem("", "动作日志", "ActionLogView"));
|
||||
MenuItems.Add(new NavigationItem("", "用户管理", "UserManageView"));
|
||||
MenuItems.Add(new NavigationItem("", "快速工况", "QuickMeterStepView"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ 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;
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using CapMachine.Wpf.ProPars;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Ganss.Excel;
|
||||
using Microsoft.Win32;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using Syncfusion.Data.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
@@ -14,11 +25,66 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public QuickMeterStepViewModel()
|
||||
public QuickMeterStepViewModel(IDialogService dialogService, IFreeSql freeSql, IEventAggregator eventAggregator, IRegionManager regionManager, MachineRtDataService machineRtDataService)
|
||||
{
|
||||
FreeSql = freeSql;
|
||||
EventAggregator = eventAggregator;
|
||||
RegionManager = regionManager;
|
||||
this.MachineRtDataService = machineRtDataService;
|
||||
|
||||
//MachineDataService = machineDataService;
|
||||
DialogService = dialogService;
|
||||
|
||||
ListQuickMeterStepDto = new ObservableCollection<QuickMeterStepDto>()
|
||||
{
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
new QuickMeterStepDto(){ Cond1Temp=12,Cond2Press=23,Cond2Temp=34,Cycle=2,EnvRH=12,EnvTemp=3,EVAPExpTemp=56,ExPress=67,HVVol=3,InhPress=23.4,InhTemp=90,LubePress=23,LVVol=23,OCR=34,OS1Temp=78,OS2Temp=78,PTCEntTemp=89,PTCFlow=90,PTCPw=22,Speed=340,StepNo=4,TimeMin=23,TimeSec=34},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// FreeSQL 实例函数
|
||||
/// </summary>
|
||||
public IFreeSql FreeSql { get; }
|
||||
public IEventAggregator EventAggregator { get; }
|
||||
public IRegionManager RegionManager { get; }
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗服务
|
||||
/// </summary>
|
||||
public IDialogService DialogService { get; }
|
||||
|
||||
private ObservableCollection<QuickMeterStepDto> _ListQuickMeterStepDto;
|
||||
/// <summary>
|
||||
/// 程序集合
|
||||
@@ -29,6 +95,242 @@ namespace CapMachine.Wpf.ViewModels
|
||||
set { _ListQuickMeterStepDto = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DelegateCommand _ProStepLoadFileCmd;
|
||||
/// <summary>
|
||||
/// 新增命令
|
||||
/// </summary>
|
||||
public DelegateCommand ProStepLoadFileCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ProStepLoadFileCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ProStepLoadFileCmd == null)
|
||||
{
|
||||
_ProStepLoadFileCmd = new DelegateCommand(() => ProStepLoadFileCmdMethod());
|
||||
}
|
||||
return _ProStepLoadFileCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 加载步骤信息数据
|
||||
/// </summary>
|
||||
private void ProStepLoadFileCmdMethod()
|
||||
{
|
||||
try
|
||||
{
|
||||
//var dd = ListQuickMeterStepDto;
|
||||
|
||||
OpenFileDialog OpenFileDialogInfo = new OpenFileDialog(); //new一个方法
|
||||
OpenFileDialogInfo.Filter = "(*.xls;*.xlsx)|*.xls;*.xlsx|all|*.*"; //删选、设定文件显示类型
|
||||
|
||||
OpenFileDialogInfo.ShowDialog(); //显示打开文件的窗口
|
||||
string fileName = OpenFileDialogInfo.FileName; //获得选择的文件路径
|
||||
|
||||
ListQuickMeterStepDto = new ExcelMapper(fileName).Fetch<QuickMeterStepDto>().ToObservableCollection();
|
||||
|
||||
DataSourceStr = "Excel文件";
|
||||
//System.Diagnostics.Process.Start(fileName);//打开指定路径下的文件
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private string _DataSourceStr="";
|
||||
/// <summary>
|
||||
/// 数据来源
|
||||
/// </summary>
|
||||
public string DataSourceStr
|
||||
{
|
||||
get { return _DataSourceStr; }
|
||||
set { _DataSourceStr = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand _ProStepExpFileCmd;
|
||||
/// <summary>
|
||||
/// 新增命令
|
||||
/// </summary>
|
||||
public DelegateCommand ProStepExpFileCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ProStepExpFileCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ProStepExpFileCmd == null)
|
||||
{
|
||||
_ProStepExpFileCmd = new DelegateCommand(() => ProStepExpFileCmdMethod());
|
||||
}
|
||||
return _ProStepExpFileCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 导出到Excel文件
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ProStepExpFileCmdMethod()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ListQuickMeterStepDto.Count > 0)
|
||||
{
|
||||
SaveFileDialog SaveFileDialogInfo = new SaveFileDialog();
|
||||
SaveFileDialogInfo.Filter = "(*.xls;*.xlsx)|*.xls;*.xlsx|all|*.*"; //删选、设定文件显示类型
|
||||
SaveFileDialogInfo.ShowDialog();
|
||||
string SavePath = SaveFileDialogInfo.FileName;
|
||||
|
||||
new ExcelMapper().Save(SavePath, ListQuickMeterStepDto, "工况");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("当前未发现数据", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private DelegateCommand _ProStepDbSelectedCmd;
|
||||
/// <summary>
|
||||
/// Db选择
|
||||
/// </summary>
|
||||
public DelegateCommand ProStepDbSelectedCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ProStepDbSelectedCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ProStepDbSelectedCmd == null)
|
||||
{
|
||||
_ProStepDbSelectedCmd = new DelegateCommand(() => ProStepDbSelectedCmdMethod());
|
||||
}
|
||||
return _ProStepDbSelectedCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Db选择文件
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ProStepDbSelectedCmdMethod()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ListQuickMeterStepDto.Count > 0)
|
||||
{
|
||||
|
||||
DataSourceStr = "本地工况库";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("当前未发现数据", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand _ProStepSaveDbCmd;
|
||||
/// <summary>
|
||||
/// Db保存
|
||||
/// </summary>
|
||||
public DelegateCommand ProStepSaveDbCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ProStepSaveDbCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ProStepSaveDbCmd == null)
|
||||
{
|
||||
_ProStepSaveDbCmd = new DelegateCommand(() => ProStepSaveDbCmdMethod());
|
||||
}
|
||||
return _ProStepSaveDbCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Db保存
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ProStepSaveDbCmdMethod()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ListQuickMeterStepDto.Count > 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("当前未发现数据", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand _ProStepLoadPlcCmd;
|
||||
/// <summary>
|
||||
/// Db保存
|
||||
/// </summary>
|
||||
public DelegateCommand ProStepLoadPlcCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ProStepLoadPlcCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ProStepLoadPlcCmd == null)
|
||||
{
|
||||
_ProStepLoadPlcCmd = new DelegateCommand(() => ProStepLoadPlcCmdMethod());
|
||||
}
|
||||
return _ProStepLoadPlcCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Db保存
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ProStepLoadPlcCmdMethod()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ListQuickMeterStepDto.Count > 0)
|
||||
{
|
||||
ProParsHelperQuick.GetPlcParsData(ListQuickMeterStepDto.ToList(), this.MachineRtDataService.SiemensDrive);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("当前未发现数据", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Width="1920"
|
||||
Height="980"
|
||||
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
|
||||
d:DesignHeight="980"
|
||||
d:DesignWidth="1920"
|
||||
mc:Ignorable="d">
|
||||
<materialDesign:DrawerHost
|
||||
x:Name="DrawerHost"
|
||||
@@ -125,16 +126,214 @@
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!--<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="280" />
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid.ColumnDefinitions>-->
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="160" />
|
||||
<RowDefinition Height="200" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<syncfusion:SfDataGrid
|
||||
x:Name="sfdatagrid"
|
||||
Margin="2"
|
||||
AddNewRowPosition="Bottom"
|
||||
AllowEditing="True"
|
||||
AutoGenerateColumns="False"
|
||||
ColumnSizer="Auto"
|
||||
EditTrigger="OnTap"
|
||||
ItemsSource="{Binding ListQuickMeterStepDto}"
|
||||
LiveDataUpdateMode="AllowDataShaping"
|
||||
ShowRowHeader="True">
|
||||
<syncfusion:SfDataGrid.Columns>
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="序号"
|
||||
MappingName="StepNo"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="时间(min)"
|
||||
MappingName="TimeMin"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="时间(sec)"
|
||||
MappingName="TimeSec"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="次数"
|
||||
MappingName="Cycle"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="速度(r/min)"
|
||||
MappingName="Speed"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="排气压力(MPa)"
|
||||
MappingName="ExPress"
|
||||
NumberDecimalDigits="2" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="吸气压力(MPa)"
|
||||
MappingName="InhPress"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="吸气温度(℃)"
|
||||
MappingName="InhTemp"
|
||||
NumberDecimalDigits="2" />
|
||||
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="COND1温度(℃)"
|
||||
MappingName="Cond1Temp"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="润滑油压力(MPa)"
|
||||
MappingName="LubePress"
|
||||
NumberDecimalDigits="2" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="COND2压力(MPa)"
|
||||
MappingName="Cond2Press"
|
||||
NumberDecimalDigits="2" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="OCR(%)"
|
||||
MappingName="OCR"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="HV电压(V)"
|
||||
MappingName="HVVol"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="LV电压(V)"
|
||||
MappingName="LVVol"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="环境湿度(%)"
|
||||
MappingName="EnvRH"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="环境温度(℃)"
|
||||
MappingName="EnvTemp"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="OS1温度(℃)"
|
||||
MappingName="OS1Temp"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="OS2温度(℃)"
|
||||
MappingName="OS2Temp"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="EVAP出口温度(℃)"
|
||||
MappingName="EVAPExpTemp"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="COND2温度(℃)"
|
||||
MappingName="Cond2Temp"
|
||||
NumberDecimalDigits="1" />
|
||||
|
||||
<syncfusion:GridCheckBoxColumn HeaderText="输出锁定" MappingName="OutLock" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="参数编号"
|
||||
MappingName="ParNo"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="EV"
|
||||
MappingName="EV"
|
||||
NumberDecimalDigits="0" />
|
||||
<syncfusion:GridCheckBoxColumn HeaderText="使能" MappingName="CapEnable" />
|
||||
<syncfusion:GridCheckBoxColumn HeaderText="吸排气阀" MappingName="InhExhValve" />
|
||||
|
||||
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="PTC入口温度(℃)"
|
||||
MappingName="PTCEntTemp"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="PTC流量(L/min)"
|
||||
MappingName="PTCFlow"
|
||||
NumberDecimalDigits="1" />
|
||||
<syncfusion:GridNumericColumn
|
||||
HeaderText="PTC功率(W)"
|
||||
MappingName="PTCPw"
|
||||
NumberDecimalDigits="1" />
|
||||
|
||||
</syncfusion:SfDataGrid.Columns>
|
||||
</syncfusion:SfDataGrid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="20,0" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="2"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="Blue"
|
||||
Text="数据来源" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="16"
|
||||
Text="{Binding DataSourceStr}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="20,0"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Command="{Binding ProStepLoadFileCmd}"
|
||||
Content="加载Excel文件"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
Margin="20,0"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Command="{Binding ProStepExpFileCmd}"
|
||||
Content="导出到Excel文件"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="3"
|
||||
Margin="20,0"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Command="{Binding ProStepDbSelectedCmd}"
|
||||
Content="工况库选择"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="4"
|
||||
Margin="20,0"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Command="{Binding ProStepSaveDbCmd}"
|
||||
Content="保存到工况库"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="5"
|
||||
Margin="20,0"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Command="{Binding ProStepLoadPlcCmd}"
|
||||
Content="下载到PLC"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="6"
|
||||
Margin="20,0"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="值和数据" />
|
||||
<TextBlock Text="{Binding MachineRtDataService.TagInfo.RtValue.Value}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</materialDesign:DrawerHost>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user