Пример #1
0
        /// <summary>
        /// 发送照片
        /// </summary>
        /// <param name="jylsh"></param>
        /// <param name="jycs"></param>
        /// <param name="zpzl"></param>
        /// <param name="zp_path"></param>
        /// <param name="code"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public bool writePicture(string jylsh, string jycs, string zpzl, string zp_path, out int code, out string message)
        {
            try
            {
                XmlDocument xmldoc  = new XmlDocument();
                XmlElement  xmlelem = xmldoc.CreateElement("", "root", "");
                xmldoc.AppendChild(xmlelem);
                XmlNode    root = xmldoc.SelectSingleNode("root");   //查找<Employees>
                XmlElement xe1  = xmldoc.CreateElement("vehispara"); //创建一个<Node>节点

                XmlElement xe11 = xmldoc.CreateElement("jylsh");     //创建一个<Node>节点
                xe11.InnerText = jylsh;
                XmlElement xe12 = xmldoc.CreateElement("jycs");      //创建一个<Node>节点
                xe12.InnerText = jycs;
                XmlElement xe13 = xmldoc.CreateElement("zpzl");      //创建一个<Node>节点
                xe13.InnerText = zpzl;
                XmlElement xe14 = xmldoc.CreateElement("zp");        //创建一个<Node>节点
                if (zp_path != "")
                {
                    xe14.InnerText = XmlOperation.encodeUTF8(XmlOperation.PushTxt(zp_path));
                }
                else
                {
                    xe14.InnerText = "";
                }
                xe1.AppendChild(xe11);
                xe1.AppendChild(xe12);
                xe1.AppendChild(xe13);
                xe1.AppendChild(xe14);

                string send_xml = XmlOperation.ConvertXmlToStringUTF8(xmldoc);
                IOControl.saveXmlLogInf("writePicture_Send:  00C63\r\n" + XmlOperation.removePictureInfo(send_xml, new string[4] {
                    @"<zp>", @"<zp1>", @"<zp2>", @"<zp3>"
                }, new string[4] {
                    @"</zp>", @"</zp1>", @"</zp2>", @"</zp3>"
                }) + "\r\n");

                ReturnInfo receiveInf = outlineservice.writeObjectOut(jkxlh, "00C63", send_xml);
                code    = receiveInf.code;
                message = receiveInf.message;
                IOControl.saveXmlLogInf("Received:\r\nCode:" + code + "|Message:" + message + "|InfoXML:\r\n" + receiveInf.infoXML + "\r\n");

                return(true);
            }
            catch (Exception er)
            {
                code    = 0;
                message = "";
                IOControl.saveXmlLogInf("writePicture_Send_Error: \r\n" + er.Message + "\r\n");
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="jylsh"></param>
        /// <param name="hphm"></param>
        /// <param name="hpzl"></param>
        /// <param name="clsbdh"></param>
        /// <param name="filePath"></param>
        /// <param name="zplx"></param>
        /// <param name="code"></param>
        /// <param name="message"></param>
        public bool writeTestImage(string jylsh, string hphm, string hpzl, string clsbdh, string filePath, string zplx, out string code, out string message)
        {
            code    = "";
            message = "";
            try
            {
                XmlDocument xmldoc  = new XmlDocument();
                XmlElement  xmlelem = xmldoc.CreateElement("", "root", "");
                xmldoc.AppendChild(xmlelem);
                XmlNode    root  = xmldoc.SelectSingleNode("root");   //查找<Employees>
                XmlElement xe1   = xmldoc.CreateElement("vehispara"); //创建一个<Node>节点
                XmlElement xe101 = xmldoc.CreateElement("jylsh");     //创建一个<Node>节点
                xe101.InnerText = jylsh;
                XmlElement xe102 = xmldoc.CreateElement("hphm");      //创建一个<Node>节点
                xe102.InnerText = XmlOperation.encodeUTF8(hphm);
                XmlElement xe103 = xmldoc.CreateElement("hpzl");      //创建一个<Node>节点
                xe103.InnerText = hpzl;
                XmlElement xe104 = xmldoc.CreateElement("clsbdh");    //创建一个<Node>节点
                xe104.InnerText = clsbdh;
                XmlElement xe105 = xmldoc.CreateElement("zplx");      //创建一个<Node>节点
                xe105.InnerText = zplx;
                XmlElement xe106 = xmldoc.CreateElement("zp");        //创建一个<Node>节点
                xe106.InnerText = XmlOperation.PushTxt(filePath);
                xe1.AppendChild(xe101);
                xe1.AppendChild(xe102);
                xe1.AppendChild(xe103);
                xe1.AppendChild(xe104);
                xe1.AppendChild(xe105);
                xe1.AppendChild(xe106);
                root.AppendChild(xe1);

                string send_xml = XmlOperation.ConvertXmlToStringUTF8(xmldoc);
                IOControl.saveXmlLogInf("writeTestImage_Send:  18W03\r\n" + send_xml + "\r\n");

                string receiveXml = HttpUtility.UrlDecode(outlineservice.writeObjectOut(Xtlb, Jkxlh, "18W03", send_xml));
                IOControl.saveXmlLogInf("Received:\r\n" + receiveXml + "\r\n");

                XmlOperation.ReadACKString(receiveXml, out code, out message);

                return(true);
            }
            catch (Exception er)
            {
                IOControl.saveXmlLogInf("writeTestImage_Send_Error: \r\n" + er.Message + "\r\n");
                return(false);
            }
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <param name="code">1:成功 小于0:失败</param>
        /// <param name="message"></param>
        public bool write18C63(wk18C63 model, out string code, out string message)
        {
            code    = "";
            message = "";
            try
            {
                XmlDocument xmldoc  = new XmlDocument();
                XmlElement  xmlelem = xmldoc.CreateElement("", "root", "");
                xmldoc.AppendChild(xmlelem);

                XmlNode    root  = xmldoc.SelectSingleNode("root");   //查找<Employees>
                XmlElement xe1   = xmldoc.CreateElement("vehispara"); //创建一个<Node>节点
                XmlElement xe101 = xmldoc.CreateElement("jylsh");     //创建一个<Node>节点
                xe101.InnerText = model.jylsh;
                XmlElement xe102 = xmldoc.CreateElement("jyjgbh");    //创建一个<Node>节点
                xe102.InnerText = model.jyjgbh;
                XmlElement xe103 = xmldoc.CreateElement("jcxdh");     //创建一个<Node>节点
                xe103.InnerText = model.jcxdh;
                XmlElement xe104 = xmldoc.CreateElement("jycs");      //创建一个<Node>节点
                xe104.InnerText = model.jycs;
                XmlElement xe105 = xmldoc.CreateElement("hphm");      //创建一个<Node>节点
                xe105.InnerText = XmlOperation.encodeUTF8(model.hphm);
                XmlElement xe106 = xmldoc.CreateElement("hpzl");      //创建一个<Node>节点
                if (model.hpzl.Contains("("))
                {
                    xe106.InnerText = model.hpzl.Split('(')[1].Split(')')[0];
                }
                else
                {
                    xe106.InnerText = model.hpzl;
                }
                XmlElement xe107 = xmldoc.CreateElement("clsbdh"); //创建一个<Node>节点
                xe107.InnerText = model.clsbdh;
                XmlElement xe108 = xmldoc.CreateElement("zp");     //创建一个<Node>节点
                if (model.zp != "")
                {
                    xe108.InnerText = XmlOperation.PushTxt(model.zp);
                }
                else
                {
                    xe108.InnerText = "";
                }
                XmlElement xe109 = xmldoc.CreateElement("pssj"); //创建一个<Node>节点
                xe109.InnerText = model.pssj;
                XmlElement xe110 = xmldoc.CreateElement("jyxm"); //创建一个<Node>节点
                xe110.InnerText = model.jyxm;
                XmlElement xe111 = xmldoc.CreateElement("zpzl"); //创建一个<Node>节点
                xe111.InnerText = model.zpzl;
                xe1.AppendChild(xe101);
                xe1.AppendChild(xe102);
                xe1.AppendChild(xe103);
                xe1.AppendChild(xe104);
                xe1.AppendChild(xe105);
                xe1.AppendChild(xe106);
                xe1.AppendChild(xe107);
                xe1.AppendChild(xe108);
                xe1.AppendChild(xe109);
                xe1.AppendChild(xe110);
                xe1.AppendChild(xe111);
                root.AppendChild(xe1);

                string send_xml = XmlOperation.ConvertXmlToStringUTF8(xmldoc);
                IOControl.saveXmlLogInf("write18C63_Send:  18C63\r\n" + XmlOperation.removePictureInfo(send_xml, new string[1] {
                    @"<zp>"
                }, new string[1] {
                    @"</zp>"
                }) + "\r\n");

                string receiveXml = HttpUtility.UrlDecode(outlineservice.writeObjectOut(Xtlb, Jkxlh, "18C63", send_xml));
                IOControl.saveXmlLogInf("Received:\r\n" + receiveXml + "\r\n");

                XmlOperation.ReadACKString(receiveXml, out code, out message);

                return(true);
            }
            catch (Exception er)
            {
                IOControl.saveXmlLogInf("write18C63_Send_Error: \r\n" + er.Message + "\r\n");
                return(false);
            }
        }
Пример #4
0
        public bool writeTestImage(string jylsh, string jyjgbh, string jcxdh, string jycs, string hphm, string hpzl, string clsbdh, string filePath, string pssj, string jyxm, string zpzl, out string code, out string message)
        {
            code    = "";
            message = "";
            try
            {
                XmlDocument xmldoc  = new XmlDocument();
                XmlElement  xmlelem = xmldoc.CreateElement("", "root", "");
                xmldoc.AppendChild(xmlelem);
                XmlNode    root  = xmldoc.SelectSingleNode("root");   //查找<Employees>
                XmlElement xe1   = xmldoc.CreateElement("vehispara"); //创建一个<Node>节点
                XmlElement xe101 = xmldoc.CreateElement("jylsh");     //创建一个<Node>节点
                xe101.InnerText = jylsh;
                XmlElement xe102 = xmldoc.CreateElement("jyjgbh");    //创建一个<Node>节点
                xe102.InnerText = jylsh;
                XmlElement xe103 = xmldoc.CreateElement("jcxdh");     //创建一个<Node>节点
                xe103.InnerText = jylsh;
                XmlElement xe104 = xmldoc.CreateElement("jycs");      //创建一个<Node>节点
                xe104.InnerText = jylsh;
                XmlElement xe105 = xmldoc.CreateElement("hphm");      //创建一个<Node>节点
                xe105.InnerText = XmlOperation.encodeUTF8(hphm);
                XmlElement xe106 = xmldoc.CreateElement("hpzl");      //创建一个<Node>节点
                xe106.InnerText = hpzl;
                XmlElement xe107 = xmldoc.CreateElement("clsbdh");    //创建一个<Node>节点
                xe107.InnerText = clsbdh;
                XmlElement xe108 = xmldoc.CreateElement("pssj");      //创建一个<Node>节点
                xe108.InnerText = jylsh;
                XmlElement xe109 = xmldoc.CreateElement("jyxm");      //创建一个<Node>节点
                xe109.InnerText = jylsh;
                XmlElement xe110 = xmldoc.CreateElement("zpzl");      //创建一个<Node>节点
                xe110.InnerText = jylsh;
                XmlElement xe111 = xmldoc.CreateElement("zp");        //创建一个<Node>节点
                xe111.InnerText = XmlOperation.PushTxt(filePath);
                xe1.AppendChild(xe101);
                xe1.AppendChild(xe102);
                xe1.AppendChild(xe103);
                xe1.AppendChild(xe104);
                xe1.AppendChild(xe105);
                xe1.AppendChild(xe106);
                xe1.AppendChild(xe107);
                xe1.AppendChild(xe108);
                xe1.AppendChild(xe109);
                xe1.AppendChild(xe110);
                xe1.AppendChild(xe111);

                string send_xml = XmlOperation.ConvertXmlToStringUTF8(xmldoc);
                IOControl.saveXmlLogInf("GetVehicleInf_Send:  XTLB:" + Xtlb + "|JKXLH:" + Jkxlh + "|JKID:18C63\r\n" + XmlOperation.removePictureInfo(send_xml, new string[1] {
                    @"<zp>"
                }, new string[1] {
                    @"</zp>"
                }) + "\r\n");

                string receiveXml = HttpUtility.UrlDecode(outlineservice.writeObjectOut(Xtlb, Jkxlh, "18C63", send_xml));
                IOControl.saveXmlLogInf("Received:\r\n" + receiveXml + "\r\n");

                XmlOperation.ReadACKString(receiveXml, out code, out message);

                return(true);
            }
            catch (Exception er)
            {
                IOControl.saveXmlLogInf("GetVehicleInf_Send_Error: \r\n" + er.Message + "\r\n");
                return(false);
            }
        }
Пример #5
0
        public bool SendPhoto(string jylsh, string jycs, string jyxm, string hphm, string hpzl, string vin, DateTime pssj, string zpzl, string zp_path)
        {
            try
            {
                XmlDocument xmldoc  = new XmlDocument();
                XmlElement  xmlelem = xmldoc.CreateElement("", "root", "");
                xmldoc.AppendChild(xmlelem);
                XmlNode    root = xmldoc.SelectSingleNode("root");   //查找<Employees>
                XmlElement xe1  = xmldoc.CreateElement("vehispara"); //创建一个<Node>节点

                XmlElement xe11 = xmldoc.CreateElement("jyjgbh");    //创建一个<Node>节点
                xe11.InnerText = station_id;
                XmlElement xe12 = xmldoc.CreateElement("jcxdh");     //创建一个<Node>节点
                xe12.InnerText = line_id;
                XmlElement xe13 = xmldoc.CreateElement("jylsh");     //创建一个<Node>节点
                xe13.InnerText = jylsh;
                XmlElement xe14 = xmldoc.CreateElement("jycs");      //创建一个<Node>节点
                xe14.InnerText = jycs;
                XmlElement xe15 = xmldoc.CreateElement("jyxm");      //创建一个<Node>节点
                xe15.InnerText = jyxm;
                XmlElement xe16 = xmldoc.CreateElement("hphm");      //创建一个<Node>节点
                xe16.InnerText = XmlOperation.encodeUTF8(hphm);
                XmlElement xe17 = xmldoc.CreateElement("hpzl");      //创建一个<Node>节点
                xe17.InnerText = hpzl;
                XmlElement xe18 = xmldoc.CreateElement("clsbdh");    //创建一个<Node>节点
                xe18.InnerText = vin;
                XmlElement xe19 = xmldoc.CreateElement("pssj");      //创建一个<Node>节点
                xe19.InnerText = pssj.ToString("yyyy-MM-dd HH:mm:ss");
                XmlElement xe110 = xmldoc.CreateElement("zpzl");     //创建一个<Node>节点
                xe110.InnerText = zpzl;
                XmlElement xe111 = xmldoc.CreateElement("zp");       //创建一个<Node>节点
                xe111.InnerText = XmlOperation.encodeUTF8(XmlOperation.PushTxt(zp_path));
                XmlElement xe112 = xmldoc.CreateElement("sqip");     //创建一个<Node>节点
                xe112.InnerText = local_ip;

                xe1.AppendChild(xe11);
                xe1.AppendChild(xe12);
                xe1.AppendChild(xe13);
                xe1.AppendChild(xe14);
                xe1.AppendChild(xe15);
                xe1.AppendChild(xe16);
                xe1.AppendChild(xe17);
                xe1.AppendChild(xe18);
                xe1.AppendChild(xe19);
                xe1.AppendChild(xe110);
                xe1.AppendChild(xe111);
                xe1.AppendChild(xe112);
                root.AppendChild(xe1);

                string send_xml = XmlOperation.ConvertXmlToStringUTF8(xmldoc);
                IOControl.saveXmlLogInf("SendPhoto_Send:   18C63 (照片种类(" + zpzl + ")\r\n" + XmlOperation.removePictureInfo(send_xml, new string[1] {
                    @"<zp>"
                }, new string[1] {
                    @"</zp>"
                }) + "\r\n");

                string receiveXml = HttpUtility.UrlDecode(upload_interface.writeObjectOut(xtlb, jkxlh, "18C63", send_xml));
                IOControl.saveXmlLogInf("Received:\r\n" + receiveXml + "\r\n");

                string code, message;
                if (XmlOperation.ReadACKString(receiveXml, out code, out message) && code == "1")
                {
                    return(true);
                }
                else
                {
                    IOControl.saveXmlLogInf("发送照片(" + zpzl + ")失败:\r\n" + message + "\r\n");
                    return(false);
                }
            }
            catch (Exception er)
            {
                IOControl.saveXmlLogInf("SendPhoto_Send_Error: \r\n" + er.Message + "\r\n");
                return(false);
            }
        }