RobotBean.cs 25.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717
using Asa;
using BLL;
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;

namespace OnlineStore.DeviceLibrary
{
    public partial class RobotBean : RobotBase
    {


        #region  初始化 
        public bool IsDebug = false;

        public InputEquip inputEquip;
        public X_RAY_Equip XrayBean;
        public OutputEquip outputEquip;
        public Dictionary<int, EquipBase> equipsMap = new Dictionary<int, EquipBase>();
        
        public Robot_Config Config = null;
        private bool canStart = false;
        public SQLite sQLite = null;
        public bool LoadSuccess = false;
        public bool SafeStop = false;
        public RobotBean(Robot_Config lineConfig, InputEquip_Config fconfig, XRay_Config xconfig, OutputEquip_Config pconfig)
        {
            equipsMap = new Dictionary<int, EquipBase>();
            if (lineConfig.IOSingle_TimerOut <= 0)
            {
                lineConfig.IOSingle_TimerOut = 5000;
            }
            Init();
            baseConfig = lineConfig;
            this.Config = lineConfig;
            this.DeviceID = lineConfig.Id;

            Name = (" 自动点料机_" + " ").ToUpper();
            MoveInfo = new RobotMoveInfo(Name);

            IsDebug = Config.IsDebug.Equals(1);

            ledProcessTimer.Elapsed += LedProcessTimer_Elapsed;

            
            List<string> ioList = new List<string>();
            ioList = new List<string>(DeviceConfig.ProIOIpMap.Values);

            inputEquip = new InputEquip("1", fconfig);
            XrayBean = new X_RAY_Equip("2", xconfig);
            outputEquip = new OutputEquip("3", pconfig);

            equipsMap.Add(1, inputEquip);
            equipsMap.Add(2, XrayBean);
            equipsMap.Add(3, outputEquip);
            IOManager.Init();
            CodeManager.LoadConfig();

            AgvClient.NodeList.Add(outputEquip.Config.AgvInName);
            AgvClient.NodeList.Add(outputEquip.Config.AgvOutName);
            AgvClient.NodeList.Add(inputEquip.Config.RightAgvName);
            AgvClient.NodeList.Add(inputEquip.Config.LeftAgvName);




            EyemManager.record = true;
            outputEquip.Out_TrayCheck_Test(outputEquip.Config.CameraName, IO_VALUE.HIGH);
            EyemManager.record = false;
            /*var carerayImage = new CarerayImage();
            if (carerayImage.Open())
            {
                carerayImage.Close();
            }
            else {
                LogUtil.info(Name + "图像平板打开失败! 系统不允许启动。");
                return;
            }
            */
            ParamManager.Init();
            OldPNList.init();
            Task.Factory.StartNew(delegate
            {
                LogUtil.info(Name + "开始连接IO模块 ");
                IOManager.instance.ConnectionIOList(ioList);
                Thread.Sleep(3000);
                mainTimer.Enabled = true;
                //ledProcessTimer.Enabled = true;
                canStart = true;
                var MaxNopaperCount = ConfigAppSettings.GetIntValue("NopaperCount");
                LogUtil.info("MaxNopaperCount:"+ MaxNopaperCount);
                var loadsuccess = XrayBean.XPlateUP();
                
                AgvClient.Init();
                string dataFile =Application.StartupPath+ ConfigAppSettings.GetValue(Setting_Init.DataPath);
                sQLite = new SQLite(dataFile);
                bool result = sQLite.Connect();
                LogUtil.info(Name + "连接【" + dataFile + "】结果: " + result+","+sQLite.ErrInfo);
                LoadSuccess = loadsuccess;
            });
        }

        private void LedProcessTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                //DateTime time = DateTime.Now;
                if (runStatus <= RobotRunStatus.Wait)
                {
                    CloseLed();
                    return;
                }
                bool isNeedAlarmLed = false;
                bool isInOut = false;
                bool yellowMove = true;
                // {inputEquip,XrayBean,outputEquip};


                bool NeedAlarm = inputEquip.NeedAlarm || XrayBean.NeedAlarm || outputEquip.NeedAlarm;
                if (!NeedAlarm) {
                    if (outputEquip.WarnMsg.IndexOf("OS_") > 0) {
                        NeedAlarm = true;
                    }
                }
                isInOut = inputEquip.MoveInfo.MoveType == RobotMoveType.Working
                    || XrayBean.MoveInfo.MoveType == RobotMoveType.Working
                    || outputEquip.ShelfMoveInfo.MoveType == RobotMoveType.ShelfPro
                    || outputEquip.MoveInfo.MoveType == RobotMoveType.Working
                    || outputEquip.SecMoveInfo.MoveType == RobotMoveType.Labelling
                    ;
                if (!NeedAlarm)
                {
                    NeedAlarm = inputEquip.alarmType >= AlarmType.AxisAlarm
                    || XrayBean.alarmType >= AlarmType.AxisAlarm
                    || outputEquip.alarmType >= AlarmType.AxisAlarm
                    ;
                }
                //if (inputEquip.runStatus<3)
                //{
                //    yellowMove = true;
                ////}

                if (isNoAirCheck || isInSuddenDown || NeedAlarm)
                {
                    isNeedAlarmLed = true;
                }




                //黄灯
                if (yellowMove)
                {
                    //开机执行中时黄灯闪烁
                    if (DOValue(IO_Type.AutoRun_HddLed).Equals(IO_VALUE.HIGH))
                    {
                        IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
                    }
                    else
                    {
                        IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
                    }
                }
                else if (DOValue(IO_Type.AutoRun_HddLed).Equals(IO_VALUE.HIGH))
                {
                    IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
                }
                //忙碌中,判断是否有移栽在出入库执行,绿灯闪烁
                if (isInOut)
                {
                    if (DOValue(IO_Type.RunSign_HddLed).Equals(IO_VALUE.LOW))
                    {
                        IOMove(IO_Type.RunSign_HddLed, IO_VALUE.HIGH);
                    }
                    else
                    {
                        IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
                    }
                }
                else if (DOValue(IO_Type.RunSign_HddLed).Equals(IO_VALUE.LOW))
                {
                    //平常常亮绿灯
                    IOMove(IO_Type.RunSign_HddLed, IO_VALUE.HIGH);
                }

                //严重报警中 ,红灯闪烁
                if (isNeedAlarmLed)
                {
                    if (DOValue(IO_Type.Alarm_HddLed).Equals(IO_VALUE.LOW))
                    {
                        IOMove(IO_Type.Alarm_HddLed, IO_VALUE.HIGH);
                    }
                    else
                    {
                        IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
                    }
                }
                else if (DOValue(IO_Type.Alarm_HddLed).Equals(IO_VALUE.HIGH))
                {
                    IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
                }
                if (isNeedAlarmLed && RobotManager.UseBuzzer)
                {
                    CheckAndMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH);
                }
                else
                {
                    CheckAndMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW);
                }
                //Thread.Sleep(900);
            }
            catch (Exception ex)
            {
                LogUtil.error(Name + "灯处理定时器出错:", ex);
            }
        }
        protected void CloseLed()
        {
            CheckAndMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
            CheckAndMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
            CheckAndMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
            CheckAndMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW);
        }
        #endregion

        public string CanStart()
        {
            if (!canStart)
            {
                return "启动失败:设备未初始化完成";
            }
            return "";
        }
        #region 启动和复位

        public override bool StartRun()
        {
            string result = CanStart();
            if (String.IsNullOrEmpty(result).Equals(false))
            {
                SetWarnMsg(result);
                return false;
            }
            else if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
            {
                SetWarnMsg("启动失败:急停未开");
                return false;
            }
            else
            {
                SafeStop = false;

                mainTimer.Enabled = false;
                //lineStatus = LineStatus.ResetMove;
                runStatus = RobotRunStatus.HomeMoving;
                StartTime = DateTime.Now;
                LogUtil.info(Name + "开始启动,启动时间:" + StartTime.ToString() + "");

                Thread.Sleep(5);

                mainTimer.Interval = 1000;
                maxSeconds = 10;
                alarmType = AlarmType.None;
                mainTimer.Enabled = false;
                isInSuddenDown = false;
                isNoAirCheck = false;
                SetWarnMsg("");
                MoveInfo.NewMove(RobotMoveType.Reset);
                MoveInfo.NextMoveStep(StepEnum.Wait);

                foreach (EquipBase moveEquip in this.equipsMap.Values)
                {
                    if (runStatus.Equals(RobotRunStatus.Wait))
                    {
                        LogUtil.error(Name + "启动过程中发现 runStatus=Wait,中断启动");
                        return false;
                    }

                    EquipStartRun(moveEquip);
                }
                if (runStatus.Equals(RobotRunStatus.Wait))
                {
                    return false;
                }
                RFIDManager.Open(new string[] { });
                mainTimer.Enabled = true;
                return true;
            }
        }
        private void EquipStartRun(EquipBase moveEquip)
        {
            if (moveEquip.IsDebug)
            {
                LogUtil.info(moveEquip.Name + "调试状态,暂不启动");
            }
            else
            {
                bool result = moveEquip.StartRun();
                Thread.Sleep(60);
            }
        }


        public override bool Reset()
        {
            SafeStop = false;

            bool isNeedAllReset = false;
            if (isInSuddenDown || isNoAirCheck)
            {
                //TrayManager.LineNeedEmptyTrayNum = 0;
                isNeedAllReset = true;
                LogUtil.error(Name + "收到复位信号,急停中或没有气压报警中,强制所有设备复位~");
            }
            else if ((runStatus == RobotRunStatus.HomeMoving || runStatus == RobotRunStatus.Reset) && NoAlarm())
            {
                LogUtil.error(Name + "收到复位信号,已经在复位或原点返回中,且当前无报警,不处理复位"); 
                return false;
            }

            //停止运动
            MoveInfo.EndMove();

            runStatus = RobotRunStatus.Reset;

            //重置通用处理
            mainTimer.Interval = 1000;
           // maxSeconds = 10;
            alarmType = AlarmType.None;
            mainTimer.Enabled = false;
            isInSuddenDown = false;
            isNoAirCheck = false;
            SetWarnMsg("");
            MoveInfo.NewMove(RobotMoveType.Reset);
            MoveInfo.NextMoveStep(StepEnum.Wait);

            foreach (EquipBase equip in equipsMap.Values)
            {
                if (runStatus.Equals(RobotRunStatus.Wait))
                {
                    LogUtil.error(Name + "复位过程中发现 runStatus=Wait,中断启动");
                    return false;
                }
                EquipReset(equip, isNeedAllReset);
            }
            if (runStatus.Equals(RobotRunStatus.Wait))
            {
                return false;
            }
            mainTimer.Enabled = true;
            return true;
        }
        private void EquipReset(EquipBase equip, bool isNeedAllReset)
        {
            //调试状态不再重置
            if (!equip.IsDebug)
            {
                if (isNeedAllReset || (!equip.NoAlarm()))
                {
                    SafeStop = false;

                    LogUtil.info(Name + "收到复位信号," + equip.Name + " 需要复位");
                    equip.Reset();
                    Thread.Sleep(60);
                }
                else
                {
                    LogUtil.info(Name + "收到复位信号," + equip.Name + " 正常无报警,不需要复位");
                }
            }
        }


        protected override void ResetProcess()
        {
            if (MoveInfo.IsInWait)
            {
                CheckWait(MoveInfo);
            }
            if (!MoveInfo.IsInWait)
            {
                SafeStop = false;

                bool isOk = true;
                string msg = "";
                //判断是否所有的已经返回完成
                TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
                foreach (EquipBase moveEquip in this.equipsMap.Values)
                {
                    if (moveEquip.runStatus.Equals(RobotRunStatus.HomeMoving) || moveEquip.runStatus.Equals(RobotRunStatus.Reset) || moveEquip.runStatus.Equals(RobotRunStatus.Wait))
                    {
                        if (moveEquip.NoAlarm())
                        {
                            msg = moveEquip.Name + "复位结束";
                            isOk = false;
                            break;
                        }
                        else
                        {
                            //LogUtil.error(Name + " " + moveEquip.Name + "在复位过程中报警,需要重新复位,调用 moveEquip.Reset();");
                            //moveEquip.Reset();
                            ////如果小于80秒,继续等待
                            //if (span.TotalSeconds < 80)
                            //{
                            //    isOk = false;
                            //    break;
                            //}
                        }
                    }
                }

                if (isOk)
                {
                    runStatus = RobotRunStatus.Runing;
                    MoveInfo.EndMove();
                    mainTimer.Interval = 300;
                    maxSeconds = 3;
                    AgvClient.SetCancelState(AgvClient.CurrCancelState);
                    LogUtil.info(Name + "复位完成 [" + FormUtil.GetSpanStr(span) + "]");
                }
                else if (span.TotalSeconds > 120)
                {
                    WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
                    LogUtil.error(WarnMsg, MoveInfo.ErrorLogType);
                    Alarm(AlarmType.IoSingleTimeOut);
                }
            }
        } 
        #endregion

        private bool busyPro = false;
        private DateTime busyProTime = DateTime.Now;
        private int maxSeconds = 3;
        protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                TimeSpan span = DateTime.Now - busyProTime;
                if (busyPro && span.TotalSeconds < maxSeconds)
                {
                    return;
                }
                try
                {
                    busyPro = true;
                    busyProTime = DateTime.Now;
                    switch (runStatus)
                    {
                        case RobotRunStatus.HomeMoving:
                            ResetProcess();
                            break;
                        case RobotRunStatus.Reset:
                            ResetProcess();
                            break;
                        case RobotRunStatus.Runing:
                            if ((isInSuddenDown.Equals(false) && isNoAirCheck.Equals(false)))
                            {
                                //清理超时异常
                                IOTimeOutProcess();
                            }
                            break;
                        default: break;
                    }
                }
                catch (Exception ex)
                {
                    LogUtil.error(Name + "LineTimerPro 出错:", ex);
                }
                busyPro = false;
            }
            catch (Exception ex)
            {
                LogUtil.error(Name + "主定时器出错:" + ex.ToString());
            }
            Thread.Sleep(1);
        }
   

        #region 停止运动

        internal override void StopMove()
        {
            MoveInfo.EndMove();
            foreach (EquipBase equip in this.equipsMap.Values)
            {
                if (!equip.IsDebug)
                {
                    equip.StopRun();
                }
            }
        }
        public override void StopRun()
        {
            mainTimer.Enabled = false;
            StopMove();
            AgvClient.SetCancelState(false);
            RFIDManager.Close();
            runStatus = RobotRunStatus.Wait;
            TimeSpan span = DateTime.Now - StartTime;
            LogUtil.info(Name + ",停止运行,总运行时间:" + span.ToString());
        }

        #endregion

        #region IOTimeOutProcess     

        private DateTime preIoTimerOutTime = DateTime.Now;
        private void IOTimeOutProcess()
        {
            try
            {
                TimeSpan span = DateTime.Now - preIoTimerOutTime;
                if (span.TotalSeconds > 1 && alarmType.Equals(AlarmType.IoSingleTimeOut))
                {
                    preIoTimerOutTime = DateTime.Now;

                    if (runStatus < RobotRunStatus.Runing || isInSuddenDown || isNoAirCheck)
                    {
                        return;
                    }

                    //若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过
                    //     if (MoveInfo.IsInWait.Equals(false) && SW41_MoveInfo.IsInWait.Equals(false) && SW23_MoveInfo.IsInWait.Equals(false))
                    {
                        LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
                        alarmType = AlarmType.None;
                        SetWarnMsg("");
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtil.error("IOTimeOutProcess出错:", ex);
            }
        }
        #endregion

        #region    CheckWait  
        private DateTime preRWTime = DateTime.Now;
        private void CheckWait(RobotMoveInfo checkWaitInfo)
        {
            try
            {
                List<WaitResultInfo> list = checkWaitInfo.WaitList;
                if (list.Count <= 0)
                {
                    checkWaitInfo.EndStepWait();
                    return;
                }

                //当等待超过一分钟时,需要打印提示 
                TimeSpan span = DateTime.Now - checkWaitInfo.LastSetpTime;
                string NotOkMsg = "";
                bool isOk = true;
                if (checkWaitInfo.OneWaitCanEndStep)
                {
                    isOk = false;
                }
                foreach (WaitResultInfo wait in list)
                {
                    if (wait == null || wait.IsEnd)
                    {
                        continue;
                    }
                    NotOkMsg = " [" + wait.ToStr() + "] ";
                    if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
                    {
                        NotOkMsg = " [" + IOManager.GetDI(wait.IoType, DeviceID).DisplayStr + "=" + wait.IoValue + "] ";
                        wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);

                        if (!wait.IsEnd)
                        {
                            TimeSpan rwSpan = DateTime.Now - preRWTime;
                            //一分钟还未检测到
                            if (span.TotalSeconds > RobotManager.Config.IOSingle_TimerOut && NoAlarm())
                            {
                                ConfigIO io = baseConfig.getWaitIO(wait.IoType);
                                WarnMsg = Name + "[" + checkWaitInfo.MoveStep + "]等待" + NotOkMsg + " 超时";
                                Alarm(AlarmType.IoSingleTimeOut);
                                LogUtil.error(  WarnMsg, checkWaitInfo.ErrorLogType);
                            }
                            //超过报警时长
                            else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < RobotManager.Config.IOSingle_TimerOut * 2)
                            {
                                preRWTime = DateTime.Now;
                                string msg = checkWaitInfo.Name + "  " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:";
                                bool isLog = false;
                                foreach (WaitResultInfo ww in list)
                                {
                                    if (ww != null && ww.WaitType.Equals(2) && baseConfig.DOList.ContainsKey(ww.IoType))
                                    {
                                        if (IOManager.DOValue(ww.IoType, baseConfig.Id).Equals(ww.IoValue).Equals(false))
                                        {
                                            isLog = true;
                                            IOMove(ww.IoType, ww.IoValue);
                                            msg += ww.ToStr() + ",";
                                        }
                                    }
                                }
                                if (isLog)
                                {
                                    LogUtil.error(msg);
                                }
                            }
                            if (!checkWaitInfo.OneWaitCanEndStep)
                            {
                                isOk = false;
                                break;
                            }
                        }
                    }
                    else if (wait.WaitType.Equals(WaitEnum.W003_Time))
                    {
                        wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
                    }

                    if (wait.IsEnd)
                    {
                        if (checkWaitInfo.OneWaitCanEndStep)
                        {
                            isOk = true;
                            break;
                        }
                    }
                    else
                    {
                        if (!checkWaitInfo.OneWaitCanEndStep)
                        {
                            isOk = false;
                            break;
                        }
                    }
                }
                if (isOk)
                {
                    checkWaitInfo.EndStepWait();
                }
                else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds)
                {
                    WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
                    LogUtil.error(WarnMsg, checkWaitInfo.ErrorLogType);
                    Alarm(AlarmType.IoSingleTimeOut);
                }
            }
            catch (Exception ex)
            {
                LogUtil.error(checkWaitInfo.Name + " [" + checkWaitInfo.MoveStep + "] CheckWait 出错:", ex);
            }
        }
        #endregion

        #region 忙碌处理
        public override bool StartLabelling(WorkParam param)
        {
            return true;
        }
        protected override void LabellingProcess()
        {
        }
         
        public override bool StartWorking(WorkParam param)
        {
            return true;

        }
        protected override void WorkingProcess()
        {
        }


        private void InOutLog(string msg)
        {
            LogUtil.debug(Name + msg);
        }

        #endregion


        public DateTime LastAlarmTime = DateTime.Now;
        public override void Alarm(AlarmType alarmType)
        {
            if (alarmType.Equals(AlarmType.None).Equals(false))
            {
                LastAlarmTime = DateTime.Now;
            }
            if (this.alarmType.Equals(alarmType))
            {
                return;
            }
            if (alarmType.Equals(AlarmType.SuddenStop))
            {
                isInSuddenDown = true;
            }
            else if (alarmType.Equals(AlarmType.NoAirCheck))
            {
                isNoAirCheck = true;
            }
            this.alarmType = alarmType;
            if (alarmType.Equals(AlarmType.SuddenStop) || alarmType.Equals(AlarmType.NoAirCheck) || alarmType.Equals(AlarmType.AxisAlarm))
            {
                StopMove();
            }
        }


    }
}