示例#1
0
        /// <summary>
        /// 发生故障、离线的车,清除其相应的任务
        /// </summary>
        public void ClearTask()
        {
            while (true)
            {
                Thread.Sleep(5000);
                List <F_AGV>            agvs         = F_DataCenter.MDev.ErrorOrFalse();
                List <FDispatchBackImf> dispatchList = WcfMainHelper.GetDispatchList();
                if (dispatchList != null && agvs != null && dispatchList.Count > 0)
                {
                    foreach (var agv in agvs)
                    {
                        foreach (var dispatch in dispatchList)
                        {
                            // 有故障的车是否对应任务的设备ID
                            if (agv.Id == dispatch.Dev)
                            {
                                if (dic.ContainsKey(agv.Id))
                                {
                                    int count = 0;
                                    dic.TryGetValue(agv.Id, out count);
                                    if (count >= 10)
                                    {
                                        // 终止该任务
                                        WcfMainHelper.CtrDispatch(dispatch.Id, EnumCtrType.Stop);
                                        sendServerLog("终止异常的 " + agv.Id + "正在执行的任务");

                                        //LogFactory.LogRunning("终止异常的 " + agv.Id + "正在执行的任务");
                                        FLog.Log("终止异常的 " + agv.Id + "正在执行的任务");

                                        count = 0;

                                        //异常终止的任务释放AGV
                                        F_AGV.AgvRelease(agv.Id);
                                    }
                                    else
                                    {
                                        count++;
                                        sendServerLog("异常的 " + agv.Id + "已等待处理 " + count + " 次");

                                        //LogFactory.LogRunning("异常的 " + agv.Id + "已等待处理 " + count + " 次");
                                        FLog.Log("异常的 " + agv.Id + "已等待处理 " + count + " 次");
                                    }
                                    dic.Remove(agv.Id);
                                    dic.Add(agv.Id, count);
                                }
                                else
                                {
                                    dic.Add(agv.Id, 0);
                                }
                            }
                        }
                    }
                }
                else
                {
                    dic.Clear();
                }
            }
        }
示例#2
0
        /// <summary>
        /// 任务完成
        /// </summary>
        public void ISetTaskSuc()
        {
            if (_plc != null)
            {
                _plc.IsLock = false;
            }

            if (_agv != null)
            {
                F_AGV.AgvRelease(_agv.Id);
            }

            if (_taskDispatch != null)
            {
                if (WcfMainHelper.CtrDispatch(_taskDispatch.Id, EnumCtrType.Stop))
                {
                    _isSuc = true;
                }
            }
        }
示例#3
0
        /// <summary>
        /// 任务完成
        /// </summary>
        private void ISetTaskSuc()
        {
            if (_plc != null)
            {
                _plc.IsLock = false;
            }
            if (_agv != null)
            {
                F_AGV.AgvRelease(_agv.Id);
            }

            if (_taskDispatch != null)
            {
                if (JTWcfHelper.WcfMainHelper.CtrDispatch(_taskDispatch.DisGuid, DisOrderCtrTypeEnum.Stop))
                {
                    _isSuc = true;
                }
            }
            else
            {
                _isSuc = true;
            }
        }