예제 #1
0
        /// <summary>
        /// 获?取¨?节¨2假¨′日¨?信?息?é
        /// </summary>
        /// <returns></returns>
        public CalendarInfo GetWorkingDays(string dateTime)
        {
            CalendarInfo calendarInfo = new CalendarInfo();
            //获?取¨?当ì?à前??工?è作á??站?
            string      url      = ConfigurationManager.AppSettings["serverUrl"].ToString();
            string      authCode = CommHelper.Str(6);
            string      token    = CommHelper.Md5(CommHelper.StringToHexString(authCode)).ToUpper();
            string      data     = "authCode=" + authCode + "&token=" + token + "&dateTime=" + dateTime;
            string      result   = CommHelper.Post(url + "/workingDaysVal.eif?", data);
            WorkingDays workDay  = CommHelper.FromJsonTo <WorkingDays>(result);

            if (workDay != null)
            {
                if (workDay.resStatus == 1)
                {
                    calendarInfo = workDay.calendarInfo;
                }
                else
                {
                    LogHelper.Log.Error(workDay.resRemark);
                }
            }
            return(calendarInfo);
        }
 /// <summary>
 ///  处理出场队列中的数据
 /// </summary>
 public void AcceptOutRecord(object state)
 {
     while (true)
     {
         try
         {
             OutRedodeEvent.WaitOne(100);
             while (OutRedodeQue.Count > 0)
             {
                 OutRedodeEvent.WaitOne(100);
                 OUTRECORDALL recordAll = null;
                 lock (AcceptOutRecordDataQueLock)
                 {
                     if (OutRedodeQue.Count > 0)
                     {
                         recordAll = OutRedodeQue.First();
                     }
                 }
                 try
                 {
                     if (null != recordAll)
                     {
                         string     url          = ConfigurationManager.AppSettings["serverUrl"].ToString();
                         string     authCode     = CommHelper.Str(6);
                         string     token        = CommHelper.Md5(CommHelper.StringToHexString(authCode)).ToUpper();
                         string     imgData      = "imgContent=" + recordAll.imgContent + "&imgUrl=" + recordAll.imgUrl + "&authCode=" + authCode + "&token=" + token + "";;
                         string     imgResult    = CommHelper.Post(url + "/inOutImg.eif", imgData);
                         returnData returnResult = CommHelper.FromJsonTo <returnData>(imgResult);
                         LogHelper.Log.Info("车牌号:" + recordAll.outrecord.vehicleNo + ";返回状态:" + returnResult.resStatus + ";返回信息:" + returnResult.resRemark);
                         if (null != returnResult)
                         {
                             if (returnResult.resStatus == 1)
                             {
                                 LogHelper.Log.Info("通道:" + recordAll.outrecord.outChannelCode + "出场图片上传成功");
                                 string data = Common.CommHelper.ToJSON(recordAll.outrecord).Replace("\\", "");
                                 data = "inOutRecord=" + data.Remove((data.IndexOf('[') - 1), 1);
                                 data = data.Remove((data.IndexOf(']') + 1), 1) + "&authCode=" + authCode + "&token=" + token;
                                 string     inResult       = CommHelper.Post(url + "/inOutRecord.eif", data);
                                 returnData returnInrecord = CommHelper.FromJsonTo <returnData>(inResult);
                                 if (returnInrecord.resStatus == 1)
                                 {
                                     LogHelper.Log.Info("通道:" + recordAll.outrecord.outChannelCode + "出场记录上传成功");
                                     OutRedodeQue.Dequeue();
                                 }
                                 else
                                 {
                                     LogHelper.Log.Info("通道:" + recordAll.outrecord.outChannelCode + "出场记录上传失败");
                                 }
                             }
                             else
                             {
                                 LogHelper.Log.Info("通道:" + recordAll.outrecord.outChannelCode + "出场图片上传失败");
                             }
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     LogHelper.Log.Error(ex.Message);
                     AcceptDataEvent.Reset();
                 }
             }
             AcceptDataEvent.Reset();
         }
         catch (Exception ex)
         {
             LogHelper.Log.Error(ex.Message);
             AcceptDataEvent.Reset();
         }
     }
 }