Exemplo n.º 1
0
        /// <summary>
        /// 窑头对接完成点到窑尾等待点
        /// </summary>
        private void TaskHeadSucToEndWait()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑头对接完成点);

            if (agv != null && agv.IsFree
                )
            {
                //如果窑头对接完成点出现一台车,则解锁窑头可出标志
                _plcHead.ExitFlag = true;

                //如果窑头对接完成点的车是出窑头充电桩出来的车,则解锁出窑头充电桩
                if (_plcHead.ExitChargeAgv == agv.Id)
                {
                    _plcHead.IsExitBatteryLock = false;

                    _plcHead.ExitChargeAgv = null;
                }

                F_ExcTask task1 = new F_ExcTask(null, EnumOper.无动作, ConstSetBA.窑头对接完成点, ConstSetBA.窑尾装载等待区);

                task1.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task1, agv.Id + TaskHeadSucToEndWaitMsg);

                sendServerLog(agv.Id + TaskHeadSucToEndWaitMsg);

                //LogFactory.LogDispatch(agv.Id, " ", TaskHeadSucToEndWaitMsg);
                FLog.Log(agv.Id + TaskHeadSucToEndWaitMsg);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 窑头等 到 进窑头充
        /// </summary>
        private void TaskHeadToEnterBattery()
        {
            F_AGV agv  = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑头卸载等待区);
            F_AGV agv1 = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.进窑头充电点);

            if (agv != null && agv.IsFree &&
                agv.Electicity <= F_DataCenter.MDev.IGetDevElectricity() &&
                agv.ChargeStatus == EnumChargeStatus.未充电 &&
                agv1 == null &&
                !_plcHead.IsEnterBatteryLock
                )
            {
                F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.充电, ConstSetBA.窑头卸载等待区, ConstSetBA.进窑头充电点);

                task.Id = agv.Id;

                //进窑头充电,锁定进窑头充电桩
                _plcHead.IsEnterBatteryLock = true;

                ParamControl.Do_EnterHeadChargeLock = false;

                _plcHead.EnterChargeAgv = agv.Id;

                F_DataCenter.MTask.IStartTask(task, agv.Id + PlcHeadChargeMsg);

                sendServerLog(agv.Id + PlcHeadChargeMsg);

                //LogFactory.LogDispatch(agv.Id, "充电", PlcHeadChargeMsg);
                FLog.Log(agv.Id + PlcHeadChargeMsg);
            }
        }
Exemplo n.º 3
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();
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 初始化任务,查找所有AGV需要初始化的指派任务
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InitAllBtn_Click(object sender, EventArgs e)
 {
     if (InitAllBtn.Checked)
     {
         F_DataCenter.MLogic.InitAgv();
         InitAllBtn.Checked = false;
         MessageBox.Show("初始化了全部AGV");
         FLog.Log("初始化了全部AGV");
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 任务完成
 /// </summary>
 public void ISetTaskSuc()
 {
     if (_taskDispatch != null)
     {
         if (WcfMainHelper.CtrDispatch(_taskDispatch.Id, EnumCtrType.Stop))
         {
             _isSuc = true;
         }
     }
     FLog.Log(_taskDispatch.Id + "任务完成");
 }
Exemplo n.º 6
0
 /// <summary>
 /// 初始化指定的AGV
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AgvInitBtn_Click(object sender, EventArgs e)
 {
     if (agvList.FocusedItem == null)
     {
         MessageBox.Show("请选选择AGV");
         return;
     }
     F_DataCenter.MLogic.InitAgv(agvList.FocusedItem.Text);
     MessageBox.Show(agvList.FocusedItem.Text + "已经初始化!");
     FLog.Log(agvList.FocusedItem.Text + "已经初始化!");
 }
Exemplo n.º 7
0
        /// <summary>
        /// 窑尾等 到 窑尾取
        /// </summary>
        private void TaskPlcEndGet()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑尾装载等待区);

            //查找是否存在目标站点是窑尾的AGV
            F_AGV d_agv  = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.窑尾装载站);
            F_AGV d_agv2 = F_DataCenter.MDev.IGetAliveDevOnSite(ConstSetBA.窑尾装载点);

            F_AGV d_agv3 = F_DataCenter.MDev.IGetAliveDevOnSite(ConstSetBA.进窑尾充电点);


            ///窑尾有货 窑尾等待点的AGV没有锁定 并且 此次任务没有被响应
            if (//(ParamControl.Do_EndPlcLock && !_plcEnd.IsLock) &&
                (d_agv == null
                 //&& d_agv2 == null
                ) &&
                agv != null && agv.IsFree &&
                (agv.Electicity > F_DataCenter.MDev.IGetDevElectricity() || (agv.Electicity > ParamControl.MinElectricityCharge) || //高于最低充电量的车不能去充电
                 (!ParamControl.Do_EnterEndCharge || _plcEnd.IsEnterBatteryLock && _plcEnd.EnterChargeAgv != agv.Id))
                //&& _plcEnd.IsLock == false
                && (d_agv3 == null || (d_agv3 != null && d_agv3.ChargeStatus != EnumChargeStatus.充电完成))
                )
            {
                //窑尾等待区的车不需要充电、没有充电完成的车 、没有初始化时要去窑尾装载点的车
                if (//!_PlcEndNeedCharge && !_EnterPlcEndChargeSuc && !_ToPlcEnd
                    true)
                {
                    ///派发一个从窑尾装载等待区到窑尾装载点取货的任务
                    F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, ConstSetBA.窑尾装载等待区, _plcEnd.Site);

                    task.Id = agv.Id;

                    F_DataCenter.MTask.IStartTask(task, (agv.Id + TaskPlcEndGetMsg));

                    //去取货,锁定窑尾
                    _plcEnd.IsLock = true;

                    ParamControl.Do_EndPlcLock = false;

                    F_AGV.AgvLock(agv.Id);

                    sendServerLog(agv.Id + TaskPlcEndGetMsg);

                    //LogFactory.LogDispatch(agv.Id, "到窑尾取货", TaskPlcEndGetMsg);
                    FLog.Log(agv.Id + TaskPlcEndGetMsg);
                }
                else
                {
                    //_ToPlcEnd = false;
                }
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// 停止车辆
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AgvStopBtn_Click(object sender, EventArgs e)
 {
     if (AgvBackwardBtn.Enabled == false || AgvForwardBtn.Enabled == false)
     {
         StopAGV();
         //记录agv状态
         agvStatus[agvList.FocusedItem.Text] = "stop";
         FLog.Log("操作:停止" + agvList.FocusedItem.Text);
     }
     else
     {
         MessageBox.Show("当前没有运行的车辆!");
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public ControlForm()
        {
            InitializeComponent();
            InitPara();
            F_DataCenter.Init(SynchronizationContext.Current, listBoxOutput);

            //LogHelper.LogFactory.Init();
            FLog.Init();

            InitChargeNum();

            XMLConfig = new XmlAnalyze();
            InitXmlConfigSetting();
        }
Exemplo n.º 10
0
        /// <summary>
        /// 进窑尾充 到 窑尾取
        /// </summary>
        public void TaskEnterEndChargeSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.进窑尾充电点);

            //查找是否存在目标站点是窑尾的AGV
            F_AGV d_agv  = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.窑尾装载站);
            F_AGV d_agv2 = F_DataCenter.MDev.IGetAliveDevOnSite(ConstSetBA.窑尾装载点);

            // 有未上锁的、充电完成的AGV,且窑尾装载点有货、AGV上无货
            if (//(ParamControl.Do_EndPlcLock && !_plcEnd.IsLock)&&
                //(d_agv == null && d_agv2 == null)
                agv != null && agv.IsFree
                //&& !F_AGV.IsLock(agv.Id)
                && agv.ChargeStatus == EnumChargeStatus.充电完成
                //&& _plcEnd.IsLock == false
                )
            {
                if (//_plcEnd.Sta_Material == EnumSta_Material.有货 &&
                    //agv.Sta_Material == EnumagvSta_Material.无货
                    true
                    )
                {
                    _EnterPlcEndChargeSuc = true;

                    F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, ConstSetBA.进窑尾充电点, ConstSetBA.窑尾装载点);

                    F_AGV.AgvLock(agv.Id);

                    //去取货,锁定窑尾
                    _plcEnd.IsLock = true;

                    ParamControl.Do_EndPlcLock = false;

                    task.Id = agv.Id;

                    Thread.Sleep(5000);

                    F_DataCenter.MTask.IStartTask(task, agv.Id + PlcEndChargeSucMsg);

                    sendServerLog(agv.Id + PlcEndChargeSucMsg);

                    //LogFactory.LogDispatch(agv.Id, "充电完成", PlcEndChargeSucMsg);
                    FLog.Log(agv.Id + PlcEndChargeSucMsg);
                }
            }
            else
            {
                _EnterPlcEndChargeSuc = false;
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 删除一个任务
        /// </summary>
        /// <param name="Id"></param>
        public void IDeletTask(string Id)
        {
            lock (_ans)
            {
                F_ExcTask exit = _taskList.Find(c => { return(c.Id == Id); });

                if (exit != null && _taskList.Contains(exit))
                {
                    //LogFactory.LogAdd(LOGTYPE.FINISH, exit.Id, exit.GetTaskInfo(), "调度完成", exit.GetTaskInfo());//任务完成日志
                    FLog.Log(Id + "调度完成" + exit.GetTaskInfo());//任务完成日志
                    PublicDataContorl.TaskIsSucc(exit.NO);
                    _taskList.Remove(exit);
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 窑尾到窑尾对接完成点
        /// </summary>
        private void TaskEndToEndSuc()
        {
            F_AGV agv  = F_DataCenter.MDev.IGetDevOnSite(_plcEnd.Site);
            F_AGV agv1 = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.出窑尾充电点);


            F_AGV d_agv = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.窑尾对接完成点);

            if (agv != null && agv.IsFree
                //&& !F_AGV.IsLock(agv.Id)
                && (ParamControl.IgnoreAgvLoadTask || agv.Sta_Material == EnumagvSta_Material.货)
                )
            {
                // 判断是否存在目标站点是对接完成点的agv
                if (//_plcEnd.ExitFlag
                    d_agv == null)
                {
                    // 如果需要充电但是充电桩有车、被锁,或者不需要充电直接去到对接完成点
                    if (//agv.Electicity <= F_DataCenter.MDev.IGetDevElectricity()  &&
                        //agv1 != null                         &&
                        //_plcEnd.IsExitBatteryLock &&
                        //ParamControl.Do_ExitEndChargeLock))
                        //|| agv.Electicity > F_DataCenter.MDev.IGetDevElectricity()
                        true
                        )
                    {
                        // 从窑尾到窑尾对接完成点
                        F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.对接完成, ConstSetBA.窑尾装载点, ConstSetBA.窑尾对接完成点);

                        F_AGV.AgvLock(agv.Id);

                        task.Id = agv.Id;

                        _plcEnd.ExitFlag = false;

                        F_DataCenter.MTask.IStartTask(task, agv.Id + TaskEndToEndSucMsg);

                        sendServerLog(agv.Id + TaskEndToEndSucMsg);

                        //LogFactory.LogDispatch(agv.Id, "取货完成", TaskEndToEndSucMsg);
                        FLog.Log(agv.Id + TaskEndToEndSucMsg);
                    }
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 窑尾取 到 出窑尾充电站
        /// </summary>
        private void TaskEndToExitBattery()
        {
            F_AGV agv  = F_DataCenter.MDev.IGetDevOnSite(_plcEnd.Site);
            F_AGV agv1 = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.出窑尾充电点);

            if (agv1 != null)
            {
                ParamControl.Do_ExitEndChargeLock = false;
            }
            if (agv != null && agv.IsFree &&
                !F_AGV.IsLock(agv.Id) &&
                (ParamControl.IgnoreAgvLoadTask || agv.Sta_Material == EnumagvSta_Material.货))
            {
                // 判断窑尾可出站标志是否为True
                if (_plcEnd.ExitFlag)
                {
                    // 判断窑尾接货完成的车是否需要充电,且出窑尾充电站没有车、未被锁定
                    if (agv.Electicity <= F_DataCenter.MDev.IGetDevElectricity() && agv.ChargeStatus == EnumChargeStatus.未充电 &&
                        agv1 == null
                        //&& !_plcEnd.IsExitBatteryLock
                        && ParamControl.Do_ExitEndChargeLock)
                    {
                        F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.充电, ConstSetBA.窑尾装载点, ConstSetBA.出窑尾充电点);

                        F_AGV.AgvLock(agv.Id);

                        task.Id = agv.Id;

                        //出窑尾充电,锁定出窑尾充电桩
                        //_plcEnd.IsExitBatteryLock = true;
                        ParamControl.Do_ExitEndChargeLock = false;

                        _plcEnd.ExitChargeAgv = agv.Id;

                        F_DataCenter.MTask.IStartTask(task, agv.Id + TaskEndToExitBatteryMsg);

                        sendServerLog(agv.Id + TaskEndToExitBatteryMsg);

                        //LogFactory.LogDispatch(agv.Id, "AGV出窑尾充电", TaskEndToExitBatteryMsg);
                        FLog.Log(agv.Id + TaskEndToExitBatteryMsg);
                    }
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 窑头等 到 窑头卸
        /// </summary>
        private void TaskPlcHeadPut()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑头卸载等待区);
            //查找是否存在目标站点是窑头的AGV
            F_AGV d_agv  = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.窑头卸载站);
            F_AGV d_agv2 = F_DataCenter.MDev.IGetAliveDevOnSite(ConstSetBA.窑头卸载点);


            ///窑头无货 窑头AGV未锁定 并且 此次任务没有被响应
            if (//ParamControl.Do_HeadPlcLock &&
                (d_agv == null && d_agv2 == null) &&// !_plcHead.IsLock
                agv != null && agv.IsFree
                //&& agv.Electicity > F_DataCenter.MDev.IGetDevElectricity()
                )
            {
                //窑头等待区的车不需要充电、没有充电完成的车、没有回卸载点的车
                if (true
                    //!_EnterPlcHeadChargeSuc && !_ToPlcHead
                    )
                {
                    ///派发一个从窑头卸载等待区到窑头卸载点的任务

                    F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.放货, ConstSetBA.窑头卸载等待区, ConstSetBA.窑头卸载点);

                    task.Id = agv.Id;

                    F_DataCenter.MTask.IStartTask(task, agv.Id + TaskPlcHeadPutMsg);

                    //去卸货,锁定窑头
                    _plcHead.IsLock = true;

                    ParamControl.Do_HeadPlcLock = false;

                    sendServerLog(agv.Id + TaskPlcHeadPutMsg);

                    //LogFactory.LogDispatch(agv.Id, "卸货", TaskPlcHeadPutMsg);
                    FLog.Log(agv.Id + "卸货" + TaskPlcHeadPutMsg);
                }
                else
                {
                    // _ToPlcHead = false;
                }
            }
        }
Exemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="no"></param>
 public void StopTask(int no)
 {
     lock (_ans)
     {
         F_ExcTask excTask = _taskList.Find(c => { return(c.NO == no); });
         if (excTask != null && _taskList.Contains(excTask))
         {
             //LogFactory.LogAdd(LOGTYPE.FINISH, excTask.Id, excTask.GetTaskInfo(), "调度终止", excTask.GetTaskInfo());//任务完成日志
             FLog.Log(no + "调度终止" + excTask.GetTaskInfo());//任务完成日志
             PublicDataContorl.TaskIsSucc(excTask.NO);
             excTask.ISetTaskSuc();
             _taskList.Remove(excTask);
         }
         else
         {
             PublicDataContorl.TaskIsSucc(no);
         }
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// 自动生成任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutoGenerateTaskBtn_Click(object sender, EventArgs e)
        {
            ParamControl.Is_AutoAddTask = AutoGenerateTaskBtn.Checked;

            //自动生成任务按钮开启时,将自动执行任务按钮同步开启
            if (AutoGenerateTaskBtn.Checked)
            {
                ExecuteTaskBtn.Checked          = true;
                ParamControl.Is_AutoExecuteTask = true;
                XMLConfig.SetConfig("autoexecute", ExecuteTaskBtn.Checked);
                FLog.Log("启动:自动生成任务");
                FLog.Log("启动:自动执行任务");
            }
            else
            {
                FLog.Log("关闭:自动生成任务");
            }
            XMLConfig.SetConfig("autoaddtask", AutoGenerateTaskBtn.Checked);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 开始一个新的操作任务
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public bool IStartTask(F_ExcTask task, String msg)
        {
            lock (_ans)
            {
                F_ExcTask exit = _taskList.Find(c =>
                {
                    return //(c.Plc == task.Plc && task.Plc != null) ||
                    (c.Id == task.Id);
                });

                if (exit == null)
                {
                    _taskList.Add(task);
                    FLog.Log(task.Id + "加入任务列表");
                    PublicDataContorl.AddTaskData(new TaskData(task.NO, msg, task.StartSite + "," + task.EndSite));
                    return(true);
                }
                else if (task.EndSite != exit.EndSite)
                {
                    _taskList.Remove(exit);
                    FLog.Log(exit.Id + "移除任务列表");
                    PublicDataContorl.TaskIsSucc(exit.NO);
                    _taskList.Add(task);
                    FLog.Log(task.Id + "加入任务列表");
                    PublicDataContorl.AddTaskData(new TaskData(task.NO, msg, task.StartSite + "," + task.EndSite));
                    return(true);
                }
                else if (task.StartSite != exit.StartSite)
                {
                    _taskList.Remove(exit);
                    FLog.Log(exit.Id + "移除任务列表");
                    PublicDataContorl.TaskIsSucc(exit.NO);
                    _taskList.Add(task);
                    FLog.Log(task.Id + "加入任务列表");
                    PublicDataContorl.AddTaskData(new TaskData(task.NO, msg, task.StartSite + "," + task.EndSite));
                    return(true);
                }
                else
                {
                    return(true);
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 窑尾对接完成点到窑头等待点
        /// </summary>
        private void TaskEndSucToHeadWait()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑尾对接完成点);

            if (agv != null && agv.IsFree)
            {
                F_ExcTask task = new F_ExcTask(null, EnumOper.无动作, ConstSetBA.窑尾对接完成点, ConstSetBA.窑头卸载等待区);

                F_AGV.AgvLock(agv.Id);

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task, agv.Id + TaskEndSucToHeadWaitMsg);

                sendServerLog(agv.Id + TaskEndSucToHeadWaitMsg);

                //LogFactory.LogDispatch(agv.Id, " ", TaskEndSucToHeadWaitMsg);
                FLog.Log(agv.Id + TaskEndSucToHeadWaitMsg);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 进窑头充 到 窑头卸
        /// </summary>
        public void TaskEnterHeadChargeSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.进窑头充电点);

            // 有充电完成的AGV,且窑头卸载点没货
            if ((ParamControl.Do_HeadPlcLock && !_plcHead.IsLock) && agv != null && agv.IsFree &&
                agv.ChargeStatus == EnumChargeStatus.充电完成 &&
                !F_AGV.IsLock(agv.Id)
                )
            {
                _EnterPlcHeadChargeSuc = true;

                if (_plcHead.Sta_Material == EnumSta_Material.无货 &&
                    agv.Sta_Material == EnumagvSta_Material.货
                    )
                {
                    F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.放货, ConstSetBA.进窑头充电点, ConstSetBA.窑头卸载点);

                    F_AGV.AgvLock(agv.Id);

                    //去卸货,锁定窑头
                    _plcHead.IsLock             = true;
                    ParamControl.Do_HeadPlcLock = false;

                    task.Id = agv.Id;

                    Thread.Sleep(2000);

                    F_DataCenter.MTask.IStartTask(task, agv.Id + PlcHeadChargeSucMsg);

                    sendServerLog(agv.Id + PlcHeadChargeSucMsg);

                    //LogFactory.LogDispatch(agv.Id, "充电完成", PlcHeadChargeSucMsg);
                    FLog.Log(agv.Id + PlcHeadChargeSucMsg);
                }
            }
            else
            {
                _EnterPlcHeadChargeSuc = false;
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 窑头去窑头对接完成点
        /// </summary>
        private void TaskHeadToHeadSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(_plcHead.Site);

            //查找是否存在目标站点是窑头对接完成点的AGV
            F_AGV d_agv = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.窑头对接完成站);

            // 如果需要充电但是充电桩有车、被锁,或者不需要充电直接去到对接完成点
            if (agv != null &&
                agv.IsFree &&
                agv.Sta_Material == EnumagvSta_Material.无货 &&
                ((agv.Electicity > F_DataCenter.MDev.IGetDevElectricity()) || (agv.Electicity > ParamControl.MinElectricityCharge) || //高于最低充电量的车不能去充电
                 (!ParamControl.Do_ExitHeadCharge || _plcHead.IsExitBatteryLock && (_plcHead.ExitChargeAgv != agv.Id)))
                )
            {
                // 判断是否可出
                if (d_agv == null &&
                    _plcHead.ExitFlag
                    )
                {
                    // 从窑头到窑头对接完成点
                    F_ExcTask task1 = new F_ExcTask(_plcHead, EnumOper.对接完成, ConstSetBA.窑头卸载点, ConstSetBA.窑头对接完成点);

                    task1.Id = agv.Id;

                    _plcHead.ExitFlag = false;

                    F_DataCenter.MTask.IStartTask(task1, agv.Id + TaskHeadToHeadSucMsg);

                    sendServerLog(agv.Id + TaskHeadToHeadSucMsg);

                    //LogFactory.LogDispatch(agv.Id, "卸货完成", TaskHeadToHeadSucMsg);
                    FLog.Log(agv.Id + TaskHeadToHeadSucMsg);
                }
                //else
                //{
                //    _plcHead.ExitFlag = false;
                //}
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 窑尾启动辊台
        /// </summary>
        public void TaskPlcEndStart()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑尾装载点);

            if (agv != null &&
                agv.IsFree &&
                agv.Sta_Material == EnumagvSta_Material.无货
                )
            {
                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, ConstSetBA.窑尾装载点, ConstSetBA.窑尾装载点);

                task.Id = agv.Id;

                _plcEnd.IsLock = true;

                F_DataCenter.MTask.IStartTask(task, agv.Id + PlcEndStartSucMsg);

                sendServerLog(agv.Id + PlcEndStartSucMsg);

                //LogFactory.LogDispatch(agv.Id, "窑尾启动辊台", PlcEndStartSucMsg);
                FLog.Log(agv.Id + PlcEndStartSucMsg);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 出窑尾充 到 窑尾对接完成点
        /// </summary>
        public void TaskExitEndChargeSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.出窑尾充电点);

            // 有未上锁的、充电完成的AGV,且窑尾装载点有货、AGV上无货
            if (agv != null && agv.IsFree &&
                !F_AGV.IsLock(agv.Id) &&
                agv.ChargeStatus == EnumChargeStatus.充电完成)
            {
                if (_plcEnd.ExitFlag &&
                    true)
                {
                    _ExitPlcEndChargeSuc = true;

                    F_ExcTask task = new F_ExcTask(null, EnumOper.对接完成, ConstSetBA.出窑尾充电点, ConstSetBA.窑尾对接完成点);

                    F_AGV.AgvLock(agv.Id);

                    _plcEnd.ExitFlag = false;

                    task.Id = agv.Id;

                    Thread.Sleep(2000);

                    F_DataCenter.MTask.IStartTask(task, agv.Id + ExitPlcEndChargeSucMsg);

                    sendServerLog(agv.Id + ExitPlcEndChargeSucMsg);

                    //LogFactory.LogDispatch(agv.Id, "充电完成", ExitPlcEndChargeSucMsg);
                    FLog.Log(agv.Id + ExitPlcEndChargeSucMsg);
                }
            }
            else
            {
                _ExitPlcEndChargeSuc = false;
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 出窑头充 到 窑头对接完成点
        /// </summary>
        public void TaskExitHeadChargeSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.出窑头充电点);

            //查找是否存在目标站点是窑头对接完成点的AGV
            F_AGV d_agv = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.窑头对接完成站);

            // 有未上锁的、充电完成的AGV
            if (agv != null &&
                agv.IsFree &&
                agv.ChargeStatus == EnumChargeStatus.充电完成)
            {
                if (d_agv == null &&
                    _plcHead.ExitFlag
                    )
                {
                    F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.对接完成, ConstSetBA.出窑头充电点, ConstSetBA.窑头对接完成点);

                    _plcHead.ExitFlag = false;

                    task.Id = agv.Id;

                    Thread.Sleep(5000);

                    F_DataCenter.MTask.IStartTask(task, agv.Id + ExitPlcHeadChargeSucMsg);

                    sendServerLog(agv.Id + ExitPlcHeadChargeSucMsg);

                    //LogFactory.LogDispatch(agv.Id, "充电完成", ExitPlcHeadChargeSucMsg);
                    FLog.Log(agv.Id + ExitPlcHeadChargeSucMsg);
                }
                else
                {
                    _plcHead.ExitFlag = false;
                }
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// 初始化,让AGV回到相应的点或者执行相应的任务
        /// </summary>
        private void InitToAllAGV()
        {
            List <F_AGV> agvs = F_DataCenter.MDev.InitGetDevNot(agvid);

            PLCEndTrafficSite.AddRange(new string[] { "26", "16", "21", "11" });
            PLCHeadTrafficSite.AddRange(new string[] { "23", "13", "24", "14" });
            PLCEndToHeadWaitSite.AddRange(new string[] { "12", "62" });
            PLCHeadToEndWaitSite.AddRange(new string[] { "15", "65" });

            if (agvs != null)
            {
                foreach (F_AGV agv in agvs)
                {
                    // 窑尾交通管制点是否有车
                    if (PLCEndTrafficSite.Contains(agv.Site))
                    {
                        if (agv.Site == ConstSetBA.窑尾装载点)
                        {
                            // 初始化,在窑尾装载点且有货,去到窑尾对接完成点
                            if (agv.Sta_Material == EnumagvSta_Material.货)
                            {
                                F_ExcTask task = new F_ExcTask(null, EnumOper.对接完成, agv.Site, ConstSetBA.窑尾对接完成点);

                                task.Id = agv.Id;

                                F_DataCenter.MTask.IStartTask(task, agv.Id + initToEndSucMsg);

                                sendServerLog(agv.Id + initToEndSucMsg);

                                //LogFactory.LogDispatch(agv.Id, "车辆初始化", initToEndSucMsg);
                                FLog.Log(agv.Id + initToEndSucMsg);
                            }
                            // 初始化,在窑尾装载点且无货,执行取货任务
                            else
                            {
                                _ToPlcEnd = true;

                                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, agv.Site, ConstSetBA.窑尾装载点);

                                F_AGV.AgvLock(agv.Id);

                                task.Id = agv.Id;

                                F_DataCenter.MTask.IStartTask(task, agv.Id + toEndGrtMsg);

                                sendServerLog(agv.Id + "初始化,位于装载点且无货的AGV,执行取货任务");

                                //LogFactory.LogDispatch(agv.Id, "车辆初始化", "位于装载点且无货的AGV,执行取货任务");
                                FLog.Log(agv.Id + "位于装载点且无货的AGV,执行取货任务");
                            }
                        }
                        // 不在装载点的车,判断地标是否为正反卡的21,若为取货完成的车去到窑尾对接完成点
                        else if (agv.Site == ConstSetBA.窑尾装载点的前一地标 && agv.Sta_Material == EnumagvSta_Material.货)
                        {
                            F_ExcTask task = new F_ExcTask(null, EnumOper.对接完成, agv.Site, ConstSetBA.窑尾对接完成点);

                            task.Id = agv.Id;

                            F_DataCenter.MTask.IStartTask(task, agv.Id + initToEndSucMsg);

                            sendServerLog(agv.Id + initToEndSucMsg);

                            //LogFactory.LogDispatch(agv.Id, "车辆初始化 ,有货的AGV", initToEndSucMsg);
                            FLog.Log(agv.Id + initToEndSucMsg);
                        }
                        else
                        {
                            // 准备取货的AGV,去到窑尾装载点取货
                            _ToPlcEnd = true;

                            F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, agv.Site, ConstSetBA.窑尾装载点);

                            F_AGV.AgvLock(agv.Id);

                            task.Id = agv.Id;

                            F_DataCenter.MTask.IStartTask(task, agv.Id + toEndGrtMsg);

                            sendServerLog(agv.Id + "初始化,准备取货的AGV,去到窑尾装载点取货");

                            //LogFactory.LogDispatch(agv.Id, "车辆初始化", "准备取货的AGV,去到窑尾装载点取货");
                            FLog.Log(agv.Id + "车辆初始化" + "准备取货的AGV,去到窑尾装载点取货");
                        }
                    }
                    // 窑头交通管制点是否有车
                    else if (PLCHeadTrafficSite.Contains(agv.Site))
                    {
                        if (agv.Site == ConstSetBA.窑头卸载点)
                        {
                            // 初始化,在窑头卸载点且无货,去到窑头对接完成点
                            if (agv.Sta_Material == EnumagvSta_Material.无货)
                            {
                                F_ExcTask task = new F_ExcTask(null, EnumOper.对接完成, agv.Site, ConstSetBA.窑头对接完成点);

                                task.Id = agv.Id;

                                F_DataCenter.MTask.IStartTask(task, agv.Id + initToHeadSucMsg);

                                sendServerLog(agv.Id + TaskHeadToHeadSucMsg);

                                //LogFactory.LogDispatch(agv.Id, "车辆初始化", initToHeadSucMsg);
                                FLog.Log(agv.Id + initToHeadSucMsg);
                            }
                            // 初始化,在窑头卸载点且无货,执行放货任务
                            else
                            {
                                _ToPlcHead = true;

                                F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.放货, agv.Site, ConstSetBA.窑头卸载点);

                                F_AGV.AgvLock(agv.Id);

                                task.Id = agv.Id;

                                F_DataCenter.MTask.IStartTask(task, agv.Id + toHeadGrtMsg);

                                sendServerLog(agv.Id + "初始化,位于窑头卸载点且有货,执行放货任务");

                                //LogFactory.LogDispatch(agv.Id, "车辆初始化", "位于窑头卸载点且有货,执行放货任务");
                                FLog.Log(agv.Id + "车辆初始化," + "位于窑头卸载点且有货,执行放货任务");
                            }
                        }
                        // 不在卸载点的车,判断地标是否为正反卡的24,若为放货完成的车去到窑头对接完成点
                        else if (agv.Site == ConstSetBA.窑头卸载点的前一地标 && agv.Sta_Material == EnumagvSta_Material.无货)
                        {
                            F_ExcTask task = new F_ExcTask(null, EnumOper.对接完成, agv.Site, ConstSetBA.窑头对接完成点);

                            task.Id = agv.Id;

                            F_DataCenter.MTask.IStartTask(task, agv.Id + initToHeadSucMsg);

                            sendServerLog(agv.Id + initToHeadSucMsg);

                            //LogFactory.LogDispatch(agv.Id, "车辆初始化 ,无货的AGV", initToHeadSucMsg);
                            FLog.Log(agv.Id + "车辆初始化 ,无货的AGV" + initToHeadSucMsg);
                        }
                        else
                        {
                            // 准备卸货的AGV,去到窑头卸载点放货
                            _ToPlcEnd = true;

                            F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.放货, agv.Site, ConstSetBA.窑头卸载点);

                            F_AGV.AgvLock(agv.Id);

                            task.Id = agv.Id;

                            F_DataCenter.MTask.IStartTask(task, agv.Id + toHeadGrtMsg);

                            sendServerLog(agv.Id + "初始化, 准备卸货的AGV,去到窑头卸载点放货");

                            //LogFactory.LogDispatch(agv.Id, "车辆初始化", " 准备卸货的AGV,去到窑头卸载点放货");
                            FLog.Log(agv.Id + "车辆初始化, 准备卸货的AGV,去到窑头卸载点放货");
                        }
                    }
                    /// 不在任何交通管制点的车,去到相应的等待点
                    /// 窑头卸货完成的车,直接去到窑尾装载等待点
                    else if (PLCHeadToEndWaitSite.Contains(agv.Site) && agv.Sta_Material == EnumagvSta_Material.无货)
                    {
                        F_ExcTask task = new F_ExcTask(null, EnumOper.无动作, agv.Site, ConstSetBA.窑尾装载等待区);

                        task.Id = agv.Id;

                        F_DataCenter.MTask.IStartTask(task, agv.Id + initToEndWaitMsg);

                        sendServerLog(agv.Id + initToEndWaitMsg);

                        //LogFactory.LogDispatch(agv.Id, "车辆初始化 ,窑头交管解除点的AGV", initToEndWaitMsg);
                        FLog.Log(agv.Id + "车辆初始化 ,窑头交管解除点的AGV");
                    }
                    ///  窑尾取货完成的车,直接去到窑头卸载等待点
                    else if (PLCEndToHeadWaitSite.Contains(agv.Site) && agv.Sta_Material == EnumagvSta_Material.货)
                    {
                        F_ExcTask task = new F_ExcTask(null, EnumOper.无动作, agv.Site, ConstSetBA.窑头卸载等待区);

                        task.Id = agv.Id;

                        F_DataCenter.MTask.IStartTask(task, agv.Id + initToHeadWaitMsg);

                        sendServerLog(agv.Id + initToHeadWaitMsg);

                        //LogFactory.LogDispatch(agv.Id, "车辆初始化 ,窑尾交管解除点的AGV", initToHeadWaitMsg);
                        FLog.Log(agv.Id + "车辆初始化 ,窑尾交管解除点的AGV");
                    }
                }
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 窑尾等 到 进窑尾充
        /// </summary>
        private void TaskEndToEnterBattery()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑尾装载等待区);

            //查找是否存在目标站点是进窑尾充电站的AGV
            F_AGV d_agv  = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.充电桩站);
            F_AGV d_agv2 = F_DataCenter.MDev.IGetAliveDevOnSite(ConstSetBA.进窑尾充电点);

            //去进窑尾充电站的车是否是窑尾的车
            if (d_agv != null && (d_agv.Site != "26" && d_agv.Site != "36"))
            {
                d_agv = null;
            }

            if (d_agv != null || d_agv2 != null)
            {
                ParamControl.Do_EnterEndChargeLock = false;

                if (d_agv != null)
                {
                    _plcEnd.IsEnterBatteryLock = true;

                    _plcEnd.EnterChargeAgv = d_agv.Id;

                    ParamControl.EndChargeLock = _plcEnd.IsEnterBatteryLock;
                    ParamControl.EndChargeAGV  = _plcEnd.EnterChargeAgv;
                }
                else if (d_agv2 != null)
                {
                    _plcEnd.IsEnterBatteryLock = true;

                    _plcEnd.EnterChargeAgv     = d_agv2.Id;
                    ParamControl.EndChargeLock = _plcEnd.IsEnterBatteryLock;
                    ParamControl.EndChargeAGV  = _plcEnd.EnterChargeAgv;
                }
            }

            // 让未上锁的、电量低于60且未充电的AGV去充电,且接货充电点没有AGV
            if (agv != null && agv.IsFree &&
                agv.Electicity <= F_DataCenter.MDev.IGetDevElectricity() &&
                agv.ChargeStatus == EnumChargeStatus.未充电 &&
                (d_agv == null && d_agv2 == null) &&
                !_plcEnd.IsEnterBatteryLock
                //&& ParamControl.Do_EnterEndChargeLock
                && agv.Electicity <= ParamControl.MinElectricityCharge //低于最低充电量的车才能去充电
                )
            {
                _PlcEndNeedCharge = true;

                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.充电, ConstSetBA.窑尾装载等待区, ConstSetBA.进窑尾充电点);

                F_AGV.AgvLock(agv.Id);

                //进窑尾充电,锁定进窑尾充电桩
                _plcEnd.IsEnterBatteryLock = true;

                ParamControl.Do_EnterEndChargeLock = false;

                _plcEnd.EnterChargeAgv = agv.Id;

                ParamControl.EndChargeLock = _plcEnd.IsEnterBatteryLock;

                ParamControl.EndChargeAGV = _plcEnd.EnterChargeAgv;

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task, agv.Id + PlcEndChargeMsg);

                sendServerLog(agv.Id + PlcEndChargeMsg);

                //LogFactory.LogDispatch(agv.Id, "充电", PlcEndChargeMsg);
                FLog.Log(agv.Id + PlcEndChargeMsg);
            }
            else
            {
                _PlcEndNeedCharge = false;
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 窑头放 到 出窑头充电站
        /// </summary>
        private void TaskHeadToExitBattery()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑头卸载点);

            //查找是否存在目标站点是出窑头充电站的AGV
            F_AGV d_agv  = F_DataCenter.MDev.IGetDevOnDestination(ConstSetBA.充电桩站); //目的站点
            F_AGV d_agv2 = F_DataCenter.MDev.IGetAliveDevOnSite(ConstSetBA.出窑头充电点); //地标

            //去出窑头充电站的车是否是窑头的车
            if (d_agv != null && (d_agv.Site != "24" && d_agv.Site != "65" && d_agv.Site != "25" && d_agv.Site != "14"))
            {
                d_agv = null;
            }

            if (d_agv != null)
            {
                _plcHead.IsExitBatteryLock         = true;
                ParamControl.Do_ExitHeadChargeLock = false;

                _plcHead.ExitChargeAgv = d_agv.Id;



                ParamControl.HeadChargeAGV  = _plcHead.ExitChargeAgv;
                ParamControl.HeadChargeLock = _plcHead.IsExitBatteryLock;
            }
            else if (d_agv2 != null)
            {
                _plcHead.IsExitBatteryLock         = true;
                ParamControl.Do_ExitHeadChargeLock = false;

                _plcHead.ExitChargeAgv = d_agv2.Id;

                ParamControl.HeadChargeAGV  = _plcHead.ExitChargeAgv;
                ParamControl.HeadChargeLock = _plcHead.IsExitBatteryLock;
            }

            if (agv != null &&
                agv.IsFree &&
                agv.Electicity <= F_DataCenter.MDev.IGetDevElectricity() &&
                agv.Sta_Material == EnumagvSta_Material.无货 &&
                agv.ChargeStatus == EnumChargeStatus.未充电 &&
                agv.Electicity <= ParamControl.MinElectricityCharge    //低于最低充电量的车才能去充电
                )
            {
                // 判断出窑头充电站是否被锁
                if ((!_plcHead.IsExitBatteryLock) &&
                    (d_agv == null && d_agv2 == null)
                    )
                {
                    F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.充电, ConstSetBA.窑头卸载点, ConstSetBA.出窑头充电点);

                    task.Id = agv.Id;

                    //出窑头充电,锁定出窑头充电桩
                    _plcHead.IsExitBatteryLock = true;

                    ParamControl.Do_ExitHeadChargeLock = false;

                    _plcHead.ExitChargeAgv = agv.Id;

                    ParamControl.HeadChargeAGV  = _plcHead.ExitChargeAgv;
                    ParamControl.HeadChargeLock = _plcHead.IsExitBatteryLock;

                    _plcHead.ExitFlag = false;

                    F_DataCenter.MTask.IStartTask(task, agv.Id + TaskHeadToExitBatteryMsg);

                    sendServerLog(agv.Id + TaskHeadToExitBatteryMsg);

                    //LogFactory.LogDispatch(agv.Id, "AGV出窑头充电", TaskHeadToExitBatteryMsg);
                    FLog.Log(agv.Id + TaskHeadToExitBatteryMsg);
                }
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// 事务处理
        /// </summary>
        public String DoWork()
        {
            if (_isSuc)
            {
                return("");
            }

            if (!_isStart)
            {
                if (++_triggerCounter > F_DataCenter.ClearTime)
                {
                    _isOverTime = true;
                }
            }

            if (_agv != null)
            {
                if (_agv.IsAlive)
                {
                    _disAliveCounter = 0;
                }
                else
                {
                    if (++_disAliveCounter > F_DataCenter.ClearTime)
                    {
                        _isDisaliveOverTime = true;
                    }
                }
            }
            else
            {
                if (++_triggerCounter > F_DataCenter.ClearTime)
                {
                    _isOverTime = true;
                }
            }

            _taskDispatch = WcfMainHelper.GetDispatch(Id);

            if (_taskDispatch == null)
            {
                FDispatchOrder dis = new FDispatchOrder();

                dis.NavigationType = EnumNavigationType.Magnet;

                dis.Id = Id;

                dis.EndSite = _endSite;

                if (!string.IsNullOrEmpty(_startSite))
                {
                    dis.StartSiteList.Add(_startSite);
                }

                ///修改By fujun
                dis.DevList.Add(Id);

                string back = "";

                WcfMainHelper.StartDispatch(dis, out back);

                return(back);
            }
            else
            {
                ///修改By fujun
                _isStart = true;

                #region 滚筒逻辑
                ///确定此时任务的AGV
                if (_agv == null)
                {
                    _agv = new F_AGV(_taskDispatch.Dev);
                }

                ///此次调度任务已经完成
                if (_taskDispatch.Statue == EnumResultType.Suc)
                {
                    if (_operType == EnumOper.取货)       //窑尾
                    {
                        ///当前AGV的到达的地标 与 棍台绑定地标一致
                        if (_agv.Site == _plc.Site)
                        {
                            FLog.Log(_agv.Id + "到达窑尾,开始取货");
                            if (_agv != null && _plc.EnterChargeAgv == _agv.Id)
                            {
                                if (_plc.IsEnterBatteryLock
                                    //&& !ParamControl.Do_EnterEndChargeLock
                                    )
                                {
                                    _plc.IsEnterBatteryLock = false;

                                    ParamControl.Do_EnterEndChargeLock = true;

                                    ParamControl.EndChargeLock = _plc.IsEnterBatteryLock;

                                    _plc.EnterChargeAgv = null;
                                }
                            }

                            //如果界面打开忽略《窑尾》AGV货物状态和Plc货物状态则 直接发送棍台转动命令
                            if (ParamControl.Is_IgnoreTailUnloadStatus ||
                                (_plc.Sta_Material == EnumSta_Material.货 &&
                                 (_agv.Sta_Material == EnumagvSta_Material.无货 || _agv.Sta_Material == EnumagvSta_Material.送中)))
                            {
                                if (_agv.Sta_Monitor != EnumSta_Monitor.电机反转)
                                {
                                    _agv.SendOrdr(EnumType.料操作, EnumPara.agv上料启动);
                                    FLog.Log(_agv.Id + "启动车载辊台");
                                }
                                else
                                {
                                    if (BeginTime == null)
                                    {
                                        BeginTime = System.DateTime.Now;
                                    }
                                    _agv.SendOrdr(EnumType.料操作, EnumPara.agv上料启动);

                                    _plc.SendOrdr(EnumType.料操作, EnumPara.窑尾辊台允许下料);

                                    FLog.Log(_agv.Id + "启动车载辊台,启动窑尾辊台");
                                }
                            }

                            //如果界面打开忽略《窑尾》AGV货物状态,并且上面已经发送了指定时间的棍台转动时间
                            if ((ParamControl.Is_IgnoreTailUnloadStatus && IsTailRunTimeFinish()) ||
                                (//_plc.Sta_Material == EnumSta_Material.无货  &&
                                    _agv.Sta_Material == EnumagvSta_Material.货))
                            {
                                _agv.SendOrdr(EnumType.料操作, EnumPara.agv辊台停止);

                                _plc.SendOrdr(EnumType.料操作, EnumPara.窑头辊台上料完成);
                                FLog.Log(_agv.Id + "停止车载辊台,停止窑尾辊台");
                                //如果界面打开忽略《窑尾》AGV棍台状态,则进去结束任务
                                if (ParamControl.Is_IgnoreTailStaStatus ||
                                    _agv.Sta_Monitor == EnumSta_Monitor.电机停止
                                    )
                                {
                                    //取货完成,解锁窑尾
                                    if (_plc != null
                                        // && !ParamControl.Do_EndPlcLock
                                        )
                                    {
                                        _plc.IsLock = false;

                                        ParamControl.Do_EndPlcLock = true;
                                    }

                                    ISetTaskSuc();
                                }
                            }
                        }
                        else
                        {
                            ISetTaskSuc();
                        }
                        return("");
                    }
                    else if (_operType == EnumOper.放货)      //窑头
                    {
                        ///当前AGV的到达的地标 与 棍台绑定地标一致
                        if (_agv.Site == _plc.Site)
                        {
                            FLog.Log(_agv.Id + "到达窑头,开始放货");
                            if (_agv != null && _plc.EnterChargeAgv == _agv.Id)
                            {
                                if (_plc.IsEnterBatteryLock
                                    )
                                {
                                    _plc.IsEnterBatteryLock = false;

                                    _plc.EnterChargeAgv = null;
                                }
                            }
                            //如果界面打开忽略《窑头》AGV货物状态和Plc货物状态则 直接发送棍台转动命令
                            if (ParamControl.Is_IgnoreHeadUnloadStatus ||
                                ((_plc.Sta_Material == EnumSta_Material.允许下料 || _plc.Sta_Material == EnumSta_Material.无货 ||
                                  _plc.Sta_Material == EnumSta_Material.未知) &&
                                 (_agv.Sta_Material == EnumagvSta_Material.送中 || _agv.Sta_Material == EnumagvSta_Material.货)))
                            {
                                if (_agv.Sta_Monitor != EnumSta_Monitor.电机反转)
                                {
                                    _agv.SendOrdr(EnumType.料操作, EnumPara.agv下料启动);
                                    FLog.Log(_agv.Id + "启动车载辊台");
                                }
                                else
                                {
                                    if (BeginTime == null)
                                    {
                                        BeginTime = System.DateTime.Now;
                                    }
                                    _plc.SendOrdr(EnumType.料操作, EnumPara.窑头辊台上料中);

                                    _agv.SendOrdr(EnumType.料操作, EnumPara.agv下料启动);
                                    FLog.Log(_agv.Id + "启动车载辊台,启动窑头辊台");
                                }
                            }

                            //如果界面打开忽略《窑头》AGV货物状态,并且上面已经发送了指定时间的棍台转动时间
                            if ((ParamControl.Is_IgnoreHeadUnloadStatus && IsHeadRunTimeFinish()) ||
                                (//(_plc.Sta_Material == EnumSta_Material.允许下料 || _plc.Sta_Material == EnumSta_Material.未知) &&
                                    _agv.Sta_Material == EnumagvSta_Material.无货))
                            {
                                _plc.SendOrdr(EnumType.料操作, EnumPara.窑头辊台上料完成);

                                _agv.SendOrdr(EnumType.料操作, EnumPara.agv辊台停止);

                                FLog.Log(_agv.Id + "停止车载辊台,停止窑头辊台");
                                //如果界面打开忽略《窑头》AGV棍台状态,则进去结束任务
                                if (ParamControl.Is_IgnoreHeadStaStatus ||
                                    _agv.Sta_Monitor == EnumSta_Monitor.电机停止
                                    )
                                {
                                    //放货完成,解锁窑头
                                    if (_plc != null
                                        //&& !ParamControl.Do_HeadPlcLock
                                        )
                                    {
                                        _plc.IsLock = false;

                                        ParamControl.Do_HeadPlcLock = true;
                                    }

                                    ISetTaskSuc();
                                }
                            }
                        }
                        else
                        {
                            ISetTaskSuc();
                        }
                        return("");
                    }
                    else if (_operType == EnumOper.充电)
                    {
                        if (!_plc.ExitFlag)
                        {
                            _plc.ExitFlag = true;
                        }
                        ISetTaskSuc();

                        return("");
                    }
                    else if (_operType == EnumOper.无动作)
                    {
                        ISetTaskSuc();

                        return("");
                    }
                    else if (_operType == EnumOper.对接完成)
                    {
                        if (_plc.IsExitBatteryLock && _plc.ExitChargeAgv == _agv.Id)
                        {
                            if (_plc.Site == "14")
                            {
                                ParamControl.Do_ExitHeadChargeLock = true;
                            }
                            //else if (_plc.Site == "11")
                            //{
                            //    ParamControl.Do_ExitEndChargeLock = true ;
                            //}

                            _plc.IsExitBatteryLock = false;

                            _plc.ExitChargeAgv = null;

                            ParamControl.HeadChargeAGV  = _plc.ExitChargeAgv;
                            ParamControl.HeadChargeLock = _plc.IsExitBatteryLock;
                        }

                        if (!_plc.ExitFlag)
                        {
                            _plc.ExitFlag = true;
                        }
                        ISetTaskSuc();
                        return("");
                    }
                }
                return("");

                #endregion
            }
        }