using DevExpress.XtraEditors;
|
using IStation.Test.Init;
|
|
namespace IStation.Win
|
{
|
public partial class CorrectionFactorView : DevExpress.XtraEditors.XtraUserControl
|
{
|
public CorrectionFactorView()
|
{
|
InitializeComponent();
|
this.layoutControl1.SetupLayoutControl();
|
this.bandedGridView1.SetNormalView();
|
this.bandedGridView1.OptionsView.ColumnAutoWidth = false;
|
this.bandedGridView2.SetNormalView();
|
this.bandedGridView2.OptionsView.ColumnAutoWidth = false;
|
|
this.dtDay.SetOnlyShowDate();
|
this.dtDay.DateTime = new DateTime(2024, 3, 2);
|
|
|
this.gbSum.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left;
|
this.gbSum1.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left;
|
|
ShowWL(false);
|
ShowFlow(false);
|
ShowPump(false);
|
ShowPressure(false);
|
|
ShowWL(false);
|
ShowFlow(false);
|
ShowPump(true);
|
ShowPressure(true);
|
ShowScada(false);
|
ShowModel(false);
|
|
this.cekStation1.Checked = true;
|
this.cekStation2.Checked = false;
|
|
}
|
|
#region Show
|
|
private void ShowScada(bool v)
|
{
|
this.gbScada.Visible = v;
|
this.gbScada1.Visible = v;
|
}
|
private void ShowModel(bool v)
|
{
|
this.gbModel.Visible = v;
|
this.gbModel1.Visible = v;
|
}
|
private void ShowWL(bool v)
|
{
|
this.colRPump21.Visible = v;
|
this.colRPump22.Visible = v;
|
this.colRPump23.Visible = v;
|
this.colRPump24.Visible = v;
|
this.colRPump25.Visible = v;
|
this.colRPump26.Visible = v;
|
this.colRPump27.Visible = v;
|
|
this.colR1.Visible = v;
|
this.colR2.Visible = v;
|
this.colR3.Visible = v;
|
}
|
|
private void ShowFlow(bool v)
|
{
|
this.colDN2400F.Visible = v;
|
this.colDN2700F.Visible = v;
|
this.colPump21F.Visible = v;
|
this.colPump22F.Visible = v;
|
this.colPump23F.Visible = v;
|
this.colPump24F.Visible = v;
|
this.colPump25F.Visible = v;
|
this.colPump26F.Visible = v;
|
this.colPump27F.Visible = v;
|
|
this.colDN2400FM.Visible = v;
|
this.colDN2700FM.Visible = v;
|
this.colPump21FM.Visible = v;
|
this.colPump22FM.Visible = v;
|
this.colPump23FM.Visible = v;
|
this.colPump24FM.Visible = v;
|
this.colPump25FM.Visible = v;
|
this.colPump26FM.Visible = v;
|
this.colPump27FM.Visible = v;
|
|
|
this.colDN2400FDiff.Visible = v;
|
this.colDN2700FDiff.Visible = v;
|
this.colPump21FDiff.Visible = v;
|
this.colPump22FDiff.Visible = v;
|
this.colPump23FDiff.Visible = v;
|
this.colPump24FDiff.Visible = v;
|
this.colPump25FDiff.Visible = v;
|
this.colPump26FDiff.Visible = v;
|
this.colPump27FDiff.Visible = v;
|
|
this.colJD1FDiff.Visible = v;
|
this.colJD2FDiff.Visible = v;
|
this.colJD3FDiff.Visible = v;
|
|
this.colJD1FM.Visible = v;
|
this.colJD2FM.Visible = v;
|
this.colJD3FM.Visible = v;
|
|
|
this.colJD1F.Visible = v;
|
this.colJD2F.Visible = v;
|
this.colJD3F.Visible = v;
|
}
|
private void ShowPressure(bool v)
|
{
|
this.colDN2400P.Visible = v;
|
this.colDN2700P.Visible = v;
|
this.colPump21P.Visible = false;
|
this.colPump22P.Visible = false;
|
this.colPump23P.Visible = false;
|
this.colPump24P.Visible = false;
|
this.colPump25P.Visible = false;
|
this.colPump26P.Visible = false;
|
this.colPump27P.Visible = false;
|
|
|
this.colDN2400PM.Visible = v;
|
this.colDN2700PM.Visible = v;
|
this.colPump21PM.Visible = false;
|
this.colPump22PM.Visible = false;
|
this.colPump23PM.Visible = false;
|
this.colPump24PM.Visible = false;
|
this.colPump25PM.Visible = false;
|
this.colPump26PM.Visible = false;
|
this.colPump27PM.Visible = false;
|
|
|
this.colDN2400PDiff.Visible = v;
|
this.colDN2700PDiff.Visible = v;
|
this.colPump21PDiff.Visible = false;
|
this.colPump22PDiff.Visible = false;
|
this.colPump23PDiff.Visible = false;
|
this.colPump24PDiff.Visible = false;
|
this.colPump25PDiff.Visible = false;
|
this.colPump26PDiff.Visible = false;
|
this.colPump27PDiff.Visible = false;
|
|
|
this.colJD1P.Visible = v;
|
this.colJD2P.Visible = v;
|
this.colJD3P.Visible = v;
|
this.colPump11P.Visible = false;
|
this.colPump12P.Visible = false;
|
this.colPump13P.Visible = false;
|
this.colPump14P.Visible = false;
|
this.colPump15P.Visible = false;
|
this.colPump16P.Visible = false;
|
this.colPump17P.Visible = false;
|
this.colPump18P.Visible = false;
|
|
|
this.colJD1PM.Visible = v;
|
this.colJD2PM.Visible = v;
|
this.colJD3PM.Visible = v;
|
this.colPump11PM.Visible = false;
|
this.colPump12PM.Visible = false;
|
this.colPump13PM.Visible = false;
|
this.colPump14PM.Visible = false;
|
this.colPump15PM.Visible = false;
|
this.colPump16PM.Visible = false;
|
this.colPump17PM.Visible = false;
|
this.colPump18PM.Visible = false;
|
|
this.colJD1PDiff.Visible = v;
|
this.colJD2PDiff.Visible = v;
|
this.colJD3PDiff.Visible = v;
|
this.colPump11PDiff.Visible = false;
|
this.colPump12PDiff.Visible = false;
|
this.colPump13PDiff.Visible = false;
|
this.colPump14PDiff.Visible = false;
|
this.colPump15PDiff.Visible = false;
|
this.colPump16PDiff.Visible = false;
|
this.colPump17PDiff.Visible = false;
|
this.colPump18PDiff.Visible = false;
|
|
}
|
private void ShowPump(bool v)
|
{
|
this.colPump21.Visible = v;
|
this.colPump22.Visible = v;
|
this.colPump23.Visible = v;
|
this.colPump24.Visible = v;
|
this.colPump25.Visible = v;
|
this.colPump26.Visible = v;
|
this.colPump27.Visible = v;
|
|
this.colPump21M.Visible = v;
|
this.colPump22M.Visible = v;
|
this.colPump23M.Visible = v;
|
this.colPump24M.Visible = v;
|
this.colPump25M.Visible = v;
|
this.colPump26M.Visible = v;
|
this.colPump27M.Visible = v;
|
|
this.colPump21Diff.Visible = v;
|
this.colPump22Diff.Visible = v;
|
this.colPump23Diff.Visible = v;
|
this.colPump24Diff.Visible = v;
|
this.colPump25Diff.Visible = v;
|
this.colPump26Diff.Visible = v;
|
this.colPump27Diff.Visible = v;
|
|
|
this.colPump11.Visible = v;
|
this.colPump12.Visible = v;
|
this.colPump13.Visible = v;
|
this.colPump14.Visible = v;
|
this.colPump15.Visible = v;
|
this.colPump16.Visible = v;
|
this.colPump17.Visible = v;
|
this.colPump18.Visible = v;
|
|
this.colPump11M.Visible = v;
|
this.colPump12M.Visible = v;
|
this.colPump13M.Visible = v;
|
this.colPump14M.Visible = v;
|
this.colPump15M.Visible = v;
|
this.colPump16M.Visible = v;
|
this.colPump17M.Visible = v;
|
this.colPump18M.Visible = v;
|
|
this.colPump11Diff.Visible = v;
|
this.colPump12Diff.Visible = v;
|
this.colPump13Diff.Visible = v;
|
this.colPump14Diff.Visible = v;
|
this.colPump15Diff.Visible = v;
|
this.colPump16Diff.Visible = v;
|
this.colPump17Diff.Visible = v;
|
this.colPump18Diff.Visible = v;
|
}
|
|
#endregion
|
|
|
#region dict
|
|
private Dictionary<string, string> _flow_id_mapping_dict1 = new Dictionary<string, string>()
|
{
|
{"Pjd1","SFJD1"},
|
{"Pjd2","SFJD2"},
|
{"Pjd3","SFJD3"},
|
};
|
|
private Dictionary<string, string> _pressure_id_mapping_dict1 = new Dictionary<string, string>()
|
{
|
{"Jjd1","SPJD1"},
|
{"Jjd2","SPJD2"},
|
{"Jjd3","SPJD3"},
|
{"Jpump11","SPPump11" },
|
{"Jpump12","SPPump12" },
|
{"Jpump13","SPPump13" },
|
{"Jpump14","SPPump14" },
|
{"Jpump15","SPPump15" },
|
{"Jpump16","SPPump16" },
|
{"Jpump17","SPPump17" },
|
{"Jpump18","SPPump18" }
|
};
|
|
private Dictionary<string, string> _pump_id_mapping_dict1 = new Dictionary<string, string>(){
|
{ "Pump11" , "Pump11"},
|
{ "Pump12" , "Pump12"},
|
{ "Pump13" , "Pump13"},
|
{ "Pump14" , "Pump14"},
|
{ "Pump15" , "Pump15"},
|
{ "Pump16" , "Pump16"},
|
{ "Pump17" , "Pump17"},
|
{ "Pump18" , "Pump18"},
|
|
};
|
|
private Dictionary<int, string> _flag_pattern_dict1 = new(){
|
{ GlobalHelper.Flag11 , "Pump11"},
|
{ GlobalHelper.Flag12 , "Pump12"},
|
{ GlobalHelper.Flag13 , "Pump13"},
|
{ GlobalHelper.Flag14 , "Pump14"},
|
{ GlobalHelper.Flag15 , "Pump15"},
|
{ GlobalHelper.Flag16 , "Pump16"},
|
{ GlobalHelper.Flag17 , "Pump17"},
|
{ GlobalHelper.Flag18 , "Pump18"},
|
};
|
|
private Dictionary<string, string> _flow_id_mapping_dict2 = new Dictionary<string, string>()
|
{
|
{"Pdn2400","SFDN2400"},
|
{"Pdn2700","SFDN2700"},
|
{"Ppump21","SFPump21"},
|
{"Ppump22","SFPump22"},
|
{"Ppump23","SFPump23"},
|
{"Ppump24","SFPump24"},
|
{"Ppump25","SFPump25"},
|
{"Ppump26","SFPump26"},
|
{"Ppump27","SFPump27"}
|
};
|
|
private Dictionary<string, string> _pressure_id_mapping_dict2 = new Dictionary<string, string>()
|
{
|
{"Jdn2400","SPDN2400"},
|
{"Jdn2700","SPDN2700"},
|
{"Jpump21","SPPump21"},
|
{"Jpump22","SPPump22"},
|
{"Jpump23","SPPump23"},
|
{"Jpump24","SPPump24"},
|
{"Jpump25","SPPump25"},
|
{"Jpump26","SPPump26"},
|
{"Jpump27","SPPump27"}
|
};
|
|
private Dictionary<string, string> _pump_id_mapping_dict2 = new Dictionary<string, string>(){
|
{ "Pump21" , "Pump21"},
|
{ "Pump22" , "Pump22"},
|
{ "Pump23" , "Pump23"},
|
{ "Pump24" , "Pump24"},
|
{ "Pump25" , "Pump25"},
|
{ "Pump26" , "Pump26"},
|
{ "Pump27" , "Pump27"}
|
};
|
|
private Dictionary<int, string> _flag_pattern_dict2 = new(){
|
{ GlobalHelper.Flag21 ,"Pump21" },
|
{ GlobalHelper.Flag22 ,"Pump22" },
|
{ GlobalHelper.Flag23 ,"Pump23" },
|
{ GlobalHelper.Flag24 ,"Pump24" },
|
{ GlobalHelper.Flag25 ,"Pump25" },
|
{ GlobalHelper.Flag26 ,"Pump26" },
|
{ GlobalHelper.Flag27 ,"Pump27" }
|
};
|
|
#endregion
|
|
//调度
|
private void btnSchedule_Click(object sender, EventArgs e)
|
{
|
var day = (DateTime)this.dtDay.EditValue;
|
var day_value = DayValueHelper.GetDayValue(day);
|
if (day_value == null)
|
{
|
XtraMessageBox.Show("无法加载日期数据!");
|
return;
|
}
|
this.memoInfo.Text = string.Empty;
|
|
var day_value_list = new List<DayValue>() { day_value };
|
WaitHelper.ShowWaitForm();
|
|
var msg = ScadaScheduleHelper.Schedule(
|
day_value_list,
|
this.cekStation1.Checked,
|
this.cekStation2.Checked,
|
out List<Station1ScadaSchedule> all_station1_scada_schedule_list,
|
out List<Station2ScadaSchedule> all_station2_scada_schedule_list,
|
true);
|
|
this.station1ScadaScheduleBindingSource.DataSource = all_station1_scada_schedule_list;
|
this.station1ScadaScheduleBindingSource.ResetBindings(false);
|
this.bandedGridView2.BestFitColumns();
|
|
this.station2ScadaScheduleBindingSource.DataSource = all_station2_scada_schedule_list;
|
this.station2ScadaScheduleBindingSource.ResetBindings(false);
|
this.bandedGridView1.BestFitColumns();
|
|
this.memoInfo.Text = msg;
|
WaitHelper.HideWaitForm();
|
}
|
|
#region event
|
|
private void cekShowScada_CheckedChanged(object sender, EventArgs e)
|
{
|
ShowScada(this.cekShowScada.Checked);
|
}
|
|
private void cekShowModel_CheckedChanged(object sender, EventArgs e)
|
{
|
ShowModel(this.cekShowModel.Checked);
|
|
}
|
|
private void bandedGridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
|
{
|
if (e.CellValue != null)
|
{
|
if (e.Column == this.colDN2400PDiff || e.Column == this.colDN2700PDiff)
|
{
|
|
var cell_value = e.CellValue.ToString() ?? string.Empty;
|
if (double.TryParse(cell_value, out double value))
|
{
|
if (Math.Abs(value) > 0.5)
|
{
|
e.Appearance.ForeColor = Color.Red;
|
}
|
}
|
|
}
|
else if
|
(
|
e.Column == this.colPump21Diff ||
|
e.Column == this.colPump22Diff ||
|
e.Column == this.colPump23Diff ||
|
e.Column == this.colPump24Diff ||
|
e.Column == this.colPump25Diff ||
|
e.Column == this.colPump26Diff ||
|
e.Column == this.colPump27Diff
|
)
|
{
|
|
var cell_value = e.CellValue.ToString() ?? string.Empty;
|
if (double.TryParse(cell_value, out double value))
|
{
|
if (value > 0)
|
{
|
e.Appearance.ForeColor = Color.Red;
|
}
|
else
|
{
|
e.Appearance.ForeColor = Color.Green;
|
}
|
}
|
}
|
else if
|
(
|
e.Column == this.colTotalPowerDiff
|
)
|
{
|
|
var cell_value = e.CellValue.ToString() ?? string.Empty;
|
if (double.TryParse(cell_value, out double value))
|
{
|
if (value > 0)
|
{
|
e.Appearance.ForeColor = Color.Red;
|
}
|
else
|
{
|
e.Appearance.ForeColor = Color.Green;
|
}
|
}
|
}
|
|
}
|
|
|
}
|
|
private void bandedGridView2_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
|
{
|
if (e.CellValue != null)
|
{
|
|
if (e.Column == this.colJD1PDiff || e.Column == this.colJD2PDiff || e.Column == this.colJD3PDiff)
|
{
|
|
var cell_value = e.CellValue.ToString() ?? string.Empty;
|
if (double.TryParse(cell_value, out double value))
|
{
|
if (Math.Abs(value) > 0.5)
|
{
|
e.Appearance.ForeColor = Color.Red;
|
}
|
}
|
|
}
|
else if
|
(
|
e.Column == this.colPump11Diff ||
|
e.Column == this.colPump12Diff ||
|
e.Column == this.colPump13Diff ||
|
e.Column == this.colPump14Diff ||
|
e.Column == this.colPump15Diff ||
|
e.Column == this.colPump16Diff ||
|
e.Column == this.colPump17Diff ||
|
e.Column == this.colPump18Diff
|
)
|
{
|
|
var cell_value = e.CellValue.ToString() ?? string.Empty;
|
if (double.TryParse(cell_value, out double value))
|
{
|
if (value > 0)
|
{
|
e.Appearance.ForeColor = Color.Red;
|
}
|
else
|
{
|
e.Appearance.ForeColor = Color.Green;
|
}
|
}
|
}
|
else if
|
(
|
e.Column == this.colTotalPowerDiff1
|
)
|
{
|
|
var cell_value = e.CellValue.ToString() ?? string.Empty;
|
if (double.TryParse(cell_value, out double value))
|
{
|
if (value > 0)
|
{
|
e.Appearance.ForeColor = Color.Red;
|
}
|
else
|
{
|
e.Appearance.ForeColor = Color.Green;
|
}
|
}
|
}
|
}
|
}
|
|
|
#endregion
|
|
}
|
}
|