更改了报警地址
复位地址 数据记录进行了校验
This commit is contained in:
@@ -72,7 +72,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
switch (CurMeterCmdMsg.Name)
|
||||
{
|
||||
case "PTC功率":
|
||||
//发送数据 SV2
|
||||
//发送数据 PTC功率 SV2
|
||||
MachineRtDataService.SiemensDrive.Write("VW434", (short)Value);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// 冷凝器出口水温
|
||||
/// </summary>
|
||||
public ITag Cond1TempTag { get; set; }
|
||||
public ITag Cond1TempT4Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 冷媒流量
|
||||
/// </summary>
|
||||
public ITag VRVTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 润滑油流量
|
||||
/// </summary>
|
||||
public ITag LubeFlowTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// COND2温度
|
||||
/// </summary>
|
||||
public ITag Cond2TempTag { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 阀前压力P3
|
||||
/// </summary>
|
||||
public ITag TxvFrPressP3Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阀前温度T3[℃]
|
||||
/// </summary>
|
||||
public ITag TxvFrTempT3Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 过冷度[K]
|
||||
/// </summary>
|
||||
public ITag SubcoolingTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 冷凝器进口温度
|
||||
|
||||
@@ -13953,7 +13953,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
#endregion
|
||||
|
||||
#region PTCPw表
|
||||
#region PTCPw1表
|
||||
|
||||
|
||||
|
||||
@@ -14646,6 +14646,702 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
//#region PTCPw2表-北厂未启用此功能,南厂有此功能
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// PTCPw2 初始化函数
|
||||
///// </summary>
|
||||
//private void PTCPw2Init()
|
||||
//{
|
||||
// ListSlopMeterPTCPw2Items = new ObservableCollection<MeterPTCPw2>();
|
||||
// SelectedSlopPTCPw2 = new MeterPTCPw2();
|
||||
// SelectedConstPTCPw2 = new MeterPTCPw2();
|
||||
//}
|
||||
|
||||
|
||||
//private ObservableCollection<MeterPTCPw2> _ListSlopMeterPTCPw2Items;
|
||||
///// <summary>
|
||||
///// Meter PTCPw2数据集合 斜率的
|
||||
///// </summary>
|
||||
//public ObservableCollection<MeterPTCPw2> ListSlopMeterPTCPw2Items
|
||||
//{
|
||||
// get { return _ListSlopMeterPTCPw2Items; }
|
||||
// set { _ListSlopMeterPTCPw2Items = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// MeterPTCPw2集合数据 斜率
|
||||
///// </summary>
|
||||
//public List<MeterPTCPw2> ListSlopMeterPTCPw2 { get; set; }
|
||||
|
||||
|
||||
//private MeterPTCPw2 _SelectedSlopPTCPw2;
|
||||
///// <summary>
|
||||
///// 当前选中的程序 PTCPw2 斜率
|
||||
///// </summary>
|
||||
//public MeterPTCPw2 SelectedSlopPTCPw2
|
||||
//{
|
||||
// get { return _SelectedSlopPTCPw2; }
|
||||
// set { _SelectedSlopPTCPw2 = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
//private MeterExInfoDto _MeterPTCPw2ExDto = new MeterExInfoDto();
|
||||
///// <summary>
|
||||
///// 当前的拓展模型 PTCPw2
|
||||
///// 用作统计,计算等
|
||||
///// </summary>
|
||||
//public MeterExInfoDto MeterPTCPw2ExDto
|
||||
//{
|
||||
// get { return _MeterPTCPw2ExDto; }
|
||||
// set { _MeterPTCPw2ExDto = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//private MeterPTCPw2 _SelectedConstPTCPw2;
|
||||
///// <summary>
|
||||
///// 当前选中的程序 PTCPw2 常值
|
||||
///// </summary>
|
||||
//public MeterPTCPw2 SelectedConstPTCPw2
|
||||
//{
|
||||
// get { return _SelectedConstPTCPw2; }
|
||||
// set { _SelectedConstPTCPw2 = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
//private double _SelectedConstPTCPw2Value;
|
||||
///// <summary>
|
||||
///// 常值模式设置的数据
|
||||
///// </summary>
|
||||
//public double SelectedConstPTCPw2Value
|
||||
//{
|
||||
// get { return _SelectedConstPTCPw2Value; }
|
||||
// set { _SelectedConstPTCPw2Value = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//private DelegateCommand<object> _MeterPTCPw2SlopSelectedChangedCmd;
|
||||
///// <summary>
|
||||
///// 刷新数据命令
|
||||
///// </summary>
|
||||
//public DelegateCommand<object> MeterPTCPw2SlopSelectedChangedCmd
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// _MeterPTCPw2SlopSelectedChangedCmd = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// if (_MeterPTCPw2SlopSelectedChangedCmd == null)
|
||||
// {
|
||||
// _MeterPTCPw2SlopSelectedChangedCmd = new DelegateCommand<object>((str) => MeterPTCPw2SlopSelectedChangedCmdMethod(str));
|
||||
// }
|
||||
// return _MeterPTCPw2SlopSelectedChangedCmd;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// PTCPw2表选中行的执行方法
|
||||
///// </summary>
|
||||
///// <param name="str"></param>
|
||||
///// <exception cref="NotImplementedException"></exception>
|
||||
//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;
|
||||
///// <summary>
|
||||
///// 新增PTCPw2命令
|
||||
///// </summary>
|
||||
//public DelegateCommand ProStepPTCPw2AddCmd
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// _ProStepPTCPw2AddCmd = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// if (_ProStepPTCPw2AddCmd == null)
|
||||
// {
|
||||
// _ProStepPTCPw2AddCmd = new DelegateCommand(() => ProStepPTCPw2AddCmdMethod());
|
||||
// }
|
||||
// return _ProStepPTCPw2AddCmd;
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 增加PTCPw2命令执行方法
|
||||
///// </summary>
|
||||
//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<MeterPTCPw2>(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<MeterPTCPw2>(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;
|
||||
///// <summary>
|
||||
///// 新增PTCPw2命令
|
||||
///// </summary>
|
||||
//public DelegateCommand ProStepPTCPw2EditCmd
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// _ProStepPTCPw2EditCmd = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// if (_ProStepPTCPw2EditCmd == null)
|
||||
// {
|
||||
// _ProStepPTCPw2EditCmd = new DelegateCommand(() => ProStepPTCPw2EditCmdMethod());
|
||||
// }
|
||||
// return _ProStepPTCPw2EditCmd;
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 编辑PTCPw2命令执行方法
|
||||
///// </summary>
|
||||
//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<MeterPTCPw2>()
|
||||
// .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;
|
||||
///// <summary>
|
||||
///// 新增PTCPw2命令
|
||||
///// </summary>
|
||||
//public DelegateCommand ProStepPTCPw2DeleteCmd
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// _ProStepPTCPw2DeleteCmd = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// if (_ProStepPTCPw2DeleteCmd == null)
|
||||
// {
|
||||
// _ProStepPTCPw2DeleteCmd = new DelegateCommand(() => ProStepPTCPw2DeleteCmdMethod());
|
||||
// }
|
||||
// return _ProStepPTCPw2DeleteCmd;
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 增加PTCPw2命令执行方法
|
||||
///// </summary>
|
||||
//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<MeterPTCPw2>(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);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 更新PTCPw2表信息
|
||||
///// </summary>
|
||||
//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<MeterPTCPw2>(ListSlopMeterPTCPw2!);
|
||||
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 获取PTCPw2当前的步骤的数据信息
|
||||
///// </summary>
|
||||
//private int AutoGetMeterPTCPw2StepNo()
|
||||
//{
|
||||
// var StepInfo = FreeSql.Select<MeterPTCPw2>().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;
|
||||
///// <summary>
|
||||
/////ConstantSaveCommand 常值保存命令
|
||||
///// </summary>
|
||||
//public DelegateCommand ProStepPTCPw2ConstantSaveCmd
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// _ProStepPTCPw2ConstantSaveCmd = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// if (_ProStepPTCPw2ConstantSaveCmd == null)
|
||||
// {
|
||||
// _ProStepPTCPw2ConstantSaveCmd = new DelegateCommand(() => ProStepPTCPw2ConstantSaveCmdMethod());
|
||||
// }
|
||||
// return _ProStepPTCPw2ConstantSaveCmd;
|
||||
// }
|
||||
//}
|
||||
///// <summary>
|
||||
///// ConstantSaveCommand 常值保存命令执行方法
|
||||
///// </summary>
|
||||
//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<MeterPTCPw2>();
|
||||
// //删除以前的斜率数据
|
||||
// foreach (var item in ListSlopMeterPTCPw2Items)
|
||||
// {
|
||||
// var DeleteData = FreeSql.Delete<MeterPTCPw2>(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<MeterPTCPw2>(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<MeterPTCPw2> { GetInsertData });
|
||||
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //常值数据不为0,那么说明之前是存在数据的,则需要更改操作
|
||||
// var ConstantData = ConstPTCPw2Data!.Where(a => a.ValueType == ConfigValueType.Constant).FirstOrDefault();
|
||||
// //更新常值信息
|
||||
// FreeSql.Update<MeterPTCPw2>()
|
||||
// .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<MeterPTCPw2>() { GetUpdateData });
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
//private bool _ProStepMeterPTCPw2SwitchConstSlopPar;
|
||||
///// <summary>
|
||||
///// Constant/Slop 切换命令的参数值
|
||||
///// </summary>
|
||||
//public bool ProStepMeterPTCPw2SwitchConstSlopPar
|
||||
//{
|
||||
// get { return _ProStepMeterPTCPw2SwitchConstSlopPar; }
|
||||
// set { _ProStepMeterPTCPw2SwitchConstSlopPar = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
//private int _ProStepPTCPw2SwitchConstSlopIndex;
|
||||
///// <summary>
|
||||
///// Constant/Slop 切换命令的参数值 Index
|
||||
///// </summary>
|
||||
//public int ProStepPTCPw2SwitchConstSlopIndex
|
||||
//{
|
||||
// get { return _ProStepPTCPw2SwitchConstSlopIndex; }
|
||||
// set { _ProStepPTCPw2SwitchConstSlopIndex = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
//private DelegateCommand<object> _MeterPTCPw2SwitchConstSlopCmd;
|
||||
///// <summary>
|
||||
///// PTCPw2 常值和斜率切换 命令
|
||||
///// </summary>
|
||||
//public DelegateCommand<object> MeterPTCPw2SwitchConstSlopCmd
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// _MeterPTCPw2SwitchConstSlopCmd = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// if (_MeterPTCPw2SwitchConstSlopCmd == null)
|
||||
// {
|
||||
// _MeterPTCPw2SwitchConstSlopCmd = new DelegateCommand<object>((obj) => MeterPTCPw2SwitchConstSlopCmdMethod(obj));
|
||||
// }
|
||||
// return _MeterPTCPw2SwitchConstSlopCmd;
|
||||
// }
|
||||
//}
|
||||
//private void MeterPTCPw2SwitchConstSlopCmdMethod(object obj)
|
||||
//{
|
||||
// if ((int)obj == 0)
|
||||
// {
|
||||
// ProStepMeterPTCPw2SwitchConstSlopPar = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ProStepMeterPTCPw2SwitchConstSlopPar = true;
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
//private DelegateCommand<object> _MeterPTCPw2ParConfigCmd;
|
||||
///// <summary>
|
||||
///// PTCPw2 仪表参数的命令
|
||||
///// </summary>
|
||||
//public DelegateCommand<object> MeterPTCPw2ParConfigCmd
|
||||
//{
|
||||
// set
|
||||
// {
|
||||
// _MeterPTCPw2ParConfigCmd = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// if (_MeterPTCPw2ParConfigCmd == null)
|
||||
// {
|
||||
// _MeterPTCPw2ParConfigCmd = new DelegateCommand<object>((par) => MeterPTCPw2ParConfigCmdMethod(par));
|
||||
// }
|
||||
// return _MeterPTCPw2ParConfigCmd;
|
||||
// }
|
||||
//}
|
||||
///// <summary>
|
||||
///// PTCPw2参数设置的命令
|
||||
///// </summary>
|
||||
///// <param name="par"></param>
|
||||
///// <exception cref="NotImplementedException"></exception>
|
||||
//private void MeterPTCPw2ParConfigCmdMethod(object par)
|
||||
//{
|
||||
// if (par != null && par is string)
|
||||
// {
|
||||
// CallMeterParConfig("PTC功率", par! as string);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 步骤数据转字符串格式
|
||||
///// </summary>
|
||||
///// <param name="data"></param>
|
||||
///// <returns></returns>
|
||||
//private string MeterPTCPw2ToString(List<MeterPTCPw2> 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 ";
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 检查斜率配置时间集合是否满足要求
|
||||
///// </summary>
|
||||
//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,
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 根据ID获取MeterPTCPw2数据
|
||||
///// </summary>
|
||||
///// <param name="id"></param>
|
||||
//private MeterPTCPw2 RefreshPTCPw2ById(long id)
|
||||
//{
|
||||
// var Data = FreeSql.Select<MeterPTCPw2>()
|
||||
// .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表
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user