public void ReadAsmCheckResultString(string xmlstring, out string result, out string info, out string co5025el, out string hc5025el, out string no5025el, out string co2540el, out string hc2540el, out string no2540el, out string co5025ed, out string hc5025ed, out string no5025ed, out string co2540ed, out string hc2540ed, out string no2540ed, out string co5025str, out string hc5025str, out string no5025str, out string co2540str, out string hc2540str, out string no2540str, out string result5 ) { info = ""; result = ""; co5025el = ""; hc5025el = ""; no5025el = ""; co2540el = ""; hc2540el = ""; no2540el = ""; co5025ed = ""; hc5025ed = ""; no5025ed = ""; co2540ed = ""; hc2540ed = ""; no2540ed = ""; co5025str = ""; hc5025str = ""; no5025str = ""; co2540str = ""; hc2540str = ""; no2540str = ""; result5 = ""; INIIO.saveLogInf(xmlstring); try { DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables["info"]; co5025el = dt1.Rows[0]["co5025el"].ToString(); hc5025el = dt1.Rows[0]["hc5025el"].ToString(); no5025el = dt1.Rows[0]["no5025el"].ToString(); co2540el = dt1.Rows[0]["co2540el"].ToString(); hc2540el = dt1.Rows[0]["hc2540el"].ToString(); no2540el = dt1.Rows[0]["no2540el"].ToString(); co5025ed = dt1.Rows[0]["co5025ed"].ToString(); hc5025ed = dt1.Rows[0]["hc5025ed"].ToString(); no5025ed = dt1.Rows[0]["no5025ed"].ToString(); co2540ed = dt1.Rows[0]["co2540ed"].ToString(); hc2540ed = dt1.Rows[0]["hc2540ed"].ToString(); no2540ed = dt1.Rows[0]["no2540ed"].ToString(); co5025str = dt1.Rows[0]["co5025str"].ToString(); hc5025str = dt1.Rows[0]["hc5025str"].ToString(); no5025str = dt1.Rows[0]["no5025str"].ToString(); co2540str = dt1.Rows[0]["co2540str"].ToString(); hc2540str = dt1.Rows[0]["hc2540str"].ToString(); no2540str = dt1.Rows[0]["no2540str"].ToString(); result5 = dt1.Rows[0]["result5"].ToString(); } } catch (Exception er) { result = ""; info = er.Message; } }
public void ReadAccessTokenString(string xmlstring, out string result, out string info, out string accessToken) { INIIO.saveLogInf("[返回消息]:" + xmlstring); if (xmlstring != "") { DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); accessToken = ""; } else { dt1 = ds.Tables["info"]; info = ""; accessToken = dt1.Rows[0]["accessToken"].ToString(); } } else { result = "0"; info = "上传过程中有异常发生,请查看日志"; accessToken = ""; } }
public void ReadAsmLimitString(string xmlstring, out string result, out string info, out string co5025, out string hc5025, out string no5025, out string co2540, out string hc2540, out string no2540) { info = ""; result = ""; co5025 = ""; hc5025 = ""; no5025 = ""; co2540 = ""; hc2540 = ""; no2540 = ""; INIIO.saveLogInf(xmlstring); DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables[1]; co5025 = dt1.Rows[0]["co5025"].ToString(); hc5025 = dt1.Rows[0]["hc5025"].ToString(); no5025 = dt1.Rows[0]["no5025"].ToString(); co2540 = dt1.Rows[0]["co2540"].ToString(); hc2540 = dt1.Rows[0]["hc2540"].ToString(); no2540 = dt1.Rows[0]["no2540"].ToString(); } }
public void ReadDjztString(string xmlstring, out string result, out string info, out string state, out string businessId, out string methodID) { info = ""; result = ""; state = ""; businessId = ""; methodID = ""; INIIO.saveLogInf("[读取状态]:" + xmlstring); DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables[1]; state = dt1.Rows[0]["zt"].ToString(); businessId = dt1.Rows[0]["lsh"].ToString(); methodID = dt1.Rows[0]["jcff"].ToString(); } }
public void ReadVmasCheckResultString(string xmlstring, out string result, out string info, out string valueCO, out string valueHC, out string valueNO, out string valueHCNO, out string valueCOLimit, out string valueHCLimit, out string valueNOLimit, out string valueHCNOLimit, out string valueCOResult, out string valueHCResult, out string valueNOResult, out string valueHCNOResult, out string result1, out string before ) { info = ""; result = ""; valueCO = ""; valueHC = ""; valueNO = ""; valueHCNO = ""; valueCOLimit = ""; valueHCLimit = ""; valueNOLimit = ""; valueHCNOLimit = ""; valueCOResult = ""; valueHCResult = ""; valueNOResult = ""; valueHCNOResult = ""; result1 = ""; before = "N"; INIIO.saveLogInf(xmlstring); try { DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables["info"]; valueCO = dt1.Rows[0]["valueCO"].ToString(); if (dt1.Columns.Contains("valueHC")) { valueHC = dt1.Rows[0]["valueHC"].ToString(); valueNO = dt1.Rows[0]["valueNO"].ToString(); valueHCLimit = dt1.Rows[0]["valueHCLimit"].ToString(); valueNOLimit = dt1.Rows[0]["valueNOLimit"].ToString(); valueHCResult = dt1.Rows[0]["valueHCResult"].ToString(); valueNOResult = dt1.Rows[0]["valueNOResult"].ToString(); before = "Y"; } if (dt1.Columns.Contains("valueHCNO")) { valueHCNO = dt1.Rows[0]["valueHCNO"].ToString(); valueHCNOLimit = dt1.Rows[0]["valueHCNOLimit"].ToString(); valueHCNOResult = dt1.Rows[0]["valueHCNOResult"].ToString(); before = "N"; } valueCOLimit = dt1.Rows[0]["valueCOLimit"].ToString(); valueCOResult = dt1.Rows[0]["valueCOResult"].ToString(); result1 = dt1.Rows[0]["result1"].ToString(); } } catch (Exception er) { result = ""; info = er.Message; } }
public void ReadLudownCheckResultString(string xmlstring, out string result, out string info, out string smokeK100, out string smokeK90, out string smokeK80, out string power, out string mortorSpeed, out string smokeK100Limit, out string smokeK90Limit, out string smokeK80Limit, out string powerLimit, out string mortorSpeedLimit, out string smokeK100Result, out string smokeK90Result, out string smokeK80Result, out string powerResult, out string mortorSpeedResult, out string result2 ) { info = ""; result = ""; smokeK100 = ""; smokeK90 = ""; smokeK80 = ""; power = ""; mortorSpeed = ""; smokeK100Limit = ""; smokeK90Limit = ""; smokeK80Limit = ""; powerLimit = ""; mortorSpeedLimit = ""; smokeK100Result = ""; smokeK90Result = ""; smokeK80Result = ""; powerResult = ""; mortorSpeedResult = ""; result2 = ""; INIIO.saveLogInf(xmlstring); try { DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables["info"]; smokeK100 = dt1.Rows[0]["smokeK100"].ToString(); smokeK90 = dt1.Rows[0]["smokeK90"].ToString(); smokeK80 = dt1.Rows[0]["smokeK80"].ToString(); power = dt1.Rows[0]["power"].ToString(); mortorSpeed = dt1.Rows[0]["mortorSpeed"].ToString(); smokeK100Limit = dt1.Rows[0]["smokeK100Limit"].ToString(); smokeK90Limit = dt1.Rows[0]["smokeK90Limit"].ToString(); smokeK80Limit = dt1.Rows[0]["smokeK80Limit"].ToString(); powerLimit = dt1.Rows[0]["powerLimit"].ToString(); mortorSpeedLimit = dt1.Rows[0]["mortorSpeedLimit"].ToString(); smokeK100Result = dt1.Rows[0]["smokeK100Result"].ToString(); smokeK90Result = dt1.Rows[0]["smokeK90Result"].ToString(); smokeK80Result = dt1.Rows[0]["smokeK80Result"].ToString(); powerResult = dt1.Rows[0]["powerResult"].ToString(); mortorSpeedResult = dt1.Rows[0]["mortorSpeedResult"].ToString(); result2 = dt1.Rows[0]["result2"].ToString(); } } catch (Exception er) { result = ""; info = er.Message; } }
public void ReadSdsCheckResultString(string xmlstring, out string result, out string info, out string coLowValue, out string hcLowValue, out string coHighValue, out string hcHighValue, out string lambdaValue, out string coLowValueLimit, out string hcLowValueLimit, out string coHighValueLimit, out string hcHighValueLimit, out string coLowValueResult, out string hcLowValueResult, out string coHighValueResult, out string hcHighValueResult, out string lambdaValueResult, out string result3 ) { info = ""; result = ""; coLowValue = ""; hcLowValue = ""; coHighValue = ""; hcHighValue = ""; lambdaValue = ""; coLowValueLimit = ""; hcLowValueLimit = ""; coHighValueLimit = ""; hcHighValueLimit = ""; coLowValueResult = ""; hcLowValueResult = ""; coHighValueResult = ""; hcHighValueResult = ""; lambdaValueResult = ""; result3 = ""; INIIO.saveLogInf(xmlstring); try { DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables["info"]; coLowValue = dt1.Rows[0]["coLowValue"].ToString(); hcLowValue = dt1.Rows[0]["hcLowValue"].ToString(); coHighValue = dt1.Rows[0]["coHighValue"].ToString(); hcHighValue = dt1.Rows[0]["hcHighValue"].ToString(); lambdaValue = dt1.Rows[0]["lambdaValue"].ToString(); coLowValueLimit = dt1.Rows[0]["coLowValueLimit"].ToString(); hcLowValueLimit = dt1.Rows[0]["hcLowValueLimit"].ToString(); coHighValueLimit = dt1.Rows[0]["coHighValueLimit"].ToString(); hcHighValueLimit = dt1.Rows[0]["hcHighValueLimit"].ToString(); coLowValueResult = dt1.Rows[0]["coLowValueResult"].ToString(); hcLowValueResult = dt1.Rows[0]["hcLowValueResult"].ToString(); coHighValueResult = dt1.Rows[0]["coHighValueResult"].ToString(); hcHighValueResult = dt1.Rows[0]["hcHighValueResult"].ToString(); lambdaValueResult = dt1.Rows[0]["lambdaValueResult"].ToString(); result3 = dt1.Rows[0]["result3"].ToString(); } } catch (Exception er) { result = ""; info = er.Message; } }
public void ReadDjclxxString(string xmlstring, out string result, out string info, out string carCardNumber, out string maxWeight, out string standardWeight, out string motorPower, out string motorRate, out string speedChanger, out string fuelType, out string airInflow, out string oilSupply, out string isSYJHQ, out string ccdjrq, out string clzl) { info = ""; result = ""; carCardNumber = ""; maxWeight = ""; standardWeight = ""; motorRate = ""; motorPower = ""; speedChanger = ""; fuelType = ""; airInflow = ""; oilSupply = ""; isSYJHQ = ""; ccdjrq = ""; clzl = ""; INIIO.saveLogInf("[读取车辆信息]:" + xmlstring); DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables[1]; carCardNumber = dt1.Rows[0]["cphm"].ToString(); maxWeight = dt1.Rows[0]["zdzzl"].ToString(); standardWeight = dt1.Rows[0]["jzzl"].ToString(); motorPower = dt1.Rows[0]["edgl"].ToString(); motorRate = dt1.Rows[0]["edzs"].ToString(); speedChanger = dt1.Rows[0]["bsqxs"].ToString(); fuelType = dt1.Rows[0]["rlzl"].ToString(); airInflow = dt1.Rows[0]["jqfs"].ToString(); oilSupply = dt1.Rows[0]["gyfs"].ToString(); isSYJHQ = dt1.Rows[0]["syjhq"].ToString(); ccdjrq = dt1.Rows[0]["ccdjrq"].ToString(); clzl = dt1.Rows[0]["clzl"].ToString(); } }
/// <summary> /// 将XmlDocument转化为string /// </summary> /// <param name="xmlDoc"></param> /// <returns></returns> static string ConvertXmlToString(XmlDocument xmlDoc) { MemoryStream stream = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(stream, null); writer.Formatting = Formatting.Indented; xmlDoc.Save(writer); StreamReader sr = new StreamReader(stream, System.Text.Encoding.UTF8); stream.Position = 0; string xmlString = sr.ReadToEnd(); sr.Close(); stream.Close(); string newstring = xmlString.Replace("xml version=\"1.0\"", "xml version=\"1.0\" encoding=\"UTF-8\"");//.Replace(" ", "%20").Replace("\r\n", "%0d%0a") + "\r\n"; INIIO.saveSocketLogInf("SEND:\r\n" + newstring); return(newstring); }
public void ReadBtgCheckResultString(string xmlstring, out string result, out string info, out string smokeValue1, out string smokeValue2, out string smokeValue3, out string avgSmoke, out string smokeLimit, out string result4 ) { info = ""; result = ""; smokeValue1 = ""; smokeValue2 = ""; smokeValue3 = ""; avgSmoke = ""; smokeLimit = ""; result4 = ""; INIIO.saveLogInf(xmlstring); try { DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables["info"]; smokeValue1 = dt1.Rows[0]["smokeValue1"].ToString(); smokeValue2 = dt1.Rows[0]["smokeValue2"].ToString(); smokeValue3 = dt1.Rows[0]["smokeValue3"].ToString(); avgSmoke = dt1.Rows[0]["avgSmoke"].ToString(); smokeLimit = dt1.Rows[0]["smokeLimit"].ToString(); result4 = dt1.Rows[0]["result4"].ToString(); } } catch (Exception er) { result = ""; info = er.Message; } }
public void ReadCarInfoString(string xmlstring, out string result, out string info, out string carCardNumber, out string maxWeight, out string standardWeight, out string motorPower, out string motorRate, out string speedChanger, out string fuelType, out string airInflow, out string oilSupply, out string isSYJHQ) { info = ""; result = ""; carCardNumber = ""; maxWeight = ""; standardWeight = ""; motorRate = ""; motorPower = ""; speedChanger = ""; fuelType = ""; airInflow = ""; oilSupply = ""; isSYJHQ = ""; INIIO.saveLogInf("[读取车辆信息]:" + xmlstring); DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } dt1 = ds.Tables[1]; carCardNumber = dt1.Rows[0]["carCardNumber"].ToString(); maxWeight = dt1.Rows[0]["maxWeight"].ToString(); standardWeight = dt1.Rows[0]["standardWeight"].ToString(); motorPower = dt1.Rows[0]["motorPower"].ToString(); motorRate = dt1.Rows[0]["motorRate"].ToString(); speedChanger = dt1.Rows[0]["speedChanger"].ToString(); fuelType = dt1.Rows[0]["fuelType"].ToString(); airInflow = dt1.Rows[0]["airInflow"].ToString(); oilSupply = dt1.Rows[0]["oilSupply"].ToString(); isSYJHQ = dt1.Rows[0]["isSYJHQ"].ToString(); }
/// <summary> /// 获取人员信息 /// </summary> /// <param name="dt_Users">返回人员信息表</param> /// <param name="errorInf">上传错误信息</param> /// <returns></returns> public bool GetUsers(out DataTable dt_Users, out string errorInf) { dt_Users = null; errorInf = ""; if (jk_status == false) { errorInf = "接口未正常初始化"; return(false); } try { INIIO.saveSocketLogInf("【获取人员信息】\r\n"); DataSet result = getUploadResult(webservices.DownloadStationStaff(cityCode, stationCode)); if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); errorInf = "Success:" + success.ToString() + "|Error:" + error; if (success.ToUpper() == "TRUE" && error == "" && result.Tables["StationStaffType"] != null) { dt_Users = result.Tables["StationStaffType"]; return(true); } else { return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch { return(false); } }
public DataTable GetVehicleInf(string hphm, string hpzl, string clsbdh, out string code, out string message) { //socket.Connect(point); XmlDocument xmldoc, xlmrecivedoc; XmlNode xmlnode; XmlElement xmlelem; DataTable dt = null; xmldoc = new XmlDocument(); xmlelem = xmldoc.CreateElement("", "root", ""); xmldoc.AppendChild(xmlelem); XmlNode root = xmldoc.SelectSingleNode("root"); //查找<Employees> XmlElement xe1 = xmldoc.CreateElement("QueryCondition"); //创建一个<Node>节点 XmlElement xe2 = xmldoc.CreateElement("hphm"); //创建一个<Node>节点 xe2.InnerText = hphm; XmlElement xe3 = xmldoc.CreateElement("hpzl");//创建一个<Node>节点 xe3.InnerText = hpzl; XmlElement xe4 = xmldoc.CreateElement("clsbdh");//创建一个<Node>节点 xe4.InnerText = clsbdh; XmlElement xe5 = xmldoc.CreateElement("jyjgbh");//创建一个<Node>节点 xe5.InnerText = Jyjgbh; xe1.AppendChild(xe2); xe1.AppendChild(xe3); xe1.AppendChild(xe4); xe1.AppendChild(xe5); root.AppendChild(xe1); INIIO.saveSocketLogInf("【读取车辆信息】" + "-【车牌号】=" + hphm); INIIO.saveSocketLogInf("XTLB:" + Xtlb); INIIO.saveSocketLogInf("JKXLH:" + Jkxlh); INIIO.saveSocketLogInf("JKID:" + "18C49"); string receiveXml = HttpUtility.UrlDecode(gainterface.queryObjectOut(Xtlb, Jkxlh, "18C49", ConvertXmlToStringNoEncoder(xmldoc))); INIIO.saveSocketLogInf("【返回】\r\n" + receiveXml); return(ReadVehicleInfDatatable(receiveXml, out code, out message)); }
/// <summary> /// 获取车辆信息 /// </summary> /// <param name="jcff">检测方法</param> /// <param name="jylsh">检测编号</param> /// <param name="dt_CarInfo">查到的车辆信息</param> /// <param name="errorInf">上传错误信息</param> /// <returns></returns> public bool GetCarInfo(string jcff, string jylsh, out DataTable dt_CarInfo, out string errorInf) { dt_CarInfo = null; errorInf = ""; if (jk_status == false) { return(false); } try { INIIO.saveSocketLogInf("【获取车辆信息】:jylsh:" + jylsh + "|lineCode:" + lineCode + "|jcff:" + jcff + "\r\n"); DataSet result = getUploadResult(webservices.DownloadVehicle(stationCode, jylsh, lineCode, jcff)); if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); errorInf = "Success:" + success.ToString() + "|Error:" + error; if (success.ToUpper() == "TRUE" && error == "" && result.Tables["Vehicle"] != null) { dt_CarInfo = result.Tables["Vehicle"]; return(true); } else { return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch { return(false); } }
/// <summary> /// 获取检测限值 /// </summary> /// <param name="jcff">检测方法</param> /// <param name="jylsh">检测编号</param> /// <param name="dt_XZ">限值数据</param> /// <param name="errorInf">上传错误信息</param> /// <returns></returns> public bool getTestXZ(string jcff, string jylsh, out DataTable dt_XZ, out string errorInf) { dt_XZ = null; errorInf = ""; if (jk_status == false) { errorInf = "接口未正常初始化"; return(false); } try { INIIO.saveSocketLogInf("【获取检测限值】:jylsh:" + jylsh + "|lineCode:" + lineCode + "|jcff:" + jcff + "\r\n"); DataSet result = getUploadResult(webservices.GetParamLimitData(stationCode, jylsh, lineCode, jcff)); if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); errorInf = "Success:" + success.ToString() + "|Error:" + error; if (success.ToUpper() == "TRUE" && error == "" && result.Tables["Limit"] != null) { dt_XZ = result.Tables["Limit"]; return(true); } else { return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch { return(false); } }
/// <summary> /// 根据时间段下载受理信息(默认下载该时间段的所有信息) /// </summary> /// <param name="StartTime">时间段起始时间</param> /// <param name="EndTime">时间段结束时间</param> /// <param name="jcff">检测方法</param> /// <param name="dt_WaitCarList">查询到的待检车辆信息</param> /// <param name="errorInf">查询错误信息</param> /// <returns></returns> public bool GetVehicleListByTime(DateTime StartTime, DateTime EndTime, string jcff, out DataTable dt_WaitCarList, out string errorInf) { dt_WaitCarList = null; errorInf = ""; if (jk_status == false) { errorInf = "接口未正常初始化"; return(false); } try { INIIO.saveSocketLogInf("【获取受理信息】:lineCode:" + lineCode + "|jcff:" + jcff + "|StartTime:" + StartTime.ToString("yyyy-MM-dd HH:mm:ss") + "|EndTime:" + EndTime.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n"); DataSet result = getUploadResult(webservices.DownloadAcceptanceData(cityCode, stationCode, lineCode, jcff, StartTime.ToString("yyyy-MM-dd HH:mm:ss"), EndTime.ToString("yyyy-MM-dd HH:mm:ss"), 0, factoryNo)); if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); errorInf = "Success:" + success + "|Error:" + error; if (success.ToUpper() == "TRUE" && error == "" && result.Tables["AcceptanceType"] != null) { dt_WaitCarList = result.Tables["AcceptanceType"]; return(true); } else { return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch { return(false); } }
/// <summary> /// 检测开始或结束 /// </summary> /// <param name="isStart">true为开始、false为结束</param> /// <param name="jylsh">检测编号(检验流水号)</param> /// <param name="uniqueStr">车辆唯一标识(VIN)</param> /// <param name="errorInf">错误信息</param> /// <returns>是否成功</returns> public bool StartOrStopTest(bool isStart, string jylsh, string uniqueStr, out string errorInf) { errorInf = ""; if (jk_status == false) { return(false); } try { INIIO.saveSocketLogInf("【发送检测开始或结束信号】:jylsh:" + jylsh + "|lineCode:" + lineCode + "|uniqueStr:" + uniqueStr + "|" + (isStart ? "start" : "stop") + "\r\n"); DataSet result = getUploadResult(webservices.UpInspectionSignal(stationCode, jylsh, lineCode, uniqueStr, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), isStart ? "start" : "stop")); if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); if (success.ToUpper() == "TRUE" && error == "") { return(true); } else { errorInf = "Success:" + success.ToString() + "|Error:" + error; return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch { return(false); } }
/// <summary> /// 系统时间同步 /// </summary> /// <returns></returns> public bool GetSystemTime(ref string sys_time, ref string errorInf) { if (jk_status == false) { errorInf = "联网接口还未正常初始化"; return(false); } try { INIIO.saveSocketLogInf("【开始同步系统时间】\r\n"); DataSet result = getUploadResult(webservices.GetDateTimeNow()); if (result != null) { if (result.Tables["ResultData"].Rows[0]["Success"].ToString().ToUpper() == "TRUE" && result.Tables["ResultData"].Rows[0]["Error"].ToString() == "") { sys_time = result.Tables["ResultData"].Rows[0]["Data"].ToString(); return(true); } else { errorInf = "获取平台时间失败,接口返回信息如下:\r\nSuccess:" + result.Tables["ResultData"].Rows[0]["Success"].ToString() + "|Error:" + result.Tables["ResultData"].Rows[0]["Error"].ToString() + "|Data:" + result.Tables["ResultData"].Rows[0]["Data"].ToString(); return(false); } } else { errorInf = "平台未返回或返回消息解析失败"; return(false); } } catch { errorInf = "获取平台时间时出错"; return(false); } }
/// <summary> /// 解析收到的信息 /// </summary> /// <param name="receive_Xml">接口返回消息</param> /// <param name="ds">消息解析得到的DataSet</param> /// <returns>收到并解析得到成功时返回true,其他返回false</returns> public DataSet getUploadResult(string receiveXml) { if (receiveXml == "") { INIIO.saveSocketLogInf("【接收的待解析数据为空】"); return(null); } try { string revXml = ini.INIIO.decodeUTF8(receiveXml); INIIO.saveSocketLogInf("【RECEIVED_接收解码后数据】:\r\n" + revXml); DataSet ds = new DataSet(); StringReader stream = new StringReader(revXml); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); return(ds); } catch (Exception er) { INIIO.saveSocketLogInf("【接收数据解析出错】\r\n" + er.Message); return(null); } }
/// <summary> /// 上传标定或自检数据 /// </summary> /// <param name="ZjBdKind">标定或自检数据类型(1、汽油线标定;2、柴油线标定;3、设备状态;4、环境参数校准;5、测功机自检;6、寄生功率自检;7、流量计自检;8、五气分析仪自检;9、烟度计自检;10、双怠速气体分析仪自检;)</param> /// <param name="hash_dt">标定或自检数据哈希表</param> /// <param name="errorInf">上传错误信息</param> /// <returns></returns> public bool UploadBdZjData(int ZjBdKind, Hashtable hash_dt, out string errorInf) { errorInf = ""; try { #region 生成XML数据 string bodyName = "", nodeName = ""; switch (ZjBdKind) { case 1: //汽油线标定 bodyName = "LineCheckPetrols"; nodeName = "LineCheckPetrol"; break; case 2: //柴油线标定 bodyName = "LineCheckDiesels"; nodeName = "LineCheckDiesel"; break; case 3: //检测线设备状态 bodyName = "StationDeviceStatuss"; nodeName = "StationDeviceStatus"; break; case 4: //环境参数校准 bodyName = "EnvParamSensors"; nodeName = "EnvParamSensor"; break; case 5: //测功机自检 bodyName = "DynamometerSelfChecks"; nodeName = "DynamometerSelfCheck"; break; case 6: //寄生功率自检 bodyName = "ParasiticPowerSelfChecks"; nodeName = "ParasiticPowerSelfCheck"; break; case 7: //流量计自检 bodyName = "FlowmeterSelfChecks"; nodeName = "FlowmeterSelfCheck"; break; case 8: //五气分析仪自检 bodyName = "GasAnalyzerSelfChecks"; nodeName = "GasAnalyzerSelfCheck"; break; case 9: //烟度计自检 bodyName = "LightProofSmokeSelfChecks"; nodeName = "LightProofSmokeSelfCheck"; break; case 10: //双怠速气体分析仪自检 bodyName = "TSIGasAnalyzerSelfChecks"; nodeName = "TSIGasAnalyzerSelfCheck"; break; default: errorInf = "输入自检、标定类别有误"; return(false); } XmlDocument xmldoc; XmlElement xmlelem; xmldoc = new XmlDocument(); xmlelem = xmldoc.CreateElement("", "bodyName", ""); xmldoc.AppendChild(xmlelem); XmlNode root = xmldoc.SelectSingleNode("bodyName"); //查找<Employees> XmlElement xe0 = xmldoc.CreateElement(nodeName); //创建一个<Node>节点 //添加固定信息 XmlElement xe01 = xmldoc.CreateElement("CityCode"); xe01.InnerText = cityCode; XmlElement xe02 = xmldoc.CreateElement("StationCode"); xe02.InnerText = stationCode; XmlElement xe03 = xmldoc.CreateElement("SceneCode"); xe03.InnerText = lineCode; xe0.AppendChild(xe01); xe0.AppendChild(xe02); xe0.AppendChild(xe03); //添加动态信息 foreach (string key in hash_dt.Keys) { XmlElement xe_n = xmldoc.CreateElement(key); xe_n.InnerText = hash_dt[key].ToString(); xe0.AppendChild(xe_n); } root.AppendChild(xe0); #endregion string xmlstring = ConvertXmlToString(xmldoc); INIIO.saveSocketLogInf("【SEND_自检标定数据上传(" + bodyName + ")】\r\n" + xmlstring); DataSet result = null; switch (ZjBdKind) { case 1: result = getUploadResult(webservices.UploadLineCheckPetrol(xmlstring)); break; case 2: result = getUploadResult(webservices.UpLoadLineCheckDiesel(xmlstring)); break; case 3: result = getUploadResult(webservices.UploadStationDeviceStatus(xmlstring)); break; case 4: result = getUploadResult(webservices.UploadEnvParamSensor(xmlstring)); break; case 5: result = getUploadResult(webservices.UploadDynamometerSelfCheck(xmlstring)); break; case 6: result = getUploadResult(webservices.UploadParasiticPowerSelfCheck(xmlstring)); break; case 7: result = getUploadResult(webservices.UploadFlowmeterSelfCheck(xmlstring)); break; case 8: result = getUploadResult(webservices.UploadGasAnalyzerSelfCheck(xmlstring)); break; case 9: result = getUploadResult(webservices.UploadLightProofSmokeSelfCheck(xmlstring)); break; case 10: result = getUploadResult(webservices.UploadTSIGasAnalyzerSelfCheck(xmlstring)); break; } if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); if (success.ToUpper() == "TRUE" && error == "") { return(true); } else { errorInf = "Success:" + success.ToString() + "|Error:" + error; return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch (Exception er) { errorInf = er.Message; return(false); } }
/// <summary> /// 发送检测数据(含检测结果及检测过程数据) /// </summary> /// <param name="jcff">检测方法(ASM、SDS、JZJS、LZ、ZYJS)</param> /// <param name="r_or_p">true时为结果数据,false时为过程数据</param> /// <param name="hash_dt">哈希数据表(List<Hashtable> hash_dt为结果数据时只有一个元素、为过程数据时每个元素为一秒数据)</param> /// <param name="errorInf">发送后返回的错误信息</param> /// <returns></returns> public bool UploadTestData(string jcff, bool r_or_p, List <Hashtable> hash_dt, out string errorInf) { errorInf = ""; try { #region 生成待发送XML信息 XmlDocument xmldoc; XmlElement xmlelem; xmldoc = new XmlDocument(); xmlelem = xmldoc.CreateElement("", "Data", ""); xmldoc.AppendChild(xmlelem); XmlNode root = xmldoc.SelectSingleNode("Data");//查找<Employees> string bodyName = ""; int interface_kind = 0; if (r_or_p) { //r_or_p==true时,发送结果数据 switch (jcff) { case "ASM": bodyName = "ASMType"; interface_kind = 1; break; case "SDS": bodyName = "TSIType"; interface_kind = 2; break; case "JZJS": bodyName = "LDType"; interface_kind = 3; break; case "LZ": bodyName = "FilterSmokeData"; interface_kind = 4; break; case "ZYJS": bodyName = "LightProofSmokeData"; interface_kind = 5; break; default: errorInf = "不存在的结果数据上传接口"; return(false); } XmlElement xe_r = xmldoc.CreateElement(bodyName);//创建一个<Node>节点 foreach (string key in hash_dt[0].Keys) { XmlElement xe_n = xmldoc.CreateElement(key); xe_n.InnerText = hash_dt[0][key].ToString(); xe_r.AppendChild(xe_n); } root.AppendChild(xe_r); } else { //r_or_p==false时,发送过程数据 switch (jcff) { case "ASM": bodyName = "ASMProcessType"; interface_kind = 6; break; case "JZJS": bodyName = "LDProcessType"; interface_kind = 7; break; default: errorInf = "不存在的过程数据上传接口"; return(false); } for (int i = 0; i < hash_dt.Count; i++) { XmlElement xe_p = xmldoc.CreateElement(bodyName);//创建一个<Node>节点 foreach (string key in hash_dt[i].Keys) { XmlElement xe_n = xmldoc.CreateElement(key); xe_n.InnerText = hash_dt[i][key].ToString(); xe_p.AppendChild(xe_n); } root.AppendChild(xe_p); } } #endregion string xmlstring = ConvertXmlToString(xmldoc); INIIO.saveSocketLogInf("【SEND_检测数据上传(" + bodyName + ")】\r\n" + xmlstring); DataSet result = null; switch (interface_kind) { case 1: //ASM_Result result = getUploadResult(webservices.UploadASMData(xmlstring)); break; case 2: //SDS_Result result = getUploadResult(webservices.UploadTSIData(xmlstring)); break; case 3: //JZJS_Result result = getUploadResult(webservices.UploadLDData(xmlstring)); break; case 4: //LZ_Result result = getUploadResult(webservices.UploadFilterSmokeData(xmlstring)); break; case 5: //ZYJS_Result result = getUploadResult(webservices.UploadLightProofSmokeData(xmlstring)); break; case 6: //ASM_Process result = getUploadResult(webservices.UploadASMProcessData(xmlstring)); break; case 7: //JZJS_Process result = getUploadResult(webservices.UploadLDProcessData(xmlstring)); break; } if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); if (success.ToUpper() == "TRUE" && error == "") { return(true); } else { errorInf = "Success:" + success.ToString() + "|Error:" + error; return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch (Exception er) { errorInf = "执行上传检测数据错误:" + er.Message; return(false); } }
/// <summary> /// 检测主信息 /// </summary> /// <param name="model"></param> /// <param name="errorInf"></param> /// <returns></returns> public bool UploadMainTestInfo(Hashtable model, out string errorInf) { errorInf = ""; try { #region 生成待发送XML信息 XmlDocument xmldoc; XmlElement xmlelem; xmldoc = new XmlDocument(); xmlelem = xmldoc.CreateElement("", "Data", ""); xmldoc.AppendChild(xmlelem); XmlNode root = xmldoc.SelectSingleNode("Data"); //查找<Employees> XmlElement xe0 = xmldoc.CreateElement("InspectionData"); //创建一个<Node>节点 XmlElement xe1 = xmldoc.CreateElement("StationCode"); xe1.InnerText = stationCode; XmlElement xe2 = xmldoc.CreateElement("CityCode"); xe2.InnerText = cityCode; XmlElement xe3 = xmldoc.CreateElement("CountyCode"); //xe3.InnerText = ; xe0.AppendChild(xe1); xe0.AppendChild(xe2); xe0.AppendChild(xe3); foreach (string key in model.Keys) { XmlElement xe_n = xmldoc.CreateElement(key); xe_n.InnerText = model[key].ToString(); xe0.AppendChild(xe_n); } root.AppendChild(xe0); #endregion string xmlstring = ConvertXmlToString(xmldoc); INIIO.saveSocketLogInf("【SEND_主检测信息上传(UploadInspectionData)】\r\n" + xmlstring); DataSet result = getUploadResult(webservices.UploadInspectionData(xmlstring)); if (result != null) { string success = result.Tables["ResultData"].Rows[0]["Success"].ToString(); string error = result.Tables["ResultData"].Rows[0]["Error"].ToString(); if (success.ToUpper() == "TRUE" && error == "") { return(true); } else { errorInf = "Success:" + success.ToString() + "|Error:" + error; return(false); } } else { errorInf = "无返回消息或返回信息解析失败"; return(false); } } catch (Exception er) { errorInf = "执行上传主检测信息错误:" + er.Message; return(false); } }
public void ReadCheckResultString(string xmlstring, out string result, out string info, out string valueCO, out string valueHC, out string valueNO, out string valueHCNO, out string valueCOLimit, out string valueHCLimit, out string valueNOLimit, out string valueHCNOLimit, out string valueCOResult, out string valueHCResult, out string valueNOResult, out string valueHCNOResult, out string result1, out string smokeK100, out string smokeK90, out string smokeK80, out string power, out string mortorSpeed, out string smokeK100Limit, out string smokeK90Limit, out string smokeK80Limit, out string powerLimit, out string mortorSpeedLimit, out string smokeK100Result, out string smokeK90Result, out string smokeK80Result, out string powerResult, out string mortorSpeedResult, out string result2, out string coLowValue, out string hcLowValue, out string coHighValue, out string hcHighValue, out string lambdaValue, out string coLowValueLimit, out string hcLowValueLimit, out string coHighValueLimit, out string hcHighValueLimit, out string coLowValueResult, out string hcLowValueResult, out string coHighValueResult, out string hcHighValueResult, out string lambdaValueResult, out string result3, out string smokeValue1, out string smokeValue2, out string smokeValue3, out string avgSmoke, out string smokeLimit, out string result4 ) { info = ""; result = ""; valueCO = ""; valueHC = ""; valueNO = ""; valueHCNO = ""; valueCOLimit = ""; valueHCLimit = ""; valueNOLimit = ""; valueHCNOLimit = ""; valueCOResult = ""; valueHCResult = ""; valueNOResult = ""; valueHCNOResult = ""; result1 = ""; smokeK100 = ""; smokeK90 = ""; smokeK80 = ""; power = ""; mortorSpeed = ""; smokeK100Limit = ""; smokeK90Limit = ""; smokeK80Limit = ""; powerLimit = ""; mortorSpeedLimit = ""; smokeK100Result = ""; smokeK90Result = ""; smokeK80Result = ""; powerResult = ""; mortorSpeedResult = ""; result2 = ""; coLowValue = ""; hcLowValue = ""; coHighValue = ""; hcHighValue = ""; lambdaValue = ""; coLowValueLimit = ""; hcLowValueLimit = ""; coHighValueLimit = ""; hcHighValueLimit = ""; coLowValueResult = ""; hcLowValueResult = ""; coHighValueResult = ""; hcHighValueResult = ""; lambdaValueResult = ""; result3 = ""; smokeValue1 = ""; smokeValue2 = ""; smokeValue3 = ""; avgSmoke = ""; smokeLimit = ""; result4 = ""; INIIO.saveLogInf(xmlstring); try { DataSet ds = new DataSet(); StringReader stream = new StringReader(xmlstring); XmlTextReader reader = new XmlTextReader(stream); ds.ReadXml(reader); DataTable dt1 = ds.Tables[0]; result = dt1.Rows[0]["result"].ToString(); if (result == "0") { info = dt1.Rows[0]["info"].ToString(); } else { dt1 = ds.Tables["info"]; valueCO = dt1.Rows[0]["valueCO"].ToString(); valueHC = dt1.Rows[0]["valueHC"].ToString(); valueNO = dt1.Rows[0]["valueNO"].ToString(); valueHCNO = dt1.Rows[0]["valueHCNO"].ToString(); valueCOLimit = dt1.Rows[0]["valueCOLimit"].ToString(); valueHCLimit = dt1.Rows[0]["valueHCLimit"].ToString(); valueNOLimit = dt1.Rows[0]["valueNOLimit"].ToString(); valueHCNOLimit = dt1.Rows[0]["valueHCNOLimit"].ToString(); valueCOResult = dt1.Rows[0]["valueCOResult"].ToString(); valueHCResult = dt1.Rows[0]["valueHCResult"].ToString(); valueNOResult = dt1.Rows[0]["valueNOResult"].ToString(); valueHCNOResult = dt1.Rows[0]["valueHCNOResult"].ToString(); result1 = dt1.Rows[0]["result1"].ToString(); smokeK100 = dt1.Rows[0]["smokeK100"].ToString(); smokeK90 = dt1.Rows[0]["smokeK90"].ToString(); smokeK80 = dt1.Rows[0]["smokeK80"].ToString(); power = dt1.Rows[0]["power"].ToString(); mortorSpeed = dt1.Rows[0]["mortorSpeed"].ToString(); smokeK100Limit = dt1.Rows[0]["smokeK100Limit"].ToString(); smokeK90Limit = dt1.Rows[0]["smokeK90Limit"].ToString(); smokeK80Limit = dt1.Rows[0]["smokeK80Limit"].ToString(); powerLimit = dt1.Rows[0]["powerLimit"].ToString(); mortorSpeedLimit = dt1.Rows[0]["mortorSpeedLimit"].ToString(); smokeK100Result = dt1.Rows[0]["smokeK100Result"].ToString(); smokeK90Result = dt1.Rows[0]["smokeK90Result"].ToString(); smokeK80Result = dt1.Rows[0]["smokeK80Result"].ToString(); powerResult = dt1.Rows[0]["powerResult"].ToString(); mortorSpeedResult = dt1.Rows[0]["mortorSpeedResult"].ToString(); result2 = dt1.Rows[0]["result2"].ToString(); coLowValue = dt1.Rows[0]["coLowValue"].ToString(); hcLowValue = dt1.Rows[0]["hcLowValue"].ToString(); coHighValue = dt1.Rows[0]["coHighValue"].ToString(); hcHighValue = dt1.Rows[0]["hcHighValue"].ToString(); lambdaValue = dt1.Rows[0]["lambdaValue"].ToString(); coLowValueLimit = dt1.Rows[0]["coLowValueLimit"].ToString(); hcLowValueLimit = dt1.Rows[0]["hcLowValueLimit"].ToString(); coHighValueLimit = dt1.Rows[0]["coHighValueLimit"].ToString(); hcHighValueLimit = dt1.Rows[0]["hcHighValueLimit"].ToString(); coLowValueResult = dt1.Rows[0]["coLowValueResult"].ToString(); hcLowValueResult = dt1.Rows[0]["hcLowValueResult"].ToString(); coHighValueResult = dt1.Rows[0]["coHighValueResult"].ToString(); hcHighValueResult = dt1.Rows[0]["hcHighValueResult"].ToString(); lambdaValueResult = dt1.Rows[0]["lambdaValueResult"].ToString(); result3 = dt1.Rows[0]["result3"].ToString(); smokeValue1 = dt1.Rows[0]["smokeValue1"].ToString(); smokeValue2 = dt1.Rows[0]["smokeValue2"].ToString(); smokeValue3 = dt1.Rows[0]["smokeValue3"].ToString(); avgSmoke = dt1.Rows[0]["avgSmoke"].ToString(); smokeLimit = dt1.Rows[0]["smokeLimit"].ToString(); result4 = dt1.Rows[0]["result4"].ToString(); } } catch (Exception er) { result = ""; info = er.Message; } }