ProvidingEquip_Partial.cs 26.2 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
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
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;
        }
        private Stopwatch trayCheckWait = new Stopwatch();
        private void StartCheckFixture()
        {
            bool canProcess = (LineManager.Line.SwNoProcess(Config.SidesWayNum));
            //int num = TrayManager.GetTrayNum(DeviceID); 
            if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH) && canProcess)
            {
                if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true))
                {
                    SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
                    CheckLog("托盘阻挡" + SecondMoveInfo.SLog + "阻挡气缸1-1上升)");
                    SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down);
                    IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
                    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
                }

            }
            else if (IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.HIGH) && canProcess)
            {
                if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true))
                {
                    //托盘在第一个阻挡处
                    SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
                    SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_Stop1Down);
                    CheckLog(" 托盘检测:" + SecondMoveInfo.SLog + "阻挡气缸1-1下降 ,等待 StopCylinder_Check1=0"  );
                    IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
                    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH));
                    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW));
                   // SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
                }
            }
            else
            {
                trayCheckWait.Stop();
            }
        }
        private void MO_14_TopCylinder_Down()
        {
            SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
            OutLog("放托盘(放开阻挡)" + MoveInfo.SLog + " 物品已移走,顶升气缸1下降");
            SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown);
            if (Config.SidesWayNum <= 0)
            {
                CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
            }
        }
        private InOutParam CheckIsNeedOutStore(out string outMsg )
        {
            outMsg = "";
            int lineNum = DeviceID % 100;
            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料";
                //入料失败料
                return inoup;
            }
            else if (trayInfo.InOrOutStore.Equals(ReelType.OutStore) && inoup.urgentReel.Equals(false) && inoup.cutReel.Equals(false))
            {
                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.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_08_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 (LineManager.Line.ProvidingCanUse(firstLine).Equals(false)&& kongxian)
                    {
                        outMsg = "优先线不可用";
                        //优先线不可用
                        return inoup;
                    }else if(span.TotalSeconds > youxianS&& kongxian)
                    {
                        outMsg = "超过180秒";
                        //超过指定的时间
                        return inoup;
                    }
                }
                else 
                {
                    if (kongxian)
                    {
                        outMsg = "随意放";
                        return inoup;
                    }
                }
            }
            
            //TODO 判断是否是需要移栽出料的料盘
            return null;
        }
        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))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_FixtureCheck);
                CheckLog("托盘阻挡" + SecondMoveInfo.SLog + "  阻挡气缸1-1上升,等待 阻挡2托盘检测=1)");
                IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_01_FixtureCheck))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down);
                CheckLog("托盘阻挡" + SecondMoveInfo.SLog + "   再次检测料盘信号");
                //CheckLog("托盘阻挡" + SecondMoveInfo.SLog + "  等待" + TrayManager.SwTrayWaitTime + ",再次检测料盘信号");
                IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
                // SecondMoveInfo.OneWaitCanEndStep = true;
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
                // SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
                // SecondMoveInfo.EndStepWait();
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_03_Stop2Down))
            {
                //if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH))
                //{
                CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " ,等待编码信号稳定StopCylinder_Check2=1");
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_04_Wait);
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
                // SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
                //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
                //}
                //else
                //{
                //    SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down);
                //    CheckLog("托盘阻挡" + SecondMoveInfo.SLog + "  等待" + TrayManager.SwTrayWaitTime + ",再次检测料盘信号");
                //    IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
                //    SecondMoveInfo.OneWaitCanEndStep = true;
                //    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
                //    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
                //}
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_04_Wait))
            {
                UpdateTrayNum();
                if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
                {
                    if (TrayManager.ErrorDeviceId.Equals(DeviceID))
                    {
                        TrayManager.UpdateTrayNumError(-1, "");
                    }
                    //出料中,需要拦盘 
                    string outMsg = "";
                    InOutParam param = CheckIsNeedOutStore(out outMsg);
                    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(1000));
                        SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitProvidingEquipCanOut());//等待

                        return;
                    }
                    else
                    {
                        SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
                        CheckLog("放托盘(放开阻挡)" + MoveInfo.SLog + " 托盘 【" + currTrayNum + "】直接放行");
                        SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown);
                        if (Config.SidesWayNum <= 0)
                        {
                            CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
                        }
                        //MO_14_TopCylinder_Down();
                    }
                }
                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))
            {
                SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopUp);
                CheckLog("托盘阻挡 " + SecondMoveInfo.SLog + " 顶升气缸上升 ");
                CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
            }
            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.MO_14_TopDown))
            {
                if (Config.SidesWayNum > 0)
                {
                    SecondMoveInfo.EndMove();
                    CheckLog("托盘放行  结束,触发 TrayPEndEvent ");
                    this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
                }
                else
                {
                    SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
                    CheckLog("托盘放行  " + SecondMoveInfo.SLog + " ,等待 NextStopCheck=0"); 
                    SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.NextStopCheck, IO_VALUE.LOW));
                }

            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_WaitCanGo))
            {
                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_StopCylinder_Back);
                CheckLog("托盘放行  " + SecondMoveInfo.SLog + " , 阻挡气缸2上升 ");
                IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.LOW));
                SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
            }
            else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_18_StopCylinder_Back))
            {
                CheckLog("托盘放行  结束,触发 TrayPEndEvent ");
                SecondMoveInfo.EndMove();
                this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
            }
            #endregion
        }

        #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);
                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);
                return true;
            }
            else
            {
                LogUtil.error(Name + " 启动出料【" + posId + "】 失败,当前 storeStatus=" + runStatus);
                return false;
            }
        }

        protected override void OutStoreProcess()
        {
            if (MoveInfo.IsInWait)
            {
                CheckWait(MoveInfo);
            }
            //if (SecondMoveInfo.IsInWait)
            //{
            //    CheckWait(SecondMoveInfo);
            //}
            if (MoveInfo.IsInWait)
            {
                return;
            }
            string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
            if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_00_CylinderAfter))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_01_CylinderDown);
                LogInfo(" " + MoveInfo.SLog + " : 上下气缸下降");
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
                UpdownDownP2Move(MoveInfo.MoveParam.PlateH);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_01_CylinderDown))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_02_DownWait);
                OutLog("出料 " + MoveInfo.SLog + " : 等待300后夹紧");
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
            }
            //只有当BOX可以进行出出料时,移栽物品,防止卡住
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_02_DownWait))
            {
                int lineId = DeviceID % 100;
                MoveInfo.NextMoveStep(LineMoveStep.PO_03_CylinderOpen);
                CylinderMove(MoveInfo, IO_Type.ClampCylinder_Tighten, IO_Type.ClampCylinder_Slack);
                if (MoveInfo.MoveParam.InStoreNg)
                {
                    OutLog("出料 " + MoveInfo.SLog + " : 夹料气缸夹紧,入料NG料,不更新料盘位置");

                }
                else
                {
                    OutLog("出料 " + MoveInfo.SLog + " : 夹料气缸夹紧,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【INBELT】【" + lineId + "】");
                    //更新料盘位置
                    SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.INBELT, lineId.ToString());
                }
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_03_CylinderOpen))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_04_CylinderUp);
                OutLog("出料 " + MoveInfo.SLog + " : 上下气缸上升,皮带线准备出料");
                UpdownUpMove();
                StartLineOut(MoveInfo.MoveParam);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_04_CylinderUp))
            {
                int num = MoveInfo.MoveParam.TrayNumber;
                MoveInfo.NextMoveStep(LineMoveStep.PO_05_WaitBox);
                LogInfo("出料 【" + posId + "】" + MoveInfo.SLog + " 更新托盘【" + num + "】为空");
                // MoveInfo.WaitList.Add(WaitResultInfo.WaitProvidingEquipCanOut());
                TrayManager.UpdateTrayInfo(num);

                //阻挡气缸移动
                MO_14_TopCylinder_Down();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_05_WaitBox))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_06_CylinderBefore);
                OutLog("出料:" + MoveInfo.SLog + " ,前后气缸前进)");
                CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_06_CylinderBefore))
            {
                if (LineIsReady())
                {
                    //气缸不下降,直接扔料
                    //MoveInfo.NextMoveStep(LineMoveStep.PO_07_CylinderDown);
                    //OutLog("出料:" + MoveInfo.SLog + " ,上下气缸下降)");
                    //UpdownDownP3Move(MoveInfo.MoveParam.PlateH);
                    MoveInfo.NextMoveStep(LineMoveStep.PO_08_CylinderRelax);
                    OutLog("出料:" + MoveInfo.SLog + ",夹料气缸放松)");
                    CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
                }
                else if (MoveInfo.IsTimeOut())
                {
                    WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 皮带线可放料 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
                    LogUtil.error(WarnMsg, DeviceID + 20);
                    Alarm(LineAlarmType.IoSingleTimeOut);
                }
            }
            //else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_07_CylinderDown))
            //{
            //    MoveInfo.NextMoveStep(LineMoveStep.PO_08_CylinderRelax);
            //    OutLog("出料:" + MoveInfo.SLog + ",夹料气缸放松)");
            //    CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
            //}
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_08_CylinderRelax))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_09_CylinderUp);
                OutLog("出料:" + MoveInfo.SLog + ",上下气缸上升)");
                UpdownUpMove();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_09_CylinderUp))
            {
                MoveInfo.NextMoveStep(LineMoveStep.PO_10_CylinderAfter);
                OutLog("出料:" + MoveInfo.SLog + ",前后气缸后退,等待1000 ,皮带线继续运动");
                CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));

                //出料皮带线停止出料
                DisLineContiune();
            }
            else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_10_CylinderAfter))
            {
                LogInfo("出料【" + posId + "】处理完成!");
                MoveEndS();
            }
        }
        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未找到对应的皮带线");
            }
        } 
        #endregion 
    }
}