ProvidingEquip_Partial.cs 53.5 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 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace OnlineStore.DeviceLibrary
{
    partial class ProvidingEquip
    {
        public event TrayProcessEnd TrayPEndEvent;
        #region 托盘检测

        protected override bool CheckWaitResult(LineMoveInfo moveInfo, WaitResultInfo wait)
        {
            if (wait.WaitType.Equals(WaitEnum.W201_ProvidingCanOut))
            {
                if (MoveInfo.MoveType.Equals(LineMoveType.None))
                {
                    return true;
                }
            }
            else if (wait.WaitType.Equals(WaitEnum.W202_DLineCanOut))
            {
                bool result = LineManager.Line.DLineStartOut(Config.DLineEquipNum, Config.DLineLineNum);
                wait.IsEnd = result;
            }
            return false;
        }
        internal DateTime lastStopDown = DateTime.Now;
        private Stopwatch trayCheckWait = new Stopwatch();
        private Stopwatch trayCheck2LowWait = new Stopwatch();
        private object lockObj = "";
        private void StartCheckFixture()
        {
            if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
            {
                try
                {
                    if (SecondMoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
                    {
                        LogUtil.error(Name + "  StartCheckFixture " + " 不在空闲中,直接返回 ");
                        return;
                    }
                    //int num = TrayManager.GetTrayNum(DeviceID); 
                    if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH))
                    {
                        bool canProcess = (LineManager.Line.SwNoProcess(Config.SidesWayNum));
                        trayCheck2LowWait.Stop();
                        if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && canProcess)
                        {
                            trayCheckWait.Stop();
                            SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
                            SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down);
                            LogUtil.info(Name + " [" + trayCount + "]  托盘阻挡" + SecondMoveInfo.SLog + "阻挡气缸1-1上升)");
                            IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
                            SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
                        }
                    }
                    else
                    {
                        bool check2Ok = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
                        if (IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.HIGH))
                        {
                            bool canProcess = (LineManager.Line.SwNoProcess(Config.SidesWayNum));
                            ProcessReelCheck();
                            if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && (DateTime.Now - lastStopDown).TotalSeconds > 3 && check2Ok && canProcess)
                            {
                                trayCheckWait.Stop();
                                trayCheck2LowWait.Stop();
                                lastStopDown = DateTime.Now;
                                //托盘在第一个阻挡处
                                SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
                                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_Stop1Down);
                                LogUtil.debug(Name + "  [" + trayCount + "] 托盘检测:" + SecondMoveInfo.SLog + "阻挡气缸1-1下降 ,等待 StopCylinder_Check1=0,清理托盘RFID");
                                ClearTrayRFID();

                                IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH, 1200);
                                SecondMoveInfo.OneWaitCanEndStep = true;
                                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW));
                                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
                                //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
                            }
                        }
                        else
                        {
                            trayCheckWait.Stop();
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogUtil.error(Name + "  StartCheckFixture " + " 出错:" + ex.ToString());
                }
                finally
                {
                    Monitor.Exit(lockObj);
                }
            }
            else
            {
                LogUtil.error(Name + "  StartCheckFixture " + "失败,未得到锁");
            }
        }
        public int ReadReelCheckId()
        {
            if (string.IsNullOrEmpty(Config.CameraName_1_RFID)) return 0;
            try
            {
                RFIDData data = RFIDManager.ReadRFID(Config.CameraName_1_RFID, true);
                if (data != null)
                {
                    if (data.RFType.Equals('E'))
                    {
                        return data.Num;
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtil.error("ReadReelCheckId", ex);
            }
            return 0;
        }
        public string GetCurReelInfo(string cameName)
        {
            try
            {
                (bool result, string barcode) = CodeManager.ReelCheckCameraScan(new List<string> { cameName }, Name);
                if (result)
                {
                    (int resultCode, taskInfo task) = SServerManager.getTaskInfo(barcode);
                    return $"【{result}】【{barcode}】【{resultCode}】【{JsonHelper.SerializeObject(task)}】";

                }
                else
                {
                    return $"相机扫码失败:【{result}】【{barcode}】";
                }
            }
            catch (Exception ex)
            {
                LogUtil.error("GetCurReelInfo", ex);
            }
            return "";
        }
        private void ProcessReelCheck()
        {
            try
            {
                if (!TrayDisableManager.UseNewLogic) return;
                if (Config.SidesWayNum.Equals(4) && !string.IsNullOrEmpty(Config.CameraName_1) && !string.IsNullOrEmpty(Config.CameraName_1_RFID))
                {
                    RFIDData data = RFIDManager.ReadRFID(Config.CameraName_1_RFID, true);
                    int trayNum = -1;
                    if (data != null)
                    {
                        if (data.RFType.Equals('E'))
                        {
                            trayNum = data.Num;
                            LogUtil.info("RFID [ " + Config.CameraName_1_RFID + " ] 读到数据 " + data.NumStr());
                            //获取托盘信息
                            TrayInfo tray = TrayManager.GetTrayInfo(trayNum);
                            if (tray.InoutPar.ManualJudgeNG||tray.InoutPar.Corrected)
                            {
                                //扫码
                                (bool result, string barcode) = CodeManager.ReelCheckCameraScan(new List<string> { Config.CameraName_1 }, Name);

                                //没扫到条码,检测到没料 ,保存图片, 清空 


                                if (tray.IsFull)//初次检测有料盘
                                {
                                    if (result)//有料盘
                                    {
                                        (int resCode, taskInfo task) = SServerManager.getTaskInfo(barcode);
                                       
                                        if(resCode==-1)
                                        {
                                            TrayDisableManager.AddDisableTray(trayNum,Name, "【屏蔽料盘二次判断】【-1】");
                                            LogUtil.info($"【屏蔽料盘二次判断】【-1】【需要禁用该托盘】【{tray.ToStr()}】");
                                        }
                                        else if (resCode==100)
                                        {
                                            tray.InoutPar.InStoreNg = true;
                                            tray.InoutPar.PlateH = task.plateH;
                                            tray.InoutPar.PlateW = task.plateW; 
                                            TrayManager.UpdateTrayInfo(trayNum, true, tray.InOrOutStore, tray.InoutPar);
                                             tray.InoutPar.Corrected = true;
                                            LogUtil.info($"【屏蔽料盘二次判断】【100】【有尺寸信息,认为NG】【{tray.ToStr()}】");
                                        }
                                      else   if (resCode == 0)
                                        {
                                            //if (task != null)
                                            {
                                                tray.InoutPar.WareCode = task.barcode;
                                                tray.InOrOutStore = task.isPutInTask ? 1 : 2;
                                                tray.InoutPar.PosId = task.posId;
                                                tray.InoutPar.PlateH = task.plateH;
                                                tray.InoutPar.PlateW = task.plateW;
                                                tray.InoutPar.cutReel = task.cutReel;
                                                tray.InoutPar.smallReel = task.smallReel;
                                                tray.InoutPar.urgentReel = task.urgentReel;
                                                tray.InoutPar.rfid = task.rfid;
                                                tray.InoutPar.rfidLoc = task.rfidLoc;
                                                tray.InoutPar.ManualJudgeNG = false;
                                                tray.InoutPar.InStoreNg = false;
                                                TrayManager.UpdateTrayInfo(trayNum, true, tray.InOrOutStore, tray.InoutPar);
                                                if (tray.InOrOutStore == 1)
                                                {
                                                    SServerManager.SendPosToStoreCheck(Name, tray.InoutPar);
                                                }
                                                tray.InoutPar.Corrected = true;
                                                LogUtil.info($"【屏蔽料盘二次判断】【初次有料,第二次有料,认为有料】【{tray.ToStr()}】");
                                            }
                                        }


                                    }
                                    else//二次检测无料盘
                                    {
                                        if (tray.IsFull && tray.InOrOutStore.Equals(1))
                                        {
                                            TrayManager.ClearInstore(tray, "【屏蔽料盘二次判断】【初次有料,第二次无料】【清空托盘】[" + trayNum + "]");
                                        }
                                        TrayManager.UpdateTrayInfo(trayNum);
                                        tray.InoutPar.Corrected = true;
                                        LogUtil.info($"【屏蔽料盘二次判断】【初次有料,第二次无料】【清空托盘】【{tray.ToStr()}】");
                                    }
                                }
                                else////初次检测无料盘
                                {
                                    if (result)//有料盘
                                    {
                                        (int resCode, taskInfo task) = SServerManager.getTaskInfo(barcode);
                                        if (resCode == -1)
                                        {
                                            TrayDisableManager.AddDisableTray(trayNum,Name, "【屏蔽料盘二次判断】【-1】【初次无料,第二次有料】");
                                            LogUtil.info($"【屏蔽料盘二次判断】【-1】【初次无料,第二次有料】 【禁用该托盘】【{tray.ToStr()}】");
                                        }
                                        else if (resCode == 100)
                                        {
                                            tray.InoutPar.InStoreNg = true;
                                            tray.InoutPar.PlateH = task.plateH;
                                            tray.InoutPar.PlateW = task.plateW; 
                                            TrayManager.UpdateTrayInfo(trayNum, true, tray.InOrOutStore, tray.InoutPar);
                                            tray.InoutPar.Corrected = true;
                                            LogUtil.info($"【屏蔽料盘二次判断】【100】【有尺寸信息,认为NG】【{tray.ToStr()}】");
                                        }
                                        else if (resCode == 0)
                                        {
                                            // if (task != null)
                                            {
                                                tray.InoutPar.WareCode = task.barcode;
                                                tray.InOrOutStore = task.isPutInTask ? 1 : 2;
                                                tray.InoutPar.PosId = task.posId;
                                                tray.InoutPar.PlateH = task.plateH;
                                                tray.InoutPar.PlateW = task.plateW;
                                                tray.InoutPar.cutReel = task.cutReel;
                                                tray.InoutPar.urgentReel = task.urgentReel;
                                                tray.InoutPar.smallReel = task.smallReel;
                                                tray.InoutPar.rfid = task.rfid;
                                                tray.InoutPar.rfidLoc = task.rfidLoc;
                                                tray.InoutPar.ManualJudgeNG = false;
                                                TrayManager.UpdateTrayInfo(trayNum, true, tray.InOrOutStore, tray.InoutPar);
                                                tray.InoutPar.Corrected = true;
                                                LogUtil.info($"【屏蔽料盘二次判断】【初次无料,第二次有料】【纠正为有料】【{tray.ToStr()}】");
                                            }
                                        }
                                    }
                                    else//二次检测无料盘
                                    {
                                        if (tray.IsFull && tray.InOrOutStore.Equals(1))
                                        {
                                            TrayManager.ClearInstore(tray, "【屏蔽料盘二次判断】【初次无料,第二次无料】【清空托盘】[" + trayNum + "]");
                                        }
                                        TrayManager.UpdateTrayInfo(trayNum);
                                        tray.InoutPar.Corrected = true;
                                        LogUtil.info($"【屏蔽料盘二次判断】【初次无料,第二次无料】【清空托盘】【{tray.ToStr()}】");
                                    }
                                }
                            }


                        }
                        else
                        {
                            trayNum = 0;
                            LogUtil.debug("RFID [ " + Config.CameraName_1_RFID + " ] 读到数据 " + data.NumStr() + " 返回盘号  0");
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                LogUtil.error($"屏蔽料盘二次处理", ex);
            }
        }
        private void MO_14_TopCylinder_Down()
        {
            // SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
            OutLog("放托盘(放开阻挡)" + MoveInfo.SLog + " 物品已移走,顶升气缸1下降");
            SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown);
            if (Config.SidesWayNum <= 0)
            {
                if (!CylinderIsOk(IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down))
                {
                    CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
                }
                else
                {
                    MO_16_Stop2Down(); 
                    //SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Stop2Down);
                    //CheckLog("托盘放行  " + SecondMoveInfo.SLog + " ,阻挡2下降");
                    //IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
                    //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
                }
            }
            else
            {
                SecondMoveInfo.EndMove();
                CheckLog("托盘放行  结束,触发 TrayPEndEvent ");
                lastStopDown = DateTime.Now.AddSeconds(-1);
                this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
            }
        }
        private InOutParam CheckIsNeedOutStore(out string outMsg)
        {
            outMsg = "";
            int lineNum = DeviceID % 100;
            if (TrayDisableManager.DisableTray(currTrayNum))
            {
                return null;
            }
            TrayInfo trayInfo = TrayManager.GetTrayInfo(currTrayNum);
            if (!trayInfo.IsFull)
            {
                return null;
            }
            TimeSpan span = DateTime.Now - trayInfo.LastUpdateTime;
            int youxianS = 180;
            InOutParam inoup = trayInfo.InoutPar;
            if (trayInfo.IsFull && trayInfo.InoutPar.InStoreNg && this.Config.SidesWayNum.Equals(4))
            {
                outMsg = "入料NG料";

                //如果分配了库位,需要调用取消
                if (trayInfo.InoutPar.WareCode != "" && trayInfo.InoutPar.PosId != "")
                {
                    SServerManager.cancelPutInTask(Name, trayInfo.InoutPar.WareCode, false);
                }
                //入料失败料
                return inoup;
            }
            else if (trayInfo.InOrOutStore.Equals(ReelType.OutStore) && inoup.urgentReel && this.Config.SidesWayNum.Equals(4))
            {
                outMsg = "出库紧急料";
                return inoup;
            }
            else if (trayInfo.InOrOutStore.Equals(ReelType.OutStore) && inoup.urgentReel.Equals(false) && inoup.cutReel.Equals(false))
            {
                bool needToBielt = SServerManager.canReelToBelt(Name, inoup.WareCode);
                if (!needToBielt)
                {
                    LogUtil.info(Name + $"工单料:{inoup.WareCode} canReelToBelt={needToBielt} ,暂不移到皮带线");
                    return null;
                }

                List<int> mustLine = new List<int>();
                List<int> firstLine = new List<int>();
                //urgentReel: true 表示紧急料,需要出到料串上
                //cutReel: true 表示分盘料,需要出到料串上
                //smallReel: true  小料(7x8),放置到小料架上
                //rfid: 分配的料架RFID
                //rfidLoc:
                //是否是小盘
                if (inoup.rfidLoc <= 0)
                {
                    //-1时随意放
                }
                else if (inoup.smallReel)
                {
                    if (inoup.rfidLoc >= 70 && inoup.rfidLoc <= 72)
                    {
                        // 70,71,72时只能分配到3 / 4号皮带线; 
                        mustLine = new List<int> { 3, 4 };
                    }
                    else if (inoup.rfidLoc <= 46)
                    {
                        // 小料时,架位为1 - 46优先走1 / 2号皮带线
                        firstLine = new List<int> { 1, 2 };
                    }
                    else if (inoup.rfidLoc >= 47)
                    {
                        // ,47 - 92优先走3 / 4号皮带线,
                        firstLine = new List<int> { 3, 4 };
                    }
                }
                else
                {
                    //大料12号只能走1号2后皮带线
                    // 料架的架位大料时,架位1 - 6,12号优先走1 / 2号皮带线, 
                    //7 - 11优先走3 / 4号皮带线
                    if (inoup.rfidLoc.Equals(12))
                    {
                        // 大料12号只能走1号2后皮带线
                        mustLine = new List<int> { 1, 2 };
                    }
                    else if (inoup.rfidLoc <= 6)
                    {
                        firstLine = new List<int> { 1, 2 };
                    }
                    else if (inoup.rfidLoc >= 7)
                    {
                        firstLine = new List<int> { 3, 4 };
                    }
                }
                bool kongxian = MoveInfo.MoveType.Equals(LineMoveType.None) || MoveInfo.MoveStep >= LineMoveStep.PO_09_CylinderRelax;
                if (mustLine.Count > 0)
                {
                    if (mustLine.Contains(lineNum))
                    {
                        outMsg = "必须线";
                        return inoup;
                    }
                }
                else if (firstLine.Count > 0)
                {
                    if (firstLine.Contains(lineNum) && kongxian)
                    {
                        outMsg = "优先线且空闲";
                        return inoup;
                    }
                    else if (lineNum.Equals(4) && kongxian)
                    {
                        outMsg = "出料4空闲";
                        return inoup;
                    }
                    else if (LineManager.Line.ProvidingCanUse(firstLine).Equals(false) && kongxian && LineNotBusy())
                    {
                        outMsg = "优先线不可用";
                        //优先线不可用
                        return inoup;
                    }
                    else if (span.TotalSeconds > youxianS && kongxian && LineNotBusy())
                    {
                        outMsg = "超过180秒";
                        //超过指定的时间
                        return inoup;
                    }
                    else if (span.TotalSeconds > youxianS * 3 && kongxian)
                    {
                        outMsg = "超过9分钟";
                        //超过指定的时间
                        return inoup;
                    }
                }
                else
                {
                    //空闲且皮带线出料已结束 
                    if (kongxian)
                    {
                        if (lineNum.Equals(1) || lineNum.Equals(2))
                        {
                            if (LastValue <= 2)
                            {
                                outMsg = "随意放" + LastValue;
                                LastValue++;
                                return inoup;
                            }
                            else
                            {
                                LastValue = 0;
                            }
                        }
                        else
                        {
                            outMsg = "随意放";
                            return inoup;
                        }
                    }
                }
            }

            //TODO 判断是否是需要移栽出料的料盘
            return null;
        }
        private int LastValue = 0;
        protected override void CheckFixtureProcess()
        {
            if (!LineManager.Line.LineCanRun())
            {
                return;
            }
            if (SecondMoveInfo.IsInWait)
            {
                CheckWait(SecondMoveInfo);
            }
            if (SecondMoveInfo.IsInWait)
            {
                return;
            }

            #region 托盘检测
            if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_00_Stop1Down))
            {
                //if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.LOW))
                //{
                TimeSpan span = DateTime.Now - SecondMoveInfo.LastSetpTime;
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_04_Wait);
                LogUtil.debug(Name + "托盘阻挡" + SecondMoveInfo.SLog + "  阻挡气缸上升,下降耗时(" + FormUtil.GetSpanStr(span) + "),等待 阻挡2托盘检测=1),最多等待30秒");
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
                SecondMoveInfo.OneWaitCanEndStep = true;
                //}
                //else
                //{
                //    CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " ,等待StopCylinder_Check=HIGH 或 StopCylinder_Check1=LOW失败,结束处理");
                //    SecondMoveInfo.EndMove();
                //}
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_03_Stop2Down))
            {
                CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " ,等待编码信号稳定StopCylinder_Check2=1,最多等待30秒");
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_04_Wait);
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
                //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
                //SecondMoveInfo.OneWaitCanEndStep = true;
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_04_Wait))
            {
                //if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.LOW))
                //{
                //    CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " ,等待 StopCylinder_Check=HIGH 失败,结束处理");
                //    SecondMoveInfo.EndMove();
                //    return;
                //}
                UpdateTrayNum();
                if (Config.SidesWayNum.Equals(4))
                {
                    CylinderMove(null, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
                }
                if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
                {
                    if (TrayManager.ErrorDeviceId.Equals(DeviceID))
                    {
                        TrayManager.UpdateTrayNumError(-1, "");
                    }
                    //出料中,需要拦盘 
                    string outMsg = "";
                    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
                    InOutParam param = CheckIsNeedOutStore(out outMsg);
                    TrayInfo tray = TrayManager.GetTrayInfo(currTrayNum);

                    bool jNg = tray.InoutPar?.ManualJudgeNG ?? false;
                    bool corr = tray.InoutPar?.Corrected ?? false;
                    if (jNg && (!corr))
                    {
                        LogInfo(SecondMoveInfo.MoveNum + "*************** 托盘【" + currTrayNum + "】被为标记判定NG,放盘通过,["+jNg+"]["+corr+"]");
                        MO_14_TopDown(); 
                    }
                    else if (param != null)
                    {
                        SecondMoveInfo.MoveParam = param;
                        SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_05_WaitTime);
                        LogUtil.info(Name + "托盘 【" + currTrayNum + "】【" + outMsg + "】需要出料" + SecondMoveInfo.SLog + ":" + param.ToStr() + " 等待可以开始移栽 ");
                        SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
                        SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitProvidingEquipCanOut());
                        //等待
                        CylinderMove(null, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
                        if (Config.SidesWayNum.Equals(4) && LineManager.Line.SwCanUpMove(1))
                        {
                            CheckLog("托盘阻挡 " + SecondMoveInfo.SLog + " 顶升气缸上升,同时横移1处的顶升也可以上升 ");
                            LineManager.Line.CylinderMove(null, IO_Type.SW1_TopCylinder_Down, IO_Type.SW1_TopCylinder_Up);
                        }
                        else
                        {
                            CheckLog("托盘阻挡 " + SecondMoveInfo.SLog + " 顶升气缸上升 ");
                        }

                        return;
                    }
                    else
                    {

                        if (this.Config.SidesWayNum.Equals(4) && TrayDisableManager.ProcessTray && TrayDisableManager.DisableTray(currTrayNum))
                        {
                            SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_10_WaitProDisableTray);
                            LogInfo(Name + "拦截禁用托盘【" + currTrayNum + "】,等待托盘启用后再放行");
                        }

                        else
                        {
                            MO_14_TopDown();
                        }
                    }
                }
                else
                {
                    string msg = Name + " 托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前托盘号 【" + currTrayNum + "】最大盘号【" + TrayManager.MaxTrayNum + "】";
                    TrayManager.UpdateTrayNumError(DeviceID, msg);
                    LogUtil.error(msg);
                    return;
                }
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_05_WaitTime) && MoveInfo.MoveType.Equals(LineMoveType.None))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_09_WaitLetFixtureGo);
                CheckLog("托盘放行 " + SecondMoveInfo.SLog + "开始新的出料任务~" + SecondMoveInfo.MoveParam.ToStr() + ",开始移栽");
                bool result = StartOutStoreMove(SecondMoveInfo.MoveParam);
                CylinderMove(null, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
                if (Config.SidesWayNum.Equals(4) && LineManager.Line.SwCanUpMove(1))
                {
                    CheckLog("托盘阻挡 " + SecondMoveInfo.SLog + " 顶升气缸上升,同时横移1处的顶升也可以上升 ");
                    LineManager.Line.CylinderMove(null, IO_Type.SW1_TopCylinder_Down, IO_Type.SW1_TopCylinder_Up);
                }
                else
                {
                    CheckLog("托盘阻挡 " + SecondMoveInfo.SLog + " 顶升气缸上升 ");
                }
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_06_TopUp))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MO_11_CodeRember);
                LogInfo(SecondMoveInfo.MoveNum + "  托盘号【" + currTrayNum + "】等待移栽料盘");
                SecondMoveInfo.EndStepWait();
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_11_CodeRember) && MoveInfo.MoveType.Equals(LineMoveType.None))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_09_WaitLetFixtureGo);
                CheckLog("托盘放行 " + SecondMoveInfo.SLog + "开始新的出料任务~" + SecondMoveInfo.MoveParam.ToStr() + ",开始移栽");
                bool result = StartOutStoreMove(SecondMoveInfo.MoveParam);
            }
            #endregion

            #region 不需要出出料,直接放行
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_10_WaitProDisableTray))
            {
                bool isOk = (!TrayDisableManager.ProcessTray) || (!TrayDisableManager.DisableTray(currTrayNum));
                if (isOk)
                {
                    ClearTimeoutAlarm(TrayDisableManager.ProWarnMsg);
                    MO_14_TopDown();
                }
                else if (SecondMoveInfo.IsTimeOut(30))
                {
                    MoveTimeoutAlarm(SecondMoveInfo, "等待处理并启用托盘超时");
                    //WarnMsg = Name + TrayDisableManager.ProWarnMsg+ "[" + currTrayNum + "], 请处理并启用托盘,已超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
                    //LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
                }
                else
                {
                    WarnMsg = Name + TrayDisableManager.ProWarnMsg + "[" + currTrayNum + "], 请处理并启用托盘";
                }
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_TopDown))
            {
                if (Config.SidesWayNum > 0)
                {
                    SecondMoveInfo.EndMove();
                    CheckLog("托盘放行  结束,触发 TrayPEndEvent ");
                    //   lastStopDown = DateTime.Now.AddSeconds(-1);
                    this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
                }
                else
                {
                    //    lastStopDown = DateTime.Now.AddSeconds(1);
                    //SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
                    //CheckLog("托盘放行  " + SecondMoveInfo.SLog + " ,等待 NextStopCheck=0");
                    //        SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.NextStopCheck, IO_VALUE.LOW));
                    MO_16_Stop2Down();
                    //SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Stop2Down);
                    //CheckLog("托盘放行  " + SecondMoveInfo.SLog + " ,阻挡2下降");
                    //IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
                    //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
                }

            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_WaitCanGo))
            {
                if (DeviceID.Equals(203)){

                    MoveEquip moveEquip = LineManager.Line.GetMoveByDId(17);
                    if (moveEquip.IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.LOW))
                    {
                        MO_16_Stop2Down();
                    }
                    else if (SecondMoveInfo.IsTimeOut(60))
                    {
                        MoveTimeoutAlarm(MoveInfo, "等待进仓17前阻挡信号X51=LOW超时");
                    }
                }
                else
                {
                    MO_16_Stop2Down();
                }
                //SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Stop2Down);
                //CheckLog("托盘放行  " + SecondMoveInfo.SLog + " ,阻挡2下降");
                //IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
                //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_Stop2Down))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_Stop2Check);
                CheckLog("托盘放行  " + SecondMoveInfo.SLog + " , 阻挡2托盘检测=0");
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.LOW));
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_Stop2Check))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MO_18_WaitTime);
                CheckLog("托盘放行  " + SecondMoveInfo.SLog + " , 等待200ms后阻挡2上升");
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.LOW));
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_18_WaitTime))
            {
                trayCheck2LowWait.Restart();
                SecondMoveInfo.NextMoveStep(LineMoveStep.MO_19_StopCylinder_Back);
                CheckLog("托盘放行  " + SecondMoveInfo.SLog + " , 阻挡气缸2上升 ");
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
                IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.LOW));
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_19_StopCylinder_Back))
            {
                CheckLog("托盘放行  结束,触发 TrayPEndEvent ");
                SecondMoveInfo.EndMove();
                //lastStopDown = DateTime.Now.AddSeconds(-1);
                this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
            }
            #endregion
        }

        private void MO_16_Stop2Down()
        {
            if (DeviceID.Equals(203)) {

                MoveEquip move17 = LineManager.Line.GetMoveByDId(17);
                if (move17.IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.HIGH))
                {
                    SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
                    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
                    LogUtil.info(Name + "托盘放行  " + SecondMoveInfo.SLog + " ,当前出料3,进仓17前阻挡有料,暂不放行托盘");
                    return;
                }
            }

            SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Stop2Down);
            CheckLog("托盘放行  " + SecondMoveInfo.SLog + " ,阻挡2下降");
            IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
            SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
        }

        private void MO_14_TopDown()
        {
            SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown);
            CheckLog("放托盘(放开阻挡)" + MoveInfo.SLog + " 托盘 【" + currTrayNum + "】直接放行,判断顶升需要下降或上升");
            if (Config.SidesWayNum <= 0)
            {
                CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
            }
            else if (Config.SidesWayNum.Equals(4))
            {
                CylinderMove(null, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
                if (LineManager.Line.SwCanUpMove(1))
                {
                    LineManager.Line.CylinderMove(null, IO_Type.SW1_TopCylinder_Down, IO_Type.SW1_TopCylinder_Up);
                }
                SecondMoveInfo.EndMove();
                CheckLog("托盘放行  结束,触发 TrayPEndEvent ");
                lastStopDown = DateTime.Now.AddSeconds(-1);
                this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
            }
        }
        #endregion

        #region 料盘移栽处理
        public override bool StartOutStoreMove(InOutParam param)
        {
            string posId = param != null ? param.PosId : "";
            if (runStatus.Equals(LineRunStatus.Runing))
            {
                runStatus = LineRunStatus.Busy;
                lineStatus = LineStatus.OutStoreExecute;
                MoveInfo.MoveParam = param;
                MoveInfo.NewMove(LineMoveType.OutStore);
                if (CylinderIsOk(IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After))
                {
                    PO_01_CylinderDown();
                }
                else
                {
                    LogInfo("开始出料【" + posId + "】处理(移栽):PO_00_CylinderAfter, 前后气缸后退,等待夹爪无料");
                    MoveInfo.NextMoveStep(LineMoveStep.PO_00_CylinderAfter);
                    MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
                    CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
                    //MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Slack, IO_VALUE.LOW));
                }
                return true;
            }
            else
            {
                LogUtil.error(Name + " 启动出料【" + posId + "】 失败,当前 storeStatus=" + runStatus);
                return false;
            }
        }
        private void PO_01_CylinderDown()
        {
            MoveInfo.NextMoveStep(LineMoveStep.PO_01_CylinderDown);
            OutLog(" " + MoveInfo.SLog + " : 上下气缸下降");
            MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
            UpdownDownP2Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);

            CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
            if (Config.SidesWayNum.Equals(4) && LineManager.Line.SwCanUpMove(1))
            {
                OutLog(" 顶升气缸上升,同时横移1处的顶升也可以上升 ");
                LineManager.Line.CylinderMove(null, IO_Type.SW1_TopCylinder_Down, IO_Type.SW1_TopCylinder_Up);
            }
            else
            {
                OutLog("  顶升气缸上升 ");
            }
        }
        private void PO_03_CylinderOpen()
        {
            string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
            if (CylinderIsOk(IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP))
            {
                int lineId = DeviceID % 100;
                MoveInfo.NextMoveStep(LineMoveStep.PO_03_CylinderOpen);
                CylinderMove(MoveInfo, IO_Type.ClampCylinder_Tighten, IO_Type.ClampCylinder_Slack);
                if (MoveInfo.MoveParam.InStoreNg)
                {
                    LogInfo("出料 【" + posId + "】" + MoveInfo.SLog + " : 夹料气缸夹紧,入料NG料,不更新料盘位置");
                }
                else
                {
                    LogInfo("出料 【" + posId + "】" + MoveInfo.SLog + " : 夹料气缸夹紧,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【INBELT】【" + lineId + "】");
                    //更新料盘位置
                    SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.INBELT, lineId.ToString());
                }
            }
            else
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_02_TopUP);
                LogInfo("出料 【" + posId + "】" + MoveInfo.SLog + " : 顶升气缸上升");
                CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
            }
        }
        protected override void OutStoreProcess()
        {
            if (MoveInfo.IsInWait)
            {
                CheckWait(MoveInfo);
            }
            if (MoveInfo.IsInWait)
            {
                return;
            }
            string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
            if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_00_CylinderAfter))
            {
                PO_01_CylinderDown();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_01_CylinderDown))
            {
                PO_03_CylinderOpen();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_02_TopUP))
            {
                PO_03_CylinderOpen();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_03_CylinderOpen))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_04_CylinderUp);
                OutLog("出料 " + MoveInfo.SLog + " : 上下气缸上升,皮带线准备出料");
                UpdownUpMove();
                StartLineOut(MoveInfo.MoveParam);
                if (MoveInfo.MoveParam.PlateW.Equals(7))
                {
                    MO_14_TopCylinder_Down();
                }
                else if (Config.SidesWayNum <= 0)
                {
                    CylinderMove(null, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
                }
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_04_CylinderUp))
            {
                //if (IOValue(IO_Type.ClampCylinder_Slack).Equals(IO_VALUE.LOW))
                //{
                //    MoveInfo.NextMoveStep(LineMoveStep.PO_05_ClampCheck);
                //    OutLog("出料:" + MoveInfo.SLog + " ,等待夹爪有料)");
                //    MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Slack, IO_VALUE.HIGH));
                //}
                //else
                {
                    PO_07_CylinderBefore();
                }
            }
            //else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_05_ClampCheck))
            //{
            //    PO_07_CylinderBefore();
            //}
            //else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_06_WaitBox))
            //{
            //    MoveInfo.NextMoveStep(LineMoveStep.PO_07_CylinderBefore);
            //    OutLog("出料:" + MoveInfo.SLog + " ,前后气缸前进)");
            //    CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
            //}
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_07_CylinderBefore))
            {
                if (CylinderIsOk(IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before))
                {
                    if (LineIsReady())
                    {
                        MoveInfo.NextMoveStep(LineMoveStep.PO_09_CylinderRelax);
                        OutLog("出料:" + MoveInfo.SLog + ",夹料气缸放松)");
                        CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);

                        if (MoveInfo.MoveParam.urgentReel && this.Config.SidesWayNum.Equals(4))
                        {
                            afterPutCutOK = false;
                            OutLog("出料:" + MoveInfo.SLog + ",紧急料,且SidesWayNum=4,发送 afterPutCut");
                            TaskData taskData;
                            string shefId = "BN";
                            int ShelfLoc = 1;
                            string msg = SServerManager.afterPutCut(Name, shefId, MoveInfo.MoveParam.WareCode, "", ShelfLoc, out taskData);
                            if (String.IsNullOrEmpty(msg).Equals(false))
                            {
                                LogUtil.error(Name + "【" + MoveInfo.MoveParam.WareCode + "】【" + shefId + "】【" + ShelfLoc.ToString() + "】afterPutCut 结果:" + msg);
                                taskData = null;
                            }
                            afterPutCutOK = true;
                        }
                        else
                        {
                            afterPutCutOK = true;
                        }
                    }
                    else if (MoveInfo.IsTimeOut())
                    {
                        MoveTimeoutAlarm(MoveInfo, "等待皮带线可放料超时");
                        //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 皮带线可放料 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
                        //LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
                        //Alarm(LineAlarmType.IoSingleTimeOut);
                    }
                }
                else
                {
                    MoveInfo.NextMoveStep(LineMoveStep.PO_07_CylinderBefore);
                    OutLog("出料:" + MoveInfo.SLog + " ,前后气缸前进)");
                    CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
                }
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_09_CylinderRelax))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_11_CylinderAfter);
                OutLog("出料:" + MoveInfo.SLog + ",前后气缸后退,等待200 ,皮带线继续运动");
                CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));

                //出料皮带线停止出料
                DisLineContiune();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_11_CylinderAfter))
            {
                if (afterPutCutOK)
                {
                    RunLogUtil.MoveEndLog(new MoveEndLog(Name, "出库", MoveInfo.MoveStartTime, DateTime.Now, MoveInfo.MoveParam.PosId, MoveInfo.MoveParam.WareCode));
                    OutLog("出料【" + posId + "】处理完成!");
                    MoveEndS();
                }
                else if (MoveInfo.IsTimeOut(60))
                {
                    MoveTimeoutAlarm(MoveInfo, "等待给服务器发送afterPutCutTask完成超时");
                    //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 给服务器发送afterPutCutTask完成 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
                    //LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
                    //Alarm(LineAlarmType.IoSingleTimeOut);
                }
            }
        }

        private void PO_07_CylinderBefore()
        {
            string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
            int num = MoveInfo.MoveParam.TrayNumber;
            MoveInfo.NextMoveStep(LineMoveStep.PO_07_CylinderBefore);
            LogInfo("出料 【" + posId + "】" + MoveInfo.SLog + " 更新托盘【" + num + "】为空,前后气缸前进");
            CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
            TrayManager.UpdateTrayInfo(num);
            if (SecondMoveInfo.MoveType.Equals(LineMoveType.None).Equals(false) && SecondMoveInfo.MoveStep < LineMoveStep.MO_14_TopDown)
            {
                //阻挡气缸移动
                MO_14_TopCylinder_Down();
            }
        }

        private bool afterPutCutOK = false;
        private OutTrayLineBean GetDisLine()
        {
            try
            {
                int id = DeviceID % 100;
                if (id.Equals(1))
                {
                    return LineManager.Line.DisLineMap[301].TrayLine1;
                }
                else if (id.Equals(2))
                {
                    return LineManager.Line.DisLineMap[301].TrayLine2;
                }
                else if (id.Equals(3))
                {
                    return LineManager.Line.DisLineMap[302].TrayLine1;
                }
                else if (id.Equals(4))
                {
                    return LineManager.Line.DisLineMap[302].TrayLine2;
                }
            }
            catch (Exception ex)
            {
                LogUtil.error(Name, ex);
            }
            return null;
        }
        private void DisLineContiune()
        {
            OutTrayLineBean outline = GetDisLine();

            if (outline != null)
            {
                if (outline.equipBean.runStatus <= LineRunStatus.Wait)
                {
                    return;
                }
                outline.MoveInfo.NextMoveStep(LineMoveStep.DLO_05_TrayIsOk);
                LogUtil.info(Name + "放料到皮带线完成," + outline.MoveInfo.Name + " " + outline.MoveInfo.SLog);
            }
            else
            {
                LogUtil.error(Name + "DisLineContiune()未找到对应的皮带线");
            }
        }

        private bool LineIsReady()
        {
            OutTrayLineBean outline = GetDisLine();

            if (outline != null)
            {
                if (outline.equipBean.runStatus <= LineRunStatus.Wait)
                {
                    return true;
                }
                else if (outline.MoveInfo.MoveStep.Equals(LineMoveStep.DLO_04_CanReviceTray))
                {
                    return true;
                }
                else if (outline.MoveInfo.MoveType.Equals(LineMoveType.None))
                {
                    outline.StartOut(MoveInfo.MoveParam);
                }
            }
            else
            {
                LogUtil.error(Name + "LineIsReady()未找到对应的皮带线");
            }
            return false;
        }

        private void StartLineOut(InOutParam param)
        {
            OutTrayLineBean outline = GetDisLine();

            if (outline != null)
            {
                if (outline.equipBean.runStatus <= LineRunStatus.Wait)
                {
                    return;
                }
                outline.StartOut(param);
            }
            else
            {
                LogUtil.error(Name + "StartLineOut未找到对应的皮带线");
            }
        }
        private bool LineNotBusy()
        {
            OutTrayLineBean outline = GetDisLine();

            if (outline != null)
            {
                if (outline.equipBean.MoveInfo.MoveType.Equals(LineMoveType.None))
                {
                    return true;
                }
            }
            else
            {
                LogUtil.error(Name + "StartLineOut未找到对应的皮带线");
            }
            return false;
        }
        #endregion
    }
}