using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Collections; using System.Threading; using System.IO; namespace FPER { public partial class frmControlMode : Form { MDIParent mdi = null; //delegate void CheckBox_Event(CheckBox c, System.EventArgs e); CheckBox[] checkLoop0; CheckBox[] checkLoop1; // cyim 2015.2.16 °èÅëÂ÷´ÜÀÌÈÄ¿¡ Â÷´ÜÇØÁ¦ÀÇ °æ¿ì¿¡ ÇÑÇØ¼­ º¹±¸ ½ÇÇàÇϵµ·Ï ÇÑ´Ù bool[] Check_checkLoop0 = new bool[16]; bool[] Check_checkLoop1 = new bool[16]; BoardTypeInfo[] brdinfos; delegate void deleFormInit(); LogFileCreate LFC = new LogFileCreate(); int selectRepNo = 0; //Áß°è±â Àб⸦ ÁøÇàÇϱâ À§ÇØ private Thread tRepeaterReadThread; private int tRepeaterReadThreadStatus = 0; public frmControlMode() { InitializeComponent(); // cyim 2013.7.12 µðÀÚÀΰ³¼±ÀÛ¾÷ : Á¦¾î - Áß°è±âÂ÷´Ü this.button_LoopCut.BackgroundImage = (Image)Properties.Resources.ÅǸ޴º¹öư_ÁÖȲ_100_30; // cyim 2015.2.24 ¾²±â¹öư »ç¿ë±ÝÁö btnOutWrite.Text = null; btnOutWrite.Enabled = false; } int savBoardID = -1; int savLoop = -1; //Áß°è±â¹× ȸ·Î ¼³Á¤Á¤º¸ RepeaterDeviceTypeInfo[] REP; RepeaterPointUnit[] REPDATA; public void Form_Init() { try { if (this.InvokeRequired) { deleFormInit d = new deleFormInit(Form_Init); this.Invoke(d, new object[] { }); } else { Board_getData(); Repeater_getData(); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName); } } //ÆÇ³ÚÀÇ checkbox¸¦ üũ¹× ÇØÁ¦ÇÑ´Ù. private void checkPanelLoad(int BoardID, Boolean Loop0CutFlag, Boolean Loop1CutFlag) { try { this.checkLoop0[BoardID - 1].Checked = Loop0CutFlag; this.checkLoop1[BoardID - 1].Checked = Loop1CutFlag; } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void frmControlMode_Load(object sender, EventArgs e) { // cyim 2013.8.1 : ´õºí¹öÆÛ¸µ Àû¿ë SetStyle(ControlStyles.UserPaint, true); //this.UpdateStyles(); SetStyle(ControlStyles.AllPaintingInWmPaint, true); //this.UpdateStyles(); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.UpdateStyles(); try { mdi = (MDIParent)this.MdiParent; txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID); txtThisReceiverID2.Text = string.Format("{0:00}", mdi.myReceiverID); checkLoop0 = new CheckBox[16] { checkLoop0Board1, checkLoop0Board2, checkLoop0Board3, checkLoop0Board4 ,checkLoop0Board5, checkLoop0Board6, checkLoop0Board7, checkLoop0Board8 ,checkLoop0Board9, checkLoop0Board10, checkLoop0Board11, checkLoop0Board12 ,checkLoop0Board13, checkLoop0Board14, checkLoop0Board15, checkLoop0Board16 }; checkLoop1 = new CheckBox[16]{ checkLoop1Board1, checkLoop1Board2, checkLoop1Board3, checkLoop1Board4 ,checkLoop1Board5, checkLoop1Board6, checkLoop1Board7, checkLoop1Board8 ,checkLoop1Board9, checkLoop1Board10, checkLoop1Board11, checkLoop1Board12 ,checkLoop1Board13, checkLoop1Board14, checkLoop1Board15, checkLoop1Board16 }; ReceiverTypeInfo Receiverinfo = this.mdi.ui.MyReceiverTypeInfo; //¼ö½Å±â¼³Á¤ this.brdinfos = Receiverinfo.MyBoardType; //Åë½Åº¸µå¼³Á¤°ª Board_getData(); Repeater_getData(); // cyim 2015.2.16 °èÅëÂ÷´ÜÀÌÈÄ¿¡ Â÷´ÜÇØÁ¦ÀÇ °æ¿ì¿¡ ÇÑÇØ¼­ º¹±¸ ½ÇÇàÇϵµ·Ï ÇÑ´Ù Save_LineCutStatus(); Reg_EventHandler_ChangeChecked(); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void frmControlMode_Activated(object sender, EventArgs e) { try { this.mdi.SelectMenuIndex = 6; } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void frmControlMode_Disposed(object sender, EventArgs e) { try { // cyim 2015.2.16 °èÅëÂ÷´ÜÀÌÈÄ¿¡ Â÷´ÜÇØÁ¦ÀÇ °æ¿ì¿¡ ÇÑÇØ¼­ º¹±¸ ½ÇÇàÇϵµ·Ï ÇÑ´Ù Del_EventHandler_ChangeChecked(); this.mdi.SelectMenuIndex = 0; } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } /******************************************************************** * Åë½Åº¸µå µ¥ÀÌÅÍ ºÒ·¯¿À±â *********************************************************************/ private void Board_getData() { try { if (this.InvokeRequired) { deleFormInit d = new deleFormInit(Board_getData); this.Invoke(d, new object[] { }); } else { for (int i = 1; i <= 16; i++) { Panel panelBoard = (Panel)Util.FineControl(tabPage_Board, "panelBoard" + i); UIImageChange(false, panelBoard); //this.chkCutFlag[i - 1].Visible = false; this.checkLoop0[i - 1].Visible = false; this.checkLoop1[i - 1].Visible = false; } DacBoardConfig dacBoardConfig = new DacBoardConfig(mdi.myReceiverID); // cyim 2015.7.30 µ¥ÀÌŸº£À̽º Á¢¼Ó ·çƾ º¯°æ DataTable dt = dacBoardConfig.Board_Select(mdi.myReceiverID, 0, null); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { int BoardId = int.Parse(Convert.ToString(dr[0])); Boolean Loop0CutFlag = Convert.ToString(dr["LOOP0_CUT_FLAG"]) == "Y" ? true : false; Boolean Loop1CutFlag = Convert.ToString(dr["LOOP1_CUT_FLAG"]) == "Y" ? true : false; //Boolean CutFlag = Convert.ToString(dr["CUT_FLAG"]) == "Y" ? true : false; Boolean Loop0UseFlag = Convert.ToString(dr["LOOP0_USE_FLAG"]) == "Y" ? true : false; Boolean Loop1UseFlag = Convert.ToString(dr["LOOP1_USE_FLAG"]) == "Y" ? true : false; Boolean UseFlag = Convert.ToString(dr["USE_FLAG"]) == "Y" ? true : false; if (UseFlag) { if (Loop0UseFlag) this.checkLoop0[BoardId - 1].Visible = true; if (Loop1UseFlag) this.checkLoop1[BoardId - 1].Visible = true; //if (Loop0UseFlag) //{ // this.checkLoop0[BoardId - 1].Visible = true; // btnBoardN_loopN_Visible(BoardId - 1, 0, true); //} //if (Loop1UseFlag) //{ // this.checkLoop1[BoardId - 1].Visible = true; // btnBoardN_loopN_Visible(BoardId - 1, 1, true); //} } Panel panelBoard = (Panel)Util.FineControl(tabPage_Board, "panelBoard" + BoardId); UIImageChange(UseFlag, panelBoard); checkPanelLoad(BoardId, Loop0CutFlag, Loop1CutFlag); } } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName); } } /* private Image ImgLoad(string path) { Image ret = null; try { ret = Image.FromFile(path); } catch (Exception e) { Util.UErrorMessage(e, 0, 0); } return ret; } private string strImgBasePath = "image"; private string ImgBasePath { get { return Path.Combine(Directory.GetCurrentDirectory(), this.strImgBasePath); } } private string strImagePathPanelUse = "Áß°è¹Ý_»ç¿ë0.gif"; private string ImagePathPanelUse { get { return Path.Combine(this.ImgBasePath, this.strImagePathPanelUse); } } private Image ImageLoadingPanelUse() { return ImgLoad(this.ImagePathPanelUse); } private string strImagePathPanelUnuse = "Áß°è¹Ý_ºñ»ç¿ë0.gif"; private string ImagePathPanelUnuse { get { return Path.Combine(this.ImgBasePath, this.strImagePathPanelUnuse); } } private Image ImageLoadingPanelUnuse() { return ImgLoad(this.ImagePathPanelUnuse); } */ //»ç¿ë¿©ºÎ üũÇϸé Áß°è¹Ý À̹ÌÁö º¯°æ ¹× UIÀԷ¸ðµå¸¦ ¹Ù²ãÁØ´Ù. private void UIImageChange(bool chkUse, Panel p) { try { if (chkUse) { // cyim 2013.8.1 µðÀÚÀΰ³¼±ÀÛ¾÷ : Á¦¾î - °èÅëÂ÷´Ü ImgLstBoardUseFlag->imageList_BoardUseFlag p.BackgroundImage = imageList_BoardUseFlag.Images[0]; //p.BackgroundImage = this.ImageLoadingPanelUse(); } else { // cyim 2013.8.1 µðÀÚÀΰ³¼±ÀÛ¾÷ : Á¦¾î - °èÅëÂ÷´Ü ImgLstBoardUseFlag->imageList_BoardUseFlag p.BackgroundImage = imageList_BoardUseFlag.Images[1]; //p.BackgroundImage = this.ImageLoadingPanelUnuse(); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnBoardSave_Click(object sender, EventArgs e) { // cyim 2013.8.5 Á¦¾îÈ­¸é ¹öư Æ÷Ä¿½º Á¶Àý this.panel_Menu.Focus(); try { // cyim 2015.2.16 Â÷´Ü¸í·ÉÀ» ³»¸®°Ú½À´Ï±î ÆË¾÷âÃâ·ÂÈÄ Ãë¼ÒÇϸé ÁøÇàµÇ¹ö¸®´Â ¹®Á¦ ¼öÁ¤ if (MessageBox.Show("¼ö½Å±â¿¡ Â÷´Ü¸í·ÉÀ» ³»¸®½Ã°Ú½À´Ï±î?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { DacBoardConfig dacBoardConfig = new DacBoardConfig(mdi.myReceiverID); // cyim 2015.7.30 µ¥ÀÌŸº£À̽º Á¢¼Ó ·çƾ º¯°æ int chkChangeCount = 0; //Control[] coll; // cyim 2013.8.2 Åë½Åº¸µå 16Àº »ç¿ë¾ÈÇÔ 16->15 for (int i = 0; i < 15; i++) { int BoardId = i + 1; Boolean Loop0CutFlag = false; Boolean Loop1CutFlag = false; Panel pan = (Panel)Util.FineControl(tabPage_Board, "panelBoard" + Convert.ToString(BoardId)); CheckBox checkLoop0 = (CheckBox)Util.FineControl(pan, "checkLoop0Board" + Convert.ToString(BoardId)); CheckBox checkLoop1 = (CheckBox)Util.FineControl(pan, "checkLoop1Board" + Convert.ToString(BoardId)); if (checkLoop0 != null && checkLoop0.Visible) { Loop0CutFlag = checkLoop0.Checked; this.brdinfos[i].Loop0CutFlagChange = Loop0CutFlag; if (this.brdinfos[i].Loop0CutFlagChange) chkChangeCount++; } if (checkLoop1 != null && checkLoop1.Visible) { Loop1CutFlag = checkLoop1.Checked; this.brdinfos[i].Loop1CutFlagChange = Loop1CutFlag; if (this.brdinfos[i].Loop1CutFlagChange) chkChangeCount++; } //DB¿¡ ÀÚ·áÀúÀå dacBoardConfig.Board_Cut_Update(mdi.myReceiverID, BoardId, Loop0CutFlag ? "Y" : "N", Loop1CutFlag ? "Y" : "N"); } // cyim 2015.2.16 °èÅëÂ÷´ÜÀÌÈÄ¿¡ Â÷´ÜÇØÁ¦ÀÇ °æ¿ì¿¡ ÇÑÇØ¼­ º¹±¸ ½ÇÇàÇϵµ·Ï ÇÑ´Ù bool RecoverExcuteEnable = false; if (chkChangeCount > 0) // ¿©±â¼­ 0ÀÌ µé¾î¿Ã È®·üÀÌ Àִ°¡?......................................................... { if (Check_Change() == true) { LFC.Log("ŸÀÔ: ¼ö½Å±â Á¶ÀÛ ·Î±×, ¸Þ¼¼Áö: Â÷´Ü-°èÅëÂ÷´Ü ÇØÁ¦"); } else { LFC.Log("ŸÀÔ: ¼ö½Å±â Á¶ÀÛ ·Î±×, ¸Þ¼¼Áö: Â÷´Ü-°èÅëÂ÷´Ü Àû¿ë"); } // cyim 2015.2.17 Àû¿ëÇϱ⠹öư ´©¸£ÀÚ¸¶ÀÚ DB ¿¡ ¹Ý¿µµÇ¹ö¸®´Â ¹®Á¦ ¼öÁ¤ -> »óÀ§¿¡¼­ ¹¯µµ·Ï ÇÔ //if (MessageBox.Show("¼ö½Å±â¿¡ Â÷´Ü¸í·ÉÀ» ³»¸®½Ã°Ú½À´Ï±î?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { this.Cursor = Cursors.WaitCursor; /***************************************************************/ /* Åë½Åº¸µå Â÷´Ü¸í·É */ /***************************************************************/ frmProgress frm = new frmProgress(mdi); // cyim 2016.12.07 : ¼ö½Å±â ¸ðµ¨º° ³»ºÎ ·ÎÁ÷ º¯°æ //Áß°è±â ¼³Á¤ µ¥ÀÌÅ͸¦ CmdInfo¿¡ ³Ö¾îÁØ´Ù.. CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null); cmd.CommandType = "DC"; cmd.ApplyRange = "L"; cmd.CommandData = this.brdinfos; frm.Commandinfo = cmd; frm.ui = this.mdi.ui; frm.ShowDialog(); /**************************************************************/ this.Cursor = Cursors.Default; // cyim 2015.2.16 °èÅëÂ÷´ÜÀÌÈÄ¿¡ Â÷´ÜÇØÁ¦ÀÇ °æ¿ì¿¡ ÇÑÇØ¼­ º¹±¸ ½ÇÇàÇϵµ·Ï ÇÑ´Ù RecoverExcuteEnable = true; } } // cyim 2013.8.5 È­¸é°»½ÅÀü ´ë±âÈ­¸é ÆË¾÷â Ãâ·Â mdi.Popup.CommonPopupShow(this); // cyim 2015.8.4 ¼ö½Å¹ÝÀ» À§ÇÑ static Ŭ·¡½º Á¤¸® // cyim 2013.9.23 È­¸é°»½ÅÄÚµå Ãß°¡ this.Update(); //¼ö½Å±â¼³Á¤¹×Â÷´ÜÄ«¿îÆ® ´Ù½Ã °è»ê this.mdi.ui.ReceiverDBRead(); // cyim 2013.8.5 È­¸é°»½ÅÀü ´ë±âÈ­¸é ÆË¾÷â Ãâ·Â mdi.Popup.CommonPopupClose(this); // cyim 2015.8.4 ¼ö½Å¹ÝÀ» À§ÇÑ static Ŭ·¡½º Á¤¸® // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï // UI °»½Å Repeater_getData(); // cyim 2015.2.16 °èÅëÂ÷´ÜÀÌÈÄ¿¡ Â÷´ÜÇØÁ¦ÀÇ °æ¿ì¿¡ ÇÑÇØ¼­ º¹±¸ ½ÇÇàÇϵµ·Ï ÇÑ´Ù if (RecoverExcuteEnable == true) { if (Check_Change() == true) { mdi.FireReset_Process(); mdi.socketUI.ReceiverDemonReset(); } } this.label_InfoApplyComment.Visible = false; // ÇöÀç »óŸ¦ ÀúÀåÇØµÐ´Ù Save_LineCutStatus(); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName); } } // // cyim 2015.2.16 °èÅëÂ÷´ÜÀÌÈÄ¿¡ Â÷´ÜÇØÁ¦ÀÇ °æ¿ì¿¡ ÇÑÇØ¼­ º¹±¸ ½ÇÇàÇϵµ·Ï ÇÑ´Ù // // ÇöÀç»óŰ¡ º¯°æµÇ¾ú´ÂÁö üũÇÑ´Ù private bool Check_Change() { for (int i = 1; i <= 16; i++) { CheckBox uCheckBoxLoop0 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop0Board" + i); CheckBox uCheckBoxLoop1 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop1Board" + i); // 1°³¶óµµ ±âÁ¸ÀÇ °ª¿¡¼­ Â÷´ÜÇØÁ¦·Î º¯°æµÇ¾ú´Â °æ¿ì¿¡´Â ¹«Á¶°Ç true ¹Ýȯ if (this.checkLoop0[i - 1].Visible == true && (uCheckBoxLoop0.Checked != Check_checkLoop0[i - 1]) && uCheckBoxLoop0.Checked == false) return true; if (this.checkLoop1[i - 1].Visible == true && (uCheckBoxLoop1.Checked != Check_checkLoop1[i - 1]) && uCheckBoxLoop1.Checked == false) return true; } return false; } // È­¸é óÀ½ ½ÃÀÛ È¤Àº Àû¿ëÇϱ⠴©¸¥ÈÄ¿¡ µ¿ÀÛÇϵµ·Ï ÇÑ´Ù private void Save_LineCutStatus() { for (int i = 1; i <= 16; i++) { CheckBox uCheckBoxLoop0 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop0Board" + i); CheckBox uCheckBoxLoop1 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop1Board" + i); Check_checkLoop0[i - 1] = uCheckBoxLoop0.Checked; Check_checkLoop1[i - 1] = uCheckBoxLoop1.Checked; } } // °ªÀÌ º¯°æµÇ´Â °æ¿ìÀÇ À̺¥Æ®¸¦ ÀϰýÀûÀ¸·Î µî·ÏÇÑ´Ù (ÁÖÀÇÇÒÁ¡ üũ¹Ú½º°¡ ¼ÂÆÃÀÌ ¿Ï·áµÈÈÄ¿¡ À̺¥Æ®¸¦ µî·ÏÇØ¾ßÇÑ´Ù) private void Reg_EventHandler_ChangeChecked() { for (int i = 1; i <= 16; i++) { CheckBox uCheckBoxLoop0 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop0Board" + i); CheckBox uCheckBoxLoop1 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop1Board" + i); uCheckBoxLoop0.CheckStateChanged += new EventHandler(uCheckBoxLoop_CheckStateChanged); uCheckBoxLoop1.CheckStateChanged += new EventHandler(uCheckBoxLoop_CheckStateChanged); } } // °ªÀÌ º¯°æµÇ´Â °æ¿ìÀÇ À̺¥Æ®¸¦ ÀϰýÀûÀ¸·Î µî·ÏÇÑ´Ù private void Del_EventHandler_ChangeChecked() { for (int i = 1; i <= 16; i++) { CheckBox uCheckBoxLoop0 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop0Board" + i); CheckBox uCheckBoxLoop1 = (CheckBox)Util.FineControl(tabPage_Board, "checkLoop1Board" + i); uCheckBoxLoop0.CheckStateChanged -= new EventHandler(uCheckBoxLoop_CheckStateChanged); uCheckBoxLoop1.CheckStateChanged -= new EventHandler(uCheckBoxLoop_CheckStateChanged); } } private void uCheckBoxLoop_CheckStateChanged(object sender, EventArgs e) { if (Check_Change() == true) this.label_InfoApplyComment.Visible = true; else this.label_InfoApplyComment.Visible = false; } private void btnWinClose_Click(object sender, EventArgs e) { this.Close(); } private void btnInputOpen_Click(object sender, EventArgs e) { try { InputIDVo vo = new InputIDVo(); vo.ReceiverID = int.Parse(txtThisReceiverID2.Text); vo.CommID = 1; vo.BoardID = Util.StrToInt(txtBoardID.Text, 0); vo.LoopNo = Util.StrToInt(txtLoopNo.Text, 0); IWin32Window window = this; frmModalLoopSelect frm = new frmModalLoopSelect(mdi); frm.InputVo = vo; frm.ShowDialog(window); vo = frm.InputVo; //ÀÔ·ÂÇÑ Äڵ尡 ÀÖ´Ù¸é if (vo.InputOK) { txtThisReceiverID.Text = String.Format("{0:00}", vo.ReceiverID); txtBoardID.Text = String.Format("{0:00}", vo.BoardID); txtLoopNo.Text = String.Format("{0}", vo.LoopNo); Repeater_getData(); // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï //Áß°è±â Àüü Àб⠸í·É dCommandResponse d = new dCommandResponse(RepeaterInfoAll); //¸í·É»ý¼º ¹× ½ÇÇà CmdInfo cmd = new CmdInfo(prt_cmd_define.read_repeater_all, mdi.myReceiverID, 1, vo.LoopNo, vo.BoardID, d); this.mdi.ui.runCommand(cmd); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } //cell°ªÀ¸·Î Áß°è±â ¼³Á¤À» Radio¹öư¿¡ Ç¥½Ã private void RepeaterStatus(String CellText) { try { String RepeaterID = CellText; String RepeaterType = ""; if (CellText.Length > 3) { RepeaterType = CellText.Substring(0, 1); RepeaterID = CellText.Substring(1, 3); } lblRepeaterID.Text = RepeaterID; //RepeaterTypeRadio(RepeaterType); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void Repeater_init() { try { //dataGridView1,dataGridView2 try { this.dataGridView1.Columns.Clear(); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } /************************************************************************/ /* dataGridView1 Çì´õ ¼³Á¤ */ /************************************************************************/ DataGridViewCellStyle sty = new DataGridViewCellStyle(); sty.Alignment = DataGridViewContentAlignment.MiddleCenter; for (int col = 0; col < 10; col++) { dataGridView1.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView1.Columns[col].ReadOnly = true; dataGridView1.Columns[col].Resizable = DataGridViewTriState.False; dataGridView1.Columns[col].Width = 70; dataGridView1.Columns[col].DefaultCellStyle = sty; } /************************************************************************/ /************************************************************************/ /* dataGridView1 Row »ý¼º.. ÃÑ 127°³ Cell */ /************************************************************************/ this.dataGridView1.Rows.Clear(); DataGridViewRowCollection rows = this.dataGridView1.Rows; for (int row = 0; row <= 12; row++) { String[] rowData = new String[10]; for (int col = 1; col <= 10; col++) { int no = row * 10 + col; if (no <= 127) { rowData[col - 1] = String.Format("{0:000}", no); //REP[no - 1] = new RepeaterDeviceTypeInfo(no); //Áß°è±â¹× ȸ·Î ¼³Á¤Á¤º¸ } } rows.Add(rowData); } /************************************************************************/ //Áß°è±â ¼³Á¤³»¿ë Ç¥½Ã RepeaterStatus(""); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); throw ex; } } // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï // Áß°è±â Á¤º¸¸¦ Á¶È¸Çؼ­ Çϳª¶ó·Î (ÀԷ ȤÀº Ãâ·Â) ȸ·Î Â÷´ÜÀÌ ÀÖ´Â °æ¿ì true ¹Ýȯ private bool Repeater_GetData_Circuit_CutInfo(RepeaterDeviceTypeInfo dev, RepeaterPointUnit unit) { int Count = 0; if (dev == null) return false; // cyim 2015.6.8 ¾Æ³¯·Î±× °¨Áö±â ¿¬µ¿ Ãß°¡ // '1' = A : 2X2 // '2' = B : 4X4 // '4' = C : ¾Æ³¯·Î±×¿¬°¨Áö±â // '5' = D : ¾Æ³¯·Î±×¿­°¨Áö±â if (dev.RepeaterType.Equals("A")) Count = 2; else if (dev.RepeaterType.Equals("B")) Count = 4; else if (dev.RepeaterType.Equals("C") || dev.RepeaterType.Equals("D")) Count = 1; else return false; // °Ë»öÇÏ´Â °æ¿ì Çϳª¶ó·Î Â÷´ÜÀÌ ÀÖ´Â °æ¿ì°¡ ÀÖ´ÂÁö »ìÆìº»´Ù for (int i = 0; i < Count; i++) { // cyim 2013.10.2 : ÀÔ·Â Ãâ·Â ½ÖÀ¸·Î Á¸ÀçÇÏÁö¾ÊÀ¸¸é ¿¡·¯°¡ ¹ß»ýÇÔ // ÀÔ·Â if (dev.inDeviceTypeInfos[i] != null && dev.inDeviceTypeInfos[i].CutFlag == true) return true; // Ãâ·Â else if (dev.outDeviceTypeInfos[i] != null && dev.outDeviceTypeInfos[i].CutFlag == true) return true; } // ´Ü, Ãâ·ÂÀº Â÷´Ü Ç÷¡±×°¡ ¼³Á¤ÀÌ ¾ÈµÇ¾îÀÖ´õ¶óµµ ºí·°Å·ÀÌ µÇ¾îÀÖ´Ù¸é Â÷´ÜÀ¸·Î ÇÑ´Ù (º»·¡ Äڵ忡´Â ÀÌ·¸°Ô µÇ¾îÀÖÀ¸¹Ç·Î ±×´ë·Î Àû¿ëÇÔ) if (unit == null) return false; else { // '1' = A : 2X2 if (Count == 2) { if (unit.Repeater_Output1 == OutputDeviceStatus.Blocking) return true; else if (unit.Repeater_Output2 == OutputDeviceStatus.Blocking) return true; } // '2' = B : 4X4 else if (Count == 4) { if (unit.Repeater_Output1 == OutputDeviceStatus.Blocking) return true; else if (unit.Repeater_Output2 == OutputDeviceStatus.Blocking) return true; else if (unit.Repeater_Output3 == OutputDeviceStatus.Blocking) return true; else if (unit.Repeater_Output4 == OutputDeviceStatus.Blocking) return true; } // '4' = C : ¾Æ³¯·Î±×¿¬°¨Áö±â // '5' = D : ¾Æ³¯·Î±×¿­°¨Áö±â else { if (unit.Repeater_Output1 == OutputDeviceStatus.Blocking) // cyim 2015.7.6 Â÷´ÜÀÇ °æ¿ì ¾Æ³¯·Î±× °¨Áö±â´Â ÀÔ·ÂÀº 1°³»ÓÀ̹ǷΠ·çƾÀ» »õ·Î Ãß°¡ÇÑ´Ù return true; } } return false; } //Áß°è±â DB¿¡¼­ ÀÚ·á°¡Á®¿À±â private void Repeater_getData() { try { if (this.InvokeRequired) { deleFormInit d = new deleFormInit(Repeater_getData); this.Invoke(d, new object[] { }); } else { int BoardID = Util.StrToInt(txtBoardID.Text, 0); int LoopNo = Util.StrToInt(txtLoopNo.Text, 0); bool LoopCutFlag = false; //if (BoardID == savBoardID && LoopNo == savLoop) return; savBoardID = BoardID; savLoop = LoopNo; Repeater_init(); ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //¼ö½Å±â¼³Á¤ BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID); //Åë½Åº¸µåsavBoardIDÀÇ loop0ÀÇ ¼³Á¤°ª if (savLoop == 0) { LoopCutFlag = brdinfo.Loop0CutFlag; REP = brdinfo.Loop0_RepeaterType; //Åë½Åº¸µå + Loop0 + 127°³ Áß°è±â ¼³Á¤°ª REPDATA = brdinfo.Loop0_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } else { LoopCutFlag = brdinfo.Loop1CutFlag; REP = brdinfo.Loop1_RepeaterType; //Åë½Åº¸µå + Loop1 + 127°³ Áß°è±â ¼³Á¤°ª REPDATA = brdinfo.Loop1_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } int rowCnt = 0, colCnt = 0; //Áß°è±â ºñ»ç¿ë ½ºÅ¸ÀÏ DataGridViewCellStyle styUnUse = new DataGridViewCellStyle(); styUnUse.Alignment = DataGridViewContentAlignment.MiddleCenter; styUnUse.BackColor = System.Drawing.Color.White; // Áß°è±â »ç¿ë ½ºÅ¸ÀÏ DataGridViewCellStyle styUse = new DataGridViewCellStyle(); styUse.Alignment = DataGridViewContentAlignment.MiddleCenter; styUse.BackColor = System.Drawing.Color.Aqua; // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï // Áß°è±â Â÷´ÜÀº ȸ»öÀ̸ç, Áß°è±âÂ÷´ÜÀÌ ¾Æ´Ñ 1°³ÀÌ»ó ȸ·ÎÂ÷´ÜÀÎ °æ¿ì »ö»óÀº ±¸ºÐµÇ¾î¾ß ÇÑ´Ù // ȸ·ÎÂ÷´Ü ½ºÅ¸ÀÏ DataGridViewCellStyle styOut_Circuit = new DataGridViewCellStyle(); styOut_Circuit.Alignment = DataGridViewContentAlignment.MiddleCenter; styOut_Circuit.BackColor = System.Drawing.Color.Pink; // Áß°è±â Â÷´Ü ½ºÅ¸ÀÏ DataGridViewCellStyle styOut = new DataGridViewCellStyle(); styOut.Alignment = DataGridViewContentAlignment.MiddleCenter; styOut.BackColor = System.Drawing.Color.Silver; foreach (DataGridViewRow row in this.dataGridView1.Rows) { colCnt = 0; foreach (DataGridViewCell col in row.Cells) { ++colCnt; int no = rowCnt * 10 + colCnt; if (no <= 127) { if (LoopCutFlag) { col.Style = styOut; } else { RepeaterDeviceTypeInfo dev = REP[no - 1]; //Áß°è±â¹× ȸ·Î ¼³Á¤Á¤º¸ if (dev != null) { if (dev.RepeaterType != null) col.Value = String.Format("{0}{1:000}", dev.RepeaterType, no); else col.Value = String.Format("{0:000}", no); if (dev.UseFlag) { if (dev.CutFlag) { col.Style = styOut; } else { // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï // Áß°è±â Â÷´ÜÀº ȸ»öÀ̸ç, Áß°è±âÂ÷´ÜÀÌ ¾Æ´Ñ 1°³ÀÌ»ó ȸ·ÎÂ÷´ÜÀÎ °æ¿ì »ö»óÀº ±¸ºÐµÇ¾î¾ß ÇÑ´Ù // ´Ü, Áß°è±â Â÷´ÜÀÌ ¸ÕÀú ¿ì¼±¼øÀ§°¡ ³ôÀ¸¹Ç·Î ³ªÁß¿¡ Áß°è±â Â÷´Ü ½ºÅ¸ÀÏÀÌ ÀÖ´Ù¸é Àû¿ëµÈ´Ù if (Repeater_GetData_Circuit_CutInfo(REP[no - 1], REPDATA[no - 1]) == true) col.Style = styOut_Circuit; else col.Style = styUse; } } else { col.Style = styUnUse; } } else { col.Value = String.Format("{0:000}", no); col.Style = styUnUse; } } } } ++rowCnt; } if (this.selectRepNo > 0) { if (dataGridView1.SelectedCells.Count > 0) { foreach (DataGridViewCell cell in dataGridView1.SelectedCells) { cell.Selected = false; } } int row = (this.selectRepNo - 1) / 10; int col = (this.selectRepNo - 1) % 10; dataGridView1.Rows[row].Cells[col].Selected = true; } else { this.selectRepNo = 1; } //Áß°è±â°¡ ¼±ÅõǹǷΠȸ·Î Ç¥½Ã if (REP[this.selectRepNo - 1] != null) { if (REP[this.selectRepNo - 1].RepeaterType != null) RepeaterStatus(String.Format("{0}{1:000}", REP[this.selectRepNo - 1].RepeaterType, this.selectRepNo)); else RepeaterStatus(string.Format("{0:000}", this.selectRepNo)); } else { RepeaterStatus(string.Format("{0:000}", this.selectRepNo)); } DeviceStatus(REP[this.selectRepNo - 1], REPDATA[this.selectRepNo - 1]); if (LoopCutFlag) { chkRepeaterCut.Enabled = false; //Áß°è±âÂ÷´Ü chkDeviceCutFlag.Enabled = false; //ȸ·ÎÂ÷´Ü btnInWrite.Enabled = false; btnOutWrite.Enabled = false; } // cyim 2014.4.3 : È­¸é Àüȯ½Ã¿¡ Áß°è±â°¡ ¾ø´Â °æ¿ì¿¡µµ ȸ·ÎÂ÷´Ü ¹öưÀÌ È°¼ºÈ­µÈ´Ù // ·çÇÁ°¡ Â÷´ÜÀ̶ó¸é ÀüºÎ ºñȰ¼ºÈ­°¡ ¸Â´Ù // ¾Æ·¡ ¹öưÀÇ È°¼ºÈ­´Â ÁÖ¼®À¸·Î ó¸®ÇÔ. DeviceStatus ¿¡¼­ ÀÌ¹Ì Ã³¸®ÇÔ //else //{ // chkRepeaterCut.Enabled = true; // chkDeviceCutFlag.Enabled = true; // ÀÌ¹Ì »óÀ§¿¡¼­ ó¸®ÇÔ // btnInWrite.Enabled = true; // btnOutWrite.Enabled = true; //} if (LoopCutFlag) { //MessageBox.Show(string.Format("ÇØ´ç °èÅëÀº Â÷´Ü¼³Á¤ ÁßÀÔ´Ï´Ù.. Åë½Åº¸µå[{0}] °èÅë[{1}] Â÷´Ü¼³Á¤ ÇØÁ¦ÈÄ Á¦¾îÇϽʽÿä..", savBoardID, LoopNo)); } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName); // throw ex; } } //¼±Åü¿ÀÌ ¹Ù²ð¶§¸¶´Ù ÇØ´çÁß°è±â ¼³Á¤³»¿ë ¹× µ¥ÀÌÅÍ Ç¥½Ã private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (dataGridView1.SelectedCells.Count > 0) { DataGridViewCell cell = this.dataGridView1.SelectedCells[0]; int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1; this.selectRepNo = no; //¼±ÅÃÁß°è±â ÀúÀå } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); // throw ex; } } //¼±Åü¿ÀÌ ¹Ù²ð¶§¸¶´Ù ÇØ´çÁß°è±â ¼³Á¤³»¿ë ¹× µ¥ÀÌÅÍ Ç¥½Ã private void dataGridView1_SelectionChanged(object sender, EventArgs e) { try { if (dataGridView1.SelectedCells.Count > 0) { DataGridViewCell cell = this.dataGridView1.SelectedCells[0]; int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1; if (no > 127) { lblRepeaterID.Text = ""; DeviceStatus(null, null); return; } else { lblRepeaterID.Text = String.Format("{0:000}", no); if (REP[no - 1] != null) { DeviceStatus(REP[no - 1], REPDATA[no - 1]); } else { DeviceStatus(null, null); } } } // cyim 2014.4.3 : È­¸é Àüȯ½Ã¿¡ Áß°è±â°¡ ¾ø´Â °æ¿ì¿¡µµ ȸ·ÎÂ÷´Ü ¹öưÀÌ È°¼ºÈ­µÈ´Ù else DeviceStatus(null, null); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } //¼±Åü¿ÀÌ ¹Ù²ð¶§¸¶´Ù ÇØ´çÁß°è±â ¼³Á¤³»¿ë ¹× µ¥ÀÌÅÍ Ç¥½Ã private void dataGridView2_SelectionChanged(object sender, EventArgs e) { // cyim 2014.4.3 : ȸ·ÎÂ÷´Ü ¹× ¾²±â ¹æÁö bool InDBCircuit = false; // µ¥ÀÌŸº£À̽º¿¡ ȸ·ÎÁ¤º¸°¡ ÀÖ´ÂÁö ¿©ºÎ txtDeviceTypeName.Text = ""; txtPositionName.Text = ""; txtDeviceMemo.Text = ""; // ¼öÁ¤(lch_13.08.28) // UI¸¦ ¸®¼Â chkDeviceCutFlag.Text = "ȸ·ÎÂ÷´Ü"; chkDeviceCutFlag.Checked = false; if (dataGridView1.SelectedCells.Count > 0 && dataGridView2.SelectedCells.Count > 0) { try { int CommID = 1; int BoardID = Util.StrToInt(txtBoardID.Text, 0); int LoopNo = Util.StrToInt(txtLoopNo.Text, 0); DataGridViewCell repCell = this.dataGridView1.SelectedCells[0]; int RepeaterID = (repCell.RowIndex * 10) + repCell.ColumnIndex + 1; DataGridViewCell devCell = this.dataGridView2.SelectedCells[0]; string InOut_Type = "I"; if (devCell.RowIndex > 0) InOut_Type = "O"; int deviceId = devCell.ColumnIndex + 1; //ȸ·Î¼³Á¤°ª DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID); // cyim 2015.7.30 µ¥ÀÌŸº£À̽º Á¢¼Ó ·çƾ º¯°æ DataTable dt2 = dacUIProcess.Device_Select(mdi.myReceiverID, CommID, BoardID, LoopNo, RepeaterID, deviceId, InOut_Type); foreach (DataRow dr2 in dt2.Rows) { // cyim 2014.4.3 : ȸ·ÎÂ÷´Ü ¹× ¾²±â ¹æÁö InDBCircuit = true; txtDeviceTypeName.Text = Util.NullToStr(dr2["DEVICE_TYPE_NAME"]); txtPositionName.Text = Util.NullToStr(dr2["POSITION_NAME"]); txtDeviceMemo.Text = Util.NullToStr(dr2["DEVICE_NAME"]); String CutFlag = Util.NullToStr(dr2["CUT_FLAG"]); // ¼öÁ¤(lch_13.08.28) - Â÷´ÜÀÌ µÇ¾îÀִ°Ŵ "Â÷´ÜÇØÁ¦" ¹öưÀ¸·Î ¿Ã¶ó¿À°Ô Çϱâ À§Çؼ­ if (CutFlag.Equals("Y")) { chkDeviceCutFlag.Checked = true; chkDeviceCutFlag.Text = "Â÷´ÜÇØÁ¦"; } else { chkDeviceCutFlag.Checked = false; } } // cyim 2015.2.17 °èÅëÂ÷´Ü½Ã¿¡´Â »ç¿ëºÒ°¡ //int BoardID = Util.StrToInt(txtBoardID.Text, 0); //int LoopNo = Util.StrToInt(txtLoopNo.Text, 0); bool LoopCutFlag = false; savBoardID = BoardID; savLoop = LoopNo; ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //¼ö½Å±â¼³Á¤ BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID); //Åë½Åº¸µåsavBoardIDÀÇ loop0ÀÇ ¼³Á¤°ª if (savLoop == 0) { LoopCutFlag = brdinfo.Loop0CutFlag; //REP = brdinfo.Loop0_RepeaterType; //Åë½Åº¸µå + Loop0 + 127°³ Áß°è±â ¼³Á¤°ª //REPDATA = brdinfo.Loop0_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } else { LoopCutFlag = brdinfo.Loop1CutFlag; //REP = brdinfo.Loop1_RepeaterType; //Åë½Åº¸µå + Loop1 + 127°³ Áß°è±â ¼³Á¤°ª //REPDATA = brdinfo.Loop1_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } // cyim 2014.4.3 : ȸ·ÎÂ÷´Ü ¹× ¾²±â ¹æÁö if (InDBCircuit == false) { // µ¥ÀÌŸ°¡ ¾ø´Ù¸é »ç¿ëºÒ°¡ btnInWrite.Enabled = false; btnOutWrite.Enabled = false; chkDeviceCutFlag.Enabled = false; } else { btnInWrite.Enabled = true; //btnOutWrite.Enabled = true; // cyim 2015.2.24 ¾²±â¹öư »ç¿ë±ÝÁö //chkDeviceCutFlag.Enabled = true; // »óÀ§¿¡¼­ ó¸®ÇÔ // cyim 2015.2.17 °èÅëÂ÷´Ü½Ã¿¡´Â »ç¿ëºÒ°¡ if (LoopCutFlag == true) { chkRepeaterCut.Enabled = false; btnInWrite.Enabled = false; btnOutWrite.Enabled = false; chkDeviceCutFlag.Enabled = false; } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } } //dataGridView2¿¡ Áß°è±â ȸ·ÎÁ¤º¸ Ç¥½Ã private void DeviceStatus(RepeaterDeviceTypeInfo dt, RepeaterPointUnit unit) { try { //dataGridView2 //this.dataGridView2.Columns.Clear(); this.dataGridView2.Rows.Clear(); if (dt != null) { chkRepeaterCut.Enabled = true; if (dt.UseFlag && dt.CutFlag) { chkRepeaterCut.Checked = true; btnInWrite.Enabled = false; btnOutWrite.Enabled = false; chkDeviceCutFlag.Enabled = false; } else { chkRepeaterCut.Checked = false; btnInWrite.Enabled = true; //btnOutWrite.Enabled = true; // cyim 2015.2.24 ¾²±â¹öư »ç¿ë±ÝÁö chkDeviceCutFlag.Enabled = true; } // // cyim 2014.4.3 : °èÅëÂ÷´Ü½Ã¿¡µµ ¹öưºñȰ¼ºÈ­ // int BoardID = Util.StrToInt(txtBoardID.Text, 0); int LoopNo = Util.StrToInt(txtLoopNo.Text, 0); bool LoopCutFlag = false; savBoardID = BoardID; savLoop = LoopNo; ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //¼ö½Å±â¼³Á¤ BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID); //Åë½Åº¸µåsavBoardIDÀÇ loop0ÀÇ ¼³Á¤°ª if (savLoop == 0) { LoopCutFlag = brdinfo.Loop0CutFlag; //REP = brdinfo.Loop0_RepeaterType; //Åë½Åº¸µå + Loop0 + 127°³ Áß°è±â ¼³Á¤°ª //REPDATA = brdinfo.Loop0_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } else { LoopCutFlag = brdinfo.Loop1CutFlag; //REP = brdinfo.Loop1_RepeaterType; //Åë½Åº¸µå + Loop1 + 127°³ Áß°è±â ¼³Á¤°ª //REPDATA = brdinfo.Loop1_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } if (LoopCutFlag == true) { chkRepeaterCut.Enabled = false; btnInWrite.Enabled = false; btnOutWrite.Enabled = false; chkDeviceCutFlag.Enabled = false; } DataGridViewCellStyle sty = new DataGridViewCellStyle(); sty.Alignment = DataGridViewContentAlignment.MiddleCenter; sty.BackColor = System.Drawing.Color.White; DataGridViewCellStyle styGray = new DataGridViewCellStyle(); styGray.Alignment = DataGridViewContentAlignment.MiddleCenter; styGray.BackColor = System.Drawing.Color.Gray; styGray.SelectionBackColor = System.Drawing.Color.Gray; if (dt.RepeaterType.Equals("A")) { for (int col = 0; col < 2; col++) { //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView2.Columns[col].ReadOnly = true; dataGridView2.Columns[col].Resizable = DataGridViewTriState.False; dataGridView2.Columns[col].Width = 90; dataGridView2.Columns[col].DefaultCellStyle = sty; } //dt.InType3 = ""; //dt.InType4 = ""; //dt.OutType3 = ""; //dt.OutType4 = ""; // cyim 2015.6.8 ¾Æ³¯·Î±× °¨Áö±â ¿¬µ¿ Ãß°¡ : ¾Æ·¡ ¼Ò½º´Â ÇÊ¿ä¾øÀ½ //dataGridView2.Columns[2].ReadOnly = true; //dataGridView2.Columns[2].Resizable = DataGridViewTriState.False; //dataGridView2.Columns[2].Width = 90; //dataGridView2.Columns[2].DefaultCellStyle = styGray; //dataGridView2.Columns[3].ReadOnly = true; //dataGridView2.Columns[3].Resizable = DataGridViewTriState.False; //dataGridView2.Columns[3].Width = 90; //dataGridView2.Columns[3].DefaultCellStyle = styGray; } else if (dt.RepeaterType.Equals("B")) { for (int col = 0; col < 4; col++) { //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView2.Columns[col].ReadOnly = true; dataGridView2.Columns[col].Resizable = DataGridViewTriState.False; dataGridView2.Columns[col].Width = 90; dataGridView2.Columns[col].DefaultCellStyle = sty; } } // cyim 2015.6.8 ¾Æ³¯·Î±× °¨Áö±â ¿¬µ¿ Ãß°¡ else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D")) { for (int col = 0; col < 1; col++) { dataGridView2.Columns[col].ReadOnly = true; dataGridView2.Columns[col].Resizable = DataGridViewTriState.False; dataGridView2.Columns[col].Width = 90; dataGridView2.Columns[col].DefaultCellStyle = sty; } } //ȸ·ÎÀÔ·Â,Ãâ·Â°ª Ç¥½Ã if (unit != null) { DataGridViewRowCollection rows2 = this.dataGridView2.Rows; if (dt != null) { if (dt.RepeaterType.Equals("A")) { // ¼öÁ¤(lch_13.08.28) - µð¹ÙÀ̽º Á¤º¸ Ãâ·Â ¿¡·¯ ÇØ°á // ÀÔ·Â µð¹ÙÀ̽º String[] inData = new String[2]; for (int i = 0; i < 2; i++) { if (dt.inDeviceTypeInfos[i] == null) { inData[i] = "-"; } else { if (i == 0) inData[i] = DeviceStatusText.InputText(unit.Repeater_Input1, dt.inDeviceTypeInfos[i].CutFlag); else inData[i] = DeviceStatusText.InputText(unit.Repeater_Input2, dt.inDeviceTypeInfos[i].CutFlag); } } // Ãâ·Â µð¹ÙÀ̽º String[] outData = new String[2]; for (int i = 0; i < 2; i++) { if (dt.outDeviceTypeInfos[i] == null) { outData[i] = "-"; } else { if (i == 0) outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output1, dt.outDeviceTypeInfos[i].CutFlag); else outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output2, dt.outDeviceTypeInfos[i].CutFlag); } } //±âÁ¸²¨ //String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1,dt.inDeviceTypeInfos[0].CutFlag) // , DeviceStatusText.InputText(unit.Repeater_Input2,dt.inDeviceTypeInfos[1].CutFlag), "", "" }; //String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1,dt.outDeviceTypeInfos[0].CutFlag) // , DeviceStatusText.OutputText(unit.Repeater_Output2,dt.outDeviceTypeInfos[1].CutFlag), "", "" }; rows2.Add(inData); rows2.Add(outData); } else if (dt.RepeaterType.Equals("B")) { // ¼öÁ¤(lch_13.08.28) - µð¹ÙÀ̽º Á¤º¸ Ãâ·Â ¿¡·¯ ÇØ°á // ÀÔ·Â µð¹ÙÀ̽º String[] inData = new String[4]; for (int i = 0; i < 4; i++) { if (dt.inDeviceTypeInfos[i] == null) { inData[i] = "-"; } else { if (i == 0) inData[i] = DeviceStatusText.InputText(unit.Repeater_Input1, dt.inDeviceTypeInfos[i].CutFlag); else if (i == 1) inData[i] = DeviceStatusText.InputText(unit.Repeater_Input2, dt.inDeviceTypeInfos[i].CutFlag); else if (i == 2) inData[i] = DeviceStatusText.InputText(unit.Repeater_Input3, dt.inDeviceTypeInfos[i].CutFlag); else if (i == 3) inData[i] = DeviceStatusText.InputText(unit.Repeater_Input4, dt.inDeviceTypeInfos[i].CutFlag); } } // Ãâ·Â µð¹ÙÀ̽º String[] outData = new String[4]; for (int i = 0; i < 4; i++) { if (dt.outDeviceTypeInfos[i] == null) { outData[i] = "-"; } else { if (i == 0) outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output1, dt.outDeviceTypeInfos[i].CutFlag); else if (i == 1) outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output2, dt.outDeviceTypeInfos[i].CutFlag); else if (i == 2) outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output3, dt.outDeviceTypeInfos[i].CutFlag); else if (i == 3) outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output4, dt.outDeviceTypeInfos[i].CutFlag); } } //String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1,dtCutFlag(dt.inDeviceTypeInfos[0])) // , DeviceStatusText.InputText(unit.Repeater_Input2,dtCutFlag(dt.inDeviceTypeInfos[1])) // , DeviceStatusText.InputText(unit.Repeater_Input3,dtCutFlag(dt.inDeviceTypeInfos[2])) // , DeviceStatusText.InputText(unit.Repeater_Input4,dtCutFlag(dt.inDeviceTypeInfos[3])) }; //String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1,dtCutFlag(dt.outDeviceTypeInfos[0])) // , DeviceStatusText.OutputText(unit.Repeater_Output2,dtCutFlag(dt.outDeviceTypeInfos[1])) // , DeviceStatusText.OutputText(unit.Repeater_Output3,dtCutFlag(dt.outDeviceTypeInfos[2])) // , DeviceStatusText.OutputText(unit.Repeater_Output4,dtCutFlag(dt.outDeviceTypeInfos[3])) }; rows2.Add(inData); rows2.Add(outData); } // cyim 2015.6.8 ¾Æ³¯·Î±× °¨Áö±â ¿¬µ¿ Ãß°¡ else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D")) { // ÀÔ·Â µð¹ÙÀ̽º String[] inData = new String[1]; for (int i = 0; i < 1; i++) { if (dt.inDeviceTypeInfos[i] == null) { inData[i] = "-"; } else { if (i == 0) inData[i] = DeviceStatusText.InputText(unit.Repeater_Input1, dt.inDeviceTypeInfos[i].CutFlag); else inData[i] = DeviceStatusText.InputText(unit.Repeater_Input2, dt.inDeviceTypeInfos[i].CutFlag); } } // Ãâ·Â µð¹ÙÀ̽º String[] outData = new String[1]; for (int i = 0; i < 1; i++) { if (dt.outDeviceTypeInfos[i] == null) { outData[i] = "-"; } else { if (i == 0) outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output1, dt.outDeviceTypeInfos[i].CutFlag); else outData[i] = DeviceStatusText.OutputText(unit.Repeater_Output2, dt.outDeviceTypeInfos[i].CutFlag); } } rows2.Add(inData); rows2.Add(outData); } } } else { DataGridViewRowCollection rows2 = this.dataGridView2.Rows; if (dt != null) { // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï : ÃʱâÈ­°ªÀ» ¼ýÀÚ¿¡¼­ - ·Î º¯°æ //case InputDeviceStatus.Init: toText = " - "; break; //case InputDeviceStatus.Use: toText = "°¨Áö"; break; //case InputDeviceStatus.Normal: toText = "Á¤»ó"; break; //case InputDeviceStatus.Blocking: toText = "´Ü¼±"; break; if (dt.RepeaterType.Equals("A")) { // cyim 2014.4.3 : ÃʱⰪ ¼öÁ¤ 1,2,3,4 -> "-" //String[] inData = { "1", "2", "", "" }; //String[] outData = { "1", "2", "", "" }; String[] inData = { "-", "-", "", "" }; String[] outData = { "-", "-", "", "" }; rows2.Add(inData); rows2.Add(outData); } else if (dt.RepeaterType.Equals("B")) { //String[] inData = { "", "2", "3", "4" }; //String[] outData = { "1", "2", "3", "4" }; String[] inData = { "-", "-", "-", "-" }; String[] outData = { "-", "-", "-", "-" }; rows2.Add(inData); rows2.Add(outData); } // cyim 2015.6.8 ¾Æ³¯·Î±× °¨Áö±â ¿¬µ¿ Ãß°¡ else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D")) { String[] inData = { "-", "", "", "" }; String[] outData = { "-", "", "", "" }; rows2.Add(inData); rows2.Add(outData); } } } } else { chkRepeaterCut.Enabled = false; btnInWrite.Enabled = false; btnOutWrite.Enabled = false; chkDeviceCutFlag.Enabled = false; } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private Boolean dtCutFlag(DeviceTypeInfo dtInfo) { bool cutFlag = false; if (dtInfo != null) cutFlag = dtInfo.CutFlag; return cutFlag; } private void btnOK_Click(object sender, EventArgs e) { // cyim 2013.8.5 Á¦¾îÈ­¸é ¹öư Æ÷Ä¿½º Á¶Àý this.panel_Menu.Focus(); try { int BoardID = Util.StrToInt(txtBoardID.Text, 0); int Loop = Util.StrToInt(txtLoopNo.Text, -1); // cyim 2013.8.2 È­¸é Àüȯ½Ã¿¡ ¶óº§ »ç¶óÁö´Â ¹®Á¦ : label1 -> label_Comment if (BoardID == 0) { this.label_Comment.Text = string.Format("Åë½Åº¸µåID¸¦ ÀÔ·ÂÇÏ¿© Áֽʽÿä."); this.label_Comment.Visible = true; //MessageBox.Show("Åë½Åº¸µåID¸¦ ÀÔ·ÂÇÏ¿© Áֽʽÿä.", Application.ProductName); txtBoardID.Focus(); return; } else if (Loop != 0 && Loop != 1) { this.label_Comment.Text = string.Format("Loop No¸¦ ¿Ã¹Ù¸£°Ô ÀÔ·ÂÇÏ¿© Áֽʽÿä"); this.label_Comment.Visible = true; //MessageBox.Show("Loop No¸¦ ¿Ã¹Ù¸£°Ô ÀÔ·ÂÇÏ¿© Áֽʽÿä.", Application.ProductName); txtLoopNo.Focus(); return; } else { this.label_Comment.Visible = false; } Repeater_getData(); // ¼öÁ¤(lch_13.08.28) //Áß°è±â Àüü Àб⠸í·É dCommandResponse d = new dCommandResponse(RepeaterInfoAll); //¸í·É»ý¼º ¹× ½ÇÇà CmdInfo cmd = new CmdInfo(prt_cmd_define.read_repeater_all, mdi.myReceiverID, 1, Loop, BoardID, d); this.mdi.ui.runCommand(cmd); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); } } private void btnRepeaterAllInfo_Click(object sender, EventArgs e) { // cyim 2013.8.5 Á¦¾îÈ­¸é ¹öư Æ÷Ä¿½º Á¶Àý this.panel_Menu.Focus(); try { int BoardID = Util.StrToInt(txtBoardID.Text, 0); int Loop = Util.StrToInt(txtLoopNo.Text, -1); // cyim 2013.8.2 È­¸é Àüȯ½Ã¿¡ ¶óº§ »ç¶óÁö´Â ¹®Á¦ : label1 -> label_Comment if (BoardID == 0) { this.label_Comment.Text = string.Format("Åë½Åº¸µåID¸¦ ÀÔ·ÂÇÏ¿© Áֽʽÿä."); this.label_Comment.Visible = true; //MessageBox.Show("Åë½Åº¸µåID¸¦ ÀÔ·ÂÇÏ¿© Áֽʽÿä.", Application.ProductName); txtBoardID.Focus(); return; } else if (Loop != 0 && Loop != 1) { this.label_Comment.Text = string.Format("Loop No¸¦ ¿Ã¹Ù¸£°Ô ÀÔ·ÂÇÏ¿© Áֽʽÿä"); this.label_Comment.Visible = true; //MessageBox.Show("Loop No¸¦ ¿Ã¹Ù¸£°Ô ÀÔ·ÂÇÏ¿© Áֽʽÿä.", Application.ProductName); txtLoopNo.Focus(); return; } else { this.label_Comment.Visible = false; } //¹öư ºñȰ¼º ¼³Á¤ button_end(false); LFC.Log("ŸÀÔ: ¼ö½Å±â Á¶ÀÛ ·Î±×, ¸Þ¼¼Áö: Â÷´Ü-Àбâ¸í·É Ŭ¸¯"); //Áß°è±â Àüü Àб⠸í·É dCommandResponse d = new dCommandResponse(RepeaterInfoAll); //¸í·É»ý¼º ¹× ½ÇÇà CmdInfo cmd = new CmdInfo(prt_cmd_define.read_repeater_all, mdi.myReceiverID, 1, Loop, BoardID, d); this.mdi.ui.runCommand(cmd); } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName); } } //*********************************************************************// // Áß°è±â ÀüüÀбâ ÀÀ´äµ¥ÀÌÅÍ À̺¥Æ® // //*********************************************************************// public void RepeaterInfoAll(CmdInfo cmd) { //¿¡·¯ÀÀ´äó¸® if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadRepeaterPointAll")) // cyim 2015.7.23 NACK ó¸® ºÎºÐ ¿À·ù { button_end(true); return; } try { RCVData_ReadRepeaterPointAll ResponseData = (RCVData_ReadRepeaterPointAll)cmd.ResponseData; RepeaterData[] data = ResponseData.Data; if (cmd.Command == prt_cmd_define.read_repeater_all || cmd.ResCommand == prt_res_define.read_repeater_all) { if (savBoardID == cmd.boardNo && savLoop == cmd.loopNo) { for (int repeaterNo = 0; repeaterNo < data.Length; repeaterNo++) { REPDATA[repeaterNo] = new RepeaterPointUnit(repeaterNo + 1, data[repeaterNo]); } Repeater_getData(); } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]{1}", ex.StackTrace, ex.Message), Application.ProductName); } finally { //¹öư ºñȰ¼º ÇØÁ¦ button_end(true); } } //È­¸é ¸¶¿ì½º Ä¿¼­ ¹× ¹öư ´Ù½Ã Ŭ¸¯ ¸øÇϵµ·Ï ¼³Á¤ ¹× ÇØÁ¦ private void button_end(Boolean val) { if (val) { this.btnRepeaterAllInfo.Enabled = true; this.Cursor = Cursors.Default; } else { this.btnRepeaterAllInfo.Enabled = false; this.Cursor = Cursors.WaitCursor; } } private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl_Main.SelectedIndex == 1) { // cyim 2015.2.17 È­¸é Àüȯ½Ã À߸øµÈ Á¤º¸°¡ ¿Ã¶ó¿È (´Ü, ¾Æ·¡ ÁÖ¼® ó¸®ÇÔ, ¾îÂ÷ÇÇ btnRepeaterAllInfo_Click ¿¡¼­ ó¸®Çϵµ·Ï µÇ¾îÀÖÀ½) //Repeater_getData(); //Áß°è±â ȸ·Î µ¥ÀÌÅÍ Àб⠸í·É btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); } else { // cyim 2015.2.17 È­¸é Àüȯ½Ã À߸øµÈ Á¤º¸°¡ ¿Ã¶ó¿È Board_getData(); this.tRepeaterReadThreadStatus = 0; } } void RepeaterInfoRead() { try { while (tRepeaterReadThreadStatus > 0) { if (this.mdi.ui.Connected) { try { int BoardID = Util.StrToInt(txtBoardID.Text, 0); int Loop = Util.StrToInt(txtLoopNo.Text, -1); if (BoardID == 0) { tRepeaterReadThreadStatus = 0; } if (Loop != 0 && Loop != 1) { tRepeaterReadThreadStatus = 0; } tRepeaterReadThreadStatus++; //Áß°è±â Àüü Àб⠸í·É dCommandResponse d = new dCommandResponse(RepeaterInfoAll); //¸í·É»ý¼º ¹× ½ÇÇà CmdInfo cmd = new CmdInfo(prt_cmd_define.read_repeater_all, mdi.myReceiverID, 1, Loop, BoardID, d); this.mdi.ui.runCommand(cmd); if (tRepeaterReadThreadStatus > 4) tRepeaterReadThreadStatus = 0; } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); tRepeaterReadThreadStatus = 0; } Thread.Sleep(1000); } else { tRepeaterReadThreadStatus = 0; } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); tRepeaterReadThreadStatus = 0; } } private void chkRepeaterCut_Click(object sender, EventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { try { bool chkCutFlag = chkRepeaterCut.Checked ? false : true; int cutActionCnt = 0; if (MessageBox.Show(string.Format("Áß°è±â Â÷´Ü{0} ¸í·ÉÀ» ¼öÇàÇϽðڽÀ´Ï±î?", chkCutFlag ? "¼³Á¤" : "ÇØÁ¦") , Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { this.Cursor = Cursors.WaitCursor; DacRepeaterConfig dacRepeaterConfig = new DacRepeaterConfig(mdi.myReceiverID); // cyim 2015.7.30 µ¥ÀÌŸº£À̽º Á¢¼Ó ·çƾ º¯°æ //int CommID = 1; int BoardID = Util.StrToInt(txtBoardID.Text, 0); int LoopNo = Util.StrToInt(txtLoopNo.Text, 0); //DataGridViewCell repCell = this.dataGridView1.SelectedCells[0]; //int RepeaterID = (repCell.RowIndex * 10) + repCell.ColumnIndex + 1; //REP[RepeaterID - 1].CutFlag = true; foreach (DataGridViewCell repCell in this.dataGridView1.SelectedCells) { int RepeaterID = (repCell.RowIndex * 10) + repCell.ColumnIndex + 1; if (REP[RepeaterID - 1] != null) { if (REP[RepeaterID - 1].CutFlag != chkCutFlag) { //ÀÌ¹Ì º¯°æÀÌ ÀÌ·ç¾î Áø°Å¶ó¸é ´Ù½Ã ¿ø»óÅ·Πȸº¹. if (REP[RepeaterID - 1].CutFlagChange) { REP[RepeaterID - 1].CutFlagChangeReset(); } else { REP[RepeaterID - 1].CutFlagChange = chkCutFlag; } dacRepeaterConfig.Repeater_Cut_Update(mdi.myReceiverID, BoardID, LoopNo, RepeaterID, chkCutFlag ? "Y" : "N"); cutActionCnt++; } } } if (cutActionCnt < 1) { this.Cursor = Cursors.Default; MessageBox.Show("Áß°è±â¼³Á¤À» È®ÀÎ ÇϽʽÿä.. Â÷´Ü¼³Á¤À» ÇÒ ¼ö ¾ø½À´Ï´Ù.", Application.ProductName); return; } if (chkCutFlag) { LFC.Log("ŸÀÔ: ¼ö½Å±â Á¶ÀÛ ·Î±×, ¸Þ¼¼Áö: Â÷´Ü-Áß°è±âÂ÷´Ü ¼³Á¤"); } else { LFC.Log("ŸÀÔ: ¼ö½Å±â Á¶ÀÛ ·Î±×, ¸Þ¼¼Áö: Â÷´Ü-Áß°è±âÂ÷´Ü ÇØÁ¦"); } /******************************************/ /* Áß°è±â Â÷´Ü ¸í·É Progress Ç¥½Ã */ /******************************************/ frmProgress frm = new frmProgress(mdi); // cyim 2016.12.07 : ¼ö½Å±â ¸ðµ¨º° ³»ºÎ ·ÎÁ÷ º¯°æ CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, LoopNo, BoardID, null); cmd.CommandType = "DC"; cmd.ApplyRange = "R"; //Â÷´Ü·¹º§(ȸ·ÎŸÀÔÂ÷´Ü¿ë) A-All,C-Comm,B-Board,L-Loop,R-Áß°è±â,D-ȸ·Î,I-ÀÔ·Âȸ·Î,O-Ãâ·Âȸ·Î cmd.CommandData = REP; frm.Commandinfo = cmd; frm.ui = this.mdi.ui; frm.ShowDialog(); ///******************************************/ // cyim 2013.8.5 È­¸é°»½ÅÀü ´ë±âÈ­¸é ÆË¾÷â Ãâ·Â mdi.Popup.CommonPopupShow(this); // cyim 2015.8.4 ¼ö½Å¹ÝÀ» À§ÇÑ static Ŭ·¡½º Á¤¸® // cyim 2013.9.23 È­¸é°»½ÅÄÚµå Ãß°¡ this.Update(); this.mdi.ui.ReceiverDBRead(); //¼ö½Å±â¼³Á¤¹×Â÷´ÜÄ«¿îÆ® ´Ù½Ã °è»ê this.Cursor = Cursors.Default; //üũ»óŸ¦ º¯°æÇØÁØ´Ù.. chkRepeaterCut.Checked = chkCutFlag; // cyim 2013.8.5 È­¸é°»½ÅÀü ´ë±âÈ­¸é ÆË¾÷â Ãâ·Â + Áߺ¹·çƾ Á¦°Å mdi.Popup.CommonPopupClose(this); // cyim 2015.8.4 ¼ö½Å¹ÝÀ» À§ÇÑ static Ŭ·¡½º Á¤¸® //this.mdi.ui.ReceiverDBRead(); //¼ö½Å±â¼³Á¤¹×Â÷´ÜÄ«¿îÆ® ´Ù½Ã °è»ê // cyim 2013.9.23 È­¸é°»½ÅÄÚµå Ãß°¡ this.Update(); //Áß°è±â ȸ·Î µ¥ÀÌÅÍ Àб⠸í·É btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï // UI °»½Å Repeater_getData(); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]{1}", ex.StackTrace, ex.Message), Application.ProductName); } } } //ȸ·ÎÂ÷´Ü¸í·É private void chkDeviceCutFlag_Click(object sender, EventArgs e) { // cyim 2014.4.3 : È­¸é Àüȯ½Ã¿¡ Áß°è±â°¡ ¾ø´Â °æ¿ì¿¡µµ ȸ·ÎÂ÷´Ü ¹öưÀÌ È°¼ºÈ­µÈ´Ù : Á¶°Ç Ãß°¡ // ¼öÁ¤(lch_13.08.28) - Áß°è±â 2*2ÀÇ È¸»ö ¹è°æÀ¸·Î µÈ 34¹ø µð¹ÙÀ̽º¸¦ Ŭ¸¯ÇÏ¿´À» °æ¿ì´Â ȸ·Î Â÷´ÜÀ» ÇÏÁö ¸øÇÔ if (dataGridView2.SelectedCells.Count == 0 || this.dataGridView2.SelectedCells[0].Value == null) { return; } if (dataGridView2.SelectedCells.Count > 0 && !lblRepeaterID.Text.Equals("")) { try { bool chkCutFlag = chkDeviceCutFlag.Checked ? false : true; DataGridViewCell upCell = this.dataGridView1.SelectedCells[0]; DataGridViewCell repCell = this.dataGridView2.SelectedCells[0]; String InOutType = repCell.RowIndex == 0 ? "I" : "O"; int DeviceId = repCell.ColumnIndex + 1; if (MessageBox.Show(string.Format("{0}ȸ·Î[{1}] Â÷´Ü{2} ¸í·ÉÀ» ¼öÇàÇϽðڽÀ´Ï±î?" , InOutType == "I" ? "ÀÔ·Â" : "Ãâ·Â", DeviceId, chkCutFlag ? "¼³Á¤" : "ÇØÁ¦") , Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { this.Cursor = Cursors.WaitCursor; DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(mdi.myReceiverID);// cyim 2015.7.30 µ¥ÀÌŸº£À̽º Á¢¼Ó ·çƾ º¯°æ //int CommID = 1; int BoardID = Util.StrToInt(txtBoardID.Text, 0); int LoopNo = Util.StrToInt(txtLoopNo.Text, 0); int RepeaterId = (upCell.RowIndex * 10) + upCell.ColumnIndex + 1; //int RepeaterId = Util.StrToInt(lblRepeaterID.Text, 0); dacDeviceConfig.Device_Cut_Update(mdi.myReceiverID, BoardID, LoopNo, RepeaterId, DeviceId, InOutType, chkCutFlag ? "Y" : "N"); /******************************************/ /* ȸ·Î Â÷´Ü ¸í·É Progress Ç¥½Ã */ /******************************************/ frmProgress frm = new frmProgress(mdi);// cyim 2016.12.07 : ¼ö½Å±â ¸ðµ¨º° ³»ºÎ ·ÎÁ÷ º¯°æ CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, LoopNo, BoardID, null); cmd.CommandType = "DC"; cmd.ApplyRange = InOutType; //Â÷´Ü·¹º§(ȸ·ÎŸÀÔÂ÷´Ü¿ë) A-All,C-Comm,B-Board,L-Loop,R-Áß°è±â,D-ȸ·Î,I-ÀÔ·Âȸ·Î,O-Ãâ·Âȸ·Î cmd.repeaterNo = RepeaterId; cmd.DeviceId = DeviceId; cmd.Status = chkCutFlag ? 0 : 1;//k.s.d 20120102, 1 : 0; -> 0 : 1; with jys(ub). cmd.CommandData = "CUTCOMMAND"; frm.Commandinfo = cmd; cmd.Devicetype = InOutType; //k.s.d 20101022, cut setting bug fix with jys(ub). frm.ui = this.mdi.ui; frm.ShowDialog(); ///******************************************/ // cyim 2013.8.5 È­¸é°»½ÅÀü ´ë±âÈ­¸é ÆË¾÷â Ãâ·Â mdi.Popup.CommonPopupShow(this); // cyim 2015.8.4 ¼ö½Å¹ÝÀ» À§ÇÑ static Ŭ·¡½º Á¤¸® this.mdi.ui.ReceiverDBRead(); //¼ö½Å±â¼³Á¤¹×Â÷´ÜÄ«¿îÆ® ´Ù½Ã °è»ê this.Cursor = Cursors.Default; //üũ»óŸ¦ º¯°æÇØÁØ´Ù.. chkDeviceCutFlag.Checked = chkCutFlag; // cyim 2013.8.5 È­¸é°»½ÅÀü ´ë±âÈ­¸é ÆË¾÷â Ãâ·Â + Áߺ¹·çƾ Á¦°Å mdi.Popup.CommonPopupClose(this); // cyim 2015.8.4 ¼ö½Å¹ÝÀ» À§ÇÑ static Ŭ·¡½º Á¤¸® //this.mdi.ui.ReceiverDBRead(); //¼ö½Å±â¼³Á¤¹×Â÷´ÜÄ«¿îÆ® ´Ù½Ã °è»ê //Áß°è±â ȸ·Î µ¥ÀÌÅÍ Àб⠸í·É btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); // cyim 2013.9.26 Áß°è±âÂ÷´Ü º¸¿Ï // UI °»½Å Repeater_getData(); } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]{1}", ex.StackTrace, ex.Message), Application.ProductName); } } } private void btnInWrite_Click(object sender, EventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { try { DataGridViewCell cell = this.dataGridView1.SelectedCells[0]; if (MessageBox.Show("TEST¿ë ȸ·Î¸¸ ÀԷ¾²±â°¡ °¡´ÉÇÕ´Ï´Ù..±×·¡µµ ÀԷ¾²±â¸¦ ÇϽðڽÀ´Ï±î?" , Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { int RepeaterID = (cell.RowIndex * 10) + cell.ColumnIndex + 1; if (REPDATA == null || REPDATA[RepeaterID - 1] == null) { MessageBox.Show("ȸ·Î¼³Á¤ ¹× µ¥ÀÌÅ͸¦ ÀÐÀ»¼ö ¾ø½À´Ï´Ù..Åë½Å»óŸ¦ È®ÀÎÇϽʽÿä..", Application.ProductName); return; } InputIDVo vo = new InputIDVo(); vo.ReceiverID = int.Parse(txtThisReceiverID.Text); vo.CommID = 1; vo.BoardID = Util.StrToInt(txtBoardID.Text, 0); vo.LoopNo = Util.StrToInt(txtLoopNo.Text, 0); vo.RepeaterID = RepeaterID; vo.RepeaterType = REP[RepeaterID - 1].RepeaterType; vo.InoutType = "I"; //ÀԷŸÀÔ InputDeviceStatus[] devData = new InputDeviceStatus[4]{REPDATA[RepeaterID - 1].Repeater_Input1 ,REPDATA[RepeaterID - 1].Repeater_Input2 ,REPDATA[RepeaterID - 1].Repeater_Input3 ,REPDATA[RepeaterID - 1].Repeater_Input4}; vo.InputUnitData = devData; // cyim 2015.2.23 ȸ·ÎÂ÷´Ü½Ã¿¡´Â »ç¿ëºÒ°¡ // Áß°è±â À妽º int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1; IWin32Window window = this; frmModalUnitDataSelect frm = new frmModalUnitDataSelect(REP[no - 1]); frm.InputVo = vo; frm.ShowDialog(window); vo = frm.InputVo; //ÀÔ·ÂÇÑ Äڵ尡 ÀÖ´Ù¸é if (vo.InputOK) { InputDeviceStatus[] inData = vo.InputUnitData; RepeaterData inputdata = new RepeaterData((byte)RepeaterID); inputdata.Set_Input_Data((int)inData[3], (int)inData[2], (int)inData[1], (int)inData[0]); //¿Ï·áÀ̺¥Æ® dCommandResponse d = new dCommandResponse(RepeaterInputWriteComplete); //¸í·É»ý¼º ¹× ½ÇÇà CmdInfo cmd = new CmdInfo(prt_cmd_define.write_repeater_input_unit, mdi.myReceiverID, 1, vo.LoopNo, vo.BoardID, vo.RepeaterID, d); cmd.CommandData = inputdata; mdi.ui.runCommand(cmd); } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]{1}", ex.StackTrace, ex.Message), Application.ProductName); } } } //Áß°è±â ÀԷ¾²±â ¿Ï·á public void RepeaterInputWriteComplete(CmdInfo cmd) { //¿¡·¯ÀÀ´äó¸® if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_WriteRepeaterInputUNIT")) // cyim 2015.7.23 NACK ó¸® ºÎºÐ ¿À·ù { button_end(true); return; } try { int BoardID = Util.StrToInt(txtBoardID.Text, 0); int Loop = Util.StrToInt(txtLoopNo.Text, -1); if (BoardID == cmd.boardNo && cmd.loopNo == Loop) { int RepeaterID = cmd.repeaterNo; RCVData_WriteRepeaterInputUNIT ResponseData = (RCVData_WriteRepeaterInputUNIT)cmd.ResponseData; RepeaterPointUnit newdata = new RepeaterPointUnit(BoardID, ResponseData.Data); //µ¥ÀÌÅÍÀúÀå ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //¼ö½Å±â¼³Á¤ BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(BoardID); //Åë½Åº¸µåsavBoardIDÀÇ loop0ÀÇ ¼³Á¤°ª RepeaterPointUnit[] repdata; if (savLoop == 0) { repdata = brdinfo.Loop0_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } else { repdata = brdinfo.Loop1_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } repdata[RepeaterID - 1] = newdata; //¼¿¿¡ Ç¥½Ã DeviceStatus(REP[RepeaterID - 1], REPDATA[RepeaterID - 1]); //ȸ·Î³»¿ëÇ¥½Ã } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName); } finally { //¹öư ºñȰ¼º ÇØÁ¦ button_end(true); } } //Áß°è±â Ãâ·Â¾²±â ¿Ï·á public void RepeaterOutputWriteComplete(CmdInfo cmd) { //¿¡·¯ÀÀ´äó¸® if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_WriteRepeaterOutputUNIT")) // cyim 2015.7.23 NACK ó¸® ºÎºÐ ¿À·ù { button_end(true); return; } try { int BoardID = Util.StrToInt(txtBoardID.Text, 0); int Loop = Util.StrToInt(txtLoopNo.Text, -1); if (BoardID == cmd.boardNo && cmd.loopNo == Loop) { int RepeaterID = cmd.repeaterNo; RCVData_WriteRepeaterOutputUNIT ResponseData = (RCVData_WriteRepeaterOutputUNIT)cmd.ResponseData; RepeaterPointUnit newdata = new RepeaterPointUnit(BoardID, ResponseData.Data); //µ¥ÀÌÅÍÀúÀå ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //¼ö½Å±â¼³Á¤ BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(BoardID); //Åë½Åº¸µåsavBoardIDÀÇ loop0ÀÇ ¼³Á¤°ª RepeaterPointUnit[] repdata; if (savLoop == 0) { repdata = brdinfo.Loop0_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } else { repdata = brdinfo.Loop1_RepeaterUnit_Data; //127°³ Áß°è±â µ¥ÀÌÅÍ } repdata[RepeaterID - 1] = newdata; //¼¿¿¡ Ç¥½Ã DeviceStatus(REP[RepeaterID - 1], REPDATA[RepeaterID - 1]); //ȸ·Î³»¿ëÇ¥½Ã if (this.tRepeaterReadThreadStatus == 1) { this.tRepeaterReadThread = new Thread(this.RepeaterInfoRead); this.tRepeaterReadThreadStatus = 1; this.tRepeaterReadThread.Start(); } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName); } finally { //¹öư ºñȰ¼º ÇØÁ¦ button_end(true); } } private void btnOutWrite_Click(object sender, EventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { try { DataGridViewCell cell = this.dataGridView1.SelectedCells[0]; if (MessageBox.Show("½ÇÁ¦·Î È­Àç ¹× ¼³ºñ ¿¬µ¿°¨Áö°¡ µÉ¼ö ÀÖ½À´Ï´Ù. ±×·¡µµ Ãâ·Â¾²±â¸¦ ÇϽðڽÀ´Ï±î?" , Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { int RepeaterID = (cell.RowIndex * 10) + cell.ColumnIndex + 1; if (REPDATA == null || REPDATA[RepeaterID - 1] == null) { MessageBox.Show("ȸ·Î¼³Á¤ ¹× µ¥ÀÌÅ͸¦ ÀÐÀ»¼ö ¾ø½À´Ï´Ù..Åë½Å»óŸ¦ È®ÀÎÇϽʽÿä..", Application.ProductName); return; } InputIDVo vo = new InputIDVo(); vo.ReceiverID = int.Parse(txtThisReceiverID.Text); vo.CommID = 1; vo.BoardID = Util.StrToInt(txtBoardID.Text, 0); vo.LoopNo = Util.StrToInt(txtLoopNo.Text, 0); vo.RepeaterID = RepeaterID; vo.RepeaterType = REP[RepeaterID - 1].RepeaterType; vo.InoutType = "O"; //Ãâ·ÂŸÀÔ OutputDeviceStatus[] devData = new OutputDeviceStatus[4]{REPDATA[RepeaterID - 1].Repeater_Output1 ,REPDATA[RepeaterID - 1].Repeater_Output2 ,REPDATA[RepeaterID - 1].Repeater_Output3 ,REPDATA[RepeaterID - 1].Repeater_Output4}; vo.OutputUnitData = devData; // cyim 2015.2.23 ȸ·ÎÂ÷´Ü½Ã¿¡´Â »ç¿ëºÒ°¡ // Áß°è±â À妽º int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1; IWin32Window window = this; frmModalUnitDataSelect frm = new frmModalUnitDataSelect(REP[no - 1]); frm.InputVo = vo; frm.ShowDialog(window); vo = frm.InputVo; //ÀÔ·ÂÇÑ Äڵ尡 ÀÖ´Ù¸é if (vo.InputOK) { OutputDeviceStatus[] outData = vo.OutputUnitData; RepeaterData outputdata = new RepeaterData((byte)RepeaterID); outputdata.Set_Output_Data(outData[3] == OutputDeviceStatus.Blocking ? true : false , outData[2] == OutputDeviceStatus.Blocking ? true : false , outData[1] == OutputDeviceStatus.Blocking ? true : false , outData[0] == OutputDeviceStatus.Blocking ? true : false , outData[3] == OutputDeviceStatus.Write ? true : false , outData[2] == OutputDeviceStatus.Write ? true : false , outData[1] == OutputDeviceStatus.Write ? true : false , outData[0] == OutputDeviceStatus.Write ? true : false ); //¿Ï·áÀ̺¥Æ® dCommandResponse d = new dCommandResponse(RepeaterOutputWriteComplete); //¸í·É»ý¼º ¹× ½ÇÇà CmdInfo cmd = new CmdInfo(prt_cmd_define.write_repeater_output_unit, mdi.myReceiverID, 1, vo.LoopNo, vo.BoardID, RepeaterID, d); cmd.CommandData = outputdata; mdi.ui.runCommand(cmd); //¿¬µ¿À¸·Î ÀÎÇØ Ãâ·Â°ªÀÌ º¯°æµÉ ¼ö ÀÖÀ¸¹Ç·Î °è¼Ó Àд´Ù.. //this.tRepeaterReadThread = new Thread(this.RepeaterInfoRead); this.tRepeaterReadThreadStatus = 1; //this.tRepeaterReadThread.Start(); } } } catch (Exception ex) { Util.UErrorMessage(ex, 0, 0); //MessageBox.Show(ex.Message, Application.ProductName); //MessageBox.Show(string.Format("[{0}]{1}", ex.StackTrace, ex.Message), Application.ProductName); } } } // // cyim 2013.7.12 µðÀÚÀΰ³¼±ÀÛ¾÷ : Á¦¾î - Áß°è´Ü // private void button_LoopCut_Click(object sender, EventArgs e) { LFC.Log("ŸÀÔ: ¼ö½Å±â Á¶ÀÛ ·Î±×, ¸Þ¼¼Áö: Â÷´Ü-°èÅëÂ÷´Ü Ŭ¸¯"); button_Menu_Color_Init(); this.tabControl_Main.SelectTab(0); this.button_LoopCut.BackgroundImage = (Image)Properties.Resources.ÅǸ޴º¹öư_ÁÖȲ_100_30; this.panel_Menu.Focus(); } private void button_Menu_RepeaterCut_Click(object sender, EventArgs e) { LFC.Log("ŸÀÔ: ¼ö½Å±â Á¶ÀÛ ·Î±×, ¸Þ¼¼Áö: Â÷´Ü-Áß°è±âÂ÷´Ü Ŭ¸¯"); button_Menu_Color_Init(); this.tabControl_Main.SelectTab(1); this.button_Menu_RepeaterCut.BackgroundImage = (Image)Properties.Resources.ÅǸ޴º¹öư_ÁÖȲ_100_30; this.panel_Menu.Focus(); } private void button_Menu_Color_Init() { this.button_LoopCut.BackgroundImage = (Image)Properties.Resources.ÅǸ޴º¹öư_ȸ»ö_100_30; this.button_Menu_RepeaterCut.BackgroundImage = (Image)Properties.Resources.ÅǸ޴º¹öư_ȸ»ö_100_30; } } }