Пример #1
0
 /// <summary>
 /// 停止摆渡车接货
 /// </summary>
 /// <param name="area"></param>
 /// <param name="tt"></param>
 /// <param name="goodsNum"></param>
 public bool IsStopTaking(string area, TaskTypeEnum tt, int goodsNum)
 {
     try
     {
         bool res = false;
         if (devices.Exists(c => c.area == area && c.taskType == tt))
         {
             DevInfoARF arf = devices.Find(c => c.area == area && c.taskType == tt);
             if ((goodsNum == 2 && arf._.GoodsStatus == GoodsEnum.辊台满货) ||
                 (goodsNum == 1 && arf._.GoodsStatus == GoodsEnum.辊台1有货 && tt == TaskTypeEnum.入库) ||
                 (goodsNum == 1 && arf._.GoodsStatus == GoodsEnum.辊台2有货 && tt == TaskTypeEnum.出库))
             {
                 if (arf._.ActionStatus == ActionEnum.停止 && arf._.FinishTask == TaskEnum.停止辊台任务)
                 {
                     res = true;
                 }
                 else
                 {
                     arf.StopRoller();
                 }
             }
         }
         return(res);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 /// <summary>
 /// 停止摆渡车送货
 /// </summary>
 /// <param name="area"></param>
 /// <param name="tt"></param>
 /// <param name="goodsNum"></param>
 public bool IsStopGiving(string area, TaskTypeEnum tt)
 {
     try
     {
         bool res = false;
         if (devices.Exists(c => c.area == area && c.taskType == tt))
         {
             DevInfoARF arf = devices.Find(c => c.area == area && c.taskType == tt);
             if (arf._.GoodsStatus == GoodsEnum.辊台无货)
             {
                 if (arf._.ActionStatus == ActionEnum.停止 && arf._.FinishTask == TaskEnum.停止辊台任务)
                 {
                     if (!arf.isLock)
                     {
                         res = true;
                     }
                     else
                     {
                         // 送完货直接解锁
                         arf.IsLockUnlock(false);
                     }
                 }
                 else
                 {
                     arf.StopRoller();
                 }
             }
         }
         return(res);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
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;
            }
        }
Пример #4
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;
            }
        }
Пример #5
0
 /// <summary>
 /// 摆渡车是否送货中
 /// </summary>
 /// <param name="area"></param>
 /// <param name="tt"></param>
 /// <returns></returns>
 public bool IsGiving(string area, TaskTypeEnum tt)
 {
     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.设备正常)
             {
                 if (a._.ActionStatus == ActionEnum.停止)
                 {
                     a.StartGiveRoll(tt);
                 }
                 else
                 {
                     if (a._.CurrentTask == TaskEnum.辊台任务)
                     {
                         if (a._.GoodsStatus != GoodsEnum.辊台无货)
                         {
                             if (a._.CurrentTask == TaskEnum.辊台任务)
                             {
                                 a.StartGiveRoll(tt);
                             }
                         }
                         else
                         {
                             if (a._.FinishTask == TaskEnum.辊台任务)
                             {
                                 a.StopRoller();
                             }
                         }
                         res = true;
                     }
                 }
             }
         }
         return(res);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #6
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;
            }
        }
Пример #7
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;
            }
        }
Пример #8
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;
            }
        }