コード例 #1
0
ファイル: frmSEMConfig.cs プロジェクト: k2un/k2un
        //20141106 이원규 (SEM_UDP)
        private void btnSave_Click(object sender, EventArgs e)
        {
            string dstrUDPIP   = "";
            string dstrUDPPort = "";

            try
            {
                this.btnSave.Enabled = false;
                if (this.rdoEnable.Checked == true)
                {
                    try
                    {
                        if (PInfo.All.UDPRecvPort == null)
                        {
                            this.PInfo.All.UDP_IP       = IPAddress.Parse(this.tbxIP.Text);
                            this.PInfo.All.UDP_PORT     = Convert.ToInt32(this.tbxPort.Text);
                            this.PInfo.All.SEMAlarmTime = Convert.ToInt32(this.cboAlarmTime.Text.Trim());

                            dstrUDPIP   = this.PInfo.All.UDP_IP.ToString();
                            dstrUDPPort = this.PInfo.All.UDP_PORT.ToString();

                            //포트연결시도를한다.
                            this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.UDPPortOpen);
                            //SEM Controller에 Start명령을 내린다.
                            this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerStart);

                            FunINIMethod.subINIWriteValue("SEM", "UDP_PORT", dstrUDPPort, this.PInfo.All.SystemINIFilePath);
                            FunINIMethod.subINIWriteValue("SEM", "UDP_IP", dstrUDPIP, this.PInfo.All.SystemINIFilePath);
                            FunINIMethod.subINIWriteValue("SEM", "SEM_AlarmTime", this.PInfo.All.SEMAlarmTime.ToString(), this.PInfo.All.SystemINIFilePath);
                        }
                        else
                        {
                            MessageBox.Show("UDP Port가 Open되어 있습니다.");
                        }
                    }
                    catch (UnauthorizedAccessException ex)
                    {
                        //사용할수 없는 포트
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
                        this.btnSave.Enabled = true;
                        return;
                    }
                }
                else
                {
                    //SEM Controller에 End명령을 내리고 포트를 닫는다.
                    this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerEnd);

                    this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.UDPPortClose);
                }

                this.Hide();
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #2
0
ファイル: frmSEMConfig - 복사본.cs プロジェクト: k2un/k2un
        private void btnSave_Click(object sender, EventArgs e)
        {
            SerialPort spPort;
            string     dstrBaudRate = "";
            string     dstrComPort  = "";

            try
            {
                this.btnSave.Enabled = false;
                if (this.rdoEnable.Checked == true)
                {
                    try
                    {
                        //포트 오픈 테스트를 한다.======================================================
                        dstrComPort = this.cboPort.Text.Trim();
                        spPort      = new SerialPort(dstrComPort, 115200, Parity.Even, 8, StopBits.One);
                        spPort.Open();
                        if (spPort.IsOpen)
                        {
                            spPort.Close();
                        }
                        //==============================================================================

                        this.PInfo.All.CommPort     = this.cboPort.Text.Trim();
                        dstrBaudRate                = this.cboBaudRate.Text.Trim();
                        this.PInfo.All.CommSetting  = dstrBaudRate + ",e,8,1";
                        this.PInfo.All.SEMAlarmTime = Convert.ToInt32(this.cboAlarmTime.Text.Trim());

                        //포트연결시도를한다.
                        this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SerialPortOpen);
                        //SEM Controller에 Start명령을 내린다.
                        this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerStart);

                        FunINIMethod.subINIWriteValue("SEM", "SEM_Port", dstrComPort, this.PInfo.All.SystemINIFilePath);
                        FunINIMethod.subINIWriteValue("SEM", "SEM_BaudRate", dstrBaudRate, this.PInfo.All.SystemINIFilePath);
                        FunINIMethod.subINIWriteValue("SEM", "SEM_AlarmTime", this.PInfo.All.SEMAlarmTime.ToString(), this.PInfo.All.SystemINIFilePath);
                    }
                    catch (UnauthorizedAccessException ex)
                    {
                        //사용할수 없는 포트
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
                        this.btnSave.Enabled = true;
                    }
                }
                else
                {
                    //SEM Controller에 End명령을 내리고 포트를 닫는다.
                    this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerEnd);
                }

                this.Hide();
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #3
0
ファイル: tabfrmSetupEQP.cs プロジェクト: k2un/k2un
 private void tabfrmSetupEQPInfo_Load(object sender, EventArgs e)
 {
     try
     {
         this.lblLastModified.Text = FunINIMethod.funINIReadValue("ETCInfo", "EQPLastModified", "", this.pInfo.All.SystemINIFilePath);
         this.txtEQPID.Text        = pInfo.EQP("Main").EQPID;
         this.txtMDLN.Text         = pInfo.All.MDLN;
         this.txtSlotCount.Text    = Convert.ToString(pInfo.EQP("Main").SlotCount);
         this.txtUnitCount.Text    = Convert.ToString(pInfo.UnitCount);
         this.txtKeepDays.Text     = pInfo.All.ProcDataKeepDays.ToString();
     }
     catch (Exception ex)
     {
         pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
     }
 }
コード例 #4
0
        private void subSaveLastModified()
        {
            string dstrSection = "";
            string dstrDate    = "";

            try
            {
                dstrSection = "ALARMLastModified";
                dstrDate    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                FunINIMethod.subINIWriteValue("ETCInfo", dstrSection, dstrDate, pInfo.All.SystemINIFilePath);

                //this.lblLastModified.Text = dstrDate;
            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #5
0
ファイル: frmLoading.cs プロジェクト: k2un/k2un
        /// <summary>
        /// 각 Class를 Loading하고 Initial한다.
        /// </summary>
        public void subclsInitial()
        {
            try
            {
                subProgressText("PlugIn Loading");
                pclsDBActPlugIn      = new clsDBActPlugIn();                            //DB를 다루기위한 PlugIn cls정의및 생성
                pclsInfoPlugIn       = new clsInfoActPlugIn();                          //구조체를 다루기위한 PlugIn cls정의및 생성
                pclsLogActPlugIn     = new clsLogActPlugIn();
                pclsHostActPlugIn    = new clsHostActPlugIn();                          //호스트를 다루기위한 PlugIn cls정의및 생성
                pclsEqpActPlugIn     = new clsEqpActPlugIn();                           //장비를 다루기위한 PlugIn cls정의및 생성
                pclsDisplayActPlugIn = new clsDisplayActPlugIn();

                if (pInfo.AddAll() == true)
                {
                    string dModelINI = Application.StartupPath + @"\system\EqpModel.ini";
                    pInfo.All.MODEL_NAME = FunINIMethod.funINIReadValue("MODEL", "NAME", "", dModelINI);
                }

                subProgressText("DBAct Initial");
                pclsDBActPlugIn.funConnectDB(pInfo.All.MODEL_NAME);                                         //DB OPEN

                subProgressText("InfoAct Initial");
                pclsInfoPlugIn.subInitialInfo(pInfo.All.MODEL_NAME);                                        //구조체 초기화

                subProgressText("LogAct Initial");
                pclsLogActPlugIn.subInitialLog();                                       //Log 폴더 Initial

                subProgressText("DisplayAct Initial");
                pclsDisplayActPlugIn.subInitial();                                      //Main Form Load

                subProgressText("EqpAct Initial");
                pclsEqpActPlugIn.funOpenPLC();                                          //장비 초기화

                subProgressText("HostAct Initial");
                pclsHostActPlugIn.funOpenSecs("EAP01");                                 //호스트 초기화

                pclsDBActPlugIn.funDisconnectDB();                                      //DB CLOSE
                this.pgbLoading.Value = 100;
            }
            catch (Exception ex)
            {
                this.pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #6
0
ファイル: tabfrmSetupEQP.cs プロジェクト: k2un/k2un
        public void Save()
        {
            try
            {
                FunINIMethod.subINIWriteValue("ETCInfo", "EQPID", this.txtEQPID.Text, pInfo.All.SystemINIFilePath);
                FunINIMethod.subINIWriteValue("ETCInfo", "MDLN", this.txtMDLN.Text, pInfo.All.SystemINIFilePath);
                //Process Data Days to Keep 관련 저장
                FunINIMethod.subINIWriteValue("ETCInfo", "KEEPDAYS", this.txtKeepDays.Text, pInfo.All.SystemINIFilePath);

                pInfo.EQP("Main").EQPID    = this.txtEQPID.Text;
                pInfo.All.MDLN             = this.txtMDLN.Text;
                pInfo.All.ProcDataKeepDays = Convert.ToInt32(txtKeepDays.Text);

                subSaveLastModified(); //최종 수정된 날짜를 Ini파일에 저장한다.

                MessageBox.Show("Data Save Success!", "Jobs Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #7
0
ファイル: frmLoading.cs プロジェクト: k2un/k2un
        //*******************************************************************************
        //  Function Name : subclsInitial()
        //  Description   : 각 Class를 Loading하고 Initial한다.
        //  Parameters    : None
        //  Return Value  : None
        //  Special Notes :
        //*******************************************************************************
        //  2006/11/02          어 경태             [L 00]
        //*******************************************************************************
        public void subclsInitial()
        {
            try
            {
                subProgressText("PlugIn Loading");
                pclsDBActPlugIn  = new clsDBActPlugIn();                                //DB를 다루기위한 PlugIn cls정의및 생성
                pclsInfoPlugIn   = new clsInfoActPlugIn();                              //구조체를 다루기위한 PlugIn cls정의및 생성
                pclsLogActPlugIn = new clsLogActPlugIn();
                pclsEqpActPlugIn = new clsEqpActPlugIn();                               //장비를 다루기위한 PlugIn cls정의및 생성

                if (pInfo.AddAll() == true)
                {
                    string dModelINI = @"D:\Source\STM\bin\Debug\system\EqpModel.ini";
                    pInfo.All.MODEL_NAME = FunINIMethod.funINIReadValue("MODEL", "NAME", "", dModelINI);
                }

                subProgressText("DBAct Initial");
                pclsDBActPlugIn.funConnectDB(pInfo.All.MODEL_NAME);                                         //DB OPEN

                subProgressText("InfoAct Initial");
                pclsInfoPlugIn.subInitialInfo(pInfo.All.MODEL_NAME);                    //구조체 초기화

                subProgressText("LogAct Initial");
                //pclsLogActPlugIn.PInfo = this.pInfo;
                pclsLogActPlugIn.subInitialLog();                                       //Log 폴더 Initial

                subProgressText("EqpAct Initial");
                pclsEqpActPlugIn.funOpenPLC();                                          //장비 초기화

                pclsDBActPlugIn.funDisconnectDB();                                      //DB CLOSE
                this.pgbLoading.Value = 100;
            }
            catch (Exception ex)
            {
                this.pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #8
0
ファイル: clsEQPEventEOIDChange.cs プロジェクト: k2un/k2un
        /// <summary>
        /// 설비에서 CIM으로 발생하는 Event에 대한 처리
        /// </summary>
        /// <param name="parameters">Parameter Array</param>
        /// <remarks>
        /// parameters[0] : strCompBit
        /// parameters[1] : dstrACTVal
        /// parameters[2] : dintActFrom
        /// parameters[3] : dstrACTFromSub
        /// parameters[4] : intBitVal
        /// parameters[5] : Special Parameter
        /// </remarks>
        public void funProcessEQPEvent(string[] parameters)
        {
            string strCompBit  = parameters[0];
            string strEOIDItem = parameters[1];

            string[]   dstrValue;
            string     dstrWordAddress = "";
            string     dstrLog         = "";
            int        dintIndex       = 0;
            string     dstrSection     = "EOIDLastModified";
            int        dintReadingEOV  = 0;
            string     dstrAfterEOV    = "";
            SortedList dHT             = new SortedList();
            string     dstrSQL;

            string[] dstrData;

            try
            {
                dintIndex = pInfo.funGetEOIDItemToIndex(strEOIDItem);                     //tbEOID 테이블의 항목에 해당하는 Index 컬럼값

                switch (strEOIDItem)
                {
                //case "VCR":
                //    dstrWordAddress = "W1511";           //VCR Reading Mode
                //    break;

                case "APC":
                    dstrWordAddress = "W1512";               //Wait time for glassid key-input(At reading fail)
                    break;
                }

                m_pEqpAct.subWordReadSave(dstrWordAddress, 1, EnuEQP.PLCRWType.Int_Data);               //VCR Reading Mode

                dstrValue = m_pEqpAct.funWordReadAction(true);

                //PLC Req에 대한 CIM의 Confirm Bit를 준다.
                m_pEqpAct.subSetConfirmBit(strCompBit);

                dintReadingEOV = Convert.ToInt32(dstrValue[0]);


                //만약 현재 EOV와 같은 값이 오면 처리를 하지 않는다.
                if (pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV == dintReadingEOV)
                {
                }
                else
                {
                    dstrAfterEOV = dstrAfterEOV + dintIndex.ToString() + ";";         //EOID 저장
                    dHT.Add(dintIndex, pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV); //변경전의 EOID Index, EOV 저장

                    //구조체 변경
                    pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV = dintReadingEOV;

                    //DB Update
                    dstrSQL = "Update tbEOID set EOV=" + dintReadingEOV + " Where Index=" + dintIndex.ToString();

                    if (DBAct.clsDBAct.funExecuteQuery(dstrSQL) == false)
                    {
                        pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, "DB Update Fail: EOID Index: " + dintIndex.ToString());
                    }

                    //변경된 EOV에 대해 HOST 보고
                    dstrData = dstrAfterEOV.Split(new char[] { ';' });
                    if (dstrData.Length > 1)
                    {
                        if (pInfo.All.EOIDChangeBYWHO == "1" || pInfo.All.EOIDChangeBYWHO == "2")
                        {
                            //HOST나 OP에서 발생한것임
                        }
                        else
                        {
                            pInfo.All.EOIDChangeBYWHO = "3";       //BY Equipment
                        }

                        //HOST로 EOV값 변경 보고
                        pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S6F11RelatedEquipmentParameterEvent, 101, dstrAfterEOV); //마지막 인자는 EOID Index임

                        pInfo.All.EOIDChangeBYWHO = "";                                                                     //초기화

                        //변경 이력 로그 저장
                        foreach (DictionaryEntry de in dHT)
                        {
                            dstrLog = dstrLog + "EOID" + ",";
                            dstrLog = dstrLog + DateTime.Now.ToString("yyyyMMddHHmmss") + ",";
                            dstrLog = dstrLog + "변경" + ",";
                            dstrLog = dstrLog + pInfo.All.UserID + ",";
                            dstrLog = dstrLog + pInfo.Unit(0).SubUnit(0).EOID(Convert.ToInt32(de.Key)).DESC + ",";
                            dstrLog = dstrLog + de.Value.ToString() + ",";
                            dstrLog = dstrLog + pInfo.Unit(0).SubUnit(0).EOID(Convert.ToInt32(de.Key)).EOV;

                            pInfo.subLog_Set(InfoAct.clsInfo.LogType.Parameter, dstrLog); //로그 출력

                            dstrLog = "";                                                 //초기화
                        }
                    }


                    //System.ini 파일에 변경 날짜 갱신
                    FunINIMethod.subINIWriteValue("ETCInfo", dstrSection, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), pInfo.All.SystemINIFilePath);
                }
            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
            finally
            {
            }
        }
コード例 #9
0
        /// <summary>
        /// 설비에서 CIM으로 발생하는 Event에 대한 처리
        /// </summary>
        /// <param name="parameters">Parameter Array</param>
        /// <remarks>
        /// parameters[0] : strCompBit
        /// parameters[1] : dstrACTVal
        /// parameters[2] : dintActFrom
        /// parameters[3] : dstrACTFromSub
        /// parameters[4] : intBitVal
        /// parameters[5] : Special Parameter
        /// </remarks>
        public void funProcessEQPEvent(string[] parameters)
        {
            string        strCompBit      = parameters[0];
            string        dstrWordAddress = "";
            StringBuilder dstrLog         = new StringBuilder();
            int           dintLength      = 0;
            string        dstrTemp        = "";
            int           dintBodyIndex   = 3; //PPID Body Index


            string dstrAfterHOSTPPID = "";
            string dstrAfterEQPPPID  = "";
            string dstrBeforeEQPPPID = "";
            int    dintAfterPPIDType = 0;

            string[] dstrAfterValue;

            try
            {
                dstrWordAddress = "W2040";
                //m_pEqpAct.subWordReadSave(dstrWordAddress, 10, EnuEQP.PLCRWType.ASCII_Data);        //HOST PPID
                m_pEqpAct.subWordReadSave(dstrWordAddress, 1, EnuEQP.PLCRWType.Int_Data);           //EQP PPID
                m_pEqpAct.subWordReadSave("", 10, EnuEQP.PLCRWType.Int_Data);                       //Spare
                m_pEqpAct.subWordReadSave("", 1, EnuEQP.PLCRWType.Int_Data);                        //PPID Type
                //for (int dintLoop = 1; dintLoop <= pInfo.Unit(0).SubUnit(0).PPIDBodyCount; dintLoop++)
                //{
                //    dintLength = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                //    m_pEqpAct.subWordReadSave("", dintLength, EnuEQP.PLCRWType.Int_Data);                 //Body
                //}

                dstrAfterValue = m_pEqpAct.funWordReadAction(true);

                //PLC Req에 대한 CIM의 Confirm Bit를 준다.5
                m_pEqpAct.subSetConfirmBit(strCompBit);

                dstrAfterHOSTPPID = dstrAfterValue[0];
                dstrAfterEQPPPID  = dstrAfterValue[1];
                dintAfterPPIDType = Convert.ToInt32(dstrAfterValue[3]);

                if (pInfo.Unit(0).SubUnit(0).HOSTPPID(dstrAfterHOSTPPID) == null)
                {
                    pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, string.Format("존재하지 않는 HostPPID: {0} 에 대한 Mapping 변경 보고됨.", dstrAfterHOSTPPID));
                    return;
                }

                if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrAfterEQPPPID) == null)
                {
                    pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, string.Format("HostPPID: {0} 에 존재하지 않는 EQPPPID: {1} Mapping 변경 보고됨.", dstrAfterHOSTPPID, dstrAfterEQPPPID));
                    return;
                }



                dstrBeforeEQPPPID = pInfo.Unit(0).SubUnit(0).HOSTPPID(dstrAfterHOSTPPID).EQPPPID;

                pInfo.Unit(0).SubUnit(0).HOSTPPID(dstrAfterHOSTPPID).EQPPPID = dstrAfterEQPPPID;

                //로그를 출력한다.
                dstrLog.Append(FunStringH.funPaddingStringData("-", 30, '-') + "\r\n");
                dstrLog.Append("HOST PPID Mapping 수정(After Data)" + "\r\n");
                dstrLog.Append("AfterHOSTPPID:" + dstrAfterHOSTPPID + ",");
                dstrLog.Append("AfterEQPPPID:" + dstrAfterEQPPPID + ",");
                dstrLog.Append("AfterPPIDType:" + dintAfterPPIDType.ToString() + "\r\n");

                //for (int dintLoop = 1; dintLoop <= pInfo.Unit(0).SubUnit(0).PPIDBodyCount; dintLoop++)
                //{
                //    dstrTemp = FunStringH.funPoint(dstrAfterValue[dintBodyIndex + dintLoop - 1], pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format);
                //    dstrLog.Append(pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name + ":" + dstrTemp + "\r\n");
                //}
                dstrLog.Append(FunStringH.funPaddingStringData("-", 30, '-') + "\r\n");
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, dstrLog.ToString());


                //HOST로 HOST Mapping 변경 보고
                //인자:변경(3), PPIDTYPE, HOSTPPID, EQPPPID
                pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S7F107PPIDCreatDeleteAndPPBodyChangedReport, "3", dintAfterPPIDType, dstrAfterHOSTPPID, dstrAfterEQPPPID);

                m_pEqpAct.subSetParameterLog("HOST PPID Mapping 수정", dstrAfterHOSTPPID, null, dstrBeforeEQPPPID, dstrAfterEQPPPID);

                //최종 수정된 날짜 Ini에 변경
                FunINIMethod.subINIWriteValue("ETCInfo", "RECIPELastModified", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), pInfo.All.SystemINIFilePath);
            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #10
0
ファイル: tabfrmSetupEOID.cs プロジェクト: k2un/k2un
        public void Save()
        {
            File.Copy(Application.StartupPath + @"\system\System.mdb", Application.StartupPath + @"\system\System.mdb.bak", true);

            string     dstrSQL;
            DataTable  dDT;
            int        dintIndex    = 0;
            int        dintEOV      = 0;
            bool       dbolError    = false;
            SortedList dHT          = new SortedList();
            string     dstrAfterEOV = "";


            try
            {
                //유효성검사
                for (int dintLoop = 0; dintLoop < this.dataGridView1.RowCount; dintLoop++)
                {
                    dintIndex = Convert.ToInt32(this.dataGridView1.Rows[dintLoop].Cells[0].Value);
                    dintEOV   = Convert.ToInt32(this.dataGridView1.Rows[dintLoop].Cells[5].Value);

                    if (dintEOV >= this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMin&& dintEOV <= this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMax)
                    {
                        if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOID == 8)          //EOID=8이면 VCR Reading Mode임.
                        {
                            if (dintEOV == 0 || dintEOV == 1 || dintEOV == 2 || dintEOV == 3) //VCR Reading Mode는 0,1,2,3 만 값이 있다.
                            {
                            }
                            else
                            {
                                dbolError = true;
                            }
                        }

                        if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOID == 19) //SEM
                        {
                            if (dintEOV == 1)
                            {
                                //pInfo.All.SEM_ON = true;
                                //if (pInfo.All.CommPort.ToUpper() != "NULL") pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SerialPortOpen);

                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.UDPPortOpen);
                                //SEM Controller에 Start명령을 내린다.
                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerStart);
                            }
                            else
                            {
                                //pInfo.All.SEM_ON = false;
                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerEnd);

                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.UDPPortClose);
                            }
                        }

                        if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOID == 21) //APC
                        {
                            if (dintEOV == 0 || dintEOV == 1)
                            {
                                if (dintEOV == 0)
                                {
                                    pInfo.All.APCUSE = false;
                                }
                                else
                                {
                                    pInfo.All.APCUSE = true;
                                }
                            }
                            else
                            {
                                dbolError = true;
                            }
                        }

                        if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOID == 22) //RPC
                        {
                            if (dintEOV == 0 || dintEOV == 1)
                            {
                                if (dintEOV == 0)
                                {
                                    pInfo.All.RPCUSE = false;
                                }
                                else
                                {
                                    pInfo.All.RPCUSE = true;
                                }
                            }
                            else
                            {
                                dbolError = true;
                            }
                        }
                    }
                    else
                    {
                        dbolError = true;
                    }

                    if (dbolError == true)
                    {
                        dstrErrorMsg = this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).DESC + " 값은 " + this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMin
                                       + "~" + this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMax + " 이어야 합니다.";
                        MessageBox.Show(dstrErrorMsg, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                //바뀐 EOV 값이 있는지 검사한다.
                for (int dintLoop = 0; dintLoop < this.dataGridView1.RowCount; dintLoop++)
                {
                    //dintIndex = dintLoop + 1;
                    dintIndex = Convert.ToInt32(this.dataGridView1.Rows[dintLoop].Cells[0].Value);
                    dintEOV   = Convert.ToInt32(this.dataGridView1.Rows[dintLoop].Cells[5].Value);
                    if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV != dintEOV)
                    {
                        dstrAfterEOV = dstrAfterEOV + dintIndex.ToString() + ";";              //EOID 저장
                        dHT.Add(dintIndex, this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV); //변경전의 EOID, EOV 저장

                        //if (this.PInfo.funGetEOIDLapseTime(dintIndex) == true) dbolProcessTimeOverChange = true;
                    }
                }

                if (dstrAfterEOV == "")
                {
                    MessageBox.Show("변경된 EOV가 하나도 없습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (!DBAct.clsDBAct.funBeginTransaction())
                {
                    MessageBox.Show("DB Transaction NG!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //DataAdapter 생성
                OleDbDataAdapter    dataAdapter    = new OleDbDataAdapter("SELECT * FROM tbEOID order by Index", DBAct.clsDBAct.funOleDbConnect());
                OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(dataAdapter);

                //DataAdapter를 이용하여 DB로 업데이트를 한다.
                dataAdapter.SelectCommand.Transaction = DBAct.clsDBAct.funOleDbTransaction();
                dataAdapter.Update((DataTable)pEOIDListSource.DataSource);

                if (!DBAct.clsDBAct.funCommitTransaction())
                {
                    MessageBox.Show("DB Commit Transaction NG!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    DBAct.clsDBAct.funRollbackTransaction();
                    return;
                }



                dstrSQL = "SELECT * FROM tbEOID order by index";
                //dDT = DBAct.clsDBAct.funSelectQuery2(dstrSQL);                          //DataTable을 받아온다.
                dDT = DBAct.clsDBAct.funSelectQuery2(dstrSQL);
                if (dDT != null)
                {
                    pInfo.Unit(0).SubUnit(0).RemoveEOID();

                    pInfo.DeleteTable("EOID");
                    pInfo.AddDataTable("EOID", dDT);

                    foreach (DataRow dr in dDT.Rows)
                    {
                        dintIndex = Convert.ToInt32(dr["Index"]);
                        pInfo.Unit(0).SubUnit(0).AddEOID(dintIndex);

                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOID     = Convert.ToInt32(dr["EOID"]);
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOMD     = Convert.ToInt32(dr["EOMD"]);
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOMDMin  = Convert.ToInt32(dr["EOMDMin"]);
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOMDMax  = Convert.ToInt32(dr["EOMDMax"]);
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV      = Convert.ToInt32(dr["EOV"]);
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMin   = Convert.ToInt32(dr["EOVMin"]);
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMax   = Convert.ToInt32(dr["EOVMax"]);
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).DESC     = dr["Description"].ToString();
                        pInfo.Unit(0).SubUnit(0).EOID(dintIndex).PLCWrite = Convert.ToBoolean(dr["PLCWrite"]);
                    }
                }
                string[] dstrData = dstrAfterEOV.Split(new char[] { ';' });
                if (dstrData.Length > 1)
                {
                    this.pInfo.All.EOIDChangeBYWHO = "2";       //BY OP

                    //HOST로 EOV값 변경 보고
                    this.pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S6F11RelatedEquipmentParameterEvent, 101, dstrAfterEOV); //마지막 인자는 EOID Index임

                    this.pInfo.All.EOIDChangeBYWHO = "";                                                                     //초기화

                    //변경 이력 로그 저장
                    foreach (DictionaryEntry de in dHT)
                    {
                        dintIndex = Convert.ToInt32(de.Key);        //EOID Index

                        string dstrLog = "";
                        dstrLog = dstrLog + "EOID" + ",";
                        dstrLog = dstrLog + DateTime.Now.ToString("yyyyMMddHHmmss") + ",";
                        dstrLog = dstrLog + "변경" + ",";
                        dstrLog = dstrLog + this.pInfo.All.UserID + ",";
                        dstrLog = dstrLog + this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).DESC + ",";
                        dstrLog = dstrLog + de.Value.ToString() + ",";
                        dstrLog = dstrLog + this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV;

                        this.pInfo.subLog_Set(InfoAct.clsInfo.LogType.Parameter, dstrLog); //로그 출력

                        dstrLog = "";                                                      //초기화


                        //만약 EOID중에 PLC로 변경할 것이 있으면 Write해 준다.
                        if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).PLCWrite == true)
                        {
                            switch (dintIndex)
                            {
                            //case 8:                       //VCR Reading Mode
                            //    this.PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.VCRReadingMode, this.PInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV);
                            //    break;

                            case 1:                           //APC(Advanced Process Control) MODE
                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.APCMode, this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV);
                                break;

                            default:
                                break;
                            }
                        }
                        else
                        {
                            switch (dintIndex)
                            {
                            case 2:                           //MCC Reporting Mode

                                if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV == 1)
                                {
                                    FunINIMethod.funINIReadValue("MCC", "MCCFileUploadUse", "True", this.pInfo.All.SystemINIFilePath);
                                }
                                else
                                {
                                    FunINIMethod.funINIReadValue("MCC", "MCCFileUploadUse", "False", this.pInfo.All.SystemINIFilePath);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }

                subSaveLastModified(); //최종 수정된 날짜를 Ini파일에 저장한다.

                MessageBox.Show("Data Save Success!", "Jobs Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
                DBAct.clsDBAct.funRollbackTransaction();
                DBAct.clsDBAct.funDisconnect();     // DB 연결을 끊는다.
                MessageBox.Show("DB Update Fail, Because DB Process Error!", "DB Update Error!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #11
0
        //*******************************************************************************
        //  Function Name : subEQPInfoInitial()
        //  Description   : System.ini를 읽어 EQP 정보를 구성한다.
        //  Parameters    :
        //  Return Value  :
        //  Special Notes : INI로부터 데이타를 읽어 저장한다.
        //*******************************************************************************
        //  2006/10/12          어 경태         [L 00]
        //  2007/02/26          김 효주         [L 01]  All(공통), EQP별로 구분
        //*******************************************************************************
        private void subEQPInfoInitial(string strEQPName)
        {
            string dSystemINI       = ""; //= Application.StartupPath + @"\system\System_" + strEQPName + ".ini";
            string dSecomINI        = Application.StartupPath + @"\system\SEComINI.EXP";
            string dCFGFile         = Application.StartupPath + @"\system\SDCA3.cfg";
            string dstrSectionUnit  = "UNIT";
            string dstrSectionPort  = "PORT";
            string dstrSectionHOST  = "HOST";
            string dstrSectionInfo  = "ETCInfo";
            string dstrSectionVCR   = "VCRReadingResult";
            string dstrSectionMCC   = "MCC";              //추가 : 20100101 이상호
            string dstrSectionSEM   = "SEM";              //SEM 추가 - 110915 고석현
            string dstrSectionSecom = "EAP01";            //Secom Driver 이름
            string dstrSectionEQP   = "CommunicationEQP"; //EQP 이름
            string dstrEQPID        = "";
            string dstrKey          = "";
            int    dintCount        = 0;

            try
            {
                string   strBasicPath = Application.StartupPath;
                string[] arrCon       = strBasicPath.Split('\\');
                strBasicPath = "";
                for (int dintLoop = 0; dintLoop < arrCon.Length; dintLoop++)
                {
                    if (arrCon[dintLoop] != "MCC")
                    {
                        if (dintLoop == arrCon.Length - 1)
                        {
                            strBasicPath += arrCon[dintLoop];
                        }
                        else
                        {
                            strBasicPath += arrCon[dintLoop] + "\\";
                        }
                    }
                }
                dSystemINI = strBasicPath + @"\system\System_" + strEQPName + ".ini";

                //EQP에 관계없이 응용 프로그램 공통으로 사용할 정보(All)를 구성한다.
                //if (this.PInfo.AddAll() == true)
                //{
                //INI파일경로를 저장한다.
                this.PInfo.All.SystemINIFilePath = dSystemINI;
                PInfo.All.MCCINIFilePath         = Application.StartupPath + @"\system\System.ini";

                this.PInfo.All.SecomINIFilePath = dSecomINI;

                //프로그램 기동시 HOST 로그 보관 기간을 91일(13주)로 Write한다.
                //왜냐하면 SecomClient에서 91일(13주)은 설정이 안되기 때문임
                //FunINIMethod.subINIWriteValue("EAP01", "LOGBACKUP", "91", this.PInfo.All.SecomINIFilePath);

                //HOST정보를 INI에서 읽어 구조체이 저장한다.
                this.PInfo.All.DeviceID   = Convert.ToInt32(FunINIMethod.funINIReadValue("EAP01", "DEVICEID", "1", this.PInfo.All.SecomINIFilePath));
                this.PInfo.All.RetryCount = Convert.ToInt32(FunINIMethod.funINIReadValue("EAP01", "RETRYCOUNT", "3", this.PInfo.All.SecomINIFilePath));
                this.PInfo.All.LocalPort  = FunINIMethod.funINIReadValue("EAP01", "LOCALPORTNUMBER", "7000", this.PInfo.All.SecomINIFilePath);

                this.PInfo.All.T3 = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSecom, "T3", "45", this.PInfo.All.SecomINIFilePath));
                this.PInfo.All.T5 = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSecom, "T5", "10", this.PInfo.All.SecomINIFilePath));
                this.PInfo.All.T6 = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSecom, "T6", "5", this.PInfo.All.SecomINIFilePath));
                this.PInfo.All.T7 = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSecom, "T7", "10", this.PInfo.All.SecomINIFilePath));
                this.PInfo.All.T8 = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSecom, "T8", "5", this.PInfo.All.SecomINIFilePath));
                this.PInfo.All.T9 = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionHOST, "T9", "45", this.PInfo.All.SystemINIFilePath));

                //VCR Reading Result 정보를 읽는다.
                this.PInfo.All.VCRPass         = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionVCR, "Pass", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.VCRPMDT         = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionVCR, "PMDT", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.VCRMatch        = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionVCR, "Match", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.VCRMismatch     = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionVCR, "Mismatch", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.VCRKeyin        = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionVCR, "Keyin", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.VCRTimeout      = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionVCR, "Timeout", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.VCRSkip         = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionVCR, "Skip", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.VCRLastModified = FunINIMethod.funINIReadValue(dstrSectionVCR, "LastModified", "", this.PInfo.All.SystemINIFilePath);

                //MMC Log Data 관련 설정을 읽어 온다.           //추가 : 20101001 이상호
                this.PInfo.All.MCCNetworkPath      = FunINIMethod.funINIReadValue(dstrSectionMCC, "NetworkPath", "Ftp://192.168.1.1/", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.MCCNetworkBasicPath = FunINIMethod.funINIReadValue(dstrSectionMCC, "NetworkBasicPath", "", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.MCCNetworkPort      = FunINIMethod.funINIReadValue(dstrSectionMCC, "NetworkPort", "21", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.MCCNetworkUserID    = FunINIMethod.funINIReadValue(dstrSectionMCC, "NetworkUserID", "USERID", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.MCCNetworkPassword  = FunINIMethod.funINIReadValue(dstrSectionMCC, "NetworkPassword", "PASSWORD", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.MCCLootFilePath     = FunINIMethod.funINIReadValue(dstrSectionMCC, "LootFilePath", @"C:\MCCLOG", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.MCCFileUploadTime   = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionMCC, "MCCFileUploadTime", "0", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.MCCFileUploadUse    = Convert.ToBoolean(FunINIMethod.funINIReadValue(dstrSectionMCC, "MCCFileUploadUse", "True", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.MCCLogFileDelete    = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionMCC, "MCCLogFileDelete", "0", this.PInfo.All.SystemINIFilePath));

                //SEM 관련 설정을 읽어온다. - 110915 고석현
                this.PInfo.All.CommPort                = FunINIMethod.funINIReadValue(dstrSectionSEM, "SEM_Port", "NULL", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.SEM_BaudRate            = FunINIMethod.funINIReadValue(dstrSectionSEM, "SEM_BaudRate", "57600", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.SEMAlarmTime            = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSEM, "SEM_AlarmTime", "8", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.SEM_ErrorDelayCheckTime = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSEM, "SEM_ErrorDelayCheckTime", "10", this.PInfo.All.SystemINIFilePath));
                this.PInfo.All.SEM_ErrorCheckCount     = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionSEM, "SEM_ErrorCheckCount", "60", this.PInfo.All.SystemINIFilePath));


                //ETCInfo정보를 INI에서 읽어 구조체이 저장한다.
                this.PInfo.All.MDLN = FunINIMethod.funINIReadValue(dstrSectionInfo, "MDLN", "", this.PInfo.All.SystemINIFilePath);
                //this.PInfo.All.UserID = FunINIMethod.funINIReadValue(dstrSectionInfo, "UserID", "", this.PInfo.All.SystemINIFilePath);
                this.PInfo.All.CurrentLOTIndex = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionInfo, "CurrentLOTIndex", "0", this.PInfo.All.SystemINIFilePath));                     //현재까지 발번한 LOTIndex(1~999)
                this.PInfo.All.SoftVersion     = FunINIMethod.funINIReadValue(dstrSectionInfo, "SOFTREV", "", this.PInfo.All.SystemINIFilePath);

                this.PInfo.All.LoginFalg = (FunINIMethod.funINIReadValue(dstrSectionInfo, "LoginFlag", "TRUE", this.PInfo.All.SystemINIFilePath).ToUpper() == "FALSE") ? false : true;

                //모니터 해상도
                this.PInfo.All.SizeWidth  = 1024;
                this.PInfo.All.SizeHeight = 768;     // SystemInformation.PrimaryMonitorSize.Height;
                //}


                //EQPCount를 가져온다.
                dintCount = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionInfo, "EQPCount", "1", this.PInfo.All.SystemINIFilePath));

                //EQPCount 만큼 돌면서 기준정보를 저장한다.
                for (int dintLoop = 1; dintLoop <= dintCount; dintLoop++)
                {
                    dstrKey   = "EQP" + dintLoop.ToString();
                    dstrEQPID = FunINIMethod.funINIReadValue(dstrSectionEQP, dstrKey, "Main", this.PInfo.All.SystemINIFilePath);
                    if (this.PInfo.AddEQP(dstrEQPID) == true)
                    {
                        //UNIT정보를 INI에서 읽어 구조체에 저장한다.
                        this.PInfo.EQP(dstrEQPID).UnitCount = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionUnit, "Count", "0", this.PInfo.All.SystemINIFilePath));

                        //PORT정보를 INI에서 읽어 구조체에 저장한다.
                        this.PInfo.EQP(dstrEQPID).SlotCount = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrSectionPort, "SlotCount", "25", this.PInfo.All.SystemINIFilePath));

                        //PLC정보를 INI에서 읽어 구조체에 저장한다.
                        this.PInfo.EQP(dstrEQPID).DummyPLC     = Convert.ToBoolean(FunINIMethod.funINIReadValue(dstrEQPID, "Dummy", "true", this.PInfo.All.MCCINIFilePath));
                        this.PInfo.EQP(dstrEQPID).Type         = FunINIMethod.funINIReadValue(dstrEQPID, "Type", "PLC", this.PInfo.All.MCCINIFilePath);
                        this.PInfo.EQP(dstrEQPID).WordStart    = FunINIMethod.funINIReadValue(dstrEQPID, "Word1 Start", "W0000", this.PInfo.All.MCCINIFilePath);
                        this.PInfo.EQP(dstrEQPID).WordEnd      = FunINIMethod.funINIReadValue(dstrEQPID, "Word1 End", "W0000", this.PInfo.All.MCCINIFilePath);
                        this.PInfo.EQP(dstrEQPID).BitScanCount = FunINIMethod.funINIReadValue(dstrEQPID, "Scan Area Count", "3", this.PInfo.All.MCCINIFilePath);

                        //Scan에 필요한 값들을 읽어온다. 어경태 20071119
                        this.PInfo.EQP(dstrEQPID).ScanTime       = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrEQPID, "ScanTime", "200", PInfo.All.MCCINIFilePath));
                        this.PInfo.EQP(dstrEQPID).WorkingSizeMin = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrEQPID, "WorkingSizeMin", "1", PInfo.All.MCCINIFilePath));
                        this.PInfo.EQP(dstrEQPID).WorkingSizeMax = Convert.ToInt32(FunINIMethod.funINIReadValue(dstrEQPID, "WorkingSizeMax", "3", PInfo.All.MCCINIFilePath));

                        for (int dintIndex = 1; dintIndex <= 10; dintIndex++)
                        {
                            dstrKey = "Area" + dintIndex.ToString() + " ";
                            this.PInfo.EQP(dstrEQPID).BitScanEnabled[dintIndex] = Convert.ToBoolean(FunINIMethod.funINIReadValue(dstrEQPID, dstrKey + "Scan", "", this.PInfo.All.MCCINIFilePath));
                            this.PInfo.EQP(dstrEQPID).BitScanStart[dintIndex]   = FunINIMethod.funINIReadValue(dstrEQPID, dstrKey + "Start", "", this.PInfo.All.MCCINIFilePath);
                            this.PInfo.EQP(dstrEQPID).BitScanEnd[dintIndex]     = FunINIMethod.funINIReadValue(dstrEQPID, dstrKey + "End", "", this.PInfo.All.MCCINIFilePath);
                        }

                        //EQP
                        this.PInfo.EQP("Main").EQPID       = FunINIMethod.funINIReadValue(dstrSectionInfo, "EQPID", "EAP01", this.PInfo.All.SystemINIFilePath);
                        this.PInfo.EQP("Main").EQPName     = FunINIMethod.funINIReadValue(dstrSectionInfo, "EQPName", "WET ETCH", this.PInfo.All.SystemINIFilePath);
                        this.PInfo.EQP("Main").EQPType     = FunINIMethod.funINIReadValue(dstrSectionInfo, "EQPType", "", this.PInfo.All.SystemINIFilePath);
                        this.PInfo.EQP("Main").RecipeCheck = Convert.ToBoolean(FunINIMethod.funINIReadValue(dstrSectionInfo, "RecipeCheck", "true", this.PInfo.All.SystemINIFilePath));
                    }

                    //검사기 PC 설정 ---------------------------------------------------------------------------------------------------------------------------------------
                    this.PInfo.EQP(dstrEQPID).DummyPC    = Convert.ToBoolean(FunINIMethod.funINIReadValue("MCC_PC", "DummyPC", "true", this.PInfo.All.SystemINIFilePath));
                    this.PInfo.EQP(dstrEQPID).LocalPort  = FunINIMethod.funINIReadValue("MCC_PC", "LocalPort", "7050", this.PInfo.All.SystemINIFilePath);
                    this.PInfo.EQP(dstrEQPID).T3         = Convert.ToInt32(FunINIMethod.funINIReadValue("MCC_PC", "T3", "60", this.PInfo.All.SystemINIFilePath));
                    this.PInfo.EQP(dstrEQPID).RetryCount = Convert.ToInt32(FunINIMethod.funINIReadValue("MCC_PC", "RETRY", "3", this.PInfo.All.SystemINIFilePath));
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #12
0
        /// <summary>
        /// 설비에서 CIM으로 발생하는 Event에 대한 처리
        /// </summary>
        /// <param name="parameters">Parameter Array</param>
        /// <remarks>
        /// parameters[0] : strCompBit
        /// parameters[1] : dstrACTVal
        /// parameters[2] : dintActFrom
        /// parameters[3] : dstrACTFromSub
        /// parameters[4] : intBitVal
        /// parameters[5] : Special Parameter
        /// </remarks>
        public void funProcessEQPEvent(string[] parameters)
        {
            string strCompBit = parameters[0];

            StringBuilder dstrLog        = new StringBuilder();
            string        dstrEQPPPID    = "";
            int           dintPPIDType   = 0;
            string        dstrTemp       = "";
            string        strWordAddress = "";

            try
            {
                //m_pEqpAct.subWordReadSave("W2040", 10, EnuEQP.PLCRWType.ASCII_Data);    //HOST PPID
                dstrEQPPPID  = m_pEqpAct.funWordRead("W2540", 1, EnuEQP.PLCRWType.Int_Data);
                dintPPIDType = 1;
                #region 수정 전
                //pInfo.Unit(0).SubUnit(0).RemoveEQPPPID(dstrEQPPPID);
                //strWordAddress = "W254C";
                //if (pInfo.Unit(0).SubUnit(0).AddEQPPPID(dstrEQPPPID) == true)
                //{
                //    for (int dintLoop = 1; dintLoop <= pInfo.Unit(0).SubUnit(0).PPIDBodyCount; dintLoop++)
                //    {
                //        //EQPPPID에 Body 저장
                //        if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).AddPPIDBody(dintLoop) == true)
                //        {
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;
                //            if (pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length == 2)
                //            {
                //                dstrTemp = FunStringH.funPoint(m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.Int_Data), pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format);
                //                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                //            }
                //            else
                //            {
                //                dstrTemp = m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.ASCII_Data);
                //                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                //            }
                //            strWordAddress = CommonAct.FunTypeConversion.funAddressAdd(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length);
                //        }
                //    }
                //}
                # endregion
                #region 수정 후
                int    dintReadcount  = (pInfo.Unit(0).SubUnit(0).PPIDBodyCount - 5) * 2;
                string dstrReadData   = "";
                int    dintLength     = 0;
                string strValue       = "";
                int    dintStartIndex = 0;
                strWordAddress = "W254C";
                if (pInfo.Unit(0).SubUnit(0).AddEQPPPID(dstrEQPPPID) == true)
                {
                    //if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBodyCount == 0)
                    //{
                    //[2015/04/20] PPID Body 값 Block으로 한번에(Add by HS)
                    dstrReadData = m_pEqpAct.funWordRead("W254C", dintReadcount, EnuEQP.PLCRWType.Hex_Data, false).Trim();
                    #region EQPPPID에 Body 저장
                    for (int dintLoop = 1; dintLoop <= pInfo.Unit(0).SubUnit(0).PPIDBodyCount - 5; dintLoop++)
                    {
                        if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).AddPPIDBody(dintLoop) == true)
                        {
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range    = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode  = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;

                            dintLength = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length * 4;       //Length에 맞게 자를 문자열 개수를 가져온다.
                            dstrTemp   = dstrReadData.Substring(dintStartIndex, dintLength);

                            if (pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length > 1)
                            {
                                string dstrTemp1 = dstrTemp.Substring(0, 4);
                                string dstrTemp2 = dstrTemp.Substring(4, 4);
                                dstrTemp = dstrTemp2 + dstrTemp1;

                                strValue = FunTypeConversion.funHexConvert(dstrTemp, EnuEQP.StringType.Decimal);
                                dstrTemp = FunStringH.funPoint(strValue, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format);
                                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                            }
                            else
                            {
                                strValue = FunTypeConversion.funHexConvert(dstrTemp, EnuEQP.StringType.ASCString);
                                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = strValue;
                            }

                            dintStartIndex += dintLength;

                            #region 변경전 [2015.04.20] Modify by HS
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;

                            //if (pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length == 2)
                            //{
                            //    dstrTemp = FunStringH.funPoint(m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.Int_Data), pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format);
                            //    pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                            //}
                            //else
                            //{
                            //    dstrTemp = m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.ASCII_Data);
                            //    pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                            //}
                            //strWordAddress = CommonAct.FunTypeConversion.funAddressAdd(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length);
                            #endregion
                        }
                    }
                    #endregion

                    strWordAddress = CommonAct.FunTypeConversion.funAddressAdd(strWordAddress, dintReadcount);

                    dstrReadData   = m_pEqpAct.funWordRead(strWordAddress, 80, EnuEQP.PLCRWType.ASCII_Data, false);
                    dintStartIndex = 0;
                    #region EQPPPID에 Film Code 저장
                    for (int dintLoop = 251; dintLoop <= 255; dintLoop++)
                    {
                        if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).AddPPIDBody(dintLoop) == true)
                        {
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range    = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode  = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;

                            dintLength = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length * 2;       //Length에 맞게 자를 문자열 개수를 가져온다.
                            dstrTemp   = dstrReadData.Substring(dintStartIndex, dintLength);


                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp.Trim();
                        }

                        dintStartIndex += dintLength;
                    }
                    #endregion
                    //}
                }
                #endregion

                //PLC Req에 대한 CIM의 Confirm Bit를 준다.
                m_pEqpAct.subSetConfirmBit(strCompBit);

                switch (dintPPIDType)
                {
                case 1:             //EQP PPID
                {
                    pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S7F107PPIDCreatDeleteAndPPBodyChangedReport, "3", "1", "", dstrEQPPPID);

                    ArrayList           arrCon = new ArrayList();
                    InfoAct.clsHOSTPPID CurrentPPID;
                    foreach (string strPPID in pInfo.Unit(0).SubUnit(0).HOSTPPID())
                    {
                        CurrentPPID = pInfo.Unit(0).SubUnit(0).HOSTPPID(strPPID);
                        if (CurrentPPID.EQPPPID == dstrEQPPPID)
                        {
                            arrCon.Add(strPPID);
                        }
                    }

                    string dstrSQL = "";
                    for (int dintLoop = 0; dintLoop < arrCon.Count; dintLoop++)
                    {
                        pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S7F107PPIDCreatDeleteAndPPBodyChangedReport, "3", "2", arrCon[dintLoop].ToString(), dstrEQPPPID);

                        //pInfo.Unit(0).SubUnit(0).RemoveHOSTPPID(arrCon[dintLoop].ToString());

                        dstrSQL = string.Format("Update `tbHOSTPPID` set EQPPPID='{0}', DTime='{1}' Where HOSTPPID='{2}';", dstrEQPPPID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), arrCon[dintLoop].ToString());
                        DBAct.clsDBAct.funExecuteQuery(dstrSQL);
                    }
                }
                break;
                }

                //최종 수정된 날짜 Ini에 변경
                FunINIMethod.subINIWriteValue("ETCInfo", "RECIPELastModified", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), pInfo.All.SystemINIFilePath);
            }
コード例 #13
0
ファイル: clsEQPEventPPIDCreate.cs プロジェクト: k2un/k2un
        /// <summary>
        /// 설비에서 CIM으로 발생하는 Event에 대한 처리
        /// </summary>
        /// <param name="parameters">Parameter Array</param>
        /// <remarks>
        /// parameters[0] : strCompBit
        /// parameters[1] : dstrACTVal
        /// parameters[2] : dintActFrom
        /// parameters[3] : dstrACTFromSub
        /// parameters[4] : intBitVal
        /// parameters[5] : Special Parameter
        /// </remarks>
        public void funProcessEQPEvent(string[] parameters)
        {
            string strCompBit = parameters[0];

            StringBuilder dstrLog        = new StringBuilder();
            string        dstrEQPPPID    = "";
            int           dintPPIDType   = 0;
            string        dstrTemp       = "";
            string        strWordAddress = "";

            try
            {
                dstrEQPPPID  = m_pEqpAct.funWordRead("W2540", 1, EnuEQP.PLCRWType.Int_Data);
                dintPPIDType = 1;
                pInfo.Unit(0).SubUnit(0).RemoveEQPPPID(dstrEQPPPID);
                #region 수정 전
                //strWordAddress = "W254C";
                //if (pInfo.Unit(0).SubUnit(0).AddEQPPPID(dstrEQPPPID) == true)
                //{
                //    for (int dintLoop = 1; dintLoop <= pInfo.Unit(0).SubUnit(0).PPIDBodyCount; dintLoop++)
                //    {
                //        //EQPPPID에 Body 저장
                //        if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).AddPPIDBody(dintLoop) == true)
                //        {
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                //            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;

                //            if (pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length == 2)
                //            {
                //                dstrTemp = FunStringH.funPoint(m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.Int_Data), pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format);
                //                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                //            }
                //            else
                //            {
                //                dstrTemp = m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.ASCII_Data);
                //                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                //            }
                //            strWordAddress = CommonAct.FunTypeConversion.funAddressAdd(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length);
                //        }
                //    }
                //}
                #endregion

                #region 수정 후
                int    dintReadcount  = (pInfo.Unit(0).SubUnit(0).PPIDBodyCount - 5) * 2;
                string dstrReadData   = "";
                int    dintLength     = 0;
                string strValue       = "";
                int    dintStartIndex = 0;
                strWordAddress = "W254C";
                if (pInfo.Unit(0).SubUnit(0).AddEQPPPID(dstrEQPPPID) == true)
                {
                    //if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBodyCount == 0)
                    //{
                    //[2015/04/20] PPID Body 값 Block으로 한번에(Add by HS)
                    dstrReadData = m_pEqpAct.funWordRead("W254C", dintReadcount, EnuEQP.PLCRWType.Hex_Data, false).Trim();
                    #region EQPPPID에 Body 저장
                    for (int dintLoop = 1; dintLoop <= pInfo.Unit(0).SubUnit(0).PPIDBodyCount - 5; dintLoop++)
                    {
                        if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).AddPPIDBody(dintLoop) == true)
                        {
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range    = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode  = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;

                            dintLength = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length * 4;   //Length에 맞게 자를 문자열 개수를 가져온다.
                            dstrTemp   = dstrReadData.Substring(dintStartIndex, dintLength);

                            if (pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length > 1)
                            {
                                string dstrTemp1 = dstrTemp.Substring(0, 4);
                                string dstrTemp2 = dstrTemp.Substring(4, 4);
                                dstrTemp = dstrTemp2 + dstrTemp1;

                                strValue = FunTypeConversion.funHexConvert(dstrTemp, EnuEQP.StringType.Decimal);
                                dstrTemp = FunStringH.funPoint(strValue, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format);
                                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                            }
                            else
                            {
                                strValue = FunTypeConversion.funHexConvert(dstrTemp, EnuEQP.StringType.ASCString);
                                pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = strValue;
                            }

                            dintStartIndex += dintLength;

                            #region 변경전 [2015.04.20] Modify by HS
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                            //pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;

                            //if (pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length == 2)
                            //{
                            //    dstrTemp = FunStringH.funPoint(m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.Int_Data), pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format);
                            //    pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                            //}
                            //else
                            //{
                            //    dstrTemp = m_pEqpAct.funWordRead(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length, EnuEQP.PLCRWType.ASCII_Data);
                            //    pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp;
                            //}
                            //strWordAddress = CommonAct.FunTypeConversion.funAddressAdd(strWordAddress, pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length);
                            #endregion
                        }
                    }
                    #endregion

                    strWordAddress = CommonAct.FunTypeConversion.funAddressAdd(strWordAddress, dintReadcount);

                    dstrReadData   = m_pEqpAct.funWordRead(strWordAddress, 80, EnuEQP.PLCRWType.ASCII_Data, false);
                    dintStartIndex = 0;
                    #region EQPPPID에 Film Code 저장
                    for (int dintLoop = 251; dintLoop <= 255; dintLoop++)
                    {
                        if (pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).AddPPIDBody(dintLoop) == true)
                        {
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).DESC     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).DESC;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Format   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Format;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Length   = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).ModuleID = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).ModuleID;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Name     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Name;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Range    = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Range;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Unit     = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Unit;
                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).UseMode  = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).UseMode;

                            dintLength = pInfo.Unit(0).SubUnit(0).PPIDBody(dintLoop).Length * 2;   //Length에 맞게 자를 문자열 개수를 가져온다.
                            dstrTemp   = dstrReadData.Substring(dintStartIndex, dintLength);


                            pInfo.Unit(0).SubUnit(0).EQPPPID(dstrEQPPPID).PPIDBody(dintLoop).Value = dstrTemp.Trim();
                        }

                        dintStartIndex += dintLength;
                    }
                    #endregion
                    //}
                }
                #endregion

                //PLC Req에 대한 CIM의 Confirm Bit를 준다.
                m_pEqpAct.subSetConfirmBit(strCompBit);

                switch (dintPPIDType)
                {
                case 1:             //EQP PPID
                    //Parameter.log에 로그 출력
                    m_pEqpAct.subSetParameterLog("EQP PPID 생성", "", null, dstrEQPPPID, dstrEQPPPID);

                    int[]  arrData = new int[16];
                    string strData = "";
                    if (pInfo.EQP("Main").DummyPLC)
                    {
                        foreach (string strEQPPID in pInfo.Unit(0).SubUnit(0).EQPPPID())
                        {
                            arrData[Convert.ToInt32(strEQPPID) - 1] = 1;
                        }

                        for (int dintLoop = 16; dintLoop > 0; dintLoop--)
                        {
                            strData += arrData[dintLoop - 1].ToString();
                        }

                        strData = CommonAct.FunTypeConversion.funBinConvert(strData, EnuEQP.StringType.Hex);
                        m_pEqpAct.funWordWrite("W2A00", strData, EnuEQP.PLCRWType.Hex_Data);
                    }

                    pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S7F107PPIDCreatDeleteAndPPBodyChangedReport, "1", "1", "", dstrEQPPPID);
                    break;
                }

                //최종 수정된 날짜 Ini에 변경
                FunINIMethod.subINIWriteValue("ETCInfo", "RECIPELastModified", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), pInfo.All.SystemINIFilePath);
            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
コード例 #14
0
ファイル: clsS2F103.cs プロジェクト: k2un/k2un
        /// <summary>
        /// Primary Message에 대해 처리한 후 Secondary Message를 Biuld하여 Driver에 전송한다.
        /// </summary>
        /// <param name="msgTran">Primary Message의 Transaction</param>
        public void funPrimaryReceive(Transaction msgTran)
        {
            string  dstrModuleID                = "";
            int     dintEOIDTemp                = 0;;
            int     dintEOIDCount               = 0;
            int     dintEOID                    = 0;
            int     dintEOMD                    = 0;
            int     dintEOV                     = 0;
            int     dintEAC                     = 0;
            int     dintMIACK                   = 0;
            string  dstrEOIDIndex               = "";
            int     dintIndex                   = 0;
            int     dintEOMDCount               = 0;
            string  dstrSQL                     = "";
            int     dintMatchEOIDCount          = 0;            //한개라도 안 맞으면 적용안함 20130308
            Boolean dbolEQPProcessTimeOverReset = false;        //기존에 설정되어 있던 EQP Process Time Over 체크 설정을 다시 할지 여부
            Boolean dbolSuccess                 = false;
            bool    dbolEOIDExist               = true;

            try
            {
                dstrModuleID = msgTran.Primary().Item("MODULEID").Getvalue().ToString().Trim();
                //ModuleID가 존재하지 않는 경우
                if (dstrModuleID != pInfo.Unit(3).SubUnit(0).ModuleID)
                {
                    msgTran.Secondary().Item("MODULEID").Putvalue(dstrModuleID);
                    msgTran.Secondary().Item("MIACK").Putvalue(1);
                    msgTran.Secondary().Item("EOIDCOUNT").Putvalue(0);

                    funSendReply(msgTran);

                    return;
                }

                dintEOIDCount = Convert.ToInt32(msgTran.Primary().Item("EOIDCOUNT").Getvalue());

                //EOID가 6이나 17이 아닌게 하나라도 있으면 NACK보고 후 리턴
                //2011.01.13    송 은선
                for (int dintLoop = 1; dintLoop <= dintEOIDCount; dintLoop++)
                {
                    dintEOIDTemp = Convert.ToInt32(msgTran.Primary().Item("EOID" + (dintLoop - 1)).Getvalue());

                    if (pInfo.funGetEOIDToIndex(dintEOIDTemp) == 0)
                    {
                        dbolEOIDExist = false;
                        //msgTran.Secondary().Item("MODULEID").Putvalue(dstrModuleID);
                        //msgTran.Secondary().Item("MIACK").Putvalue(2);
                        //msgTran.Secondary().Item("EOIDCOUNT").Putvalue(0);

                        //funSendReply(msgTran);
                        //return;
                    }
                }

                msgTran.Secondary().Item("MODULEID").Putvalue(dstrModuleID);
                msgTran.Secondary().Item("EOIDCOUNT").Putvalue(dintEOIDCount);

                //받은 EOID중에 존재하지 않는것이 하나라도 있으면 NAK으로 보고하고 모두 적용하지 않는다.
                for (int dintLoop = 1; dintLoop <= dintEOIDCount; dintLoop++)
                {
                    dintEOMDCount = Convert.ToInt32(msgTran.Primary().Item("EOMDCOUNT" + (dintLoop - 1)).Getvalue());

                    for (int dintLoop2 = 1; dintLoop2 <= dintEOMDCount; dintLoop2++)
                    {
                        dintEOID = Convert.ToInt32(msgTran.Primary().Item("EOID" + (dintLoop - 1)).Getvalue());
                        dintEOMD = Convert.ToInt32(msgTran.Primary().Item("EOMD" + (dintLoop - 1) + (dintLoop2 - 1)).Getvalue());
                        dintEOV  = Convert.ToInt32(msgTran.Primary().Item("EOV" + (dintLoop - 1) + (dintLoop2 - 1)).Getvalue());

                        //EOMD, EOMD값으로 Index를 찾는다.(Index가 Key값이기 떄문)
                        dintIndex = pInfo.funGetEOIDEOMDToIndex(dintEOID, dintEOMD);
                        if (pInfo.Unit(0).SubUnit(0).EOID(dintIndex) != null)   //존재하는 EOID임.
                        {
                            //EOMD 유효성 검사
                            if (dintEOMD >= pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOMDMin&& dintEOMD <= pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOMDMax)
                            {
                                if (dintEOV >= pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMin&& dintEOV <= pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMax)
                                {
                                    if (dintEOID == 8)                                                    //VCR Reading Mode는 0,1,2,3 만 값이 있다.(이외의 값이 오면 Error임.)
                                    {
                                        if (dintEOV == 0 || dintEOV == 1 || dintEOV == 2 || dintEOV == 3) //EOV값 정상
                                        {
                                            dintEAC             = 0;                                      //EOMD 정상
                                            dintMatchEOIDCount += 1;                                      //옳은 EOID 개수 누적
                                        }
                                        else
                                        {
                                            dintEAC = 3;          //3 = Denied, At least one constant out of range
                                        }
                                    }
                                    else
                                    {
                                        dintEAC             = 0;        //EOMD 정상
                                        dintMatchEOIDCount += 1;        //옳은 EOID 개수 누적
                                    }
                                }
                                else
                                {
                                    dintEAC = 3;          //3 = Denied, At least one constant out of range
                                }
                            }
                            else
                            {
                                dintEAC = 1;        //1 = Denied, At least one constant does not exist
                            }
                        }
                        else                        //존재하지 않는 EOID임.
                        {
                            dintEAC = 1;            //1 = Denied, At least one constant does not exist
                        }

                        msgTran.Secondary().Item("EOID" + (dintLoop - 1)).Putvalue(dintEOID);
                        msgTran.Secondary().Item("EOMDCOUNT" + (dintLoop - 1)).Putvalue(dintEOMDCount);

                        msgTran.Secondary().Item("EOMD" + (dintLoop - 1) + (dintLoop2 - 1)).Putvalue(dintEOMD);
                        msgTran.Secondary().Item("EAC" + (dintLoop - 1) + (dintLoop2 - 1)).Putvalue(dintEAC);
                    }
                }

                //if (dbolEOIDExist == false)
                //{
                //    dintMIACK = 2;  //없는 EOID를 받았다.
                //}
                //else
                {
                    dintMIACK = 0;  //정상
                }

                msgTran.Secondary().Item("MIACK").Putvalue(dintMIACK);


                //HOST로 S2F104 보고
                funSendReply(msgTran);

                //유효성 검사에서 OK이면 S6F11(CEID=101) 보고
                if (dintMatchEOIDCount == dintEOIDCount)
                {
                    pInfo.All.EOIDChangeBYWHO = "1";   //BY HOST

                    //구조체를 변경
                    for (int dintLoop = 1; dintLoop <= dintEOIDCount; dintLoop++)
                    {
                        dintEOMDCount = Convert.ToInt32(msgTran.Primary().Item("EOMDCOUNT" + (dintLoop - 1)).Getvalue());

                        for (int dintLoop2 = 1; dintLoop2 <= dintEOMDCount; dintLoop2++)
                        {
                            dintEOID = Convert.ToInt32(msgTran.Primary().Item("EOID" + (dintLoop - 1)).Getvalue());
                            dintEOMD = Convert.ToInt32(msgTran.Primary().Item("EOMD" + (dintLoop - 1) + (dintLoop2 - 1)).Getvalue());
                            dintEOV  = Convert.ToInt32(msgTran.Primary().Item("EOV" + (dintLoop - 1) + (dintLoop2 - 1)).Getvalue());

                            //EOMD, EOMD값으로 Index를 찾는다.(Index가 Key값이기 떄문)
                            dintIndex = pInfo.funGetEOIDEOMDToIndex(dintEOID, dintEOMD);

                            if (pInfo.Unit(0).SubUnit(0).EOID(dintIndex) != null)
                            {
                                if (dintEOV >= pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMin&& dintEOV <= pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOVMax)  // && dintEOV != this.PInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV
                                {
                                    //if (dintEOID == 8)     //VCR Reading Mode는 0,1,2,3 만 값이 있다.(이외의 값이 오면 Error임.)
                                    //{
                                    //    if (dintEOV == 0 || dintEOV == 1 || dintEOV == 2 || dintEOV == 3)       //EOV값 정상
                                    //    {
                                    //        dbolSuccess = true;
                                    //    }
                                    //    else
                                    //    {
                                    //        dbolSuccess = false;
                                    //    }
                                    //}
                                    //else
                                    {
                                        dbolSuccess = true;
                                    }

                                    //True이면 업데이트 한다.  이때 EOV의 이전값과 바꾸는 값이 동일하면 넘어간다(S6F11 보고를 안하기 위해서임) - 같은값이 와도 보고해야됨(입고전검수) 20101208 KJK
                                    if (dbolSuccess == true)    // && dintEOV != this.PInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV
                                    {
                                        #region "LOG 출력"
                                        pInfo.subLog_Set(InfoAct.clsInfo.LogType.Parameter, string.Format("EOID,{0},변경,{1},{2},{3},{4}", DateTime.Now.ToString("yyyyMMddHHmmss"), pInfo.All.UserID, pInfo.Unit(0).SubUnit(0).EOID(dintIndex).DESC, pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV, dintEOV));      //로그 출력
                                        #endregion



                                        this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV = dintEOV;
                                        dstrEOIDIndex = dstrEOIDIndex + dintIndex.ToString() + ";";

                                        //DB Update
                                        dstrSQL = "Update tbEOID set EOV=" + dintEOV.ToString() + " Where Index=" + dintIndex.ToString();

                                        if (DBAct.clsDBAct.funExecuteQuery(dstrSQL) == false)
                                        {
                                            funSetLog(InfoAct.clsInfo.LogType.CIM, "DB Update Fail: EOID Index: " + dintIndex.ToString());
                                        }

                                        pInfo.DeleteTable("EOID");
                                        dstrSQL = "SELECT * FROM tbEOID order by Index";
                                        DataTable dt = DBAct.clsDBAct.funSelectQuery(dstrSQL);
                                        pInfo.AddDataTable("EOID", dt);
                                        pInfo.AddViewEvent(InfoAct.clsInfo.ViewEvent.EOIDUpdate);


                                        switch (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOID)
                                        {
                                        case 17:                           //MCC Reporting Mode (Decision to transfer MCC log file to File Server)
                                            if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV == 1)
                                            {
                                                FunINIMethod.subINIWriteValue("MCC", "MCCFileUploadUse", "True", this.pInfo.All.SystemINIFilePath);
                                                this.pInfo.All.MCC_UPLOAD = true;
                                            }
                                            else
                                            {
                                                FunINIMethod.subINIWriteValue("MCC", "MCCFileUploadUse", "False", this.pInfo.All.SystemINIFilePath);
                                                this.pInfo.All.MCC_UPLOAD = false;
                                            }
                                            break;

                                        case 19:                // SEM On/Off
                                            if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV == 1)
                                            {
                                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.UDPPortOpen);
                                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerStart);
                                            }
                                            else
                                            {
                                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SEMControllerEnd);
                                                this.pInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.UDPPortClose);
                                            }
                                            break;

                                        case 21:
                                            if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV == 1)
                                            {
                                                //FunINIMethod.subINIWriteValue("MCC", "MCCFileUploadUse", "True", this.pInfo.All.SystemINIFilePath);
                                                pInfo.All.APCUSE = true;
                                            }
                                            else
                                            {
                                                //FunINIMethod.subINIWriteValue("MCC", "MCCFileUploadUse", "False", this.pInfo.All.SystemINIFilePath);
                                                pInfo.All.APCUSE = false;
                                            }
                                            break;

                                        case 22:
                                            if (this.pInfo.Unit(0).SubUnit(0).EOID(dintIndex).EOV == 1)
                                            {
                                                //FunINIMethod.subINIWriteValue("MCC", "MCCFileUploadUse", "True", this.pInfo.All.SystemINIFilePath);
                                                pInfo.All.RPCUSE = true;
                                            }
                                            else
                                            {
                                                //FunINIMethod.subINIWriteValue("MCC", "MCCFileUploadUse", "False", this.pInfo.All.SystemINIFilePath);
                                                pInfo.All.RPCUSE = false;
                                            }
                                            break;

                                        default:
                                        {
                                        }
                                        break;
                                        }
                                    }

                                    dbolSuccess = false;  //초기화
                                }
                            }
                        }
                    }

                    //CEID=101, Host로 보고
                    pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S6F11RelatedEquipmentParameterEvent, 101, dstrEOIDIndex); //마지막 인자는 EOID Index임

                    pInfo.All.EOIDChangeBYWHO = "";                                                                      //초기화

                    //최종 수정된 날짜 Ini에 변경
                    FunINIMethod.subINIWriteValue("ETCInfo", "EOIDLastModified", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), pInfo.All.SystemINIFilePath);
                }

                if (dbolEQPProcessTimeOverReset == true)
                {
                    pInfo.All.EQPProcessTimeOverReset = true;
                }
            }
            catch (Exception error)
            {
                funSetLog(InfoAct.clsInfo.LogType.CIM, error.ToString());
                return;
            }
        }
コード例 #15
0
        /// <summary>
        /// 설비에서 CIM으로 발생하는 Event에 대한 처리
        /// </summary>
        /// <param name="parameters">Parameter Array</param>
        /// <remarks>
        /// parameters[0] : strCompBit
        /// parameters[1] : dstrACTVal
        /// parameters[2] : dintActFrom
        /// parameters[3] : dstrACTFromSub
        /// parameters[4] : intBitVal
        /// parameters[5] : Special Parameter
        /// </remarks>
        public void funProcessEQPEvent(string[] parameters)
        {
            string strCompBit = parameters[0];
            int    dintIndex  = 0;
            //int dintIndex2 = 0;
            string dstrWordAddress = "";
            string dstrECIDReport  = "";
            string dstrECSLL       = "";
            string dstrECWLL       = "";
            string dstrECDEF       = "";
            string dstrECWUL       = "";
            string dstrECSUL       = "";
            string dstrLog         = "";
            string dstrSQL         = "";

            string[] dstrValue        = null;
            int      dintECID         = 0;
            string   dstrECIDReadData = "";
            string   strData          = "";
            string   dstrECID         = "";

            try
            {
                dstrWordAddress = "W2A00";

                dstrECIDReadData = m_pEqpAct.funWordRead(dstrWordAddress, pInfo.Unit(0).SubUnit(0).ECIDCount * 7, EnuEQP.PLCRWType.Hex_Data);
                //PLC Req에 대한 CIM의 Confirm Bit를 준다.
                m_pEqpAct.subSetConfirmBit(strCompBit);

                // 디비트랜젝션... 해야지..
                if (DBAct.clsDBAct.funOleDbTransaction() == null)
                {
                    DBAct.clsDBAct.funBeginTransaction();
                }

                OleDbTransaction odbTransaction = DBAct.clsDBAct.funOleDbTransaction();


                for (int dintLoop = 1; dintLoop <= pInfo.Unit(0).SubUnit(0).ECIDCount; dintLoop++)
                {
                    strData  = dstrECIDReadData.Substring((dintLoop - 1) * 28, 28);
                    dstrECID = strData.Substring(0, 4);
                    dintECID = Convert.ToInt32(FunTypeConversion.funHexConvert(dstrECID, EnuEQP.StringType.Decimal));  //ECID

                    //dstrECSLL = strData.Substring(4, 8); // ECSLL
                    dstrECWLL = strData.Substring(4, 8);
                    dstrECWLL = dstrECWLL.Substring(4, 4) + dstrECWLL.Substring(0, 4);
                    dstrECDEF = strData.Substring(12, 8); // ECDEF
                    dstrECDEF = dstrECDEF.Substring(4, 4) + dstrECDEF.Substring(0, 4);
                    //dstrECSUL = strData.Substring(20, 8); // ECSUL
                    dstrECWUL = strData.Substring(20, 8);
                    dstrECWUL = dstrECWUL.Substring(4, 4) + dstrECWUL.Substring(0, 4);

                    //dstrECSLL = FunTypeConversion.funDecimalConvert(dstrECSLL, EnuEQP.StringType.Hex);
                    //dstrECDEF = FunTypeConversion.funDecimalConvert(dstrECDEF, EnuEQP.StringType.Hex);
                    //dstrECSUL = FunTypeConversion.funDecimalConvert(dstrECSUL, EnuEQP.StringType.Hex);

                    dstrECWLL = FunTypeConversion.funHexConvert(dstrECWLL, EnuEQP.StringType.Decimal);
                    dstrECDEF = FunTypeConversion.funHexConvert(dstrECDEF, EnuEQP.StringType.Decimal);
                    dstrECWUL = FunTypeConversion.funHexConvert(dstrECWUL, EnuEQP.StringType.Decimal);

                    ////dstrECSLL = FunTypeConversion.funPlusMinusAPDCalc(dstrECSLL);
                    //dstrECWLL = FunTypeConversion.funPlusMinusAPDCalc(dstrECWLL);
                    //dstrECDEF = FunTypeConversion.funPlusMinusAPDCalc(dstrECDEF);
                    ////dstrECSUL = FunTypeConversion.funPlusMinusAPDCalc(dstrECSUL);
                    //dstrECWUL = FunTypeConversion.funPlusMinusAPDCalc(dstrECWUL);

                    //dstrECSLL = FunStringH.funPoint(dstrECSLL, pInfo.Unit(0).SubUnit(0).ECID(dintLoop).Format);
                    dstrECWLL = FunStringH.funPoint(dstrECWLL, pInfo.Unit(0).SubUnit(0).ECID(dintLoop).Format);
                    dstrECDEF = FunStringH.funPoint(dstrECDEF, pInfo.Unit(0).SubUnit(0).ECID(dintLoop).Format);
                    //dstrECSUL = FunStringH.funPoint(dstrECSUL, pInfo.Unit(0).SubUnit(0).ECID(dintLoop).Format);
                    dstrECWUL = FunStringH.funPoint(dstrECWUL, pInfo.Unit(0).SubUnit(0).ECID(dintLoop).Format);



                    if (pInfo.Unit(0).SubUnit(0).ECID(dintECID) != null)
                    {
                        if (pInfo.Unit(0).SubUnit(0).ECID(dintECID).ECDEF != dstrECDEF ||
                            pInfo.Unit(0).SubUnit(0).ECID(dintECID).ECWLL != dstrECWLL ||
                            pInfo.Unit(0).SubUnit(0).ECID(dintECID).ECWUL != dstrECWUL)
                        // pInfo.Unit(0).SubUnit(0).ECID(dintECID).ECSLL != dstrECSLL ||
                        //pInfo.Unit(0).SubUnit(0).ECID(dintECID).ECSUL != dstrECSUL)
                        {
                            dstrECIDReport += dintLoop.ToString() + ";";

                            //로그 출력
                            //dstrLog = dstrLog + "ECID" + ",";
                            //dstrLog = dstrLog + DateTime.Now.ToString("yyyyMMddHHmmss") + ",";
                            //dstrLog = dstrLog + "변경" + ",";
                            //dstrLog = dstrLog + pInfo.All.UserID + ",";
                            //dstrLog = dstrLog + "ECID(" + dintLoop.ToString() + "): " + pInfo.Unit(0).SubUnit(0).ECID(dintLoop).DESC + ",";
                            //dstrLog = dstrLog + pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECSLL + ",";
                            //dstrLog = dstrLog + pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECDEF + ",";
                            //dstrLog = dstrLog + pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECSUL + ",";

                            //dstrLog = dstrLog + dstrECSLL + ",";
                            //dstrLog = dstrLog + dstrECWLL + ",";
                            //dstrLog = dstrLog + dstrECDEF + ",";
                            //dstrLog = dstrLog + dstrECWUL + ",";
                            //dstrLog = dstrLog + dstrECSUL;


                            dstrLog = string.Format("ECID,{0},변경,{1},ECID({2}): {3},{4} -> {5}, {6} -> {7}, {8} -> {9}",
                                                    DateTime.Now.ToString("yyyyMMddHHmmss"),
                                                    pInfo.All.UserID,
                                                    dintLoop.ToString(),
                                                    pInfo.Unit(0).SubUnit(0).ECID(dintLoop).DESC,
                                                    pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECWLL,
                                                    dstrECWLL,
                                                    pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECDEF,
                                                    dstrECDEF,
                                                    pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECWUL,
                                                    dstrECWUL
                                                    );

                            pInfo.subLog_Set(InfoAct.clsInfo.LogType.Parameter, dstrLog); //로그 출력
                            dstrLog = "";                                                 //초기화

                            //구조체 업데이트

                            pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECSLL = dstrECWLL;
                            pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECWLL = dstrECWLL;
                            pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECDEF = dstrECDEF;
                            pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECWUL = dstrECWUL;
                            pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECSUL = dstrECWUL;

                            dstrSQL = "Update tbECID set ECSLL=" + pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECSLL + ", ECWLL=" + dstrECWLL + ", ECDEF=" + dstrECDEF +
                                      ", ECWUL=" + dstrECWUL + ", ECSUL=" + pInfo.Unit(0).SubUnit(0).ECID(dintLoop).ECSUL + " Where ECID=" + dintLoop.ToString();

                            if (DBAct.clsDBAct.funExecuteNonQuery(dstrSQL) == false)
                            {
                                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, "DB Update Fail(subLoadECID): ECID: " + dintLoop.ToString());
                            }
                        }
                    }
                }

                if (DBAct.clsDBAct.funOleDbTransaction() != null)
                {
                    DBAct.clsDBAct.funCommitTransaction();
                }


                // 디비내용 업데이트는 한번만 하면 되지.. 이게 뭐니...
                pInfo.DeleteTable("ECID");
                dstrSQL = "SELECT * FROM tbECID order by ECID";
                DataTable dt = DBAct.clsDBAct.funSelectQuery(dstrSQL);
                pInfo.AddDataTable("ECID", dt);
                pInfo.AddViewEvent(InfoAct.clsInfo.ViewEvent.ECIDUpdate);

                if (pInfo.All.ECIDChangeBYWHO == "1" || pInfo.All.ECIDChangeBYWHO == "2")
                {
                    //HOST나 OP에서 발생한것임
                    dstrECIDReport = pInfo.All.ECIDChangeFromHost;
                    pInfo.All.ECIDChangeFromHost = "";
                    //m_pInfo.All.ECIDChangeBYWHO = "";
                }
                else
                {
                    pInfo.All.ECIDChangeBYWHO = "2";  //By Equipment
                }


                pInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S6F11RelatedEquipmentParameterEvent, 102, dstrECIDReport); //마지막 인자는 ECID임
                pInfo.All.ECIDChangeBYWHO = "";

                //최종 수정된 날짜 Ini에 변경
                FunINIMethod.subINIWriteValue("ETCInfo", "ECIDLastModified", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), pInfo.All.SystemINIFilePath);
            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
                if (!DBAct.clsDBAct.funIsNullTransaction())
                {
                    DBAct.clsDBAct.funCommitTransaction();
                }
            }
        }