using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Threading.Tasks;
|
using System.Web.UI.WebControls.WebParts;
|
using System.Windows.Forms;
|
|
namespace TProduct.WinFrmUI.TPump
|
{
|
public class TestList4FactoryBasePage : DocumentPage
|
{
|
protected List<CurrentViewModel> _bindList = null;
|
protected List<Model.LoginUser> _allUsers = null;
|
protected List<Model.ProductSeries> _allSeries = null;
|
protected List<Model.ManufacturerBase> _allManufacturers = null;
|
protected List<Model.Senderbase> _allSenderbases = null;
|
protected List<Model.WorkBenchBase> _allWorkBenchs = null;
|
protected List<Model.ProductMainExPump> _allPumpList = null;
|
protected class CurrentViewModel
|
{
|
public CurrentViewModel(Model.TestProjectItemView project_item)
|
{
|
this.ProjectID = project_item.ProjectID;
|
this.ProjectCode = project_item.ProjectCode;
|
this.ProjectTime = project_item.ProjectCreateTime.ToString("MM月dd日 HH:mm");
|
this.JudgeResult = project_item.ItemJudgeResult.ToString();
|
this.Entity = project_item;
|
this.ItemID = project_item.ItemID;
|
}
|
public long ProjectID { get; set; }
|
public long ItemID { get; set; }
|
|
public string SeriesName { get; set; }
|
public string ProductName { get; set; }
|
public string PartNO { get; set; }//产品编号
|
public string PartName { get; set; }//产品名称
|
public string SenderName { get; set; }//设备送检方
|
public string ManufacturerName { get; set; }//设备生产商
|
public string ProjectCode { get; set; }//项目编号
|
|
public string ProjectTime { get; set; }//测试时间
|
public string TestUserName { get; set; }//测试人
|
|
public string WorkBenchName { get; set; }//测试台名
|
|
public string JudgeResult { get; set; }//判别结果
|
|
public TProduct.Model.ProductSeries Series { get; set; }
|
public TProduct.Model.ProductMainExPump Pump { get; set; }
|
public TProduct.Model.PartBase Part { get; set; }
|
public TProduct.Model.WorkBenchBase WorkBench { get; set; }
|
|
public TProduct.Model.TestProjectItemView Entity { get; set; }
|
|
public string ProjectNameDisp
|
{
|
get
|
{
|
if (this.Entity.TestType == Model.eTestType.FeatTest)
|
{
|
if (string.IsNullOrEmpty(this.Entity.ProjectName))
|
{
|
return "性能测试";
|
}
|
else
|
{
|
return this.Entity.ProjectName;
|
}
|
}
|
if (this.Entity.TestType == Model.eTestType.NpshTest)
|
{
|
if (string.IsNullOrEmpty(this.Entity.ProjectName))
|
{
|
return string.Format("{0}({1})", "汽蚀测试", this.Entity.ItemName);
|
}
|
else
|
{
|
return string.Format("{0} {1}({2})", this.Entity.ProjectName, "汽蚀测试", this.Entity.ItemName);
|
}
|
}
|
|
return this.Entity.ProjectName;
|
}
|
}
|
//
|
internal void RestProject(TProduct.Model.TestProjectBase project)
|
{
|
this.Entity.Reset(project);
|
|
this.ProjectCode = project.Code;
|
}
|
internal void RestItem(TProduct.Model.TestProjectItemView project_item)
|
{
|
this.Entity = project_item;
|
|
this.ProjectCode = project_item.ProjectCode;
|
this.ItemID = project_item.ItemID;
|
this.JudgeResult = project_item.ItemJudgeResult.ToString();
|
}
|
}
|
|
private System.Windows.Forms.BindingSource _bindingSource;
|
protected void SetGridBindingSource(System.Windows.Forms.BindingSource soruce)
|
{
|
_bindingSource = soruce;
|
}
|
|
public override void InitialDataSource()
|
{
|
base.InitialDataSource();
|
|
_allSenderbases = new BLL.Senderbase().GetAll();
|
_allUsers = new BLL.LoginUser().GetAll();
|
_allPumpList = new BLL.ProductPump().GetExAll();
|
_allManufacturers = new BLL.ManufacturerBase().GetAll();
|
_allWorkBenchs = new BLL.WorkBenchBase().GetAll();
|
}
|
|
|
protected void CreateDemoDataByOnePoint(
|
TProduct.Model.ProductMainExPump pump,
|
TProduct.Model.PartBase part,
|
TProduct.Model.TestProjectItemView testItem,
|
TProduct.Model.WorkBenchBase workBench)
|
{
|
DrawLxpCurveOnePtPanel frm2 = new DrawLxpCurveOnePtPanel();
|
if (!frm2.SetBindingData(pump))
|
return;
|
if (frm2.ShowDialog() != DialogResult.OK)
|
return;
|
|
|
|
var allMonitorPointList = new BLL.WorkBenchMonitorPoint().GetByBenchID(workBench.ID);
|
|
var moinitor_press_inlet = allMonitorPointList.Find(x => x.MonitorType == TProduct.Model.eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.进口);
|
|
var moinitor_press_outlet = allMonitorPointList.Find(x => x.MonitorType == TProduct.Model.eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.出口);
|
|
|
|
List<Eventech.Model.FeatPoint> pointInfoQH = null;
|
List<Eventech.Model.FeatPoint> pointInfoQE = null;
|
List<Eventech.Model.FeatPoint> pointInfoQP = null;
|
List<Eventech.Model.FeatPoint> pointInfoNPSH = null;
|
|
var ratedN = pump.Ratedn.Value;
|
|
var bll = new BLL.PumpFeatTestRecord();
|
|
frm2.GetFeatPoint(out pointInfoQH, out pointInfoQE, out pointInfoQP, out pointInfoNPSH);
|
Random rd = new Random();
|
for (int i = 0; i < pointInfoQH.Count; i++)
|
{
|
var testQ = pointInfoQH[i].X;
|
var testH = pointInfoQH[i].Y;
|
double testP = 0;
|
if (pointInfoQP[i].Y > 50)
|
testP = Math.Round(pointInfoQP[i].Y, 1);
|
else if (pointInfoQP[i].Y > 10)
|
testP = Math.Round(pointInfoQP[i].Y, 2);
|
else if (pointInfoQP[i].Y > 2)
|
testP = Math.Round(pointInfoQP[i].Y, 3);
|
else
|
testP = Math.Round(pointInfoQP[i].Y, 4);
|
var testE = pointInfoQE[i].Y;
|
|
var rTestSpeed = pump.Ratedn.Value - rd.Next(1, 30) / 10.0;
|
|
TProduct.Model.PumpFeatTestRecordViewModel radomRecord
|
= new TProduct.Model.PumpFeatTestRecordViewModel();
|
|
radomRecord.TestItemID = testItem.ItemID;
|
radomRecord.Time = DateTime.Now.AddSeconds(i * 120 + rd.Next(1, 15));
|
radomRecord.RecordType = TProduct.Model.eRecordType.Statistics;
|
|
//得到相似换算值
|
double xshsFlow = testQ * ratedN / rTestSpeed;
|
double xshsHead = testH * ratedN * ratedN / rTestSpeed / rTestSpeed;
|
|
//效率进行修正
|
double xshsEffice = CalcFeatTestData1Dlg.GetSpeedE(testE, rTestSpeed, ratedN);
|
|
//功率
|
double xshsPower = 0;
|
if (i == 0 || xshsFlow < 1)
|
{//零流量点的功率
|
xshsPower = testP * ratedN * ratedN * ratedN / rTestSpeed / rTestSpeed / rTestSpeed;
|
}
|
else
|
{//一般点的功率用效率计算
|
xshsPower = CalcFeatTestData1Dlg.CalculateP(xshsFlow, xshsHead, xshsEffice);
|
}
|
|
radomRecord.Speed = rTestSpeed;
|
radomRecord.TestPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(testQ);
|
radomRecord.TestPtH = TProduct.Common.RoundHelper.GetDispValueHead(testH);
|
radomRecord.TestPtE = TProduct.Common.RoundHelper.GetDispValueEta(testE);
|
radomRecord.TestPtP = TProduct.Common.RoundHelper.GetDispValuePower(testP);
|
radomRecord.CorrectPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(xshsFlow);
|
radomRecord.CorrectPtH = TProduct.Common.RoundHelper.GetDispValueHead(xshsHead);
|
radomRecord.CorrectPtE = TProduct.Common.RoundHelper.GetDispValueEta(xshsEffice);
|
radomRecord.CorrectPtP = TProduct.Common.RoundHelper.GetDispValuePower(xshsPower);
|
|
|
var p1m = -0.015 + rd.Next(100, 140) / 1000.0;
|
|
//高差
|
double gc = 0;
|
|
double OtherPressCoeff = 4 * 1000 / Math.PI / 3.6;
|
double rPipeInV = 0;
|
//if (moinitor_press_inlet != null &&
|
// moinitor_press_inlet.PipeDia != null &&
|
// moinitor_press_inlet.PipeDia > 10)
|
//{
|
// double mm_inlet_dia = moinitor_press_inlet.PipeDia.Value;
|
// rPipeInV = OtherPressCoeff * testQ / mm_inlet_dia / mm_inlet_dia;
|
//}
|
|
double rPipeOutV = 0;
|
//if (moinitor_press_outlet != null &&
|
// moinitor_press_outlet.PipeDia != null &&
|
// moinitor_press_outlet.PipeDia > 10)
|
//{
|
// double mm_outlet_dia = moinitor_press_outlet.PipeDia.Value;
|
// rPipeOutV = OtherPressCoeff * testQ / mm_outlet_dia / mm_outlet_dia;
|
//}
|
|
|
//if (moinitor_press_outlet != null && moinitor_press_outlet.Elevation != null)
|
//{
|
// gc += moinitor_press_outlet.Elevation.Value;
|
//}
|
//if (moinitor_press_inlet != null && moinitor_press_inlet.Elevation != null)
|
//{
|
// gc -= moinitor_press_inlet.Elevation.Value;
|
//}
|
double rVDif = (rPipeOutV * rPipeOutV - rPipeInV * rPipeInV) / (TProduct.ConstantParas.g * 2.0);
|
double p2m = Math.Round((testH - rVDif - gc) * TProduct.ConstantParas.g / 1000 + p1m, 4);
|
|
|
TProduct.Model.MonitorRecord4DsList monitorRecord4Ds = new TProduct.Model.MonitorRecord4DsList();
|
foreach (var db in allMonitorPointList)
|
{
|
if (db.MonitorType == TProduct.Model.eMonitorType.功率)
|
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, testP));
|
if (db.MonitorType == TProduct.Model.eMonitorType.压力 && db.Property == TProduct.Model.MonitorTypeProperty.进口)
|
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, p1m));
|
if (db.MonitorType == TProduct.Model.eMonitorType.压力 && db.Property == TProduct.Model.MonitorTypeProperty.出口)
|
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, p2m));
|
if (db.MonitorType == TProduct.Model.eMonitorType.流量)
|
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, testQ));
|
if (db.MonitorType == TProduct.Model.eMonitorType.转速)
|
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, rTestSpeed));
|
if (db.MonitorType == TProduct.Model.eMonitorType.电机效率)
|
{
|
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, 100));
|
}
|
}
|
radomRecord.MonitorRecordList = monitorRecord4Ds;
|
radomRecord.MonitorRecords = monitorRecord4Ds.ToDsString();
|
|
radomRecord.ID = bll.Add(testItem, radomRecord);
|
}
|
testItem.PointNumber = pointInfoQH.Count();
|
new BLL.TestProjectItem().UpdatePointNumberAndTime(testItem.ItemID, testItem.PointNumber);
|
}
|
|
/// <summary>
|
/// 通过对话框添加测试
|
/// </summary>
|
/// <param name="Series"></param>
|
/// <param name="ProductID"></param>
|
protected void AddTestByDialog(long SeriesID, long ProductID)
|
{
|
var dlg = new AddTest泵厂Dlg();
|
dlg.SetBindingData(SeriesID, ProductID);
|
dlg.OnAddTest += (prj_items, dataSouceType) =>
|
{
|
if (prj_items == null)
|
return;
|
var workBench = dlg.SelWorkBenchBase;
|
var part = dlg.SelPart;
|
var pump = dlg.SelProductPump;
|
var series = dlg.SelProductSeries;
|
|
CurrentViewModel feat_test_viewModel = null;
|
|
List<CurrentViewModel> vCurrents = new List<CurrentViewModel>();
|
foreach (var test_item in prj_items)
|
{
|
var vCurrent = new CurrentViewModel(test_item);
|
vCurrent.TestUserName = TProduct.WinFrmUI.GlobeParas.CurrentLoginUser.RealName;
|
|
|
vCurrent.WorkBenchName = workBench.Name;
|
vCurrent.WorkBench = workBench;
|
vCurrent.PartNO = part.Code;
|
vCurrent.PartName = part.Name;
|
vCurrent.Part = part;
|
vCurrent.SenderName = _allSenderbases.Find(x => x.ID == part.SenderID)?.ShortName;
|
vCurrent.ManufacturerName = _allManufacturers.Find(x => x.ID == part.ManufacturerID)?.ShortName;
|
|
vCurrent.ProductName = pump.Name;
|
vCurrent.Pump = pump;
|
|
vCurrent.SeriesName = series.Name;
|
vCurrent.Series = series;
|
|
vCurrents.Add(vCurrent);
|
if (vCurrent.Entity.TestType == Model.eTestType.FeatTest)
|
feat_test_viewModel = vCurrent;
|
}
|
|
|
if (this._bindList == null)
|
this._bindList = new List<CurrentViewModel>();
|
this._bindList.AddRange(vCurrents);
|
this._bindingSource.ResetBindings(false);
|
|
|
if (dataSouceType == 1)
|
{
|
ViewTest(feat_test_viewModel, true);
|
}
|
else if (dataSouceType == 2 && feat_test_viewModel != null)
|
{//单点生成
|
CreateDemoDataByOnePoint(
|
dlg.SelProductPump,
|
dlg.SelPart,
|
feat_test_viewModel.Entity,
|
dlg.SelWorkBenchBase);
|
|
ViewTest(feat_test_viewModel, false);
|
}
|
else
|
{
|
TProduct.WinFrmUI.WaitFrmHelper.ShowWaitForm();
|
var frmIngTest = new TPump.FeatTestIngMainDialog();
|
frmIngTest.WindowState = FormWindowState.Maximized;
|
frmIngTest.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
|
frmIngTest.SetBindingData(
|
pump, part,
|
feat_test_viewModel.Entity,
|
workBench);
|
if (frmIngTest.ShowDialog() == DialogResult.Yes)
|
{
|
ViewTest(feat_test_viewModel, true);
|
}
|
}
|
};
|
ShowCmdOperateInfo("添加测试");
|
dlg.ShowDialog();
|
ShowCmdOperateInfo(_pageOperateInfo);
|
if (dlg.IsChangePumpList())
|
{//放在ShowDialog 之后
|
_allPumpList = new BLL.ProductPump().GetExAll();
|
}
|
}
|
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="view_items"></param>
|
protected void SetItemNpsh(List<CurrentViewModel> view_items)
|
{
|
var ref_view_model = view_items.First();
|
|
var items = (from x in view_items select x.Entity).ToList();
|
SetNpshTestItemsDialog frm = new SetNpshTestItemsDialog();
|
frm.SetBindingData(items);
|
frm.OnAddItem += (item) =>
|
{
|
var vCurrent = new CurrentViewModel(item);
|
vCurrent.TestUserName = TProduct.WinFrmUI.GlobeParas.CurrentLoginUser.RealName;
|
|
vCurrent.WorkBenchName = ref_view_model.WorkBenchName;
|
vCurrent.WorkBench = ref_view_model.WorkBench;
|
|
vCurrent.PartNO = ref_view_model.PartNO;
|
vCurrent.PartName = ref_view_model.PartName;
|
vCurrent.Part = ref_view_model.Part;
|
vCurrent.SenderName = ref_view_model.SenderName;
|
vCurrent.ManufacturerName = ref_view_model.ManufacturerName;
|
|
|
vCurrent.ProductName = ref_view_model.ProductName;
|
vCurrent.Pump = ref_view_model.Pump;
|
|
|
vCurrent.SeriesName = ref_view_model.SeriesName;
|
vCurrent.Series = ref_view_model.Series;
|
|
this._bindList.Add(vCurrent);
|
_bindingSource.ResetBindings(false);
|
};
|
frm.OnDeleteItem += (item) =>
|
{
|
var f = this._bindList.Find(x => x.Entity.ItemID == item.ItemID);
|
if (f != null)
|
{
|
this._bindList.Remove(f);
|
}
|
_bindingSource.ResetBindings(false);
|
};
|
frm.OnChangeItemName += (id, itemName) =>
|
{
|
var f = this._bindList.Find(x => x.Entity.ItemID == id);
|
if (f != null)
|
{
|
f.Entity.ItemName = itemName;
|
}
|
_bindingSource.ResetBindings(false);
|
};
|
|
|
if (frm.ShowDialog() == DialogResult.OK)
|
{
|
|
}
|
}
|
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="selRow"></param>
|
protected void EditTest(CurrentViewModel selRow)
|
{
|
if (selRow.Entity.TestType == Model.eTestType.FeatTest)
|
{
|
EditFeatTest(selRow);
|
}
|
else if (selRow.Entity.TestType == Model.eTestType.NpshTest)
|
{
|
EditNpshTest(selRow);
|
}
|
}
|
|
protected void EditFeatTest(CurrentViewModel selRow)
|
{
|
var items = selRow.Entity;
|
if (items == null)
|
return;
|
var dlg = new EditFeatItem泵厂Dlg();
|
dlg.SetBindingData(items);
|
dlg.OnEditTest += (testItem) =>
|
{
|
if (testItem == null)
|
return;
|
selRow.RestItem(testItem);
|
//进去测试时,可能产品信息改了,所有重新获取一下
|
if(selRow.Pump != null)
|
selRow.Pump = new BLL.ProductPump().GetExByProductID(selRow.Pump.ID);
|
|
TProduct.WinFrmUI.WaitFrmHelper.ShowWaitForm();
|
var frmIngTest = new TPump.FeatTestIngMainDialog();
|
frmIngTest.WindowState = FormWindowState.Maximized;
|
frmIngTest.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
|
frmIngTest.SetBindingData(
|
dlg.SelectPump, dlg.SelectPart,
|
testItem,
|
dlg.SelWorkBench);
|
frmIngTest.OnChangeProductInfo += (pump, motor) =>
|
{
|
if (selRow.Pump != null)
|
selRow.Pump = pump;
|
};
|
frmIngTest.OnChangeTestInfo += (item) =>
|
{
|
selRow.RestItem(item);
|
};
|
//frm.Show();
|
if (frmIngTest.ShowDialog() == DialogResult.Yes)
|
{
|
ViewTest(selRow, true);
|
}
|
};
|
dlg.ShowDialog();
|
if (dlg.IsChangePumpList())
|
{//放在ShowDialog 之后
|
_allPumpList = new BLL.ProductPump().GetExAll();
|
}
|
}
|
protected void EditNpshTest(CurrentViewModel selRow)
|
{
|
var items = selRow.Entity;
|
if (items == null)
|
return;
|
var dlg = new EditNpshItem泵厂Dlg();
|
dlg.SetBindingData(items);
|
dlg.OnEditTest += (testItem) =>
|
{
|
if (testItem == null)
|
return;
|
selRow.RestItem(testItem);
|
|
TProduct.WinFrmUI.WaitFrmHelper.ShowWaitForm();
|
var frm = new TPump.NpshTestIngMainDialog();
|
frm.WindowState = FormWindowState.Maximized;
|
frm.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
|
frm.SetBindingData(
|
dlg.SelProductPump, dlg.SelPart,
|
testItem,
|
dlg.SelWorkBench);
|
frm.OnChangeProductInfo += (pump, motor) =>
|
{
|
selRow.Pump = pump;
|
};
|
frm.OnChangeTestInfo += (item) =>
|
{
|
selRow.RestItem(item);
|
};
|
frm.ShowDialog();
|
|
|
};
|
dlg.ShowDialog();
|
if (dlg.IsChangePumpList())
|
{//放在ShowDialog 之后
|
_allPumpList = new BLL.ProductPump().GetExAll();
|
}
|
}
|
|
protected virtual void ViewTest(CurrentViewModel selRow, bool isDelay)
|
{
|
var all_views = (from x in this._bindList where x.ProjectID == selRow.ProjectID select x).ToList();
|
var feat_view = all_views.Find(x => x.Entity.TestType == Model.eTestType.FeatTest);
|
//进去测试时,可能产品信息改了,所有重新获取一下
|
if(selRow.Pump != null)
|
selRow.Pump = new BLL.ProductPump().GetExByProductID(selRow.Pump.ID);
|
|
var viewPage = new FeatTestViewMainPage();
|
viewPage.Name = "FeatTestViewMainPumpPage";
|
|
//修改了测试信息
|
viewPage.OnChangeFeatTestInfo += (item) =>
|
{//只针对性能测试
|
if (feat_view != null)
|
feat_view.RestItem(item);
|
this._bindingSource.ResetBindings(false);
|
};
|
viewPage.OnChangeTestItemInfo += (item) =>
|
{//只针对所有测试
|
var view = all_views.Find(x => x.ItemID == item.ItemID);
|
view.RestItem(item);
|
this._bindingSource.ResetBindings(false);
|
};
|
viewPage.OnChangeTestProjectInfo += (prj) =>
|
{//只针对所有测试
|
foreach (var view in all_views)
|
view.RestProject(prj);
|
this._bindingSource.ResetBindings(false);
|
};
|
viewPage.OnChangeJudgeResult += (prj, item) =>
|
{
|
feat_view.JudgeResult = item.ToString();
|
this._bindingSource.ResetBindings(false);
|
};
|
|
viewPage.OnChangeProductInfo += (pump, motor) =>
|
{
|
feat_view.Pump = pump;
|
};
|
var items = all_views.Select(x => x.Entity).ToList();
|
viewPage.SetBindingData(
|
selRow.Pump, selRow.Part,
|
items);
|
|
var detail_guid = new SurfaceGuid()
|
{
|
DockType = eDockType.Tab,
|
Modular = eModular.PumpTest,
|
Function = "PumpTestView",
|
TagName = String.Format("PumpTestView{0}", selRow.ProjectID)
|
};
|
|
if (isDelay)
|
{
|
Task.Factory.StartNew(() =>
|
{
|
Task.Delay(500).ContinueWith(t =>
|
{
|
this.Invoke(new MethodInvoker(delegate
|
{
|
OpenNewPageInMain(viewPage, detail_guid);
|
}));
|
});
|
});
|
}
|
else
|
{
|
OpenNewPageInMain(viewPage, detail_guid);
|
}
|
|
}
|
|
|
protected int BuilViewModelList(
|
List<Model.TestProjectItemView> all_project_item, long senderID)
|
{
|
if (all_project_item == null || all_project_item.Count() == 0)
|
{
|
_bindList = new List<CurrentViewModel>();
|
|
this._bindingSource.DataSource = _bindList;
|
this._bindingSource.ResetBindings(false);
|
|
return 0;
|
}
|
var part_ids = (from x in all_project_item where x.PartID > 0 select x.PartID).Distinct();
|
|
List<Model.PartBase> allParts = null;
|
if (part_ids.Count() > 0)
|
{
|
var partBaseBll = new BLL.PartBase();
|
allParts = partBaseBll.GetByIds(part_ids.ToList());
|
}
|
|
if (_allSeries == null)
|
_allSeries = new BLL.ProductSeries().GetByProductType(Model.eProductType.Pump);
|
|
|
|
|
_bindList = new List<CurrentViewModel>();
|
|
foreach (var project_item in all_project_item)
|
{
|
CurrentViewModel v = new CurrentViewModel(project_item);
|
|
v.TestUserName = _allUsers?.Find(x => x.ID == project_item.LastTestUserID)?.RealName;
|
|
v.JudgeResult = project_item.ItemJudgeResult.ToString();
|
|
var workBench = _allWorkBenchs.Find(x => x.ID == project_item.BenchID);
|
if (workBench == null)
|
continue;
|
|
v.WorkBenchName = workBench.Name;
|
v.WorkBench = workBench;
|
|
if(project_item.ProductID == 0 || project_item.PartID == 0)
|
{
|
v.PartNO = "未指定";
|
v.PartName = "未指定";
|
}
|
else if (allParts != null)
|
{
|
var part = allParts.Find(x => x.ID == project_item.PartID);
|
if (part == null)
|
continue;
|
if (senderID > 0)
|
{
|
if (part.SenderID != senderID)
|
continue;
|
}
|
|
v.PartNO = part.Code;
|
v.PartName = part.Name;
|
v.Part = part;
|
v.SenderName = _allSenderbases.Find(x => x.ID == part.SenderID)?.ShortName;
|
v.ManufacturerName = _allManufacturers.Find(x => x.ID == part.ManufacturerID)?.ShortName;
|
}
|
|
if(project_item.ProductID >0)
|
{
|
var pump = _allPumpList.Find(x => x.ID == project_item.ProductID);
|
if (pump != null)
|
{
|
v.ProductName = pump.Name;
|
v.Pump = pump;
|
}
|
}
|
else {
|
v.ProductName = "未指定";
|
}
|
|
if(project_item.SeriesID > 0)
|
{
|
if (_allSeries != null)
|
{
|
var series = _allSeries.Find(x => x.ID == project_item.SeriesID);
|
if (series != null)
|
{
|
v.SeriesName = series.Name;
|
v.Series = series;
|
}
|
else
|
{
|
v.SeriesName = "Error:596";
|
}
|
}
|
}
|
else
|
{
|
v.SeriesName = "未指定";
|
}
|
|
|
_bindList.Add(v);
|
}
|
|
|
return _bindList.Count();
|
}
|
|
|
}
|
}
|