AC_SA_BoxBean_Partial.cs 46.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
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; 

namespace OnlineStore.DeviceLibrary
{
    partial class AC_SA_BoxBean
    {

        #region 自动出入库参数
        /// <summary>
        /// 料仓内所有的位置列表
        /// </summary>
        public List<string> PositionNumList = new List<string>();
        /// <summary>
        /// 入库完成后自动出库,出库完成后自动入库
        /// </summary>
        public bool autoNext = false;
        /// <summary>
        /// 自动出入库间隔
        /// </summary>
        public int autoJiange = 3;
        public int autoPositionIndex = 0;
        public string autoMsg = "";
        #endregion

        #region 出入库参数
        /// <summary>
        /// 当前出入库的次数,超过配置的数量时,需要自动重置一下,再进行出入库
        /// </summary>
        private int CurrInOutCount = 0;
        private int CurrInOutACount = 0;

        private bool LoadParamPosition(InOutStoreParam param)
        {
            if (param == null)
            {
                return false;
            }
            //加载位置
            if (param.MoveP == null)
            {
                LineMoveP p = new LineMoveP();
                KTKSAStorePostion position = param.GetKTKSAPosition();
                if (position == null)
                {
                    LogUtil.error(LOGGER, StoreName + "出入库时发现param中取到的Position=null,没有库位不能执行出入库");
                    return false;
                }

                p.ComPress_P1 = Config.CompressAxis_P1_Position;
                p.InOut_P1 = Config.InOutAxis_P1_Position;
                p.Middle_P1 = Config.MiddleAxis_P1_Position;

                p.InOut_P2 = position.InOutAxis_DoorPosition_P2;
                //p.UpDown_P1 = position.UpDownAxis_DoorOPosition_P1;
                //p.UpDown_P8 = position.UpDownAxis_DoorIBPosition_P8;
                //p.UpDown_P2 = position.UpDownAxis_DoorIPosition_P2;
                //p.UpDown_P7 = position.UpDownAxis_DoorOBPosition_P7;

                //p.InOut_P2 = Config.InOutAxis_DoorPosition_P2;
                p.UpDown_P1 = Config.UpDownAxis_DoorOPosition_P1;
                p.UpDown_P8 = Config.UpDownAxis_DoorIBPosition_P8;
                p.UpDown_P2 = Config.UpDownAxis_DoorIPosition_P2;
                p.UpDown_P7 = Config.UpDownAxis_DoorOBPosition_P7;

                p.ComPress_P2 = position.CompressAxis_Position_P2;
                p.ComPress_P3 = position.CompressAxis_CPosition_P3;
                p.InOut_P3 = position.InOutAxis_Position_P3;
                p.Middle_P2 = position.MiddleAxis_Position_P2;
                p.UpDown_P3 = position.UpDownAxis_IHPosition_P3;
                p.UpDown_P4 = position.UpDownAxis_ILPosition_P4;
                p.UpDown_P5 = position.UpDownAxis_OHPosition_P5;
                p.UpDown_P6 = position.UpDownAxis_OLPosition_P6;
                param.MoveP = p;
                return true;
            }
            return true;
        }

        #endregion

        #region 出入库结果验证
        private void InOutBackToP1(int InOut_P1)
        {
            ACAxisMove(Config.InOut_Axis, InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed); 
            //StoreMove.WaitList.Add(WaitResultInfo.WaitAxisOrg(Config.InOut_Axis,IO_VALUE.HIGH));
        }

        private void CheckWait()
        {
            List<WaitResultInfo> list = StoreMove.WaitList;
            //当等待超过一分钟时,需要打印提示 
            TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
            if (span.TotalMinutes > 5)
            {
                WarnMsg = StoreName + "等待超时【" + StoreMove.MoveType + "】【" + StoreMove.MoveStep + "】已等待【" + span.TotalMinutes + "】分钟,";
                foreach (WaitResultInfo wait in list)
                {
                    WarnMsg = WarnMsg + "\r\n" + wait.ToStr();
                }
                LogUtil.error(LOGGER, WarnMsg, 12);
                Alarm(StoreAlarmType.IoSingleTimeOut,"",WarnMsg,StoreMove.MoveType);
            }
            if (list.Count > 0)
            {
                bool isOk = true;
                foreach (WaitResultInfo wait in list)
                {
                    if (wait.WaitType == 1)
                    {
                        if (wait.IsHomeMove)
                        {
                            if ((!ACHomeMoveIsEnd(wait.AxisInfo)))
                            {
                                isOk = false;
                                break;
                            }
                        }
                        else
                        {
                            string msg = "";
                            bool isEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
                            if (!msg.Equals(""))
                            {
                                isOk = false; 
                                WarnMsg = msg;
                                Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
                                break;
                            }
                            else if (!isEnd)
                            {
                                isOk = false;
                                break;
                            }
                        }
                    }
                    else if (wait.WaitType == 2)
                    {
                        if (!KNDIOValue(wait.IoType).Equals(wait.IoValue))
                        {
                            //一分钟还未检测到
                            if (span.TotalMilliseconds > Config.IOSingle_TimerOut)
                            {
                                ConfigIO io = Config.getWaitIO(wait.IoType);
                                WarnMsg = StoreName + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
                                //SendAlarmCode(StoreID, LineAlarm.IoNotOk, wait.IoType); 
                                Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
                                LogUtil.error(LOGGER, StoreName + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
                            }
                            isOk = false;
                            break;

                        }
                    }
                    else if (wait.WaitType == 3)
                    {
                        if (span.TotalMilliseconds < wait.TimeMSeconds)
                        {
                            isOk = false;
                            break;
                        }
                    }
                    else if (wait.WaitType == 5)
                    {
                        if (wait.IsHomeMove)
                        {
                            if (!ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime))
                            {
                                ShuoKeControls.GetStatus(wait.SlvAddr);
                                isOk = false;
                                break;
                            }
                            else if (StoreMove.OneWaitCanEndStep)
                            {
                                isOk = true; break;
                            }
                        }
                        else
                        {
                            if (!ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime))
                            {
                                ShuoKeControls.GetStatus(wait.SlvAddr);
                                isOk = false;
                                break;
                            }
                            else if (StoreMove.OneWaitCanEndStep)
                            {
                                isOk = true; break;
                            }
                        }
                    } 
                   
                }
                if (isOk)
                {
                    StoreMove.EndStepWait();
                }
            }
            else
            {
                StoreMove.EndStepWait();
            }
        }

        #endregion

        #region 入库
        /// <summary>
        /// 开始入库移动移动
        /// </summary> 
        public void StartInStoreMove(InOutStoreParam param, bool isNeedCheckIO)
        {
            string posId = param != null ? param.PositionNum : "";
            if (storeRunStatus == StoreRunStatus.Runing)
            {
                if (!LoadParamPosition(param))
                {
                    LogUtil.error(LOGGER, StoreName + " 启动一个 入库运动出错,找不到库位信息");
                    return;
                }

                LogUtil.info(LOGGER, StoreName + " 入库【" + posId + "】处理:启动新的入库,目标位置【" + param.PositionNum + "】", storeMoveColor);
                storeRunStatus = StoreRunStatus.Busy;
                storeStatus = StoreStatus.InStoreExecute;
                StoreMove.NewMove(StoreMoveType.InStore, param);
                if (isNeedCheckIO)
                {
                    //料盘检测
                    InStoreLog(" 入库【" + posId + "】处理:(SI_00_TrayCheck   检测料盘信号");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_00_TrayCheck);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.TrayCheck_1, IO_VALUE.HIGH));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.TrayCheck_2, IO_VALUE.HIGH));
                }
                else
                {
                    if (IsHasCompress_Axis)
                    {
                        InStoreLog(" 入库处理:(SI_02_InOutAxisHome   进出轴(叉子)动作至P1, 打开舱门");
                        StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);

                        //打开门 ,门上升
                        KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.LOW);
                        KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.HIGH);
                        StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.LOW));
                        StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.HIGH));
                        //ACAxisMove(Config.InOut_Axis, param.MoveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                        InOutBackToP1(param.MoveP.InOut_P1);
                    }
                    else
                    {
                        InStoreLog(" 入库处理:(SI_01_LocationCylinderDown   定位气缸下降");
                        StoreMove.NextMoveStep(StoreMoveStep.SI_01_LocationCylinderDown);
                      
                        KNDIOMove(Store_IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
                        KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
                        StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Up, IO_VALUE.HIGH));
                        StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Down, IO_VALUE.LOW));
                    }
                }
            }
            else
            {
                LogUtil.error(LOGGER, StoreName + " 启动一个 入库【" + posId + "】运动出错,当前状态,storeStatus=" + storeRunStatus);
            }
        }
        /// <summary>
        /// 开始入库移动移动
        /// </summary> 
        public override void StartInStoreMove(InOutStoreParam param)
        {
            StartInStoreMove(param, false);
        }
        protected override void InStoreProcess()
        {
            LineMoveP moveP = StoreMove.MoveParam.MoveP;
            if (StoreMove.IsInWait)
            {
                CheckWait();
            }
            if (StoreMove.IsInWait)
            {
                return;
            }
            if (StoreMove.MoveStep == StoreMoveStep.SI_00_TrayCheck)
            {
                if (IsHasCompress_Axis)
                {
                    InStoreLog(" 入库处理:(SI_02_InOutAxisHome   进出轴(叉子)动作至P1,打开舱门");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);

                    //打开门 ,门上升
                    KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.LOW);
                    KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.HIGH);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.LOW));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.HIGH));
                    //ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                    InOutBackToP1(moveP.InOut_P1);
                }
                else
                {
                    InStoreLog(" 入库处理:(SI_01_LocationCylinderDown   定位气缸下降");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_01_LocationCylinderDown);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW));
                     
                }
            }
            if (StoreMove.MoveStep == StoreMoveStep.SI_01_LocationCylinderDown)
            {
                InStoreLog(" 入库处理:(SI_02_InOutAxisHome   进出轴(叉子)动作至P1,打开舱门");
                StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);
                //ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                InOutBackToP1(moveP.InOut_P1);

                //打开门 ,门上升
                KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.LOW);
                KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.HIGH);
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.LOW));
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.HIGH));
                //ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_02_InOutAxisHome)
            {
                InStoreLog(" 入库处理:(SI_03_ReturnHome   所有轴先回到待机点,轴2、轴1 动作到P1,,轴4动作至P3");
                StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
                if (IsHasCompress_Axis)
                {
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false)); 
                }
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed, Config.UpDown_Axis.StartSpeed);
                ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed, Config.Middle_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_03_ReturnHome)
            {
                if (IsHasCompress_Axis)
                {
                    InStoreLog(" 入库处理:(SI_04_CompressWare  压紧物品(有压紧轴的才需要此步骤),轴4( 压紧) 至P3(压紧前点))开始");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_04_CompressWare); 
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3); 
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false)); 
                }
                else
                {
                    InStoreLog(" 入库处理:(SI_05_DeviceToDoor  叉子进入入料口,轴3( 叉子) 至P2( 进料口取料点))开始");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_05_DeviceToDoor);
                    ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed, Config.InOut_Axis.StartSpeed);
                }
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_04_CompressWare)
            {
                InStoreLog(" 入库处理:(SI_05_DeviceToDoor 叉子进入入料口,轴3( 叉子) 至P2( 进料口取料点))开始");
                StoreMove.NextMoveStep(StoreMoveStep.SI_05_DeviceToDoor);
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed, Config.InOut_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_05_DeviceToDoor)
            {
                InStoreLog(" 入库处理:(SI_06_DoorWarToDevice 把物品放入叉子上,轴4( 压紧) 至P2(压紧点))开始,等待一秒后,轴2( 上下) 至P7( 进料口取料缓冲点))开始");
                StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
                if (IsHasCompress_Axis)
                {
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
                    //ACAxisMove(Config.Compress_Axis, moveP.ComPress_P2, Config.CompressAxis_P2_Speed, Config.Compress_Axis.StartSpeed);
                    System.Threading.Thread.Sleep(600);
                }
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed, Config.UpDown_Axis.StartSpeed);
                 
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_06_DoorWarToDevice)
            {
                InStoreLog(" 入库处理:(SI_07_DeviceBackFromDoor 叉子 从入料口抽出,轴3( 叉子) 至P1( 待机点))开始");
                StoreMove.NextMoveStep(StoreMoveStep.SI_07_DeviceBackFromDoor);
                //ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                InOutBackToP1(moveP.InOut_P1);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_07_DeviceBackFromDoor)
            {
                if (IsHasCompress_Axis)
                {
                    InStoreLog(" 入库处理:(SI_09_MoveToBag 移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点))开始");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
                    ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed, Config.Middle_Axis.StartSpeed);
                    ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed, Config.UpDown_Axis.StartSpeed);
                    //关闭舱门 
                    KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.HIGH);
                    KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.LOW);
                }
                else
                {
                    InStoreLog(" 入库处理:(SI_08_LocationCylinder_Up 定位气缸伸出 (有压紧轴的不需要此步骤)开始");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_08_LocationCylinder_Up);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Down, IO_VALUE.LOW));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Up, IO_VALUE.HIGH)); 
                }
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_08_LocationCylinder_Up)
            {
                InStoreLog(" 入库处理:(SI_09_MoveToBag 移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点)),关闭舱门  开始");
                StoreMove.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
                ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P1_Speed, Config.Middle_Axis.StartSpeed);
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed, Config.UpDown_Axis.StartSpeed);
                //关闭舱门 
                KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.HIGH);
                KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.LOW);
                //StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.HIGH));
                //StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.LOW));
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_09_MoveToBag)
            {
                if (IsHasCompress_Axis)
                {
                    InStoreLog(" 入库处理:(SI_11_DeviceToBag 叉子进入库位中,轴3( 叉子) 至P3(库位取放料点))开始");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag);
                    ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed, Config.InOut_Axis.StartSpeed);
                }
                else
                {
                    InStoreLog(" 入库处理:(SI_10_LocationCylinder_Down 定位气缸退回 (有压紧轴的不需要此步骤) )开始");
                    StoreMove.NextMoveStep(StoreMoveStep.SI_10_LocationCylinder_Down);
                   
                    KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW));
                }
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_10_LocationCylinder_Down)
            {
                KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
                InStoreLog(" 入库处理:(SI_11_DeviceToBag 叉子进入库位中,轴3( 叉子) 至P3(库位取放料点))开始");
                StoreMove.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag);
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed, Config.InOut_Axis.StartSpeed);

            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_11_DeviceToBag)
            {
                InStoreLog(" 入库处理:(SI_12_PutWareToBag 放下物品,轴2( 上下) 至P4( 库位入料缓冲点)轴4( 压紧) 至P3( 压紧前点))开始!");
                StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
                if (IsHasCompress_Axis)
                {
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
                    //ACAxisMove(Config.Compress_Axis, moveP.ComPress_P3, Config.CompressAxis_P3_Speed, Config.Compress_Axis.StartSpeed);
                }
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed, Config.UpDown_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
            {
                InStoreLog(" 入库处理:(SI_13_DeviceBackFromBag 叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点))开始!");
                // 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)   
                string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
                lastPosId = posId;
                lastPosIdStatus = StoreStatus.InStoreEnd;
                storeStatus = StoreStatus.InStoreEnd;
                //手动发给服务器状态,防止没有手动
                //SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);

                StoreMove.NextMoveStep(StoreMoveStep.SI_13_DeviceBackFromBag);
                //ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                InOutBackToP1(moveP.InOut_P1);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_13_DeviceBackFromBag)
            {
                InStoreLog(" 入库处理:(SI_14_GoBack 返回待机点,轴2/轴1/轴4动作至P1( 待机点)),检测门关闭,开始!");
                StoreMove.NextMoveStep(StoreMoveStep.SI_14_GoBack);
                if (IsHasCompress_Axis)
                {
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P1);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P1, false));
                    //ACAxisMove(Config.Compress_Axis, moveP.ComPress_P1, Config.CompressAxis_P1_Speed, Config.Compress_Axis.StartSpeed);
                }
                ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed, Config.Middle_Axis.StartSpeed);
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed, Config.UpDown_Axis.StartSpeed);
                //关闭门
                KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.HIGH);
                KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.LOW);
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.HIGH));
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.LOW));
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SI_14_GoBack)
            {
                string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
                LogUtil.info(LOGGER, StoreName + " 入库【" + posId + "】处理: 整个入库流程结束!", storeMoveColor);
                //MoveEndEvent.Invoke(StoreID, StoreMoveType.InStore, StoreMove.MoveParam);//触发完成事件
                StoreMove.EndMove();
                storeRunStatus = StoreRunStatus.Runing;
                //设备连接,入库后,BOX恢复原始状态 
                storeStatus = StoreStatus.StoreOnline;
                InOutEndProcess(StoreMoveType.InStore);
            }
            else
            {
                LogUtil.info(LOGGER, StoreName + " 入库处理,moveStatus=" + StoreMove.MoveStep + ",没有对应的处理!");
            }

        }


        #endregion


        #region 出库
        /// <summary>
        /// 开始出库运动
        /// </summary> 
        public override void StartOutStoreMove(InOutStoreParam param)
        {
            string posId = param != null ? param.PositionNum : "";
            if (storeRunStatus == StoreRunStatus.Runing)
            {
                if (!LoadParamPosition(param))
                {
                    LogUtil.error(LOGGER, StoreName + " 启动一个 出库【" + posId + "】运动出错,找不到库位信息");
                    return;
                }
                storeStatus = StoreStatus.OutStoreExecute;
                LogUtil.info(LOGGER, StoreName + " 出库处理:启动一个出库【" + posId + "】 开始处理 ", storeMoveColor);
                storeRunStatus = StoreRunStatus.Busy;
                StoreMove.NewMove(StoreMoveType.OutStore, param);
                if (IsHasCompress_Axis)
                {
                    StoreMove.NextMoveStep(StoreMoveStep.SO_02_DeviceBack);
                    OutStoreLog(" 出库处理:(SO_02_DeviceBack 叉子先运动到P1 ,打开舱门 开始");
                    //ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                    InOutBackToP1(StoreMove.MoveParam.MoveP.InOut_P1);
                    //打开舱门
                    KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.HIGH);
                    KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.LOW);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.HIGH));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.LOW));
                }
                else
                {
                    StoreMove.NextMoveStep(StoreMoveStep.SO_01_LocationCylinderDown);
                    OutStoreLog(" 出库处理:(SO_01_LocationCylinderDown 定位气缸下降");
                    KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW));
                    //CylinderMove(StoreMove, Store_IO_Type.LocationCylinder_Up, Store_IO_Type.LocationCylinder_Down);
                }
            }
            else
            {
                LogUtil.error(LOGGER, StoreName + " 启动一个 出库运动出错,当前状态,storeStatus=" + storeRunStatus);
            }
        }
        protected override void OutStoreProcess()
        {
            LineMoveP moveP = StoreMove.MoveParam.MoveP;
            if (StoreMove.IsInWait)
            {
                CheckWait();
            }
            if (StoreMove.IsInWait)
            {
                return;
            }
            if (StoreMove.MoveStep == StoreMoveStep.SO_01_LocationCylinderDown)
            {
                StoreMove.NextMoveStep(StoreMoveStep.SO_02_DeviceBack);
                OutStoreLog(" 出库处理:(SO_02_DeviceBack 叉子先运动到P1 开始");
                //ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                InOutBackToP1(StoreMove.MoveParam.MoveP.InOut_P1);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_02_DeviceBack)
            {
                StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition);
                OutStoreLog(" 出库处理:(SO_03_ToBagPosition 所有轴运行到库位,  轴4( 压紧) 至P3(压紧前点) ,轴1( 转盘) 至P2( 库位点),轴2(上下) 至P5(库位出库前点) ) 开始");
                if (IsHasCompress_Axis)
                {
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
                    //ACAxisMove(Config.Compress_Axis, StoreMove.MoveParam.MoveP.ComPress_P3, Config.CompressAxis_P3_Speed, Config.Compress_Axis.StartSpeed);
                }
                ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed, Config.Middle_Axis.StartSpeed);
                ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed, Config.UpDown_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagPosition)
            {
                StoreMove.NextMoveStep(StoreMoveStep.SO_04_DeviceToBag);
                OutStoreLog(" 出库处理:(SO_04_DeviceToBag叉子进入库位中,  轴3( 叉子) 至P3(库位取放料点))开始");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed, Config.InOut_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_04_DeviceToBag)
            {
                OutStoreLog(" 出库处理:(SO_05_BagWareToDevice库位的物品放入叉子上,轴2( 上下) 至P6( 库位出料缓冲点),轴4( 压紧) 至P2(压紧点))开始");
                StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice);
                //电缸微动至对应料盘的上端位置 
                if (IsHasCompress_Axis)
                {
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
                    //ACAxisMove(Config.Compress_Axis, moveP.ComPress_P2, Config.CompressAxis_P2_Speed, Config.Compress_Axis.StartSpeed);
                }
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed, Config.UpDown_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_05_BagWareToDevice)
            {
                StoreMove.NextMoveStep(StoreMoveStep.SO_06_BagDeviceBack);
                OutStoreLog(" 出库处理:(SO_06_BagDeviceBack,叉子从 库位返回,轴3( 叉子) 至P1( 待机点))开始");
                //ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                InOutBackToP1(moveP.InOut_P1);
                //把库位的物品放到取到叉子上之后是出仓完成 
                string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
                lastPosId = posId;
                lastPosIdStatus = StoreStatus.OutStoreBoxEnd;
                storeStatus = StoreStatus.OutStoreBoxEnd; 

            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_06_BagDeviceBack)
            {
                if (IsHasCompress_Axis)
                {
                    StoreMove.NextMoveStep(StoreMoveStep.SO_08_ToDoorPosition);
                    OutStoreLog(" 出库处理: (SO_08_ToDoorPosition所有设备运行到门,,轴1( 转盘) 至P1( 待机点)轴2( 上下) 至P2( 进料口出料前点)),打开舱门 开始");
                    ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed, Config.UpDown_Axis.StartSpeed);
                    ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed, Config.Middle_Axis.StartSpeed);
                    //打开舱门
                    KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.HIGH);
                    KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.LOW);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.HIGH));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.LOW));
                }
                else
                {
                    StoreMove.NextMoveStep(StoreMoveStep.SO_07_LocationCylinder_Up);
                    OutStoreLog(" 出库处理: (SO_07_LocationCylinder_Up定位气缸伸出(有压紧轴的不需要此步骤),,定位气缸伸出 )开始");
                    //同时运动,电缸移动至入料口的上端位置    旋转电机2反转
                    KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Down, IO_VALUE.LOW));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Up, IO_VALUE.HIGH)); 
                }
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_07_LocationCylinder_Up)
            {
                StoreMove.NextMoveStep(StoreMoveStep.SO_08_ToDoorPosition);
                OutStoreLog(" 出库处理: (SO_08_ToDoorPosition所有设备运行到门,,轴1( 转盘) 至P1( 待机点)轴2( 上下) 至P2( 进料口出料前点))开始");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed, Config.UpDown_Axis.StartSpeed);
                ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed, Config.Middle_Axis.StartSpeed);
                //此处需要等待box门口没有盘
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.TrayCheck_1, IO_VALUE.LOW));
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.TrayCheck_2, IO_VALUE.LOW));

            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_08_ToDoorPosition)
            { 
                if (IsHasCompress_Axis)
                {
                    StoreMove.NextMoveStep(StoreMoveStep.SO_10_DeviceToDoor);
                    OutStoreLog(" 出库处理:(SO_10_DeviceToDoor叉子进出料口,,轴3( 叉子) 至P2( 进料口取料点))开始");
                    ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed, Config.InOut_Axis.StartSpeed);
                }
                else
                {
                    StoreMove.NextMoveStep(StoreMoveStep.SO_09_LocationCylinder_Down);
                    OutStoreLog(" 出库处理:(SO_09_LocationCylinder_Down定位气缸退回(有压紧轴的不需要此步骤),,定位气缸退回  )开始");
                    KNDIOMove(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
                    KNDIOMove(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Down, IO_VALUE.HIGH));
                    StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.LocationCylinder_Up, IO_VALUE.LOW)); 
                } 
            }
            //此处需要等待移栽没有工作,才能把盘放入出料口
            else if (StoreMove.MoveStep == StoreMoveStep.SO_09_LocationCylinder_Down)
            { 
                OutStoreLog(" 出库处理:(SO_10_DeviceToDoor叉子进出料口,,轴3( 叉子) 至P2( 进料口取料点))开始");
                StoreMove.NextMoveStep(StoreMoveStep.SO_10_DeviceToDoor);
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed, Config.InOut_Axis.StartSpeed); 
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_10_DeviceToDoor)
            {
                OutStoreLog(" 出库处理:(SO_11_DevicePutWare把物品放下,,轴2( 上下) 至P8( 进料口出料缓冲点)轴4( 压紧) 至P1( 待机点)) 开始!");
                StoreMove.NextMoveStep(StoreMoveStep.SO_11_DevicePutWare);
                if (IsHasCompress_Axis)
                {
                    ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P1);
                    StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P1, false));
                    //ACAxisMove(Config.Compress_Axis, moveP.ComPress_P1, Config.CompressAxis_P1_Speed, Config.Compress_Axis.StartSpeed); 
                }
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P8, Config.UpDownAxis_P8_Speed, Config.UpDown_Axis.StartSpeed);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_11_DevicePutWare)
            {
                StoreMove.NextMoveStep(StoreMoveStep.SO_12_DeviceOutFromDoor);
                OutStoreLog(" 出库处理:(SO_12_DeviceOutFromDoor叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机点))开始!");
                //ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed, Config.InOut_Axis.StartSpeed);
                InOutBackToP1(moveP.InOut_P1);
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_12_DeviceOutFromDoor)
            {
                StoreMove.NextMoveStep(StoreMoveStep.SO_13_GoBack);
                OutStoreLog(" 出库处理:(SO_13_GoBack升降轴返回,,  轴2至P1( 待机点))开始,关闭舱门!");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed, Config.UpDown_Axis.StartSpeed);
                KNDIOMove(Store_IO_Type.Door_Up, IO_VALUE.LOW);
                KNDIOMove(Store_IO_Type.Door_Down, IO_VALUE.HIGH);
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Up, IO_VALUE.LOW));
                StoreMove.WaitList.Add(WaitResultInfo.WaitIO(Store_IO_Type.Door_Down, IO_VALUE.HIGH));
            }
            else if (StoreMove.MoveStep == StoreMoveStep.SO_13_GoBack)
            {
                string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";

                storeStatus = StoreStatus.OutStoreBoxEnd;
                LogUtil.info(LOGGER, StoreName + " 出库【" + posId + "】处理: 整个出库流程结束!", storeMoveColor);
                StoreMove.EndMove();
                storeRunStatus = StoreRunStatus.Runing;
                InOutEndProcess(StoreMoveType.OutStore);
            }
            else
            {
                LogUtil.error(LOGGER, StoreName + " 出库处理,moveStatus=" + StoreMove.MoveStep + ",没有对应的处理!");
            }

        }
        #endregion
        public List<FixtureCodeInfo> waitOutStoreList = new List<FixtureCodeInfo>();
        public object waitOutListLock = "";

        public static Dictionary<string, List<string>> codeMap = new Dictionary<string, List<string>>();

        public void AddWaitOutInfo(FixtureCodeInfo code)
        {
            lock (waitOutListLock)
            {
                waitOutStoreList.Add(code);
            }
        }
        private void InOutEndProcess(StoreMoveType storeMoveType)
        {
            try
            {
                CurrInOutCount++;
                CurrInOutACount++;
                //是否自动进入出库状态
                if (!autoNext)
                {
                    return;
                }
                if (storeMoveType.Equals(StoreMoveType.InStore))
                {
                    int newIndex = autoPositionIndex - 1;
                    if (autoJiange == 0)
                    {
                        newIndex = autoPositionIndex;
                    }
                    if (newIndex < 0)
                    {
                        autoNext = false;
                        autoMsg = "自动出入库结束!";
                        LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动 出入库结束!");
                    }
                    else
                    {
                        autoPositionIndex = newIndex;
                        string posid = PositionNumList[autoPositionIndex];

                        //判断是否需要重置
                        if (CurrInOutACount >= Config.Box_ResetACount)
                        {
                            LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
                            Reset(false);
                            autoMsg = "自动出库:" + posid;
                            AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
                        }
                        else if (CurrInOutCount >= Config.Box_ResetMCount)
                        {
                            LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
                            //ResetMiddleAxis(false);
                            autoMsg = "自动出库:" + posid;
                            AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
                        }
                        else
                        {
                            LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid);
                            autoMsg = "自动出库:" + posid;
                            StartOutStoreMove(new InOutStoreParam("", posid));
                        }
                    }
                }
                else if (storeMoveType.Equals(StoreMoveType.OutStore))
                {
                    int newIndex = autoPositionIndex - autoJiange;
                    if (newIndex < 0)
                    {
                        autoNext = false;
                        autoMsg = "自动出入库结束!";
                        LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动 出入库结束!");
                    }
                    else
                    {
                        string posid = PositionNumList[newIndex];
                        //判断是否需要重置
                        if (CurrInOutACount >= Config.Box_ResetACount)
                        {
                            LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
                            Reset(false);
                            autoMsg = "自动入库:" + posid;
                            AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid));
                        }
                        else if (CurrInOutCount >= Config.Box_ResetMCount)
                        {
                            LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
                            //ResetMiddleAxis(false);
                            autoMsg = "自动入库:" + posid;
                            AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid));
                        }
                        else
                        {
                            LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid);
                            autoMsg = "自动入库:" + posid;
                            StartInStoreMove(new InOutStoreParam("AAAA", posid));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtil.error(LOGGER, ex.ToString());
            }
        }
         
        private void InStoreLog(string msg)
        {
            string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
            LogUtil.info(LOGGER, StoreName + "【" + posId + "】" + msg, storeMoveColor);
        }
        private void OutStoreLog(string msg)
        {
            string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
            LogUtil.info(LOGGER, StoreName + "【" + posId + "】" + msg, storeMoveColor);
        }
    }
}