コード例 #1
0
        /// <summary>
        /// 上料扫码上传
        /// </summary>
        /// <param name="taryInfo"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool UploadBattery(TrayInfo taryInfo, out string msg)
        {
            string     xml = GetXML("TrayInfo", new string[] { "BarcodeNo=" + taryInfo.BarcodeNo, "TrayCode=" + taryInfo.TrayCode, "ProcessCode=" + taryInfo.ProcessCode, "UserNumber=" + taryInfo.UserNumber, "InputTime=" + taryInfo.InputTime });
            ServiceAPI ws  = new ServiceAPI();

#if ISOFFLINE
            string returnXml = @"<?xml version='1.0' encoding='utf-8'?>
                                <response>
                                    <table>
                                        <rows>
                                            <returncode>1</returncode>
                                            <errormsg>OK</errormsg>
                                        </rows>
                                    </table>
                                </response>";
#else
            string returnXml = string.Empty;
            try
            {
                returnXml = returnXml = ws.SetTrayInfo(xml);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(false);
            }
#endif
            bool b = CheckXML(returnXml, out msg);
            if (!string.IsNullOrEmpty(msg))
            {
                LogHelper.WriteError(msg + "xml" + xml);
            }

            TengDa.LogHelper.WriteInfo("XML上传:\r\n" + xml);
            TengDa.LogHelper.WriteInfo("XML返回:\r\n" + returnXml);
            return(b);
        }