using System.Collections.Generic;
using System.Windows.Forms;
using TProduct.Model;
namespace TProduct.WinFrmUI.TValve
{
///
/// 性能测试
///
public partial class FeatTestViewMainPage : DocumentPage
{
///
/// 赋值
///
///
///
///
///
public void SetBindingData(
TProduct.Model.ProductMainExValve valve,
TProduct.Model.PartBase part,
TProduct.Model.TestProjectItemView project_item)
{
if (project_item == null)
{
MessageBox.Show("还未设置project参数");
return;
}
if (valve == null)
{
MessageBox.Show("还未设置valve参数");
return;
}
if (part == null)
{
MessageBox.Show("还未设置part参数");
return;
}
//this.PageTitle.Caption = "阀测试:"+ project.Name;
this._currentValve = valve;
this._currentPart = part;
var feat_test_item = project_item;
if (feat_test_item == null)
return;
this._testProject = new Model.TestProjectBase(project_item);
this._featTestItem = feat_test_item;
this._workBenchInfo = new BLL.WorkBenchBase().GetByID(feat_test_item.BenchID);
if (_workBenchInfo == null)
{
MessageBox.Show("还未设置测试台参数");
return;
}
var allMonitorPointList = new BLL.WorkBenchMonitorPoint().GetByBenchID(_workBenchInfo.ID);
//
if (!InitialCalcDialog(valve, _workBenchInfo, feat_test_item, allMonitorPointList))
{
return;
}
//从数据库中获取以前的测试数据
var allRecords4Ds = new BLL.ValveFeatTestRecord().GetByTestItem(feat_test_item);
this._allRecords = new List();
if (allRecords4Ds != null)
{
foreach (var r in allRecords4Ds)
{
this._allRecords.Add(new ValveFeatTestRecordViewModel(r) { MonitorRecordList = new MonitorRecord4DsList(r.MonitorRecords) });
}
}
//
InitialJudgeItem();
//
InitialMonitorGrid(allMonitorPointList);
//
InitialTestLogCtrl();
//
IntialPartInfoCtrl();
//
IntialMainChart();
//
InitialJudgeResult();
//
InitialModel3d();
//
InitialDurabilityTest();
if (!string.IsNullOrEmpty(_featTestItem.ProjectName))
this.PageTitle.Caption = "泵测试:" + _featTestItem.ProjectName;
else if (!string.IsNullOrEmpty(_featTestItem.ProjectCode))
this.PageTitle.Caption = "泵测试:" + _featTestItem.ProjectCode;
}
//耐久试验
private void InitialDurabilityTest()
{
if (this._featTestItem == null)
return;
TProduct.Model.DurabilityTestBundle bundle = this._featTestItem.DurabilityTestInfo;
if (bundle == null || !bundle.IsHave || bundle.TotalDuration < 5)
{
tabPageDurabilityTest.PageVisible = false;
return;
}
var durabilityTestCtrl = new TProduct.WinFrmUI.TBase.ViewDurabilityTestDetail();
durabilityTestCtrl.Name = "ViewDurabilityTestDetail";
durabilityTestCtrl.Dock = DockStyle.Fill;
durabilityTestCtrl.SetBindingData(bundle);
tabPageDurabilityTest.Controls.Add(durabilityTestCtrl);
}
//日志
TBase.TestItemLogContentCtrl _testLogCtrl = null;
void InitialTestLogCtrl()
{
if (this._featTestItem == null)
return;
if (_testLogCtrl == null)
{
_testLogCtrl = new TBase.TestItemLogContentCtrl();
_testLogCtrl.Name = "ViewTestItemLogCtrl";
_testLogCtrl.Dock = DockStyle.Fill;
_testLogCtrl.OnSaveLog += (new_content) =>
{
this._featTestItem.ItemLogContent = new_content;
new TProduct.BLL.TestProjectItem().UpdateLogContent(_featTestItem.ItemID, _featTestItem.ItemLogContent);
TProduct.WinFrmUI.TipFrmHelper.ShowSuccess("日志已保存");
};
tabPageLog.Controls.Add(_testLogCtrl);
}
_testLogCtrl.SetBindingData(this._featTestItem.ItemLogContent);
}
}
}