示例#1
0
        /// <summary>
        ///窑尾充电点有充电完成的AGV
        ///优先派充电完成的车去接货
        /// </summary>
        public void PlcEndChargeSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.接货充电点);

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

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

                    F_AGV.AgvLock(agv.Id);

                    _plcEnd.IsLock = true;

                    task.Id = agv.Id;

                    F_DataCenter.MTask.IStartTask(task);

                    sendServerLog(agv.Id + ",充电完成,派充电完成的车去接货");

                    LogFactory.LogDispatch(agv.Id, "充电完成", "派充电完成的车去接货");
                }
            }
            else
            {
                _PlcEndChargeSuc = false;
            }
        }
示例#2
0
        /// <summary>
        /// 窑尾启动辊台
        /// </summary>
        private void EndHolder()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑尾1);


            if (agv != null && agv.IsFree && !agv.IsLock 
                && agv.Sta_Material == EnumSta_AGV.AGV无货
                &&agv.Sta_Monitor == EnumSta_AGVMonitor.AGV电机停止
                && (_plcEnd.Sta_Material_End == EnumSta_Material_End.窑尾有货
                || _plcEnd.Sta_Material_End == EnumSta_Material_End.窑尾传输中)
                && true
                )
            {

                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, Site.窑尾1, Site.窑尾1);

                agv.IsLock = true;

                _plcEnd.IsLock = true;

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + "窑尾辊台启动取货");

                LogFactory.LogDispatch(agv.Id, "窑尾取货", " 窑尾辊台启动");

            }
        }
示例#3
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);
            }
        }
示例#4
0
        /// <summary>
        /// 窑尾1 去 窑尾等待5   
        /// </summary>
        public void EndToEndWait()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑尾1);

            // 判断窑尾1 号机械手是否完成 
            if (agv != null && agv.IsFree && !agv.IsLock
                && agv.Sta_Material == EnumSta_AGV.AGV有货
                && _plcEnd.Sta_Material_End == EnumSta_Material_End.窑尾1号机械手完成

                )
            {
                // 从窑尾1 去 窑尾等待5
                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.无动作, Site.窑尾1, Site.窑尾5);

                task.Id = agv.Id;

                agv.IsLock = true;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + ", 从窑尾1 去 窑尾等待5");

                LogFactory.LogDispatch(agv.Id, "取货完成", ", 从窑尾1 去 窑尾等待5");
            }
        }
示例#5
0
        /// <summary>
        /// 窑头4去充电
        /// </summary>
        private void PlcCharge()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑头4);

            if (agv != null && agv.IsFree&&!agv.IsLock
                && agv.Sta_Material == EnumSta_AGV.AGV无货
                && _plcHead.Sta_Material_Head == EnumSta_Material_Head.窑头接料完成
                && agv.Electicity <= ConstSetBA.最低电量
                && agv.ChargeStatus == EnumChargeStatus.未充电)
            {
                _PlcHeadNeedCharge = true;

                F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.充电, Site.窑头4, Site.充电点);

                agv.IsLock = true;

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + ",去到充电点充电");

                LogFactory.LogDispatch(agv.Id, "充电", "去到充电点充电");

            }
            else
            {
                _PlcHeadNeedCharge = false;
            }
        }
示例#6
0
        /// <summary>
        /// 窑头启动辊台
        /// </summary>
        private void HeadHolder()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑头4);


            if (agv != null && agv.IsFree && !agv.IsLock 
                && agv.Sta_Material == EnumSta_AGV.AGV有货
                &&agv.Sta_Monitor== EnumSta_AGVMonitor.AGV电机停止
                && true
                )
            {

                F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.放货, Site.窑头4, Site.窑头4);

                agv.IsLock = true;

                _plcHead.IsLock = true;

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + "窑头辊台启动卸货");

                LogFactory.LogDispatch(agv.Id, "窑头卸货", " 窑头辊台启动");

            }
        }
示例#7
0
        /// <summary>
        ///充电完成的AGV去窑尾1
        /// </summary>
        public void PlcChargeSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.充电点);

            // 有未上锁的、充电完成的AGV,且窑头卸载点无货、AGV上有货
            if (agv != null && agv.IsFree && !agv.IsLock
                && agv.ChargeStatus == EnumChargeStatus.充电完成
                && agv.Sta_Material == EnumSta_AGV.AGV无货
                )
            {

                //return;
                _PlcHeadChargeSuc = true;

                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, Site.充电点, Site.窑尾1);

                agv.IsLock = true;

                _plcEnd.IsLock = true;

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + ",充电完成,派充电完成的车去窑尾1");

                LogFactory.LogDispatch(agv.Id, "充电完成", "派充电完成的车去窑尾1");

            }
            else
            {
                _PlcHeadChargeSuc = false;
            }
        }
示例#8
0
        /// <summary>
        /// 窑尾机械手1操作
        /// </summary>
        private void EndHolder1()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑尾1);

            // AGV已经取货完成,
            if (agv != null && agv.IsFree && !agv.IsLock 
                && !_plcEnd.IsLock
                && agv.Sta_Material == EnumSta_AGV.AGV有货
                &&
                !(_plcEnd.Sta_Material_End == EnumSta_Material_End.窑尾1号机械手完成)
                && true
                )
            {
                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.窑尾1号机械手, Site.窑尾1, Site.窑尾1);

                agv.IsLock = true;

                task.Id = agv.Id;

                _plcEnd.IsLock = true;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + "窑尾1号机械手启动");

                LogFactory.LogDispatch(agv.Id, "取货完成", " 窑尾1号机械手启动");

            }
        }
示例#9
0
        /// <summary>
        /// 窑头4 到 窑尾1
        /// </summary>
        private void TaskHeadToEnd()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑头4);

            if (agv != null && agv.IsFree && !agv.IsLock
                 && agv.Sta_Material == EnumSta_AGV.AGV无货
                && _plcHead.Sta_Material_Head == EnumSta_Material_Head.窑头接料完成
                 //&& agv.Electicity > ConstSetBA.最低电量
                 )
            {
                F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, Site.窑头4, Site.窑尾1);

                task.Id = agv.Id;

                agv.IsLock = true;

                _plcEnd.IsLock = true;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + "从窑头卸载点4 到 窑尾装载点1");

                LogFactory.LogDispatch(agv.Id, "到窑尾接货", "从窑头卸载点4到窑尾装载点1");

            }
        }
示例#10
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);
            }
        }
示例#11
0
        /// <summary>
        /// 窑头等待7 去 窑头机械手3
        /// </summary>
        public void HeadWaitToHolder()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑头7);

            //窑头等待区7的车不需要充电、没有充电完成的车 、没有初始化时要去窑头装载点的车
            if (agv != null && agv.IsFree && !agv.IsLock
                 //&& !_ToPlcHead
                )
            {
                // 判断夹具的状态 及 窑尾货物状态、AGV货物状态
                if (true
                   && agv.Sta_Material == EnumSta_AGV.AGV有货
                   && _plcHeadHolder.Sta_Material_HeadMLP == EnumSta_Material_HeadMLP.窑头机械手就绪
                    )
                {
                    // 从窑头等待7 去 窑头夹具点3
                    F_ExcTask task = new F_ExcTask(_plcHeadHolder, EnumOper.窑头机械手, Site.窑头7, Site.窑头3);

                    task.Id = agv.Id;

                    agv.IsLock = true;

                    F_DataCenter.MTask.IStartTask(task);

                    sendServerLog(agv.Id + ",  从窑头等待7 去 窑头夹具点3");

                    LogFactory.LogDispatch(agv.Id, "卸货", "从窑头等待7去窑头夹具点3");
                }
            }
        }
示例#12
0
        /// <summary>
        /// 窑头等待8 去 窑头4
        /// </summary>
        private void TaskPlcHeadPut()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑头8);

            /// 窑头AGV未锁定 并且 此次任务没有被响应
            if (agv != null && agv.IsFree && !agv.IsLock 
                                          //&& !_plcHead.IsLock
                && agv.Sta_Material == EnumSta_AGV.AGV有货
               )
            {
                // 从窑头卸载等待点2 到 窑头卸载点的放货任务
                F_ExcTask task = new F_ExcTask(_plcHead, EnumOper.放货, Site.窑头8, Site.窑头4);

                task.Id = agv.Id;

                _plcHead.IsLock = true;

                agv.IsLock = true;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + "从窑头卸载等待点8 到 窑头卸载点4的任务");

                LogFactory.LogDispatch(agv.Id, "窑头卸货", "从窑头卸载等待点8 到 窑头卸载点4的任务");
            }
            else
            {
                _ToPlcHead = false;
            }
        }
示例#13
0
        /// <summary>
        /// 如果agv没货 回到装载点1
        /// </summary>
        private void InitToEnd()
        {
            Thread.Sleep(1000);

            List<F_AGV> agvs = F_DataCenter.MDev.IGetDevNotLoadOnWaitSite();

            if (agvs != null)
            {
                foreach (F_AGV agv in agvs)
                {
                    if (agv.IsFree)
                    {
                        _ToPlcEnd = true;

                        F_ExcTask task = new F_ExcTask(_plcEnd, EnumOper.取货, agv.Site, Site.窑尾1);

                        task.Id = agv.Id;

                        F_DataCenter.MTask.IStartTask(task);

                        sendServerLog(agv.Id + " 初始化,回到窑尾装载点1");

                        LogFactory.LogDispatch(agv.Id, "车辆初始化", "回到窑尾装载点1");

                    }
                }
            }
        }
示例#14
0
        /// <summary>
        /// 开始一个新的操作任务
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public bool IStartTask(F_ExcTask task)
        {
            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);
                    return(true);
                }
                else if (task.EndSite != exit.EndSite)
                {
                    _taskList.Remove(exit);
                    _taskList.Add(task);
                    return(true);
                }
                else if (task.StartSite != exit.StartSite)
                {
                    _taskList.Remove(exit);
                    _taskList.Add(task);
                    return(true);
                }
                else
                {
                    return(true);
                }
            }
        }
示例#15
0
        /// <summary>
        /// 窑头卸载区的AGV去充电
        /// </summary>
        private void PlcHeadCharge()
        {
            F_AGV agv  = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑头卸载等待区);
            F_AGV agv1 = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.卸货充电点);

            // 让电量低于60且未充电的AGV去充电
            if (agv != null && agv.Electicity <= ConstSetBA.最低电量 && !F_AGV.IsLock(agv.Id) &&
                //agv.ChargeStatus == EnumChargeStatus.未充电  &&
                agv1 == null)
            {
                _PlcHeadNeedCharge = true;

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

                F_AGV.AgvLock(agv.Id);

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + ",去到窑头充电点充电");

                LogFactory.LogDispatch(agv.Id, "充电", "去到窑头充电点充电");
            }
            else
            {
                _PlcHeadNeedCharge = false;
            }
        }
示例#16
0
        /// <summary>
        /// 窑头等待点7的AGV去充电
        /// </summary>
        private void PlcHeadCharge()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(Site.窑头7);

            // 让未上锁的、电量低于60且未充电的AGV去充电
            if (agv != null && agv.IsFree && agv.Electicity <= 90 &&//ConstSetBA.最低电量 &&
                agv.ChargeStatus == EnumChargeStatus.未充电
                )
            {
                _PlcHeadNeedCharge = true;

                F_ExcTask task = new F_ExcTask(null, EnumOper.充电, Site.窑头7, Site.充电点);

                agv.IsLock = true;

                task.Id = agv.Id;

                F_DataCenter.MTask.IStartTask(task);

                sendServerLog(agv.Id + ",去到充电点充电");

                LogFactory.LogDispatch(agv.Id, "充电", "去到充电点充电");
            }
            else
            {
                _PlcHeadNeedCharge = false;
            }
        }
示例#17
0
        public void ExitPlcHeadChargeSuc()
        {
            F_AGV agv = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.出窑头充电点);

            // 有未上锁的、充电完成的AGV
            if (agv != null && agv.IsFree &&
                !F_AGV.IsLock(agv.Id) &&
                agv.ChargeStatus == EnumChargeStatus.充电完成)
            {
                if (_plcHead.ExitFlag &&
                    true)
                {
                    _ExitPlcHeadChargeSuc = true;

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

                    F_AGV.AgvLock(agv.Id);

                    _plcHead.ExitFlag = false;
                    //task.Id = agv.Id;

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

                    sendServerLog(agv.Id + ExitPlcHeadChargeSucMsg);

                    LogFactory.LogDispatch(agv.Id, "充电完成", ExitPlcHeadChargeSucMsg);
                }
            }
            else
            {
                _ExitPlcHeadChargeSuc = false;
            }
        }
示例#18
0
        private void TaskEndToExitBattery()
        {
            F_AGV agv  = F_DataCenter.MDev.IGetDevOnSite(_plcEnd.Site);
            F_AGV agv1 = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.出窑尾充电点);

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

                        F_AGV.AgvLock(agv.Id);

                        task.Id = agv.Id;

                        _plcEnd.IsExitBatteryLock = true;

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

                        sendServerLog(agv.Id + TaskEndToExitBatteryMsg);

                        LogFactory.LogDispatch(agv.Id, "AGV出窑尾充电", TaskEndToExitBatteryMsg);
                    }
                }
            }
        }
示例#19
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;
                }
            }
        }
示例#20
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;
            }
        }
示例#21
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.GetAgvId(), "调度完成", exit.GetTaskInfo());//任务完成日志

                    _taskList.Remove(exit);
                }
            }
        }
示例#22
0
        /// <summary>
        /// 开始一个新的操作任务
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public bool IStartTask(F_ExcTask task)
        {
            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); return(true);
                }
            }

            return(false);
        }
示例#23
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());//任务完成日志
             PublicDataContorl.TaskIsSucc(excTask.NO);
             excTask.ISetTaskSuc();
             _taskList.Remove(excTask);
         }
     }
 }
示例#24
0
        /// <summary>
        /// 窑尾等 到 进窑尾充
        /// </summary>
        private void TaskEndToEnterBattery()
        {
            F_AGV agv  = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.窑尾装载等待区);
            F_AGV agv1 = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.进窑尾充电点);

            if (agv1 != null)
            {
                ParamControl.Do_EnterEndChargeLock = false;
            }

            // 让未上锁的、电量低于60且未充电的AGV去充电,且接货充电点没有AGV
            if (agv != null && agv.IsFree &&
                !F_AGV.IsLock(agv.Id) &&
                agv.Electicity <= F_DataCenter.MDev.IGetDevElectricity() &&
                agv.ChargeStatus == EnumChargeStatus.未充电 &&
                agv1 == null &&
                !_plcEnd.IsEnterBatteryLock && ParamControl.Do_EnterEndChargeLock)
            {
                _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;

                task.Id = agv.Id;

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

                sendServerLog(agv.Id + PlcEndChargeMsg);

                LogFactory.LogDispatch(agv.Id, "充电", PlcEndChargeMsg);
            }
            else
            {
                _PlcEndNeedCharge = false;

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

                    _plcEnd.EnterChargeAgv = agv1.Id;
                }
            }
        }
示例#25
0
        /// <summary>
        /// 窑头去窑头对接完成点
        /// </summary>
        private void TaskHeadToHeadSuc()
        {
            F_AGV agv  = F_DataCenter.MDev.IGetDevOnSite(_plcHead.Site);
            F_AGV agv1 = F_DataCenter.MDev.IGetDevOnSite(ConstSetBA.出窑头充电点);

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

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

                        F_AGV.AgvLock(agv.Id);

                        task1.Id = agv.Id;

                        _plcHead.ExitFlag = false;

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

                        sendServerLog(agv.Id + TaskHeadToHeadSucMsg);

                        LogFactory.LogDispatch(agv.Id, "卸货完成", TaskHeadToHeadSucMsg);
                    }
                }
            }
        }
示例#26
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
                //&& !F_AGV.IsLock(agv.Id)
                //&& agv.Electicity > F_DataCenter.MDev.IGetDevElectricity()
                //&& (//ParamControl.IgnoreHeadUnloadTask ||
                //_plcHead.Sta_Material == EnumSta_Material.允许下料
                //|| _plcHead.Sta_Material == EnumSta_Material.未知                )
                )
            {
                //窑头等待区的车不需要充电、没有充电完成的车、没有回卸载点的车
                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;

                    F_AGV.AgvLock(agv.Id);

                    sendServerLog(agv.Id + TaskPlcHeadPutMsg);

                    LogFactory.LogDispatch(agv.Id, "卸货", TaskPlcHeadPutMsg);
                }
                else
                {
                    // _ToPlcHead = false;
                }
            }
        }
示例#27
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);
                }
            }
        }
示例#28
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);
                    PublicDataContorl.AddTaskData(new TaskData(task.NO, msg, task.StartSite + "," + task.EndSite));
                    return(true);
                }
            }

            return(false);
        }
示例#29
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);
                    }
                }
            }
        }
示例#30
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.窑尾装载点);

            ///窑尾有货 窑尾等待点的AGV没有锁定 并且 此次任务没有被响应
            if (//(ParamControl.Do_EndPlcLock && !_plcEnd.IsLock) &&
                (d_agv == null && d_agv2 == null) &&
                agv != null && agv.IsFree
                //&& !F_AGV.IsLock(agv.Id)
                //&& agv.Electicity > F_DataCenter.MDev.IGetDevElectricity()
                //&& (ParamControl.IgnoreTailLoadTask || _plcEnd.Sta_Material == EnumSta_Material.有货)
                )
            {
                //窑尾等待区的车不需要充电、没有充电完成的车 、没有初始化时要去窑尾装载点的车
                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);
                }
                else
                {
                    //_ToPlcEnd = false;
                }
            }
        }