009_DI-Elec/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalManagementViewModel.cs

2011 lines
77 KiB
C#
Raw Normal View History

2025-09-04 18:28:02 +08:00
//using SWS.CAD.Models;
//using SWS.CAD.Services;
//using SWS.CAD.ViewModels.myViewModelBase;
//using SWS.CAD.Views;
//using System;
//using System.Collections.Generic;
//using System.Collections.ObjectModel;
//using System.Linq;
//using System.Threading.Tasks;
//using System.Windows.Input;
//using Telerik.Windows.Controls;
//using Unity;
//using System.Windows;
//using static SWS.CAD.Services.WireGroupService;
//using SWS.CAD.Views.SignalManagementViews;
//using Prism.Ioc;
//using Telerik.Windows.Data;
//using System.Data;
//using DryIoc;
//using Prism.Services.Dialogs;
//using SWS.Commons;
//namespace SWS.CAD.ViewModels
//{
// public class DialogSignalManagementViewModel : DialogBase, IDialogAware
// {
// #region 属性
// private ObservableCollection<SignalManagementInfo> _smInfos = new ObservableCollection<SignalManagementInfo>();
// /// <summary>
// /// 表格数据源
// /// </summary>
// public ObservableCollection<SignalManagementInfo> smInfos
// {
// get { return _smInfos; }
// set
// {
// _smInfos = value;
// RaisePropertyChanged(nameof(smInfos));
// }
// }
// private QueryableCollectionView _smInfosView;
// /// <summary>
// /// 可筛选的的集合视图
// /// </summary>
// public QueryableCollectionView smInfosView
// {
// get { return _smInfosView; }
// set { _smInfosView = value; RaisePropertyChanged(nameof(smInfosView)); }
// }
// private SignalManagementInfo _SelectedSmInfo;
// /// <summary>
// /// 选中行
// /// </summary>
// public SignalManagementInfo SelectedSmInfo
// {
// get { return _SelectedSmInfo; }
// set { _SelectedSmInfo = value; RaisePropertyChanged(nameof(SelectedSmInfo)); }
// }
// /// <summary>
// /// 信号接口服务
// /// </summary>
// WireGroupService _wireGroupService;
// private string _count;
// /// <summary>
// /// 表格数据数量
// /// </summary>
// public string count
// {
// get { return _count; }
// set { _count = value; RaisePropertyChanged(nameof(count)); }
// }
// private string _pojectName;
// /// <summary>
// /// 表格名
// /// </summary>
// public string pojectName
// {
// get { return _pojectName; }
// set { _pojectName = value; RaisePropertyChanged(nameof(pojectName)); }
// }
// public DialogSignalNotice SignalNoticeView { get; set; }
// private string _ButtonContent = "回收站";
// /// <summary>
// /// 回收站按钮文本
// /// </summary>
// public string ButtonContent
// {
// get { return _ButtonContent; }
// set { _ButtonContent = value; RaisePropertyChanged(nameof(ButtonContent)); }
// }
// private string _SearchText;
// /// <summary>
// /// 搜索框文本
// /// </summary>
// public string SearchText
// {
// get { return _SearchText; }
// set { _SearchText = value; RaisePropertyChanged(nameof(SearchText)); }
// }
// private System.Windows.Visibility _IsButtonVisibility = Visibility.Hidden;
// /// <summary>
// /// 控制关联母线按钮显示隐藏
// /// </summary>
// public System.Windows.Visibility IsButtonVisibility
// {
// get { return _IsButtonVisibility; }
// set
// {
// _IsButtonVisibility = value;
// RaisePropertyChanged(nameof(IsButtonVisibility));
// }
// }
// private Visibility _IsChannelButtonVisibility = Visibility.Hidden;
// /// <summary>
// /// 控制关联通道按钮显示隐藏
// /// </summary>
// public Visibility IsChannelButtonVisibility
// {
// get { return _IsChannelButtonVisibility; }
// set
// {
// _IsChannelButtonVisibility = value;
// RaisePropertyChanged(nameof(IsChannelButtonVisibility));
// }
// }
// private ec_Wire_Group _IsAssociated;
// /// <summary>
// /// 通道是否关联信号
// /// </summary>
// public ec_Wire_Group IsAssociated
// {
// get { return _IsAssociated; }
// set
// {
// _IsAssociated = value;
// RaisePropertyChanged(nameof(IsAssociated));
// }
// }
// #region 下拉列表
// private List<ec_dataitemdetail> _GroupOthers;
// /// <summary>
// /// 绑定组别列表
// /// </summary>
// public List<ec_dataitemdetail> GroupOthers
// {
// get { return _GroupOthers; }
// set { _GroupOthers = value; RaisePropertyChanged(nameof(GroupOthers)); }
// }
// private List<string> _BelongingMajors = new List<string> { "E", "M" };
// /// <summary>
// /// 绑定归属专业
// /// </summary>
// public List<string> BelongingMajors
// {
// get { return _BelongingMajors; }
// set { _BelongingMajors = value; RaisePropertyChanged(nameof(BelongingMajors)); }
// }
// private List<string> _InOrOuts = new List<string> { "input", "output" };
// /// <summary>
// /// 绑定IO类型
// /// </summary>
// public List<string> InOrOuts
// {
// get { return _InOrOuts; }
// set { _InOrOuts = value; RaisePropertyChanged(nameof(InOrOuts)); }
// }
// private List<string> _IO_Types = new List<string> { "ON/OFF", "NO", "NC", "4-20mA", "PT100", "Pulse", "N/A" };
// /// <summary>
// /// 绑定信号类型
// /// </summary>
// public List<string> IO_Types
// {
// get { return _IO_Types; }
// set { _IO_Types = value; RaisePropertyChanged(nameof(IO_Types)); }
// }
// private List<string> _AL_GRPs;
// /// <summary>
// /// 绑定AL_GRP
// /// </summary>
// public List<string> AL_GRPs
// {
// get { return _AL_GRPs; }
// set { _AL_GRPs = value; RaisePropertyChanged(nameof(AL_GRPs)); }
// }
// private List<string> _BL_GRPs;
// /// <summary>
// /// 绑定BL_GRP
// /// </summary>
// public List<string> BL_GRPs
// {
// get { return _BL_GRPs; }
// set { _BL_GRPs = value; RaisePropertyChanged(nameof(BL_GRPs)); }
// }
// private List<ec_dataitemdetail> _Suppliers;
// /// <summary>
// /// 绑定供应商
// /// </summary>
// public List<ec_dataitemdetail> Suppliers
// {
// get { return _Suppliers; }
// set { _Suppliers = value; RaisePropertyChanged(nameof(Suppliers)); }
// }
// private List<ec_dataitemdetail> _WHCPUs;
// /// <summary>
// /// 绑定WHCPU
// /// </summary>
// public List<ec_dataitemdetail> WHCPUs
// {
// get { return _WHCPUs; }
// set
// {
// _WHCPUs = value;
// ECRCPUs = value;
// ShipOfficeCPUs = value;
// RaisePropertyChanged(nameof(WHCPUs));
// }
// }
// private List<ec_dataitemdetail> _ECRCPUs;
// /// <summary>
// /// 绑定ECRCPU
// /// </summary>
// public List<ec_dataitemdetail> ECRCPUs
// {
// get { return _ECRCPUs; }
// set { _ECRCPUs = value; RaisePropertyChanged(nameof(ECRCPUs)); }
// }
// private List<ec_dataitemdetail> _ShipOfficeCPUs;
// /// <summary>
// /// 绑定ShipOfficeCPU
// /// </summary>
// public List<ec_dataitemdetail> ShipOfficeCPUs
// {
// get { return _ShipOfficeCPUs; }
// set { _ShipOfficeCPUs = value; RaisePropertyChanged(nameof(ShipOfficeCPUs)); }
// }
// private WireGroups _Ent;
// /// <summary>
// /// 新增或修改的列表
// /// </summary>
// public WireGroups Ent
// {
// get { return _Ent; }
// set { _Ent = value; }
// }
// #endregion
// #endregion
// public DialogSignalManagementViewModel()
// {
// title = "信号管理";
// _wireGroupService = GlobalObject.container.Resolve<WireGroupService>();
// var serv = GlobalObject.container.Resolve<DataItemService>();
// GroupOthers = Task.Run(() => serv.GetDetails("be_Signal_Group")).Result;
// Suppliers = Task.Run(() => serv.GetDetails("Maker")).Result;
// WHCPUs = Task.Run(() => serv.GetDetails("Alarm")).Result;
// Ent = new WireGroups();
// Ent.Signals = new List<SWS.Model.ec_Wire_Group>();
// }
// public string Title => "";
// public event Action<IDialogResult> RequestClose;
// public bool CanCloseDialog()
// {
// return true;
// }
// public void OnDialogClosed()
// {
// }
// private List<SWS.Model.ec_Wire_Group> signals;
// public async void OnDialogOpened(IDialogParameters parameters)
// {
// try
// {
// IsBusy = true; BusyContent = "加载中...";
// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false);
// IsBusy = false;
// count = signals.Count.ToString();
// signals = signals.Where(s => s.Status != SWS.Model.WireGroupStatusEnum.deleted).ToList();
// SetBaseData(signals);
// count = smInfos.Count.ToString() + "/" + count;
// pojectName = GlobalObject.curProject.ProjectName + " | " + GlobalObject.curProject.ShipNameCN;
// //关联母线按钮是否显示
// string FromWhichPage = parameters.GetValue<string>(GlobalObject.dialogPar.para1.ToString());
// if (FromWhichPage!=null)
// {
// if (FromWhichPage.Equals("关联母线"))
// {
// IsButtonVisibility = Visibility.Visible;
// }
// if (FromWhichPage.Equals("关联通道"))
// {
// IsChannelButtonVisibility = Visibility.Visible;
// }
// }
2025-08-15 16:34:31 +08:00
2025-09-04 18:28:02 +08:00
// IsAssociated = parameters.GetValue<ec_Wire_Group>(GlobalObject.dialogPar.info.ToString());
// }
// catch (Exception)
// {
// }
// }
// public override void ExecuteOKCommandAsync(object para)
// {
// IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
// //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}");
// RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
// }
// public override void ExecuteCloseCommand(object parameter)
// {
// if (smInfos.Any(s => s.IsModified == true))
// {
// MessageBoxResult resultMessage = MessageBox.Show("修改未保存,是否取消修改", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
// if (resultMessage != MessageBoxResult.OK)
// {
// return;
// }
// }
// if (parameter as string == "ClickNo")
// {
// DialogResult res = new DialogResult(ButtonResult.No);
// RequestClose.Invoke(res);
// }
// else
// {
// RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
// }
// this.Dispose();
// }
// #region 页面按钮事件
// public ICommand StatusButtonCmd => new DelegateCommand(StatusButton_Click);
// /// <summary>
// /// 显示状态按钮
// /// </summary>
// /// <param name="parameter"></param>
// public virtual async void StatusButton_Click(object parameter)
// {
// smInfos = new ObservableCollection<SignalManagementInfo>();
// IsBusy = true; BusyContent = "查询中...";
// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false);
// IsBusy = false;
// count = signals.Count.ToString();
// signals = signals.Where(s => s.Status != SWS.Model.WireGroupStatusEnum.deleted).ToList();
// if (!parameter.Equals("All"))
// {
// signals = signals.Where(s => s.Status.ToString().Equals(parameter)).ToList();
// SetBaseData(signals, 1);
// }
// else
// {
// SetBaseData(signals);
// }
// count = smInfos.Count.ToString() + "/" + count;
// }
// public ICommand ButtonCmd => new DelegateCommand(Button_Click);
// /// <summary>
// /// 页面右侧按钮
// /// </summary>
// /// <param name="parameter"></param>
// public virtual async void Button_Click(object parameter)
// {
// if (!_smInfos.Any())
// {
// return;
// }
// int index = _smInfos.IndexOf(_SelectedSmInfo);//当前选中项在源数据集合中的索引
// #region 新增信号按钮
// if (parameter.Equals("新增信号"))
// {
// if (index != -1 || SelectedSmInfo.type != "虚拟点")
// {
// var newEntity = new SignalManagementInfo();
// newEntity.BelongingMajor = "M";
// newEntity.type = "信号";
// newEntity.Status = "New";
// newEntity.GroupOthers = GroupOthers;
// newEntity.Suppliers = Suppliers;
// newEntity.IsModified = true;
// //订阅事件以更新数据。
// newEntity.GroupOtherChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender);
// // 添加新行到选中行下方
// _smInfos.Insert(index == -1 ? 0 : index + 1, newEntity);
// //重新排序
// int i = 0;
// foreach (var item in _smInfos)
// {
// i++;
// item.serialNumber = i.ToString();
// foreach (var item2 in item.ChildSignals)
// {
// i++;
// item2.serialNumber = i.ToString();
// }
// }
// SelectedSmInfo = newEntity;
// }
// else
// {
// // 显示消息框
// MessageBox.Show("请选择信号节点!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// }
// #endregion
// #region 新增虚拟点
// if (parameter.Equals("新增虚拟点"))
// {
// if (index == -1 || SelectedSmInfo.type.Equals("虚拟点"))
// {
// MessageBox.Show("请选择信号节点!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// else
// {
// var newEntity = new SignalManagementInfo();
// newEntity.BelongingMajor = SelectedSmInfo.BelongingMajor;
// newEntity.type = "虚拟点";
// newEntity.Status = "New";
// newEntity.ParentID = SelectedSmInfo.Wire_Group_ID;
// newEntity.GroupOthers = GroupOthers;
// newEntity.GroupOther = SelectedSmInfo.GroupOther;
// newEntity.Suppliers = Suppliers;
// newEntity.IsModified = true;
// //订阅事件以更新数据。
// newEntity.ParametersChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender);
// // 添加新行到选中行下方
// //smInfos.Insert(index + 1, newEntity);
// SelectedSmInfo.ChildSignals.Add(newEntity);
// //重新排序
// int i = 0;
// foreach (var item in smInfos)
// {
// i++;
// item.serialNumber = i.ToString();
// foreach (var item2 in item.ChildSignals)
// {
// i++;
// item2.serialNumber = i.ToString();
// }
// }
// SelectedSmInfo = newEntity;
// }
// }
// #endregion
// #region 信号转虚拟点
// if (parameter.Equals("信号转虚拟点"))
// {
// if (SelectedSmInfo != null)
// {
// if (SelectedSmInfo.type.Equals("信号"))
// {
// IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
// para.Add(GlobalObject.dialogPar.para1.ToString(), smInfos);
// var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
// _dialogService.ShowDialog(nameof(DialogSignalSelect), para, (RES) =>
// {
// if (RES.Result == ButtonResult.Yes)
// {
// var signal = RES.Parameters.GetValue<Signal>(GlobalObject.dialogPar.para1.ToString());
// SelectedSmInfo.ParentID = signal.SignalId;
// SelectedSmInfo.type = "虚拟点";
// SelectedSmInfo.Group_Name = SelectedSmInfo.Group_Name + (string.IsNullOrEmpty(SelectedSmInfo.Code) ? "" : "_" + SelectedSmInfo.Code);
// SelectedSmInfo.IsModified = true;
// var tempSmInfo = SelectedSmInfo;
// smInfos.Remove(SelectedSmInfo);
// //var signalindex = smInfos.IndexOf(smInfos.FirstOrDefault(s => s.Wire_Group_ID == signal.SignalId)) + 1;
// //smInfos.Insert(signalindex, tempSmInfo);
// smInfos.FirstOrDefault(s => s.Wire_Group_ID == signal.SignalId).ChildSignals.Add(tempSmInfo);
// var i = 0;
// foreach (var item in smInfos)
// {
// i++;
// item.serialNumber = i.ToString();
// foreach (var item2 in item.ChildSignals)
// {
// i++;
// item2.serialNumber = i.ToString();
// }
// }
// SelectedSmInfo = tempSmInfo;
// }
// else if (RES.Result == ButtonResult.No)
// { }
// });
// }
// else if (SelectedSmInfo.type.Equals("虚拟点"))
// {
// var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID);
// SelectedSmInfo.type = "信号";
// SelectedSmInfo.ParentID = "";
// //SelectedSmInfo.Code = "";
// SelectedSmInfo.Group_Name = SelectedSmInfo.Group_Name.Split('_')[0];
// SelectedSmInfo.IsModified = true;
// var tempSmInfo = SelectedSmInfo;
// parentSmif.ChildSignals.Remove(SelectedSmInfo);
// var signalindex = smInfos.IndexOf(parentSmif);
// //signalindex = smInfos.IndexOf(smInfos.Skip(signalindex).Where(s => s.type.Equals("信号")).First());
// smInfos.Insert(signalindex + 1, tempSmInfo);
// var i = 0;
// foreach (var item in smInfos)
// {
// i++;
// item.serialNumber = i.ToString();
// foreach (var item2 in item.ChildSignals)
// {
// i++;
// item2.serialNumber = i.ToString();
// }
// }
// SelectedSmInfo = tempSmInfo;
// }
// }
// }
// #endregion
// #region 删除
// if (parameter.Equals("删除"))
// {
// if (SelectedSmInfo != null)
// {
// //RadWindow.Alert("Start time: " + this.StartTime + "\nEnd time: " + this.EndTime);
// // 显示消息框
// MessageBoxResult result = MessageBox.Show("确定准备删除选择的一行数据", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
// if (result == MessageBoxResult.OK)
// {
// //id为空表示新增的未保存所以直接删除不为空表示数据库已存在只修改状态
// if (string.IsNullOrEmpty(SelectedSmInfo.Wire_Group_ID))
// {
// smInfos.Remove(SelectedSmInfo);
// }
// else
// {
// IDialogParameters x = new Prism.Services.Dialogs.DialogParameters();
// x.Add(GlobalObject.dialogPar.title.ToString(), "提示");
// x.Add(GlobalObject.dialogPar.info.ToString(), "请输入删除的原因:");
// var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
// _dialogService.ShowDialog(nameof(DialogInput), x, (RES) =>
// {
// if (RES.Result == ButtonResult.Yes)
// {
// var Reason = RES.Parameters.GetValue<string>(GlobalObject.dialogPar.info.ToString());
// if (string.IsNullOrEmpty(Reason))
// {
// MessageBox.Show("您输入的信息为空!");
// }
// else
// {
// List<ActionHistory> histories = new List<ActionHistory>()
// {
// new ActionHistory()
// {
// ActionTime= DateTime.Now,
// ActionType = Models.Action.准备删除,
// reason = Reason
// }
// };
// SelectedSmInfo.ActionHistorys = histories;
// SelectedSmInfo.Status = "ToDelete";
// SelectedSmInfo.IsModified = true;
// if (SelectedSmInfo.type.Equals("虚拟点"))
// {
// SelectedSmInfo.GroupOther = "";
// }
// }
// }
// else if (RES.Result == ButtonResult.No)
// { }
// });
// }
// }
// }
// else
// {
// // 显示消息框
// MessageBox.Show("请选择要准备删除的信号!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// }
// }
// #endregion
// #region 撤销删除
// if (parameter.Equals("撤销删除"))
// {
// if (SelectedSmInfo != null && SelectedSmInfo.Status == "ToDelete")
// {
// List<ActionHistory> histories = new List<ActionHistory>()
// {
// new ActionHistory()
// {
// ActionTime= DateTime.Now,
// ActionType = Models.Action.撤销删除,
// }
// };
// SelectedSmInfo.ActionHistorys = histories;
// SelectedSmInfo.Status = "New";
// SelectedSmInfo.IsModified = true;
// }
// else
// {
// MessageBox.Show("只有待删除的信号才能撤销删除");
// }
// }
// #endregion
// #region 彻底删除
// if (parameter.Equals("彻底删除"))
// {
// if (SelectedSmInfo != null)
// {
// List<ec_Wire_Group> Signals = new List<ec_Wire_Group>()
// {
// new ec_Wire_Group()
// {
// Group_Name = SelectedSmInfo.Group_Name,
// Wire_Group_ID = SelectedSmInfo.Wire_Group_ID
// }
// };
// WireGroups ent = new WireGroups();
// ent.Signals = Signals;
// string message = await _wireGroupService.CanSaveSignals(ent, Models.Action.删除);
// if (message != "OK")
// {
// // 显示消息框
// MessageBox.Show(message, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// else
// {
// List<ActionHistory> histories = new List<ActionHistory>()
// {
// new ActionHistory()
// {
// ActionTime= DateTime.Now,
// ActionType = Models.Action.删除,
// reason = ""
// }
// };
// SelectedSmInfo.ActionHistorys = histories;
// SelectedSmInfo.Status = "deleted";
// SelectedSmInfo.DeleteFlg = true;
// SelectedSmInfo.IsModified = true;
// SignalManagementInfo tempsmif = new SignalManagementInfo();
// tempsmif = SelectedSmInfo;
// if (SelectedSmInfo.type.Equals("信号"))
// {
// smInfos.Remove(SelectedSmInfo);
// smInfos.Add(tempsmif);
// }
// else
// {
// var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID);
// parentSmif.ChildSignals.Remove(SelectedSmInfo);
// smInfos.Add(tempsmif);
// }
// }
// }
// }
// #endregion
// #region 还原信号
// if (parameter.Equals("还原信号"))
// {
// if (SelectedSmInfo != null)
// {
// IDialogParameters x = new Prism.Services.Dialogs.DialogParameters();
// x.Add(GlobalObject.dialogPar.title.ToString(), "提示");
// x.Add(GlobalObject.dialogPar.info.ToString(), "请输入还原信号的原因:");
// var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
// _dialogService.ShowDialog(nameof(DialogInput), x, (RES) =>
// {
// if (RES.Result == ButtonResult.Yes)
// {
// var Reason = RES.Parameters.GetValue<string>(GlobalObject.dialogPar.info.ToString());
// if (string.IsNullOrEmpty(Reason))
// {
// MessageBox.Show("您输入的信息为空!");
// }
// else
// {
// List<ActionHistory> histories = new List<ActionHistory>()
// {
// new ActionHistory()
// {
// ActionTime= DateTime.Now,
// ActionType = Models.Action.回收站恢复,
// reason = Reason
// }
// };
// SelectedSmInfo.ActionHistorys = histories;
// SelectedSmInfo.Status = "New";
// SelectedSmInfo.DeleteFlg = false;
// SelectedSmInfo.IsModified = true;
// SignalManagementInfo tempsmif = new SignalManagementInfo();
// tempsmif = SelectedSmInfo;
// if (SelectedSmInfo.Equals("信号"))
// {
// smInfos.Remove(SelectedSmInfo);
// smInfos.Add(tempsmif);
// }
// else
// {
// var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID);
// parentSmif.ChildSignals.Remove(SelectedSmInfo);
// smInfos.Add(tempsmif);
// }
// }
// }
// else if (RES.Result == ButtonResult.No)
// { }
// });
// }
// }
// #endregion
// #region 审核
// if (parameter.Equals("审核"))
// {
// if (SelectedSmInfo != null)
// {
// List<ec_Wire_Group> Signals = new List<ec_Wire_Group>()
// {
// new ec_Wire_Group()
// {
// Group_Name = SelectedSmInfo.Group_Name,
// Wire_Group_ID = SelectedSmInfo.Wire_Group_ID
// }
// };
// WireGroups ent = new WireGroups();
// ent.Signals = Signals;
// string message = await _wireGroupService.CanSaveSignals(ent, Models.Action.审核);
// if (message != "OK")
// {
// // 显示消息框
// MessageBox.Show(message, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// else
// {
// List<ActionHistory> histories = new List<ActionHistory>()
// {
// new ActionHistory()
// {
// ActionTime= DateTime.Now,
// ActionType = Models.Action.审核,
// reason = ""
// }
// };
// SelectedSmInfo.ActionHistorys = histories;
// SelectedSmInfo.Status = "Confirmed";
// SelectedSmInfo.IsModified = true;
// }
// }
// }
// #endregion
// #region 重新打开
// if (parameter.Equals("重新打开"))
// {
// if (SelectedSmInfo != null)
// {
// var messageBoxResult = MessageBox.Show("确定重新打开选中的一行数据?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
// if (messageBoxResult == MessageBoxResult.OK)
// {
// if (SelectedSmInfo.Status == "Confirmed")
// {
// IDialogParameters x = new Prism.Services.Dialogs.DialogParameters();
// x.Add(GlobalObject.dialogPar.title.ToString(), "提示");
// x.Add(GlobalObject.dialogPar.info.ToString(), "请输入重新打开改信号的原因:");
// var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
// _dialogService.ShowDialog(nameof(DialogInput), x, (RES) =>
// {
// if (RES.Result == ButtonResult.Yes)
// {
// var Reason = RES.Parameters.GetValue<string>(GlobalObject.dialogPar.info.ToString());
// if (string.IsNullOrEmpty(Reason))
// {
// MessageBox.Show("输入的信息不能为空!");
// }
// else
// {
// List<ActionHistory> histories = new List<ActionHistory>()
// {
// new ActionHistory()
// {
// ActionTime= DateTime.Now,
// ActionType = Models.Action.重新打开,
// reason = Reason
// }
// };
// SelectedSmInfo.ActionHistorys = histories;
// SelectedSmInfo.Status = "Reopen";
// SelectedSmInfo.IsModified = true;
// }
// }
// else if (RES.Result == ButtonResult.No)
// { }
// });
// }
// else
// {
// // 显示消息框
// MessageBox.Show("只有已审核的信号才能重新打开", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// }
// else
// {
// return;
// }
// }
// }
// #endregion
// #region 关联通道
// if (parameter.Equals("关联通道"))
// {
// if (SelectedSmInfo == null)
// {
// System.Windows.MessageBox.Show("您未选择关联信号", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
// }
// else
// {
// if (!SelectedSmInfo.Status.Equals("New") || SelectedSmInfo.Status.Equals("Reopen"))
// {
// System.Windows.MessageBox.Show("只有新增或重新打开的信号才能关联,请重新选择!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
// }
// else
// {
// if (IsAssociated != null)
// {
// MessageBoxResult result = System.Windows.MessageBox.Show("已关联的信号:" + IsAssociated.Group_Name + "是否确认被覆盖?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
// if (result == MessageBoxResult.OK)
// {
// List<ec_Wire_Group> WireGroups = new List<ec_Wire_Group>();
// WireGroups.Add(SelectedSmInfo.to_ec_Wire_Group(signals));
// IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
// res.Add(GlobalObject.dialogPar.para1.ToString(), WireGroups);
// RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
// this.Dispose();
// }
// else
// {
// return;
// }
// }
2025-08-15 16:34:31 +08:00
2025-09-04 18:28:02 +08:00
// }
// }
// }
// #endregion
// #region 关联母线
// if (parameter.Equals("关联母线"))
// {
// if (SelectedSmInfo == null)
// {
// System.Windows.MessageBox.Show("您未选择关联信号", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
// }
// else
// {
// if (!SelectedSmInfo.CommunicationPoint)
// {
// System.Windows.MessageBox.Show("只有通讯信号才能关联,请重新选择!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
// }
// else
// {
// List<SignalManagementInfo> WireGroupIds = new List<SignalManagementInfo>();
// WireGroupIds.Add(SelectedSmInfo);
// IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
// res.Add(GlobalObject.dialogPar.para1.ToString(), WireGroupIds);
// RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
// this.Dispose();
// }
// }
// }
// #endregion
// }
// public ICommand HeadButtonCmd => new DelegateCommand(HeadButton_Click);
// /// <summary>
// /// 页面右侧按钮
// /// </summary>
// /// <param name="parameter"></param>
// public virtual async void HeadButton_Click(object parameter)
// {
// #region 保存按钮
// if (parameter.Equals("保存"))
// {
// //新增或者修改的集合
// List<SignalManagementInfo> updatals = new List<SignalManagementInfo>();
// foreach (var item in smInfos)
// {
// if (item.IsModified)
// {
// updatals.Add(item);
// }
// foreach (var item2 in item.ChildSignals)
// {
// if (item2.IsModified)
// {
// updatals.Add(item2);
// }
// }
// }
// //updatals = smInfos.Where(s => s.IsModified == true).ToList();
// foreach (var item in updatals)
// {
// //保存的为信号时才判断组别
// if (item.type == "信号")
// {
// if (string.IsNullOrEmpty(item.GroupOther))
// {
// // 显示消息框
// MessageBox.Show("组别不能为空", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// }
// else if (item.type == "虚拟点")
// {
// if (string.IsNullOrEmpty(item.Code))
// {
// MessageBox.Show("Code列不能为空", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// }
// Ent.Signals.Add(item.to_ec_Wire_Group(signals));
// }
// //保存
// var data = await _wireGroupService.SaveSignals(Ent);
// if (data != null && data.Count != 0)
// {
// //foreach (var item in data)
// //{
// //}
// smInfos = new ObservableCollection<SignalManagementInfo>();
// IsBusy = true; BusyContent = "保存中...";
// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false);
// IsBusy = false;
// count = signals.Count.ToString();
// if (ButtonContent.Equals("回收站"))
// {
// signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList();
// }
// else
// {
// signals = signals.Where(s => s.Status == WireGroupStatusEnum.deleted).ToList();
// }
// SetBaseData(signals);
// count = smInfos.Count.ToString() + "/" + count;
// Ent.Signals.Clear();
// // 显示消息框
// MessageBox.Show("保存成功", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Information);
// }
// else
// {
// }
// }
// #endregion
// #region 退出按钮
// if (parameter.Equals("退出"))
// {
// if (smInfos.Any(s => s.IsModified == true))
// {
// MessageBoxResult resultMessage = MessageBox.Show("修改未保存,是否取消修改", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
// if (resultMessage != MessageBoxResult.OK)
// {
// return;
// }
// }
// RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
// this.Dispose();
// }
// #endregion
// #region 通知消息
// if (parameter.Equals("通知信息"))
// {
// //RadWindow window = new RadWindow();
// //window.Content = new DialogSignalNotice();
// //window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
// //window.Header = "通知消息";
// ////window.CanClose = false;
// //window.Show();
// //打开窗体
// IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
// var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
// _dialogService.ShowDialog(nameof(DialogSignalNotice), para, (RES) =>
// {
// if (RES.Result == ButtonResult.Yes)
// {
// }
// else if (RES.Result == ButtonResult.No)
// { }
// });
// }
// #endregion
// #region 历史记录
// if (parameter.Equals("历史记录"))
// {
// if (SelectedSmInfo != null)
// {
// //打开窗体
// IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
// para.Add(GlobalObject.dialogPar.para1.ToString(), SelectedSmInfo);
// var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
// _dialogService.ShowDialog(nameof(DialogSignalPropertyhisAndLogs), para, (RES) =>
// {
// if (RES.Result == ButtonResult.Yes)
// {
// }
// else if (RES.Result == ButtonResult.No)
// { }
// });
// }
// }
// #endregion
// #region 回收站
// if (parameter.Equals("回收站"))
// {
// switch (ButtonContent)
// {
// case "回收站":
// ButtonContent = "显示全部";
// break;
// case "显示全部":
// ButtonContent = "回收站";
// break;
// }
// smInfos = new ObservableCollection<SignalManagementInfo>();
// IsBusy = true; BusyContent = "查询中...";
// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false);
// IsBusy = false;
// count = signals.Count.ToString();
// if (ButtonContent.Equals("回收站"))
// {
// signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList();
// }
// else
// {
// signals = signals.Where(s => s.Status == WireGroupStatusEnum.deleted).ToList();
// }
// SetBaseData(signals);
// count = smInfos.Count.ToString() + "/" + count;
// }
// #endregion
// #region 搜索
// if (parameter.Equals("搜索框"))
// {
// PerformSearch();
// }
// #endregion
// }
// public ICommand EditEndCmd => new DelegateCommand(EditEnd);
// /// <summary>
// /// 编辑结束事件
// /// </summary>
// /// <param name="parameter"></param>
// public virtual void EditEnd(object parameter)
// {
// //做个标记表示该项修改过
// SelectedSmInfo.IsModified = true;
// }
// #endregion
// #region 方法
// /// <summary>
// /// 设置数据
// /// 0是初始化数据1是查询数据
// /// </summary>
// public void SetBaseData(List<SWS.Model.ec_Wire_Group> signals, int model = 0)
// {
// int index = 0;
// foreach (var signal in signals)
// {
// if (model == 0)
// {
// if (string.IsNullOrEmpty(signal.ParentID))
// {
// index++;
// SignalManagementInfo info = new SignalManagementInfo();
// info.serialNumber = index.ToString();
// SetEntData(info, signal);
// smInfos.Add(info);
// foreach (var signal2 in signals)
// {
// if (signal.Wire_Group_ID.Equals(signal2.ParentID))
// {
// index++;
// SignalManagementInfo info2 = new SignalManagementInfo();
// info2.serialNumber = index.ToString();
// SetEntData(info2, signal2);
// info.ChildSignals.Add(info2);
// info.ChildSignalsView = new QueryableCollectionView(info.ChildSignals);
// info.IsExpandable = true;
// }
// }
// }
// }
// else
// {
// index++;
// SignalManagementInfo info = new SignalManagementInfo();
// info.serialNumber = index.ToString();
// SetEntData(info, signal);
// smInfos.Add(info);
// }
// }
// smInfosView = new QueryableCollectionView(smInfos);
// }
// public void SetEntData(SignalManagementInfo info, ec_Wire_Group signal)
// {
// info.Wire_Group_ID = signal.Wire_Group_ID;
// info.ParentID = signal.ParentID;
// info.Status = signal.Status.ToString();
// info.type = string.IsNullOrEmpty(signal.ParentID) ? "信号" : "虚拟点";
// info.Group_Name = signal.Group_Name;
// info.Group_Desc_EN = signal.Group_Desc_EN;
// info.Group_Desc = signal.Group_Desc;
// info.BelongingMajor = signal.ElecOnly ? "E" : "M";
// info.GroupOthers = GroupOthers;
// info.GroupOther = GroupOthers.Where(g => g.DataItemCode == signal.Signal_Group).Select(g => g.DataItemName).FirstOrDefault();
// info.Signal_SeqNo = signal.Signal_SeqNo;
// info.Code = signal.Code;
// info.InOrOut = signal.InOrOut;
// info.IO_Type = signal.IO_Type;
// info.Range_Min = signal.Range_Min;
// info.Range_Max = signal.Range_Max;
// info.Unit = signal.Unit;
// info.Alarm_LL = signal.Alarm_LL;
// info.Alarm_L = signal.Alarm_L;
// info.Alarm_H = signal.Alarm_H;
// info.Alarm_HH = signal.Alarm_HH;
// info.SENSOR_CODE = signal.SENSOR_CODE;
// info.CommunicationPoint = signal.CommunicationPoint;
// info.SeriousType = signal.SeriousType;
// info.AL_GRP = signal.AL_GRP;
// info.BL_GRP = signal.BL_GRP;
// info.Time_Delay = signal.Time_Delay;
// info.Suppliers = Suppliers;
// info.Supplier = Suppliers.Where(g => g.DataItemCode == signal.Supplier).Select(g => g.DataItemName).FirstOrDefault();
// info.EquipName = signal.EquipName;
// info.VDR_Record = signal.VDR_Record;
// info.WHConsole = signal.WHConsole;
// //info.WHCPU = signal.WHCPU;
// foreach (var item in signal.WHCPU.Split('|'))
// {
// info.WHCPUs.Add(WHCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault());
// }
// info.ECRConsole = signal.ECRConsole;
// //info.ECRCPU = signal.ECRCPU;
// foreach (var item in signal.ECRCPU.Split('|'))
// {
// info.ECRCPUs.Add(ECRCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault());
// }
// info.ShipOfficeConsole = signal.ShipOfficeConsole;
// //info.ShipOfficeCPU = signal.ShipOfficeCPU;
// foreach (var item in signal.ShipOfficeCPU.Split('|'))
// {
// info.ShipOfficeCPUs.Add(ShipOfficeCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault());
// }
// info.SLD = signal.SLD;
// info.SHD = signal.SHD;
// info.SafetyDelay = signal.SafetyDelay;
// info.AutoCtrl = signal.AutoCtrl;
// info.AssociatedCableInfo = (signal.CableName == "" || signal.CableName == null ? "" : "电缆位号:" + signal.CableName) + (signal.CableSetName == null ? "" : " 电缆对:" + signal.CableSetName);
// info.AssociatedChannelInfo = (signal.PanelName == null ? "" : "采集箱:" + signal.PanelName) + (signal.StripName == null ? "" : "端子排:" + signal.StripName) + (signal.ChannelName == null ? "" : " 通道:" + signal.ChannelName);
// info.Remarks = signal.Remarks;
// info.DeleteFlg = signal.DeleteFlg;
// //订阅事件以更新数据。
// info.ParametersChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender);
// }
// /// <summary>
// /// 选择组别改变时修改Group_Name和Code()
// /// </summary>
// /// <param name="item"></param>
// private async void UpdateParametersValue(SignalManagementInfo item)
// {
// if (item.type == "信号")
// {
// //获取当前组别的可用编码
// string group = GroupOthers.Where(e => e.DataItemName.Equals(item.GroupOther)).Select(e => e.DataItemCode).FirstOrDefault();
// if (string.IsNullOrEmpty(item.Signal_SeqNo))//编码列为空时才通过接口获取可用编码
// {
// var seq = await _wireGroupService.GetNextAvailableSeq(group);
// int count = smInfos.Where(s => s.IsModified == true && string.IsNullOrEmpty(s.Wire_Group_ID)).ToList().Count;
// if (count > 1)
// {
// seq = (double.Parse(seq) + count - 1).ToString();
// }
// item.Signal_SeqNo = seq.ToString();
// }
// item.Group_Name = group + item.Signal_SeqNo;
// }
// else if (item.type == "虚拟点")
// {
// if (string.IsNullOrEmpty(item.Group_Name))
// {
// string Group_Name = smInfos.Where(e => e.Wire_Group_ID == item.ParentID).Select(e => e.Group_Name).FirstOrDefault();
// item.Group_Name = Group_Name + "_" + item.Code;
// }
// else
// {
// item.Group_Name = item.Group_Name.Split('_')[0] + "_" + item.Code;
// }
// }
// }
// /// <summary>
// /// 搜索方法
// /// </summary>
// private void PerformSearch()
// {
// smInfosView.FilterDescriptors.Clear();
// if (!string.IsNullOrEmpty(SearchText))
// {
// var compositeFilter = new CompositeFilterDescriptor
// {
// LogicalOperator = FilterCompositionLogicalOperator.Or
// };
// foreach (var prop in typeof(SignalManagementInfo).GetProperties())
// {
// if (prop.PropertyType == typeof(string))
// {
// compositeFilter.FilterDescriptors.Add(new FilterDescriptor
// {
// Member = prop.Name,
// Operator = FilterOperator.Contains,
// Value = SearchText.ToLower(),
// IsCaseSensitive = false
// });
// }
// }
// smInfosView.FilterDescriptors.Add(compositeFilter);
// }
// }
// #endregion
// }
// public class SignalManagementInfo : DialogBase
// {
// public event EventHandler GroupOtherChanged;
// public event EventHandler CodeChanged;
// public event EventHandler ParametersChanged;
// #region 表格字段
// private string _Wire_Group_ID;
// /// <summary>
// /// ID
// /// </summary>
// public string Wire_Group_ID
// {
// get { return _Wire_Group_ID; }
// set { _Wire_Group_ID = value; RaisePropertyChanged(nameof(Wire_Group_ID)); }
// }
// private string _ParentID;
// /// <summary>
// /// 如果有值表示其为虚拟点
// /// </summary>
// public string ParentID
// {
// get { return _ParentID; }
// set { _ParentID = value; }
// }
// private string _Status;
// /// <summary>
// /// 状态
// /// </summary>
// public string Status
// {
// get { return _Status; }
// set { _Status = value; RaisePropertyChanged(nameof(Status)); }
// }
// private string _serialNumber;
// /// <summary>
// /// 序号
// /// </summary>
// public string serialNumber
// {
// get { return _serialNumber; }
// set { _serialNumber = value; RaisePropertyChanged(nameof(serialNumber)); }
// }
// private string _type;
// /// <summary>
// /// 类型
// /// </summary>
// public string type
// {
// get { return _type; }
// set { _type = value; RaisePropertyChanged(nameof(type)); }
// }
// private string _Group_Name;
// /// <summary>
// /// CH.NO
// /// </summary>
// public string Group_Name
// {
// get { return _Group_Name; }
// set { _Group_Name = value; RaisePropertyChanged(nameof(Group_Name)); }
// }
// private string _Group_Desc_EN;
// /// <summary>
// /// 英文描述
// /// </summary>
// public string Group_Desc_EN
// {
// get { return _Group_Desc_EN; }
// set { _Group_Desc_EN = value; RaisePropertyChanged(nameof(Group_Desc_EN)); }
// }
// private string _Group_Desc;
// /// <summary>
// /// 中文描述
// /// </summary>
// public string Group_Desc
// {
// get { return _Group_Desc; }
// set { _Group_Desc = value; RaisePropertyChanged(nameof(Group_Desc)); }
// }
// private string _BelongingMajor;
// /// <summary>
// /// 归属专业
// /// </summary>
// public string BelongingMajor
// {
// get { return _BelongingMajor; }
// set { _BelongingMajor = value; RaisePropertyChanged(nameof(BelongingMajor)); }
// }
// private string _GroupOther;
// /// <summary>
// /// 组别
// /// </summary>
// public string GroupOther
// {
// get { return _GroupOther; }
// set
// {
// _GroupOther = value;
// RaisePropertyChanged(nameof(GroupOther));
// ParametersChanged?.Invoke(this, EventArgs.Empty);
// }
// }
// private List<ec_dataitemdetail> _GroupOthers;
// /// <summary>
// /// 组别列表
// /// </summary>
// public List<ec_dataitemdetail> GroupOthers
// {
// get { return _GroupOthers; }
// set { _GroupOthers = value; RaisePropertyChanged(nameof(GroupOthers)); }
// }
// private string _Signal_SeqNo;
// /// <summary>
// /// 编码
// /// </summary>
// public string Signal_SeqNo
// {
// get { return _Signal_SeqNo; }
// set { _Signal_SeqNo = value; RaisePropertyChanged(nameof(Signal_SeqNo)); }
// }
// private string _Code;
// /// <summary>
// /// Code
// /// </summary>
// public string Code
// {
// get { return _Code; }
// set
// {
// _Code = value;
// RaisePropertyChanged(nameof(Code));
// ParametersChanged?.Invoke(this, EventArgs.Empty);
// }
// }
// private string _InOrOut;
// /// <summary>
// /// IO类型
// /// </summary>
// public string InOrOut
// {
// get { return _InOrOut; }
// set { _InOrOut = value; RaisePropertyChanged(nameof(InOrOut)); }
// }
// private string _IO_Type;
// /// <summary>
// /// 信号类型
// /// </summary>
// public string IO_Type
// {
// get { return _IO_Type; }
// set { _IO_Type = value; RaisePropertyChanged(nameof(IO_Type)); }
// }
// private string _Range_Min;
// /// <summary>
// /// Range_Min
// /// </summary>
// public string Range_Min
// {
// get { return _Range_Min; }
// set { _Range_Min = value; RaisePropertyChanged(nameof(Range_Min)); }
// }
// private string _Range_Max;
// /// <summary>
// /// Range_Max
// /// </summary>
// public string Range_Max
// {
// get { return _Range_Max; }
// set { _Range_Max = value; RaisePropertyChanged(nameof(Range_Max)); }
// }
// private string _Unit;
// /// <summary>
// /// 单位
// /// </summary>
// public string Unit
// {
// get { return _Unit; }
// set { _Unit = value; RaisePropertyChanged(nameof(Unit)); }
// }
// private string _Alarm_LL;
// public string Alarm_LL
// {
// get { return _Alarm_LL; }
// set { _Alarm_LL = value; RaisePropertyChanged(nameof(Alarm_LL)); }
// }
// private string _Alarm_L;
// public string Alarm_L
// {
// get { return _Alarm_L; }
// set { _Alarm_L = value; RaisePropertyChanged(nameof(Alarm_L)); }
// }
// private string _Alarm_H;
// public string Alarm_H
// {
// get { return _Alarm_H; }
// set { _Alarm_H = value; RaisePropertyChanged(nameof(Alarm_H)); }
// }
// private string _Alarm_HH;
// public string Alarm_HH
// {
// get { return _Alarm_HH; }
// set { _Alarm_HH = value; RaisePropertyChanged(nameof(Alarm_HH)); }
// }
// private string _SENSOR_CODE;
// public string SENSOR_CODE
// {
// get { return _SENSOR_CODE; }
// set { _SENSOR_CODE = value; RaisePropertyChanged(nameof(SENSOR_CODE)); }
// }
// private bool _CommunicationPoint;
// /// <summary>
// /// 是否是通讯点
// /// </summary>
// public bool CommunicationPoint
// {
// get { return _CommunicationPoint; }
// set { _CommunicationPoint = value; RaisePropertyChanged(nameof(CommunicationPoint)); }
// }
// private string _SeriousType;
// public string SeriousType
// {
// get { return _SeriousType; }
// set { _SeriousType = value; RaisePropertyChanged(nameof(SeriousType)); }
// }
// private string _AL_GRP;
// public string AL_GRP
// {
// get { return _AL_GRP; }
// set { _AL_GRP = value; RaisePropertyChanged(nameof(AL_GRP)); }
// }
// private string _BL_GRP;
// public string BL_GRP
// {
// get { return _BL_GRP; }
// set { _BL_GRP = value; RaisePropertyChanged(nameof(BL_GRP)); }
// }
// private string _Time_Delay;
// public string Time_Delay
// {
// get { return _Time_Delay; }
// set { _Time_Delay = value; RaisePropertyChanged(nameof(Time_Delay)); }
// }
// private string _Supplier;
// /// <summary>
// /// 供应商
// /// </summary>
// public string Supplier
// {
// get { return _Supplier; }
// set { _Supplier = value; RaisePropertyChanged(nameof(Supplier)); }
// }
// private string _EquipName;
// /// <summary>
// /// 设备名
// /// </summary>
// public string EquipName
// {
// get { return _EquipName; }
// set { _EquipName = value; RaisePropertyChanged(nameof(EquipName)); }
// }
// private bool _VDR_Record;
// public bool VDR_Record
// {
// get { return _VDR_Record; }
// set { _VDR_Record = value; RaisePropertyChanged(nameof(VDR_Record)); }
// }
// private string _WHConsole;
// public string WHConsole
// {
// get { return _WHConsole; }
// set { _WHConsole = value; RaisePropertyChanged(nameof(WHConsole)); }
// }
// private ObservableCollection<ec_dataitemdetail> _WHCPU = new ObservableCollection<ec_dataitemdetail>();
// public ObservableCollection<ec_dataitemdetail> WHCPU
// {
// get { return _WHCPU; }
// set
// {
// _WHCPU = value;
// WHCPUs.AddRange(value);
// RaisePropertyChanged(nameof(WHCPU));
// }
// }
// private ObservableCollection<ec_dataitemdetail> _WHCPUs = new ObservableCollection<ec_dataitemdetail>();
// public ObservableCollection<ec_dataitemdetail> WHCPUs
// {
// get { return _WHCPUs; }
// set { _WHCPUs = value; OnPropertyChanged(nameof(WHCPUs)); }
// }
// private string _ECRConsole;
// public string ECRConsole
// {
// get { return _ECRConsole; }
// set { _ECRConsole = value; RaisePropertyChanged(nameof(ECRConsole)); }
// }
// private string _ECRCPU;
// public string ECRCPU
// {
// get { return _ECRCPU; }
// set { _ECRCPU = value; RaisePropertyChanged(nameof(ECRCPU)); }
// }
// private ObservableCollection<ec_dataitemdetail> _ECRCPUs = new ObservableCollection<ec_dataitemdetail>();
// public ObservableCollection<ec_dataitemdetail> ECRCPUs
// {
// get { return _ECRCPUs; }
// set { _ECRCPUs = value; RaisePropertyChanged(nameof(ECRCPUs)); }
// }
// private string _ShipOfficeConsole;
// public string ShipOfficeConsole
// {
// get { return _ShipOfficeConsole; }
// set { _ShipOfficeConsole = value; RaisePropertyChanged(nameof(ShipOfficeConsole)); }
// }
// private string _ShipOfficeCPU;
// public string ShipOfficeCPU
// {
// get { return _ShipOfficeCPU; }
// set { _ShipOfficeCPU = value; RaisePropertyChanged(nameof(ShipOfficeCPU)); }
// }
// private ObservableCollection<ec_dataitemdetail> _ShipOfficeCPUs = new ObservableCollection<ec_dataitemdetail>();
// public ObservableCollection<ec_dataitemdetail> ShipOfficeCPUs
// {
// get { return _ShipOfficeCPUs; }
// set { _ShipOfficeCPUs = value; RaisePropertyChanged(nameof(ShipOfficeCPUs)); }
// }
// private bool _SLD;
// public bool SLD
// {
// get { return _SLD; }
// set { _SLD = value; RaisePropertyChanged(nameof(SLD)); }
// }
// private bool _SHD;
// public bool SHD
// {
// get { return _SHD; }
// set { _SHD = value; RaisePropertyChanged(nameof(SHD)); }
// }
// private string _SafetyDelay;
// /// <summary>
// /// 安保延迟
// /// </summary>
// public string SafetyDelay
// {
// get { return _SafetyDelay; }
// set { _SafetyDelay = value; RaisePropertyChanged(nameof(SafetyDelay)); }
// }
// private string _AutoCtrl;
// /// <summary>
// /// 自动控制
// /// </summary>
// public string AutoCtrl
// {
// get { return _AutoCtrl; }
// set { _AutoCtrl = value; RaisePropertyChanged(nameof(AutoCtrl)); }
// }
// private string _AssociatedCableInfo;
// /// <summary>
// /// 关联电缆信息
// /// </summary>
// public string AssociatedCableInfo
// {
// get { return _AssociatedCableInfo; }
// set { _AssociatedCableInfo = value; RaisePropertyChanged(nameof(AssociatedCableInfo)); }
// }
// private string _AssociatedChannelInfo;
// /// <summary>
// /// 关联通道信息
// /// </summary>
// public string AssociatedChannelInfo
// {
// get { return _AssociatedChannelInfo; }
// set { _AssociatedChannelInfo = value; RaisePropertyChanged(nameof(AssociatedChannelInfo)); }
// }
// private string _Remarks;
// /// <summary>
// /// 备注
// /// </summary>
// public string Remarks
// {
// get { return _Remarks; }
// set { _Remarks = value; RaisePropertyChanged(nameof(Remarks)); }
// }
// private List<ec_dataitemdetail> _Suppliers;
// /// <summary>
// /// 绑定供应商
// /// </summary>
// public List<ec_dataitemdetail> Suppliers
// {
// get { return _Suppliers; }
// set { _Suppliers = value; RaisePropertyChanged(nameof(Suppliers)); }
// }
// #region 扩展字段
// private bool _IsModified;
// /// <summary>
// /// 是否修改
// /// </summary>
// public bool IsModified
// {
// get { return _IsModified; }
// set { _IsModified = value; RaisePropertyChanged(nameof(IsModified)); }
// }
// private bool _IsExpanded = false;
// /// <summary>
// /// 是否展开
// /// </summary>
// public bool IsExpanded
// {
// get { return _IsExpanded; }
// set { _IsExpanded = value; RaisePropertyChanged(nameof(IsExpanded)); }
// }
// private bool _IsExpandable;
// /// <summary>
// /// 是否可展开
// /// </summary>
// public bool IsExpandable
// {
// get { return _IsExpandable; }
// set { _IsExpandable = value; RaisePropertyChanged(nameof(IsExpandable)); }
// }
// private List<ActionHistory> _ActionHistorys;
// /// <summary>
// /// 操作历史
// /// </summary>
// public List<ActionHistory> ActionHistorys
// {
// get { return _ActionHistorys; }
// set { _ActionHistorys = value; }
// }
// private bool _DeleteFlg;
// /// <summary>
// /// 删除标记
// /// </summary>
// public bool DeleteFlg
// {
// get { return _DeleteFlg; }
// set { _DeleteFlg = value; }
// }
// private ObservableCollection<SignalManagementInfo> _ChildSignals = new ObservableCollection<SignalManagementInfo>();
// public ObservableCollection<SignalManagementInfo> ChildSignals
// {
// get { return _ChildSignals; }
// set { _ChildSignals = value; RaisePropertyChanged(nameof(ChildSignals)); }
// }
// private QueryableCollectionView _ChildSignalsView;
// /// <summary>
// /// 虚拟点集合视图
// /// </summary>
// public QueryableCollectionView ChildSignalsView
// {
// get { return _ChildSignalsView; }
// set { _ChildSignalsView = value; RaisePropertyChanged(nameof(ChildSignalsView)); }
// }
// #endregion
// #endregion
// #region 方法
// /// <summary>
// /// 将表格对象转换为数据模型类
// /// </summary>
// /// <returns></returns>
// public ec_Wire_Group to_ec_Wire_Group(List<ec_Wire_Group> sigals)
// {
// ec_Wire_Group ent;
// if (string.IsNullOrEmpty(Wire_Group_ID))
// {
// ent = new ec_Wire_Group();
// }
// else
// {
// ent = sigals.Where(e => e.Wire_Group_ID.Equals(Wire_Group_ID)).First();
// }
// switch (Status)
// {
// case "ToDelete":
// ent.Status = WireGroupStatusEnum.ToDelete;
// break;
// case "New":
// ent.Status = WireGroupStatusEnum.New;
// break;
// case "Used":
// ent.Status = WireGroupStatusEnum.Used;
// break;
// case "Confirmed":
// ent.Status = WireGroupStatusEnum.Confirmed;
// break;
// case "Reopen":
// ent.Status = WireGroupStatusEnum.Reopen;
// break;
// case "deleted":
// ent.Status = WireGroupStatusEnum.deleted;
// break;
// }
// ent.Wire_Group_ID = Wire_Group_ID;
// ent.ParentID = ParentID;
// ent.Group_Name = Group_Name;
// ent.Group_Desc_EN = Group_Desc_EN;
// ent.Group_Desc = Group_Desc;
// ent.ElecOnly = BelongingMajor.Equals("E") ? true : false;
// if (GroupOther == null)
// {
// ent.Signal_Group = "";
// }
// else
// {
// ent.Signal_Group = GroupOthers.Where(g => g.DataItemName == GroupOther).Select(g => g.DataItemCode).FirstOrDefault();
// }
// ent.Signal_SeqNo = Signal_SeqNo;
// ent.Code = Code;
// ent.InOrOut = InOrOut;
// ent.IO_Type = IO_Type;
// ent.Range_Min = Range_Min;
// ent.Range_Max = Range_Max;
// ent.Unit = Unit;
// ent.Alarm_LL = Alarm_LL;
// ent.Alarm_L = Alarm_L;
// ent.Alarm_H = Alarm_H;
// ent.Alarm_HH = Alarm_HH;
// ent.SENSOR_CODE = SENSOR_CODE;
// ent.CommunicationPoint = CommunicationPoint;
// ent.SeriousType = SeriousType;
// ent.AL_GRP = AL_GRP;
// ent.BL_GRP = BL_GRP;
// ent.Time_Delay = Time_Delay;
// ent.Supplier = Suppliers.Where(g => g.DataItemName == Supplier).Select(g => g.DataItemCode).FirstOrDefault();
// ent.EquipName = EquipName;
// ent.VDR_Record = VDR_Record;
// ent.WHConsole = WHConsole;
// ent.WHCPU = "";
// foreach (var item in WHCPUs)
// {
// if (item != null)
// {
// ent.WHCPU = ent.WHCPU + item.DataItemCode + "|";
// }
// }
// ent.ECRConsole = ECRConsole;
// ent.ECRCPU = "";
// foreach (var item in ECRCPUs)
// {
// if (item != null)
// {
// ent.ECRCPU = ent.ECRCPU + item.DataItemCode + "|";
// }
// }
// ent.ShipOfficeConsole = ShipOfficeConsole;
// ent.ShipOfficeCPU = "";
// foreach (var item in ShipOfficeCPUs)
// {
// if (item != null)
// {
// ent.ShipOfficeCPU = ent.ShipOfficeCPU + item.DataItemCode + "|";
// }
// }
// ent.SLD = SLD;
// ent.SHD = SHD;
// ent.SafetyDelay = SafetyDelay;
// ent.AutoCtrl = AutoCtrl;
// if (string.IsNullOrEmpty(AssociatedCableInfo))
// {
// //// 使用正则表达式匹配模式,并提取每组数据
// //var matches = Regex.Matches(AssociatedCableInfo, @"电缆位号:(.*?)\s电缆对:(.*)");
// // if (matches.Count > 0) // 确保至少有一个匹配项
// // {
// // string cableNumber = matches[0].Groups[1].Value; // 第一个冒号后的值
// // string cableSet = matches[0].Groups[2].Value; // 第二个冒号后的值
// // }
// ent.CableName = "";
// ent.CableSetName = "";
// }
// else
// {
// ent.CableName = AssociatedCableInfo.Split(' ')[0].Split(':')[1];
// ent.CableSetName = (AssociatedCableInfo.Split(' ').Count() > 1) ? AssociatedCableInfo.Split(' ')[1].Split(':')[1] : "";
// }
// if (string.IsNullOrEmpty(AssociatedChannelInfo))
// {
// ent.PanelName = "";
// ent.StripName = "";
// ent.ChannelName = "";
// }
// else
// {
// ent.PanelName = AssociatedChannelInfo.Split(' ')[0].Split(':')[1];
// ent.StripName = (AssociatedChannelInfo.Split(' ').Count() > 1) ? AssociatedChannelInfo.Split(' ')[1].Split(':')[1] : "";
// ent.ChannelName = (AssociatedChannelInfo.Split(' ').Count() > 2) ? AssociatedChannelInfo.Split(' ')[2].Split(':')[2] : "";
// }
// ent.Remarks = Remarks;
// ent.ActionHistorys = ActionHistorys;
// ent.DeleteFlg = DeleteFlg;
// return ent;
// }
// #endregion
// }
//}