Exemple #1
0
 /// <summary>
 /// 摆渡车是否接货中
 /// </summary>
 /// <param name="area"></param>
 /// <param name="tt"></param>
 /// <returns></returns>
 public bool IsTaking(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.StartTakeRoll(tt, 2);
                 }
                 else
                 {
                     if (a._.CurrentTask == TaskEnum.辊台任务)
                     {
                         res = true;
                     }
                 }
             }
         }
         return(res);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
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;
            }
        }