Ejemplo n.º 1
0
        public void Test_MainMethod(EnumMacMaskBoxType boxType, bool getComeraShot, DrawerReplaceBoxPlace drawerReplaceBoxPlace)
        {
            /** Index & array
             * [0]   [1]  [2]
             * 1-2,  1-3, 1-4     IP: 31~33
             * ------------------
             * [3]   [4]  [5]
             * 2-2,  2-3, 2-4,    IP: 41~43
             * ------------------
             * [6]   [7]  [8]
             * 3-2,  3-3, 3-4,    IP: 51~53
             * ----------------
             * [9]   [10] [11]
             * 4-2,  4-3, 4-4,    IP: 61~63
             * ------------------
             * [12]  [13] [14]
             * 5-2,  5-3, 5-4,    IP: 71~73
             * ------------------
             * [15]  [16] [17]
             * 6-2,  6-3, 6-4,    IP: 81~83
             *--------------------
             * [18]  [19]
             * 7-2,  7-3,         IP: 91~92
             */


            if (InitialError)
            {
                var message = InitialErrorMessage;
                return;
            }

            int BREAK_POINT = 0;


            // Connect, 所有Drawer
            var failedConnectDrawers = HalContext.DrawersConnect();


            int start = 2; // 0; // 3-2~ 4-4
            int end   = 6; // DrawerKeys.Count;// DrawerKeys.Count;

            //int end = DrawerKeys.Count;
            for (var i = start; i < end; i++)
            {
                var drawerKey      = DrawerKeys[i];
                var drawerLocation = DrawerLocations[i];
                try
                {
                    var           drawer         = HalContext.GetDrawer(drawerKey);
                    IMacHalDrawer previousDrawer = null;
                    var           drawerHome     = drawerLocation.GetCabinetHomeCode().Item2;

                    if (i != start)
                    {
                        // 取得前一個 Drawer
                        previousDrawer = HalContext.GetDrawer(DrawerKeys[i - 1]);
                        // 將前一個 Drawer Tray 移回 Home 點
                        previousDrawer.MoveTrayToHome();
                        // 將 前一個 Drawer 移到可以 抽換 Box 的位置
                        if (drawerReplaceBoxPlace == DrawerReplaceBoxPlace.In)
                        {
                            previousDrawer.MoveTrayToIn();
                        }
                        else
                        {
                            previousDrawer.MoveTrayToOut();
                        }
                    }

                    /** 004-01 光罩盒在 Drawer 內 */
                    drawer.Initial();
                    // 將 目前 Drawer 的 Tray 移到可抽換Box 的位置
                    if (drawerReplaceBoxPlace == DrawerReplaceBoxPlace.In)
                    {
                        drawer.MoveTrayToIn();
                    }
                    else
                    {
                        drawer.MoveTrayToOut();
                    }


                    BREAK_POINT++;// [[[[[[[[一定要暫停]]]]]]]]]]]]     將 Box 放入 Tray 中 (如果是第2個及第2個以後的 Drawer, 將 盒子從前一個測試的 Drawer 取出來, 放到這個 Drawer 當中)

                    // 前個 Drawer Tray 回 Home
                    if (previousDrawer != null)
                    {
                        previousDrawer.MoveTrayToHome();
                    }


                    /** 004-02  Drawer 往機台內部移動 到Box Robot 可以存光罩鐵盒的位置 */
                    // Drawer Tray 回 Home
                    drawer.MoveTrayToHome();
                    // Drawer Tray 移到  Box Robot 可以取得 光罩鐵盒的位置
                    drawer.MoveTrayToIn();


                    BREAK_POINT++;  // 確試 Drawer Tray  已經移到 In

                    /** 004-03 Box Robot 從Home 點至Drawer 夾取點, 進行光罩鐵盒夾取(Clamp光鐵盒)*/
                    // BoxRobot 回 Cabinet 1 Home
                    HalBoxTransfer.TurnToCB1Home();
                    // Drawer 04-01 ~ Drawer 07-05 回 Cabitnet 1 Home 轉向 Cabitnet 2 Home
                    if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                    {
                        HalBoxTransfer.TurnToCB2Home();
                    }
                    filePath = pathFileObj.GetFromCabinetHomeToDrawerGetPath(drawerLocation);
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++;  // 確認 BoxTransfer 是否到了Drawer
                    // 夾取
                    HalBoxTransfer.Clamp((uint)boxType);


                    BREAK_POINT++;  // 確認 Box robot 是否夾到了 盒子

                    /**004-04. Box Robot 將光罩盒從Drawer 移動到Open stage Entry</para>*/
                    // Box robot 回 Home
                    filePath = pathFileObj.GetFromDrawerToCabitnetHomeGetPath(drawerLocation);
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++;  // 確認 Box robot 是否到了   Cabinet 1( or 2) Home

                    //  Drawer 04-01 ~ Drawer 07-05 回 Cabitnet 1 Home
                    if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                    {
                        HalBoxTransfer.TurnToCB1Home();
                        BREAK_POINT++;  // 確認 Box robot 是否到了   Cabinet 1 Home
                    }


                    // OpenStage 入侵
                    HalOpenStage.SetRobotIntrude(true, null);
                    //HalOpenStage.SortUnclampAndLock();

                    BREAK_POINT++; // 確認 OPen Stage 的狀態是否可以放入盒子

                    // Boxrobot 移到 Open Stage
                    filePath = pathFileObj.FromCabinet01HomeToOpenStage_PUT_PathFile();
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++; // 確認 BOx Robot 是否已到Open Stage


                    /** 004-05. Drawer 回到Cabinet 內 */
                    drawer.MoveTrayToHome();

                    /** 004-06. Box Robot將光罩盒放在 Open Stage平台上 */
                    HalBoxTransfer.Unclamp();

                    /** 004-07.Box Robot(無夾持光罩盒) 從Open Stage 移回 Home 點*/
                    // Boxrobot 回 Cabitnet 1 Home
                    filePath = pathFileObj.FromOpenStageToCabinet01Home_PUT_PathFile();
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++;// 確認 BoxRobot 是否回到 Cabitnet 1 Home

                    // 解除 Open Stage 入侵
                    HalOpenStage.SetRobotIntrude(false, null);

                    BREAK_POINT++;//

                    // HalOpenStage.SetBoxTypeAndSortClamp(boxType);

                    //BREAK_POINT++;// 確認 OPenStage  是否  已固定

                    /** 005-01 光罩鐵盒位於於Open Stage平台上 */
                    // 目視, 確認
                    BREAK_POINT++;

                    /** 005-02. Drawer往機台內部移動到Box Robot可以存取光罩鐵盒的位置 */
                    drawer.MoveTrayToIn();

                    BREAK_POINT++;// 確認 Drawer Tray 是否在 In

                    /** 005-03. Box Robot從Home點至Open Stage進行光罩鐵盒夾取*/
                    // 入侵 OpenStage
                    HalOpenStage.SetRobotIntrude(true, null);
                    //  HalOpenStage.SortUnclampAndLock();

                    BREAK_POINT++;// 確認 Open Stage 是否已經放開鐵盒 ?

                    // Boxrobot 移到 Open Stage
                    filePath = pathFileObj.FromCabinet01HomeToOpenStage_GET_PathFile();
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++; // 確認 Boxrobot 是否已經到了 Cabitnet 1 Home

                    // Clamp
                    HalBoxTransfer.Clamp((uint)boxType);

                    BREAK_POINT++; // 確認 Boxrobot 已經夾到盒子

                    /** 005-04. Box Robot將光罩鐵盒從Open Stage夾取並放置於Drawer內 (release光罩鐵盒)*/
                    // Boxrobot 回到 Cabinet 1 Home
                    filePath = pathFileObj.FromOpenStageToCabinet01Home_GET_PathFile();
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++; // 確認Boxrobot 已經到 Cabitnet 1 HOme

                    // 解除 入侵
                    HalOpenStage.SetRobotIntrude(false, null);

                    BREAK_POINT++;

                    if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                    {                  // Drawer 04-01 ~ Drawer 07-05 , Boxrobot 移到 Cabinet 2 Home
                        HalBoxTransfer.TurnToCB2Home();
                        BREAK_POINT++; // 確認Boxrobot 已經到 Cabitnet 2 HOme
                    }

                    // Boxrobot 移到 Drawer
                    filePath = pathFileObj.GetFromCabinetHomeToDrawerPutPath(drawerLocation);
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++; // 1. 確認 DRAWER Tray 是否在In, 2.確認 BoxTRansfer 是否到位

                    // Unclamp
                    HalBoxTransfer.Unclamp();

                    BREAK_POINT++;// 確認 Box 是否已在 Tray 上

                    /** 005-05. Box Robot退回Home點 */
                    // Boxrobot 回 Home 點
                    filePath = pathFileObj.GetFromDrawerToCabitnetHomePutPath(drawerLocation);
                    HalBoxTransfer.Move(filePath);

                    BREAK_POINT++; //Box robot  是否到了 Cabinet 1(or 2) Home
                    if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                    {              // Drawer 04-01 ~ Drawer 07-05, Boxrobot 回 Cabitnet 2 Home
                        HalBoxTransfer.TurnToCB1Home();

                        BREAK_POINT++; //Box robot  是否到了 Cabinet 1 Home
                    }


                    /** 005-06. Drawer回到Cabinet內 */
                    drawer.MoveTrayToHome();

                    /** 005-07 測試(編號13-CCD): 開啟光源 -> 拍照-> 關閉光源, 功能是否正常 */
                    if (getComeraShot)
                    {
                        // 2-07.測試(編號13-CCD): 開啟光源 -> 拍照-> 關閉光源, 功能是否正常
                        var lightValue = HalBoxTransfer.GetCameraLightValue(boxType);
                        var resultTemp = HalBoxTransfer.CameraShot("D:/Image/BT/Gripper", "jpg", lightValue);
                    }


                    /** 999999 ok*/
                    BREAK_POINT++;  //[[[[[[[[[[[[[[[[[[一定要暫停]]]]]]]]]]]]]]]]]]]]]]]]]] 準備下一個
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("EX=" + ex.Message);
                }
            }

            //  Repeat();
        }
Ejemplo n.º 2
0
        [DataRow(EnumMacMaskBoxType.IronBox, false)] // 鐵盒
        //[DataRow(BoxType.CrystalBox,false)]// 水晶盒
        public void Test_Ut001_BT(EnumMacMaskBoxType boxType, bool autoConnect)
        {
            var BREAK_POINT = 0;

            using (var halContext = MacHalContextExtends.Create_MacHalContext_Instance())
            {
                try
                {
                    var universal   = halContext.GetUniversalAssembly(autoConnect);
                    var boxTransfer = halContext.GetBoxTransferAssembly(autoConnect);
                    var cabinet     = halContext.GetCabinetAssembly(autoConnect);
                    var openStage   = halContext.GetOpenStageAssembly(autoConnect);

                    if (!autoConnect)
                    {
                        universal.HalConnect();
                        boxTransfer.HalConnect();
                        cabinet.HalConnect();
                        openStage.HalConnect();
                    }

                    // Initial OpenStage
                    openStage.Initial();
                    openStage.SetBoxType((uint)boxType);
                    openStage.SortClamp();
                    // Initial BoxTransfer
                    boxTransfer.Initial();
                    // 關燈
                    boxTransfer.TurnOffCameraLight();


                    // connect 所有 Drawer
                    halContext.DrawersConnect();



                    for (int i = 0; 0 < DrawerKeys.Count; i++)
                    {
                        try
                        {
                            // 取得 Drawer
                            var drawer = halContext.GetDrawer(DrawerKeys[i]);
                            // Drawer  代碼
                            var drawerLocation = DrawerLocations[i];
                            // Drawer Home
                            var drawerHome = DrawerLocations[i].GetCabinetHomeCode().Item2;
                            // Drawer Initial
                            drawer.Initial();
                            // boxTransfer 轉向 Cabitnet 1 Home
                            boxTransfer.TurnToCB1Home();


                            BREAK_POINT = 0;


                            /** 1 光罩鐵盒放置於Open Stage平台上*/


                            BREAK_POINT = 0;   // 確認 光罩鐵盒放置於Open Stage平台上*/


                            /** 2. Drawer往機台內部移動到光罩盒可放置的位置 */
                            // 將 Drawer 的Tray 移到 In
                            drawer.MoveTrayToIn();


                            BREAK_POINT = 0;

                            /** 3. Box Robot從Home點至Open Stage進行光罩鐵盒夾取*/
                            //  3.1 能否入侵 Open Stage?
                            openStage.SetRobotIntrude(true, null);
                            //  3.2 將 Boxrobot 移到 OpenStage
                            var path = pathFileObj.FromCabinet01HomeToOpenStage_GET_PathFile();
                            openStage.SortUnclamp();
                            openStage.Lock();
                            boxTransfer.Move(path);

                            boxTransfer.Clamp((uint)boxType);

                            BREAK_POINT = 0;

                            /** 4. Box Robot從Open Stage夾持光罩至Drawer放置點位之前一個點位 (暫且定義為 CB1 Home 或CB2 Home) */
                            path = pathFileObj.FromOpenStageToCabinet01Home_GET_PathFile();
                            boxTransfer.Move(path);
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {
                                boxTransfer.TurnToCB2Home();
                            }

                            #region 拍照 , 移到 6~7 間
                            // 5. (編號13-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源, 確認Drawer中無光罩盒
                            #endregion


                            BREAK_POINT = 0;

                            /** 6. Box Robot從Open Stage夾持光罩至Drawer放置點位 (不做放置光罩鐵盒於drawer的動作) */
                            //  將 BoxRobot 移到 Drawer
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home)
                            {
                                path = pathFileObj.FromCabinet01HomeToDrawer_PUT_PathFile(drawerLocation);
                            }
                            else  //if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {
                                boxTransfer.TurnToCB2Home();

                                path = pathFileObj.FromCabinet02HomeToDrawer_PUT_PathFile(drawerLocation);
                            }


                            boxTransfer.Move(path);

                            //  拍照
                            //  boxTransfer.CameraShot("Ut001_BT_" + drawerLocation);


                            BREAK_POINT = 0;


                            /** 7. Box Robot夾持光罩回到Drawer entry點位 (目前没有 teach Drawer entry 點 這個點位, 改以 回到 CB1_HOME 或 CB2_Home)*/
                            //   7.1 以Get 方式回到 Cb1Home(目前有盒子)
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home)
                            {  // cabinet 1
                                path = pathFileObj.FromDrawerToCabinet01Home_GET_PathFile(drawerLocation);
                            }
                            else if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {   // cabinet 2
                                path = pathFileObj.FromDrawerToCabinet02Home_GET_PathFile(drawerLocation);
                            }
                            boxTransfer.Move(path);
                            //   7.2 如果 Drawer 是 Cabinet 2的Drawer, 再回到 Cabitnet 1 Home
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {
                                boxTransfer.TurnToCB1Home();
                            }
                            //   7.3 檢查入侵到 Open Stage
                            openStage.SetRobotIntrude(true, null); // 入侵
                            path = pathFileObj.FromCabinet01HomeToOpenStage_PUT_PathFile();
                            //    7.4 BoxTransfer 移到 OpenStage
                            boxTransfer.Move(path);
                            //   7.5 放下盒子
                            boxTransfer.Unclamp();    // => 第二 個以後Drawer(01_03, 01_04 ,......, 07_03)  的 1.
                            //   7.6 Box robot 回CB1Home
                            path = pathFileObj.FromOpenStageToCabinet01Home_PUT_PathFile();
                            boxTransfer.Move(path);



                            BREAK_POINT = 0;


                            // 8. Drawer回到Cabinet內
                            drawer.MoveTrayToHome();

                            // 9. 重複1~8步驟, 完成20個Drawer的光罩鐵盒的移動測試(下個 Cycle)
                            //10.重複1~8步驟, 完成20個Drawer的光罩水晶盒的移動測試
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                    MvaLog.WarnNs(this, ex);
                }
            };
        }
Ejemplo n.º 3
0
        [DataRow(EnumMacMaskBoxType.IronBox, true, DrawerReplaceBoxPlace.In)] // 鐵盒
        //[DataRow(BoxType.CrystalBox,true)]  // 水晶盒
        public void TestMethod1(EnumMacMaskBoxType boxType, bool autoConnect, DrawerReplaceBoxPlace drawerReplaceBoxPlace)
        {
            var BREAK_POINT = 0;

            using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real"))
            {
                /** Index & array
                 * [0]   [1]  [2]
                 * 1-2,  1-3, 1-4     IP: 31~33
                 * ------------------
                 * [3]   [4]  [5]
                 * 2-2,  2-3, 2-4,    IP: 41~43
                 * ------------------
                 * [6]   [7]  [8]
                 * 3-2,  3-3, 3-4,    IP: 51~53
                 * ----------------
                 * [9]   [10] [11]
                 * 4-2,  4-3, 4-4,    IP: 61~63
                 * ------------------
                 * [12]  [13] [14]
                 * 5-2,  5-3, 5-4,    IP: 71~73
                 * ------------------
                 * [15]  [16] [17]
                 * 6-2,  6-3, 6-4,    IP: 81~83
                 *--------------------
                 * [18]  [19]
                 * 7-2,  7-3,         IP: 91~92
                 */

                halContext.MvaCfBootup();
                halContext.MvaCfLoad();

                try
                {
                    var    uni            = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp;
                    var    bt             = halContext.HalDevices[EnumMacDeviceId.boxtransfer_assembly.ToString()] as MacHalBoxTransfer;
                    var    os             = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage;
                    string btMovePathFile = default(string);

                    uni.HalConnect();
                    bt.HalConnect();
                    os.HalConnect();


                    halContext.DrawersConnect();
                    //bt.Reset();
                    bt.Initial();
                    //bt.TurnToCB1Home();
                    int start = 8;
                    int end   = 10;

                    for (var i = start; i < end; i++)
                    {
                        try
                        {
                            var           drawerLocation = DrawerLocations[i];
                            var           drawer         = halContext.GetDrawer(DrawerKeys[i]);
                            IMacHalDrawer previousDrawer = null;
                            var           drawerHome     = drawerLocation.GetCabinetHomeCode().Item2;
                            /** 00 預先動作, 如有上一輪的 Drawer, 將上一輪的 Drawer 推回到 Out , 取出 Box, 將Box放到現在的 Drawer Tray中, 並將 Tray 放回 Home */
                            // 0.1 如有上一輪的 Drawer, 將其 Tray 移到 可抽換 box 的位置
                            if (i > start)
                            {
                                previousDrawer = halContext.GetDrawer(DrawerKeys[i - 1]);
                                previousDrawer.MoveTrayToHome();
                                if (drawerReplaceBoxPlace == DrawerReplaceBoxPlace.In)
                                {
                                    previousDrawer.MoveTrayToIn();
                                }
                                else
                                {
                                    previousDrawer.MoveTrayToOut();
                                }
                            }
                            // 0.2 將目前的  Drawer Tray Initial
                            drawer.Initial();
                            // 0.3 將 目前的  Drawer Tray 移回 可以置換 Drawer 的地方
                            if (drawerReplaceBoxPlace == DrawerReplaceBoxPlace.In)
                            {
                                drawer.MoveTrayToIn();
                            }
                            else
                            {
                                drawer.MoveTrayToOut();
                            }


                            /**1. 光罩盒置於 Drawer內*/
                            BREAK_POINT++; //[[[[[[[[[[[[[[[[[[一定要暫停]]]]]]]]]]]]]]]]]]]]]]]]]]   確認有 Box後往下執行
                            // 1.1 如有上一個  Drawer, 將上一個 Drawer 移到 Home
                            if (previousDrawer != null)
                            { //
                                previousDrawer.MoveTrayToHome();;
                            }
                            // 1.2 Drawer Tray 往機台內部移動到可以取得光罩的位置
                            drawer.MoveTrayToHome();
                            drawer.MoveTrayToIn();

                            /** 02 Box Robot從Home點至Drawer entry處*/
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home)
                            {                                                                                        // Drawer 01-01 ~ Drawer 03-05
                                bt.TurnToCB1Home();
                                btMovePathFile = pathFileObj.FromCabinet01HomeToDrawer_GET_PathFile(drawerLocation); // Box Transfer 要去 Drawer 夾盒子, 所以用 GET
                            }
                            else //if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {   // // Drawer 04-01 ~ Drawer 07-05
                                //Cabinet 2 Drawer 的 Path
                                bt.TurnToCB1Home();
                                bt.TurnToCB2Home();
                                btMovePathFile = pathFileObj.FromCabinet02HomeToDrawer_GET_PathFile(drawerLocation); // Box Transfer 要去 Drawer 夾盒子, 所以用 GET
                            }
                            bt.Move(btMovePathFile);

                            /** 03 (編號13-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/

                            try
                            {
                                var lightValue = bt.GetCameraLightValue(boxType);
                                bt.LightForGripperSetValue(lightValue);
                                bt.Camera_CapToSave("D:/Image/BT/Gripper", "jpg");
                                //bt.LightForGripper(0);
                            }
                            catch (Exception ex)
                            {
                                MvaLog.WarnNs(this, ex);
                            }
                            finally
                            {
                                bt.LightForGripperSetValue(0);
                            }
                            //    bt.Clamp((uint)boxType);
                            //var lightValue = bt.GetCameraLightValue(boxType);
                            //var resultTemp=bt.CameraShot("D:/Image/BT/Gripper", "jpg",lightValue);


                            /** 04 Box Robot從Drawer Entry處移至Drawer內進行光罩鐵盒夾取*/
                            var resultTemp = bt.Clamp((uint)boxType);

                            /** 05 光罩鐵盒夾取前確認Box Robot是水平狀態 (by 水平儀)*/
                            var Level = bt.ReadLevelSensor();

                            /** 06 Box Robot將光罩鐵盒從Drawer移動至Open Stage上方*/
                            // 6.1 回到 Cabinet 1 Home
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home)
                            {
                                btMovePathFile = pathFileObj.FromDrawerToCabinet01Home_GET_PathFile(drawerLocation); // Box Transfer 夾到盒子後,由 Drawer 回到 Home, 用GET
                                bt.Move(btMovePathFile);
                            }
                            else // if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {   // Drawer 04_01~07~05 回到  Cabinet 1 Home
                                btMovePathFile = pathFileObj.FromDrawerToCabinet02Home_GET_PathFile(drawerLocation);// Box Transfer 夾到盒子後,由 Drawer 回到 Home, 用GET
                                bt.Move(btMovePathFile);
                                bt.TurnToCB1Home();
                            }

                            // 6.2 boxrobot 移到 OpenStage
                            os.SetRobotIntrude(true, null);
                            btMovePathFile = pathFileObj.FromCabinet01HomeToOpenStage_PUT_PathFile(); // boxrobot 目前有盒子, 要到 Open Stage, 用PUT
                            bt.Move(btMovePathFile);

                            /** 07 光罩鐵盒放置前確認Box Robot是水平狀態 (by 水平儀)*/
                            Level = bt.ReadLevelSensor();

                            /** 08 Box Robot將光罩鐵盒放置於Open Stage上*/
                            bt.Unclamp();

                            /** 09 Box Robot退出Open Stage, 並回到Box Robot Home點*/
                            btMovePathFile = pathFileObj.FromOpenStageToCabinet01Home_PUT_PathFile();
                            bt.Move(btMovePathFile);
                            os.SetRobotIntrude(false, null);

                            /** 10 (編號9-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/

                            /**
                             * os.LightForTopBarDfsSetValue(200);
                             * os.Camera_Top_CapToSave("D:/Image/OS/Top", "jpg");
                             * os.LightForTopBarDfsSetValue(0);
                             */
                            try
                            {
                                os.LightForFrontBarDfsSetValue(85); //bar 0~255
                                os.LightForSideBarDfsSetValue(140); //bar 0~255
                                os.LightForTopBarDfsSetValue(20);   //bar 0~255
                                os.Camera_Top_CapToSave("D:/Image/OS/Top", "jpg");
                                Debug.WriteLine("Open Stage Camera Shot(Top) OK");
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine("Open Stage Camera Shot(Top) Error=" + ex.Message);
                            }
                            finally
                            {
                                os.LightForFrontBarDfsSetValue(0);
                                os.LightForSideBarDfsSetValue(0);
                                os.LightForTopBarDfsSetValue(0);
                            }



                            /** 11 (編號12-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/

                            /**
                             * os.LightForSideBarDfsSetValue(200);
                             * os.Camera_Side_CapToSave("D:/Image/OS/Side", "jpg");
                             * os.LightForSideBarDfsSetValue(0);
                             */
                            try
                            {
                                os.LightForFrontBarDfsSetValue(85); //bar 0~255
                                os.LightForSideBarDfsSetValue(140); //bar 0~255
                                os.LightForTopBarDfsSetValue(20);   //bar 0~255
                                os.Camera_Side_CapToSave("D:/Image/OS/Side", "jpg");

                                Debug.WriteLine("Open Stage Camera Shot OK");
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine("Open Stage Camera Shot(Side) Error=" + ex.Message);
                            }
                            finally
                            {
                                os.LightForFrontBarDfsSetValue(0);
                                os.LightForSideBarDfsSetValue(0);
                                os.LightForTopBarDfsSetValue(0);
                            }

                            /** 12 Box Robot(無夾持光罩鐵盒)從Home點移動進入Open Stage上方*/
                            os.SetRobotIntrude(true, null);
                            btMovePathFile = pathFileObj.FromCabinet01HomeToOpenStage_GET_PathFile();
                            bt.Move(btMovePathFile);

                            /** 13 光罩鐵盒夾取前確認Box Robot是水平狀態 (by 水平儀)*/
                            Level = bt.ReadLevelSensor();

                            /** 14 Box Robot從Open Stage上方夾取光罩鐵盒*/
                            bt.Clamp((uint)boxType);

                            /** 15 Box Robot將光罩鐵盒移動至Drawer處*/
                            // 15.1 Boxrobot 移到 Cabitnet 1 Home
                            btMovePathFile = pathFileObj.FromOpenStageToCabinet01Home_GET_PathFile(); // boxrobot 目前有盒子,要回到 Cabinet 1 Home, 用 GET
                            bt.Move(btMovePathFile);
                            os.SetRobotIntrude(false, null);
                            // 15.2
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home)
                            {                                                                                        // drawer 01-01 ~ drawer 03-05
                                btMovePathFile = pathFileObj.FromCabinet01HomeToDrawer_PUT_PathFile(drawerLocation); // boxrobot 目前有盒子,要到 Drawer, 所以用 PUT
                                bt.Move(btMovePathFile);
                            }
                            else //if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {
                                // drawer 04-01 ~ drawer 07-05
                                bt.TurnToCB2Home();
                                btMovePathFile = pathFileObj.FromCabinet02HomeToDrawer_PUT_PathFile(drawerLocation); // boxrobot 目前有盒子,要到 Drawer, 所以用 PUT
                                bt.Move(btMovePathFile);
                            }


                            /** 16 (編號13-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/
                            try
                            {
                                var lightValue = bt.GetCameraLightValue(boxType);
                                bt.LightForGripperSetValue(lightValue);
                                bt.Camera_CapToSave("D:/Image/BT/Gripper", "jpg");
                            }
                            catch (Exception ex)
                            {
                                MvaLog.WarnNs(this, ex);
                            }
                            finally
                            {
                                bt.LightForGripperSetValue(0);
                            }

                            //lightValue = bt.GetCameraLightValue(boxType);
                            //resultTemp= bt.CameraShot("D:/Image/BT/Gripper", "jpg", lightValue);

                            /** 17 Box Robot將光罩鐵盒移動至Drawer內*/
                            bt.Unclamp();

                            /** 18 Box Robot (無夾持光罩鐵盒) 從Drawer移回Home點*/
                            // 18.1 Boxrobot 移回 Home 點
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home)
                            {
                                btMovePathFile = pathFileObj.FromDrawerToCabinet01Home_PUT_PathFile(drawerLocation); //
                            }
                            else //if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {
                                btMovePathFile = pathFileObj.FromDrawerToCabinet02Home_PUT_PathFile(drawerLocation); // T
                            }
                            bt.Move(btMovePathFile);

                            // 18.2 Drawer 04-01 ~ Drawer 07-05 時 Boxrobot 轉回 Cabitnet 1 Home
                            if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home)
                            {
                                bt.TurnToCB1Home();
                            }


                            // drawer.CommandINI();
                            /** 19 重複1~18步驟, 完成20個Drawer的光罩鐵盒測試*/
                            /** 20 重複1~19步驟, 完成20個Drawer的光罩水晶盒測試*/

                            BREAK_POINT++; // [一定要暫停] 這個 drawer 做好了, 準備下一個
                        }
                        catch (Exception ex)                       { MvaLog.WarnNs(this, ex); }
                    }
                }
                catch (Exception ex)                { MvaLog.WarnNs(this, ex); }
            }
        }