using DevExpress.XtraEditors;
using System.Windows.Forms;
using TProduct.Model;
namespace TProduct.WinFrmUI.TPump
{
///
/// 性能测试
///
public partial class FeatTestViewMainPage
{
private void IntialPartInfoCtrl()
{
if (_partInfoCtrl == null)
{
this._partInfoCtrl = new TProduct.WinFrmUI.TPump.PartInfoCtrl();
this._partInfoCtrl.Appearance.BackColor = System.Drawing.SystemColors.Control;
this._partInfoCtrl.Appearance.Options.UseBackColor = true;
this._partInfoCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this._partInfoCtrl.Location = new System.Drawing.Point(0, 0);
this._partInfoCtrl.Name = "featTestIngPartInfoDlg1";
this._partInfoCtrl.Size = new System.Drawing.Size(967, 555);
this._partInfoCtrl.TabIndex = 0;
this._partInfoCtrl.OnEditMore += () =>
{
EditPumpMoreInfo();
};
this._partInfoCtrl.OnChangePump += () =>
{
ChangePumpEntity();
};
this._partInfoCtrl.OnGetMaxEtaPt += () =>
{
if (this._allRecords == null || this._allRecords.Count < 4)
return null;
if (_chartMainCtrl == null)
return null;
return _chartMainCtrl.GetMaxEtaPt();
};
this._partInfoCtrl.OnChangeMotorInfo += (motor ) =>
{
if (_currentMotor == null)
return;
this._currentMotor = motor;
var rated_motor = TProduct.Model.RatedParas4Motor.ToModel(_currentMotor.RatedParas);
if (theCalcDataDlg != null)
theCalcDataDlg.SetMotorInfo(motor);
var bllMtor = new BLL.ProductMain();
new BLL.ProductMotor().UpdateEx(_currentMotor);
if (OnChangeProductInfo != null)
{
OnChangeProductInfo(this._currentPump, _currentMotor);
}
};
this._partInfoCtrl.OnChangeElectricInfo += (eleInfo) =>
{
if (eleInfo == null)
return;
};
this._partInfoCtrl.OnChangeRatedParas += (rateParas) =>
{
if (rateParas != this._ratedParas.ToJson())
{
this._ratedParas = Model.RatedParas4Pump.ToModel(rateParas);
this._currentPump.RatedParas = _ratedParas.ToJson();
this._chartMainCtrl.RefreshRatedParas(this._ratedParas, this._testJudgeItems);
new BLL.ProductMain().UpdateRatedParas(_currentPump.ID, rateParas);
if (OnChangeProductInfo != null)
{
OnChangeProductInfo(this._currentPump, _currentMotor);
}
JudgeTestResult();//合格重新判断
}
};
this.tabPagePartInfo.Controls.Add(this._partInfoCtrl);
}
this._partInfoCtrl.SetBindingData(
this._currentPump,
this._currentMotor,
this._currentPart,
this._featTestItem.ElectricInfo);
}
//PumpTestBimfaceViewCtrl _model3dCtrl = null;
private void InitialModel3d()
{
this.tabPage3D.PageVisible = false;//暂时不需要
//if (_model3dCtrl == null)
//{
// //_model3dCtrl = new PumpTestBimfaceViewCtrl();
// //_model3dCtrl.Dock = DockStyle.Fill;
// //_model3dCtrl.Name = "PumpTestBimfaceViewCtrl";
// //string error_info;
// //if (_model3dCtrl.SetBindingData(out error_info) == false)
// //{
// // MessageBox.Show(error_info);
// // return;
// //}
// //this.tabPage3D.Controls.Add(_model3dCtrl);
//}
}
//测试信息
void InitialTestInfoCtrl()
{
if (this._featTestItem == null)
return;
TestInfoCtrl ctrl = new TestInfoCtrl();
ctrl.Name = "TestInfoCtrl";
ctrl.Dock = DockStyle.Fill;
ctrl.SetBindingData(this._testProject, this._testItems);
this.tabPageTestInfo.Controls.Add(ctrl);
ctrl.OnSaveItem += (item) =>
{
if (this.OnChangeTestItemInfo != null)
{
this.OnChangeTestItemInfo(item);
}
new BLL.TestProjectItem().Update(new TestProjectItem(item));
TProduct.WinFrmUI.TipFrmHelper.ShowSuccess(" 已保存");
};
ctrl.OnSaveProject += (prj) =>
{
foreach (var item in this._testItems)
{
item.Reset(prj);
}
if (this.OnChangeTestProjectInfo != null)
{
this.OnChangeTestProjectInfo(prj);
}
new BLL.TestProject().Update(prj);
};
}
//耐久试验
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);
}
private void barBtn测试台仪表参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
ShowWorkBenchInfo();
}
public void ShowWorkBenchInfo()
{
var frm = new TProduct.WinFrmUI.TPump.ViewWorkBenchInfoDlg();
frm.SetBindingData(this._workBenchInfo, this._featTestItem);
frm.Show();
}
private void barBtn测点参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
ShowMonitorPointList();
}
public void ShowMonitorPointList()
{
TProduct.WinFrmUI.TestBench.ListWorkBenchMonitorPointDlg frm = new TProduct.WinFrmUI.TestBench.ListWorkBenchMonitorPointDlg();
frm.SetBindingData(this._workBenchInfo);
frm.Show();
}
private void bbi产品参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
EditPumpMoreInfo();
}
///
///
///
private void EditPumpMoreInfo()
{
if (_currentPump == null)
return;
WaitFrmHelper.ShowWaitForm();
TProduct.WinFrmUI.Data4Factory.EditProductPumpDlg
dlg = new Data4Factory.EditProductPumpDlg();
dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
dlg.SetBindingData(this._currentPump,this._currentPart==null?0:this._currentPart.ID);
dlg.IsEditChangedAble( false);
dlg.ReloadDataEvent += (isChangePart, pump, motor,part) =>
{
if (part != null)
{
this._currentPart = part;
}
this._currentPump.Reset(pump);
this._ratedParas = TProduct.Model.RatedParas4Pump.ToModel(pump.RatedParas);
JudgeTestResult();
this._chartMainCtrl.RefreshRatedParas(this._ratedParas, this._testJudgeItems);
ShowCmdOperateInfo("更新成功!");
XtraMessageBox.Show("更新成功!");
if (this._partInfoCtrl != null)
{
this._partInfoCtrl.SetBindingData(
this._currentPump,
this._currentMotor,
this._currentPart,
this._featTestItem.ElectricInfo);
}
if (this.theCalcDataDlg != null)
{
this.theCalcDataDlg.SetPumpInfo(this._currentPumpSeries, this._currentPump);
this.theCalcDataDlg.SetMotorInfo(this._currentMotor);
}
};
dlg.Show();
}
///
///
///
private void ChangePumpEntity()
{
}
}
}