Ejemplo n.º 1
0
        /// <summary>
        /// 是否有锁定摆渡车
        /// </summary>
        /// <returns></returns>
        public bool IsLockARF(string area, TaskTypeEnum tt, out int goods)
        {
            try
            {
                ChangeFlag(area);

                bool res = false;
                goods = 0;
                if (devices.Exists(c => c.isUseful && c.area == area && c.taskType == tt))
                {
                    DevInfoARF a = devices.Find(c => c.isUseful && c.area == area && c.taskType == tt);

                    if (ADS.mSocket.IsConnected(a.devName) &&
                        a._.CommandStatus != CommandEnum.命令错误 && a._.DeviceStatus != DeviceEnum.设备故障)
                    {
                        if (a._.CurrentTask == TaskEnum.辊台任务 && a._.FinishTask == TaskEnum.辊台任务)
                        {
                            a.StopRoller();
                        }
                        switch (a._.GoodsStatus)
                        {
                        case GoodsEnum.辊台1有货:
                        case GoodsEnum.辊台2有货:
                        case GoodsEnum.辊台中间有货:
                            goods = 1;
                            break;

                        case GoodsEnum.辊台满货:
                            goods = 2;
                            break;

                        default:
                            break;
                        }

                        if (a.isLock)
                        {
                            if (a._.GoodsStatus == GoodsEnum.辊台无货 && a._.RollerStatus == RollerStatusEnum.辊台停止)
                            {
                                // 停止&解锁
                                a.StopTask();
                                a.IsLockUnlock(false);
                            }
                            else
                            {
                                res = true;
                            }
                        }
                    }
                }
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 是否有空闲摆渡车
        /// </summary>
        /// <returns></returns>
        public bool IsFreeARF(string area, TaskTypeEnum tt)
        {
            try
            {
                ChangeFlag(area);

                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.设备故障)
                    {
                        if (a._.CurrentTask == TaskEnum.辊台任务 && a._.FinishTask == TaskEnum.辊台任务)
                        {
                            a.StopRoller();
                        }
                        if (a.isLock)
                        {
                            if (a._.GoodsStatus == GoodsEnum.辊台无货 && a._.ActionStatus == ActionEnum.停止)
                            {
                                // 停止&解锁
                                a.StopTask();
                                a.IsLockUnlock(false);
                                res = true;
                            }
                        }
                        else
                        {
                            res = true;
                        }
                    }
                }
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 锁定摆渡车
        /// </summary>
        /// <returns></returns>
        public bool LockARF(string area, TaskTypeEnum tt)
        {
            try
            {
                ChangeFlag(area);

                bool res = false;
                if (devices.Exists(c => c.isUseful && c.area == area && c.taskType == tt))
                {
                    DevInfoARF a = devices.Find(c => c.isUseful && c.area == area && c.taskType == tt);
                    if (ADS.mSocket.IsConnected(a.devName) &&
                        a._.CommandStatus == CommandEnum.命令正常 && a._.DeviceStatus == DeviceEnum.设备正常)
                    {
                        if (a._.CurrentTask == TaskEnum.辊台任务 && a._.FinishTask == TaskEnum.辊台任务)
                        {
                            a.StopRoller();
                        }
                        if (a._.GoodsStatus == GoodsEnum.辊台无货)
                        {
                            if (a._.ActionStatus == ActionEnum.停止)
                            {
                                res = true;
                            }
                        }
                        else
                        {
                            if (a.isLock)
                            {
                                res = true;
                            }
                            else
                            {
                                bool run = false;
                                switch (tt)
                                {
                                case TaskTypeEnum.入库:
                                    if ((a._.GoodsStatus == GoodsEnum.辊台满货 && a._.RollerStatus == RollerStatusEnum.辊台停止) ||
                                        (a._.GoodsStatus == GoodsEnum.辊台1有货 &&
                                         a._.RollerStatus != RollerStatusEnum.辊台1启动 && a._.RollerStatus != RollerStatusEnum.辊台全启动))
                                    {
                                        run = true;
                                    }
                                    break;

                                case TaskTypeEnum.出库:
                                    if ((a._.GoodsStatus == GoodsEnum.辊台满货 && a._.RollerStatus == RollerStatusEnum.辊台停止) ||
                                        (a._.GoodsStatus == GoodsEnum.辊台2有货 &&
                                         a._.RollerStatus != RollerStatusEnum.辊台2启动 && a._.RollerStatus != RollerStatusEnum.辊台全启动))
                                    {
                                        run = true;
                                    }
                                    break;

                                default:
                                    break;
                                }
                                if (run)
                                {
                                    // 停止 & 锁定
                                    a.StopTask();
                                    a.IsLockUnlock(true);
                                    res = true;
                                }
                                else
                                {
                                    if (a._.ActionStatus == ActionEnum.停止)
                                    {
                                        a.StartTakeRoll(tt, 2);
                                    }
                                }
                            }
                        }
                    }
                }
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }