WeldRobotBean_Partial.cs 27.0 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
using URSoldering.Common;
using URSoldering.LoadCSVLibrary;
using System;
using System.Collections.Generic; 
using System.Threading;

namespace URSoldering.DeviceLibrary
{
    partial class WeldRobotBean
    {
        public static bool  IsInWeld=false;
        public static bool LastAOIResult = true;
        //public delegate void GetCode();
        //public static event GetCode GetCodeFun;

        public delegate bool AOICheck( );
        public static event AOICheck AOICheckFun;

        public delegate List<PositionResult> PositionOffset();
        public static event PositionOffset PositionOffsetFun;
        public static string StartWeld( )
        {
            StopSleep();
            KeepTemp();
            if ((!alarmType.Equals(AlarmType.None)) && (!WarnMsg.Equals("")))
            {
                return "开始焊接失败:" + WarnMsg;
            }
            if (URRobotControl.IsRun == false)
            {
                return "机器人未连接,无法开始焊接";
            }
            if (!WeldMoveStep.moveType.Equals(MoveType.None))
            {
                return "忙碌中,无法开始焊接";
            }
            if (BoardManager.CurrBoard == null)
            {
                return "没有找到电路板信息,无法开始焊接";
            }

            //记录焊接板子数量
            WeldCount++;

            LogUtil.info(RobotName + "开始【" + BoardManager.CurrBoard.boardName + "】的焊接 ,WeldCount="+WeldCount);
            if (!WeldMoveStep.NewWeld(MoveType.Weld, BoardManager.CurrBoard))
            {
                return "没有找到需要焊接的焊点,启动焊接失败!";
            }
            LastAOIResult = true;
            IsInWeld = true ;
            return "";
        }
       
        private static void WeldProcess()
        {
            if (WeldMoveStep.IsInWait)
            {
                CheckWait();
            }
            if (WeldMoveStep.IsInWait)
            {
                return;
            }

            if (WeldMoveStep.moveStep.Equals(MoveStep.Wait))
            {
                NewPoint();
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W01_RobotToHighPoint))
            {
                WeldMoveStep.NextMoveStep(MoveStep.W02_RobotMoveToPoint);
                LogUtil.info("  " + WeldMoveStep.CurrPoint.TypeValue + "【" + WeldMoveStep.CurrPoint.pointName + "】预热" + WeldMoveStep.CurrPoint.preheatTemperature + "度,送丝下降,移动机械臂");
                MoveToPoint(WeldMoveStep.CurrPoint );
                WorkCountManager.AddWeldPint();
                WeldMoveStep.IsSlowSendWire = true;
                SlowSendWire();
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W02_RobotMoveToPoint))
            {
                if (WeldMoveStep.CurrPoint.pointType.Equals(0))
                {
                    if (WeldMoveStep.IsSlowSendWire)
                    {
                        //已经慢速送丝
                        WeldMoveStep.NextMoveStep(MoveStep.W04_SendWire);
                        SendWire();
                    }
                    else
                    {
                        if (WeldMoveStep.CurrPoint.startSendWireTime > 0 && WeldMoveStep.CurrPoint.startSendWireSpeed > 0)
                        {
                            WeldMoveStep.NextMoveStep(MoveStep.W03_SlowSendWire);
                            SlowSendWire();
                        }
                        else
                        {
                            WeldMoveStep.NextMoveStep(MoveStep.W04_SendWire);
                            SendWire();
                        }
                    }
                }
                else
                {
                    PointEndPross();
                }
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W03_SlowSendWire))
            {
                WeldMoveStep.NextMoveStep(MoveStep.W04_SendWire);
                SendWire();
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W04_SendWire))
            {
                if (WeldMoveStep.CurrPoint.weldTime > 0)
                {
                    WeldMoveStep.NextMoveStep(MoveStep.W05_WeldWait);
                    SetTemp(false, true);
                }
                else
                {
                    PointEndPross();
                }
            }

            else if (WeldMoveStep.moveStep.Equals(MoveStep.W05_WeldWait))
            {
                PointEndPross();
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W11_ToClear1))
            {
                WeldMoveStep.NextMoveStep(MoveStep.W12_ToClear2);
                MoveToClear2(RobotConfig.ClearMSenconds);
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W12_ToClear2))
            {
                KeepTemp();
                WeldMoveStep.NextMoveStep(MoveStep.W15_ClearEnd);
                MoveToOrg();
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W15_ClearEnd))
            {
                WeldEnd();
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W20_MoveToClear1))
            {
                WeldMoveStep.NextMoveStep(MoveStep.W21_MoveToClear2);
                //焊点清洗,根据焊点配置的时间来 
                MoveToClear2(WeldMoveStep.CurrPoint.ClearTime);
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W21_MoveToClear2))
            {
                WeldMoveStep.NextMoveStep(MoveStep.W22_MoveToOrg);
                MoveToOrg();
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W22_MoveToOrg))
            {
                if (WeldMoveStep.NextPoint())
                {
                    NewPoint();
                }
                else
                {
                    WeldEnd();
                }
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W13_GoOrg))
            {
                WeldLog("焊接结束,等待AOI检测");
                WeldMoveStep.NextMoveStep(MoveStep.W14_AOICheck);
                int AOIWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.AOIWaitSeconds);
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(AOIWaitSeconds));
            }
            else if (WeldMoveStep.moveStep.Equals(MoveStep.W14_AOICheck))
            {
                LastAOIResult= AOICheckFun.Invoke();
                Thread.Sleep(300);
                IsInWeld = false;
                if (WeldCount >= RobotConfig.ClearCount)
                {
                    WeldLog("已经连续焊" + WeldCount + "块板子,清洗烙铁");
                    WeldMoveStep.NextMoveStep(MoveStep.W11_ToClear1);
                    SendWireUpToClear1();
                }
                else
                {
                    WeldEnd();
                }
            } 
        }
        private static void NewPoint()
        {
            //运动到焊点,送丝下降,烙铁加温, 
            WeldMoveStep.NextMoveStep(MoveStep.W02_RobotMoveToPoint);
            if (WeldMoveStep.IsFirstPoint())
            {
                SetPreTemp(true, true);
            }
            else
            {
                SetPreTemp(true, false);
            }
            if (WeldMoveStep.CurrPoint.pointType.Equals(0))
            {
                if (ZUpLiftValue>0)
                {
                    //普通焊点先移动至高位
                    WeldMoveStep.NextMoveStep(MoveStep.W01_RobotToHighPoint);
                    LogUtil.info(" 新" + WeldMoveStep.CurrPoint.TypeValue + "【" + WeldMoveStep.CurrPoint.pointName + "】移动至焊点高处");
                    MoveToHighPoint(WeldMoveStep.CurrPoint);
                }
                else
                {
                    LogUtil.info(" 新" + WeldMoveStep.CurrPoint.TypeValue + "【" + WeldMoveStep.CurrPoint.pointName + "】预热" + WeldMoveStep.CurrPoint.preheatTemperature + "度,送丝下降,移动机械臂");
                    MoveToPoint(WeldMoveStep.CurrPoint); 
                    WeldMoveStep.IsSlowSendWire = true;
                    SlowSendWire();
                } 
                WorkCountManager.AddWeldPint();
            }
            else if (WeldMoveStep.CurrPoint.pointType.Equals(2))
            {
                LogUtil.info(" 新" + WeldMoveStep.CurrPoint.TypeValue + "【" + WeldMoveStep.CurrPoint.pointName + "】预热" + WeldMoveStep.CurrPoint.preheatTemperature + "度,送丝下降,移动机械臂");
                MoveToPoint(WeldMoveStep.CurrPoint );
                WorkCountManager.AddWeldPint();
                WeldMoveStep.IsSlowSendWire = true;
                SlowSendWire();

            }
            else
            {
                LogUtil.info(" 新" + WeldMoveStep.CurrPoint.TypeValue + "【" + WeldMoveStep.CurrPoint.pointName + "】 移动机械臂");
                MoveToPoint(WeldMoveStep.CurrPoint );
            }
        }
        private static void PointEndPross()
        {
            //判断是否需要清洗烙铁
            if (WeldMoveStep.CurrPoint.isNeedClear)
            {
                WeldMoveStep.NextMoveStep(MoveStep.W20_MoveToClear1); 
                SendWireUpToClear1();
            }
            else
            {
                if (WeldMoveStep.NextPoint())
                {
                    //WeldMoveStep.NextMoveStep(MoveStep.Wait);
                    //WeldLog("开始下一个焊点:" + WeldMoveStep.CurrPoint.pointName);
                    NewPoint();
                }
                else
                {
                    //AOICheckFun?.Invoke();

                    ////判断是否需要清洗
                    //if (WeldCount >= RobotConfig.ClearCount)
                    //{
                    //    WeldLog("已经连续焊" + WeldCount + "块板子,清洗烙铁");
                    //    WeldMoveStep.NextMoveStep(MoveStep.W11_ToClear1);
                    //    SendWireUpToClear1();
                    //}
                    //else
                    {
                        WeldMoveStep.NextMoveStep(MoveStep.W13_GoOrg);
                        MoveToOrg();
                        KeepTemp();
                    }
                }
            }
        }

        private static void WeldEnd()
        {
            IsInWeld = false;
            WeldLog("焊接结束");
            WeldMoveStep.EndMove(); 
        }

        private static void KeepTemp()
        {
            if (WeldMoveStep.currBoard != null && WeldMoveStep.currBoard.pointList.Count > 1)
            {
                int temp = WeldMoveStep.currBoard.pointList[0].preheatTemperature;
                SolderingManager.setTemp(temp + "");
                WeldLog("烙铁保持【" + temp + "】度");
            }
        }
        //设置预热焊接温度
        private static void SetPreTemp(bool isNeedCheck, bool IsWaitTime)
        {
            int temp = WeldMoveStep.CurrPoint.preheatTemperature;
            //等待温度到达,并达到指定时间 
            SolderingManager.setTemp(temp.ToString());
            int time = (int)(WeldMoveStep.CurrPoint.preheatTime * 1000);
            if (isNeedCheck)
            {
                //WeldLog("  设置焊接温度:" + temp + "°,等待达到温度");
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTemperature(temp, WeldMoveStep.CurrPoint.preheatTemperatureMax, WeldMoveStep.CurrPoint.preheatTemperatureMin));
            }
            if (IsWaitTime)
            {
                //WeldLog("焊接温度:" + temp + "°,焊接等待" + time);
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(time));
            }
        }
        //设置焊接温度
        private static void SetTemp(bool isNeedCheck, bool IsWaitTime)
        {
            int temp = WeldMoveStep.CurrPoint.weldTemperature;
            //等待温度到达,并达到指定时间 
            SolderingManager.setTemp(temp.ToString());
            int time = (int)(WeldMoveStep.CurrPoint.weldTime * 1000);
            if (isNeedCheck)
            {
                WeldLog(" 设置焊接温度:" + temp + "°,等待达到温度");
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTemperature(temp, WeldMoveStep.CurrPoint.weldTemperatureMax, WeldMoveStep.CurrPoint.weldTemperatureMin));
            }
            if (IsWaitTime)
            {
                WeldLog("焊接温度:" + temp + "°,焊接等待" + time);
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(time));
            }
        }
        private static void SlowSendWire()
        {
            SetTemp(false, false); 
            double time = WeldMoveStep.CurrPoint.startSendWireTime;
            if (time > 0)
            {
                double speed = WeldMoveStep.CurrPoint.startSendWireSpeed;
                WeldLog("  慢速送丝,速度:" + speed + " :" + time.ToString() + "秒");
                SendWireManager.SendWire( time, speed);
                int ms = (int)(time * 1000+100);
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitSendWire(ms,false));
            }
            else
            {
                WeldLog("  慢速送丝时间:" + time + " 不需要慢速送丝"); 
            }
        }
        private static void SendWire()
        {
            SetTemp(false, false); 
            double time = WeldMoveStep.CurrPoint.sendWireTime;
            double speed =WeldMoveStep.CurrPoint.sendWireSpeed ;
            WeldLog("  送丝,速度:" + speed + " :" + time.ToString() + "秒");
            if (time > 0)
            {
                SendWireManager.SendWire( time, speed);
                int ms = (int)(time * 1000+100);
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitSendWire(ms,false));
            }
        }
        public static void SolderingDown(bool isWait)
        { 
            if(RobotBean.KNDIOValue(IO_Type.Soldering_Down).Equals(IO_VALUE.HIGH)&&
                RobotBean.KNDIOValue(IO_Type.Soldering_Up).Equals(IO_VALUE.LOW))
            {
                return;
            }
            RobotBean.KNDIOMove(IO_Type.Soldering_Down, IO_VALUE.HIGH);
            RobotBean.KNDIOMove(IO_Type.Soldering_Up, IO_VALUE.LOW);
            if (isWait)
            {
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Soldering_Down, IO_VALUE.HIGH));
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Soldering_Up, IO_VALUE.LOW));
            }
        }
        public static void SolderingUp(bool isWait)
        {
            if (RobotBean.KNDIOValue(IO_Type.Soldering_Down).Equals(IO_VALUE.LOW) &&
                  RobotBean.KNDIOValue(IO_Type.Soldering_Up).Equals(IO_VALUE.HIGH))
            {
                return;
            }
            RobotBean.KNDIOMove(IO_Type.Soldering_Down, IO_VALUE.LOW);
            RobotBean.KNDIOMove(IO_Type.Soldering_Up, IO_VALUE.HIGH);
            if (isWait)
            {
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Soldering_Down, IO_VALUE.LOW));
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Soldering_Up, IO_VALUE.HIGH));
            }
        }

        public static void SendWireWork(bool isWait)
        {
            if (RobotBean.KNDIOValue(IO_Type.SendWire_Clear).Equals(IO_VALUE.LOW) &&
                  RobotBean.KNDIOValue(IO_Type.SendWire_Work).Equals(IO_VALUE.HIGH))
            {
                return;
            }
            RobotBean.KNDIOMove(IO_Type.SendWire_Clear, IO_VALUE.LOW);
            RobotBean.KNDIOMove(IO_Type.SendWire_Work, IO_VALUE.HIGH);
            if (isWait)
            {
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Clear, IO_VALUE.LOW));
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Work, IO_VALUE.HIGH));
            }
        }
        public static void SendWireClear(bool isWait)
        {
            if (RobotBean.KNDIOValue(IO_Type.SendWire_Work).Equals(IO_VALUE.LOW) &&
                    RobotBean.KNDIOValue(IO_Type.SendWire_Clear).Equals(IO_VALUE.HIGH))
            {
                return;
            }
            RobotBean.KNDIOMove(IO_Type.SendWire_Clear, IO_VALUE.HIGH);
            RobotBean.KNDIOMove(IO_Type.SendWire_Work, IO_VALUE.LOW);
            if (isWait)
            {
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Clear, IO_VALUE.HIGH));
                WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Work, IO_VALUE.LOW));
            }
        }
        private static DateTime preGetStatusTime = DateTime.Now;
        private static void CheckWait()
        {
            int ioSingleTimeOutSeconds = 10000;
            List<WaitResultInfo> list = new List<WaitResultInfo>(WeldMoveStep.WaitList);
            //当等待超过一分钟时,需要打印提示 
            TimeSpan span = DateTime.Now - WeldMoveStep.LastSetpTime;
            string NotOkMsg = "";
            if (list.Count > 0)
            {
                bool isOk = true;
                foreach (WaitResultInfo wait in list)
                {
                    if (wait.WaitType == 1)
                    {
                        if (!RobotBean.KNDIOValue(wait.IoType).Equals(wait.IoValue))
                        {
                            //一分钟还未检测到
                            if (span.TotalMilliseconds > ioSingleTimeOutSeconds)
                            {
                                ConfigIO io = RobotBean.getWaitIO(wait.IoType);
                                NotOkMsg = "信号(" + io.Explain + "=" + wait.IoValue + ")";
                                WarnMsg = RobotName + " 等待信号(" + io.Explain + "=" + wait.IoValue + ") 超时!";
                                Alarm(AlarmType.IoSingleTimeOut);
                                LogUtil.error(LOGGER, WarnMsg, 13);
                            }
                            isOk = false;
                            break;
                        }
                        else if (WeldMoveStep.OneWaitOk)
                        {
                            isOk = true;
                            break;
                        }
                    }
                    else if (wait.WaitType == 2)
                    {
                        if (span.TotalMilliseconds < wait.TimeMSeconds)
                        {
                            NotOkMsg = "时间[" + wait.TimeMSeconds + "]毫秒";
                            isOk = false;
                            break;
                        }
                        else if (WeldMoveStep.OneWaitOk)
                        {
                            isOk = true;
                            break;
                        }
                    }
                    else if (wait.WaitType == 3)
                    {
                        if (URRobotControl.MoveOK(wait.UrPoint, WeldMoveStep.LastSetpTime).Equals(false))
                        {
                            NotOkMsg = "机械臂移动到位"+wait.UrPoint.ToShowStr();
                            isOk = false;
                            break;
                        }
                        else if (WeldMoveStep.OneWaitOk)
                        {
                            isOk = true;
                            break;
                        }
                    }
                    else if (wait.WaitType == 4)
                    {
                        if (!wait.IsEnd)
                        {
                            if (HasSoldering)
                            {
                                int temp = SolderingManager.queryActualTemp();
                                if (wait.Temperature != temp && (temp < wait.TemperatureMin || temp > wait.TemperatureMax))
                                {
                                    NotOkMsg = "烙铁温度[" + wait.Temperature + "]";
                                    isOk = false;
                                    break;
                                }
                                else
                                {
                                    if (WeldMoveStep.OneWaitOk)
                                    {
                                        isOk = true;
                                        break;
                                    }
                                    else
                                    {
                                        wait.IsEnd = true;
                                    }
                                }
                            }
                            wait.IsEnd = true;
                        }
                    }
                    else if (wait.WaitType == 5)
                    {
                        bool isAlarm = false;
                        if (RobotManager.SolderingRobot.IsDebug.Equals(false))
                        {
                            if (WeldMoveStep.ResetCount < 3)
                            {
                                isAlarm = SendWireManager.IsAlarm();
                                preCheckSendWireTime = DateTime.Now;


                                if (isAlarm)
                                {
                                    SendWireManager.StopSend();
                                    WeldMoveStep.ResetCount++;
                                    SendWireManager.Reset();
                                    //反向送丝
                                    int speed = ConfigAppSettings.GetIntValue(Setting_Init.ReverseSendWireSpeed) ;
                                    double time = (double)ConfigAppSettings.GetNumValue(Setting_Init.ReverseSendWireTime);
                                    if (speed.Equals(0) || time <= 0)
                                    {
                                        isAlarm = false;
                                        LogUtil.error("焊接中第【" + WeldMoveStep.ResetCount + "】次 检测到送丝器报警, 速度【" + speed + "】时间【" + time + "】配置不完整,不反转处理");
                                    }
                                    else
                                    {
                                        LogUtil.error("焊接中第【" + WeldMoveStep.ResetCount + "】次 检测到送丝器报警, 开始反向送丝,速度【" + speed + "】时间【" + time + "】");
                                        WeldMoveStep.LastSetpTime = DateTime.Now;
                                        WeldMoveStep.WaitList.Clear();

                                        SendWireManager.SendWireBack(time, speed);
                                        int ms = (int)((time * 1000) + 100);
                                        WeldMoveStep.WaitList.Add(WaitResultInfo.WaitSendWire(ms, true));
                                        isOk = false;
                                    }
                                }
                            }
                        }

                        if (wait.ShuoKeISReverse.Equals(false) && isAlarm.Equals(false))
                        {
                            if (span.TotalMilliseconds < wait.TimeMSeconds)
                            {
                                NotOkMsg = "送丝时间[" + wait.TimeMSeconds + "]毫秒";
                                isOk = false;
                                break;
                            }
                            else if (WeldMoveStep.OneWaitOk)
                            {
                                isOk = true;
                                break;
                            }
                        }
                        else if (wait.ShuoKeISReverse.Equals(true) && isAlarm.Equals(false))
                        {
                            if (span.TotalMilliseconds < wait.TimeMSeconds)
                            {
                                NotOkMsg = "送丝时间[" + wait.TimeMSeconds + "]毫秒";
                                isOk = false;
                                break;
                            }
                            else
                            {
                                //反转已经停止,直接重新运行次步骤
                                //MoveStep step = (MoveStep)((int)WeldMoveStep.moveStep - 1);
                                LogUtil.info(RobotName + " 送丝反转结束,重新开始当前焊点焊接");
                                WeldMoveStep.NextMoveStep(MoveStep.Wait);
                            }
                        }
                    }
                    else if (wait.WaitType == 6)
                    {
                        if (!URRobotControl.IsRun)
                        {
                            NotOkMsg = "机器人连接";
                            isOk = false;
                            break;
                        }
                        else if (WeldMoveStep.OneWaitOk)
                        {
                            isOk = true;
                            break;
                        }
                    }
                }
                if (isOk)
                {
                    WeldMoveStep.EndStepWait();
                }
                if (WeldMoveStep.IsInWait)
                {
                    if (span.TotalMinutes > 1)
                    {
                        if (NotOkMsg.Equals(""))
                        {
                            WarnMsg = "等待超时[" + WeldMoveStep.moveType + "][" + WeldMoveStep.moveStep + "]已等待[" + Math.Round(span.TotalMinutes, 1) + "]分钟,";
                            foreach (WaitResultInfo wait in list)
                            {
                                WarnMsg = WarnMsg + "\r\n" + wait.ToStr();
                            }
                        }
                        else
                        {
                            WarnMsg = "等待超时[" + WeldMoveStep.moveType + "][" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalMinutes, 1) + "]分钟";
                       }
                        Alarm(AlarmType.StepTimeOut);
                        LogUtil.error(LOGGER, WarnMsg, 12);
                        //Alarm(StoreAlarmType.IoSingleTimeOut);
                    }
                    else if (span.TotalSeconds > 5  && WeldMoveStep.moveType.Equals(MoveType.Weld))
                    {
                        LogUtil.info("焊接[" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒");
                    }
                }
            }
            else
            {
                WeldMoveStep.EndStepWait();
            }
        }

        private static void WeldLog(string str)
        {
            if (WeldMoveStep.moveType.Equals(MoveType.Weld))
            {
                if (WeldMoveStep.CurrPoint != null)
                {
                    LogUtil.info( "焊点【" + WeldMoveStep.CurrPoint.pointName + "】" + str);

                }
                else
                {
                    LogUtil.info(RobotName + " 工作中 " + str);
                }
            }
            else if (WeldMoveStep.moveType.Equals(MoveType.GoHome))
            {
                LogUtil.info( " 重置 " + str);
            }
        } 
         
    }
}