예제 #1
0
        /// <summary>
        /// 更新设备的作业ID
        /// </summary>
        /// <returns></returns>
        public int UpdateAllSMGsWorkStatus()
        {
            try
            {
                foreach (CSMG smg in SMGs)
                {
                    if (smg.nIsWorking != 0)
                    {
                        CTask tsk = new CWTask().GetCTaskFromtskID(smg.nIsWorking);
                        if (tsk == null)
                        {
                            smg.MTskID     = 0;
                            smg.nIsWorking = 0;
                            smg.NextTaskId = 0;
                            CWData.myDB.UpdateSMGTaskStat(smg);
                        }
                        //如果是移动作业,已发生过移动,则强制完成其作业
                        if (smg.SMGType == CSMG.EnmSMGType.ETV)
                        {
                            if (tsk != null)
                            {
                                if (tsk.Type == CTask.EnmTaskType.TVMove)
                                {
                                    //已经发送过了,且确认了10S过后
                                    if (tsk.StatusDetail == CTask.EnmTaskStatusDetail.Asked &&
                                        DateTime.Compare(DateTime.Now, tsk.SendDtime.AddSeconds(10)) > 0)
                                    {
                                        if (smg.Available && CheckAcceptNewCommand(smg.ID))
                                        {
                                            if (smg.CurrAddress != null && smg.CurrAddress != tsk.ToLctAdrs)
                                            {
                                                smg.nIsWorking = 0;
                                                CWData.myDB.UpdateSMGTaskStat(smg);

                                                CSysLog log = new CSysLog("0000", DateTime.Now, "强制复位移动:目标车位" + tsk.ToLctAdrs + "- 时间" + DateTime.Now, "系统");
                                                CWData.myDB.InsertSysLog(log);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                HttpRuntime.Cache.Remove("SMGs");
                throw ex;
            }
            return(0);
        }
예제 #2
0
 /// <summary>
 /// 记录故障
 /// </summary>
 /// <param name="elog"></param>
 /// <returns></returns>
 public int WriteErrorLog(byte eqp, string descp, DateTime dt)
 {
     try
     {
         CSysLog elog = new CSysLog(Convert.ToString(eqp), dt, descp, "");
         CWData.myDB.InsertErrorLog(elog);
         return(100);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }