Пример #1
0
        /// <summary>
        /// 发整备质量结果
        /// </summary>
        /// <param name="model"></param>
        /// <param name="code"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public bool writeZbzlDetails(gxZbzlDetailResult 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("jcbh");      //创建一个<Node>节点
                xe101.InnerText = model.jcbh;
                XmlElement xe102 = xmldoc.CreateElement("jyxm");      //创建一个<Node>节点
                xe102.InnerText = "PB";
                XmlElement xe103 = xmldoc.CreateElement("zxh");       //创建一个<Node>节点
                xe103.InnerText = model.zxh;
                XmlElement xe104 = xmldoc.CreateElement("jycs");      //创建一个<Node>节点
                xe104.InnerText = model.jycs;
                XmlElement xe105 = xmldoc.CreateElement("zbzl");      //创建一个<Node>节点
                xe105.InnerText = model.zbzl;
                XmlElement xe106 = xmldoc.CreateElement("zbzlpd");    //创建一个<Node>节点
                xe106.InnerText = model.zbzlpd;
                XmlElement xe107 = xmldoc.CreateElement("cbmc");      //创建一个<Node>节点
                xe107.InnerText = XmlOperation.encodeGBK(model.cbmc);
                XmlElement xe108 = xmldoc.CreateElement("ip");        //创建一个<Node>节点
                xe108.InnerText = model.ip;
                xe1.AppendChild(xe101);
                xe1.AppendChild(xe102);
                xe1.AppendChild(xe103);
                xe1.AppendChild(xe104);
                xe1.AppendChild(xe105);
                xe1.AppendChild(xe106);
                xe1.AppendChild(xe107);
                xe1.AppendChild(xe108);
                root.AppendChild(xe1);

                string send_xml = XmlOperation.ConvertXmlToStringUTF8(xmldoc);
                IOControl.saveXmlLogInf("writeZbzlDetails_Send:  Xtlb:" + Xtlb + "|Jkid:18C81|Yhdh:" + Yhdh + "|Jkxh:" + Jkxh + "\r\n" + send_xml + "\r\n");

                StringBuilder receiveXml = new StringBuilder();
                receiveXml.Length = 10240;
                gxDll.writeObjectOut(Xtlb, "18C81", send_xml, Yhdh, Jkxh, receiveXml);
                IOControl.saveXmlLogInf("Received:\r\n" + receiveXml.ToString() + "\r\n");

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

                return(true);
            }
            catch (Exception er)
            {
                IOControl.saveXmlLogInf("writeZbzlDetails_Send_Error: \r\n" + er.Message + "\r\n");
                return(false);
            }
        }
Пример #2
0
        public DataTable GetVehicleInf(string hphm, string hpzl, 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("QueryCondition"); //创建一个<Node>节点
                XmlElement xe2  = xmldoc.CreateElement("hphm");           //创建一个<Node>节点
                xe2.InnerText = XmlOperation.encodeGBK(hphm);
                XmlElement xe3 = xmldoc.CreateElement("hpzl");            //创建一个<Node>节点
                xe3.InnerText = hpzl;
                XmlElement xe4 = xmldoc.CreateElement("bm");              //创建一个<Node>节点
                xe4.InnerText = "gbk";
                xe1.AppendChild(xe2);
                xe1.AppendChild(xe3);
                xe1.AppendChild(xe4);
                root.AppendChild(xe1);

                string send_xml = XmlOperation.ConvertXmlToStringGBK(xmldoc);
                IOControl.saveXmlLogInf("GetVehicleInf_Send:  Xtlb:" + Xtlb + "|Jkid:18C91|Yhdh:" + Yhdh + "|Jkxh:" + Jkxh + "\r\n" + send_xml + "\r\n");

                StringBuilder receiveXml = new StringBuilder();
                receiveXml.Length = 10240;
                gxDll.queryObjectOut(Xtlb, "18C91", send_xml, Yhdh, Jkxh, receiveXml);
                IOControl.saveXmlLogInf("Received:\r\n" + receiveXml.ToString() + "\r\n");

                return(XmlOperation.ReadXmlToDatatable(receiveXml.ToString(), out code, out message));
            }
            catch (Exception er)
            {
                IOControl.saveXmlLogInf("GetVehicleInf_Send_Error: \r\n" + er.Message + "\r\n");
                return(null);
            }
        }