diff --git a/CapMachine.Model/MeterConfig/MeterPTCPw.cs b/CapMachine.Model/MeterConfig/MeterPTCPw.cs index dc9a381..6c908b5 100644 --- a/CapMachine.Model/MeterConfig/MeterPTCPw.cs +++ b/CapMachine.Model/MeterConfig/MeterPTCPw.cs @@ -1,9 +1,4 @@ using FreeSql.DataAnnotations; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace CapMachine.Model { diff --git a/CapMachine.Model/MeterConfig/MeterPTCPw2.cs b/CapMachine.Model/MeterConfig/MeterPTCPw2.cs new file mode 100644 index 0000000..d7c31c8 --- /dev/null +++ b/CapMachine.Model/MeterConfig/MeterPTCPw2.cs @@ -0,0 +1,84 @@ +using FreeSql.DataAnnotations; + +namespace CapMachine.Model.MeterConfig +{ + /// + /// PTC功率 表设置 + /// + [Table(Name = "MeterPTCPw2")] + public class MeterPTCPw2 + { + /// + /// 主键 + /// + [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 int KeepTime { get; set; } + + /// + /// 配置值类型 + /// + [Column(MapType = typeof(int))] + public ConfigValueType ValueType { get; set; } + + /// + /// 常值 + /// 在ValueType为常值时会使用 + /// + [Column(Name = "Constant")] + public double Constant { get; set; } + + + /// + /// PID No + /// + [Column(Name = "PIDNo")] + public int PIDNo { get; set; } + + /// + /// 限幅 No + /// + [Column(Name = "LimitNo")] + public int LimitNo { get; set; } + + /// + /// 报警 No + /// + [Column(Name = "AlarmNo")] + public int AlarmNo { 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.Wpf/Assets/Images/CapMachineOutput1.png b/CapMachine.Wpf/Assets/Images/CapMachineOutput1.png index f4aacfa..8341819 100644 Binary files a/CapMachine.Wpf/Assets/Images/CapMachineOutput1.png and b/CapMachine.Wpf/Assets/Images/CapMachineOutput1.png differ diff --git a/CapMachine.Wpf/Dtos/HandSwitchData.cs b/CapMachine.Wpf/Dtos/HandSwitchData.cs index f50a749..e329296 100644 --- a/CapMachine.Wpf/Dtos/HandSwitchData.cs +++ b/CapMachine.Wpf/Dtos/HandSwitchData.cs @@ -28,6 +28,10 @@ namespace CapMachine.Wpf.Dtos /// public string? StateAddress { get; set; } + /// + /// 状态地址类型 + /// + public HandSwitchStateType StateAddressType { get; set; } private bool _State; /// @@ -40,8 +44,30 @@ namespace CapMachine.Wpf.Dtos } /// - /// 数据结果 + /// 状态数据结果-布尔 /// - public OperateResult? StateOperateResult { get; set; } + public OperateResult? StateBoolOperateResult { get; set; } + + /// + /// 状态数据结果-字 + /// + public OperateResult? StateShortOperateResult { get; set; } } + + /// + /// 手自动切换状态类型枚举 + /// + public enum HandSwitchStateType + { + /// + /// 布尔类型 + /// + Bool = 1, + + /// + /// 字类型 + /// + Word = 2, + } + } diff --git a/CapMachine.Wpf/Models/CsvRecordModel.cs b/CapMachine.Wpf/Models/CsvRecordModel.cs index 59b1267..34027ba 100644 --- a/CapMachine.Wpf/Models/CsvRecordModel.cs +++ b/CapMachine.Wpf/Models/CsvRecordModel.cs @@ -148,13 +148,13 @@ namespace CapMachine.Wpf.Models /// /// 冷媒流量[L/min] /// - [Name("冷媒流量[L/min]")] + [Name("冷媒流量[kg/h]")] public double VRV { get; set; } /// /// 润滑油流量[L/min] /// - [Name("润滑油流量[L/min]")] + [Name("润滑油流量[kg/h]")] public double LubeFlow { get; set; } /// diff --git a/CapMachine.Wpf/Models/CsvRecordModelMap.cs b/CapMachine.Wpf/Models/CsvRecordModelMap.cs index 405399a..42d711b 100644 --- a/CapMachine.Wpf/Models/CsvRecordModelMap.cs +++ b/CapMachine.Wpf/Models/CsvRecordModelMap.cs @@ -37,8 +37,8 @@ namespace CapMachine.Wpf.Models Map(m => m.OS2Temp).Name("OS2温度[℃]"); Map(m => m.Cond2Temp).Name("COND2温度[℃]"); Map(m => m.EVAPExpTemp).Name("EVAP出口温度[℃]"); - Map(m => m.VRV).Name("冷媒流量[L/min]"); - Map(m => m.LubeFlow).Name("润滑油流量[L/min]"); + Map(m => m.VRV).Name("冷媒流量[kg/h]"); + Map(m => m.LubeFlow).Name("润滑油流量[kg/h]"); Map(m => m.ExTemp).Name("排气温度[℃]"); Map(m => m.TxvFrPressP3).Name("阀前压力P3[BarA]"); diff --git a/CapMachine.Wpf/Models/LightChart/ChartManager.cs b/CapMachine.Wpf/Models/LightChart/ChartManager.cs index 212c49d..d6beb05 100644 --- a/CapMachine.Wpf/Models/LightChart/ChartManager.cs +++ b/CapMachine.Wpf/Models/LightChart/ChartManager.cs @@ -239,9 +239,9 @@ namespace CapMachine.Wpf.Models.LightChart return CurHistoryData.Select(a => new ChartPoint() { Value = a.Cond2Temp, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); case "EVAP出口温度[℃]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.EVAPExpTemp, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); - case "冷媒流量[L/min]": + case "冷媒流量[kg/h]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.VRV, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); - case "润滑油流量[L/min]": + case "润滑油流量[kg/h]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.LubeFlow, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); case "排气温度[℃]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.ExTemp, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); @@ -263,7 +263,7 @@ namespace CapMachine.Wpf.Models.LightChart return CurHistoryData.Select(a => new ChartPoint() { Value = a.EVAPExpPressP6, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); case "背压压力P8[BarA]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.BackPressP8, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); - case "阀前温度T3[BarA]": + case "阀前温度T3[℃]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.TxvFrTempT3, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); case "COND1入口温度T4[℃]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.Cond1TempT4, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); @@ -319,7 +319,7 @@ namespace CapMachine.Wpf.Models.LightChart return CurHistoryData.Select(a => new ChartPoint() { Value = a.CapPTCBusCur, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); case "通讯PTC膜温[℃]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.CapPTCFilmTemp, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); - case "通讯PTC模块温度[℃]": + case "通讯PTC功率模块温度[℃]": return CurHistoryData.Select(a => new ChartPoint() { Value = a.CapPTCPwMdTemp, Time = a.CreateTime }).OrderBy(a => a.Time).ToList(); default: diff --git a/CapMachine.Wpf/Services/AlarmService.cs b/CapMachine.Wpf/Services/AlarmService.cs index 6fe3edb..49b505d 100644 --- a/CapMachine.Wpf/Services/AlarmService.cs +++ b/CapMachine.Wpf/Services/AlarmService.cs @@ -31,81 +31,33 @@ namespace CapMachine.Wpf.Services { new AlarmRunCell(FreeSql){Index=0,CurAlarmConfig=new AlarmConfig() { - Name="急停报警", + Name="高压报警", ActiveType=ActiveType.Bool, - Address="V0.0", + Address="V0.1", AlarmLevel=AlarmLevel.Level1, Category="一般报警", - Message="急停报警", + Message="高压报警", ThresholdDown=1, ThresholdUp=1, BoolActiveValue=true }}, new AlarmRunCell(FreeSql){Index=1,CurAlarmConfig=new AlarmConfig() { - Name="高压压控", + Name="地压报警", ActiveType=ActiveType.Bool, - Address="V0.1", + Address="V0.2", AlarmLevel=AlarmLevel.Level1, Category="一般报警", - Message="高压压控", + Message="地压报警", ThresholdDown=1, ThresholdUp=1, BoolActiveValue=true }}, new AlarmRunCell(FreeSql){Index=2,CurAlarmConfig=new AlarmConfig() - { - Name="低压压控", - ActiveType=ActiveType.Bool, - Address="V0.2", - AlarmLevel=AlarmLevel.Level1, - Category="一般报警", - Message="低压压控", - ThresholdDown=1, - ThresholdUp=1, - BoolActiveValue=true - }}, - new AlarmRunCell(FreeSql){Index=3,CurAlarmConfig=new AlarmConfig() - { - Name="水压低", - ActiveType=ActiveType.Bool, - Address="V0.3", - AlarmLevel=AlarmLevel.Level1, - Category="一般报警", - Message="水压低", - ThresholdDown=1, - ThresholdUp=1, - BoolActiveValue=true - }}, - new AlarmRunCell(FreeSql){Index=4,CurAlarmConfig=new AlarmConfig() - { - Name="水泵过载", - ActiveType=ActiveType.Bool, - Address="V0.4", - AlarmLevel=AlarmLevel.Level1, - Category="一般报警", - Message="水泵过载", - ThresholdDown=1, - ThresholdUp=1, - BoolActiveValue=true - }}, - new AlarmRunCell(FreeSql){Index=5,CurAlarmConfig=new AlarmConfig() - { - Name="冷水机组故障", - ActiveType=ActiveType.Bool, - Address="V0.5", - AlarmLevel=AlarmLevel.Level1, - Category="一般报警", - Message="冷水机组故障", - ThresholdDown=1, - ThresholdUp=1, - BoolActiveValue=true - }}, - new AlarmRunCell(FreeSql){Index=6,CurAlarmConfig=new AlarmConfig() { Name="排气压力", ActiveType=ActiveType.Bool, - Address="V0.6", + Address="V0.3", AlarmLevel=AlarmLevel.Level1, Category="一般报警", Message="排气压力", @@ -113,11 +65,11 @@ namespace CapMachine.Wpf.Services ThresholdUp=1, BoolActiveValue=true }}, - new AlarmRunCell(FreeSql){Index=7,CurAlarmConfig=new AlarmConfig() + new AlarmRunCell(FreeSql){Index=3,CurAlarmConfig=new AlarmConfig() { Name="吸气压力", ActiveType=ActiveType.Bool, - Address="V0.7", + Address="V0.4", AlarmLevel=AlarmLevel.Level1, Category="一般报警", Message="吸气压力", @@ -125,11 +77,11 @@ namespace CapMachine.Wpf.Services ThresholdUp=1, BoolActiveValue=true }}, - new AlarmRunCell(FreeSql){Index=8,CurAlarmConfig=new AlarmConfig() + new AlarmRunCell(FreeSql){Index=4,CurAlarmConfig=new AlarmConfig() { Name="吸气温度", ActiveType=ActiveType.Bool, - Address="V1.0", + Address="V0.5", AlarmLevel=AlarmLevel.Level1, Category="一般报警", Message="吸气温度", @@ -137,35 +89,11 @@ namespace CapMachine.Wpf.Services ThresholdUp=1, BoolActiveValue=true }}, - new AlarmRunCell(FreeSql){Index=9,CurAlarmConfig=new AlarmConfig() - { - Name="吸气混合器温度", - ActiveType=ActiveType.Bool, - Address="V1.1", - AlarmLevel=AlarmLevel.Level1, - Category="一般报警", - Message="吸气混合器温度", - ThresholdDown=1, - ThresholdUp=1, - BoolActiveValue=true - }}, - new AlarmRunCell(FreeSql){Index=10,CurAlarmConfig=new AlarmConfig() - { - Name="水加热温度", - ActiveType=ActiveType.Bool, - Address="V1.2", - AlarmLevel=AlarmLevel.Level1, - Category="一般报警", - Message="水加热温度", - ThresholdDown=1, - ThresholdUp=1, - BoolActiveValue=true - }}, - new AlarmRunCell(FreeSql){Index=11,CurAlarmConfig=new AlarmConfig() + new AlarmRunCell(FreeSql){Index=5,CurAlarmConfig=new AlarmConfig() { Name="排气温度", ActiveType=ActiveType.Bool, - Address="V1.3", + Address="V0.6", AlarmLevel=AlarmLevel.Level1, Category="一般报警", Message="排气温度", @@ -173,38 +101,134 @@ namespace CapMachine.Wpf.Services ThresholdUp=1, BoolActiveValue=true }}, - new AlarmRunCell(FreeSql){Index=12,CurAlarmConfig=new AlarmConfig() + new AlarmRunCell(FreeSql){Index=6,CurAlarmConfig=new AlarmConfig() { - Name="水箱进水温度", + Name="OS1", + ActiveType=ActiveType.Bool, + Address="V0.7", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="OS1", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=7,CurAlarmConfig=new AlarmConfig() + { + Name="OS2", + ActiveType=ActiveType.Bool, + Address="V1.0", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="OS2", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=8,CurAlarmConfig=new AlarmConfig() + { + Name="COND2", + ActiveType=ActiveType.Bool, + Address="V1.1", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="COND2", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=9,CurAlarmConfig=new AlarmConfig() + { + Name="COND1", + ActiveType=ActiveType.Bool, + Address="V1.2", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="COND1", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=10,CurAlarmConfig=new AlarmConfig() + { + Name="EVAP", + ActiveType=ActiveType.Bool, + Address="V1.3", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="EVAP", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=11,CurAlarmConfig=new AlarmConfig() + { + Name="GAS1", ActiveType=ActiveType.Bool, Address="V1.4", AlarmLevel=AlarmLevel.Level1, Category="一般报警", - Message="水箱进水温度", + Message="GAS1", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=12,CurAlarmConfig=new AlarmConfig() + { + Name="温湿度箱", + ActiveType=ActiveType.Bool, + Address="V1.5", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="温湿度箱", ThresholdDown=1, ThresholdUp=1, BoolActiveValue=true }}, new AlarmRunCell(FreeSql){Index=13,CurAlarmConfig=new AlarmConfig() { - Name="压缩机表面温度", + Name="急停", ActiveType=ActiveType.Bool, - Address="V1.5", + Address="V1.6", AlarmLevel=AlarmLevel.Level1, Category="一般报警", - Message="压缩机表面温度", + Message="急停", ThresholdDown=1, ThresholdUp=1, BoolActiveValue=true }}, new AlarmRunCell(FreeSql){Index=14,CurAlarmConfig=new AlarmConfig() { - Name="试验箱", + Name="润滑油", ActiveType=ActiveType.Bool, - Address="V1.6", + Address="V1.7", AlarmLevel=AlarmLevel.Level1, Category="一般报警", - Message="试验箱", + Message="润滑油", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=15,CurAlarmConfig=new AlarmConfig() + { + Name="R1234F", + ActiveType=ActiveType.Bool, + Address="V2.0", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="R1234F", + ThresholdDown=1, + ThresholdUp=1, + BoolActiveValue=true + }}, + new AlarmRunCell(FreeSql){Index=16,CurAlarmConfig=new AlarmConfig() + { + Name="冷却水", + ActiveType=ActiveType.Bool, + Address="V2.1", + AlarmLevel=AlarmLevel.Level1, + Category="一般报警", + Message="冷却水", ThresholdDown=1, ThresholdUp=1, BoolActiveValue=true diff --git a/CapMachine.Wpf/Services/DataRecordService.cs b/CapMachine.Wpf/Services/DataRecordService.cs index 0353beb..d09aec6 100644 --- a/CapMachine.Wpf/Services/DataRecordService.cs +++ b/CapMachine.Wpf/Services/DataRecordService.cs @@ -98,6 +98,54 @@ namespace CapMachine.Wpf.Services // } //} + + //new Columns(){ Name="Id",MapType="System.Int64",IsIdentity=true,IsPrimary=true}, + //new Columns(){ Name="工况",MapType="System.String",IsIdentity=false,IsPrimary=false,StringLength=100}, + //new Columns(){ Name="转速[rpm]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="排气压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="吸气压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="吸气温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="COND1温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="润滑油压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="COND2压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="OCR[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="HV[V]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="HV[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="HV[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="LV[V]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="LV[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="环境温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="环境湿度[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="OS1温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="OS2温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="COND2温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="EVAP出口温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="冷媒流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="润滑油流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="排气温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="膨胀阀前压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="膨胀阀前温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="EVAP出口压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="腔内压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="压缩机表面温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="PTC流量[L/min]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="PTC入水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="PTC出水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯Cmp母线电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯Cmp母线电压[V]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯Cmp逆变器温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯Cmp相电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯Cmp功率[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯Cmp芯片温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯PTC入水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯PTC出水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯PTC峰值电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯PTC母线电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯PTC膜温[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="通讯PTC模块温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + + + new ModelMap(){ Name="Record", Comment="工况数据记录", @@ -123,29 +171,48 @@ namespace CapMachine.Wpf.Services new Columns(){ Name="OS2温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="COND2温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="EVAP出口温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="冷媒流量[L/min]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="润滑油流量[L/min]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="冷媒流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="润滑油流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="排气温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="膨胀阀前压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="膨胀阀前温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="EVAP出口压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="腔内压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="压缩机表面温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="阀前压力P3[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="膨胀阀前温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="EVAP出口压力P6[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="背压压力P8[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="阀前温度T3[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="COND1入口温度T4[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="EVAP出口温度T6[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="XXX",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="XXX",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + //new Columns(){ Name="XXX",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + + //new Columns(){ Name="腔内压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="压缩机表面温度T11[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="PTC流量[L/min]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="PTC入水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="PTC出水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="通讯Cmp母线电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="通讯Cmp母线电压[V]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="通讯Cmp逆变器温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="通讯Cmp相电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="通讯Cmp功率[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="通讯Cmp芯片温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="PTC功率[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + + new Columns(){ Name="制冷量[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="制热量[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="制冷性能系数[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="制热性能系数[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="容积效率[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="等熵效率[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="过冷度[K]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="过热度[K]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="干度[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + + new Columns(){ Name="通讯母线电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="通讯母线电压[V]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="通讯逆变器温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="通讯相电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="通讯功率[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="通讯芯片温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="通讯PTC入水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="通讯PTC出水温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="通讯PTC峰值电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="通讯PTC母线电流[A]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="通讯PTC膜温[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, - new Columns(){ Name="通讯PTC模块温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, + new Columns(){ Name="通讯PTC功率模块温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false}, new Columns(){ Name="创建时间",MapType="System.DateTime",IsIdentity=false,IsPrimary=false}, diff --git a/CapMachine.Wpf/Services/MachineRtDataService.cs b/CapMachine.Wpf/Services/MachineRtDataService.cs index 2590a33..dd73fec 100644 --- a/CapMachine.Wpf/Services/MachineRtDataService.cs +++ b/CapMachine.Wpf/Services/MachineRtDataService.cs @@ -214,7 +214,7 @@ namespace CapMachine.Wpf.Services //转速 TagManger.AddTag(new ShortControlTag() { - Id = 1, + Id = 10, Name = "转速[rpm]", NameNoUnit = "转速", EnName = "Speed", @@ -247,7 +247,7 @@ namespace CapMachine.Wpf.Services //排气压力 TagManger.AddTag(new ShortControlTag() { - Id = 2, + Id = 20, Name = "排气压力[BarA]", NameNoUnit = "排气压力", EnName = "ExPress", @@ -277,7 +277,7 @@ namespace CapMachine.Wpf.Services //吸气压力 TagManger.AddTag(new ShortControlTag() { - Id = 3, + Id = 30, Name = "吸气压力[BarA]", NameNoUnit = "吸气压力", EnName = "InhPress", @@ -307,7 +307,7 @@ namespace CapMachine.Wpf.Services //吸气温度 TagManger.AddTag(new ShortControlTag() { - Id = 4, + Id = 40, Name = "吸气温度[℃]", NameNoUnit = "吸气温度", EnName = "InhTemp", @@ -337,7 +337,7 @@ namespace CapMachine.Wpf.Services //COND1温度 TagManger.AddTag(new ShortControlTag() { - Id = 5, + Id = 50, Name = "COND1温度[℃]", NameNoUnit = "COND1温度", EnName = "Cond1Temp", @@ -367,7 +367,7 @@ namespace CapMachine.Wpf.Services //润滑油压力 TagManger.AddTag(new ShortControlTag() { - Id = 6, + Id = 60, Name = "润滑油压力[BarA]", NameNoUnit = "润滑油压力", EnName = "LubePress", @@ -398,7 +398,7 @@ namespace CapMachine.Wpf.Services //COND2压力 TagManger.AddTag(new ShortControlTag() { - Id = 7, + Id = 70, Name = "COND2压力[BarA]", NameNoUnit = "COND2压力", EnName = "Cond2Press", @@ -428,7 +428,7 @@ namespace CapMachine.Wpf.Services //OCR TagManger.AddTag(new ShortControlTag() { - Id = 8, + Id = 80, Name = "OCR[%]", NameNoUnit = "OCR", EnName = "OCR", @@ -458,7 +458,7 @@ namespace CapMachine.Wpf.Services //HV TagManger.AddTag(new ShortControlTag() { - Id = 9, + Id = 90, Name = "HV[V]", NameNoUnit = "HV[V]", EnName = "HV", @@ -488,7 +488,7 @@ namespace CapMachine.Wpf.Services //HV[A] 采集 TagManger.AddTag(new ShortValueTag() { - Id = 10, + Id = 100, Name = "HV[A]", NameNoUnit = "HV[A]", EnName = "HVCur", @@ -496,8 +496,8 @@ namespace CapMachine.Wpf.Services MinValue = 0, MaxValue = 100, IsMeter = false, - DecimalPoint = 1, - Precision = 10, + DecimalPoint = 2, + Precision = 100, Unit = "A", DataType = TagDataType.Short, PVModel = new MeterValueAttrCell() { Address = "VW118", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 18 }, @@ -518,7 +518,7 @@ namespace CapMachine.Wpf.Services //HV[W] 采集 TagManger.AddTag(new ShortValueTag() { - Id = 11, + Id = 110, Name = "HV[W]", NameNoUnit = "HV[W]", EnName = "HVPw", @@ -548,7 +548,7 @@ namespace CapMachine.Wpf.Services //LV[V] TagManger.AddTag(new ShortControlTag() { - Id = 12, + Id = 120, Name = "LV[V]", NameNoUnit = "LV[V]", EnName = "LV", @@ -578,7 +578,7 @@ namespace CapMachine.Wpf.Services //LV[A] 采集 TagManger.AddTag(new ShortValueTag() { - Id = 13, + Id = 130, Name = "LV[A]", NameNoUnit = "LV[A]", EnName = "LVCur", @@ -586,8 +586,8 @@ namespace CapMachine.Wpf.Services MinValue = 0, MaxValue = 100, IsMeter = false, - DecimalPoint = 1, - Precision = 10, + DecimalPoint = 2, + Precision = 100, Unit = "A", DataType = TagDataType.Short, PVModel = new MeterValueAttrCell() { Address = "VW124", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 24 }, @@ -608,7 +608,7 @@ namespace CapMachine.Wpf.Services //环境温度 TagManger.AddTag(new ShortControlTag() { - Id = 14, + Id = 140, Name = "环境温度[℃]", NameNoUnit = "环境温度", EnName = "EnvTemp", @@ -638,7 +638,7 @@ namespace CapMachine.Wpf.Services //环境湿度 TagManger.AddTag(new ShortControlTag() { - Id = 15, + Id = 150, Name = "环境湿度[%]", NameNoUnit = "环境湿度", EnName = "EnvRH", @@ -668,7 +668,7 @@ namespace CapMachine.Wpf.Services //OS1温度 TagManger.AddTag(new ShortControlTag() { - Id = 16, + Id = 160, Name = "OS1温度[℃]", NameNoUnit = "OS1温度", EnName = "OS1Temp", @@ -698,7 +698,7 @@ namespace CapMachine.Wpf.Services //OS2温度 TagManger.AddTag(new ShortControlTag() { - Id = 17, + Id = 170, Name = "OS2温度[℃]", NameNoUnit = "OS2温度", EnName = "OS2Temp", @@ -728,7 +728,7 @@ namespace CapMachine.Wpf.Services //COND2温度 TagManger.AddTag(new ShortControlTag() { - Id = 18, + Id = 180, Name = "COND2温度[℃]", NameNoUnit = "COND2温度", EnName = "Cond2Temp", @@ -758,7 +758,7 @@ namespace CapMachine.Wpf.Services //EVAP出口温度 TagManger.AddTag(new ShortControlTag() { - Id = 19, + Id = 190, Name = "EVAP出口温度[℃]", NameNoUnit = "EVAP出口温度", EnName = "EVAPExpTemp", @@ -789,7 +789,7 @@ namespace CapMachine.Wpf.Services //PTC功率 控制但非仪表控制 TagManger.AddTag(new ShortControlTag() { - Id = 20, + Id = 200, Name = "PTC功率[W]", NameNoUnit = "PTC功率", EnName = "PTCPw", @@ -801,7 +801,7 @@ namespace CapMachine.Wpf.Services Precision = 1, Unit = "W", DataType = TagDataType.Short, - PVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 0, Enable = false }, + PVModel = new MeterValueAttrCell() { Address = "VW432", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 332 }, SVModel = new MeterValueAttrCell() { Address = "VW432", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 32 }, MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false }, MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false }, @@ -817,10 +817,42 @@ namespace CapMachine.Wpf.Services RWInfo = RWInfo.Control, }); + //PTC功率2 控制但非仪表控制 -北厂未启用此功能,南厂有此功能 + //TagManger.AddTag(new ShortControlTag() + //{ + // Id = 201, + // Name = "PTC功率2[W]", + // NameNoUnit = "PTC功率2", + // EnName = "PTCPw2", + // Group = "程序", + // MinValue = 0, + // MaxValue = 10000, + // IsMeter = true, + // DecimalPoint = 1, + // Precision = 1, + // Unit = "W", + // DataType = TagDataType.Short, + // PVModel = new MeterValueAttrCell() { Address = "VW434", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 334}, + // SVModel = new MeterValueAttrCell() { Address = "VW434", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 34 }, + // MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false }, + // MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false }, + + // Pid_PModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false }, + // Pid_IModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false }, + // Pid_DModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false }, + // Limit_UpModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false }, + // Limit_DownModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false }, + // AlarmModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false }, + // AutoHandState = false, + + // RWInfo = RWInfo.Control, + //}); + + //PTC流量 控制但非仪表控制 TagManger.AddTag(new ShortControlTag() { - Id = 21, + Id = 210, Name = "PTC流量[L/min]", NameNoUnit = "PTC流量", EnName = "PTCFlow", @@ -851,7 +883,7 @@ namespace CapMachine.Wpf.Services //PTC入口水温 控制但非仪表控制 TagManger.AddTag(new ShortControlTag() { - Id = 22, + Id = 220, Name = "PTC入口水温[℃]", NameNoUnit = "PTC入口水温", EnName = "PTCEntTemp", @@ -888,7 +920,7 @@ namespace CapMachine.Wpf.Services //冷媒流量 采集 TagManger.AddTag(new ShortValueTag() { - Id = 23, + Id = 230, Name = "冷媒流量[kg/h]", NameNoUnit = "冷媒流量", EnName = "VRV", @@ -907,7 +939,7 @@ namespace CapMachine.Wpf.Services //润滑油流量 采集 TagManger.AddTag(new ShortValueTag() { - Id = 24, + Id = 240, Name = "润滑油流量[kg/h]", NameNoUnit = "润滑油流量", EnName = "LubeFlow", @@ -926,7 +958,7 @@ namespace CapMachine.Wpf.Services //排气温度 采集 TagManger.AddTag(new ShortValueTag() { - Id = 25, + Id = 250, Name = "排气温度[℃]", NameNoUnit = "排气温度", EnName = "ExTemp", @@ -947,7 +979,7 @@ namespace CapMachine.Wpf.Services //阀前压力P3 采集 TagManger.AddTag(new ShortValueTag() { - Id = 26, + Id = 260, Name = "阀前压力P3[BarA]", NameNoUnit = "阀前压力P3", EnName = "TxvFrPressP3", @@ -966,7 +998,7 @@ namespace CapMachine.Wpf.Services //EVAP出口压力P6 采集 TagManger.AddTag(new ShortValueTag() { - Id = 27, + Id = 270, Name = "EVAP出口压力P6[BarA]", NameNoUnit = "EVAP出口压力P6", EnName = "EVAPExpPressP6", @@ -985,7 +1017,7 @@ namespace CapMachine.Wpf.Services //背压压力P8 采集 TagManger.AddTag(new ShortValueTag() { - Id = 28, + Id = 280, Name = "背压压力P8[BarA]", NameNoUnit = "背压压力P8", EnName = "BackPressP8", @@ -1004,7 +1036,7 @@ namespace CapMachine.Wpf.Services //阀前温度T3 采集 TagManger.AddTag(new ShortValueTag() { - Id = 29, + Id = 290, Name = "阀前温度T3[℃]", NameNoUnit = "阀前温度T3", EnName = "TxvFrTempT3", @@ -1023,7 +1055,7 @@ namespace CapMachine.Wpf.Services //COND1入口温度T4 采集 TagManger.AddTag(new ShortValueTag() { - Id = 30, + Id = 300, Name = "COND1入口温度T4[℃]", NameNoUnit = "COND1入口温度T4", EnName = "Cond1TempT4", @@ -1042,7 +1074,7 @@ namespace CapMachine.Wpf.Services //EVAP出口温度T6 采集 TagManger.AddTag(new ShortValueTag() { - Id = 31, + Id = 310, Name = "EVAP出口温度T6[℃]", NameNoUnit = "EVAP出口温度T6", EnName = "EVAPExpTempT6", @@ -1061,7 +1093,7 @@ namespace CapMachine.Wpf.Services //压缩机表面温度T11 采集 TagManger.AddTag(new ShortValueTag() { - Id = 32, + Id = 320, Name = "压缩机表面温度T11[℃]", NameNoUnit = "压缩机表面温度T11", EnName = "CapSufTempT11", @@ -1081,7 +1113,7 @@ namespace CapMachine.Wpf.Services //Qcool 计算 制冷量 TagManger.AddTag(new ShortValueTag() { - Id = 33, + Id = 330, Name = "制冷量[W]", NameNoUnit = "制冷量", EnName = "Qcool", @@ -1101,7 +1133,7 @@ namespace CapMachine.Wpf.Services //Qcool_Customer 计算 TagManger.AddTag(new ShortValueTag() { - Id = 34, + Id = 340, Name = "制热量[W]", NameNoUnit = "制热量", EnName = "Qheat", @@ -1141,7 +1173,7 @@ namespace CapMachine.Wpf.Services //COP_Cooling_5K 计算 TagManger.AddTag(new ShortValueTag() { - Id = 36, + Id = 360, Name = "制冷性能系数[W]", NameNoUnit = "制冷性能系数", EnName = "COPCooling", @@ -1181,7 +1213,7 @@ namespace CapMachine.Wpf.Services //COP_Heating 计算 制热性能系数 TagManger.AddTag(new ShortValueTag() { - Id = 38, + Id = 380, Name = "制热性能系数[W]", NameNoUnit = "制热性能系数", EnName = "COPHeating", @@ -1201,7 +1233,7 @@ namespace CapMachine.Wpf.Services //VolumeEfficiency 计算 容积效率 TagManger.AddTag(new ShortValueTag() { - Id = 39, + Id = 390, Name = "容积效率[%]", NameNoUnit = "容积效率", EnName = "VolumeEfficiency", @@ -1221,7 +1253,7 @@ namespace CapMachine.Wpf.Services //IsentropyEfficiency 计算 等熵效率 TagManger.AddTag(new ShortValueTag() { - Id = 40, + Id = 400, Name = "等熵效率[%]", NameNoUnit = "等熵效率", EnName = "IsentropyEfficiency", @@ -1263,7 +1295,7 @@ namespace CapMachine.Wpf.Services // 过冷度 计算 TagManger.AddTag(new CalcTag() { - Id = 42, + Id = 420, Name = "过冷度[K]", NameNoUnit = "过冷度", EnName = "Subcooling", @@ -1282,7 +1314,7 @@ namespace CapMachine.Wpf.Services // 过热度 计算 TagManger.AddTag(new CalcTag() { - Id = 43, + Id = 430, Name = "过热度[K]", NameNoUnit = "过热度", EnName = "Superheat", @@ -1301,7 +1333,7 @@ namespace CapMachine.Wpf.Services // 干度 计算 TagManger.AddTag(new CalcTag() { - Id = 44, + Id = 440, Name = "干度[%]", NameNoUnit = "干度", EnName = "Dryness", @@ -1325,7 +1357,7 @@ namespace CapMachine.Wpf.Services // 通讯母线电流 压缩机 TagManger.AddTag(new CapTag() { - Id = 45, + Id = 450, Name = "通讯母线电流[A]", NameNoUnit = "通讯母线电流", EnName = "ComCapBusCur", @@ -1344,7 +1376,7 @@ namespace CapMachine.Wpf.Services // 通讯母线电压 压缩机 TagManger.AddTag(new CapTag() { - Id = 46, + Id = 460, Name = "通讯母线电压[V]", NameNoUnit = "通讯母线电压", EnName = "ComCapBusCur", @@ -1363,7 +1395,7 @@ namespace CapMachine.Wpf.Services // 通讯相电流 压缩机 TagManger.AddTag(new CapTag() { - Id = 47, + Id = 470, Name = "通讯相电流[A]", NameNoUnit = "通讯相电流", EnName = "ComCapPhCur", @@ -1382,7 +1414,7 @@ namespace CapMachine.Wpf.Services // 通讯功率 压缩机 TagManger.AddTag(new CapTag() { - Id = 48, + Id = 480, Name = "通讯功率[W]", NameNoUnit = "通讯功率", EnName = "ComCapPw", @@ -1401,7 +1433,7 @@ namespace CapMachine.Wpf.Services // 通讯逆变器温度 压缩机 TagManger.AddTag(new CapTag() { - Id = 49, + Id = 490, Name = "通讯逆变器温度[℃]", NameNoUnit = "通讯逆变器温度", EnName = "ComCapInverterTemp", @@ -1420,7 +1452,7 @@ namespace CapMachine.Wpf.Services // 通讯芯片温度 压缩机 TagManger.AddTag(new CapTag() { - Id = 50, + Id = 500, Name = "通讯芯片温度[℃]", NameNoUnit = "通讯芯片温度", EnName = "ComCapChipTemp", @@ -1444,7 +1476,7 @@ namespace CapMachine.Wpf.Services // 通讯PTC入水温度 压缩机 TagManger.AddTag(new CapTag() { - Id = 51, + Id = 510, Name = "通讯PTC入水温度[℃]", NameNoUnit = "通讯PTC入水温度", EnName = "CapPTCInWaterTemp", @@ -1464,7 +1496,7 @@ namespace CapMachine.Wpf.Services // 通讯PTC出水温度 压缩机 TagManger.AddTag(new CapTag() { - Id = 52, + Id = 520, Name = "通讯PTC出水温度[℃]", NameNoUnit = "通讯PTC出水温度", EnName = "CapPTCOutWaterTemp", @@ -1484,7 +1516,7 @@ namespace CapMachine.Wpf.Services // 通讯PTC峰值电流 压缩机 TagManger.AddTag(new CapTag() { - Id = 53, + Id = 530, Name = "通讯PTC峰值电流[A]", NameNoUnit = "通讯PTC峰值电流", EnName = "CapPTCPeakCur", @@ -1504,7 +1536,7 @@ namespace CapMachine.Wpf.Services // 通讯PTC母线电流 TagManger.AddTag(new CapTag() { - Id = 54, + Id = 540, Name = "通讯PTC母线电流[A]", NameNoUnit = "通讯PTC母线电流", EnName = "CapPTCBusCur", @@ -1524,7 +1556,7 @@ namespace CapMachine.Wpf.Services // 通讯PTC膜温 压缩机 TagManger.AddTag(new CapTag() { - Id = 55, + Id = 550, Name = "通讯PTC膜温[℃]", NameNoUnit = "通讯PTC膜温", EnName = "CapPTCFilmTemp", @@ -1544,7 +1576,7 @@ namespace CapMachine.Wpf.Services // 通讯PTC功率模块温度 压缩机 TagManger.AddTag(new CapTag() { - Id = 56, + Id = 560, Name = "通讯PTC功率模块温度[℃]", NameNoUnit = "通讯PTC功率模块温度", EnName = "CapPTCPwMdTemp", @@ -2210,35 +2242,35 @@ namespace CapMachine.Wpf.Services ListHandSwitchData = new List() { - new HandSwitchData(){Name="自动",ActionAddress="M0.0",StateAddress="M0.0" }, - new HandSwitchData(){Name="抽真空",ActionAddress="M0.3",StateAddress="V9.0" }, - //new HandSwitchData(){Name="复位",ActionAddress="M0.7",StateAddress="M0.7" },放到上侧的按钮区域了 - //new HandSwitchData(){Name="消音",ActionAddress="M0.3",StateAddress="M0.3" },放到上侧的按钮区域了 - new HandSwitchData(){Name="HV电源",ActionAddress="M1.1",StateAddress="Q0.1" }, - new HandSwitchData(){Name="HV启动",ActionAddress="M1.2",StateAddress="Q2.0" }, - new HandSwitchData(){Name="LV电源",ActionAddress="M1.3",StateAddress="Q0.2" }, - new HandSwitchData(){Name="LV启动",ActionAddress="M1.4",StateAddress="M1.4" },//VW30=1 + new HandSwitchData(){Name="自动",ActionAddress="M0.0",StateAddress="M0.0",StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="抽真空",ActionAddress="M0.3",StateAddress="V9.0" ,StateAddressType=HandSwitchStateType.Bool }, + //new HandSwitchData(){Name="复位",ActionAddress="M0.7",StateAddress="M0.7" ,StateAddressType=HandSwitchStateType.Bool },放到上侧的按钮区域了 + //new HandSwitchData(){Name="消音",ActionAddress="M0.3",StateAddress="M0.3" ,StateAddressType=HandSwitchStateType.Bool },放到上侧的按钮区域了 + new HandSwitchData(){Name="HV电源",ActionAddress="M1.1",StateAddress="Q0.1" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="HV启动",ActionAddress="M1.2",StateAddress="Q2.0" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="LV电源",ActionAddress="M1.3",StateAddress="Q0.2" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="LV启动",ActionAddress="M1.4",StateAddress="VW30" ,StateAddressType=HandSwitchStateType.Word },//VW30=1 - new HandSwitchData(){Name="P1水泵",ActionAddress="M1.5",StateAddress="Q0.3" }, - new HandSwitchData(){Name="P2水泵",ActionAddress="M1.6",StateAddress="Q0.4" }, + new HandSwitchData(){Name="P1水泵",ActionAddress="M1.5",StateAddress="Q0.3" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="P2水泵",ActionAddress="M1.6",StateAddress="Q0.4" ,StateAddressType=HandSwitchStateType.Bool }, - new HandSwitchData(){Name="OS1加热器",ActionAddress="M1.7",StateAddress="Q0.5" }, - new HandSwitchData(){Name="OS2加热器",ActionAddress="M2.0",StateAddress="Q0.6" }, + new HandSwitchData(){Name="OS1加热器",ActionAddress="M1.7",StateAddress="Q0.5" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="OS2加热器",ActionAddress="M2.0",StateAddress="Q0.6" ,StateAddressType=HandSwitchStateType.Bool }, - new HandSwitchData(){Name="COND2加热器",ActionAddress="M2.1",StateAddress="Q0.7" }, - new HandSwitchData(){Name="EVAP加热器",ActionAddress="M2.2",StateAddress="Q1.0" }, - new HandSwitchData(){Name="HCV1",ActionAddress="M2.3",StateAddress="Q1.1" }, - new HandSwitchData(){Name="HCV2",ActionAddress="M2.4",StateAddress="Q1.7" }, - new HandSwitchData(){Name="HCV3",ActionAddress="M2.5",StateAddress="Q1.2" }, - new HandSwitchData(){Name="HCV4",ActionAddress="M2.6",StateAddress="Q1.3" }, + new HandSwitchData(){Name="COND2加热器",ActionAddress="M2.1",StateAddress="Q0.7" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="EVAP加热器",ActionAddress="M2.2",StateAddress="Q1.0" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="HCV1",ActionAddress="M2.3",StateAddress="Q1.1" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="HCV2",ActionAddress="M2.4",StateAddress="Q1.7" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="HCV3",ActionAddress="M2.5",StateAddress="Q1.2" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="HCV4",ActionAddress="M2.6",StateAddress="Q1.3" ,StateAddressType=HandSwitchStateType.Bool }, - new HandSwitchData(){Name="EV1",ActionAddress="M2.7",StateAddress="Q1.4" }, - new HandSwitchData(){Name="EV2",ActionAddress="M3.0",StateAddress="Q1.5" }, - new HandSwitchData(){Name="EV3",ActionAddress="M3.1",StateAddress="Q1.6" }, - new HandSwitchData(){Name="EV4",ActionAddress="M3.2",StateAddress="Q2.1" }, - new HandSwitchData(){Name="试验箱",ActionAddress="M3.3",StateAddress="M3.3" },//VW32=1 - new HandSwitchData(){Name="吸排气球阀",ActionAddress="M3.4",StateAddress="Q2.3" }, - new HandSwitchData(){Name="使能",ActionAddress="M3.5",StateAddress="V9.1" }, + new HandSwitchData(){Name="EV1",ActionAddress="M2.7",StateAddress="Q1.4" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="EV2",ActionAddress="M3.0",StateAddress="Q1.5" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="EV3",ActionAddress="M3.1",StateAddress="Q1.6" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="EV4",ActionAddress="M3.2",StateAddress="Q2.1" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="试验箱",ActionAddress="M3.3",StateAddress="VW32" ,StateAddressType=HandSwitchStateType.Word },//VW32=1 + new HandSwitchData(){Name="吸排气球阀",ActionAddress="M3.4",StateAddress="Q2.3" ,StateAddressType=HandSwitchStateType.Bool }, + new HandSwitchData(){Name="使能",ActionAddress="M3.5",StateAddress="V9.1" ,StateAddressType=HandSwitchStateType.Bool }, }; ListPlcExdConfigCell = new List() @@ -2251,28 +2283,6 @@ namespace CapMachine.Wpf.Services }; - //TagManger.ListTag[0].Name = "new TestType() { byteValue=12}"; - //TagManger.ListTag[0].Name = "new TestType() { byteValue=12}"; - - //Type genericType = typeof(Tag<>).MakeGenericType(typeof(short)); - //Activator.CreateInstance(genericType, 42); - - //var DATA = TagManger.GetTagValueByName("转速"); - //var data1 = TagManger.GetTagByName("转速"); - - //var data2 = TagManger.GetTagByName("转速5888"); - - //data1.TagValue.Value = 12; - - //TagInfo = data1; - - //var TagInfo1= data1.RtValue.Value; - - //var Data = DATA.Value; - - //dynamic dad=10; - - InitialPLCCom(); //拓展的参数信息 @@ -2295,7 +2305,7 @@ namespace CapMachine.Wpf.Services /// public bool SysReset() { - + SiemensDrive.Write("M0.7", true); return true; @@ -2571,44 +2581,44 @@ namespace CapMachine.Wpf.Services try { - ////第一次计时 + //// 第一次计时 //stopwatch.Start(); //启动Stopwatch //CANLIN数据读取到TagManger.DicTags数据中心中,上面的操作是itemWrite反写到PLC中 foreach (var itemCanLinGroup in TagManger.DicTags) { + //转速特殊处理,因为在数据集合中叫做【转速】,在CANLIN中叫做【通讯转速】 + if (itemCanLinGroup.Value.NameNoUnit == "转速") + { + switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) + { + case CanLinEnum.Can: + //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX + if (TagManger.TryGetPVModel(itemCanLinGroup.Key, out MeterValueAttrCell? CanpVModel)) + { + CanpVModel!.EngValue = CanDriveService.GetDbcSpeedValueBySpeedName("通讯转速"); + SiemensDrive.Write(CanpVModel!.Address, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯转速")); + //pVModel.EngSrcValue = 0; + } + break; + case CanLinEnum.Lin: + //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX + if (TagManger.TryGetPVModel(itemCanLinGroup.Key, out MeterValueAttrCell? LinpVModel)) + { + LinpVModel!.EngValue = LinDriveService.GetLdfSpeedValueBySpeedName("通讯转速"); + SiemensDrive.Write(LinpVModel!.Address, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯转速")); + } + break; + default: + break; + } + //找到后继续下一个 + continue; + } + //只处理CANLIN的数据 if (itemCanLinGroup.Value.Group == "CANLIN") { - //转速特殊处理,因为在数据集合中叫做【转速】,在CANLIN中叫做【通讯转速】 - if (itemCanLinGroup.Value.NameNoUnit == "转速") - { - switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) - { - case CanLinEnum.Can: - //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX - if (TagManger.TryGetPVModel(itemCanLinGroup.Key, out MeterValueAttrCell? CanpVModel)) - { - CanpVModel!.EngValue = CanDriveService.GetDbcSpeedValueBySpeedName("通讯转速"); - SiemensDrive.Write(CanpVModel!.Address, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯转速")); - //pVModel.EngSrcValue = 0; - } - break; - case CanLinEnum.Lin: - //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX - if (TagManger.TryGetPVModel(itemCanLinGroup.Key, out MeterValueAttrCell? LinpVModel)) - { - LinpVModel!.EngValue = LinDriveService.GetLdfSpeedValueBySpeedName("通讯转速"); - SiemensDrive.Write(LinpVModel!.Address, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯转速")); - } - break; - default: - break; - } - //找到后继续下一个 - continue; - } - //尝试获取模型信息 if (TagManger.TryGetPVModel(itemCanLinGroup.Key, out MeterValueAttrCell? pVModel)) { @@ -2637,7 +2647,7 @@ namespace CapMachine.Wpf.Services } //PV批量读取 - OperateResultBlockPVRead = SiemensDrive.Read("VW100", 200); + OperateResultBlockPVRead = SiemensDrive.Read("VW100", 700); if (OperateResultBlockPVRead.IsSuccess) { foreach (var itemBlockReadTag in TagManger.DicTags) @@ -2726,7 +2736,7 @@ namespace CapMachine.Wpf.Services //stopwatch.Reset(); //读取报警信息 取消报警XXX - OperateResultAlarm = SiemensDrive.ReadBool("V0.0", 15); + OperateResultAlarm = SiemensDrive.ReadBool("V0.1", 20); if (OperateResultAlarm.IsSuccess) { foreach (var item in AlarmService.ListAlarmRunCell) @@ -2735,33 +2745,48 @@ namespace CapMachine.Wpf.Services } } - //循环读取手自动切换 取消XXX + //循环读取手自动切换 foreach (var item in ListHandSwitchData) { - item.StateOperateResult = SiemensDrive.ReadBool(item.StateAddress); - if (item.StateOperateResult.IsSuccess) + switch (item.StateAddressType) { - item.State = item.StateOperateResult.Content; - //根据PLC得到执行的步骤数据,更新到CAN和LIN的数据,压缩的使能时来自于程序的步骤配置,不再接受PLC的指令数据 - //if (item.Name!.Equals("使能")) - //{ - // switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) - // { - // case CanLinEnum.Can: - // //获取PLC的使能状态,更新到CAN的使能状态 - // CanDriveService.UpdateCapEnableCmdData(item.State); - // //itemTag.Value.EngPvValue = 0; - // break; - // case CanLinEnum.Lin: - // //获取PLC的使能状态,更新到LIN的使能状态 - // LinDriveService.UpdateCapEnableCmdData(item.State); - // //itemTag.Value.EngPvValue = 0; - // break; - // default: - // break; - // } - //} + case HandSwitchStateType.Bool: + item.StateBoolOperateResult = SiemensDrive.ReadBool(item.StateAddress); + if (item.StateBoolOperateResult.IsSuccess) + { + item.State = item.StateBoolOperateResult.Content; + //根据PLC得到执行的步骤数据,更新到CAN和LIN的数据,压缩的使能时来自于程序的步骤配置,不再接受PLC的指令数据 + //if (item.Name!.Equals("使能")) + //{ + // switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) + // { + // case CanLinEnum.Can: + // //获取PLC的使能状态,更新到CAN的使能状态 + // CanDriveService.UpdateCapEnableCmdData(item.State); + // //itemTag.Value.EngPvValue = 0; + // break; + // case CanLinEnum.Lin: + // //获取PLC的使能状态,更新到LIN的使能状态 + // LinDriveService.UpdateCapEnableCmdData(item.State); + // //itemTag.Value.EngPvValue = 0; + // break; + // default: + // break; + // } + //} + } + break; + case HandSwitchStateType.Word: + item.StateShortOperateResult = SiemensDrive.ReadInt16(item.StateAddress); + if (item.StateShortOperateResult.IsSuccess) + { + item.State = item.StateShortOperateResult.Content == 0 ? false : true; + } + break; + default: + break; } + } @@ -3064,9 +3089,19 @@ namespace CapMachine.Wpf.Services foreach (var itemStepExd in ProRunChannelData.ListStepExd) { //压缩机使能的参数直接给压缩机触发 - if (itemStepExd.Name.Contains("压缩机使能")) + if (itemStepExd.Name!.Contains("压缩机使能")) { - CanDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value); + switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) + { + case CanLinEnum.Can: + CanDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!); + break; + case CanLinEnum.Lin: + LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!); + break; + default: + break; + } continue; } @@ -3076,11 +3111,11 @@ namespace CapMachine.Wpf.Services switch (itemStepExd.ValueType) { case ExdValueType.Bool: - var ResultBool = SiemensDrive.Write(DataAdrees.Address, (bool)itemStepExd.Value == true ? 1 : 0); + var ResultBool = SiemensDrive.Write(DataAdrees.Address, (bool)itemStepExd.Value! == true ? 1 : 0); if (!ResultBool.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:{itemStepExd.Name}写入失败"); break; case ExdValueType.Short: - var ResultShort = SiemensDrive.Write(DataAdrees.Address, (short)itemStepExd.Value); + var ResultShort = SiemensDrive.Write(DataAdrees.Address, (short)itemStepExd.Value!); if (!ResultShort.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:{itemStepExd.Name}写入失败"); break; case ExdValueType.Double: @@ -3094,27 +3129,27 @@ namespace CapMachine.Wpf.Services } - if (ProRunChannelData.RunStepType == RunStepType.SlopCell) - { - //SiemensDrive.Write("D1", (short)ProRunChannelData.SV); - //Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " + - // $"【参数名称】:{ProRunChannelData.MeterName} " + - // $"【程序Seg】{ProRunChannelData.ProSegName} " + - // $"【程序步骤】{ProRunChannelData.MeterStep} " + - // $"【斜坡打点步骤】{ProRunChannelData.SlopStepNo} " + - // $"【斜坡打点值SV】{ProRunChannelData.SV} " + - // $"【Msg】:接受到仿真写入PLC OK "); - } - else - { - //SiemensDrive.Write("D1", (short)ProRunChannelData.SV); - //Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " + - // $"【参数名称】:{ProRunChannelData.MeterName} " + - // $"【程序Seg】{ProRunChannelData.ProSegName} " + - // $"【程序步骤】{ProRunChannelData.MeterStep} " + - // $"【步骤SV】{ProRunChannelData.SV} " + - // $"【Msg】:接受到步骤仿真写入PLC OK "); - } + //if (ProRunChannelData.RunStepType == RunStepType.SlopCell) + //{ + // //SiemensDrive.Write("D1", (short)ProRunChannelData.SV); + // //Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " + + // // $"【参数名称】:{ProRunChannelData.MeterName} " + + // // $"【程序Seg】{ProRunChannelData.ProSegName} " + + // // $"【程序步骤】{ProRunChannelData.MeterStep} " + + // // $"【斜坡打点步骤】{ProRunChannelData.SlopStepNo} " + + // // $"【斜坡打点值SV】{ProRunChannelData.SV} " + + // // $"【Msg】:接受到仿真写入PLC OK "); + //} + //else + //{ + // //SiemensDrive.Write("D1", (short)ProRunChannelData.SV); + // //Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " + + // // $"【参数名称】:{ProRunChannelData.MeterName} " + + // // $"【程序Seg】{ProRunChannelData.ProSegName} " + + // // $"【程序步骤】{ProRunChannelData.MeterStep} " + + // // $"【步骤SV】{ProRunChannelData.SV} " + + // // $"【Msg】:接受到步骤仿真写入PLC OK "); + //} //Thread.Sleep(50); @@ -3139,7 +3174,7 @@ namespace CapMachine.Wpf.Services { CanDriveService.UpdateSpeedCmdData(SpeedSv); } - + //itemTag.Value.EngPvValue = 0; break; case CanLinEnum.Lin: diff --git a/CapMachine.Wpf/Services/ProRuntimeService.cs b/CapMachine.Wpf/Services/ProRuntimeService.cs index 7818ddb..abc64eb 100644 --- a/CapMachine.Wpf/Services/ProRuntimeService.cs +++ b/CapMachine.Wpf/Services/ProRuntimeService.cs @@ -307,12 +307,12 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ListStepExd = new List() - { - new StepExd(){ Name="输出锁定",Value=itemMeterValueCell.OutLock,ValueType=ExdValueType.Bool}, - new StepExd(){ Name="吸排气阀",Value=itemMeterValueCell.InhExhValve,ValueType=ExdValueType.Bool}, - new StepExd(){ Name="EV",Value=(short)itemMeterValueCell.Ev,ValueType=ExdValueType.Short}, - new StepExd(){ Name="压缩机使能",Value=itemMeterValueCell.CapEnable,ValueType=ExdValueType.Bool}, - }, + { + new StepExd(){ Name="输出锁定",Value=itemMeterValueCell.OutLock,ValueType=ExdValueType.Bool}, + new StepExd(){ Name="吸排气阀",Value=itemMeterValueCell.InhExhValve,ValueType=ExdValueType.Bool}, + new StepExd(){ Name="EV",Value=(short)itemMeterValueCell.Ev,ValueType=ExdValueType.Short}, + new StepExd(){ Name="压缩机使能",Value=itemMeterValueCell.CapEnable,ValueType=ExdValueType.Bool}, + }, ProStepInfo = $"{itemStep.StepNo}", ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", @@ -374,12 +374,12 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ListStepExd = new List() - { - new StepExd(){ Name="输出锁定",Value=itemMeterValueCell.OutLock,ValueType=ExdValueType.Bool}, - new StepExd(){ Name="吸排气阀",Value=itemMeterValueCell.InhExhValve,ValueType=ExdValueType.Bool}, - new StepExd(){ Name="EV",Value=(short)itemMeterValueCell.Ev,ValueType=ExdValueType.Short}, - new StepExd(){ Name="压缩机使能",Value=itemMeterValueCell.CapEnable,ValueType=ExdValueType.Bool}, - }, + { + new StepExd(){ Name="输出锁定",Value=itemMeterValueCell.OutLock,ValueType=ExdValueType.Bool}, + new StepExd(){ Name="吸排气阀",Value=itemMeterValueCell.InhExhValve,ValueType=ExdValueType.Bool}, + new StepExd(){ Name="EV",Value=(short)itemMeterValueCell.Ev,ValueType=ExdValueType.Short}, + new StepExd(){ Name="压缩机使能",Value=itemMeterValueCell.CapEnable,ValueType=ExdValueType.Bool}, + }, ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", diff --git a/CapMachine.Wpf/ViewModels/DialogMeterExdViewModel.cs b/CapMachine.Wpf/ViewModels/DialogMeterExdViewModel.cs index 7e221f8..9b25d4f 100644 --- a/CapMachine.Wpf/ViewModels/DialogMeterExdViewModel.cs +++ b/CapMachine.Wpf/ViewModels/DialogMeterExdViewModel.cs @@ -72,7 +72,7 @@ namespace CapMachine.Wpf.ViewModels switch (CurMeterCmdMsg.Name) { case "PTC功率": - //发送数据 SV2 + //发送数据 PTC功率 SV2 MachineRtDataService.SiemensDrive.Write("VW434", (short)Value); break; default: diff --git a/CapMachine.Wpf/ViewModels/MonitorViewModel.cs b/CapMachine.Wpf/ViewModels/MonitorViewModel.cs index 919f39b..510df44 100644 --- a/CapMachine.Wpf/ViewModels/MonitorViewModel.cs +++ b/CapMachine.Wpf/ViewModels/MonitorViewModel.cs @@ -62,14 +62,23 @@ namespace CapMachine.Wpf.ViewModels InhPressTag = TagManager.DicTags.GetValueOrDefault("吸气压力[BarA]"); InhTempTag = TagManager.DicTags.GetValueOrDefault("吸气温度[℃]"); + Cond1TempT4Tag = TagManager.DicTags.GetValueOrDefault("COND1入口温度T4[℃]"); + VRVTag = TagManager.DicTags.GetValueOrDefault("冷媒流量[kg/h]"); + LubeFlowTag = TagManager.DicTags.GetValueOrDefault("润滑油流量[kg/h]"); + Cond2TempTag = TagManager.DicTags.GetValueOrDefault("COND2温度[℃]"); + TxvFrPressP3Tag = TagManager.DicTags.GetValueOrDefault("阀前压力P3[BarA]"); + TxvFrTempT3Tag = TagManager.DicTags.GetValueOrDefault("阀前温度T3[℃]"); + SubcoolingTag = TagManager.DicTags.GetValueOrDefault("过冷度[K]"); + + ComCapBusVolTag = TagManager.DicTags.GetValueOrDefault("通讯母线电压[V]"); ComCapBusCurTag = TagManager.DicTags.GetValueOrDefault("通讯母线电流[A]"); ComCapPwTag = TagManager.DicTags.GetValueOrDefault("通讯功率[W]"); - OS2TempTag = TagManager.DicTags.GetValueOrDefault("吸气混合器温度[℃]"); - TxvFrTempTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前温度[℃]"); - TxvFrPressTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前压力[BarA]"); - Cond1TempTag = TagManager.DicTags.GetValueOrDefault("冷凝器出口水温[℃]"); - CondInTempTag = TagManager.DicTags.GetValueOrDefault("冷凝器进口温度[℃]"); + //OS2TempTag = TagManager.DicTags.GetValueOrDefault("吸气混合器温度[℃]"); + //TxvFrTempTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前温度[℃]"); + //TxvFrPressTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前压力[BarA]"); + //Cond1TempTag = TagManager.DicTags.GetValueOrDefault("冷凝器出口水温[℃]"); + //CondInTempTag = TagManager.DicTags.GetValueOrDefault("冷凝器进口温度[℃]"); } @@ -222,7 +231,38 @@ namespace CapMachine.Wpf.ViewModels /// /// 冷凝器出口水温 /// - public ITag Cond1TempTag { get; set; } + public ITag Cond1TempT4Tag { get; set; } + + /// + /// 冷媒流量 + /// + public ITag VRVTag { get; set; } + + /// + /// 润滑油流量 + /// + public ITag LubeFlowTag { get; set; } + + /// + /// COND2温度 + /// + public ITag Cond2TempTag { get; set; } + + + /// + /// 阀前压力P3 + /// + public ITag TxvFrPressP3Tag { get; set; } + + /// + /// 阀前温度T3[℃] + /// + public ITag TxvFrTempT3Tag { get; set; } + + /// + /// 过冷度[K] + /// + public ITag SubcoolingTag { get; set; } /// /// 冷凝器进口温度 diff --git a/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs b/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs index 26a8af3..376fef9 100644 --- a/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs +++ b/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs @@ -13953,7 +13953,7 @@ namespace CapMachine.Wpf.ViewModels #endregion - #region PTCPw表 + #region PTCPw1表 @@ -14646,6 +14646,702 @@ namespace CapMachine.Wpf.ViewModels #endregion + + + //#region PTCPw2表-北厂未启用此功能,南厂有此功能 + + + + ///// + ///// PTCPw2 初始化函数 + ///// + //private void PTCPw2Init() + //{ + // ListSlopMeterPTCPw2Items = new ObservableCollection(); + // SelectedSlopPTCPw2 = new MeterPTCPw2(); + // SelectedConstPTCPw2 = new MeterPTCPw2(); + //} + + + //private ObservableCollection _ListSlopMeterPTCPw2Items; + ///// + ///// Meter PTCPw2数据集合 斜率的 + ///// + //public ObservableCollection ListSlopMeterPTCPw2Items + //{ + // get { return _ListSlopMeterPTCPw2Items; } + // set { _ListSlopMeterPTCPw2Items = value; RaisePropertyChanged(); } + //} + + ///// + ///// MeterPTCPw2集合数据 斜率 + ///// + //public List ListSlopMeterPTCPw2 { get; set; } + + + //private MeterPTCPw2 _SelectedSlopPTCPw2; + ///// + ///// 当前选中的程序 PTCPw2 斜率 + ///// + //public MeterPTCPw2 SelectedSlopPTCPw2 + //{ + // get { return _SelectedSlopPTCPw2; } + // set { _SelectedSlopPTCPw2 = value; RaisePropertyChanged(); } + //} + + //private MeterExInfoDto _MeterPTCPw2ExDto = new MeterExInfoDto(); + ///// + ///// 当前的拓展模型 PTCPw2 + ///// 用作统计,计算等 + ///// + //public MeterExInfoDto MeterPTCPw2ExDto + //{ + // get { return _MeterPTCPw2ExDto; } + // set { _MeterPTCPw2ExDto = value; RaisePropertyChanged(); } + //} + + + + //private MeterPTCPw2 _SelectedConstPTCPw2; + ///// + ///// 当前选中的程序 PTCPw2 常值 + ///// + //public MeterPTCPw2 SelectedConstPTCPw2 + //{ + // get { return _SelectedConstPTCPw2; } + // set { _SelectedConstPTCPw2 = value; RaisePropertyChanged(); } + //} + + + //private double _SelectedConstPTCPw2Value; + ///// + ///// 常值模式设置的数据 + ///// + //public double SelectedConstPTCPw2Value + //{ + // get { return _SelectedConstPTCPw2Value; } + // set { _SelectedConstPTCPw2Value = value; RaisePropertyChanged(); } + //} + + + + //private DelegateCommand _MeterPTCPw2SlopSelectedChangedCmd; + ///// + ///// 刷新数据命令 + ///// + //public DelegateCommand MeterPTCPw2SlopSelectedChangedCmd + //{ + // set + // { + // _MeterPTCPw2SlopSelectedChangedCmd = value; + // } + // get + // { + // if (_MeterPTCPw2SlopSelectedChangedCmd == null) + // { + // _MeterPTCPw2SlopSelectedChangedCmd = new DelegateCommand((str) => MeterPTCPw2SlopSelectedChangedCmdMethod(str)); + // } + // return _MeterPTCPw2SlopSelectedChangedCmd; + // } + //} + + + ///// + ///// PTCPw2表选中行的执行方法 + ///// + ///// + ///// + //private void MeterPTCPw2SlopSelectedChangedCmdMethod(object par) + //{ + // var SelectedData = par as MeterPTCPw2; + // if (SelectedData != null) + // { + // //直接属性赋值,防止更改后未保存但是列表是同一个实例,列表更新了 + // SelectedSlopPTCPw2 = new MeterPTCPw2 + // { + // StartValue = SelectedData.StartValue, + // EndValue = SelectedData.EndValue, + // StepNo = SelectedData.StepNo, + // Id = SelectedData.Id, + // ProStepId = SelectedData.ProStepId, + // ProStep = SelectedData.ProStep, + // Constant = SelectedData.Constant, + // ValueType = SelectedData.ValueType, + // CreateTime = SelectedData.CreateTime, + // KeepTime = SelectedData.KeepTime, + // AlarmNo = SelectedData.AlarmNo, + // LimitNo = SelectedData.LimitNo, + // PIDNo = SelectedData.PIDNo, + // }; + + // } + //} + + //private DelegateCommand _ProStepPTCPw2AddCmd; + ///// + ///// 新增PTCPw2命令 + ///// + //public DelegateCommand ProStepPTCPw2AddCmd + //{ + // set + // { + // _ProStepPTCPw2AddCmd = value; + // } + // get + // { + // if (_ProStepPTCPw2AddCmd == null) + // { + // _ProStepPTCPw2AddCmd = new DelegateCommand(() => ProStepPTCPw2AddCmdMethod()); + // } + // return _ProStepPTCPw2AddCmd; + // } + //} + + ///// + ///// 增加PTCPw2命令执行方法 + ///// + //private void ProStepPTCPw2AddCmdMethod() + //{ + // if (SelectedProgramSeg != null && SelectedProStepDto == null) + // { + // MessageBox.Show("未发现选中要操作的数据!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand); + // return; + // } + + // //if (GetKeepTimeBySpeed() < (ListSlopMeterPTCPw2.Sum(a => a.KeepTime) + SelectedSlopPTCPw2.KeepTime)) + // //{ + // // MessageBox.Show("请把设置对象和速度表的时间匹配上!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand); + // // return; + // //} + + // //删除可能之前的常值数据 + // var Data = ListProStep.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.ToList(); + // if (Data != null && Data.Where(a => a.ValueType == ConfigValueType.Constant).Any()) + // { + // //常值数据库数据删除 + // FreeSql.Delete(Data.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault()!.Id).ExecuteAffrows(); + // //界面集合数据删除 + // var ConstData = ListProStep.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault(); + // ListProStep.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.Remove(ConstData!); + // } + + // //当前的速度表集合数据 + // var MeterPTCPw2s = ListSlopMeterPTCPw2Items.ToList(); + + // var MeterPTCPw2Data = new MeterPTCPw2() + // { + // StartValue = SelectedSlopPTCPw2.StartValue, + // EndValue = SelectedSlopPTCPw2.EndValue, + // KeepTime = SelectedSlopPTCPw2.KeepTime, + // ProStepId = SelectedProStepDto.Id, + // AlarmNo = SelectedSlopPTCPw2.AlarmNo, + // LimitNo = SelectedSlopPTCPw2.LimitNo, + // PIDNo = SelectedSlopPTCPw2.PIDNo, + // ValueType = ConfigValueType.Slope, + // StepNo = AutoGetMeterPTCPw2StepNo(), + // }; + + // //增加数据 + // var InsertDataId = FreeSql.Insert(MeterPTCPw2Data).ExecuteIdentity(); + + // //重新查询获取的数据包括子集 + // var GetInsertData = RefreshPTCPw2ById(InsertDataId); + // //var CurIndex = ListProStep.FindIndex(a => a.Id == InsertStepData!.Id); + + // var CurIndex = GetListMeterIndex(SelectedProgramSeg!.ProSteps!.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.Count(), + // SelectedProgramSeg!.ProSteps!.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.Count() != 0 ? SelectedProgramSeg!.ProSteps!.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.Max(a => a.StepNo) : 0); + + // //上级的新增数据到集合中 + // SelectedProgramSeg!.ProSteps!.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.Insert(CurIndex, GetInsertData); + // //新增数据到集合中 + // ListSlopMeterPTCPw2.Insert(CurIndex, GetInsertData); + + // //新增数据到界面集合中 + // ListSlopMeterPTCPw2Items.Insert(CurIndex, GetInsertData); + + // //更新ProStep的字符串的集合数据 + // ListProStepDtoItems.FindFirst(a => a.Id == SelectedProStepDto.Id)!.MeterPTCPw2Info = MeterPTCPw2ToString(ListSlopMeterPTCPw2); + + // //更新后检测时间是否匹配并界面提示 + // CheckPTCPw2SlopListTime(); + // SelectedSlopPTCPw2 = new MeterPTCPw2() { Id = -1 }; + //} + + + //private DelegateCommand _ProStepPTCPw2EditCmd; + ///// + ///// 新增PTCPw2命令 + ///// + //public DelegateCommand ProStepPTCPw2EditCmd + //{ + // set + // { + // _ProStepPTCPw2EditCmd = value; + // } + // get + // { + // if (_ProStepPTCPw2EditCmd == null) + // { + // _ProStepPTCPw2EditCmd = new DelegateCommand(() => ProStepPTCPw2EditCmdMethod()); + // } + // return _ProStepPTCPw2EditCmd; + // } + //} + + ///// + ///// 编辑PTCPw2命令执行方法 + ///// + //private void ProStepPTCPw2EditCmdMethod() + //{ + // if (SelectedProgramSeg == null || SelectedProStepDto == null || SelectedSlopPTCPw2 == null || SelectedSlopPTCPw2.Id == -1) + // { + // MessageBox.Show("未发现选中要操作的数据!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand); + // return; + // } + + // //if (GetKeepTimeBySpeed() < (ListSlopMeterPTCPw2.Where(a => a.Id != SelectedSlopPTCPw2!.Id).Sum(a => a.KeepTime) + SelectedSlopPTCPw2!.KeepTime)) + // //{ + // // MessageBox.Show("请把设置对象和速度表的时间匹配上!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand); + // // return; + // //} + + // var UpdateData = FreeSql.Update() + // .Set(a => a.StartValue, SelectedSlopPTCPw2.StartValue) + // .Set(a => a.EndValue, SelectedSlopPTCPw2.EndValue) + // .Set(a => a.KeepTime, SelectedSlopPTCPw2.KeepTime) + // .Set(a => a.StepNo, SelectedSlopPTCPw2.StepNo) + // .Set(a => a.PIDNo, SelectedSlopPTCPw2.PIDNo) + // .Set(a => a.LimitNo, SelectedSlopPTCPw2.LimitNo) + // .Set(a => a.AlarmNo, SelectedSlopPTCPw2.AlarmNo) + // .Where(a => a.Id == SelectedSlopPTCPw2.Id) + // .ExecuteUpdated().FirstOrDefault(); + + // //重新查询获取的数据包括子集 + // var GetUpdateData = RefreshPTCPw2ById(SelectedSlopPTCPw2.Id); + // var CurIndex = ListSlopMeterPTCPw2.FindIndex(a => a.Id == SelectedSlopPTCPw2.Id); + + // //删除上级的旧数据 + // SelectedProgramSeg!.ProSteps!.FindFirst(a => a.Id == SelectedProStepDto!.Id).MeterPTCPw2s!.Remove(ListSlopMeterPTCPw2.Find(a => a.Id == SelectedSlopPTCPw2!.Id)!); + // //移除旧的数据 + // ListSlopMeterPTCPw2.Remove(ListSlopMeterPTCPw2.Find(a => a.Id == SelectedSlopPTCPw2.Id)!); + + // //上级新增数据 + // SelectedProgramSeg!.ProSteps!.FindFirst(a => a.Id == SelectedProStepDto!.Id).MeterPTCPw2s!.Insert(CurIndex, GetUpdateData); + // //新增数据 + // ListSlopMeterPTCPw2.Insert(CurIndex, GetUpdateData); + + // //移除旧的数据 + // ListSlopMeterPTCPw2Items.Remove(ListSlopMeterPTCPw2Items.Where(a => a.Id == SelectedSlopPTCPw2!.Id).FirstOrDefault()!); + // ListSlopMeterPTCPw2Items.Insert(CurIndex, GetUpdateData); + + // //更新ProStep的字符串的集合数据 + // ListProStepDtoItems.FindFirst(a => a.Id == SelectedProStepDto!.Id)!.MeterPTCPw2Info = MeterPTCPw2ToString(ListSlopMeterPTCPw2); + + // //更新后检测时间是否匹配并界面提示 + // CheckPTCPw2SlopListTime(); + //} + + //private DelegateCommand _ProStepPTCPw2DeleteCmd; + ///// + ///// 新增PTCPw2命令 + ///// + //public DelegateCommand ProStepPTCPw2DeleteCmd + //{ + // set + // { + // _ProStepPTCPw2DeleteCmd = value; + // } + // get + // { + // if (_ProStepPTCPw2DeleteCmd == null) + // { + // _ProStepPTCPw2DeleteCmd = new DelegateCommand(() => ProStepPTCPw2DeleteCmdMethod()); + // } + // return _ProStepPTCPw2DeleteCmd; + // } + //} + + ///// + ///// 增加PTCPw2命令执行方法 + ///// + //private void ProStepPTCPw2DeleteCmdMethod() + //{ + // if (SelectedProgramSeg != null && SelectedProStepDto != null && SelectedSlopPTCPw2 != null && SelectedSlopPTCPw2.Id != -1) + // { + // MessageBoxResult dialogResult = MessageBox.Show("你确定要删除当前的数据吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand); + // if (dialogResult == MessageBoxResult.OK) + // { + // FreeSql.Delete(SelectedSlopPTCPw2!.Id).ExecuteAffrows(); + + // //删除上级的旧数据 + // SelectedProgramSeg!.ProSteps!.FindFirst(a => a.Id == SelectedProStepDto!.Id).MeterPTCPw2s!.Remove(ListSlopMeterPTCPw2.Find(a => a.Id == SelectedSlopPTCPw2!.Id)!); + // //移除旧的数据 + // ListSlopMeterPTCPw2.Remove(ListSlopMeterPTCPw2.Find(a => a.Id == SelectedSlopPTCPw2.Id)!); + + // //移除旧的数据 + // ListSlopMeterPTCPw2Items.Remove(ListSlopMeterPTCPw2Items.Where(a => a.Id == SelectedSlopPTCPw2!.Id).FirstOrDefault()!); + + // //更新ProStep的字符串的集合数据 + // ListProStepDtoItems.FindFirst(a => a.Id == SelectedProStepDto!.Id)!.MeterPTCPw2Info = MeterPTCPw2ToString(ListSlopMeterPTCPw2); + + // //更新后检测时间是否匹配并界面提示 + // CheckPTCPw2SlopListTime(); + // SelectedSlopPTCPw2 = new MeterPTCPw2() { Id = -1 }; + // } + + // } + // else + // { + // MessageBox.Show("未发现选中要删除的数据!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand); + // } + //} + + + + ///// + ///// 更新PTCPw2表信息 + ///// + //private void RefreshMeterPTCPw2() + //{ + // ListSlopMeterPTCPw2 = ListProgramSeg.Where(a => a.Id == SelectedProgramSeg.Id).FirstOrDefault()!.ProSteps!.Where(a => a.Id == SelectedProStepDto.Id)! + // .FirstOrDefault()!.MeterPTCPw2s!.ToList(); + + // ListSlopMeterPTCPw2Items.Clear(); + + // ListSlopMeterPTCPw2Items = new ObservableCollection(ListSlopMeterPTCPw2!); + + //} + + ///// + ///// 获取PTCPw2当前的步骤的数据信息 + ///// + //private int AutoGetMeterPTCPw2StepNo() + //{ + // var StepInfo = FreeSql.Select().Where(a => a.ProStepId == SelectedProStepDto.Id).ToList(); + // if (StepInfo != null && StepInfo.Count > 0) + // { + // var MaxStep = StepInfo.Max(a => a.StepNo); + // return MaxStep + 1; + // } + // else + // { + // return 1; + // } + + //} + + //private DelegateCommand _ProStepPTCPw2ConstantSaveCmd; + ///// + /////ConstantSaveCommand 常值保存命令 + ///// + //public DelegateCommand ProStepPTCPw2ConstantSaveCmd + //{ + // set + // { + // _ProStepPTCPw2ConstantSaveCmd = value; + // } + // get + // { + // if (_ProStepPTCPw2ConstantSaveCmd == null) + // { + // _ProStepPTCPw2ConstantSaveCmd = new DelegateCommand(() => ProStepPTCPw2ConstantSaveCmdMethod()); + // } + // return _ProStepPTCPw2ConstantSaveCmd; + // } + //} + ///// + ///// ConstantSaveCommand 常值保存命令执行方法 + ///// + //private void ProStepPTCPw2ConstantSaveCmdMethod() + //{ + // if (SelectedProStepDto == null) + // { + // MessageBox.Show("未发现选中要操作的数据!", "提示", MessageBoxButton.OK, MessageBoxImage.Hand); + // return; + // } + + // //1 先判断是否有斜率数据,有则判断后删除,否则退回。 + // if (ListSlopMeterPTCPw2Items != null && ListSlopMeterPTCPw2Items.Where(a => a.ValueType == ConfigValueType.Slope && a.ProStepId == SelectedProStepDto.Id).Count() > 0) + // { + // var result = MessageBox.Show("你将要保存常值模式的数据,同一个时刻只能配置一个模式生效,检测到【斜率】设置中存在多天数据,是否删除?【确定】将要删除斜率数据且设置常值信息,【取消】则不删除斜率数据且常值不保存", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Hand); + // if (result == MessageBoxResult.OK) + // { + // var ListTempDeleteData = new List(); + // //删除以前的斜率数据 + // foreach (var item in ListSlopMeterPTCPw2Items) + // { + // var DeleteData = FreeSql.Delete(item.Id).ExecuteDeleted().FirstOrDefault(); + // ListTempDeleteData.Add(DeleteData); + // } + + // //再循环删除数据 + // foreach (var DeleteData in ListTempDeleteData) + // { + // //删除上级的旧数据 + // SelectedProgramSeg!.ProSteps!.FindFirst(a => a.Id == SelectedProStepDto!.Id).MeterPTCPw2s!.Remove(ListSlopMeterPTCPw2.Find(a => a.Id == DeleteData!.Id)!); + // //移除旧的数据 + // ListSlopMeterPTCPw2.Remove(ListSlopMeterPTCPw2.Find(a => a.Id == DeleteData!.Id)!); + + // //移除旧的数据 + // ListSlopMeterPTCPw2Items.Remove(ListSlopMeterPTCPw2Items.Where(a => a.Id == DeleteData!.Id).FirstOrDefault()!); + // } + + + // //更新ProStep的字符串的集合数据 + // ListProStepDtoItems.FindFirst(a => a.Id == SelectedProStepDto!.Id)!.MeterPTCPw2Info = MeterPTCPw2ToString(ListSlopMeterPTCPw2); + + // //更新后检测时间是否匹配并界面提示 + // CheckPTCPw2SlopListTime(); + + // } + // else + // { + // //不删除,不进行动作 + // return; + // } + // } + + // //2 再判断之前是否存在常值数据 + // var ConstPTCPw2Data = ListProStep.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.ToList(); + // if (ConstPTCPw2Data != null && ConstPTCPw2Data.Where(a => a.ValueType == ConfigValueType.Constant && a.ProStepId == SelectedProStepDto.Id).Count() == 0) + // { + // //没有常值数据,则新增 + // var MeterPTCPw2Data = new MeterPTCPw2() + // { + // Constant = SelectedConstPTCPw2Value, + // ValueType = ConfigValueType.Constant, + // KeepTime = GetKeepTimeBySpeed(), + // ProStepId = SelectedProStepDto.Id, + // //StepNo = AutoGetMeterPTCPw2StepNo(), + // }; + + // //增加数据 + // var InsertDataId = FreeSql.Insert(MeterPTCPw2Data).ExecuteIdentity(); + + // //重新查询获取的数据包括子集 + // var GetInsertData = RefreshPTCPw2ById(InsertDataId); + + // //上级的新增数据到集合中 + // SelectedProgramSeg!.ProSteps!.Where(a => a.Id == SelectedProStepDto.Id).FirstOrDefault()!.MeterPTCPw2s!.Add(GetInsertData);//常值只有一个 + + // //更新ProStep的字符串的集合数据 + // ListProStepDtoItems.FindFirst(a => a.Id == SelectedProStepDto.Id)!.MeterPTCPw2Info = MeterPTCPw2ToString(new List { GetInsertData }); + + + // } + // else + // { + // //常值数据不为0,那么说明之前是存在数据的,则需要更改操作 + // var ConstantData = ConstPTCPw2Data!.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault(); + // //更新常值信息 + // FreeSql.Update() + // .Set(a => a.Constant, SelectedConstPTCPw2Value) + // .Set(a => a.KeepTime, GetKeepTimeBySpeed()) + // .Where(a => a.Id == ConstantData!.Id) + // .ExecuteAffrows(); + + // //重新查询获取的数据包括子集 + // var GetUpdateData = RefreshPTCPw2ById(ConstantData!.Id); + + // //删除上级的旧数据 + // SelectedProgramSeg!.ProSteps!.FindFirst(a => a.Id == SelectedProStepDto!.Id).MeterPTCPw2s!.Remove(ConstantData); + + // //上级新增数据 + // SelectedProgramSeg!.ProSteps!.FindFirst(a => a.Id == SelectedProStepDto!.Id).MeterPTCPw2s!.Add(GetUpdateData); + + // //更新ProStep的字符串的集合数据 + // ListProStepDtoItems.FindFirst(a => a.Id == SelectedProStepDto!.Id)!.MeterPTCPw2Info = MeterPTCPw2ToString(new List() { GetUpdateData }); + + // } + //} + + //private bool _ProStepMeterPTCPw2SwitchConstSlopPar; + ///// + ///// Constant/Slop 切换命令的参数值 + ///// + //public bool ProStepMeterPTCPw2SwitchConstSlopPar + //{ + // get { return _ProStepMeterPTCPw2SwitchConstSlopPar; } + // set { _ProStepMeterPTCPw2SwitchConstSlopPar = value; RaisePropertyChanged(); } + //} + + + //private int _ProStepPTCPw2SwitchConstSlopIndex; + ///// + ///// Constant/Slop 切换命令的参数值 Index + ///// + //public int ProStepPTCPw2SwitchConstSlopIndex + //{ + // get { return _ProStepPTCPw2SwitchConstSlopIndex; } + // set { _ProStepPTCPw2SwitchConstSlopIndex = value; RaisePropertyChanged(); } + //} + + + //private DelegateCommand _MeterPTCPw2SwitchConstSlopCmd; + ///// + ///// PTCPw2 常值和斜率切换 命令 + ///// + //public DelegateCommand MeterPTCPw2SwitchConstSlopCmd + //{ + // set + // { + // _MeterPTCPw2SwitchConstSlopCmd = value; + // } + // get + // { + // if (_MeterPTCPw2SwitchConstSlopCmd == null) + // { + // _MeterPTCPw2SwitchConstSlopCmd = new DelegateCommand((obj) => MeterPTCPw2SwitchConstSlopCmdMethod(obj)); + // } + // return _MeterPTCPw2SwitchConstSlopCmd; + // } + //} + //private void MeterPTCPw2SwitchConstSlopCmdMethod(object obj) + //{ + // if ((int)obj == 0) + // { + // ProStepMeterPTCPw2SwitchConstSlopPar = false; + // } + // else + // { + // ProStepMeterPTCPw2SwitchConstSlopPar = true; + // } + + //} + + + //private DelegateCommand _MeterPTCPw2ParConfigCmd; + ///// + ///// PTCPw2 仪表参数的命令 + ///// + //public DelegateCommand MeterPTCPw2ParConfigCmd + //{ + // set + // { + // _MeterPTCPw2ParConfigCmd = value; + // } + // get + // { + // if (_MeterPTCPw2ParConfigCmd == null) + // { + // _MeterPTCPw2ParConfigCmd = new DelegateCommand((par) => MeterPTCPw2ParConfigCmdMethod(par)); + // } + // return _MeterPTCPw2ParConfigCmd; + // } + //} + ///// + ///// PTCPw2参数设置的命令 + ///// + ///// + ///// + //private void MeterPTCPw2ParConfigCmdMethod(object par) + //{ + // if (par != null && par is string) + // { + // CallMeterParConfig("PTC功率", par! as string); + // } + //} + + + ///// + ///// 步骤数据转字符串格式 + ///// + ///// + ///// + //private string MeterPTCPw2ToString(List data) + //{ + // var strInfo = new StringBuilder(); + // if (data != null && data.Count() > 0) + // { + // if (data.Where(a => a.ValueType == ConfigValueType.Slope).Count() > 0) + // { + // var Count = data.Count; + // foreach (var item in data) + // { + // Count--; + // strInfo.Append(item.StartValue); + // strInfo.Append("->"); + // strInfo.Append(item.EndValue); + // strInfo.Append(" ["); + // strInfo.Append(SecToString((int)item.KeepTime)); + // strInfo.Append("]"); + // if (Count != 0) + // { + // strInfo.Append(Environment.NewLine); + // } + // } + // } + // else + // { + // strInfo.Append(data.FirstOrDefault()!.Constant); + // strInfo.Append($" [{SecToString(data.FirstOrDefault()!.KeepTime)}]"); + // } + // } + // else + // { + // //空的集合数据 + // strInfo.Append("---"); + // } + + + + // return strInfo.ToString(); + // //return @"< ASDFA-ADFA-FASD-ADF "+ Environment.NewLine+" ASDFA-ADFA-FASD-ADF ASDFA-ADFA-FASD-ADF "; + //} + + ///// + ///// 检查斜率配置时间集合是否满足要求 + ///// + //private void CheckPTCPw2SlopListTime() + //{ + // //更新后检测时间是否匹配并界面提示 + // MeterPTCPw2ExDto.SlopTime = ListSlopMeterPTCPw2.Sum(a => a.KeepTime); + // if (MeterPTCPw2ExDto.SlopTime != 0) + // { + // if (GetKeepTimeBySpeed() % MeterPTCPw2ExDto.SlopTime != 0) + // { + // MeterPTCPw2ExDto.SlopCycle = GetKeepTimeBySpeed() * 1.0 / MeterPTCPw2ExDto.SlopTime; + // MeterPTCPw2ExDto.IsTimeOk = false; + // } + // else + // { + // MeterPTCPw2ExDto.SlopCycle = GetKeepTimeBySpeed() * 1.0 / MeterPTCPw2ExDto.SlopTime; + // MeterPTCPw2ExDto.IsTimeOk = true; + // } + // } + // else + // { + // //被除数为0, + // } + + //} + + + ///// + ///// 根据ID获取MeterPTCPw2数据 + ///// + ///// + //private MeterPTCPw2 RefreshPTCPw2ById(long id) + //{ + // var Data = FreeSql.Select() + // .Where(c => c.Id == id) + // .Include(a => a.ProStep) + // .ToList(); + + // if (Data != null && Data.Count() > 0) + // { + // return Data.FirstOrDefault()!; + // } + // else + // { + // return new MeterPTCPw2(); + // } + //} + + + //#endregion + + #region EnvRH表 diff --git a/CapMachine.Wpf/Views/MonitorView.xaml b/CapMachine.Wpf/Views/MonitorView.xaml index c07fcb3..ca8f167 100644 --- a/CapMachine.Wpf/Views/MonitorView.xaml +++ b/CapMachine.Wpf/Views/MonitorView.xaml @@ -507,7 +507,7 @@ - + -->