using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TProduct.Model;
using static DevExpress.Data.Helpers.ExpressiveSortInfo;
namespace TProduct.DataTran.FromBPump
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
///
/// X86运行
///
///
///
private void simpleButton1_Click(object sender, EventArgs e)
{
if (!System.IO.File.Exists(access_file_path))
{
return;
}
var user_id = 1;
var now = DateTime.Now;
var allWorkBenchBase = new BLL.WorkBenchBase().GetByProductType(TProduct.Model.eProductType.Pump);
if (allWorkBenchBase == null || allWorkBenchBase.Count() == 0)
{
XtraMessageBox.Show("请手动添加默认测试台!");
return;
}
Model.WorkBenchBase selWorkBench进口压力 = null;
Model.WorkBenchBase selWorkBench清水池 = null;
foreach (var benchBase in allWorkBenchBase)
{
if (string.IsNullOrEmpty(benchBase.TestMethod))
{
continue;
}
var method = new Model.WorkBenchMethod4Pump(benchBase.TestMethod);
if (method.InletIsUseWaterLevel == 1)
{
selWorkBench清水池 = benchBase;
}
else
{
selWorkBench进口压力 = benchBase;
}
//this.imgComPowerTestMethod.EditValue = method.Power;
//this.imgComPressTestMethod.EditValue = method.Press;
//this.imgComTorqueTestMethod.EditValue = method.Torque;
//this.imgComeNpshTestMethod.EditValue = method.Npsh;
//this.check用清水池水位代替进口压力.Checked = method.InletIsUseWaterLevel == 1 ? true : false;
}
if (selWorkBench清水池 == null)
{
XtraMessageBox.Show("请手动添加默认测试台(用清水池测试进口压力)!");
return;
}
if (selWorkBench进口压力 == null)
{
XtraMessageBox.Show("请手动添加默认测试台(用进口压力仪)!");
return;
}
var _allMeters = new BLL.PressureMeter().GetAll();
if (_allMeters == null || _allMeters.Count() == 0)
{
XtraMessageBox.Show("请添加压力计!");
return;
}
var inlet_press_压力计 = _allMeters.Find(x => x.RangeMin == -0.1 && x.RangeMax == 0.1);
if (inlet_press_压力计 == null)
{
XtraMessageBox.Show("请手动添加量程正负0.1的压力计!");
return;
}
var outlet_press_压力计 = _allMeters.Find(x => x.RangeMin == 0 && x.RangeMax == 1);
if (outlet_press_压力计 == null)
{
XtraMessageBox.Show("请手动添加量程0-1的压力计!");
return;
}
var bllStation = new BLL.StationBase();
List allStation_tproduct = bllStation.GetAll();
if (allStation_tproduct == null)
allStation_tproduct = new List();
#region ProductStyle
var bllProductStyle = new BLL.ProductStyle();
List allProductStyle_tproduct = bllProductStyle.GetAll();
if (allProductStyle_tproduct == null)
allProductStyle_tproduct = new List();
var productStyle双吸泵 = allProductStyle_tproduct.Find(x => x.Name == "双吸泵");
if (productStyle双吸泵 == null)
{
productStyle双吸泵 = new Model.ProductStyle();
productStyle双吸泵.Name = "双吸泵";
productStyle双吸泵.Type = Model.eProductType.Pump;
productStyle双吸泵.CreateUserID = user_id;
productStyle双吸泵.CreateTime = now;
productStyle双吸泵.UpdateUserID = user_id;
productStyle双吸泵.UpdateTime = now;
productStyle双吸泵.SortCode = 1;
productStyle双吸泵.ID = bllProductStyle.Insert(productStyle双吸泵);
}
var productStyle常规电机 = allProductStyle_tproduct.Find(x => x.Name == "常规电机");
if (productStyle常规电机 == null)
{
productStyle常规电机 = new Model.ProductStyle();
productStyle常规电机.Name = "常规电机";
productStyle常规电机.Type = Model.eProductType.Pump;
productStyle常规电机.CreateUserID = user_id;
productStyle常规电机.CreateTime = now;
productStyle常规电机.UpdateUserID = user_id;
productStyle常规电机.UpdateTime = now;
productStyle常规电机.SortCode = 2;
productStyle常规电机.ID = bllProductStyle.Insert(productStyle常规电机);
}
#endregion
#region ProductSeries
var bllProductSeries = new BLL.ProductSeries();
List allProductSeries_tproduct = bllProductSeries.GetAll();
if (allProductSeries_tproduct == null)
allProductSeries_tproduct = new List();
var productSeries双吸泵 = allProductSeries_tproduct.Find(x => x.Name == "双吸泵");
if (productSeries双吸泵 == null)
{
productSeries双吸泵 = new Model.ProductSeries();
productSeries双吸泵.Name = "双吸泵";
productSeries双吸泵.ProductStyleID = productStyle双吸泵.ID;
productSeries双吸泵.CreateUserID = user_id;
productSeries双吸泵.CreateTime = now;
productSeries双吸泵.UpdateUserID = user_id;
productSeries双吸泵.UpdateTime = now;
productSeries双吸泵.SortCode = 1;
productSeries双吸泵.IsInnerMotor = 0;
productSeries双吸泵.ID = bllProductSeries.Insert(productSeries双吸泵);
}
var productSeries常规电机 = allProductSeries_tproduct.Find(x => x.Name == "常规电机");
if (productSeries常规电机 == null)
{
productSeries常规电机 = new Model.ProductSeries();
productSeries常规电机.Name = "双吸泵";
productSeries常规电机.ProductStyleID = productStyle常规电机.ID;
productSeries常规电机.CreateUserID = user_id;
productSeries常规电机.CreateTime = now;
productSeries常规电机.UpdateUserID = user_id;
productSeries常规电机.UpdateTime = now;
productSeries常规电机.SortCode = 2;
productSeries常规电机.ID = bllProductSeries.Insert(productSeries常规电机);
}
#endregion
#region 产品
var bllProductMotor = new BLL.ProductMotor();
List allMotor_tproduct = bllProductMotor.GetExBySeriesID(productSeries常规电机.ID);
if (allMotor_tproduct == null)
allMotor_tproduct = new List();
var bllProductPump = new BLL.ProductPump();
List allPump_tproduct = bllProductPump.GetExBySeriesID(productSeries双吸泵.ID);
if (allPump_tproduct == null)
allPump_tproduct = new List();
var bllPartBase = new BLL.PartBase();
List allPartBase_tproduct = bllPartBase.GetAll();
if (allPartBase_tproduct == null)
allPartBase_tproduct = new List();
var bllManufacturerBase = new BLL.ManufacturerBase();
List allManufacturertproduct = bllManufacturerBase.GetAll();
if (allManufacturertproduct == null)
allManufacturertproduct = new List();
#endregion
var bllTestProject = new BLL.TestProject();
List allProject_tproduct = bllTestProject.GetAll();
if (allProject_tproduct == null)
allProject_tproduct = new List();
var bllTestProjectItem = new BLL.TestProjectItem();
List allItem_tproduct = bllTestProjectItem.GetAll();
if (allItem_tproduct == null)
allItem_tproduct = new List();
#region 泵站转化
//Factorys
var factorysDataSet = Read("Factorys");
List allFactorys_bpump = BPump.Model.Factorys.DataTableToList(factorysDataSet.Tables[0]);
int SortCode = 1;
foreach (var bp in allFactorys_bpump)
{
TProduct.Model.StationBase station_tproduct = allStation_tproduct.Find(x => x.Tag == bp.FactoryID.ToString());
if (station_tproduct != null)
{
continue;
}
station_tproduct = new Model.StationBase();
station_tproduct.CreateUserID = user_id;
station_tproduct.CreateTime = now;
station_tproduct.UpdateUserID = user_id;
station_tproduct.UpdateTime = now;
station_tproduct.Code = "";
station_tproduct.Name = bp.FactoryName;
station_tproduct.Note = "";
station_tproduct.Tag = bp.FactoryID.ToString();
station_tproduct.SortCode = SortCode;
station_tproduct.ParasStr = "";
station_tproduct.ID = bllStation.Insert(station_tproduct);
allStation_tproduct.Add(station_tproduct);
SortCode++;
}
#endregion
#region 产品转化
var motorsDataSet = Read("Motors");
List allMotors_bpump = BPump.Model.Motors.DataTableToList(motorsDataSet.Tables[0]);
if (allMotors_bpump != null)
{
SortCode = 1;
foreach (var bp in allMotors_bpump)
{
var productmain_tproduct = allMotor_tproduct.Find(x => x.Tag == bp.MotorID.ToString());
if (productmain_tproduct != null)
{
continue;
}
productmain_tproduct = new ProductMainExMotor();
productmain_tproduct.Tag = bp.MotorID.ToString();
productmain_tproduct.CreateUserID = user_id;
productmain_tproduct.CreateTime = now;
productmain_tproduct.UpdateUserID = user_id;
productmain_tproduct.UpdateTime = now;
productmain_tproduct.Name = bp.MotorCode;
productmain_tproduct.SeriesID = productSeries常规电机.ID;
var ratedparas = new TProduct.Model.RatedParas4Motor();
ratedparas.CurrentType = Model.eSupplyCurrentType.交流;
productmain_tproduct.RatedParas = ratedparas.ToJson();
productmain_tproduct.SortCode = SortCode;
productmain_tproduct.RatedPower = bp.MotorPower;
productmain_tproduct.PowerFactor = bp.MotorFactor;
productmain_tproduct.RatedI = bp.RatedI;
productmain_tproduct.RatedU = bp.RatedU;
productmain_tproduct.Ratedn = bp.RatedN;
productmain_tproduct.PhaseNum = Model.eSupplyCurrentPhase.三相;
productmain_tproduct.ID = bllProductMotor.InsertEx(productmain_tproduct);
SortCode++;
allMotor_tproduct.Add(productmain_tproduct);
}
}
var pumpsDataSet = Read("Pumps");
List allPumps_bpump = BPump.Model.Pumps.DataTableToList(pumpsDataSet.Tables[0]);
if (allPumps_bpump == null || allPumps_bpump.Count() == 0)
return;
SortCode = 1;
foreach (var bp in allPumps_bpump)
{
var productmain_tproduct = allPump_tproduct.Find(x => x.Tag == bp.PumpID.ToString());
if (productmain_tproduct != null)
{
continue;
}
productmain_tproduct = new ProductMainExPump();
productmain_tproduct.Tag = bp.PumpID.ToString();
productmain_tproduct.CreateUserID = user_id;
productmain_tproduct.CreateTime = now;
productmain_tproduct.UpdateUserID = user_id;
productmain_tproduct.UpdateTime = now;
//productmain_tproduct.Code = bp.PumpCode;
productmain_tproduct.Name = bp.PumpCode;
productmain_tproduct.SeriesID = productSeries双吸泵.ID;
var ratedparas = new TProduct.Model.RatedParas4Pump();
ratedparas.CurrentType = Model.eSupplyCurrentType.交流;
ratedparas.Q = bp.RatedParas.Q;
ratedparas.H = bp.RatedParas.H;
ratedparas.P = bp.RatedParas.P;
ratedparas.E = bp.RatedParas.E;
ratedparas.NPSHr = bp.RatedParas.NPSHr;
ratedparas.IsFrequency = bp.IsFrequency;
ratedparas.IsSxp = true;
ratedparas.StageNumber = 1;
productmain_tproduct.RatedParas = ratedparas.ToJson();
productmain_tproduct.MotorMainID = 0;
if (bp.MotorID > 0)
{
var motor = allMotor_tproduct.Find(x => x.Tag == bp.MotorID.ToString());
if (motor != null)
{
productmain_tproduct.MotorMainID = motor.ID;
}
}
productmain_tproduct.Ratedn = bp.RatedN;
productmain_tproduct.D2 = bp.OriginD2;
productmain_tproduct.PosiAngle = 0;
productmain_tproduct.SortCode = SortCode;
SortCode++;
productmain_tproduct.CurveFitTypeQH = Eventech.Model.eCurveFitType.CubicCurve;
productmain_tproduct.CurveFitTypeQE = Eventech.Model.eCurveFitType.CubicCurve;
productmain_tproduct.CurveFitTypeQP = Eventech.Model.eCurveFitType.CubicCurve;
productmain_tproduct.ID = bllProductPump.InsertEx(productmain_tproduct);
allPump_tproduct.Add(productmain_tproduct);
TProduct.Model.PartBase part = new TProduct.Model.PartBase();
part.Name = bp.PumpName;
part.ManufacturerID = 0;
part.ProductMainID = productmain_tproduct.ID;
var station = allStation_tproduct.Find(x => x.Tag == bp.FactoryID.ToString());
if (station != null)
part.StationID = station.ID;
if (!string.IsNullOrEmpty(bp.PumpManufacturer))
{
var manu = allManufacturertproduct.Find(x => x.FullName == bp.PumpManufacturer);
if (manu != null)
{
part.ManufacturerID = manu.ID;
}
else
{
manu = new ManufacturerBase();
manu.CreateUserID = user_id;
manu.CreateTime = now;
manu.UpdateUserID = user_id;
manu.UpdateTime = now;
manu.ShortName = bp.PumpManufacturer;
manu.FullName = bp.PumpManufacturer;
manu.ID = bllManufacturerBase.Insert(manu);
part.ManufacturerID = manu.ID;
}
}
part.ID = bllPartBase.Insert(part);
allPartBase_tproduct.Add(part);
}
#endregion
var tproduct_monitor_points_all = new BLL.WorkBenchMonitorPoint().GetAll();
var testsDataSet = Read("Tests");
List allTests_bpump = BPump.Model.Tests.DataTableToList(testsDataSet.Tables[0]);
var testDatassDataSet = Read("TestDatas");
List allTestDatas_bpump = BPump.Model.TestDatas.DataTableToList(testDatassDataSet.Tables[0]);
var bllTestRecord = new BLL.PumpFeatTestRecord();
foreach (var test_bp in allTests_bpump)
{
var test_dataS_bp = allTestDatas_bpump.Where(x => x.TestID == test_bp.TestID);
if (test_dataS_bp == null || test_dataS_bp.Count() < 3)
continue;
var project = allProject_tproduct.Find(x => x.Tag == test_bp.TestID.ToString());
if (project != null)
{
continue;
}
var pump = allPump_tproduct.Find(x => x.Tag == test_bp.PumpID.ToString());
if (pump == null)
{
continue;
}
var part = allPartBase_tproduct.Find(x => x.ProductMainID == pump.ID);
if (part == null)
{
continue;
}
//if (part.Name != "低压1#泵")
//{
// continue;
//}
Dictionary dict = BPump.Common.TypeConvert.StringToDict(test_bp.MethodParas);
BPump.Model.eInletPressMethod inletMethod = BPump.Model.eInletPressMethod.泵进口压力;
if (dict.ContainsKey("进口压力"))
{
string strValue = dict["进口压力"];
inletMethod=(BPump.Model.eInletPressMethod)Convert.ToInt32(strValue);
}
Model.WorkBenchBase selWorkBench = null;
switch (inletMethod)
{
case BPump.Model.eInletPressMethod.泵进口压力:
selWorkBench = selWorkBench进口压力;
break;
case BPump.Model.eInletPressMethod.清水池高度:
selWorkBench = selWorkBench清水池;
break;
}
if (selWorkBench == null)
{
MessageBox.Show("对应测试台无法找到");
return;
}
List points = new List();
MonitorPointBundle point转速 = null;
var mp_电机效率 = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID && x.MonitorType == eMonitorType.电机效率);
var mp_电机频率 = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID && x.MonitorType == eMonitorType.频率);
string[] strMeasureList = test_bp.MeasureList.Split(',');
for (int i = 0; i < strMeasureList.Count(); i++)
{
var strMeasure = strMeasureList[i];
string[] details = strMeasure.Split('|');
int measureType = Convert.ToInt32(details[0]);//第一个是类型
string MeasureName = details[1];// 第二个是名称 第三个是系数
MonitorPointBundle point = new MonitorPointBundle() { IndexBP = i };
points.Add(point);
if (measureType == (int)BPump.Model.eMeasureType.泵进口压力)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.进口);
}
else if (measureType == (int)BPump.Model.eMeasureType.泵出口压力)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.出口);
}
else if (measureType == (int)BPump.Model.eMeasureType.流量)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.流量);
}
else if (measureType == (int)BPump.Model.eMeasureType.功率)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.功率);
}
else if (measureType == (int)BPump.Model.eMeasureType.总管出口压力)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.出口);
}
else if (measureType == (int)BPump.Model.eMeasureType.总管进口压力)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.进口);
}
else if (measureType == (int)BPump.Model.eMeasureType.泵出口阀后压力)
{
}
else if (measureType == (int)BPump.Model.eMeasureType.泵进口阀前压力)
{
}
else if (measureType == (int)BPump.Model.eMeasureType.并联泵出口压力)
{
}
else if (measureType == (int)BPump.Model.eMeasureType.转速)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.转速);
point转速 = point;
}
else if (measureType == (int)BPump.Model.eMeasureType.介质温度)
{
}
else if (measureType == (int)BPump.Model.eMeasureType.轴温)
{
}
else if (measureType == (int)BPump.Model.eMeasureType.清水池高度)
{
point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.水位);
}
else if (measureType == (int)BPump.Model.eMeasureType.相电流A || measureType == (int)BPump.Model.eMeasureType.相电流B ||
measureType == (int)BPump.Model.eMeasureType.相电流C)
{
}
else if (measureType == (int)BPump.Model.eMeasureType.相电压A || measureType == (int)BPump.Model.eMeasureType.相电压B ||
measureType == (int)BPump.Model.eMeasureType.相电压C)
{
}
else if (measureType == (int)BPump.Model.eMeasureType.总管出口压力)
{
}
}
Dictionary dictEquip = BPump.Common.TypeConvert.StringToDict(test_bp.EquipParas);
Dictionary dictUnit = BPump.Common.TypeConvert.StringToDict(test_bp.DispUnitParas);
Dictionary dictMethod = BPump.Common.TypeConvert.StringToDict(test_bp.MethodParas);
Dictionary dictEnvi = BPump.Common.TypeConvert.StringToDict(test_bp.EnviParas);
//BPump.Model.ePowerTestMethod powerMethod = BPump.Model.ePowerTestMethod.功率;
//switch (powerMethod)
//{
// case BPump.Model.ePowerTestMethod.功率:
// break;
// case BPump.Model.ePowerTestMethod.扭矩:
// break;
// case BPump.Model.ePowerTestMethod.单相电流电压:
// break;
// case BPump.Model.ePowerTestMethod.三相电流电压:
// break;
//}
//BPump.Model.eOutletPressMethod outletMethod = BPump.Model.eOutletPressMethod.泵出口压力;
//switch (outletMethod)
//{
// case BPump.Model.eOutletPressMethod.泵出口压力:
// break;
// case BPump.Model.eOutletPressMethod.总管压力:
// break;
//}
double inlet_meter_dia = 0, inlet_meter_ele = 0;
double outlet_meter_dia = 0, outlet_meter_ele = 0;
double ele_dis = 0;
foreach (var record in dictEquip)
{
string strValue = record.Value;
switch (record.Key)
{
case "进口直径":
inlet_meter_dia = Convert.ToDouble(strValue);
break;
case "出口直径":
outlet_meter_dia = Convert.ToDouble(strValue);
break;
case "表位差":
ele_dis = Convert.ToDouble(strValue) ;//存储的是m 显示为mm
break;
case "进口压力表高":
inlet_meter_ele = Convert.ToDouble(strValue);
break;
case "出口压力表高":
outlet_meter_ele = Convert.ToDouble(strValue);
break;
//case "水位基准高":
// this.spinShuiWeiJizhun.Value = Convert.ToDecimal(strValue);
// break;
case "高差":
break;
}
}
var first_time = (from x in test_dataS_bp select x.TestTime).Min();
project = new TestProjectBase();
project.ProductType = eProductType.Pump;
project.SeriesID = pump.SeriesID;
project.ProductID = pump.ID;
project.PartID = part.ID;
project.CreateUserID = user_id;
project.CreateTime = first_time;
project.Name = test_bp.TestName;
project.IsFixed = true;
project.UseStatus = eUseStatus.Enable;
project.JudgeResult = eTestJudgeResult.未判断;
project.ProjectParas = new TestProjectParas();
project.Tag = test_bp.TestID.ToString();
Model.TestProjectItemBundleTree bundleTree = new Model.TestProjectItemBundleTree();
bundleTree.Bundle = new TProduct.Model.TestProjectItemBundle()
{
TestType = TProduct.Model.eTestType.FeatTest,
BenchID = selWorkBench.ID,//暂时统一测试台, 统一标准, 以后改成可以通过界面设置
TestStandardID = "GB3216-2016",
TestGradeID = "GB3216-2016-2B",
ItemCount = 1
};
var instrument = new Model.PrjItemInstrumentSetting()
{
InletPressureMeterID = inlet_press_压力计.ID,
InletPressureMeterElevation = inlet_meter_ele - ele_dis,//清水池水位标高也放在这里
InletPressureMeterPipeDia = inlet_meter_dia,
OutletPressureMeterID = outlet_press_压力计.ID,
OutletPressureMeterElevation = outlet_meter_ele,
OutletPressureMeterPipeDia = outlet_meter_dia,
//FlowMeterRangeMax = flow_range_max,
//FlowMeterRangeMin = flow_range_min,
};
var featTestItem = new TProduct.Model.TestProjectItem()
{
CreateTime = first_time,
CreateUserID = user_id,
LastTestUserID = user_id,
Name = "性能测试",
TestType = TProduct.Model.eTestType.FeatTest,
JudgeResult = TProduct.Model.eTestJudgeResult.未判断,
UseStatus = TProduct.Model.eUseStatus.Enable,
InstrumentInfo = instrument,
AutoTestInfo = null,
DurabilityTestInfo = null,
ItemParas = null
};
bundleTree.Items = new List() { featTestItem };
var test_views = bllTestProject.Insert(project, new List() { bundleTree });
var default_test_item_view = test_views.First();
project.ID = default_test_item_view.ProductID;
var project_item_id = default_test_item_view.ItemID;
foreach (var bp_record in test_dataS_bp)
{
TProduct.Model.MonitorRecord4DsList monitorRecord4Ds = new TProduct.Model.MonitorRecord4DsList();
TProduct.Model.PumpFeatTestRecord record = new PumpFeatTestRecord();
string[] strMeasureRecord = bp_record.MeasureRecord.Split(',');
for (int i = 0; i < strMeasureRecord.Count(); i++)
{
var bp_measureValue = Convert.ToDouble(strMeasureRecord[i]);
if (i >= points.Count)
break;
if (points[i].point == null)
continue;
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(points[i].point.ID, bp_measureValue));
}
if (mp_电机效率 != null)
{
if (bp_record.MotorEfficient < 1.1)
{
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(mp_电机效率.ID, bp_record.MotorEfficient*100));
}
else
{
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(mp_电机效率.ID, bp_record.MotorEfficient));
}
}
if (mp_电机频率 != null)
{
monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(mp_电机频率.ID, bp_record.MotorFrequence));
}
record.TestItemID = project_item_id;
record.Time = bp_record.TestTime;
record.CorrectPtQ = bp_record.CorrectQ;
record.CorrectPtH = bp_record.CorrectH;
record.CorrectPtE = bp_record.CorrectE;
record.CorrectPtP = bp_record.CorrectP;
record.TestPtQ = bp_record.TestQ;
record.TestPtH = bp_record.TestH;
record.TestPtE = bp_record.TestE;
record.TestPtP = bp_record.TestP;
record.Speed = 0;
if(point转速 != null)
{
record.Speed = Convert.ToDouble(strMeasureRecord[point转速.IndexBP]);
}
record.MonitorRecords = monitorRecord4Ds.ToDsString();
record.RecordType = eRecordType.Import;
record.ID = bllTestRecord.Add(default_test_item_view, record);
}
}
MessageBox.Show("转化完成");
}
class MonitorPointBundle
{
public TProduct.Model.MonitorPointBase point { get; set; }
public int IndexBP { get; set; }
}
string access_file_path = @"D:\WorkData\TProduct\Client.V1.3.1\Out\Data中山公用\DB.mdb";
private System.Data.DataSet Read(string tableName)
{
string connect_string = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + access_file_path + ";Jet OleDb:DataBase Password='TXSMHLY';";
OleDbConnection thisConnection = new OleDbConnection(connect_string);
// string.Format(@"provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};DataBase Password='TXSMHLY';", access_file_path)); //连接Access数据库
string sql = "select * from " + tableName;
OleDbDataAdapter thisAdapter = new OleDbDataAdapter(sql, thisConnection);
System.Data.DataSet thisDataSet = new System.Data.DataSet();
thisAdapter.Fill(thisDataSet, "table");
thisConnection.Close();
return thisDataSet;
}
}
}