Esempio n. 1
0
        /// <summary>
        /// 是否会撞车
        /// </summary>
        private bool IsHit(DevInfoARF da, int site)
        {
            DevInfoARF arf = devices.Find(c => c.area.Equals(da.area) && c.devName != da.devName);

            if (arf == null)
            {
                return(false);
            }
            int safe = ADS.mDis.GetArfSafeDis(da.area);
            int loc;

            switch (da.taskType)
            {
            case TaskTypeEnum.入库:
                loc = ADS.mDis.GetArfStandByP2(da.area);
                if (arf._.CurrentSite <= (site + safe) && arf._.ActionStatus == ActionEnum.运行中)
                {
                    return(true);
                }
                break;

            case TaskTypeEnum.出库:
                loc = ADS.mDis.GetArfStandByP1(da.area);
                if (arf._.CurrentSite >= (site - safe) && arf._.ActionStatus == ActionEnum.运行中)
                {
                    return(true);
                }
                break;

            default:
                return(true);
            }
            arf.ToSite(loc);
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// 移至待命点
        /// </summary>
        /// <returns></returns>
        public bool Standby(string area, TaskTypeEnum tt, int site)
        {
            try
            {
                bool res = false;
                if (devices.Exists(c => c.area == area && c.taskType == tt && c.isUseful))
                {
                    DevInfoARF a = devices.Find(c => c.area == area && c.taskType == tt && c.isUseful);

                    if (a._.CurrentTask == TaskEnum.辊台任务 && a._.FinishTask == TaskEnum.辊台任务)
                    {
                        a.StopRoller();
                    }
                    if (a.isLock)
                    {
                        if (a._.CurrentSite != site)
                        {
                            res = true;
                        }
                    }
                    else
                    {
                        int sb = tt == TaskTypeEnum.入库 ? ADS.mDis.GetArfStandByP1(a.area) : ADS.mDis.GetArfStandByP2(a.area);
                        if (Math.Abs(a._.CurrentSite - sb) <= 2)
                        {
                            res = true;
                        }
                        else
                        {
                            if (a.isUseful && ADS.mSocket.IsConnected(a.devName) && a._.ActionStatus == ActionEnum.停止)
                            {
                                a.ToSite(sb);
                            }
                        }
                    }
                }
                else
                {
                    res = true;
                }
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 移动对接点
        /// </summary>
        public bool MovingButtSite(string area, TaskTypeEnum tt, int site)
        {
            try
            {
                bool res = false;
                if (devices.Exists(c => c.area == area && c.taskType == tt && c.isUseful))
                {
                    DevInfoARF a = devices.Find(c => c.area == area && c.taskType == tt && c.isUseful);

                    if (!ADS.mSocket.IsConnected(a.devName) ||
                        a._.CommandStatus == CommandEnum.命令错误 ||
                        a._.DeviceStatus == DeviceEnum.设备故障)
                    {
                        return(res);
                    }

                    if (a._.CurrentTask == TaskEnum.辊台任务 && a._.FinishTask == TaskEnum.辊台任务)
                    {
                        a.StopRoller();
                    }

                    if (Standby(area, tt == TaskTypeEnum.入库 ? TaskTypeEnum.出库 : TaskTypeEnum.入库, site))
                    {
                        if (a._.CurrentSite != site)
                        {
                            if (a._.ActionStatus == ActionEnum.停止)
                            {
                                a.ToSite(site);
                            }
                        }
                        else
                        {
                            res = true;
                        }
                    }
                }
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 摆渡车是否到位
        /// </summary>
        public bool IsArfOk(string area, TaskTypeEnum tt, int site)
        {
            try
            {
                bool res = false;
                if (devices.Exists(c => c.area == area && c.taskType == tt && c.isUseful && c.isLock))
                {
                    DevInfoARF arf = devices.Find(c => c.area == area && c.taskType == tt && c.isUseful && c.isLock);
                    if (arf._.ActionStatus == ActionEnum.停止 || ADS.mSocket.IsConnected(arf.devName) ||
                        arf._.CommandStatus == CommandEnum.命令正常 || arf._.DeviceStatus == DeviceEnum.设备正常)
                    {
                        if (arf._.CurrentSite == site)
                        {
                            res = true;
                        }
                        else
                        {
                            int safe = ADS.mDis.GetArfSafeDis(area);
                            if (devices.Exists(c => c.area == area && c.taskType != tt && !c.isLock))
                            {
                                DevInfoARF a = devices.Find(c => c.area == area && c.taskType != tt && !c.isLock);
                                if (ADS.mSocket.IsConnected(a.devName) || a._.CommandStatus == CommandEnum.命令正常 || a._.DeviceStatus == DeviceEnum.设备正常)
                                {
                                    int loc = 0;
                                    switch (a.taskType)
                                    {
                                    case TaskTypeEnum.入库:
                                        loc = ADS.mDis.GetArfStandByP1(area);
                                        if (a._.CurrentSite <= (site - safe))
                                        {
                                            arf.ToSite(site);
                                        }
                                        else if (a._.ActionStatus == ActionEnum.停止)
                                        {
                                            a.ToSite(loc);
                                        }
                                        break;

                                    case TaskTypeEnum.出库:
                                        loc = ADS.mDis.GetArfStandByP2(area);
                                        if (a._.CurrentSite >= (site + safe))
                                        {
                                            arf.ToSite(site);
                                        }
                                        else if (a._.ActionStatus == ActionEnum.停止)
                                        {
                                            a.ToSite(loc);
                                        }
                                        break;

                                    default:
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }