示例#1
0
        private void SetTEMS_InspectionState(TEMS_InspectionStates inspectionState)
        {
            try
            {
                TEMS_State currentTEMS_State = GetTEMS_StateAtPoint(ptLatest);

                if (currentTEMS_State != null)
                {
                    if (_PanelImageSide == PanelImageSides.TH)
                    {
                        currentTEMS_State.TH_InspectionState = inspectionState;
                    }
                    else
                    {
                        currentTEMS_State.BH_InspectionState = inspectionState;
                    }

                    DrawRectangles();
                }
            }

            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
示例#2
0
        public PanelState(string lotID, CSAM_ManualRecipe recipe)
        {
            LotID = lotID;

            int iDeviceCount = recipe.TEMS_Count_X * recipe.TEMS_Count_Y;


            for (int y = 1; y <= recipe.TEMS_Count_Y; y++)
            {
                for (int x = 1; x <= recipe.TEMS_Count_X; x++)
                {
                    int deviceIndex = 0;
                    if (y % 2 == 1)
                    {
                        deviceIndex = x + (y - 1) * recipe.TEMS_Count_X;
                    }
                    else
                    {
                        deviceIndex = (1 + recipe.TEMS_Count_X - x) + (y - 1) * recipe.TEMS_Count_X;
                    }

                    TEMS_State tems_state = new TEMS_State(y, x, deviceIndex);

                    TEMS_States.Add(tems_state);

                    //dictPoint_TEMS_States.Add(new Point(x, y), tems_state);

                    //dictDeviceID_TEMS_States.Add(deviceIndex, tems_state);
                }
            }
        }
示例#3
0
        private System.Drawing.Color GetRectangleColor(TEMS_State tems_state)
        {
            try
            {
                // Never had state set. Bridal white.
                if (tems_state.BH_InspectionState == TEMS_InspectionStates.NA && tems_state.TH_InspectionState == TEMS_InspectionStates.NA)
                {
                    return(System.Drawing.Color.White);
                }

                // Both pass. That's great. Green means go.
                if (tems_state.BH_InspectionState == TEMS_InspectionStates.Pass && tems_state.TH_InspectionState == TEMS_InspectionStates.Pass)
                {
                    return(System.Drawing.Color.Green);
                }

                // Either one fails. This TEM is garbage.
                if (tems_state.BH_InspectionState == TEMS_InspectionStates.Fail || tems_state.TH_InspectionState == TEMS_InspectionStates.Fail)
                {
                    return(System.Drawing.Color.Red);
                }

                // Anything else is indeterminate. But it'd be nice to know that something was good on one side. So if we still don't have a result, we can get specific.

                if (_PanelImageSide == PanelImageSides.TH)
                {
                    if (tems_state.BH_InspectionState == TEMS_InspectionStates.Pass && tems_state.TH_InspectionState == TEMS_InspectionStates.NA)
                    {
                        return(System.Drawing.Color.White);
                    }
                    if (tems_state.BH_InspectionState == TEMS_InspectionStates.NA && tems_state.TH_InspectionState == TEMS_InspectionStates.Pass)
                    {
                        return(System.Drawing.Color.LightGreen);
                    }
                }


                if (_PanelImageSide == PanelImageSides.BH)
                {
                    if (tems_state.TH_InspectionState == TEMS_InspectionStates.Pass && tems_state.BH_InspectionState == TEMS_InspectionStates.NA)
                    {
                        return(System.Drawing.Color.White);
                    }
                    if (tems_state.TH_InspectionState == TEMS_InspectionStates.NA && tems_state.BH_InspectionState == TEMS_InspectionStates.Pass)
                    {
                        return(System.Drawing.Color.LightGreen);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            // If we're down here, I'm not sure what's up. So we go yellow.
            return(System.Drawing.Color.Yellow);
        }
示例#4
0
        private void iboxPanel_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.P)
            {
                TEMS_State currentTEMS_State = GetTEMS_StateAtPoint(ptLatest);
                currentTEMS_State.SetInspectionState(_PanelImageSide, TEMS_InspectionStates.Pass);
                DrawRectangles();
            }

            if (e.KeyCode == Keys.F)
            {
                TEMS_State currentTEMS_State = GetTEMS_StateAtPoint(ptLatest);
                currentTEMS_State.SetInspectionState(_PanelImageSide, TEMS_InspectionStates.Fail);
                DrawRectangles();
            }

            if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
            {
                TEMS_State currentTEMS_State = GetTEMS_StateAtPoint(ptLatest);
                currentTEMS_State.SetInspectionState(_PanelImageSide, TEMS_InspectionStates.NA);
                DrawRectangles();
            }

            if (e.KeyCode == Keys.Space)
            {
                TEMS_State            currentTEMS_State = GetTEMS_StateAtPoint(ptLatest);
                TEMS_InspectionStates currentState      = currentTEMS_State.GetInspectionState(_PanelImageSide);
                TEMS_InspectionStates targetState       = TEMS_InspectionStates.NA;
                if (currentState == TEMS_InspectionStates.NA)
                {
                    targetState = TEMS_InspectionStates.Pass;
                }
                if (currentState == TEMS_InspectionStates.Pass)
                {
                    targetState = TEMS_InspectionStates.Fail;
                }
                currentTEMS_State.SetInspectionState(_PanelImageSide, targetState);
                DrawRectangles();
            }
        }
示例#5
0
        private void CalculateRectangles()
        {
            try
            {
                // If we don't have corners, don't draw rectangles.
                if (ptLowerLeft == ptDefault || ptUpperLeft == ptDefault || ptLowerRight == ptDefault || ptUpperRight == ptDefault)
                {
                    return;
                }

                int allTemsWidth  = (int)(((ptUpperRight.X - ptUpperLeft.X) + (ptLowerRight.X - ptLowerLeft.X)) / 2);
                int allTemsHeight = (int)(((ptLowerRight.Y - ptUpperRight.Y) + (ptLowerLeft.Y - ptUpperLeft.Y)) / 2);

                // We have corners. We know how many devices. Calculate rectangles.
                int rectWidth  = (int)(allTemsWidth / recipe.TEMS_Count_X);
                int rectHeight = (int)(allTemsHeight / recipe.TEMS_Count_Y);


                for (int y = 1; y <= recipe.TEMS_Count_Y; y++)
                {
                    for (int x = 1; x <= recipe.TEMS_Count_X; x++)
                    {
                        int deviceIndex = 0;
                        if (y % 2 == 1)
                        {
                            deviceIndex = x + (y - 1) * recipe.TEMS_Count_X;

                            if (_PanelImageSide == PanelImageSides.BH)
                            {
                                deviceIndex = (1 + recipe.TEMS_Count_X - x) + (y - 1) * recipe.TEMS_Count_X;
                            }
                        }
                        else
                        {
                            deviceIndex = (1 + recipe.TEMS_Count_X - x) + (y - 1) * recipe.TEMS_Count_X;

                            if (_PanelImageSide == PanelImageSides.BH)
                            {
                                deviceIndex = x + (y - 1) * recipe.TEMS_Count_X;
                            }
                            ;
                        }


                        // Upper left corner of the rectangle.
                        int xCoord = (int)((allTemsWidth * (x - 1)) / recipe.TEMS_Count_X);
                        int yCoord = (int)((allTemsHeight * (y - 1)) / recipe.TEMS_Count_Y);

                        xCoord += ptUpperLeft.X;
                        yCoord += ptUpperLeft.Y;

                        OpenCvSharp.Point pt = new OpenCvSharp.Point(xCoord, yCoord);
                        //OpenCvSharp.Point pt = new OpenCvSharp.Point(ptUpperLeft.X + ((x - 1) * rectWidth), ptUpperLeft.Y + ((y - 1) * rectHeight));

                        if (_PanelImageSide == PanelImageSides.TH)
                        {
                            TEMS_State tems_state = _PanelState.GetTEMS_State(deviceIndex);
                            tems_state.TH_Rect = new Rect(pt, new OpenCvSharp.Size(rectWidth, rectHeight));
                        }


                        if (_PanelImageSide == PanelImageSides.BH)
                        {
                            TEMS_State tems_state = _PanelState.GetTEMS_State(deviceIndex);
                            tems_state.BH_Rect = new Rect(pt, new OpenCvSharp.Size(rectWidth, rectHeight));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }