Exemple #1
0
        private void tmrUpdateSEM_Tick(object sender, EventArgs e)
        {
            try
            {
                this.tmrUpdateSEM.Enabled = false;

                if (dintRowCountOld != pInfo.Unit(0).SubUnit(0).SVIDCount)
                {
                    subUpdate();
                    dintRowCountOld = pInfo.Unit(0).SubUnit(0).SVIDCount;
                }

                for (int dintLoop = 0; dintLoop < dataGridView1.Rows.Count - 1; dintLoop++)
                {
                    int dintSVID = Convert.ToInt32(dataGridView1.Rows[dintLoop].Cells[0].Value.ToString());
                    dataGridView1.Rows[dintLoop].Cells["VALUE"].Value = this.pInfo.Unit(0).SubUnit(0).SVID(dintSVID).Value;
                }

                dataGridView1.Sort(new RowComparer(SortOrder.Ascending));
            }
            catch (Exception ex)
            {
                this.pInfo.subLog_Set(clsInfo.LogType.CIM, ex.ToString());
            }
            finally
            {
                this.tmrUpdateSEM.Enabled = true;
            }
        }
Exemple #2
0
        /// <summary>
        /// DataGridView 초기화 (Port & Unit 정보)
        /// </summary>
        private void subMainGridViewInitial()
        {
            try
            {
                for (int dintLoop = 0; dintLoop < PInfo.UnitCount; dintLoop++)
                {
                    PInfo.Unit(dintLoop + 1).SubUnit(0).eqpState        += new clsSubUnit.EQPStateChange(eqpState);
                    PInfo.Unit(dintLoop + 1).SubUnit(0).eqpProcessState += new clsSubUnit.EQPProcessStateChange(eqpProcessState);
                    PInfo.Unit(dintLoop + 1).SubUnit(0).filmexist       += new clsSubUnit.FilmExistChange(filmexist);
                    PInfo.Unit(dintLoop + 1).SubUnit(0).glsexist        += new clsSubUnit.GLSExistChange(glsexist);


                    eqpState(dintLoop + 1, PInfo.Unit(dintLoop + 1).SubUnit(0).EQPState);
                    eqpProcessState(dintLoop + 1, PInfo.Unit(dintLoop + 1).SubUnit(0).EQPProcessState);
                    if (dintLoop == 7)
                    {
                        glsexist(8, PInfo.Unit(8).SubUnit(0).GLSExist);
                    }
                    else
                    {
                        filmexist(dintLoop + 1, PInfo.Unit(dintLoop + 1).SubUnit(0).FilmExist);
                    }
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #3
0
 public void subFormLoad(string strHostPPIDName)
 {
     try
     {
         txtHOSTPPID.Text             = strHostPPIDName;
         this.txtEQPPPID_Current.Text = PInfo.Unit(0).SubUnit(0).HOSTPPID(strHostPPIDName).EQPPPID;
     }
     catch (Exception ex)
     {
         PInfo.subLog_Set(clsInfo.LogType.CIM, ex.ToString());
     }
 }
Exemple #4
0
        /// <summary>
        /// 해당 알람정보 Display
        /// </summary>
        private void subAlarmInfoDisplay()
        {
            string dstrDateTime = "";

            try
            {
                this.lvwAlarmInfo.Items.Clear();

                string[]     dstrData = new string[] { "", "" };
                ListViewItem lvIPort;

                dstrData[0] = "Alarm ID";
                dstrData[1] = pintAlarmID.ToString();

                lvIPort = new ListViewItem(dstrData);
                this.lvwAlarmInfo.Items.Add(lvIPort);

                dstrData[0] = "Alarm Description";
                if (PInfo.Unit(pintUnitID).SubUnit(0).Alarm(pintAlarmID) == null)
                {
                    dstrData[1] = "";
                }
                else
                {
                    dstrData[1] = PInfo.Unit(pintUnitID).SubUnit(0).Alarm(pintAlarmID).AlarmDesc;
                }

                lvIPort = new ListViewItem(dstrData);
                this.lvwAlarmInfo.Items.Add(lvIPort);

                dstrData[0]  = "Occur Time";
                dstrDateTime = pstrDate.Substring(0, 4) + "-" + pstrDate.Substring(4, 2) + "-" + pstrDate.Substring(6, 2) + " " +
                               pstrDate.Substring(8, 2) + ":" + pstrDate.Substring(10, 2) + ":" + pstrDate.Substring(12, 2);
                dstrData[1] = dstrDateTime;

                lvIPort = new ListViewItem(dstrData);
                this.lvwAlarmInfo.Items.Add(lvIPort);

                lvIPort = null;
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtHOSTPPID.Text) == false && string.IsNullOrEmpty(txtEQPPPID.Text) == false)
                {
                    if (PInfo.Unit(0).SubUnit(0).HOSTPPID(txtHOSTPPID.Text) == null)
                    {
                        string strDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        PInfo.Unit(0).SubUnit(0).AddHOSTPPID(txtHOSTPPID.Text);
                        PInfo.Unit(0).SubUnit(0).HOSTPPID(txtHOSTPPID.Text);

                        PInfo.Unit(0).SubUnit(0).HOSTPPID(txtHOSTPPID.Text).EQPPPID  = txtEQPPPID.Text;
                        PInfo.Unit(0).SubUnit(0).HOSTPPID(txtHOSTPPID.Text).DateTime = strDateTime;

                        string dstrSQL = string.Format("INSERT INTO `tbHOSTPPID` values ('{0}','{1}','{2}');", txtHOSTPPID.Text, txtEQPPPID.Text, strDateTime);
                        clsDBAct.funExecuteQuery(dstrSQL);

                        PInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S7F107PPIDCreatDeleteAndPPBodyChangedReport, "1", "2", txtHOSTPPID.Text, txtEQPPPID.Text);
                        DialogResult = System.Windows.Forms.DialogResult.Yes;
                        this.Hide();
                    }
                    else
                    {
                        //Error Message!!
                        MessageBox.Show("Error!! HostPPID Exist!!");
                    }
                }
                else
                {
                    MessageBox.Show("Input Data Error!!");
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #6
0
        private void subFormInitial(int dintType)
        {
            try
            {
                //PInfo.All.SelectPPIDType = dintType;
                grdPPIDList.Rows.Clear();
                if (dintType == 1)
                {
                    foreach (string EQPPPPID in PInfo.Unit(0).SubUnit(0).EQPPPID())
                    {
                        grdPPIDList.Rows.Add(EQPPPPID);
                    }
                }
                else if (dintType == 2)
                {
                    foreach (string HostPPID in PInfo.Unit(0).SubUnit(0).HOSTPPID())
                    {
                        grdPPIDList.Rows.Add(HostPPID);
                    }
                }
                else
                {
                    PInfo.All.isReceivedFromCIM = true;
                    PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.SetUpPPID, 1);
                    subWaitDuringReadFromPLC();
                    PInfo.All.isReceivedFromCIM = false;

                    foreach (string EQPPPPID in PInfo.Unit(0).SubUnit(0).EQPPPID())
                    {
                        grdPPIDList.Rows.Add(EQPPPPID);
                    }
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtEQPPPID.Text) == false && string.IsNullOrEmpty(txtEQPPPID_UP.Text) == false && string.IsNullOrEmpty(txtEQPPPID_LOW.Text) == false)
                {
                    if (PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text) == null)
                    {
                        string strDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        PInfo.Unit(0).SubUnit(0).AddMappingEQPPPID(txtEQPPPID.Text);
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text);

                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).UP_EQPPPID  = txtEQPPPID_UP.Text;
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).LOW_EQPPPID = txtEQPPPID_LOW.Text;
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).DateTime    = strDateTime;
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).PPIDCommand = clsInfo.PPIDCMD.Create;
                        PInfo.SetPPIDCMD(txtEQPPPID.Text);

                        //PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.OnePPIDRead, 1, txtEQPPPID_UP.Text, "");
                        //subWaitDuringReadFromPLC();

                        //PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.OnePPIDRead, 1, txtEQPPPID_LOW.Text, "");
                        //subWaitDuringReadFromPLC();

                        string dstrSQL = string.Format("INSERT INTO `tbEQPPPID` values ('{0}','{1}','{2}', '{3}');", txtEQPPPID.Text, txtEQPPPID_UP.Text, txtEQPPPID_LOW.Text, strDateTime);
                        clsDBAct.funExecuteQuery(dstrSQL);

                        PInfo.All.CreatePPIDName = txtEQPPPID.Text;
                        PInfo.All.CreatePPIDType = 1;

                        //PInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S7F107PPIDCreatDeleteAndPPBodyChangedReport, "1", "1","", txtEQPPPID.Text);
                        DialogResult = System.Windows.Forms.DialogResult.Yes;
                        this.Hide();
                    }
                    else
                    {
                        //Error Message!!
                        MessageBox.Show("Error!! HostPPID Exist!!");
                    }
                }
                else
                {
                    MessageBox.Show("Input Data Error!!");
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #8
0
 public void subFormLoad(string strEQPPPID)
 {
     try
     {
         txtEQPPPID.Text     = strEQPPPID;
         txtCurrent_UP.Text  = PInfo.Unit(0).SubUnit(0).MappingEQPPPID(strEQPPPID).UP_EQPPPID;
         txtCurrent_LOW.Text = PInfo.Unit(0).SubUnit(0).MappingEQPPPID(strEQPPPID).LOW_EQPPPID;
     }
     catch (Exception ex)
     {
         PInfo.subLog_Set(clsInfo.LogType.CIM, ex.ToString());
     }
 }
Exemple #9
0
        /// <summary>
        /// EQP State Display (Normal, Fault, PM)
        /// </summary>
        private void subEQPState()
        {
            try
            {
                if (PInfo.Unit(0).SubUnit(0).EQPState != this.pstrEQPState)
                {
                    switch (PInfo.Unit(0).SubUnit(0).EQPState)
                    {
                    case "1":
                        this.lblEQPState.Text      = "Normal";
                        this.lblEQPState.BackColor = Color.Yellow;
                        this.lblEQPState.ForeColor = Color.Black;
                        break;

                    case "2":
                        this.lblEQPState.Text      = "Fault";
                        this.lblEQPState.BackColor = Color.Red;
                        this.lblEQPState.ForeColor = Color.White;
                        break;

                    case "3":
                        this.lblEQPState.Text      = "PM";
                        this.lblEQPState.BackColor = Color.Gray;
                        this.lblEQPState.ForeColor = Color.White;
                        break;

                    default:
                        this.lblEQPState.Text      = "";
                        this.lblEQPState.BackColor = Color.White;
                        this.lblEQPState.ForeColor = Color.Black;
                        break;
                    }
                    this.pstrEQPState = PInfo.Unit(0).SubUnit(0).EQPState;
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #10
0
        public void subFormInitial()
        {
            try
            {
                if (PInfo.EQP("Main").PLCConnect)
                {
                    string EQPState = PInfo.Unit(0).SubUnit(0).EQPState;

                    if (EQPState != null && EQPState != "")
                    {
                        if (EQPState == "1")
                        {
                            this.btnNORMAL.Enabled   = false;
                            this.btnPM.Enabled       = true;
                            this.btnNORMAL.BackColor = Color.WhiteSmoke;
                            this.btnNORMAL.ForeColor = Color.Black;
                        }
                        else if (EQPState == "3")
                        {
                            this.btnNORMAL.Enabled = true;
                            this.btnPM.Enabled     = false;
                            this.btnPM.BackColor   = Color.WhiteSmoke;
                            this.btnPM.ForeColor   = Color.Black;
                        }
                    }
                }
                else
                {
                    btnNORMAL.Enabled = false;
                    btnPM.Enabled     = false;

                    this.btnNORMAL.BackColor = Color.WhiteSmoke;
                    this.btnNORMAL.ForeColor = Color.Black;
                    this.btnPM.BackColor     = Color.WhiteSmoke;
                    this.btnPM.ForeColor     = Color.Black;
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #11
0
        public void subFormInitial()
        {
            try
            {
                if (PInfo.EQP("Main").PLCConnect)
                {
                    if (PInfo.Unit(0).SubUnit(0).EQPProcessState != "4")
                    {
                        btnResume.Enabled = false;
                        btnPause.Enabled  = true;

                        this.btnPause.BackColor = Color.WhiteSmoke;
                        this.btnPause.ForeColor = Color.Black;
                    }
                    else
                    {
                        btnPause.Enabled  = false;
                        btnResume.Enabled = true;

                        this.btnResume.BackColor = Color.WhiteSmoke;
                        this.btnResume.ForeColor = Color.Black;
                    }
                }
                else
                {
                    btnPause.Enabled  = false;
                    btnResume.Enabled = false;

                    this.btnPause.BackColor  = Color.WhiteSmoke;
                    this.btnPause.ForeColor  = Color.Black;
                    this.btnResume.BackColor = Color.WhiteSmoke;
                    this.btnResume.ForeColor = Color.Black;
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #12
0
        public void Save()
        {
            string    dstrSQL;
            DataTable dDT;
            int       dintIndex = 0;

            try
            {
                if (MessageBox.Show("Alarm 리스트를 업데이트 합니다.\n양산중인 장비에서 이 기능을 실행하면\n심각한 문제가 발생 할 수 있습니다.\n진행하겠습니까?", "경고", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    return;
                }

                File.Copy(Application.StartupPath + @"\system\System.mdb", Application.StartupPath + @"\system\System.mdb.bak", true);

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

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

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

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

                //DB에 저장이 성공적으로 완료되면 다시 DB에서 Data를 로딩한다.
                //구조체의 내용 갱신
                //현재 등록되어 있는 모든 Alarm을 삭제한다.
                pInfo.Unit(0).SubUnit(0).RemoveAlarm();

                dstrSQL = "SELECT * FROM tbAlarm order by AlarmID";
                //dDT = DBAct.clsDBAct.funSelectQuery2(dstrSQL);                          //DataTable을 받아온다.
                dDT = DBAct.clsDBAct.funSelectQuery2(dstrSQL);
                if (dDT != null)
                {
                    pInfo.DeleteTable("ALARM");
                    pInfo.AddDataTable("ALARM", dDT);

                    foreach (DataRow dr in dDT.Rows)
                    {
                        if (Convert.ToBoolean(dr["AlarmReport"].ToString().Trim()))
                        {
                            dintIndex = Convert.ToInt32(dr["AlarmID"]);
                            pInfo.Unit(0).SubUnit(0).AddAlarm(dintIndex);

                            pInfo.Unit(0).SubUnit(0).Alarm(dintIndex).AlarmCode   = Convert.ToInt32(dr["AlarmCD"].ToString().Trim());
                            pInfo.Unit(0).SubUnit(0).Alarm(dintIndex).AlarmType   = dr["AlarmType"].ToString().Trim();
                            pInfo.Unit(0).SubUnit(0).Alarm(dintIndex).AlarmDesc   = dr["AlarmDesc"].ToString().Trim();
                            pInfo.Unit(0).SubUnit(0).Alarm(dintIndex).AlarmReport = Convert.ToBoolean(dr["AlarmReport"].ToString().Trim());
                            pInfo.Unit(0).SubUnit(0).Alarm(dintIndex).UnitID      = pInfo.funGetModuleIDToUnitID(dr["ModuleID"].ToString());
                            pInfo.Unit(0).SubUnit(0).Alarm(dintIndex).ModuleID    = dr["ModuleID"].ToString();
                        }
                    }
                }

                //DBAct.clsDBAct.funDisconnect();     // DB 연결을 끊는다.

                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);
            }
        }
Exemple #13
0
 private void subEventAdd()
 {
     try
     {
         //pInfo.Unit(0).SubUnit(0).Event_EQPPPID_Update += new clsSubUnitMethod.EQPPPID_Update_Event(tabfrmSetupPPID_Event_EQPPPID_Update);
         pInfo.Unit(0).SubUnit(0).Event_HOSTPPID_Update += new clsSubUnitMethod.HOSTPPID_Update_Event(tabfrmSetupPPID_Event_HOSTPPID_Update);
     }
     catch (Exception ex)
     {
         pInfo.subLog_Set(clsInfo.LogType.CIM, ex.ToString());
     }
 }
Exemple #14
0
        public void Save()
        {
            string    dstrSQL;
            DataTable dDT;
            string    dstrName = "";

            try
            {
                File.Copy(Application.StartupPath + @"\system\System.mdb", Application.StartupPath + @"\system\System.mdb.bak", true);

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

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

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

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

                //DB에 저장이 성공적으로 완료되면 다시 DB에서 Data를 로딩한다.
                //구조체의 내용 갱신
                pInfo.Unit(0).SubUnit(0).RemoveUser();

                //DB로부터 User 정보를 읽어들여 저장한다.
                dstrSQL = "SELECT * FROM tbUser order by UserLevel";
                dDT     = DBAct.clsDBAct.funSelectQuery2(dstrSQL);                      //DataTable을 받아온다.
                if (dDT != null)
                {
                    pInfo.DeleteTable("USER");
                    pInfo.AddDataTable("USER", dDT);

                    foreach (DataRow dr in dDT.Rows)
                    {
                        dstrName = dr["UserID"].ToString();
                        pInfo.Unit(0).SubUnit(0).AddUser(dstrName);

                        pInfo.Unit(0).SubUnit(0).User(dstrName).Level    = Convert.ToInt32(dr["UserLevel"].ToString());
                        pInfo.Unit(0).SubUnit(0).User(dstrName).PassWord = dr["Pass"].ToString();
                        pInfo.Unit(0).SubUnit(0).User(dstrName).Desc     = dr["Description"].ToString();
                    }
                }

                //DBAct.clsDBAct.funDisconnect();     // DB 연결을 끊는다.

                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);
            }
        }
Exemple #15
0
        public void Save()
        {
            if (MessageBox.Show("SVID 리스트를 업데이트 합니다.\n양산중인 장비에서 이 기능을 실행하면\n심각한 문제가 발생 할 수 있습니다.\n진행하겠습니까?", "경고", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                return;
            }

            File.Copy(Application.StartupPath + @"\system\System.mdb", Application.StartupPath + @"\system\System.mdb.bak", true);

            string    dstrSQL;
            DataTable dDT;
            int       dintIndex = 0;

            try
            {
                //if (!DBAct.clsDBAct.funConnect())
                //{
                //    MessageBox.Show("DB Connection Fail!", "Connect Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //    return;
                //}

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

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

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

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



                dstrSQL = "SELECT * FROM tbSVID order by SVID";
                //dDT = DBAct.clsDBAct.funSelectQuery2(dstrSQL);                          //DataTable을 받아온다.
                dDT = DBAct.clsDBAct.funSelectQuery2(dstrSQL);
                if (dDT != null)
                {
                    pInfo.Unit(0).SubUnit(0).RemoveSVID();
                    pInfo.DeleteTable("SVID");
                    pInfo.AddDataTable("SVID", dDT);

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

                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Name           = dr["SVNAME"].ToString();
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Length         = Convert.ToInt32(dr["Length"].ToString());
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Format         = dr["Format"].ToString();
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Value          = dr["SV"].ToString();
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Type           = dr["Type"].ToString();
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Unit           = dr["Unit"].ToString();
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Range          = dr["Range"].ToString();
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).HaveMinusValue = Convert.ToBoolean(dr["HaveMinusValue"]);
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).DESC           = dr["Description"].ToString();
                        //PInfo.Unit(0).SubUnit(0).SVID(dintIndex).UnitID = this.PInfo.funGetModuleIDToUnitID(dr["ModuleID"].ToString());
                        pInfo.Unit(0).SubUnit(0).SVID(dintIndex).ModuleID = dr["ModuleID"].ToString();

                        if (pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Format.Trim() != "")
                        {
                            this.pInfo.All.SVIDPLCReadLength = this.pInfo.All.SVIDPLCReadLength + this.pInfo.Unit(0).SubUnit(0).SVID(dintIndex).Length;
                        }
                    }
                }

                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);
            }
        }
Exemple #16
0
        private void subSaveECValue()
        {
            string ChangeECID = "";
            string ChangeECV = "";
            bool dbolErrorCheck = false;
            try
            {
                for (int dintLoop = 0; dintLoop < dataGridView1.Rows.Count; dintLoop++)
                {

                }

                if (dbolErrorCheck)
                {
                    
                }

                for (int dintLoop = 0; dintLoop < dataGridView1.Rows.Count; dintLoop++)
                {
                    int dintECID = Convert.ToInt32(dataGridView1[0, dintLoop].Value);

                    clsECID ECID = pInfo.Unit(0).SubUnit(0).ECID(dintECID);
                    if (ECID.ECDEF != dataGridView1[3, dintLoop].Value.ToString())
                    {
                        ChangeECID += dintECID + "=";
                        ChangeECV += dataGridView1[3, dintLoop].Value.ToString() + "=";
                        ECID.ECDEF = dataGridView1[3, dintLoop].Value.ToString();
                    }
                }

                pInfo.subPLCCommand_Set(clsInfo.PLCCommand.ECIDChange);

                //if (string.IsNullOrEmpty(ChangeECID) == false)
                //{
                //    funECID_DBDelete();
                //    funECID_DBInsert();
                //    //pInfo.subSendSF_Set(clsInfo.SFName.S6F11_ECReport, ChangeECID, ChangeECV);

                //}

            }
            catch (Exception ex)
            {
                pInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
                MessageBox.Show("EC Value Update Fail!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #17
0
        private void subStateinit()
        {
            try
            {
                for (int dintloop = 1; dintloop <= PInfo.UnitCount; dintloop++)
                {
                    for (int dintloop2 = 1; dintloop2 <= PInfo.Unit(dintloop).SubUnitCount; dintloop2++)
                    {
                        string strName = PInfo.Unit(dintloop).SubUnit(dintloop2).ModuleID.Substring(PInfo.Unit(dintloop).SubUnit(dintloop2).ModuleID.Length - 4);
                        if (dintloop == 3)
                        {
                            dgv_UnitState.Columns.Add(strName, strName);
                        }
                        else
                        {
                            //dgv_PortState.Columns.Add(strName, strName);
                        }
                    }
                }

                foreach (DataGridViewColumn col in dgv_UnitState.Columns)
                {
                    col.SortMode = DataGridViewColumnSortMode.NotSortable;
                }


                dgv_UnitState.Rows.Add(2);

                dgv_UnitState.Rows[0].HeaderCell.Value = "EQP STATE";
                dgv_UnitState.Rows[1].HeaderCell.Value = "Process STATE";

                for (int dintloop = 1; dintloop <= PInfo.UnitCount; dintloop++)
                {
                    for (int dintloop2 = 1; dintloop2 <= PInfo.Unit(dintloop).SubUnitCount; dintloop2++)
                    {
                        string strName = PInfo.Unit(dintloop).SubUnit(dintloop2).ModuleID.Substring(PInfo.Unit(dintloop).SubUnit(dintloop2).ModuleID.Length - 4);
                        if (dintloop == 3)
                        {
                            eqpState(dintloop2, PInfo.Unit(dintloop).SubUnit(dintloop2).EQPState);
                            eqpProcessState(dintloop2, PInfo.Unit(dintloop).SubUnit(dintloop2).EQPProcessState);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Exemple #18
0
        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);
            }
        }