123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076 |
- 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;
-
- CheckBox[] checkLoop0;
- CheckBox[] checkLoop1;
-
- 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();
-
- this.button_LoopCut.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
-
- 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);
-
- }
- }
-
- 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)
- {
-
- SetStyle(ControlStyles.UserPaint, true);
-
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);
-
- 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();
-
- 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
- {
-
- 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.checkLoop0[i - 1].Visible = false;
- this.checkLoop1[i - 1].Visible = false;
- }
- DacBoardConfig dacBoardConfig = new DacBoardConfig(mdi.myReceiverID);
- 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 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;
-
-
-
-
-
-
-
-
-
-
- }
- Panel panelBoard = (Panel)Util.FineControl(tabPage_Board, "panelBoard" + BoardId);
- UIImageChange(UseFlag, panelBoard);
- checkPanelLoad(BoardId, Loop0CutFlag, Loop1CutFlag);
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
-
- }
- }
-
-
- private void UIImageChange(bool chkUse, Panel p)
- {
- try
- {
- if (chkUse)
- {
-
- p.BackgroundImage = imageList_BoardUseFlag.Images[0];
-
- }
- else
- {
-
- p.BackgroundImage = imageList_BoardUseFlag.Images[1];
-
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoardSave_Click(object sender, EventArgs e)
- {
-
- this.panel_Menu.Focus();
- try
- {
-
- if (MessageBox.Show("수신기에 차단명령을 내리시겠습니까?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- DacBoardConfig dacBoardConfig = new DacBoardConfig(mdi.myReceiverID);
- int chkChangeCount = 0;
-
-
- 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++;
- }
-
- dacBoardConfig.Board_Cut_Update(mdi.myReceiverID, BoardId, Loop0CutFlag ? "Y" : "N", Loop1CutFlag ? "Y" : "N");
- }
-
- bool RecoverExcuteEnable = false;
- if (chkChangeCount > 0)
- {
- if (Check_Change() == true)
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 차단-계통차단 해제");
- }
- else
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 차단-계통차단 적용");
- }
-
-
- {
- this.Cursor = Cursors.WaitCursor;
-
-
-
- frmProgress frm = new frmProgress(mdi);
-
- 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;
-
- RecoverExcuteEnable = true;
- }
- }
-
- mdi.Popup.CommonPopupShow(this);
-
- this.Update();
-
- this.mdi.ui.ReceiverDBRead();
-
- mdi.Popup.CommonPopupClose(this);
-
-
- Repeater_getData();
-
- 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);
-
-
- }
- }
-
-
-
-
- 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);
-
- 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();
-
-
- 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);
- }
- }
-
- 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;
-
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void Repeater_init()
- {
- try
- {
-
- try
- {
- this.dataGridView1.Columns.Clear();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
-
-
-
- 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;
- }
-
-
-
-
- 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);
-
- }
- }
- rows.Add(rowData);
- }
-
-
- RepeaterStatus("");
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- throw ex;
- }
- }
-
-
- private bool Repeater_GetData_Circuit_CutInfo(RepeaterDeviceTypeInfo dev, RepeaterPointUnit unit)
- {
- int Count = 0;
- if (dev == null)
- return false;
-
-
-
-
-
- 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++)
- {
-
-
- 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
- {
-
- if (Count == 2)
- {
- if (unit.Repeater_Output1 == OutputDeviceStatus.Blocking)
- return true;
- else if (unit.Repeater_Output2 == OutputDeviceStatus.Blocking)
- return true;
- }
-
- 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;
- }
-
-
- else
- {
- if (unit.Repeater_Output1 == OutputDeviceStatus.Blocking)
- return true;
- }
- }
- return false;
- }
-
- 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;
-
- savBoardID = BoardID;
- savLoop = LoopNo;
- Repeater_init();
- ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo;
- BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID);
- if (savLoop == 0)
- {
- LoopCutFlag = brdinfo.Loop0CutFlag;
- REP = brdinfo.Loop0_RepeaterType;
- REPDATA = brdinfo.Loop0_RepeaterUnit_Data;
- }
- else
- {
- LoopCutFlag = brdinfo.Loop1CutFlag;
- REP = brdinfo.Loop1_RepeaterType;
- REPDATA = brdinfo.Loop1_RepeaterUnit_Data;
- }
- 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;
-
-
-
- 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
- {
-
-
-
- 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;
- }
-
-
-
-
-
-
-
-
-
-
- if (LoopCutFlag)
- {
-
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
-
-
- }
- }
-
- 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);
-
- }
- }
-
- 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);
- }
- }
- }
-
- else
- DeviceStatus(null, null);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- private void dataGridView2_SelectionChanged(object sender, EventArgs e)
- {
-
- bool InDBCircuit = false;
- txtDeviceTypeName.Text = "";
- txtPositionName.Text = "";
- txtDeviceMemo.Text = "";
-
-
- 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);
- DataTable dt2 = dacUIProcess.Device_Select(mdi.myReceiverID, CommID, BoardID, LoopNo, RepeaterID, deviceId, InOut_Type);
- foreach (DataRow dr2 in dt2.Rows)
- {
-
- 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"]);
-
- if (CutFlag.Equals("Y"))
- {
- chkDeviceCutFlag.Checked = true;
- chkDeviceCutFlag.Text = "차단해제";
- }
- else
- {
- chkDeviceCutFlag.Checked = false;
- }
- }
-
-
-
- bool LoopCutFlag = false;
- savBoardID = BoardID;
- savLoop = LoopNo;
- ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo;
- BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID);
- if (savLoop == 0)
- {
- LoopCutFlag = brdinfo.Loop0CutFlag;
-
-
- }
- else
- {
- LoopCutFlag = brdinfo.Loop1CutFlag;
-
-
- }
-
- if (InDBCircuit == false)
- {
-
- btnInWrite.Enabled = false;
- btnOutWrite.Enabled = false;
- chkDeviceCutFlag.Enabled = false;
- }
- else
- {
- btnInWrite.Enabled = true;
-
-
-
- if (LoopCutFlag == true)
- {
- chkRepeaterCut.Enabled = false;
- btnInWrite.Enabled = false;
- btnOutWrite.Enabled = false;
- chkDeviceCutFlag.Enabled = false;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- }
-
- private void DeviceStatus(RepeaterDeviceTypeInfo dt, RepeaterPointUnit unit)
- {
- try
- {
-
-
- 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;
-
- chkDeviceCutFlag.Enabled = true;
- }
-
-
-
- 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);
- if (savLoop == 0)
- {
- LoopCutFlag = brdinfo.Loop0CutFlag;
-
-
- }
- else
- {
- LoopCutFlag = brdinfo.Loop1CutFlag;
-
-
- }
- 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[col].ReadOnly = true;
- dataGridView2.Columns[col].Resizable = DataGridViewTriState.False;
- dataGridView2.Columns[col].Width = 90;
- dataGridView2.Columns[col].DefaultCellStyle = sty;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- else if (dt.RepeaterType.Equals("B"))
- {
- for (int col = 0; col < 4; col++)
- {
-
- dataGridView2.Columns[col].ReadOnly = true;
- dataGridView2.Columns[col].Resizable = DataGridViewTriState.False;
- dataGridView2.Columns[col].Width = 90;
- dataGridView2.Columns[col].DefaultCellStyle = sty;
- }
- }
-
- 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"))
- {
-
-
- 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);
- }
- }
-
-
-
-
-
- rows2.Add(inData);
- rows2.Add(outData);
- }
- else if (dt.RepeaterType.Equals("B"))
- {
-
-
- 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);
- }
- }
-
-
-
-
-
-
-
-
- rows2.Add(inData);
- rows2.Add(outData);
- }
-
- 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)
- {
-
-
-
-
-
- if (dt.RepeaterType.Equals("A"))
- {
-
-
-
- String[] inData = { "-", "-", "", "" };
- String[] outData = { "-", "-", "", "" };
- rows2.Add(inData);
- rows2.Add(outData);
- }
- else if (dt.RepeaterType.Equals("B"))
- {
-
-
- String[] inData = { "-", "-", "-", "-" };
- String[] outData = { "-", "-", "-", "-" };
- rows2.Add(inData);
- rows2.Add(outData);
- }
-
- 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)
- {
-
- this.panel_Menu.Focus();
- try
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
-
- if (BoardID == 0)
- {
- this.label_Comment.Text = string.Format("통신보드ID를 입력하여 주십시요.");
- this.label_Comment.Visible = true;
-
- txtBoardID.Focus();
- return;
- }
- else if (Loop != 0 && Loop != 1)
- {
- this.label_Comment.Text = string.Format("Loop No를 올바르게 입력하여 주십시요");
- this.label_Comment.Visible = true;
-
- txtLoopNo.Focus();
- return;
- }
- else
- {
- this.label_Comment.Visible = false;
- }
- Repeater_getData();
-
-
- 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)
- {
-
- this.panel_Menu.Focus();
- try
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
-
- if (BoardID == 0)
- {
- this.label_Comment.Text = string.Format("통신보드ID를 입력하여 주십시요.");
- this.label_Comment.Visible = true;
-
- txtBoardID.Focus();
- return;
- }
- else if (Loop != 0 && Loop != 1)
- {
- this.label_Comment.Text = string.Format("Loop No를 올바르게 입력하여 주십시요");
- this.label_Comment.Visible = true;
-
- 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);
-
-
- }
- }
-
-
-
- public void RepeaterInfoAll(CmdInfo cmd)
- {
-
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadRepeaterPointAll"))
- {
- 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);
-
-
- }
- 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)
- {
-
-
-
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty);
- }
- else
- {
-
- 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);
-
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
-
-
-
- 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("타입: 수신기 조작 로그, 메세지: 차단-중계기차단 해제");
- }
-
-
-
- frmProgress frm = new frmProgress(mdi);
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, LoopNo, BoardID, null);
- cmd.CommandType = "DC";
- cmd.ApplyRange = "R";
- cmd.CommandData = REP;
- frm.Commandinfo = cmd;
- frm.ui = this.mdi.ui;
- frm.ShowDialog();
-
-
- mdi.Popup.CommonPopupShow(this);
-
- this.Update();
- this.mdi.ui.ReceiverDBRead();
- this.Cursor = Cursors.Default;
-
- chkRepeaterCut.Checked = chkCutFlag;
-
- mdi.Popup.CommonPopupClose(this);
-
-
- this.Update();
-
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty);
-
-
- Repeater_getData();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
-
- }
- }
- }
-
- private void chkDeviceCutFlag_Click(object sender, EventArgs e)
- {
-
-
- 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);
-
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
- int RepeaterId = (upCell.RowIndex * 10) + upCell.ColumnIndex + 1;
-
- dacDeviceConfig.Device_Cut_Update(mdi.myReceiverID, BoardID, LoopNo, RepeaterId, DeviceId, InOutType, chkCutFlag ? "Y" : "N");
-
-
-
- frmProgress frm = new frmProgress(mdi);
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, LoopNo, BoardID, null);
- cmd.CommandType = "DC";
- cmd.ApplyRange = InOutType;
- cmd.repeaterNo = RepeaterId;
- cmd.DeviceId = DeviceId;
- cmd.Status = chkCutFlag ? 0 : 1;
- cmd.CommandData = "CUTCOMMAND";
- frm.Commandinfo = cmd;
- cmd.Devicetype = InOutType;
- frm.ui = this.mdi.ui;
- frm.ShowDialog();
-
-
- mdi.Popup.CommonPopupShow(this);
- this.mdi.ui.ReceiverDBRead();
- this.Cursor = Cursors.Default;
-
- chkDeviceCutFlag.Checked = chkCutFlag;
-
- mdi.Popup.CommonPopupClose(this);
-
-
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty);
-
-
- Repeater_getData();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
-
- }
- }
- }
- 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;
-
-
- 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);
-
-
- }
- }
- }
-
- public void RepeaterInputWriteComplete(CmdInfo cmd)
- {
-
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_WriteRepeaterInputUNIT"))
- {
- 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);
- RepeaterPointUnit[] repdata;
- if (savLoop == 0)
- {
- repdata = brdinfo.Loop0_RepeaterUnit_Data;
- }
- else
- {
- repdata = brdinfo.Loop1_RepeaterUnit_Data;
- }
- repdata[RepeaterID - 1] = newdata;
-
- DeviceStatus(REP[RepeaterID - 1], REPDATA[RepeaterID - 1]);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
- }
- finally
- {
-
- button_end(true);
- }
- }
-
- public void RepeaterOutputWriteComplete(CmdInfo cmd)
- {
-
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_WriteRepeaterOutputUNIT"))
- {
- 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);
- RepeaterPointUnit[] repdata;
- if (savLoop == 0)
- {
- repdata = brdinfo.Loop0_RepeaterUnit_Data;
- }
- else
- {
- repdata = brdinfo.Loop1_RepeaterUnit_Data;
- }
- 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);
-
- }
- 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;
-
-
- 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.tRepeaterReadThreadStatus = 1;
-
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
-
- }
- }
- }
-
-
-
- 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;
- }
- }
- }
|