using DevExpress.XtraEditors.Repository;
|
using DevExpress.XtraRichEdit.Design;
|
using DevExpress.XtraSpreadsheet;
|
using Yw.WinFrmUI.Hydro;
|
|
namespace Yw.WinFrmUI
|
{
|
public partial class SetHydroMarkPureCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public SetHydroMarkPureCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalEditView();
|
this.colName.OptionsColumn.AllowEdit = false;
|
this.gridView1.CustomRowCellEdit += GridView1_CustomRowCellEdit;
|
}
|
|
private Func<Yw.Model.HydroModelInfo> _hydroInfoFunc;
|
private BindingList<HydroMarkSetViewModel> _allBindingList = null;
|
|
/// <summary>
|
///
|
/// </summary>
|
public void SetBindingData(Func<Yw.Model.HydroModelInfo> hydroInfoFunc, List<HydroMarkSetViewModel> list)
|
{
|
_hydroInfoFunc = hydroInfoFunc;
|
_allBindingList = new BindingList<HydroMarkSetViewModel>();
|
list?.ForEach(x =>
|
{
|
_allBindingList.Add(x);
|
});
|
this.hydroMarkSetViewModelBindingSource.DataSource = _allBindingList;
|
this.hydroMarkSetViewModelBindingSource.ResetBindings(false);
|
}
|
|
/// <summary>
|
/// 获取结果列表
|
/// </summary>
|
/// <returns></returns>
|
public List<HydroMarkResultViewModel> GetResultList()
|
{
|
var hydroInfo = _hydroInfoFunc?.Invoke();
|
if (hydroInfo == null)
|
{
|
return default;
|
}
|
|
var resultList = new List<HydroMarkResultViewModel>();
|
_allBindingList?.ToList().ForEach(x =>
|
{
|
switch (x.Code)
|
{
|
case Yw.Hydro.ParterCatalog.Waterbox:
|
{
|
if (hydroInfo.Waterboxs != null && hydroInfo.Waterboxs.Count > 0)
|
{
|
switch ((eWaterboxMarkType)x.MarkType)
|
{
|
case eWaterboxMarkType.None:
|
{
|
|
}
|
break;
|
case eWaterboxMarkType.PoolElev:
|
{
|
hydroInfo.Waterboxs.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"池底标高:{t.PoolElev}m"
|
});
|
});
|
}
|
break;
|
case eWaterboxMarkType.InitLevel:
|
{
|
hydroInfo.Waterboxs.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"初始水位:{t.InitLevel}m"
|
});
|
});
|
}
|
break;
|
case eWaterboxMarkType.MinLevel:
|
{
|
hydroInfo.Waterboxs.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"最小水位:{t.MinLevel}m"
|
});
|
});
|
}
|
break;
|
case eWaterboxMarkType.MaxLevel:
|
{
|
hydroInfo.Waterboxs.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"最高水位:{t.MaxLevel}m"
|
});
|
});
|
}
|
break;
|
case eWaterboxMarkType.Diameter:
|
{
|
hydroInfo.Waterboxs.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"直径:{t.MaxLevel}m"
|
});
|
});
|
}
|
break;
|
case eWaterboxMarkType.MinVol:
|
{
|
hydroInfo.Waterboxs.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"最小容积:{t.MinVol}m"
|
});
|
});
|
}
|
break;
|
default: break;
|
}
|
}
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Pump:
|
{
|
if (hydroInfo.Pumps != null && hydroInfo.Pumps.Count > 0)
|
{
|
switch ((ePumpMarkType)x.MarkType)
|
{
|
case ePumpMarkType.None:
|
{
|
|
}
|
break;
|
case ePumpMarkType.PumpStatus:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"开机状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}"
|
});
|
});
|
}
|
break;
|
case ePumpMarkType.RatedP:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"额定功率:{t.RatedP}kW"
|
});
|
});
|
}
|
break;
|
case ePumpMarkType.RatedQ:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"额定流量:{t.RatedQ}m³/h"
|
});
|
});
|
}
|
break;
|
case ePumpMarkType.RatedH:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"额定扬程:{t.RatedH}m"
|
});
|
});
|
}
|
break;
|
case ePumpMarkType.RatedN:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"额定转速:{t.RatedN}r/min"
|
});
|
});
|
}
|
break;
|
case ePumpMarkType.RatedHz:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"额定频率:{t.RatedHz}"
|
});
|
});
|
}
|
break;
|
case ePumpMarkType.CurrentN:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"设定转速:{t.RatedN * t.SpeedRatio}r/min"
|
});
|
});
|
}
|
break;
|
case ePumpMarkType.CurrentHz:
|
{
|
hydroInfo.Pumps.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"设定频率:{t.RatedHz * t.SpeedRatio}"
|
});
|
});
|
}
|
break;
|
default: break;
|
}
|
}
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Valve:
|
{
|
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Pipe:
|
{
|
if (hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0)
|
{
|
switch ((ePipeMarkType)x.MarkType)
|
{
|
case ePipeMarkType.None:
|
{
|
|
}
|
break;
|
case ePipeMarkType.PipeStatus:
|
{
|
hydroInfo.Pipes.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}"
|
});
|
});
|
}
|
break;
|
case ePipeMarkType.Diameter:
|
{
|
hydroInfo.Pipes.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"直径:{t.Diameter}mm"
|
});
|
});
|
}
|
break;
|
case ePipeMarkType.Length:
|
{
|
hydroInfo.Pipes.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"长度:{t.Length}m"
|
});
|
});
|
}
|
break;
|
case ePipeMarkType.Roughness:
|
{
|
hydroInfo.Pipes.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"粗糙系数:{t.Roughness}"
|
});
|
});
|
}
|
break;
|
case ePipeMarkType.MinorLoss:
|
{
|
hydroInfo.Pipes.ForEach(t =>
|
{
|
resultList.Add(new HydroMarkResultViewModel()
|
{
|
Code = t.Code,
|
Text = $"局阻系数:{t.MinorLoss}"
|
});
|
});
|
}
|
break;
|
default: break;
|
}
|
}
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Nozzle:
|
{
|
|
}
|
break;
|
default: break;
|
}
|
});
|
|
return resultList;
|
}
|
|
//自定义
|
private void GridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
|
{
|
var row = this.gridView1.GetRow(e.RowHandle) as HydroMarkSetViewModel;
|
if (row == null)
|
{
|
return;
|
}
|
if (e.Column == this.colMarkType)
|
{
|
var repositoryItem = new RepositoryItemImageComboBox();
|
switch (row.Code)
|
{
|
case Yw.Hydro.ParterCatalog.Waterbox:
|
{
|
repositoryItem.AddEnum(typeof(eWaterboxMarkType), true);
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Pump:
|
{
|
repositoryItem.AddEnum(typeof(ePumpMarkType), true);
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Valve:
|
{
|
repositoryItem.AddEnum(typeof(eValveMarkType), true);
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Pipe:
|
{
|
repositoryItem.AddEnum(typeof(ePipeMarkType), true);
|
}
|
break;
|
case Yw.Hydro.ParterCatalog.Nozzle:
|
{
|
repositoryItem.AddEnum(typeof(eNozzleMarkType), true);
|
}
|
break;
|
default: break;
|
}
|
e.RepositoryItem = repositoryItem;
|
}
|
}
|
|
|
}
|
}
|