using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
using System.Net;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace TProduct.OpenDto
|
{
|
public class FeatTestPackInfoHelper
|
{
|
protected TProduct.Model.ProductSeries _currentPumpSeries = null;
|
public TProduct.Model.ProductSeries CurrentPumpSeries { get => _currentPumpSeries; set => _currentPumpSeries = value; }
|
|
protected TProduct.Model.ProductMainExPump _currentPump = null;
|
public TProduct.Model.ProductMainExPump CurrentPump { get => _currentPump; set => _currentPump = value; }
|
|
protected TProduct.Model.ProductMainExMotor _currentMotor = null;
|
public TProduct.Model.ProductMainExMotor CurrentMotor { get => _currentMotor; set => _currentMotor = value; }
|
|
protected TProduct.Model.PartBase _currentPart = null;
|
public TProduct.Model.PartBase CurrentPart { get => _currentPart; set => _currentPart = value; }
|
|
protected TProduct.Model.RatedParas4Pump _ratedParas = null;
|
public TProduct.Model.RatedParas4Pump RatedParas { get => _ratedParas; set => _ratedParas = value; }
|
|
protected TProduct.Model.WorkBenchBase _workBenchInfo = null;
|
public TProduct.Model.WorkBenchBase WorkBenchInfo { get => _workBenchInfo; set => _workBenchInfo = value; }
|
|
protected TProduct.Model.TestProjectItemView _testItem = null;
|
public TProduct.Model.TestProjectItemView TestItem { get => _testItem; set => _testItem = value; }
|
|
protected List<TProduct.Model.WorkBenchMonitorPoint> _allMonitorPointList = null;
|
public List<TProduct.Model.WorkBenchMonitorPoint> AllMonitorPointList { get => _allMonitorPointList; set => _allMonitorPointList = value; }
|
|
protected List<Model.LoginUser> _allLoginUser { get; set; } = null;
|
public List<Model.LoginUser> AllLoginUser { get => _allLoginUser; set => _allLoginUser = value; }
|
|
protected List<Model.ManufacturerBase> allManufacturer { get; set; } = null;
|
public List<Model.ManufacturerBase> AllManufacturer { get => allManufacturer; set => allManufacturer = value; }
|
|
protected List<TProduct.Model.PumpFeatTestRecordViewModel> _allRecords = null;
|
public List<Model.PumpFeatTestRecordViewModel> AllRecords { get => _allRecords; set => _allRecords = value; }
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="error_info"></param>
|
/// <returns></returns>
|
public TProduct.OpenDto.IStationSynResult Synch(out string error_info)
|
{
|
error_info = null;
|
FeatTestPackInfoV1 packInfo = new FeatTestPackInfoV1();
|
packInfo.Version = "V1";
|
|
if (_allRecords == null || _allRecords.Count < 3)
|
{
|
error_info = "测试记录过少, 无法同步";
|
return null;
|
}
|
|
string url_type = TProduct.CorpConfig.Instance.TestPackRemoteService.ServiceName;
|
string url = null;
|
|
if (url_type == "SqiIStation")
|
{
|
if (TProduct.CorpConfig.Instance.IStation == null)
|
{
|
error_info = "对接配置未设置 IStation";
|
return null;
|
}
|
if (string.IsNullOrEmpty(TProduct.CorpConfig.Instance.IStation.SoftClientID))
|
{
|
error_info = "未设置 IStation SoftClientID";
|
return null;
|
}
|
if (string.IsNullOrEmpty(TProduct.CorpConfig.Instance.IStation.WebApiUrl))
|
{
|
error_info = "未设置 IStation WebApiUrl";
|
return null;
|
}
|
packInfo.TenantID = TProduct.CorpConfig.Instance.IStation.TenantID;
|
packInfo.TenantTag = TProduct.CorpConfig.Instance.IStation.TenantTag;
|
packInfo.SoftClientID = TProduct.CorpConfig.Instance.IStation.SoftClientID;
|
url = TProduct.CorpConfig.Instance.IStation.WebApiUrl + "SQI/Test/TProduct/SynProject@V1.0";
|
}
|
else
|
{
|
error_info = "TestPackRemoteService ServiceName 无法识别";
|
return null;
|
}
|
|
|
|
|
|
TProduct.OpenDto.ProductPump pump_dto = new OpenDto.ProductPump();
|
|
#region 泵信息
|
pump_dto.ID = _currentPump.ID;
|
pump_dto.CreateUserName = (from x in _allLoginUser where x.ID == _currentPump.CreateUserID select x.RealName).FirstOrDefault();
|
pump_dto.CreateTime = _currentPump.CreateTime;
|
pump_dto.UpdateUserName = (from x in _allLoginUser where x.ID == _currentPump.UpdateUserID select x.RealName).FirstOrDefault();
|
pump_dto.UpdateTime = _currentPump.UpdateTime;
|
pump_dto.Code = _currentPump.Code;
|
pump_dto.Name = _currentPump.Name;
|
pump_dto.SeriesName = this._currentPumpSeries.Name;
|
if (_ratedParas != null)
|
{
|
|
pump_dto.RatedParas = new OpenDto.RatedParas4Pump();
|
pump_dto.RatedParas.Q = _ratedParas.Q;
|
pump_dto.RatedParas.H = _ratedParas.H;
|
pump_dto.RatedParas.P = _ratedParas.P;
|
pump_dto.RatedParas.E = _ratedParas.E;
|
pump_dto.RatedParas.NPSHr = _ratedParas.NPSHr;
|
pump_dto.RatedParas.IsFrequency = _ratedParas.IsFrequency;
|
pump_dto.RatedParas.IsSxp = _ratedParas.IsSxp;
|
pump_dto.RatedParas.StageNumber = _ratedParas.StageNumber;
|
pump_dto.RatedParas.OutletDia = _ratedParas.OutletDia;
|
pump_dto.RatedParas.InletDia = _ratedParas.InletDia;
|
pump_dto.RatedParas.NpshGaoChaZd = _ratedParas.NpshGaoChaZd;
|
pump_dto.RatedParas.IsInletPress = _ratedParas.IsInletPress;
|
pump_dto.RatedParas.CurrentType = _ratedParas.CurrentType.ToString();
|
pump_dto.RatedParas.Voltage = _ratedParas.Voltage;
|
pump_dto.RatedParas.CurrentI = _ratedParas.CurrentI;
|
pump_dto.RatedParas.MaxQ = _ratedParas.MaxQ;
|
pump_dto.RatedParas.MaxH = _ratedParas.MaxH;
|
}
|
|
|
pump_dto.SortCode = _currentPump.SortCode;
|
pump_dto.Ratedn = _currentPump.Ratedn;
|
pump_dto.D2 = _currentPump.D2;
|
pump_dto.PosiAngle = _currentPump.PosiAngle;
|
pump_dto.CurveFitTypeQH = (int)_currentPump.CurveFitTypeQH;
|
pump_dto.CurveFitTypeQE = (int)_currentPump.CurveFitTypeQE;
|
pump_dto.CurveFitTypeQP = (int)_currentPump.CurveFitTypeQP;
|
|
pump_dto.PartID = _currentPart.ID;
|
pump_dto.PartCode = _currentPart.Code;
|
pump_dto.PartName = _currentPart.Name;
|
pump_dto.LastTestUserName = (from x in _allLoginUser where x.ID == _currentPart.LastTestUserID select x.RealName).FirstOrDefault();
|
pump_dto.LastTestTime = _currentPart.LastTestTime;
|
|
pump_dto.ManufacturerName = (from x in allManufacturer where x.ID == _currentPart.ManufacturerID select x.FullName).FirstOrDefault();
|
pump_dto.ManufactureTime = _currentPart.ManufactureTime;
|
#endregion
|
|
|
#region 电机
|
if (_currentMotor != null)
|
{
|
|
pump_dto.Motor = new OpenDto.ProductMotor();
|
|
#region 电机信息
|
pump_dto.Motor.ID = _currentMotor.ID;
|
pump_dto.Motor.CreateUserName = (from x in _allLoginUser where x.ID == _currentMotor.CreateUserID select x.RealName).FirstOrDefault();
|
pump_dto.Motor.CreateTime = _currentMotor.CreateTime;
|
pump_dto.Motor.UpdateUserName = (from x in _allLoginUser where x.ID == _currentMotor.UpdateUserID select x.RealName).FirstOrDefault();
|
pump_dto.Motor.UpdateTime = _currentMotor.UpdateTime;
|
pump_dto.Motor.Code = _currentMotor.Code;
|
pump_dto.Motor.Name = _currentMotor.Name;
|
//pump_dto.Motor.SeriesName = (from x in allSereis where x.ID == _currentMotor.SeriesID select x.Name).FirstOrDefault();
|
|
if (!string.IsNullOrEmpty(_currentMotor.RatedParas))
|
{
|
var _ratedParas = Model.RatedParas4Motor.ToModel(_currentMotor.RatedParas);
|
|
pump_dto.Motor.IsFrequency = _ratedParas.IsFrequency;
|
pump_dto.Motor.E_PLC = _ratedParas.E_PLC;
|
pump_dto.Motor.E_Self = _ratedParas.E_Self;
|
pump_dto.Motor.CurrentType = _ratedParas.CurrentType.ToString();
|
}
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
packInfo.Pump = pump_dto;
|
|
|
|
#region 测试台
|
OpenDto.WorkBenchBase dto_bench = new OpenDto.WorkBenchBase();
|
dto_bench.ID = _workBenchInfo.ID;
|
dto_bench.IStationID = _workBenchInfo.IStationID;
|
if (string.IsNullOrEmpty(_workBenchInfo.IStationID))
|
{
|
error_info = "测试台未设置外部ID, 无法同步";
|
return null;
|
}
|
dto_bench.CreateUserName = (from x in _allLoginUser where x.ID == _workBenchInfo.CreateUserID select x.RealName).FirstOrDefault();
|
//_workBenchInfo.CreateUserID;
|
dto_bench.CreateTime = _workBenchInfo.CreateTime;
|
dto_bench.UpdateUserName = (from x in _allLoginUser where x.ID == _workBenchInfo.UpdateUserID select x.RealName).FirstOrDefault();
|
//_workBenchInfo.UpdateUserID;
|
dto_bench.UpdateTime = _workBenchInfo.UpdateTime;
|
dto_bench.Code = _workBenchInfo.Code;
|
dto_bench.Name = _workBenchInfo.Name;
|
|
dto_bench.LastUseTime = _workBenchInfo.LastUseTime;
|
dto_bench.LastUseUserID = _workBenchInfo.LastUseUserID;
|
dto_bench.UseStatus = _workBenchInfo.UseStatus.ToString();
|
dto_bench.PipeIndex = _workBenchInfo.PipeIndex;
|
dto_bench.PipeParas = _workBenchInfo.PipeParas;
|
dto_bench.LinkType = _workBenchInfo.LinkType.ToString();
|
//dto_bench.TestMethod = _workBenchInfo.TestMethod;
|
//dto_bench.TestSetting = _workBenchInfo.TestSetting;
|
|
dto_bench.Tag = _workBenchInfo.Tag;
|
dto_bench.LinkTag = _workBenchInfo.LinkTag;
|
dto_bench.SortCode = _workBenchInfo.SortCode;
|
|
if (_workBenchInfo.LinkInfo != null)
|
{
|
dto_bench.ReceiveWaitTime = _workBenchInfo.LinkInfo.ReceiveWaitTime;
|
dto_bench.PollTime = _workBenchInfo.LinkInfo.PollTime;
|
}
|
|
var test_setting = new Model.WorkBenchSetting4Pump(_workBenchInfo.TestSetting);
|
dto_bench.NpshCriterion = test_setting.NpshCriterion;
|
dto_bench.IsTemperatureTrn = test_setting.IsTemperatureTrn;
|
dto_bench.Elevation = test_setting.Elevation;
|
dto_bench.AtmosphericPressure = test_setting.AtmosphericPressure;
|
dto_bench.IsAutoTestAble = test_setting.IsAutoTestAble;
|
dto_bench.IsOperateValveDegree = test_setting.IsOperateValveDegree;
|
dto_bench.IsInitialElectricalAble = test_setting.IsInitialElectricalAble;
|
|
var method = new Model.WorkBenchMethod4Pump(_workBenchInfo.TestMethod);
|
dto_bench.TestMethodPower = method.Power == null ? "" : method.Power.ToString();
|
dto_bench.TestMethodPress = method.Press == null ? "" : method.Press.ToString();
|
dto_bench.TestMethodTorque = method.Torque == null ? "" : method.Torque.ToString();
|
dto_bench.TestMethodNpsh = method.Npsh == null ? "" : method.Npsh.ToString();
|
dto_bench.InletIsUseWaterLevel = method.InletIsUseWaterLevel;
|
|
//
|
if (_allMonitorPointList != null)
|
{
|
dto_bench.Points = new List<OpenDto.MonitorPointBase>();
|
foreach (var mp in _allMonitorPointList)
|
{
|
var mp_dto = new TProduct.OpenDto.MonitorPointBase();
|
|
mp_dto.ID = mp.ID;
|
mp_dto.IStationID = mp.IStationID;
|
mp_dto.Code = mp.Code;
|
mp_dto.Name = mp.Name;
|
mp_dto.MonitorType = (OpenDto.eMonitorType)(int)mp.MonitorType;
|
mp_dto.Property = mp.Property;
|
mp_dto.PipeDia = mp.PipeDia;
|
mp_dto.Elevation = mp.Elevation;
|
mp_dto.SortCode = mp.SortCode;
|
if (mp.ValueCoeffParas != null)
|
{
|
mp_dto.ValueCoeffParas = new OpenDto.ValueCoeffParas();
|
|
mp_dto.ValueCoeffParas.Method = mp.ValueCoeffParas.Method;
|
mp_dto.ValueCoeffParas.Multiply1 = mp.ValueCoeffParas.Multiply1;
|
mp_dto.ValueCoeffParas.Add1 = mp.ValueCoeffParas.Add1;
|
|
mp_dto.ValueCoeffParas.InterpolationType = mp.ValueCoeffParas.InterpolationType;
|
mp_dto.ValueCoeffParas.RealValues = mp.ValueCoeffParas.RealValues;
|
|
mp_dto.ValueCoeffParas.Multiplys = mp.ValueCoeffParas.Multiplys;
|
|
mp_dto.ValueCoeffParas.Adds = mp.ValueCoeffParas.Adds;
|
}
|
|
mp_dto.SumCalcCoeff = mp.SumCalcCoeff;
|
//mp_dto.AnalogParas = mp.AnalogParas;
|
//mp_dto.DigitalParas = mp.DigitalParas;
|
|
|
dto_bench.Points.Add(mp_dto);
|
}
|
}
|
|
packInfo.TestBench = dto_bench;
|
#endregion
|
|
|
#region 测试数据
|
|
|
var testItem_dto = new TProduct.OpenDto.TestProjectItem();
|
|
testItem_dto.SeriesID = _testItem.SeriesID;
|
testItem_dto.ProductID = _testItem.ProductID;
|
testItem_dto.PartID = _testItem.PartID;
|
testItem_dto.ProjectUseStatus = _testItem.ProjectUseStatus.ToString();
|
testItem_dto.PrjIStationID = _testItem.IStationID;
|
|
testItem_dto.ProjectID = _testItem.ProjectID;
|
testItem_dto.ProjectCode = _testItem.ProjectCode;
|
testItem_dto.ProjectName = _testItem.ProjectName;
|
testItem_dto.IsFixed = _testItem.IsFixed;
|
testItem_dto.ProjectJudgeResult = _testItem.ProjectJudgeResult.ToString();
|
testItem_dto.ReportFileNO = _testItem.ReportFileNO;
|
testItem_dto.TestStandardID = _testItem.TestStandardID;
|
testItem_dto.TestGradeID = _testItem.TestGradeID;
|
testItem_dto.BenchID = _testItem.BenchID;
|
|
testItem_dto.ItemID = _testItem.ItemID;
|
testItem_dto.ItemCode = _testItem.ItemCode;
|
testItem_dto.ItemName = _testItem.ItemName;
|
testItem_dto.ItemUseStatus = _testItem.ItemUseStatus.ToString();
|
testItem_dto.ItemCreateUserName = (from x in _allLoginUser where x.ID == _testItem.ItemCreateUserID select x.RealName).FirstOrDefault();
|
testItem_dto.ItemCreateTime = _testItem.ItemCreateTime;
|
testItem_dto.LastTestUserName = (from x in _allLoginUser where x.ID == _testItem.LastTestUserID select x.RealName).FirstOrDefault();
|
|
|
|
if (!string.IsNullOrEmpty(_testItem.ItemTestResult))
|
{
|
Model.FeatTestResult result = new Model.FeatTestResult(_testItem.ItemTestResult);
|
testItem_dto.ProjectJudgeParas = new Dictionary<string, double>();
|
testItem_dto.ProjectJudgeParas["Qt"] = result.Flow;
|
testItem_dto.ProjectJudgeParas["Ht"] = result.Head;
|
testItem_dto.ProjectJudgeParas["Et"] = result.Eta;
|
}
|
|
|
testItem_dto.ItemParas = new OpenDto.TestProjectItemParas();
|
|
if (_testItem.ProjectParas != null)
|
{
|
testItem_dto.ItemParas.Elevation = _testItem.ProjectParas.Elevation;
|
testItem_dto.ItemParas.AtmosphericPressure = _testItem.ProjectParas.AtmosphericPressure;
|
testItem_dto.ItemParas.IsTemperatureTrn = _testItem.ProjectParas.IsTemperatureTrn;
|
testItem_dto.ItemParas.JzWenDu = _testItem.ProjectParas.JzWenDu;
|
testItem_dto.ItemParas.InspectionNumber = _testItem.ProjectParas.InspectionNumber;
|
testItem_dto.ItemParas.TestNature = _testItem.ProjectParas.TestNature.ToString();
|
testItem_dto.ItemParas.SpeedSimuMethod = _testItem.ProjectParas.SpeedSimuMethod == null ? "" :
|
_testItem.ProjectParas.SpeedSimuMethod.ToString();
|
}
|
|
//testItem_dto.AlarmSetting = _testItem.AlarmSetting;
|
|
if(_testItem.TestStartTime == null)
|
{
|
_testItem.TestStartTime = (from x in _allRecords select x.Time).FirstOrDefault();
|
}
|
if (_testItem.TestEndTime == null)
|
{
|
_testItem.TestEndTime = (from x in _allRecords select x.Time).LastOrDefault();
|
}
|
testItem_dto.TestStartTime = _testItem.TestStartTime;
|
testItem_dto.TestEndTime = _testItem.TestEndTime;
|
testItem_dto.ItemLogContent = _testItem.ItemLogContent;
|
testItem_dto.ItemJudgeResult = _testItem.ItemJudgeResult.ToString();
|
if (_testItem.ItemParas != null)
|
{
|
testItem_dto.ItemParas.NpshJudgeThreshold = _testItem.ItemParas.NpshJudgeThreshold;
|
testItem_dto.ItemParas.IsEntendZeroH = _testItem.ItemParas.IsEntendZeroH;
|
testItem_dto.ItemParas.FlowInZeroH = _testItem.ItemParas.FlowInZeroH;
|
}
|
|
testItem_dto.CoordinateParas = _testItem.CoordinateParas;
|
//testItem_dto.PointNumber = _testItem.PointNumber;
|
//testItem_dto.AutoTestInfo = _testItem.AutoTestInfo;
|
//testItem_dto.DurabilityTestInfo = _testItem.DurabilityTestInfo;
|
if (_testItem.InstrumentInfo != null)
|
{
|
testItem_dto.ItemParas.OutletPressureMeterID = _testItem.InstrumentInfo.OutletPressureMeterID;
|
testItem_dto.ItemParas.OutletPressureMeterElevation = _testItem.InstrumentInfo.OutletPressureMeterElevation;
|
testItem_dto.ItemParas.OutletPressureMeterPipeDia = _testItem.InstrumentInfo.OutletPressureMeterPipeDia;
|
testItem_dto.ItemParas.InletPressureMeterID = _testItem.InstrumentInfo.OutletPressureMeterID;
|
testItem_dto.ItemParas.InletPressureMeterElevation = _testItem.InstrumentInfo.InletPressureMeterElevation;
|
testItem_dto.ItemParas.InletPressureMeterPipeDia = _testItem.InstrumentInfo.InletPressureMeterPipeDia;
|
testItem_dto.ItemParas.FlowMeterRangeMin = _testItem.InstrumentInfo.FlowMeterRangeMin;
|
testItem_dto.ItemParas.FlowMeterRangeMax = _testItem.InstrumentInfo.FlowMeterRangeMax;
|
}
|
|
if (_testItem.ElectricInfo != null)
|
{
|
testItem_dto.ItemParas.Ct = _testItem.ElectricInfo.Ct;
|
testItem_dto.ItemParas.Pt = _testItem.ElectricInfo.Pt;
|
}
|
|
testItem_dto.ItemTestResult = _testItem.ItemTestResult;
|
testItem_dto.ItemTestTarget = _testItem.ItemTestTarget;
|
|
|
|
|
|
|
if (_allRecords != null && _allRecords.Count > 0)
|
{
|
testItem_dto.PointNumber = _allRecords.Count();
|
|
testItem_dto.Records = new List<OpenDto.PumpFeatTestRecord>();
|
|
foreach (var record in _allRecords)
|
{
|
var record_dt0 = new OpenDto.PumpFeatTestRecord();
|
record_dt0.ID = record.ID;
|
record_dt0.Time = record.Time;
|
record_dt0.CorrectPtQ = record.CorrectPtQ;
|
record_dt0.CorrectPtH = record.CorrectPtH;
|
record_dt0.CorrectPtE = record.CorrectPtE;
|
record_dt0.CorrectPtP = record.CorrectPtP;
|
|
record_dt0.TestPtQ = record.TestPtQ;
|
record_dt0.TestPtH = record.TestPtH;
|
record_dt0.TestPtE = record.CorrectPtE;
|
record_dt0.TestPtP = record.TestPtP;
|
|
record_dt0.Speed = record.Speed;
|
|
|
var vvvMonitorRecordList = new Model.MonitorRecord4DsList(record.MonitorRecords);
|
|
record_dt0.Records = new List<TProduct.OpenDto.MonitorPointValue>();
|
foreach (var mp in _allMonitorPointList)
|
{
|
var mp_dto = new TProduct.OpenDto.MonitorPointValue();
|
|
mp_dto.ID = mp.ID;
|
mp_dto.IStationID = mp.IStationID;
|
mp_dto.Code = mp.Code;
|
mp_dto.Name = mp.Name;
|
mp_dto.MonitorType = (OpenDto.eMonitorType)(int)mp.MonitorType;
|
mp_dto.Property = mp.Property;
|
mp_dto.PipeDia = mp.PipeDia;
|
mp_dto.Elevation = mp.Elevation;
|
mp_dto.SortCode = mp.SortCode;
|
if (mp.ValueCoeffParas != null)
|
{
|
mp_dto.ValueCoeffParas = new OpenDto.ValueCoeffParas();
|
|
mp_dto.ValueCoeffParas.Method = mp.ValueCoeffParas.Method;
|
mp_dto.ValueCoeffParas.Multiply1 = mp.ValueCoeffParas.Multiply1;
|
mp_dto.ValueCoeffParas.Add1 = mp.ValueCoeffParas.Add1;
|
|
mp_dto.ValueCoeffParas.InterpolationType = mp.ValueCoeffParas.InterpolationType;
|
mp_dto.ValueCoeffParas.RealValues = mp.ValueCoeffParas.RealValues;
|
|
mp_dto.ValueCoeffParas.Multiplys = mp.ValueCoeffParas.Multiplys;
|
|
mp_dto.ValueCoeffParas.Adds = mp.ValueCoeffParas.Adds;
|
}
|
|
mp_dto.SumCalcCoeff = mp.SumCalcCoeff;
|
//mp_dto.AnalogParas = mp.AnalogParas;
|
//mp_dto.DigitalParas = mp.DigitalParas;
|
|
var va = vvvMonitorRecordList.Find(x => x.ID == mp.ID);
|
if (va != null)
|
{
|
mp_dto.Value = va.Value;
|
}
|
|
record_dt0.Records.Add(mp_dto);
|
}
|
|
testItem_dto.Records.Add(record_dt0);
|
}
|
}
|
|
|
|
packInfo.TestItem = testItem_dto;
|
|
|
#endregion
|
|
|
|
var ret = Request(packInfo, url_type,url);
|
if(ret.Data != null)
|
error_info = ret.Data.ErrorCode;
|
|
return ret;
|
}
|
|
|
//请求
|
private static TProduct.OpenDto.IStationSynResult Request(FeatTestPackInfoV1 packInfo,string type, string url)
|
{
|
string jsonStringContent = TProduct.JsonHelper.Object2Json(packInfo);
|
|
|
var request = (HttpWebRequest)WebRequest.Create(url);
|
request.Method = "POST";
|
request.ContentType = "application/json";
|
|
//Version version = null;
|
//if (version != null)
|
//{ //默认是HttpVersion.Version11
|
// request.ProtocolVersion = version;
|
//}
|
|
|
//Dictionary<string, string> headers = null;
|
//if (headers != null && headers.Count > 0)
|
//{
|
// foreach (var header in headers)
|
// {
|
// request.Headers.Add(header.Key, header.Value);
|
// }
|
//}
|
|
|
|
|
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
|
{
|
streamWriter.Write(jsonStringContent);
|
streamWriter.Flush();
|
}
|
|
|
string responseText;
|
using (var response = (HttpWebResponse)request.GetResponse())
|
using (var reader = new StreamReader(response.GetResponseStream()))
|
{
|
responseText = reader.ReadToEnd();
|
}
|
return TProduct.JsonHelper.Json2Object<TProduct.OpenDto.IStationSynResult>(responseText);
|
|
}
|
|
|
|
|
}
|
}
|