using DevExpress.XtraEditors;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Windows.Forms;
|
using TProduct.Common;
|
|
namespace TProduct.WinFrmUI.TPump
|
{
|
public partial class ResultJudgeForm : XtraForm
|
{
|
public ResultJudgeForm()
|
{
|
InitializeComponent();
|
|
this.btnJudge.SetCommButtonColor();
|
this.gridViewMain.OptionsDetail.ShowDetailTabs = false;//不显示TAB名
|
this.gridViewMain.OptionsView.ShowGroupPanel = false;//隐藏最上面的GroupPanel
|
this.gridViewMain.OptionsSelection.MultiSelect = false;//单选
|
//this.gridViewMain.OptionsBehavior.Editable = false;//只读
|
this.gridViewMain.BestFitColumns();
|
this.gridViewMain.IndicatorWidth = 2;
|
this.gridViewMain.RowHeight = 38;
|
}
|
private TProduct.Model.TestProjectItemView _featTestItem = null;//只针对性能测试
|
private TProduct.Model.ProductMainExPump _currentPump = null;
|
private TProduct.Model.RatedParas4Pump _ratedParas = null;
|
private TProduct.Model.TestStandard _testStandard = null;
|
private TProduct.Model.TestGrade _testGrade = null;
|
private List<Model.TestGradeJudgeItem> _testJudgeItems = null;
|
private List<TProduct.Model.TestJudgeItemResultViewModel> _testJudgeResults = null;
|
public void SetRatedParas(TProduct.Model.ProductMainExPump currentPump, TProduct.Model.RatedParas4Pump ratedParas)
|
{
|
this._currentPump = currentPump;
|
this._ratedParas = ratedParas;
|
}
|
private List<TProduct.Model.PumpFeatTestRecordViewModel> _allRecords = null;
|
public void SetRecordPoints(List<TProduct.Model.PumpFeatTestRecordViewModel> allRecords)
|
{
|
this._allRecords = allRecords;
|
}
|
public void SetBindingData(
|
TProduct.Model.TestProjectItemView featTestItem,// 对性能测试
|
TProduct.Model.TestStandard testStandard,
|
TProduct.Model.TestGrade testGrade,
|
List<Model.TestGradeJudgeItem> testJudgeItems,
|
List<TProduct.Model.TestJudgeItemResultViewModel> testJudgeResults)
|
{
|
this._testStandard = testStandard;
|
this._testGrade = testGrade;
|
this._testJudgeItems = testJudgeItems;
|
this._testJudgeResults = testJudgeResults;
|
this._featTestItem = featTestItem;
|
|
this.imageComboTestStandard.Properties.Items.Clear();
|
TestStandardHelper.Instance.GetStandardList(
|
TProduct.Model.eProductType.Pump,
|
Model.eTestType.FeatTest).ForEach(x => this.imageComboTestStandard.Properties.Items.Add(x.Name, x.ID, -1));
|
this.imageComboTestStandard.EditValue = testStandard.ID;
|
this.imageComboTestGrade.EditValue = testGrade.ID;
|
this.bindingSource1.DataSource = testJudgeResults;
|
}
|
|
private void imageComboTestStandard_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
if (imageComboTestStandard.SelectedIndex < 0)
|
return;
|
var standard_id = this.imageComboTestStandard.EditValue.ToString();
|
string defaultGradeId = null;
|
var grades = TestStandardHelper.Instance.GetGradeList(TProduct.Model.eProductType.Pump, standard_id, out defaultGradeId);
|
|
this.imageComboTestGrade.Properties.Items.Clear();
|
grades.ForEach(x => this.imageComboTestGrade.Properties.Items.Add(x.Name, x.ID, -1));
|
this.imageComboTestGrade.EditValue = defaultGradeId;
|
}
|
|
public Action<string, string, List<Model.TestGradeJudgeItem>> OnSaveGrade = null;
|
public Action<Model.eTestJudgeResult, List<TProduct.Model.TestJudgeItemResultViewModel>> OnSaveResult = null;
|
private void btnJudge_Click(object sender, EventArgs e)
|
{
|
if (imageComboTestStandard.SelectedIndex < 0)
|
return;
|
if (imageComboTestGrade.SelectedIndex < 0)
|
return;
|
var standard_id = this.imageComboTestStandard.EditValue.ToString();
|
var grade_id = this.imageComboTestGrade.EditValue.ToString();
|
if (this._testGrade.ID != grade_id)
|
{
|
this._testStandard = TestStandardHelper.Instance.GetStandard(TProduct.Model.eProductType.Pump, standard_id);
|
this._testGrade = TestStandardHelper.Instance.GetGrade(TProduct.Model.eProductType.Pump, standard_id, grade_id);
|
|
this._testJudgeItems = TProduct.Common.TestStandardHelper.Instance.GetJudgeItems(TProduct.Model.eProductType.Pump, _testStandard.ID, _testGrade.ID);
|
if (OnSaveGrade != null)
|
OnSaveGrade(standard_id, grade_id, this._testJudgeItems);
|
}
|
|
if (this._allRecords == null || this._allRecords.Count() < 4)
|
{
|
MessageBox.Show("点数量过少,暂时无法判断");
|
return;
|
}
|
|
TProduct.Common.PumpTestJudgeHelper helper = new TProduct.Common.PumpTestJudgeHelper();
|
helper.SetRatedParas(this._currentPump, this._ratedParas);
|
helper.SetStandard(this._testStandard, this._testGrade, this._testJudgeItems);
|
if (this._featTestItem.ItemParas != null &&
|
this._featTestItem.ItemParas.ExtendPointQ != null)
|
{
|
helper.SetCurveMaxFlow(this._featTestItem.ItemParas.ExtendPointQ.Value);
|
}
|
var isOk = helper.Judge(this._allRecords, out _testJudgeResults);
|
OnSaveResult(isOk, _testJudgeResults);
|
this.bindingSource1.DataSource = _testJudgeResults;
|
this.bindingSource1.ResetBindings(false);
|
}
|
|
private void ResultJudgeForm_Load(object sender, EventArgs e)
|
{
|
|
}
|
}
|
}
|