using Eventech.Model; using System.Collections.Generic; using System.Linq; using TProduct.Model; namespace TProduct.DataFile.YwGeneralFile { public class BaseFile { protected TProduct.Model.ProductMainExPump _currentPump = null; protected TProduct.Model.ProductMainExMotor _currentMotor = null; protected TProduct.Model.PartBase _currentPart = null; protected TProduct.Model.RatedParas4Pump _ratedParas = null; protected TProduct.Model.TestStandard _testStandard = null; protected TProduct.Model.TestGrade _testGrade = null; protected List _testJudgeItems = null; protected List _testJudgeResults = null; protected List _allMonitorPoints = null; protected TProduct.Model.TestProjectBase _testProject = null; protected List _testItems = null; protected TProduct.Model.TestProjectItemView _defaultTestItem = null; protected TProduct.Model.TestProjectParas _testParas = null; protected List _allRecords = null; protected Eventech.Model.CurveExpress _curveExpressQH = null; protected Eventech.Model.CurveExpress _curveExpressQE = null; protected Eventech.Model.CurveExpress _curveExpressQP = null; protected Model.WorkBenchBase _workBench = null; /// /// 赋值 /// /// /// /// /// public virtual string SetBindingData( TProduct.Model.ProductMainExPump pump, TProduct.Model.PartBase part, TProduct.Model.TestProjectBase project) { if (project == null) { return "还未设置project参数"; } if (pump == null) { return "还未设置pump参数"; } if (part == null) { return "还未设置part参数"; } if (string.IsNullOrEmpty(pump.RatedParas)) { return "还未设置泵的额定参数"; } this._testItems = new BLL.TestProjectItemView().GetByProjectID(project.ID); if (this._testItems == null || this._testItems.Count() == 0) { return "还未设置items参数"; } this._currentPump = pump; this._currentPart = part; this._ratedParas = TProduct.Model.RatedParas4Pump.ToModel(pump.RatedParas); if (this._currentPump.MotorMainID.HasValue && this._currentPump.MotorMainID > 0) { _currentMotor = new BLL.ProductMotor().GetExByProductID(this._currentPump.MotorMainID.Value); } var default_item = this._testItems.Last(); this._testProject = project; this._defaultTestItem = default_item; _testParas = project.ProjectParas; _workBench = new BLL.WorkBenchBase().GetByID(default_item.BenchID); if (_workBench == null) { return "还未设置 workBench参数"; } _allMonitorPoints = new BLL.WorkBenchMonitorPoint().GetByBenchID(_workBench.ID); //从数据库中获取以前的测试数据 var allRecords4Ds = new BLL.PumpFeatTestRecord().GetByTestItem(default_item); this._allRecords = new List(); if (allRecords4Ds != null) { foreach (var r in allRecords4Ds) { this._allRecords.Add(new PumpFeatTestRecordViewModel(r) { MonitorRecordList = new MonitorRecord4DsList(r.MonitorRecords) }); } } if (this._allRecords.Count > 4) { var pointsqh = from x in this._allRecords select new Eventech.Model.FeatPoint(x.CorrectPtQ, x.CorrectPtH); _curveExpressQH = new CurveExpress(pointsqh.ToList(), pump.CurveFitTypeQH); var pointsqe = from x in this._allRecords select new Eventech.Model.FeatPoint(x.CorrectPtQ, x.CorrectPtE.Value); _curveExpressQE = new CurveExpress(pointsqe.ToList(), pump.CurveFitTypeQE); var pointsqp = from x in this._allRecords select new Eventech.Model.FeatPoint(x.CorrectPtQ, x.CorrectPtP.Value); _curveExpressQP = new CurveExpress(pointsqp.ToList(), pump.CurveFitTypeQP); } //测试标准 _testStandard = TProduct.Common.TestStandardHelper.Instance.GetStandard( TProduct.Model.eProductType.Pump, default_item.TestStandardID); if (_testStandard == null) { _testStandard = TProduct.Common.TestStandardHelper.Instance.GetDefaultStandard(eProductType.Pump, eTestType.FeatTest); } _testGrade = TProduct.Common.TestStandardHelper.Instance.GetGrade(TProduct.Model.eProductType.Pump, _testStandard.ID, default_item.TestGradeID); if (_testGrade == null) { _testGrade = TProduct.Common.TestStandardHelper.Instance.GetDefaultGrade(TProduct.Model.eProductType.Pump, _testStandard.ID); } _testJudgeItems = TProduct.Common.TestStandardHelper.Instance.GetJudgeItems(TProduct.Model.eProductType.Pump, _testStandard.ID, _testGrade.ID); ReJudge(); return null; } protected void ReJudge() { TProduct.Common.PumpTestJudgeHelper helper = new TProduct.Common.PumpTestJudgeHelper(); helper.SetRatedParas(this._currentPump, this._ratedParas); helper.SetStandard(this._testStandard, this._testGrade, this._testJudgeItems); var isOk = helper.Judge(this._allRecords, out _testJudgeResults); } public virtual string CreatXmlFile(string Path, TProduct.Model.DispStautInfo infoDelegete) { return null; } } }