AC_BOX_Bean_InStore.cs 27.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
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace OnlineStore.DeviceLibrary
{
    partial class AC_BOX_Bean
    {
        private DateTime startInStoreTime = DateTime.Now;
        /// <summary>
        /// 入库NG的料架位置
        /// </summary>
        Dictionary<string, bool> inNGShelfPos = new Dictionary<string, bool>();
        void addNGShelfPos(string shelfPos, bool ok = false)
        {
            inNGShelfPos[shelfPos] = ok;
        }
        /// <summary>
        /// 清空料架NG位置信息
        /// </summary>
        void clearNGShelfPos()
        {
            inNGShelfPos.Clear();
            LogInfo("清空料架NG位置信息");
        }
        string getNGShelfPos()
        {
            StringBuilder sb = new StringBuilder();
            foreach (var item in inNGShelfPos)
            {
                sb.Append($"{item.Key}={item.Value},");
            }
            return sb.ToString();
        }
        /// <summary>
        /// 是否是入库NG料架
        /// </summary>
        /// <returns></returns>
        bool isNGShelf()
        {
            return !inNGShelfPos.Values.Contains(true);
        }
        /// <summary>
        /// 清空最后一盘的信息
        /// </summary>
        private void ClearLastTrayInfo()
        {
            LastScanCodes = new List<string>();
            ComTargetPosition = 0;
            LastWidth = 0;
            LastHeight = 0;
        }

        /// <summary>
        /// 开始单盘入库
        /// </summary> 
        public override void StartInStoreMove(InOutParam param)
        {
            startInStoreTime = DateTime.Now;
            string posId = param != null ? param.PosID : "";
            if (isInSuddenDown || isNoAirCheck ||
           (!storeRunStatus.Equals(StoreRunStatus.Runing))
           || (!MoveInfo.MoveType.Equals(StoreMoveType.None)))
            {
                LogUtil.error(Name + " 启动出库出错,忙碌或报警中 ,storeStatus=" + storeRunStatus + ",MoveType=" + MoveInfo.MoveType + ",isInSuddenDown=" + isInSuddenDown + ",isNoAirCheck" + isNoAirCheck);
                return;
            }

            if (!StoreManager.LoadInoutParam(param, true, this))
            {
                LogUtil.error(Name + " 启动入库【" + param.ToStr() + "】出错,找不到库位信息");
                return;
            }
            InOutStoreLog(" 启动入库【" + param.ToStr() + "】,压紧点P2【" + param.MoveP.ComPress_P2 + "】压紧前点P3【" + param.MoveP.ComPress_P3 + "】");
            setStatus(StoreRunStatus.Busy, StoreStatus.InStoreExecute);
            MoveInfo.NewMove(StoreMoveType.InStore, param);

            //新的料架库位
            MoveInfo.NextMoveStep(StoreMoveStep.BI_11_InoutToP1);
            MoveInfo.SingleInstore = true;
            InOutStoreLog("料架取料:  叉子后退到待机点P1, 重置盘信息");
            ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
            ClearLastTrayInfo();
            //LastRfidID = "";
            LastOutParam = new InOutParam();
        }


        private void GetPosId()
        {
            MoveInfo.NextMoveStep(StoreMoveStep.BI_30_SetInstoreParam);
            InOutStoreLog("不扫码 : 获取库位号");
            MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
            if (MoveInfo.IsShelfLocked)
            {
                bool result = GetPosIdByCode();
                if (!result)//获取库位失败
                {
                    MoveInfo.MoveParam.PosID = "";
                    StartSendTray("锁定库位:获取入库库位失败", false);
                }
                else
                {
                    MoveInfo.EndStepWait();
                }
            }
        }
        private void StartMoveToBag()
        {
            MoveInfo.NextMoveStep(StoreMoveStep.BI_51_MoveToBag);
            InOutStoreLog("到库位点,旋转轴至P2( 库位点)轴2(上下) 至P3(库位入库前点)");
            ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
            ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
        }
        /// <summary>
        /// 入库失败料盘处理
        /// </summary>
        /// <param name="str"></param>
        private void StartSendTray(string str = "扫码失败", bool ok = false)
        {
            StartMoveTrayBack(str, ok);
            //MoveInfo.NextMoveStep(StoreMoveStep.BI_71_ToNGDoor);
            //InOutStoreLog("NG料,升降轴到NG门口高点P12,旋转轴到NG门口P11");
            ////if(MoveInfo.IsShelfLocked)//锁定料架,扫码失败则清除当前位置
            //{
            //    StoreManager.ClearLockLoc(Name, CurrShelfID, MoveInfo.currShelfIndex);
            //}
            //ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P12, Config.UpDownAxis_P1_Speed);
            //ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P11, Config.MiddleAxis_P1_Speed);
        }
        /// <summary>
        /// 将料盘送回原位
        /// </summary>
        /// <param name="str"></param>
        private void StartMoveTrayBack(string str = "料盘不属于该仓库", bool ok = false)
        {
            MoveInfo.NextMoveStep(StoreMoveStep.SO_10_ToShelfPosition);
            addNGShelfPos(MoveInfo.MoveParam.CurShelfPosID, ok);
            InOutStoreLog($"送出料盘 :{str} ,走到料架位置,旋转轴至P101,升降轴至P102");
            ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_HP102, Config.UpDownAxis_P102_Speed);
            ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P101, Config.MiddleAxis_P101_Speed);
        }
        protected override void InStoreProcess()
        {
            LineMoveP moveP = MoveInfo.MoveParam.MoveP;
            if (MoveInfo.IsInWait)
            {
                CheckWait();
            }
            if (MoveInfo.IsInWait)
            {
                return;
            }

            #region 料架取料盘扫码获取POSID
            if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_10_StartGetTray))
            {
                if (MoveInfo.IsShelfLocked)
                {
                    if (MoveInfo.NextLockedShelfPos())
                    {
                        //新的料架库位
                        startInStoreTime = DateTime.Now;
                        MoveInfo.SingleInstore = false;
                        MoveInfo.NextMoveStep(StoreMoveStep.BI_11_InoutToP1);
                        InOutStoreLog("料架取料,叉子后退到待机点P1, 重置盘信息");
                        ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
                        ClearLastTrayInfo();
                    }
                    else
                    {
                        //所有料盘已取料完成,送出料架
                        StartShelfOut();
                    }
                }
                else
                {
                    if (MoveInfo.NextShelfPos())
                    {
                        //新的料架库位
                        startInStoreTime = DateTime.Now;
                        MoveInfo.SingleInstore = false;
                        MoveInfo.NextMoveStep(StoreMoveStep.BI_11_InoutToP1);
                        InOutStoreLog("料架取料,叉子后退到待机点P1, 重置盘信息");
                        ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
                        ClearLastTrayInfo();
                    }
                    else
                    {
                        //所有料盘已取料完成,送出料架
                        StartShelfOut();
                    }
                }

            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_11_InoutToP1))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_12_MoveToShelf);
                InOutStoreLog("料架取料,升降轴到P101低点[" + moveP.UpDown_LP101 + "],旋转轴到P101点[" + moveP.Middle_P101 + "],压紧轴到压紧前点p3[" + Config.CompAxis_Max_P3 + "]");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_LP101, Config.UpDownAxis_P102_Speed);
                ACAxisMove(Config.Middle_Axis, moveP.Middle_P101, Config.MiddleAxis_P101_Speed);
                ACAxisMove(Config.Comp_Axis, Config.CompAxis_Max_P3, Config.CompAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_12_MoveToShelf))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_13_InoutToP101);
                InOutStoreLog("料架取料,叉子前进到P101点[" + moveP.InOut_P101 + "]");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P101, Config.InOutAxis_P101_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_13_InoutToP101))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_14_UpdownToP102);
                InOutStoreLog("料架取料,升降轴上升到P102点[" + moveP.UpDown_HP102 + "]");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_HP102, Config.UpDownAxis_P101_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_14_UpdownToP102))
            {
                if (MoveInfo.SingleInstore)
                {
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_16_ComDownMove);
                    InOutStoreLog("单盘入库,料架取料,压紧轴走到压紧点P2: " + MoveInfo.MoveParam.MoveP.ComPress_P2);
                    ACAxisMove(Config.Comp_Axis, MoveInfo.MoveParam.MoveP.ComPress_P2, Config.CompAxis_P2_Speed);
                }
                else
                {
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_15_StartCompress);
                    InOutStoreLog("料架取料,压紧轴开始缓慢压紧到P4 :" + Config.CompAxis_P4_Position);
                    MoveInfo.WaitList.Add(WaitResultInfo.WaitComAxis(Config.Comp_Axis, Config.CompAxis_P4_Position, Config.CompAxis_P4_Speed));
                    Config.Comp_Axis.TargetPosition = Config.CompAxis_P4_Position;
                    ACServerManager.AbsMove(Config.Comp_Axis.DeviceName, Config.Comp_Axis.GetAxisValue(), Config.CompAxis_P4_Position, Config.CompAxis_P4_Speed);
                    ComAxisStartCheck();
                }
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_15_StartCompress))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_16_ComDownMove);
                int currPosition = ACServerManager.GetActualtPosition(Config.Comp_Axis);
                ComTargetPosition = currPosition;
                int targetP = currPosition + Config.CompAxis_Down_Position;
                LastHeight = Config.GetComP2PlateH(targetP);
                MoveInfo.MoveParam.MoveP.ComPress_P2 = targetP;
                MoveInfo.MoveParam.MoveP.ComPress_P3 = targetP + Config.CompAxis_P3_P2_Value;
                InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP +
                    "]记录ComP2[" + targetP + "]ComP3[" + MoveInfo.MoveParam.MoveP.ComPress_P3 + "]");

                ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);

            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_16_ComDownMove))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_17_InoutBack);
                InOutStoreLog("料架取料,叉子后退到扫码点");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.CompAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_17_InoutBack))
            {
                if (MoveInfo.SingleInstore)
                {
                    //单盘入库,不需要扫码
                    StartMoveToBag();
                }
                else if (MoveInfo.IsShelfLocked && !IsScanCodeWithLockedShelf)
                {
                    //该料架已锁定库位,不需要扫码,直接查询服务器
                    GetPosId();
                }
                else
                {
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_21_ToScanPosition);
                    InOutStoreLog("扫码,升降轴到P2,旋转轴到P1");
                    ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P1_Speed);
                    ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
                }
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_21_ToScanPosition))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_22_InOutToP2);
                InOutStoreLog("扫码,进出轴到P2");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
            }

            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_22_InOutToP2))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_23_PutTrayDown);
                InOutStoreLog("扫码,升降轴到扫码低点P1,压紧轴到压紧前点P3");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P2_Speed);
                ACAxisMove(Config.Comp_Axis, moveP.ComPress_P3, Config.CompAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_23_PutTrayDown))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_24_InOutToP1);
                InOutStoreLog("扫码,进出轴返回待机点P1");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.CompAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_24_InOutToP1))
            {
                IO_VALUE io1 = IOValue(IO_Type.TrayCheck_1);
                IO_VALUE io2 = IOValue(IO_Type.TrayCheck_2);
                IO_VALUE io3 = IOValue(IO_Type.TrayCheck_3);
                IO_VALUE io4 = IOValue(IO_Type.TrayCheck_4);

                if (io3.Equals(IO_VALUE.HIGH) || io4.Equals(IO_VALUE.HIGH))
                {
                    LastWidth = 15;
                }
                else if (io1.Equals(IO_VALUE.HIGH) || io2.Equals(IO_VALUE.HIGH))
                {
                    LastWidth = 7;
                }
                else
                {
                    LastWidth = 0;
                    LogUtil.error("未检测到识别区料盘检测信号, 设置默认宽度=0");
                }

                MoveInfo.NextMoveStep(StoreMoveStep.BI_25_ScanCode);
                InOutStoreLog("扫码,料盘识别 [" + io1 + "] [" + io2 + "] [" + io3 + "] [" + io4 + "] ,宽度【" + LastWidth + "】,开始扫码");
                MoveInfo.OneWaitCanEndStep = true;
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(12000));
                MoveInfo.WaitList.Add(WaitResultInfo.WaitCode());
                Task.Factory.StartNew(delegate
                {
                    IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
                    LastScanCodes = CodeManager.CameraScan(Config.GetCameraList(), Name);
                    if (LastScanCodes.Count <= 0)
                    {
                        Thread.Sleep(1);
                        LastScanCodes = CodeManager.CameraScan(Config.GetCameraList(), Name);
                    }
                    IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
                });
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_25_ScanCode))
            {
                //if (LastScanCodes.Count <= 0 && LastWidth.Equals(0) && LastHeight.Equals(8))
                //{
                //    storeStatus = StoreStatus.InStoreExecute;
                //    MoveInfo.NextMoveStep(StoreMoveStep.BI_10_StartGetTray);
                //    InOutStoreLog("扫码,扫码失败,尺寸" + LastWidth + "*" + LastHeight + ",认为没拿到料盘,继续循环料架取料盘");
                //}
                //else
                {
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_27_InoutToP2);
                    InOutStoreLog("扫码,进出轴到P2");
                    ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
                }
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_27_InoutToP2))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_28_GetScanPTray);
                InOutStoreLog("扫码,升降轴到扫码高P2,压紧轴到压紧点P2");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
                ACAxisMove(Config.Comp_Axis, moveP.ComPress_P2, Config.CompAxis_P2_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_28_GetScanPTray))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_29_InoutBackP1);
                InOutStoreLog("扫码,进出轴返回");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_29_InoutBackP1))
            {
                if (LastScanCodes.Count <= 0 && LastWidth.Equals(0) && LastHeight.Equals(8))
                {
                    StartSendTray("未检测到料盘",true);
                }
                else if (LastScanCodes.Count <= 0)
                {
                    StartSendTray();
                }
                else
                {
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_30_SetInstoreParam);
                    InOutStoreLog("扫码 ,获取库位号");
                    MoveInfo.WaitList.Add(WaitResultInfo.WaitTime((int)TimeSpan.FromMinutes(75).TotalMilliseconds));
                    bool result = GetPosIdByCode(MoveInfo.currShelfIndex, out CodeResultType codeResult);
                    if (!result)//获取库位失败
                    {
                        if (codeResult == CodeResultType.NotPosForPutIn)//库位不在该料仓,将该料盘放回料架
                        {
                            //MoveInfo.MoveParam.PosID = "";
                            StartMoveTrayBack("此料盘不属于该仓库,放回料架", true);
                        }
                        else//无法获取库位信息
                        {
                            MoveInfo.MoveParam.PosID = "";
                            StartSendTray("获取入库库位失败", false);
                        }
                    }
                    else
                    {
                        MoveInfo.EndStepWait();
                    }
                }
            }


            #endregion

            #region 入库逻辑
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_30_SetInstoreParam))
            {
                StartMoveToBag();
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_51_MoveToBag))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_52_DeviceToBag);
                InOutStoreLog("叉子进入库位中,进出轴到库位P3");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_52_DeviceToBag))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_53_PutWareToBag);
                InOutStoreLog("放下物品,升降轴到库位缓冲点P4,压紧轴到P3");

                // 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)   
                string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
                lastPosId = posId;
                lastPosIdStatus = StoreStatus.InStoreEnd;
                storeStatus = StoreStatus.InStoreEnd;
                //手动发给服务器状态,防止没有手动
                //SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);

                ACAxisMove(Config.Comp_Axis, moveP.ComPress_P3, Config.CompAxis_P3_Speed);
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_53_PutWareToBag))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_54_DeviceBackFromBag);
                InOutStoreLog("叉子从库位中返回,进出轴到P1");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_54_DeviceBackFromBag))
            {
                if (MoveInfo.SingleInstore)
                {
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_55_GoBack);
                    InOutStoreLog("返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始");
                    ACAxisMove(Config.Comp_Axis, moveP.ComPress_P1, Config.CompAxis_P1_Speed);
                    ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
                    ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
                }
                else
                {
                    TimeSpan span = DateTime.Now - startInStoreTime;
                    storeStatus = StoreStatus.InStoreExecute;
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_10_StartGetTray);
                    InOutStoreLog("料架入库,上一盘入库结束, 耗时【" + FormUtil.GetSpanStr(span) + "】,旋转轴返回待机点,继续循环料架取料盘");
                    ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
                }
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_55_GoBack))
            {
                TimeSpan span = DateTime.Now - startInStoreTime;
                StoreManager.ClearLockLoc(Name, CurrShelfID, MoveInfo.currShelfIndex);
                if (MoveInfo.SingleInstore)
                {
                    string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
                    InOutStoreLog("  【" + posId + "】单盘入库结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
                    MoveEndToRuningStatus();
                    AutoInout.InOutEndProcess(this, StoreMoveType.InStore);
                }
                else
                {
                    storeStatus = StoreStatus.InStoreExecute;
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_10_StartGetTray);
                    InOutStoreLog("料架入库,上一盘入库结束, 耗时【" + FormUtil.GetSpanStr(span) + "】继续循环料架取料盘");
                }
            }
            #endregion

            #region 把料盘送到NG口逻辑

            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_71_ToNGDoor))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_72_NGDoorUp);
                InOutStoreLog("NG料,NG升降门上升");
                CylinderMove(MoveInfo, IO_Type.NGDoorCylinder_Down, IO_Type.NGDoowCylinder_Up);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_72_NGDoorUp))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_73_InoutToNGDoor);
                InOutStoreLog("NG料,进出轴到NG料门口位置P11");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P11, Config.InOutAxis_P2_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_73_InoutToNGDoor))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_74_UpdownDown);
                InOutStoreLog("NG料,升降轴到P11,压紧轴到P3,放下料盘");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P11, Config.UpDownAxis_P2_Speed);
                ACAxisMove(Config.Comp_Axis, moveP.ComPress_P3, Config.CompAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_74_UpdownDown))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_75_InoutToP1);
                InOutStoreLog("NG料,叉子后退到P1");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_75_InoutToP1))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_76_NGDoorDown);
                InOutStoreLog("NG料,关门NG料门,送出料盘结束");
                CylinderMove(MoveInfo, IO_Type.NGDoowCylinder_Up, IO_Type.NGDoorCylinder_Down);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_76_NGDoorDown))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_77_NGLineRun);
                InOutStoreLog("料架入库,NG流水线转动30s");
                IOMove(IO_Type.NGLine_BackRun, IO_VALUE.LOW);
                IOMove(IO_Type.NGLine_Run, IO_VALUE.HIGH);
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));

            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_77_NGLineRun))
            {
                IOMove(IO_Type.NGLine_Run, IO_VALUE.LOW);
                MoveInfo.NextMoveStep(StoreMoveStep.BI_10_StartGetTray);
                InOutStoreLog("料架入库,停止NG线体转动,继续循环料架取料盘");
            }
            #endregion

            #region 把料盘送回料架逻辑
            else if (MoveInfo.MoveStep == StoreMoveStep.SO_10_ToShelfPosition)
            {
                MoveInfo.NextMoveStep(StoreMoveStep.SO_11_ToShelf);
                InOutStoreLog("送出料盘,叉子进出料口,进出轴至P101");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P101, Config.InOutAxis_P101_Speed);

            }
            else if (MoveInfo.MoveStep == StoreMoveStep.SO_11_ToShelf)
            {
                MoveInfo.NextMoveStep(StoreMoveStep.SO_12_PutReel);
                InOutStoreLog("送出料盘,放下物品,压紧轴到P1,升降轴至P101,清空 taskData=null ");
                ACAxisMove(Config.Comp_Axis, moveP.ComPress_P1, Config.CompAxis_P1_Speed);
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_LP101, Config.UpDownAxis_P101_Speed);
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
            }
            else if (MoveInfo.MoveStep == StoreMoveStep.SO_12_PutReel)
            {
                MoveInfo.NextMoveStep(StoreMoveStep.SO_13_InoutBack);
                InOutStoreLog("送出料盘,叉子从出料口返回, 进出轴到P1 ");
                InOutBackToP1(moveP.InOut_P1);
            }
            else if (MoveInfo.MoveStep == StoreMoveStep.SO_13_InoutBack)
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_10_StartGetTray);
                InOutStoreLog("送出料盘结束,升降轴返回,升降轴到P1,顶升下降,继续循环料架取料盘");
                //    ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
            }
            #endregion



            //料架进入逻辑
            else if (MoveInfo.MoveStep < StoreMoveStep.BI_10_StartGetTray)
            {
                ShelfEnterProcess();
            }
            //料架送出逻辑
            else if (MoveInfo.MoveStep >= StoreMoveStep.BS_01_TopDown)
            {
                ShelfOutProcess();
            }
            else
            {
                InOutStoreLog("没有对应的处理!");
            }
        }

    }
}