Exemple #1
0
 public clsLogFiles(InfoAct.clsInfo.LogType dLogType, string dstrFileName, FileStream dFS)
 {
     this.pLogType     = dLogType;
     this.pstrFileName = dstrFileName;
     this.pFS          = dFS;
     if (this.pFS != null)
     {
         this.pSW = new StreamWriter(this.pFS);
     }
 }
Exemple #2
0
 /// <summary>
 /// clsSmFn에서 발생하는 Log 처리
 /// </summary>
 /// <param name="logType"> Type of LOG </param>
 /// <param name="strLogText"> Test for record </param>
 protected void funSetLog(InfoAct.clsInfo.LogType logType, string strLogText)
 {
     try
     {
         if (pInfo != null)
         {
             pInfo.subLog_Set(logType, strLogText);
         }
     }
     catch (Exception error)
     {
         if (pInfo != null)
         {
             pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, error.ToString());
             return;
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// CIM, PLC 로그를 폼에 출력한다.
        /// </summary>
        /// <param name="dLogType"></param>
        /// <param name="strMessage"></param>
        public void subLogFormWrite(InfoAct.clsInfo.LogType dLogType, string strMessage)
        {
            string dstrTmp     = "";
            string dstrLogTime = "";                        //로그 시간을 뽑아 저장할 변수

            string[] dstrArrayLogData = { "", };            //로그 시간이 같을 경우 "\n"으로 Split하여 시간을 제외한 값만 뽑아낼 배열.
            Point    CursorPoint;

            try
            {
                switch (dLogType)
                {
                case InfoAct.clsInfo.LogType.CIM:
                    //인자로 들어온 strMessage에서 시간부분만 추려냄.
                    dstrLogTime = strMessage.Substring(12, 8);

                    //이전 로그의 시간과 현재 들어온 로그의 시간이 같을 경우 '\n'으로 구분해서 시간을 제외한 데이타만 strMessage에 다시 넣음.
                    if (dstrLogTime.Equals(pstrCIMLogTime))
                    {
                        dstrArrayLogData = strMessage.Split('\n');
                        strMessage       = dstrArrayLogData[1].ToString();
                    }
                    if (this.txtCIMLog.Text == "")
                    {
                        dstrTmp = this.txtCIMLog.Text + strMessage;
                    }
                    else
                    {
                        dstrTmp = this.txtCIMLog.Text + "\r\n" + strMessage;
                    }
                    if (dstrTmp.Length > 10000)
                    {
                        dstrTmp = dstrTmp.Substring(dstrTmp.Length - 10000);
                    }
                    this.txtCIMLog.Text = dstrTmp;           //PLC Log 내용 출력
                    this.txtCIMLog.ScrollToCaret();
                    pstrCIMLogTime = dstrLogTime;
                    break;

                case InfoAct.clsInfo.LogType.PLC:

                    //인자로 들어온 strMessage에서 시간부분만 추려냄.
                    dstrLogTime = strMessage.Substring(12, 8);

                    //이전 로그의 시간과 현재 들어온 로그의 시간이 같을 경우 '\n'으로 구분해서 시간을 제외한 데이타만 strMessage에 다시 넣음.
                    if (dstrLogTime.Equals(pstrPLCLogTime))
                    {
                        dstrArrayLogData = strMessage.Split('\n');
                        strMessage       = dstrArrayLogData[1].ToString();
                    }
                    if (this.txtPLCLog.Text == "")
                    {
                        dstrTmp = this.txtPLCLog.Text + strMessage;
                    }
                    else
                    {
                        //dstrTmp = this.txtPLCLog.Text + "\r\n" + strMessage;
                        dstrTmp = this.txtPLCLog.Text + "\r" + strMessage;
                    }

                    if (dstrTmp.Length > 10000)
                    {
                        dstrTmp = dstrTmp.Substring(dstrTmp.Length - 10000);
                    }
                    this.txtPLCLog.Text = dstrTmp;       //PLC Log 내용 출력
                    this.txtPLCLog.ScrollToCaret();
                    //if (this.Visible == true)
                    //{
                    //    txtPLCLog.Focus();
                    //    SendKeys.Send("^{END}");    // Focus를 맨 아랫줄로 보낸다.
                    //    txtPLCLog.Focus();

                    //     CursorPoint = this.txtPLCLog.AutoScrollOffset;
                    //    this.txtPLCLog.PointToClient(CursorPoint);
                    //}
                    pstrPLCLogTime = dstrLogTime;
                    break;

                case InfoAct.clsInfo.LogType.PLCError:
                    //인자로 들어온 strMessage에서 시간부분만 추려냄.
                    dstrLogTime = strMessage.Substring(12, 8);

                    //이전 로그의 시간과 현재 들어온 로그의 시간이 같을 경우 '\n'으로 구분해서 시간을 제외한 데이타만 strMessage에 다시 넣음.
                    if (dstrLogTime.Equals(pstrPLCErrorLogTime))
                    {
                        dstrArrayLogData = strMessage.Split('\n');
                        strMessage       = dstrArrayLogData[1].ToString();
                    }

                    if (this.txtPLCErrLog.Text == "")
                    {
                        dstrTmp = this.txtPLCErrLog.Text + strMessage;
                    }
                    else
                    {
                        dstrTmp = this.txtPLCErrLog.Text + "\r\n" + strMessage;
                    }
                    if (dstrTmp.Length > 10000)
                    {
                        dstrTmp = dstrTmp.Substring(dstrTmp.Length - 10000);
                    }
                    this.txtPLCErrLog.Text = dstrTmp;                //PLC Error 내용 출력

                    pstrPLCErrorLogTime = dstrLogTime;
                    break;

                default:
                    break;
                }

                //이전 로그 시간과 현재 로그 시간을 비교하기 위해 임시 저장변수(static string dstrLogTimeTmp)에 저장해놈.
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #4
0
 public clsLogData(InfoAct.clsInfo.LogType logType, string strLogData)
 {
     this.pLogType     = logType;
     this.pstrbLogData = strLogData;
 }
Exemple #5
0
        private string funGetLogFileName(InfoAct.clsInfo.LogType dLogType)
        {
            string dstrTmp = string.Empty;

            switch (dLogType)
            {
            case InfoAct.clsInfo.LogType.PLC:
                dstrTmp = "PLC.Log";
                break;

            case InfoAct.clsInfo.LogType.PLCError:
                dstrTmp = "PLCError.Log";
                break;

            case InfoAct.clsInfo.LogType.CIM:
                dstrTmp = "CIM.Log";
                break;

            case InfoAct.clsInfo.LogType.Alarm:
                dstrTmp = "Alarm.Log";
                break;

            case InfoAct.clsInfo.LogType.ScrapUnScrapAbort:
                dstrTmp = "Scrap.Log";
                break;

            case InfoAct.clsInfo.LogType.GLSInOut:
                dstrTmp = "GLSInOut.Log";
                break;

            case InfoAct.clsInfo.LogType.GLSPDC:
                dstrTmp = "GLSPDC.Log";
                break;

            case InfoAct.clsInfo.LogType.LOTPDC:
                dstrTmp = "LOTPDC.Log";
                break;

            case InfoAct.clsInfo.LogType.Parameter:
                dstrTmp = "Parameter.Log";
                break;

            case InfoAct.clsInfo.LogType.MCCLog:
                // subWriteMCCLog(string strLog) <--- 생각좀
                break;

            case InfoAct.clsInfo.LogType.AlarmGLSInfo:
                dstrTmp = "AlarmGLSInfo.Log";
                break;

            case InfoAct.clsInfo.LogType.btnEVENT:
                dstrTmp = "ButtonEvent.Log";
                break;

            case InfoAct.clsInfo.LogType.SEM:
                dstrTmp = "SEM.Log";
                break;

            default:
                dstrTmp = string.Empty;
                break;
            }

            return(dstrTmp);
        }