using System.Collections.Generic;
|
using System.Linq;
|
using System.Windows.Forms;
|
using TProduct.Model;
|
|
namespace TProduct.WinFrmUI.TPump
|
{
|
/// <summary>
|
/// 性能测试
|
/// </summary>
|
public partial class FeatTestViewMainPage : DocumentPage
|
{
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="pumpExPart"></param>
|
/// <param name="item"></param>
|
public void SetBindingData(
|
TProduct.Model.ProductMainExPumpPart pumpExPart,
|
TProduct.Model.TestProjectItemView item)
|
{
|
TProduct.Model.ProductMainExPump pump = new Model.ProductMainExPump(pumpExPart);
|
var part = new BLL.PartBase().GetByID(pumpExPart.PartID);
|
this.SetBindingData(
|
pump, part, new List<TProduct.Model.TestProjectItemView>() { item });
|
}
|
/// <summary>
|
/// 赋值
|
/// </summary>
|
/// <param name="project"></param>
|
/// <param name="item"></param>
|
/// <param name="workBench"></param>
|
/// <param name="workBenchParas"></param>
|
public void SetBindingData(
|
TProduct.Model.ProductMainExPump pump,
|
TProduct.Model.PartBase part,
|
List<TProduct.Model.TestProjectItemView> items)
|
{
|
if (items == null || items.Count() == 0)
|
{
|
MessageBox.Show("还未设置project参数");
|
return;
|
}
|
if (pump == null)
|
{
|
MessageBox.Show("还未设置pump参数");
|
return;
|
}
|
if (part == null)
|
{
|
MessageBox.Show("还未设置part参数");
|
return;
|
}
|
if (string.IsNullOrEmpty(pump.RatedParas))
|
{
|
MessageBox.Show("还未设置泵的额定参数");
|
return;
|
}
|
|
|
this._currentPump = pump;
|
this._currentPart = part;
|
this._ratedParas = TProduct.Model.RatedParas4Pump.ToModel(pump.RatedParas);
|
if (_currentPump.MotorMainID.HasValue && _currentPump.MotorMainID > 0)
|
{
|
_currentMotor = new BLL.ProductMotor().GetExByProductID((long)_currentPump.MotorMainID);
|
}
|
this._currentPumpSeries = new BLL.ProductSeries().GetByID(this._currentPump.SeriesID);
|
if (this._currentPumpSeries == null)
|
{
|
MessageBox.Show("当前泵对应系列未找到");
|
return;
|
}
|
|
this._testProject = new TestProjectBase(items.First());
|
this._featTestItem = items.Find(x => x.TestType == eTestType.FeatTest);
|
this._testItems = items;
|
|
this._workBenchInfo = new BLL.WorkBenchBase().GetByID(this._featTestItem.BenchID);
|
if (_workBenchInfo == null)
|
{
|
MessageBox.Show("还未设置测试台参数");
|
return;
|
}
|
if (!string.IsNullOrEmpty(_featTestItem.ProjectName))
|
this.PageTitle.Caption = "泵测试:" + _featTestItem.ProjectName;
|
else if (!string.IsNullOrEmpty(_featTestItem.ProjectCode))
|
this.PageTitle.Caption = "泵测试:" + _featTestItem.ProjectCode;
|
|
// 初始化监控点(会根据当前设置修改 监控点 的信息)
|
this._allMonitorPointList = ResetMonitorPoint(new BLL.WorkBenchMonitorPoint().GetByBenchID(_workBenchInfo.ID));
|
//
|
if (!InitialCalcDialog(this._currentPumpSeries, this._currentPump, _currentMotor, _workBenchInfo, this._featTestItem, _allMonitorPointList))
|
{
|
return;
|
}
|
|
|
//从数据库中获取以前的测试数据
|
var allRecords4Ds = new BLL.PumpFeatTestRecord().GetByTestItem(this._featTestItem);
|
this._allRecords = new List<PumpFeatTestRecordViewModel>();
|
if (allRecords4Ds != null && allRecords4Ds.Count > 0)
|
{
|
foreach (var r in allRecords4Ds)
|
{
|
this._allRecords.Add(new PumpFeatTestRecordViewModel(r) { MonitorRecordList = new MonitorRecord4DsList(r.MonitorRecords) });
|
}
|
if (this._featTestItem.PointNumber != allRecords4Ds.Count)
|
{
|
this._featTestItem.PointNumber = allRecords4Ds.Count;
|
new BLL.TestProjectItem().UpdatePointNumberOnly(this._featTestItem.ItemID, this._featTestItem.PointNumber);
|
}
|
}
|
else
|
{
|
if (this._featTestItem.PointNumber != 0)
|
{
|
this._featTestItem.PointNumber = 0;
|
new BLL.TestProjectItem().UpdatePointNumberOnly(this._featTestItem.ItemID, this._featTestItem.PointNumber);
|
}
|
}
|
|
//
|
InitialJudgeItem();
|
|
|
//
|
InitialMonitorGrid( );
|
|
|
//
|
InitialTestInfoCtrl();
|
|
|
//
|
IntialPartInfoCtrl();
|
|
//放在初始化性能图表之前, 因为需要此步骤,获取汽蚀点
|
InitialNpshTestInfo(items);
|
|
//
|
IntialMainChart();
|
|
//合格判断,放在后面
|
JudgeTestResult();
|
|
//
|
InitialModel3d();
|
|
//
|
InitialDurabilityTest();
|
|
//工艺图
|
InitialProcessDrawing();
|
}
|
|
/// <summary>
|
/// 设置测点
|
/// </summary>
|
/// <param name="list"></param>
|
/// <returns></returns>
|
private List<TProduct.Model.WorkBenchMonitorPoint> ResetMonitorPoint(
|
List<TProduct.Model.WorkBenchMonitorPoint> list)
|
{
|
if (list == null || list.Count() == 0)
|
{
|
return null;
|
}
|
//
|
var instrumentInfo = this._featTestItem.InstrumentInfo;
|
if (instrumentInfo != null)
|
{
|
#region 出口压力
|
var out_press_index = list.FindIndex(x => x.MonitorType == Model.eMonitorType.压力
|
&& x.Property == TProduct.Model.MonitorTypeProperty.出口);
|
if (out_press_index >= 0)
|
{
|
var monitor_outletPress = list[out_press_index];
|
|
//设置出口压力表量程
|
if (instrumentInfo.OutletPressureMeterID > 0)
|
{
|
var meter = new BLL.PressureMeter().GetByID(instrumentInfo.OutletPressureMeterID);
|
if (meter != null)
|
{
|
if (monitor_outletPress.AnalogParas == null)
|
monitor_outletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_outletPress.AnalogParas.RangeMax = meter.RangeMax;
|
monitor_outletPress.AnalogParas.RangeMin = meter.RangeMin;
|
list[out_press_index] = monitor_outletPress;
|
}
|
}
|
if (instrumentInfo.OutletPressureMeterPipeDia > 0)
|
{// 暂时用不到, 都是从测点或者泵上获取的,代码暂时保留
|
if (monitor_outletPress.AnalogParas == null)
|
monitor_outletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_outletPress.PipeDia = instrumentInfo.OutletPressureMeterPipeDia;
|
}
|
if (instrumentInfo.InletPressureMeterElevation != 0)
|
{
|
if (monitor_outletPress.AnalogParas == null)
|
monitor_outletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_outletPress.Elevation = instrumentInfo.OutletPressureMeterElevation;
|
}
|
|
//1:来源泵口径
|
if (TProduct.UserSetting.Setting.PumpTest.OutletPressMonitorDiaStatus == 1 && _ratedParas != null)
|
{
|
if (this._ratedParas.OutletDia.HasValue && _ratedParas.OutletDia > 0)
|
{
|
if (monitor_outletPress.AnalogParas == null)
|
monitor_outletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_outletPress.PipeDia = this._ratedParas.OutletDia.Value;
|
}
|
}
|
}
|
#endregion
|
|
|
#region 进口压力
|
var inlet_press_index = list.FindIndex(x => x.MonitorType == Model.eMonitorType.压力
|
&& x.Property == TProduct.Model.MonitorTypeProperty.进口);
|
if (inlet_press_index >= 0)
|
{
|
var monitor_inletPress = list[inlet_press_index];
|
|
if (instrumentInfo.InletPressureMeterID > 0)
|
{
|
var meter = new BLL.PressureMeter().GetByID(instrumentInfo.InletPressureMeterID);
|
if (meter != null)
|
{
|
if (monitor_inletPress.AnalogParas == null)
|
monitor_inletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_inletPress.AnalogParas.RangeMax = meter.RangeMax;
|
monitor_inletPress.AnalogParas.RangeMin = meter.RangeMin;
|
list[inlet_press_index] = monitor_inletPress;
|
}
|
}
|
if (instrumentInfo.InletPressureMeterPipeDia > 0)
|
{// 暂时用不到, 都是从测点或者泵上获取的,代码暂时保留
|
if (monitor_inletPress.AnalogParas == null)
|
monitor_inletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_inletPress.PipeDia = instrumentInfo.InletPressureMeterPipeDia;
|
}
|
if (instrumentInfo.InletPressureMeterElevation != 0)
|
{
|
if (monitor_inletPress.AnalogParas == null)
|
monitor_inletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_inletPress.Elevation = instrumentInfo.InletPressureMeterElevation;
|
}
|
|
//1:来源泵口径
|
if (TProduct.UserSetting.Setting.PumpTest.InletPressMonitorDiaStatus == 1 && _ratedParas != null)
|
{
|
if (this._ratedParas.InletDia.HasValue && _ratedParas.InletDia > 0)
|
{
|
if (monitor_inletPress.AnalogParas == null)
|
monitor_inletPress.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_inletPress.PipeDia = this._ratedParas.InletDia.Value;
|
}
|
}
|
}
|
|
//清水池水位的标高也放在进口压力设置中
|
var water_level_index = list.FindIndex(x => x.MonitorType == Model.eMonitorType.水位);
|
if (water_level_index >= 0)
|
{
|
var monitor_WaterLevel = list[water_level_index];
|
|
if (instrumentInfo.InletPressureMeterElevation != 0)
|
{
|
monitor_WaterLevel.Elevation = instrumentInfo.InletPressureMeterElevation;
|
}
|
}
|
|
|
#endregion
|
|
#region 流量
|
if (instrumentInfo.FlowMeterRangeMax > instrumentInfo.FlowMeterRangeMin)
|
{
|
var flow_index = list.FindIndex(x => x.MonitorType == Model.eMonitorType.流量);
|
if (flow_index >= 0)
|
{
|
var monitor_flow = list[flow_index];
|
if (monitor_flow.AnalogParas == null)
|
monitor_flow.AnalogParas = new Model.AnalogMonitorPointParas();
|
monitor_flow.AnalogParas.RangeMax = instrumentInfo.FlowMeterRangeMax;
|
monitor_flow.AnalogParas.RangeMin = instrumentInfo.FlowMeterRangeMin;
|
}
|
}
|
#endregion
|
|
}
|
|
|
return list;
|
}
|
|
|
|
|
}
|
}
|