Example #1
0
        //*******************************************************************************
        //   Function Name : subUnitTable
        //   Description   : 콤보박스의 선택된 유닛의 테이블을 만듬.
        //   Parameters    : ddtUnit = 그리드에 뿌려줄 테이블,
        //                   dintComboIndex = 콤보 박스의 선택된 인덱스
        //   Return Value  :
        //   Special Notes : None
        //*******************************************************************************
        //   2007/03/19         박 근 태
        //*******************************************************************************
        public void subAddColumnsUnitTb()
        {
            try
            {
                int dintLoop = 0;           //Loop를 돌리기 위함.
                //pdtUnitTable.Clear();
                //grdAlarmList.DataSource = null;
                pdtUnitTable.Columns.Clear();
                //pdtUnitTable에 컬럼값들을 추가함.
                pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "LOTID", "LOTID");
                pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "SlotID", "SlotID");
                pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "GLSID", "GLSID");

                //pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "UnitID", "UnitID");
                //pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "CSTID", "CSTID");
                //pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "LOTIndex", "LOTIndex");
                //pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "GLSStartTime", "GLSStartTime");
                //pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "DLPPID", "DLPPID");
                //pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, "ACPPID", "ACPPID");

                //if (PintComboIndex > 0 && PintComboIndex < 13)
                //{
                for (dintLoop = 1; dintLoop <= PInfo.Unit(0).SubUnit(0).GLSAPDCount; dintLoop++)
                {
                    //pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, PInfo.Unit(PintComboIndex).SubUnit(0).GLSAPD(dintLoop).Name, PInfo.Unit(PintComboIndex).SubUnit(0).GLSAPD(dintLoop).Name);
                    pdtUnitTable = PclsDataGridView.funAddColumn(pdtUnitTable, PInfo.Unit(0).SubUnit(0).GLSAPD(dintLoop).Name, PInfo.Unit(0).SubUnit(0).GLSAPD(dintLoop).Name);
                }
                //}
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Example #2
0
        //로딩시 실행되는 함수
        #region subFormLoad

        //*******************************************************************************
        //  Function Name : subFormLoad()
        //  Description   : Base 폼의 Load를 호출하여 폼을 초기화 한다.
        //  Parameters    :
        //  Return Value  :
        //  Special Notes : 폼이 안보이다가 보이게 될 경우 실행된다.
        //*******************************************************************************
        //  2007/01/31          어 경태         [L 00]
        //  2007/03/09          최 성원
        //  2007/03/22          박 근태
        //*******************************************************************************
        public void subFormLoad()
        {
            string dstrLOTName   = "";      //DB에 추가되는 컬럼네임을 LOTAPD테이블에 추가하기 위한 변수.
            int    dintLOTAPDCnt = 0;

            try
            {
                //DB에 등록되 있는 LOTAPD의 갯수를 가져온다.
                dintLOTAPDCnt = PInfo.Unit(0).SubUnit(0).LOTAPDCount;
                //CommonListView (부모) 함수를 호출한다.
                subFormLoad("LOTAPD");

                //컬럼헤더의 높이값을 정한다.
                grdAlarmList.ColumnHeadersHeight = 27;



                //LOTAPTCount가 달라지면 테이블의 컬럼을 새로 만든다.
                //if (dintLOTAPDTmp != dintLOTAPDCnt)
                //{
                //    this.subInitTable();
                //DB에 있는 LOTAPD항목을 pdtLOTAPdtable의 컬럼에 추가.
                pdtLOTAPDTable = new DataTable();
                for (int dintLOTCount = 1; dintLOTCount <= PInfo.Unit(0).SubUnit(0).LOTAPDCount; dintLOTCount++)
                {
                    dstrLOTName    = PInfo.Unit(0).SubUnit(0).LOTAPD(dintLOTCount).Name;
                    pdtLOTAPDTable = PclsDataGridView.funAddColumn(pdtLOTAPDTable, dstrLOTName, dstrLOTName);
                }
                //    dintLOTAPDTmp = dintLOTAPDCnt;
                //}
                //데이터 테이블을 만들어서 화면에 표시한다.
                this.subDisplay();

                //폼을 표시한다.
                this.Show();
            }

            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Example #3
0
        //데이터 테이블에 관련된 함수
        #region "데이터 테이블에 관련된 함수"

        #region subMakeFileString

        //*******************************************************************************
        //  Function Name : subMakeFileString()
        //  Description   : 로그 파일에서 데이터를 읽어서 스트링 배열로 만든다.
        //  Parameters    :
        //  Return Value  :
        //  Special Notes :
        //*******************************************************************************
        //  2007/03/09          최 성 원         [L 00]
        //*******************************************************************************
        private void subMakeFileString()
        {
            //지역 변수 선언
            string   dstrFilePath;                      //파일의 경로 저장
            string   dstrDateFrom;                      //로그를 볼 시작 날짜
            string   dstrDateTo;                        //로그를 볼 마지막 날짜
            DateTime myDate;                            //날짜를 저장할 임시 변수

            string dstrChangeDate;                      //날짜의 형태를 변경시킬 변수 2007-01-01 => 20070101

            string[] dstrArrayDateFrom;                 //날짜 변환을 위한 split용 임시 저장변수
            string[] dstrArrayDateTo;                   //날짜 변환을 위한 split용 임시 저장변수

            string[] dstrArrayFileContent;              //데이터를 읽기 위한 임시 변수
            int      dintArrIndex = 0;                  //스트링 배열의 첫번째 인덱스

            string dstrYear;                            //년도
            string dstrMonth;                           //월
            string dstrDay;                             //일

            bool dbolLastDay = false;                   //반복문을 벗어나기 위한 변수

            string[] dstrFileDataTmp;                   //텍스트에서 읽어온 데이터를 임시로 저장할 변수
            string[] dstrFileData = new string[30];     //텍스트에서 읽어온 데이터를 임시로 저장할 변수

            string[] dstrsplit    = { String.Empty.PadLeft(6, ' ') };
            string   dstrFileTemp = "";                    //파일을 스플릿해서 담을 변수.(1,2,3,4,5,)

            int dintFirst = 0;

            try
            {
                //시작 날짜 저장
                dstrChangeDate    = PstrDateFrom;
                dstrArrayDateFrom = dstrChangeDate.Split('-');
                dstrDateFrom      = dstrArrayDateFrom[0].Trim() + dstrArrayDateFrom[1].Trim() + dstrArrayDateFrom[2].Trim();

                //마지막 날짜 저장
                dstrChangeDate  = PstrDateTo;
                dstrArrayDateTo = dstrChangeDate.Split('-');
                dstrDateTo      = dstrArrayDateTo[0].Trim() + dstrArrayDateTo[1].Trim() + dstrArrayDateTo[2].Trim();

                //총 행수 리셋
                pintAllRows = 0;

                //이차원 배열 초기화
                for (int day = 0; day < 30; day++)
                {
                    pstrFileContents[day] = null;
                }

                //스트링 배열의 인덱스 초기화
                pintArrIndex = 0;

                //선택한 From날짜와 to 날짜가 같은때
                if (dstrDateFrom == dstrDateTo)
                {
                    //파일 경로를 읽어서
                    dstrFilePath = Application.StartupPath + "\\" + "PLCLOG" + "\\" + dstrDateFrom + "\\" + "LOTAPD.Log";

                    //파일이 존재하면
                    if (File.Exists(dstrFilePath))
                    {
                        //파일의 모든 라인을 가져와 스트링 배열에 저장한다
                        dstrArrayFileContent = File.ReadAllLines(dstrFilePath);

                        //총 Row 수에 현재 Row 수를 더한다.
                        pintAllRows     = pintAllRows + dstrArrayFileContent.Length;
                        dstrFileDataTmp = new string[pintAllRows];
                        //원본 데이터 스트링에 더한다.
                        for (int dintLoop = 0; dintLoop < dstrArrayFileContent.Length; dintLoop++)
                        {
                            dstrFileData = null;
                            //dstrFileData = new string[dstrArrayFileContent[dintLoop].Length / 32];
                            dstrFileData = new string[PInfo.Unit(0).SubUnit(0).LOTAPDCount];
                            //for (int dintDataLoop = 0; dintDataLoop < (dstrArrayFileContent[dintLoop].Length / 32); dintDataLoop++)
                            for (int dintDataLoop = 0; dintDataLoop < PInfo.Unit(0).SubUnit(0).LOTAPDCount; dintDataLoop++)
                            {
                                dintFirst = dintDataLoop * 32;
                                dstrFileData[dintDataLoop] = dstrArrayFileContent[dintLoop].Substring(dintFirst, 32).Trim();
                            }
                            //  읽어들인 파일의 문장별로 9개의 값만 가져온다.EX(1,2,3,4,5,6,7,8,9,10,11...)에서 9까지..
                            for (int dintArrayLoop = 0; dintArrayLoop < dstrFileData.Length; dintArrayLoop++)
                            {
                                //마지막 스트링은 컴마를 찍지 않는다.
                                if (dintArrayLoop == dstrFileData.Length - 1)
                                {
                                    dstrFileTemp = dstrFileTemp + dstrFileData[dintArrayLoop].Trim();
                                }
                                else
                                {
                                    dstrFileTemp = dstrFileTemp + dstrFileData[dintArrayLoop].Trim() + ",";
                                }
                            }
                            dstrFileDataTmp[dintLoop] = dstrFileTemp;
                            dstrFileTemp = "";
                        }
                        pstrFileContents[dintArrIndex] = dstrFileDataTmp;

                        //인덱스를 저장한다.
                        pintArrIndex = dintArrIndex + 1;

                        //데이터가 있다는 플레그를 셋팅한다.
                        pbodIsFileContents = true;
                    }
                }

                //선택한 From날짜와 to 날짜가 다를때
                else
                {
                    //Alarm Display 시작날짜가 마지막날짜보다 크면
                    if (int.Parse(dstrDateFrom) > int.Parse(dstrDateTo))
                    {
                        MessageBox.Show("Select Again From StartDate To EndDate!!", "INFORM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    //알람열람일수는 30일로 제한
                    if ((int.Parse(dstrDateTo) - int.Parse(dstrDateFrom)) > 31)
                    {
                        MessageBox.Show("Select Date Within One Month!", "INFORM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    //선택한 From날짜와 To날짜가 정상적으로 범위가 있을때
                    if (int.Parse(dstrDateFrom) < int.Parse(dstrDateTo))
                    {
                        do
                        {
                            //파일 경로를 읽어서
                            dstrFilePath = Application.StartupPath + "\\" + "PLCLOG" + "\\" + dstrDateFrom + "\\" + "LOTAPD.Log";

                            //파일이 있으면
                            if (File.Exists(dstrFilePath))
                            {
                                //파일의 모든 라인을 가져와 스트링 배열에 저장한다
                                dstrArrayFileContent = File.ReadAllLines(dstrFilePath);

                                //총 Row 수에 현재 Row 수를 더한다.
                                pintAllRows     = pintAllRows + dstrArrayFileContent.Length;
                                dstrFileDataTmp = new string[dstrArrayFileContent.Length];
                                for (int dintLoop = 0; dintLoop < dstrArrayFileContent.Length; dintLoop++)
                                {
                                    dstrFileData = null;
                                    //dstrFileData = new string[dstrArrayFileContent[dintLoop].Length / 32];
                                    dstrFileData = new string[PInfo.Unit(0).SubUnit(0).LOTAPDCount];
                                    for (int dintDataLoop = 0; dintDataLoop < PInfo.Unit(0).SubUnit(0).LOTAPDCount; dintDataLoop++)
                                    {
                                        dintFirst = dintDataLoop * 32;
                                        dstrFileData[dintDataLoop] = dstrArrayFileContent[dintLoop].Substring(dintFirst, 32).Trim();
                                    }
                                    //  읽어들인 파일의 문장별로 9개의 값만 가져온다.EX(1,2,3,4,5,6,7,8,9,10,11...)에서 9까지..
                                    for (int dintArrayLoop = 0; dintArrayLoop < dstrFileData.Length; dintArrayLoop++)
                                    {
                                        //마지막 스트링은 컴마를 찍지 않는다.
                                        if (dintArrayLoop == dstrFileData.Length - 1)
                                        {
                                            dstrFileTemp = dstrFileTemp + dstrFileData[dintArrayLoop].Trim();
                                        }
                                        else
                                        {
                                            dstrFileTemp = dstrFileTemp + dstrFileData[dintArrayLoop].Trim() + ",";
                                        }
                                    }
                                    dstrFileDataTmp[dintLoop] = dstrFileTemp;
                                    dstrFileTemp = "";
                                }
                                pstrFileContents[dintArrIndex] = dstrFileDataTmp;

                                //원본 배열의 인덱스를 증가시킨다.
                                dintArrIndex = dintArrIndex + 1;
                            }

                            //반복을 하기 위한 날짜 설정
                            dstrYear  = dstrDateFrom.Substring(0, 4);
                            dstrMonth = dstrDateFrom.Substring(4, 2);
                            dstrDay   = dstrDateFrom.Substring(6, 2);

                            myDate = new DateTime(int.Parse(dstrYear), int.Parse(dstrMonth), int.Parse(dstrDay));

                            //날짜를 하루 증가 시킨다.
                            dstrDateFrom = (myDate.AddDays(1)).ToString("yyyyMMdd");

                            //시작 날짜가 마지막 날짜 보다 클때
                            if (int.Parse(dstrDateFrom) > int.Parse(dstrDateTo))
                            {
                                //데이터가 있다는 플레그를 셋팅한다.
                                pbodIsFileContents = true;

                                //반복문을 벗어나기 위해서 변수를 설정한다.
                                dbolLastDay = true;
                            }
                        } while (dbolLastDay == false);

                        //인덱스를 저장한다.
                        pintArrIndex = dintArrIndex;

                        //변수를 리셋한다.
                        dbolLastDay = false;
                    }
                }
            }

            catch (Exception)
            {
                throw;
            }
        }