Пример #1
0
        /// <summary>
        /// 向服务器获取数据并解析
        /// </summary>
        /// <param name="eid"></param>
        /// <param name="procedure"></param>
        /// <param name="planCode"></param>
        /// <param name="station"></param>
        /// <param name="result"></param>
        /// <param name="testData"></param>
        /// <param name="log"></param>
        /// <returns></returns>
        public int DataGetAndAnalysis(string eid, string procedure, string planCode, string station
                                      , int result, string testData, string log)
        {
            int ret = -1;

            //将请求数据序列化
            RequestInfo requestInfo = new RequestInfo();

            requestInfo.eid       = eid;
            requestInfo.procedure = procedure;
            requestInfo.planCode  = planCode;
            requestInfo.station   = station;
            requestInfo.result    = result;
            requestInfo.testData  = testData;
            requestInfo.log       = log;
            string requestStr = JsonConvert.SerializeObject(requestInfo);

            //开始请求
            HttpRequestTask task        = new HttpRequestTask(url, requestStr);
            string          responseStr = task.GetResponse();

            //解析响应数据
            response = JsonConvert.DeserializeObject(responseStr, typeof(ResponseInfo)) as ResponseInfo;

            ret = (response.code == (int)ReturnCode.执行成功) ? 0 : -1;
            return(ret);
        }
Пример #2
0
        /// <summary>
        /// 向服务器获取数据并解析
        /// </summary>
        /// <param name="type"></param>
        /// <param name="data"></param>
        public int DataGetAndAnalysis(string planCode)
        {
            int ret = -1;

            //将请求数据序列化
            RequestInfo requestInfo = new RequestInfo();

            requestInfo.type = 1;       //获取基本信息的方式 1为根据计划单获取
            requestInfo.data = planCode;
            string requestStr = JsonConvert.SerializeObject(requestInfo);

            //开始请求
            HttpRequestTask task        = new HttpRequestTask(url, requestStr);
            string          responseStr = null;

            try
            {
                responseStr = task.GetResponse();
            }
            catch
            {
                throw;
            }

            //解析响应数据
            response = JsonConvert.DeserializeObject(responseStr, typeof(ResponseInfo)) as ResponseInfo;

            ret = (response.code == (int)ReturnCode.执行成功) ? 0 : -1;
            return(ret);
        }
Пример #3
0
        /// <summary>
        /// 向服务器获取数据并解析
        /// </summary>
        /// <param name="eid"></param>
        /// <param name="procedure"></param>
        /// <param name="planCode"></param>
        /// <param name="station"></param>
        /// <param name="result"></param>
        /// <param name="testData"></param>
        /// <param name="log"></param>
        /// <returns></returns>
        public int DataGetAndAnalysis(string imei = null, string iccid = null, string imsi = null, string eid = null, string sn = null)
        {
            int ret = -1;

            //将请求数据序列化
            RequestInfo requestInfo = new RequestInfo();

            requestInfo.factoryId    = ConfigInfo.FactoryId;
            requestInfo.workOrderSn  = ConfigInfo.WorkOrderSn;
            requestInfo.boxSn        = ConfigInfo.BoxSn;
            requestInfo.bindingParam = string.Format("{0}-{1}-{2}-{3}-{4}-{5}", imei, iccid, imsi, eid, sn);


            //requestInfo.eid = eid;
            //requestInfo.procedure = procedure;
            //requestInfo.planCode = planCode;
            //requestInfo.station = station;
            //requestInfo.result = result;
            //requestInfo.testData = testData;
            //requestInfo.log = log;

            string requestStr = JsonConvert.SerializeObject(requestInfo);

            //开始请求
            HttpRequestTask task = new HttpRequestTask(url, requestStr);
            string          responseStr;

            ret = task.GetResponse(out responseStr);

            //解析响应数据
            response = JsonConvert.DeserializeObject(responseStr, typeof(ResponseInfo)) as ResponseInfo;

            //ret = (response.code == (int)ReturnCode.执行成功) ? 0 : -1;
            return(ret);
        }
Пример #4
0
        /// <summary>
        /// 向服务器获取数据并解析
        /// </summary>
        /// <param name="eid"></param>
        /// <param name="procedure"></param>
        /// <param name="planCode"></param>
        /// <param name="station"></param>
        /// <param name="result"></param>
        /// <param name="testData"></param>
        /// <param name="log"></param>
        /// <returns></returns>
        public int DataGetAndAnalysis(out ResponseInfo2 response, string imei = null, string iccid = null, string imsi = null, string eid = null, string sn = null)
        {
            int ret = -1;

            try
            {
                //将请求数据序列化
                RequestInfo requestInfo = new RequestInfo();
                requestInfo.factoryId    = ConfigInfo.FactoryId;
                requestInfo.workOrderSn  = ConfigInfo.WorkOrderSn;
                requestInfo.boxSn        = ConfigInfo.BoxSn;
                requestInfo.bindingParam = string.Format("{0}-{1}-{2}-{3}-{4}", imei, iccid, imsi, eid, sn);

                string requestStr = JsonConvert.SerializeObject(requestInfo);

                //开始请求
                HttpRequestTask task = new HttpRequestTask(url, requestStr);
                string          responseStr;
                ret = task.GetResponse(out responseStr);

                //解析响应数据
                response = JsonConvert.DeserializeObject(responseStr, typeof(ResponseInfo2)) as ResponseInfo2;
            }
            catch (Exception ex)
            {
                throw new MyException(ex.Message);
            }

            return(ret);
        }
Пример #5
0
        /// <summary>
        /// 向服务器获取数据并解析
        /// </summary>
        /// <param name="eid"></param>
        /// <param name="procedure"></param>
        /// <param name="planCode"></param>
        /// <param name="station"></param>
        /// <param name="result"></param>
        /// <param name="testData"></param>
        /// <param name="log"></param>
        /// <returns></returns>
        public int DataGetAndAnalysis(out ResponseInfo response, string imei = null, string iccid = null, string imsi = null, string eid = null, string sn = null)
        {
            int ret = -1;

            try
            {
                //将请求数据序列化
                RequestInfo requestInfo = new RequestInfo();
                requestInfo.factoryId   = ConfigInfo.FactoryId;
                requestInfo.workOrderSn = ConfigInfo.WorkOrderSn;
                //string a = ConfigInfo.Token;
                requestInfo.bindingParam = string.Format("{0}-{1}-{2}-{3}-{4}", imei, iccid, imsi, eid, sn);


                //requestInfo.eid = eid;
                //requestInfo.procedure = procedure;
                //requestInfo.planCode = planCode;
                //requestInfo.station = station;
                //requestInfo.result = result;
                //requestInfo.testData = testData;
                //requestInfo.log = log;

                string requestStr = JsonConvert.SerializeObject(requestInfo);

                //开始请求
                HttpRequestTask task = new HttpRequestTask(url, requestStr);
                //HttpRequestTask task = new HttpRequestTask("http://111.9.116.150:8088/ailink/authentication/api/v1/sn/imeiPrint", requestStr);
                string responseStr;
                ret = task.GetResponse(out responseStr);

                //解析响应数据
                response = JsonConvert.DeserializeObject(responseStr, typeof(ResponseInfo)) as ResponseInfo;

                //ret = (response.code == (int)ReturnCode.执行成功) ? 0 : -1;
            }
            catch (Exception ex)
            {
                throw new ExceptionHelp.MyException(ex.Message);
            }
            return(ret);
        }
Пример #6
0
        public int DataGetAndAnalysis(string numberSmall, string planCode)
        {
            int ret = -1;

            //将请求数据序列化
            RequestInfo requestInfo = new RequestInfo();

            requestInfo.cn       = numberSmall;
            requestInfo.planCode = planCode;

            string requestStr = JsonConvert.SerializeObject(requestInfo);

            //开始请求
            HttpRequestTask task        = new HttpRequestTask(url, requestStr);
            string          responseStr = task.GetResponse();

            //解析响应数据
            response = JsonConvert.DeserializeObject(responseStr, typeof(ResponseInfo)) as ResponseInfo;

            ret = (response.code == (int)ReturnCode.执行成功) ? 0 : -1;
            return(ret);
        }