1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017 |
- ๏ปฟusing System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- using System.Collections;
- using System.Threading;
- namespace FPER
- {
- public partial class frmRepeaterGroup : Form
- {
- int savBoardID = -1;
- int savLoop = -1;
- bool BoardGroup_change;
- MDIParent mdi;
- //FormRepeater FormRepeater = null;
- delegate void deleFormInit();
- LogFileCreate LFC = new LogFileCreate();
- //์ค๊ณ๊ธฐ ์ฝ๊ธฐ๋ฅผ ์งํํ๊ธฐ ์ํด
- private Thread tRepeaterReadThread;
- private int tRepeaterReadThreadStatus = 0;
- // cyim 2015.7.2 ํด์ฌํ
์ด๋ธ๋ก ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ๋ ๋ฒจ์ ์์ด๋๋ณ๋ก ์ ์ฅํด๋๋ค
- // ํ๋ฉด์์ ๋ณด์ด๋ ๋ณด๋,๋ฃจํ๋ฒํธ์ ํด๋นํ๋ ์๋ ๋ก๊ทธ๊ฐ์ง๊ธฐ ๋ ๋ฒจ๊ฐ ์ ๋ณด๋ฅผ ๋ฏธ๋ฆฌ ๊ฐ์ ธ์จ๋ค
- Hashtable AnalogDetecterRepeaterID_Hashtable = new Hashtable();
- //ํ๋ฉด์ GRIDVIEW ๊ฐ ์
๊ด๋ จ ์ค๊ณ๊ธฐ๋ด์ฉ
- GridRepeater[] GRIDCELL = new GridRepeater[127];
- // ์์ฑ์
- public frmRepeaterGroup()
- {
- InitializeComponent();
- // ์ด๋ฒคํธ ํธ๋ค๋ฌ (๋์์ด๋๊ฐ ์๋ ์๋์ผ๋ก ๋ฑ๋ก)
- this.FormClosing += new FormClosingEventHandler(frmRepeaterGroup_FormClosing);
- }
- // cyim 2015.7.6 ๋ ๋ฒจ๊ฐ ๊ฐฑ์ ์ด๋ฒคํธ ์ถ๊ฐ
- public void _Event_AnalogLevel_Update_SendMessage_Event(MDIParent mdi)
- {
- // Repeater_ SettingData ๋ฅผ ํธ์ถ์ ๋ฐ๋์ ํด๋น ๋ณด๋์์ด๋์ ๋ฃจํ๊ฐ ๋ณ๊ฒฝ๋ ๋๋ง ํธ์ถ๋๋ฏ๋ก,
- // ์ง์ ํด์ฌํ
์ด๋ธ์ ๊ฐฑ์ ํ๋๋ก ํ๋ค
- AnalogDetecterRepeaterID_Hashtable = mdi.GetAnalogDetecterRepeaterID(mdi.myReceiverID, savBoardID, savLoop);
- }
- // ์๋ฉธ์
- public void frmRepeaterGroup_FormClosing(object sender, FormClosingEventArgs e)
- {
- // cyim 2015.7.6 ๋ ๋ฒจ๊ฐ ๊ฐฑ์ ์ด๋ฒคํธ ์ถ๊ฐ : ํด์
- mdi.Event.AnalogLevel_Update_SendMessage_Event -= new _Event.AnalogLevel_Update_SendMessage_Handler(_Event_AnalogLevel_Update_SendMessage_Event); // cyim 2015.8.4 ์์ ๋ฐ์ ์ํ static ํด๋์ค ์ ๋ฆฌ
- }
- // ์ด๊ธฐํ
- public void Form_Init()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(Form_Init);
- this.Invoke(d, new object[] { });
- }
- else
- {
- Repeater_SettingData();
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, EventArgs.Empty);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
- }
- }
- bool load = false;
- // ์ด๊ธฐํ
- private void frmRepeaterGroup_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
- {
- this.Cursor = Cursors.WaitCursor;
- mdi = (MDIParent)this.MdiParent;
- txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
- if (BoardGroup_change)
- {
- mdi.temptxtBoardID = txtBoardID.Text;
- mdi.temptxtLoopNo = txtLoopNo.Text;
- BoardGroup_change = false;
- }
- //DacBoardConfig dacBoardConfig = new DacBoardConfig();
- //ArrayList ary = dacBoardConfig.Board_List(mdi.myReceiverID);
- //Util.ComboSetting(cboBoardList, ary, null);
- load = true;
- Repeater_SettingData();
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, EventArgs.Empty);
- this.timer_RepeaterAllInfo_BlockRead.Start();
- // cyim 2015.7.6 ๋ ๋ฒจ๊ฐ ๊ฐฑ์ ์ด๋ฒคํธ ์ถ๊ฐ
- mdi.Event.AnalogLevel_Update_SendMessage_Event += new _Event.AnalogLevel_Update_SendMessage_Handler(_Event_AnalogLevel_Update_SendMessage_Event); // cyim 2015.8.4 ์์ ๋ฐ์ ์ํ static ํด๋์ค ์ ๋ฆฌ
- // cyim 2015.7.23 NACK ์๋ต์ด ์ต๋ 7.2์ด๊ฐ ๋๋ ์ด๋จ, ๋จ ๊ธฐ๋ณธ๊ฐ์ 4์ด
- timer_RepeaterAllInfo_BlockRead_ChangeStart(4000);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void frmRepeaterGroup_Activated(object sender, EventArgs e)
- {
- this.mdi.SelectMenuIndex = 3;
- }
- private void frmRepeaterGroup_Disposed(object sender, EventArgs e)
- {
- this.mdi.SelectMenuIndex = 0;
- }
- // ์ค๊ณ๊ธฐ ์ํ๋ฅผ ์กฐํํ๊ธฐ ์ํ ํต์ ๋ณด๋, ๋ฃจํ๋ฒํธ๋ฅผ ์กฐํํ๋ค (UI ๊ธฐ์ค)
- public void setBoardId(int boardId, int loopNo)
- {
- try
- {
- txtBoardID.Text = String.Format("{0:00}", boardId);
- txtLoopNo.Text = String.Format("{0}", loopNo);
- BoardGroup_change = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //GRID์ ์ค๊ณ๊ธฐ ์ค์ ํ์
- private void Repeater_init()
- {
- // ์ค๊ณ๊ธฐ ์ด๋ฏธ์ง
- //imgListRepeaterBack.Images[0];
- //0 : ์ค๊ณ๊ธฐ ๋น๊ฒ
- //1 : ์ค๊ณ๊ธฐ ์ฐจ๋จ
- //2 : ์ค๊ณ๊ธฐ ์๋ฌ
- //3 : ์ค๊ณ๊ธฐ ์์
- try
- {
- this.dataGridView_Repeater_Main.Columns.Clear();
- DataGridViewCellStyle sty = new DataGridViewCellStyle();
- sty.Alignment = DataGridViewContentAlignment.MiddleCenter;
- for (int col = 0; col < 10; col++)
- {
- DataGridViewImageColumn imageColumn = new DataGridViewImageColumn();
- imageColumn.ImageLayout = DataGridViewImageCellLayout.Normal;
- // ์ฒ์ ๊ธฐ๋ณธ ๋ฐํ์ด๋ฏธ์ง๋ ์ค๊ณ๊ธฐ ๋น๊ฒ์ผ๋ก ๋์ฒด (ํฐ์)
- imageColumn.Image = imgListRepeaterBack.Images[0];
- dataGridView_Repeater_Main.Columns.Add(imageColumn);
- dataGridView_Repeater_Main.Columns[col].ReadOnly = true;
- dataGridView_Repeater_Main.Columns[col].Resizable = DataGridViewTriState.False;
- dataGridView_Repeater_Main.Columns[col].Width = 76;
- dataGridView_Repeater_Main.Columns[col].DefaultCellStyle = sty;
- }
- // 10๊ฐ์ ์
๋ฐํ์ด๋ฏธ์ง๋ ์ค๊ณ๊ธฐ ์์์ผ๋ก ๋์ฒด (ํ์)
- Image[] rowData12 = new Image[10] {
- imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3] , imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3],
- imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3] , imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3]};
- try
- {
- this.dataGridView_Repeater_Main.Rows.Clear();
- DataGridViewRowCollection rows = dataGridView_Repeater_Main.Rows;
- for (int row = 0; row <= 12; row++)
- {
- rows.Add(rowData12);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- // ์
๋จ์๋ก ์ด๋ฏธ์ง๋ฅผ ์
ํ
ํ๋ค
- for (int row = 0; row <= 12; row++)
- {
- for (int col = 1; col <= 10; col++)
- {
- // no ๋ ์ค๊ณ๊ธฐ ์์ด๋
- int no = row * 10 + col;
- if (no <= 127)
- {
- GRIDCELL[no - 1] = new GridRepeater(dataGridView_Repeater_Main.Rows[row].Cells[col - 1], imgListRepeaterBack, no);
- }
- }
- dataGridView_Repeater_Main.Rows[row].Height = 45;
- //REP[no] = new RepeaterDeviceTypeInfo(no);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- throw ex;
- }
- }
- bool ex = false;
- //์ค๊ณ๊ธฐ ์ค์ ๋ฐ์ดํฐ ๊ฐ์ ธ์ค๊ธฐ
- private void Repeater_SettingData()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(Repeater_SettingData);
- this.Invoke(d, new object[] { });
- }
- else
- {
- //if (cboBoardList.Items.Count < 1 || cboLoopList.Items.Count < 1) { Repeater_init(); return; }
- //if (cboBoardList.SelectedItem == null || cboLoopList.SelectedItem == null) { Repeater_init(); return; }
- //String BoardID = cboBoardList.SelectedItem.ToString();
- //String Loop = cboLoopList.SelectedItem.ToString();
- ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo;
- if (load)
- {
- if (mdi.temptxtBoardID != null && mdi.temptxtLoopNo != null)
- {
- int boardid = Convert.ToInt32(mdi.temptxtBoardID);
- int tempboard = boardid - 1;
- int loopid = Convert.ToInt32(mdi.temptxtLoopNo);
- if (Receiverinfo.MyBoardType[tempboard] != null)
- {
- if (Receiverinfo.MyBoardType[tempboard].UseFlag == true)
- {
- switch (loopid)
- {
- case 0:
- {
- if (Receiverinfo.MyBoardType[tempboard].Loop0UseFlag == true)
- {
- if (boardid > 9)
- {
- txtBoardID.Text = boardid.ToString();
- mdi.temptxtBoardID = txtBoardID.Text;
- }
- else
- {
- txtBoardID.Text = "0" + boardid.ToString();
- mdi.temptxtBoardID = boardid.ToString();
- }
- txtLoopNo.Text = "0";
- mdi.temptxtLoopNo = txtLoopNo.Text;
- ex = true;
- break;
- }
- ex = false;
- break;
- }
- case 1:
- {
- if (Receiverinfo.MyBoardType[tempboard].Loop1UseFlag == true)
- {
- if (boardid > 9)
- {
- txtBoardID.Text = boardid.ToString();
- mdi.temptxtBoardID = txtBoardID.Text;
- }
- else
- {
- txtBoardID.Text = "0" + boardid.ToString();
- mdi.temptxtBoardID = boardid.ToString();
- }
- txtLoopNo.Text = "1";
- mdi.temptxtLoopNo = txtLoopNo.Text;
- ex = true;
- break;
- }
- ex = false;
- break;
- }
- case 2:
- {
- if (Receiverinfo.MyBoardType[tempboard].Loop2UseFlag == true)
- {
- if (boardid > 9)
- {
- txtBoardID.Text = boardid.ToString();
- mdi.temptxtBoardID = txtBoardID.Text;
- }
- else
- {
- txtBoardID.Text = "0" + boardid.ToString();
- mdi.temptxtBoardID = boardid.ToString();
- }
- txtLoopNo.Text = "2";
- mdi.temptxtLoopNo = txtLoopNo.Text;
- ex = true;
- break;
- }
- ex = false;
- break;
- }
- case 3:
- {
- if (Receiverinfo.MyBoardType[tempboard].Loop3UseFlag == true)
- {
- if (boardid > 9)
- {
- txtBoardID.Text = boardid.ToString();
- mdi.temptxtBoardID = txtBoardID.Text;
- }
- else
- {
- txtBoardID.Text = "0" + boardid.ToString();
- mdi.temptxtBoardID = boardid.ToString();
- }
- txtLoopNo.Text = "3";
- mdi.temptxtLoopNo = txtLoopNo.Text;
- ex = true;
- break;
- }
- ex = false;
- break;
- }
- }
- }
- }
- }
- if (!ex)
- {
- for (var i = 0; i < Receiverinfo.MyBoardType.Length; i++)
- {
- if (Receiverinfo.MyBoardType[i] != null)
- {
- if (Receiverinfo.MyBoardType[i].UseFlag == true)
- {
- if (Receiverinfo.MyBoardType[i].Loop0UseFlag == true || Receiverinfo.MyBoardType[i].Loop1UseFlag == true || Receiverinfo.MyBoardType[i].Loop2UseFlag == true || Receiverinfo.MyBoardType[i].Loop3UseFlag == true)
- {
- int tempcnt = i + 1;
- if (tempcnt > 9)
- {
- txtBoardID.Text = tempcnt.ToString();
- }
- else
- {
- txtBoardID.Text = "0" + tempcnt.ToString();
- }
- if (Receiverinfo.MyBoardType[i].Loop0UseFlag == true)
- {
- txtLoopNo.Text = "0";
- break;
- }
- else if (Receiverinfo.MyBoardType[i].Loop1UseFlag == true)
- {
- txtLoopNo.Text = "1";
- break;
- }
- else if (Receiverinfo.MyBoardType[i].Loop2UseFlag == true)
- {
- txtLoopNo.Text = "2";
- break;
- }
- else
- {
- txtLoopNo.Text = "3";
- break;
- }
- }
- }
- }
- }
- }
- load = false;
- }
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- if (txtBoardID.Text.Substring(0, 1) == "0")
- {
- mdi.temptxtBoardID = txtBoardID.Text.Substring(1, 1);
- }
- else
- {
- mdi.temptxtBoardID = txtBoardID.Text;
- }
- mdi.temptxtLoopNo = txtLoopNo.Text;
- if (BoardID == savBoardID && Loop == savLoop) return;
- this.Cursor = Cursors.WaitCursor;
- // ์ค๊ณ๊ธฐ ์ํ๋ณด๊ธฐ ์ด๋ฏธ์ง๋ฅผ ์ด๊ธฐํ
- Repeater_init();
- savBoardID = BoardID;
- savLoop = Loop;
- //์์ ๊ธฐ์ค์
- //ํต์ ๋ณด๋ savBoardID ์ loop ์ ์ค์ ๊ฐ
- BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID);
- RepeaterDeviceTypeInfo[] repinfo;
- RepeaterPointUnit[] repdata;
- bool LoopCutFlag = false;
- // cyim 2015.7.2 ํด์ฌํ
์ด๋ธ๋ก ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ๋ ๋ฒจ์ ์์ด๋๋ณ๋ก ์ ์ฅํด๋๋ค
- // ์ฌ์ ์ ๊ฐ์ ธ์จ ๋ฐ์ดํ๋ฒ ์ด์ค ์ ๋ณด๋ฅผ ํ ๋๋ก ํด๋น ๋ณด๋, ๋ฃจํ๋ฅผ ๋ฐ์ ธ ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ์ ๋ณด๋ฅผ ๋ฏธ๋ฆฌ ์์๋ธ๋ค
- // ์ด ๋ ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ๋ผ๋ฉด ๋ ๋ฒจ๊ฐ์ ๋ฐ์ ธ ํ์ฌ ์ํ๋ฅผ ์์๋ด์ผ ํ๋ค
- AnalogDetecterRepeaterID_Hashtable = mdi.GetAnalogDetecterRepeaterID(mdi.myReceiverID, savBoardID, savLoop);
- // cyim 2016.10.31 : ๊ณํต์ ๋ณด๋ 0,1,2,3 ์ผ๋ก ๋ณ๊ฒฝ
- // ํต์ ๋ณด๋์ Loop ์ ๋ณด
- if (savLoop == 0)
- {
- LoopCutFlag = brdinfo.Loop0CutFlag;
- repinfo = brdinfo.Loop0_RepeaterType; //ํต์ ๋ณด๋ + Loop0 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 1)
- {
- LoopCutFlag = brdinfo.Loop1CutFlag;
- repinfo = brdinfo.Loop1_RepeaterType; //ํต์ ๋ณด๋ + Loop1 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 2)
- {
- LoopCutFlag = brdinfo.Loop2CutFlag;
- repinfo = brdinfo.Loop2_RepeaterType; //ํต์ ๋ณด๋ + Loop2 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop2_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 3)
- {
- LoopCutFlag = brdinfo.Loop3CutFlag;
- repinfo = brdinfo.Loop3_RepeaterType; //ํต์ ๋ณด๋ + Loop3 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop3_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else
- {
- LoopCutFlag = brdinfo.Loop0CutFlag;
- repinfo = null;
- repdata = null;
- }
- // ์ฐจ๋จ ์ ๋ณด (๊ณํต)
- if (LoopCutFlag)
- {
- btnRepeaterRecoverCmd.Enabled = false;
- btnRepeaterSearchCmd.Enabled = false;
- btnInWrite.Enabled = false;
- btnOutWrite.Enabled = false;
- this.btnRepeaterReset.Enabled = false; // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- }
- else
- {
- btnRepeaterRecoverCmd.Enabled = true;
- btnRepeaterSearchCmd.Enabled = true;
- btnInWrite.Enabled = true;
- btnOutWrite.Enabled = true;
- this.btnRepeaterReset.Enabled = true; // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- }
- // ๊ฐ ์ค๊ณ๊ธฐ์ ์ ๋ณด
- for (int i = 0; i < repinfo.Length; i++)//2010.11.22, k.s.d , #127 repeater information don't display bug fix. , for (int i = 0; i < repinfo.Length - 1;i++ )
- {
- RepeaterDeviceTypeInfo dev = repinfo[i];
- GRIDCELL[i].LoopCutFlag = LoopCutFlag;
- //if (dev != null)
- //{
- int RepeaterID = i + 1;
- //๊ฐ๋ณ์ค๊ณ๊ธฐ ์ค์ ๊ฐ์ผ๋ก Grid UI ์์ฑ
- GRIDCELL[i].Set_DeviceInfo(dev);
- //๊ฐ๋ณ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ๊ฐ์ผ๋ก Grid UI ์์ฑ - ์ค๊ณ๊ธฐ ํ์
๊ฒฐ์
- GRIDCELL[i].Set_DeviceUnit(repdata[RepeaterID - 1]);
- //}
- }
- // ํ๋จ์ ํ์์์
- //if (LoopCutFlag)
- //{
- // //MessageBox.Show(string.Format("ํด๋น ๊ณํต์ ์ฐจ๋จ์ค์ ์ค์
๋๋ค.. ํต์ ๋ณด๋[{0}] ๊ณํต[{1}] ์ฐจ๋จ์ค์ ํด์ ํ ์ ์ดํ์ญ์์..", savBoardID, savLoop));
- //}
- }
- this.Cursor = Cursors.Default;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 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 dataGridView1_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- if (dataGridView_Repeater_Main.SelectedCells.Count > 0)
- {
- DataGridViewCell cell = this.dataGridView_Repeater_Main.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 (GRIDCELL[no - 1] != null)
- {
- lblInfoMessage.Text = GRIDCELL[no - 1].InfoMessage;
- //dataGridView2์ ๋ฐ์ดํฐ ํ์
- RepeaterDeviceTypeInfo dev = GRIDCELL[no - 1].DeviceInfo;
- RepeaterPointUnit unit = GRIDCELL[no - 1].DeviceUnit;
- DeviceStatus(dev, unit);
- }
- else
- {
- lblRepeaterID.Text = "";
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- // ํ์ฌ ๋ผ์ธ์ด ์ฐจ๋จ๋์๋์ง ์์๋ณด๋ ํจ์
- private bool LoopCut()
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //์์ ๊ธฐ์ค์
- BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(BoardID); //ํต์ ๋ณด๋savBoardID์ loop0์ ์ค์ ๊ฐ
- //RepeaterDeviceTypeInfo[] repinfo;
- //RepeaterPointUnit[] repdata;
- bool LoopCutFlag = false;
- // cyim 2016.10.31 : ๊ณํต์ ๋ณด๋ 0,1,2,3 ์ผ๋ก ๋ณ๊ฒฝ
- if (savLoop == 0)
- {
- LoopCutFlag = brdinfo.Loop0CutFlag;
- //repinfo = brdinfo.Loop0_RepeaterType; //ํต์ ๋ณด๋ + Loop0 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- //repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 1)
- {
- LoopCutFlag = brdinfo.Loop1CutFlag;
- //repinfo = brdinfo.Loop1_RepeaterType; //ํต์ ๋ณด๋ + Loop1 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- //repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 2)
- {
- LoopCutFlag = brdinfo.Loop2CutFlag;
- //repinfo = brdinfo.Loop1_RepeaterType; //ํต์ ๋ณด๋ + Loop2 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- //repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 3)
- {
- LoopCutFlag = brdinfo.Loop3CutFlag;
- //repinfo = brdinfo.Loop1_RepeaterType; //ํต์ ๋ณด๋ + Loop3 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- //repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- return LoopCutFlag;
- }
- //dataGridView2์ ์ค๊ณ๊ธฐ ํ๋ก์ ๋ณด ํ์
- private void DeviceStatus(RepeaterDeviceTypeInfo dt, RepeaterPointUnit unit)
- {
- try
- {
- if (dt != null && dt.UseFlag == true)
- {
- if (dt.RepeaterType.Equals("")
- // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- || LoopCut() == true
- // cyim 2015.2.23 ์ค๊ณ๊ธฐ์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- || dt.CutFlag == true
- )
- {
- btnInWrite.Enabled = false;
- btnOutWrite.Enabled = false;
- btnRepeaterRecoverCmd.Enabled = false;
- btnRepeaterSearchCmd.Enabled = false;
- this.btnRepeaterReset.Enabled = false; // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- }
- //else if (dt.CutFlag
- else
- {
- btnInWrite.Enabled = true;
- btnOutWrite.Enabled = true;
- btnRepeaterRecoverCmd.Enabled = true;
- btnRepeaterSearchCmd.Enabled = true;
- this.btnRepeaterReset.Enabled = true; // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- }
- // ์ฌ์ฉํ๋ ์
(ํฐ์)
- 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;
- // cyim 2015.6.8 ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ์ฐ๋ ์ถ๊ฐ : ํ์
์ ๊ด๊ณ์์ด ๋์ผํ ์คํ์ผ์ด ์ ์ฉ๋๋ค
- for (int col = 0; col < 4; col++)
- {
- dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
- dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
- dataGridView_Repeater_Sub.Columns[col].Width = 70;
- dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
- }
- //if (dt.RepeaterType.Equals("A"))
- //{
- // for (int col = 0; col < 4; col++)
- // {
- // //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn());
- // dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
- // dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
- // dataGridView_Repeater_Sub.Columns[col].Width = 140;
- // dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
- // }
- // //dt.InType3 = "";
- // //dt.InType4 = "";
- // //dt.OutType3 = "";
- // //dt.OutType4 = "";
- // // cyim 2015.6.8 ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ์ฐ๋ ์ถ๊ฐ : ์๋ ์์ค๋ ํ์์์
- // //dataGridView_Repeater_Sub.Columns[2].ReadOnly = true;
- // //dataGridView_Repeater_Sub.Columns[2].Resizable = DataGridViewTriState.False;
- // //dataGridView_Repeater_Sub.Columns[2].Width = 140;
- // //dataGridView_Repeater_Sub.Columns[2].DefaultCellStyle = styGray;
- // //dataGridView_Repeater_Sub.Columns[3].ReadOnly = true;
- // //dataGridView_Repeater_Sub.Columns[3].Resizable = DataGridViewTriState.False;
- // //dataGridView_Repeater_Sub.Columns[3].Width = 140;
- // //dataGridView_Repeater_Sub.Columns[3].DefaultCellStyle = styGray;
- //}
- //else if (dt.RepeaterType.Equals("B"))
- //{
- // for (int col = 0; col < 4; col++)
- // {
- // //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn());
- // dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
- // dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
- // dataGridView_Repeater_Sub.Columns[col].Width = 70;
- // dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
- // }
- //}
- //else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D"))
- //{
- // for (int col = 0; col < 1; col++)
- // {
- // //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn());
- // dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
- // dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
- // dataGridView_Repeater_Sub.Columns[col].Width = 140;
- // dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
- // }
- //}
- //ํ๋ก์
๋ ฅ,์ถ๋ ฅ๊ฐ ํ์
- if (unit != null)
- {
- DataGridViewRowCollection rows2 = this.dataGridView_Repeater_Sub.Rows;
- if (dt != null)
- {
- if (dt.RepeaterType.Equals("A"))
- {
- //sdkim , 2011.11.22. bug fix , 2in2out type repeater - null point exception bug.
- String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1,dt.inDeviceTypeInfos[0]),
- DeviceStatusText.InputText(unit.Repeater_Input2,dt.inDeviceTypeInfos[1]),
- "",
- "" };
- String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1,dt.outDeviceTypeInfos[0]),
- DeviceStatusText.OutputText(unit.Repeater_Output2,dt.outDeviceTypeInfos[1]),
- "",
- "" };
- rows2.Clear();
- rows2.Add(inData);
- rows2.Add(outData);
- }
- else if (dt.RepeaterType.Equals("B"))
- {
- String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1,dt.inDeviceTypeInfos[0]),
- DeviceStatusText.InputText(unit.Repeater_Input2,dt.inDeviceTypeInfos[1]),
- DeviceStatusText.InputText(unit.Repeater_Input3,dt.inDeviceTypeInfos[2]),
- DeviceStatusText.InputText(unit.Repeater_Input4,dt.inDeviceTypeInfos[3]) };
- String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1,dt.outDeviceTypeInfos[0]),
- DeviceStatusText.OutputText(unit.Repeater_Output2,dt.outDeviceTypeInfos[1]),
- DeviceStatusText.OutputText(unit.Repeater_Output3,dt.outDeviceTypeInfos[2]),
- DeviceStatusText.OutputText(unit.Repeater_Output4,dt.outDeviceTypeInfos[3])};
- rows2.Clear();
- rows2.Add(inData);
- rows2.Add(outData);
- }
- // cyim 2015.6.8 ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ์ฐ๋ ์ถ๊ฐ
- else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D"))
- {
- String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1, dt.inDeviceTypeInfos[0]) };
- String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1, dt.outDeviceTypeInfos[0]) };
- rows2.Clear();
- rows2.Add(inData);
- rows2.Add(outData);
- }
- }
- }
- else
- {
- DataGridViewRowCollection rows2 = this.dataGridView_Repeater_Sub.Rows;
- if (dt != null)
- {
- rows2.Clear();
- // cyim 2014.4.3 : ์ด๊ธฐ๊ฐ ์์ 1,2,3,4 -> "-"
- 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);
- }
- // 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
- {
- this.dataGridView_Repeater_Sub.Rows.Clear();
- btnInWrite.Enabled = false;
- btnOutWrite.Enabled = false;
- btnRepeaterRecoverCmd.Enabled = false;
- btnRepeaterSearchCmd.Enabled = false;
- lblRepeaterID.Text = "";
- this.btnRepeaterReset.Enabled = false; // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private Boolean dtCutFlag(DeviceTypeInfo dtInfo)
- {
- bool cutFlag = false;
- try
- {
- if (dtInfo != null) cutFlag = dtInfo.CutFlag;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return cutFlag;
- }
- /*******************************************
- * ์ค๊ณ๊ธฐ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ค๋ ํต์ ๋ถ๋ถ ---์์
- ******************************************/
- private void btnRepeaterAllInfo_Click(object sender, EventArgs e)
- {
- try
- {
- SocketUI ui = this.mdi.ui;
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- if (BoardID == 0)
- {
- this.label_Warning.Text = string.Format("ํต์ ๋ณด๋ID๋ฅผ ์
๋ ฅํ์ฌ ์ฃผ์ญ์์.");
- this.label_Warning.Visible = true;
- txtBoardID.Focus();
- return;
- }
- else
- if (Loop != 0 && Loop != 1 && Loop != 2 && Loop != 3)
- {
- this.label_Warning.Text = string.Format("Loop No๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์
๋ ฅํ์ฌ ์ฃผ์ญ์์.");
- this.label_Warning.Visible = true;
- txtLoopNo.Focus();
- return;
- }
- else
- {
- this.label_Warning.Visible = false;
- }
- button_end(false);//๋ฒํผ ๋นํ์ฑ ์ค์
- dCommandResponse d = new dCommandResponse(RepeaterInfoAll);//์ค๊ณ๊ธฐ ์ ์ฒด ์ฝ๊ธฐ ๋ช
๋ น
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_repeater_all, mdi.myReceiverID, 1, Loop, BoardID, d);//๋ช
๋ น์์ฑ ๋ฐ ์คํ
- ui.runCommand(cmd);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //ํ๋ฉด ๋ง์ฐ์ค ์ปค์ ๋ฐ ๋ฒํผ ๋ค์ ํด๋ฆญ ๋ชปํ๋๋ก ์ค์ ๋ฐ ํด์
- private void button_end(Boolean val)
- {
- try
- {
- if (val)
- {
- this.btnRepeaterAllInfo.Enabled = true;
- this.Cursor = Cursors.Default;
- }
- else
- {
- this.btnRepeaterAllInfo.Enabled = false;
- this.Cursor = Cursors.WaitCursor;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2015.7.23 NACK ์๋ต์ด ์ต๋ 7.2์ด๊ฐ ๋๋ ์ด๋จ, ๋จ ๊ธฐ๋ณธ๊ฐ์ 4์ด
- public void timer_RepeaterAllInfo_BlockRead_ChangeStart(int interval)
- {
- if (timer_RepeaterAllInfo_BlockRead.Interval != interval) // ์ค๊ฐ์ ์ฃผ๊ธฐ๋ฅผ ๋ณ๊ฒฝํ๋ ๊ฒฝ์ฐ์๋ง ํ์ด๋จธ๋ฅผ ์ฌ์์ํ๋ค
- {
- timer_RepeaterAllInfo_BlockRead.Stop();
- timer_RepeaterAllInfo_BlockRead.Interval = interval;
- timer_RepeaterAllInfo_BlockRead.Start();
- }
- }
- //*********************************************************************//
- // ์ค๊ณ๊ธฐ ์ ์ฒด์ฝ๊ธฐ ์๋ต๋ฐ์ดํฐ ์ด๋ฒคํธ //
- //*********************************************************************//
- public void RepeaterInfoAll(CmdInfo cmd)
- {
- try
- {
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadRepeaterPointAll")) // cyim 2015.7.23 NACK ์ฒ๋ฆฌ ๋ถ๋ถ ์ค๋ฅ
- {
- //์๋ฌ์๋ต์ฒ๋ฆฌ
- button_end(true);
- // cyim 2015.7.23 NACK ์๋ต์ด ์ต๋ 7.2์ด๊ฐ ๋๋ ์ด๋จ, ๋จ ๊ธฐ๋ณธ๊ฐ์ 4์ด
- timer_RepeaterAllInfo_BlockRead_ChangeStart(7200);
- return;
- }
- // cyim 2015.7.23 NACK ์๋ต์ด ์ต๋ 7.2์ด๊ฐ ๋๋ ์ด๋จ, ๋จ ๊ธฐ๋ณธ๊ฐ์ 4์ด
- timer_RepeaterAllInfo_BlockRead_ChangeStart(4000);
- 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)
- {
- ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //์์ ๊ธฐ์ค์
- BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID); //ํต์ ๋ณด๋savBoardID์ loop0์ ์ค์ ๊ฐ
- RepeaterDeviceTypeInfo[] repinfo;
- RepeaterPointUnit[] repdata;
- // cyim 2016.10.31 : ๊ณํต์ ๋ณด๋ 0,1,2,3 ์ผ๋ก ๋ณ๊ฒฝ
- if (savLoop == 0)
- {
- repinfo = brdinfo.Loop0_RepeaterType; //ํต์ ๋ณด๋ + Loop0 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 1)
- {
- repinfo = brdinfo.Loop1_RepeaterType; //ํต์ ๋ณด๋ + Loop1 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 2)
- {
- repinfo = brdinfo.Loop2_RepeaterType; //ํต์ ๋ณด๋ + Loop2 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop2_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 3)
- {
- repinfo = brdinfo.Loop3_RepeaterType; //ํต์ ๋ณด๋ + Loop3 + 127๊ฐ ์ค๊ณ๊ธฐ ์ค์ ๊ฐ
- repdata = brdinfo.Loop3_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else
- {
- repinfo = null;
- repdata = null;
- }
- bool dataChanged = false;
- for (int repeaterNo = 0; repeaterNo < data.Length; repeaterNo++)
- {
- if (repinfo[repeaterNo] != null)
- {
- // cyim 2015.6.8 ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ์ฐ๋ ์ถ๊ฐ : ํด๋น ์ค๊ณ๊ธฐ ์์ด๋๊ฐ ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ํ์
์ด๋ค
- if (repinfo[repeaterNo].RepeaterType.Equals("C") || repinfo[repeaterNo].RepeaterType.Equals("D"))
- {
- // cyim 2015.7.2 ํด์ฌํ
์ด๋ธ๋ก ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ๋ ๋ฒจ์ ์์ด๋๋ณ๋ก ์ ์ฅํด๋๋ค
- // ํด๋น ์ค๊ณ๊ธฐ์ ์๋ ๋ก๊ทธ ๋ ๋ฒจ ๊ฐ์ ์์ฑ์๋ก ์ ๋ฌํ๋ค
- AnalogLevel analoglevel = (AnalogLevel)AnalogDetecterRepeaterID_Hashtable[(repeaterNo + 1).ToString()];
- if (GRIDCELL[repeaterNo].Unit == null)
- {
- RepeaterPointUnit newdata = new RepeaterPointUnit(repeaterNo + 1, data[repeaterNo], analoglevel, mdi); // cyim 2015.8.4 ์์ ๋ฐ์ ์ํ static ํด๋์ค ์ ๋ฆฌ
- repdata[repeaterNo] = newdata;
- GRIDCELL[repeaterNo].Set_DeviceUnit(newdata);
- dataChanged = true;
- }
- else if (GRIDCELL[repeaterNo].UpdateDeviceUnit(data[repeaterNo], analoglevel, mdi)) // cyim 2015.8.4 ์์ ๋ฐ์ ์ํ static ํด๋์ค ์ ๋ฆฌ
- {
- dataChanged = true;
- }
- }
- // ์ผ๋ฐ ์ค๊ณ๊ธฐ ํ์
์ด๋ค
- else
- {
- if (GRIDCELL[repeaterNo].Unit == null)
- {
- RepeaterPointUnit newdata = new RepeaterPointUnit(repeaterNo + 1, data[repeaterNo]);
- repdata[repeaterNo] = newdata;
- GRIDCELL[repeaterNo].Set_DeviceUnit(newdata);
- dataChanged = true;
- }
- else if (GRIDCELL[repeaterNo].UpdateDeviceUnit(data[repeaterNo]))
- {
- dataChanged = true;
- }
- }
- }
- }
- if (dataChanged)
- {
- dataGridView1_SelectionChanged(dataGridView_Repeater_Main, System.EventArgs.Empty);//์ ํ๋ ์
์ ๋ฐ์ดํฐ๋ฅผ dataGridView2์ ํ์ํ๋ค..
- }
- }
- }
- button_end(true);//๋ฒํผ ๋นํ์ฑ ํด์
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- //finally
- //{
- // button_end(true);//๋ฒํผ ๋นํ์ฑ ํด์
- //}
- }
- private void btnInputOpen_Click(object sender, EventArgs e)
- {
- try
- {
- 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);
- IWin32Window window = this;
- // cyim 2017.01.12 : ๋ชจ๋ธ์ ๋ฐ๋ผ ์ ํํ ์ ์๋ ํต์ ๋ณด๋๊ฐ ํ๋ฆฌ๋ค
- 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_SettingData();
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); //์ค๊ณ๊ธฐ์ ๋ณด์ฝ๊ธฐ
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnOK_Click(object sender, EventArgs e)
- {
- try
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- if (BoardID == 0)
- {
- this.label_Warning.Text = string.Format("ํต์ ๋ณด๋ID๋ฅผ ์
๋ ฅํ์ฌ ์ฃผ์ญ์์.");
- this.label_Warning.Visible = true;
- //MessageBox.Show("ํต์ ๋ณด๋ID๋ฅผ ์
๋ ฅํ์ฌ ์ฃผ์ญ์์.", Application.ProductName);
- txtBoardID.Focus();
- return;
- }
- else
- if (Loop != 0 && Loop != 1 && Loop != 2 && Loop != 3)
- {
- this.label_Warning.Text = string.Format("Loop No๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์
๋ ฅํ์ฌ ์ฃผ์ญ์์.");
- this.label_Warning.Visible = true;
- //MessageBox.Show("Loop No๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์
๋ ฅํ์ฌ ์ฃผ์ญ์์.", Application.ProductName);
- txtLoopNo.Focus();
- return;
- }
- else
- {
- this.label_Warning.Visible = false;
- }
- Repeater_SettingData();
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- try
- {
- this.Close();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnRepeaterRecoverCmd_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
- if (no <= 127)
- {
- SocketUI ui = this.mdi.ui;
- //์๋ฃ์ด๋ฒคํธ
- dCommandResponse d = new dCommandResponse(RepeaterRecoverComplete);
- //๋ช
๋ น์์ฑ ๋ฐ ์คํ
- CmdInfo cmd = new CmdInfo(prt_cmd_define.reset_repeater_unit, mdi.myReceiverID, 1, Loop, BoardID, no, d);
- ui.runCommand(cmd);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void RepeaterRecoverComplete(CmdInfo cmd)
- {
- try
- {
- //์๋ฌ์๋ต์ฒ๋ฆฌ
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ACK")) // cyim 2015.7.23 NACK ์ฒ๋ฆฌ ๋ถ๋ถ ์ค๋ฅ
- {
- button_end(true);
- return;
- }
- MessageBox.Show("์ค๊ณ๊ธฐ๋ณต๊ตฌ ์๋ฃ");
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); //์ค๊ณ๊ธฐ ์ฝ๊ธฐ ๋ช
๋ น
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //์ ํ์
์ด ๋ฐ๋๋๋ง๋ค ํด๋น์ค๊ณ๊ธฐ ์ค์ ๋ด์ฉ ๋ฐ ๋ฐ์ดํฐ ํ์
- private void dataGridView2_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- txtDeviceTypeName.Text = "";
- txtPositionName.Text = "";
- txtDeviceMemo.Text = "";
- if (dataGridView_Repeater_Main.SelectedCells.Count > 0 && dataGridView_Repeater_Sub.SelectedCells.Count > 0)
- {
- int CommID = 1;
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
- DataGridViewCell repCell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int RepeaterID = (repCell.RowIndex * 10) + repCell.ColumnIndex + 1;
- DataGridViewCell devCell = this.dataGridView_Repeater_Sub.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)
- {
- txtDeviceTypeName.Text = Util.NullToStr(dr2["DEVICE_TYPE_NAME"]);
- txtPositionName.Text = Util.NullToStr(dr2["POSITION_NAME"]);
- txtDeviceMemo.Text = Util.NullToStr(dr2["DEVICE_NAME"]);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //์ค๊ณ๊ธฐ๊ฒ์
- private void btnRepeaterSearchCmd_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
- if (no <= 127)
- {
- SocketUI ui = this.mdi.ui;
- //์๋ฃ์ด๋ฒคํธ
- dCommandResponse d = new dCommandResponse(RepeaterSearchComplete);
- //๋ช
๋ น์์ฑ ๋ฐ ์คํ
- CmdInfo cmd = new CmdInfo(prt_cmd_define.search_repeater_unit, mdi.myReceiverID, 1, Loop, BoardID, no, d);
- ui.runCommand(cmd);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //์ค๊ณ๊ธฐ๊ฒ์์๋ฃ
- public void RepeaterSearchComplete(CmdInfo cmd)
- {
- //์๋ฌ์๋ต์ฒ๋ฆฌ
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_SearchRepeaterUNIT")) // cyim 2015.7.23 NACK ์ฒ๋ฆฌ ๋ถ๋ถ ์ค๋ฅ
- {
- button_end(true);
- return;
- }
- try
- {
- RCVData_SearchRepeaterUNIT unit = (RCVData_SearchRepeaterUNIT)cmd.ResponseData;
- if (unit == null) throw new Exception("์ค๊ณ๊ธฐ ๊ฒ์์ ์คํจํ์์ต๋๋ค. ํต์ ์ํ ๋ฐ ์ค๊ณ๊ธฐ ์ค์ ์ ํ์ธํ์ญ์์.");
- if (unit.Data == null) throw new Exception("์ค๊ณ๊ธฐ ๊ฒ์์ ์คํจํ์์ต๋๋ค. ํต์ ์ํ ๋ฐ ์ค๊ณ๊ธฐ ์ค์ ์ ํ์ธํ์ญ์์.");
- RepeaterData dat = (RepeaterData)unit.Data;
- 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;
- RepeaterPointUnit rep = new RepeaterPointUnit(cmd.repeaterNo, dat);
- GRIDCELL[RepeaterID - 1].Set_DeviceUnit(rep); //๊ฐ๋ณ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ๊ฐ์ผ๋ก Grid UI ์์ฑ
- //๊ฒ์์๋ฃ์ฌ๋ถ
- if (rep.RepeaterS == false)
- {
- MessageBox.Show(string.Format("์ค๊ณ๊ธฐ๊ฒ์ ์๋ฃ. ์ค๊ณ๊ธฐ๋ฒํธ:{0}", RepeaterID));
- }
- else
- {
- MessageBox.Show(string.Format("์ค๊ณ๊ธฐ๊ฒ์ ์คํจ. ์ค๊ณ๊ธฐ๋ฒํธ:{0}", RepeaterID));
- }
- btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); //์ค๊ณ๊ธฐ ์ฝ๊ธฐ ๋ช
๋ น
- }
- }
- 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 btnInWrite_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
- if (no <= 127)
- {
- SocketUI ui = this.mdi.ui;
- //ํ๋ก
- RepeaterPointUnit unit = GRIDCELL[no - 1].DeviceUnit;
- RepeaterDeviceTypeInfo Info = GRIDCELL[no - 1].DeviceInfo;
- if (Info == null || unit == null)
- {
- MessageBox.Show("ํ๋ก์ค์ ๋ฐ ๋ฐ์ดํฐ๋ฅผ ์ฝ์์ ์์ต๋๋ค..ํต์ ์ํ๋ฅผ ํ์ธํ์ญ์์..", Application.ProductName);
- return;
- }
- if (MessageBox.Show("TEST์ฉ ํ๋ก๋ง ์
๋ ฅ์ฐ๊ธฐ๊ฐ ๊ฐ๋ฅํฉ๋๋ค..๊ทธ๋๋ ์
๋ ฅ์ฐ๊ธฐ๋ฅผ ํ์๊ฒ ์ต๋๊น?", Application.ProductName, MessageBoxButtons.OKCancel)
- == DialogResult.OK)
- {
- //int deviceNo = cell2.ColumnIndex + 1;
- 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 = no;
- vo.RepeaterType = Info.RepeaterType;
- vo.InoutType = "I";
- InputDeviceStatus[] devData = new InputDeviceStatus[4]{ unit.Repeater_Input1
- ,unit.Repeater_Input2
- ,unit.Repeater_Input3
- ,unit.Repeater_Input4};
- vo.InputUnitData = devData;
- IWin32Window window = this;
- frmModalUnitDataSelect frm = new frmModalUnitDataSelect(Info); // cyim 2015.2.23 ํ๋ก์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- frm.InputVo = vo;
- frm.ShowDialog(window);
- vo = frm.InputVo;
- //์
๋ ฅํ ์ฝ๋๊ฐ ์๋ค๋ฉด
- if (vo.InputOK)
- {
- devData = vo.InputUnitData;
- //ํ๋ก
- RepeaterData inputdata = new RepeaterData((byte)vo.RepeaterID);
- inputdata.Set_Input_Data((int)devData[3], (int)devData[2], (int)devData[1], (int)devData[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;
- ui.runCommand(cmd);
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), 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;
- //๊ฐ ์
์ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ ํ์
- GRIDCELL[RepeaterID - 1].Set_DeviceUnit(newdata);
- //dataGridView2์ ๋ฐ์ดํฐ ํ์
- RepeaterDeviceTypeInfo dev = GRIDCELL[RepeaterID - 1].DeviceInfo;
- RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
- DeviceStatus(dev, unit);
- }
- }
- 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);
- }
- }
- // cyim 2016.10.31 : ๊ณํต์ ๋ณด๋ 0,1,2,3 ์ผ๋ก ๋ณ๊ฒฝ
- //์ค๊ณ๊ธฐ ์ถ๋ ฅ์ฐ๊ธฐ ์๋ฃ
- 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 if (savLoop == 1)
- {
- repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 2)
- {
- repdata = brdinfo.Loop2_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else if (savLoop == 3)
- {
- repdata = brdinfo.Loop3_RepeaterUnit_Data; //127๊ฐ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ
- }
- else
- {
- repdata = null;
- }
- repdata[RepeaterID - 1] = newdata;
- //๊ฐ ์
์ ์ค๊ณ๊ธฐ ๋ฐ์ดํฐ ํ์
- GRIDCELL[RepeaterID - 1].Set_DeviceUnit(newdata);
- //dataGridView2์ ๋ฐ์ดํฐ ํ์
- RepeaterDeviceTypeInfo dev = GRIDCELL[RepeaterID - 1].DeviceInfo;
- RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
- DeviceStatus(dev, unit);
- 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)
- {
- try
- {
- if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
- {
- // ์์์ ํต์ ๋ณด๋ ์์ด๋์ ์ฑ๋๊ณํต ์ ๋ณด๋ฅผ ๊ฐ์ ธ์จ๋ค
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- // ์ค๊ณ๊ธฐ ์ธ๋ฑ์ค
- DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
- if (no <= 127)
- {
- SocketUI ui = this.mdi.ui;
- //
- // ํ๋ก ์ ๋ณด
- //
- RepeaterPointUnit unit = GRIDCELL[no - 1].DeviceUnit;
- RepeaterDeviceTypeInfo Info = GRIDCELL[no - 1].DeviceInfo;
- if (Info == null || unit == null)
- {
- MessageBox.Show("ํ๋ก์ค์ ๋ฐ ๋ฐ์ดํฐ๋ฅผ ์ฝ์์ ์์ต๋๋ค", Application.ProductName);
- return;
- }
- // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- if (LoopCut() == true
- // cyim 2015.2.23 ์ค๊ณ๊ธฐ์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- || Info.CutFlag == true)
- {
- MessageBox.Show("์ฐจ๋จ์ค์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค", Application.ProductName);
- return;
- }
- // cyim 2015.2.24 ํต์ ์๋ฌ๋ ์ฐ๊ธฐ ๊ธ์ง
- if (unit.RepeaterErr == true)
- {
- MessageBox.Show("ํต์ ์๋ฌ์ค์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค", Application.ProductName);
- return;
- }
- //
- // ์ถ๋ ฅ ํ๋ก ๊ฐ ์ฐ๊ธฐ
- //
- if (MessageBox.Show("์ค์ ๋ก ํ์ฌ ๋ฐ ์ค๋น ์ฐ๋๊ฐ์ง๊ฐ ๋ ์ ์์ต๋๋ค. ๊ทธ๋๋ ์ถ๋ ฅ์ฐ๊ธฐ๋ฅผ ํ์๊ฒ ์ต๋๊น?", Application.ProductName, MessageBoxButtons.OKCancel)
- == DialogResult.OK)
- {
- //
- // ํ๋ก ์ ๋ณด๋ฅผ ๋ด๋ ํด๋์ค
- //
- 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 = no;
- vo.RepeaterType = Info.RepeaterType;
- vo.InoutType = "O";
- //
- // ์ถ๋ ฅ๋๋ฐ์ด์ค ์ํ (InputIDVo ์ ์ฉ)
- //
- //์ถ๋ ฅํ๋ก์ํ๊ฐ ์ด๊ธฐ์ํ(-1),์ถ๋ ฅ์์(0),์ถ๋ ฅ์์(1),์ฐจ๋จ(3)
- //public enum OutputDeviceStatus { Init = -1, NotWrite = 0, Write = 1, Blocking = 3 }
- OutputDeviceStatus[] devData = new OutputDeviceStatus[4]{
- unit.Repeater_Output1 // NotWrite
- ,unit.Repeater_Output2 // NotWrite
- ,unit.Repeater_Output3 // NotWrite
- ,unit.Repeater_Output4};// NotWrite
- // ์ถ๋ ฅ๋๋ฐ์ด์ค ์ํ ์ถ๊ฐ
- vo.OutputUnitData = devData;
- //
- // ๋ชจ๋ฌ๋ํ์์๋ฅผ ์ถ๋ ฅ
- //
- IWin32Window window = this;
- frmModalUnitDataSelect frm = new frmModalUnitDataSelect(Info); // cyim 2015.2.23 ํ๋ก์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- frm.InputVo = vo;
- frm.ShowDialog(window);
- vo = frm.InputVo; // ๋ค์ด์ผ๋ก๊ทธ ์ถ๋ ฅ์ดํ ์ํ๋ ํ๋ก๊ฐ์ด ์์ดํจ
- // ํ์ธ ๋ฒํผ์ ๋๋ฆ (์
๋ ฅํ ์ฝ๋๊ฐ ์๋ค๋ฉด)
- if (vo.InputOK)
- {
- // cyim 2013.9.3 ์ถ๋ ฅ์ฐ๊ธฐ ์๋์ ํ
์คํธ ๋ชจ๋๋ก ์ง์
- this.mdi.SetInputTestMode(true);
- // cyim 2015.2.27 ์ถ๋ ฅ ์ฐ๊ธฐ ์ฌ์ฉ์ค
- mdi.CommandLog(MappingStatus.Log, string.Format("์ถ๋ ฅํ
์คํธ ์คํ CommID:{0},LoopNo:{1},BoardID:{2},RepeaterID:{3},devID:{4}-{5}-{6}-{7}",
- vo.CommID, vo.LoopNo, vo.BoardID, vo.RepeaterID, vo.OutputUnitData[0], vo.OutputUnitData[1], vo.OutputUnitData[2], vo.OutputUnitData[3]));
- // ์ค๊ณ๊ธฐ ๋ฐ์ดํ
- RepeaterData outputdata = new RepeaterData((byte)vo.RepeaterID);
- devData = vo.OutputUnitData;
- outputdata.Set_Output_Data(
- devData[3] == OutputDeviceStatus.Blocking ? true : false
- , devData[2] == OutputDeviceStatus.Blocking ? true : false
- , devData[1] == OutputDeviceStatus.Blocking ? true : false
- , devData[0] == OutputDeviceStatus.Blocking ? true : false
- , devData[3] == OutputDeviceStatus.Write ? true : false
- , devData[2] == OutputDeviceStatus.Write ? true : false
- , devData[1] == OutputDeviceStatus.Write ? true : false
- , devData[0] == OutputDeviceStatus.Write ? true : false
- );
- //์๋ฃ์ด๋ฒคํธ
- dCommandResponse d = new dCommandResponse(RepeaterOutputWriteComplete);
- //๋ช
๋ น์์ฑ ๋ฐ ์คํ
- CmdInfo cmd = new CmdInfo(
- prt_cmd_define.write_repeater_output_unit,
- mdi.myReceiverID, // ์์ ๊ธฐ ์์ด๋
- 1, // CommID (1-ํต์ ๋ณด๋ 3-IO๋ณด๋ 4-KEYPAD 5-๋น์๋ฐฉ์ก)
- vo.LoopNo, //์ฑ๋๊ณํต
- vo.BoardID, // ํต์ ๋ณด๋
- vo.RepeaterID, // ์ค๊ณ๊ธฐ ์์ด๋
- d); // ์๋ฃ์ด๋ฒคํธ
- cmd.CommandData = outputdata;
- 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(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- this.btnRepeaterAllInfo_Click(null, null);
- }
- // ๋๋ธ ํด๋ฆญ์ ์
๋ ฅ ๊ฐ์ ํ
์คํธ ์คํ
- private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- // ์
๋ ฅ์ ํธ ์ค 1๊ฐ ์ ํ์์๋ง ๋์
- if (this.dataGridView_Repeater_Sub.SelectedCells.Count == 1)
- {
- DataGridViewCell cell = this.dataGridView_Repeater_Sub.SelectedCells[0];
- // ์
๋ ฅ ํ๋ก ์ ํ์
- if (cell.RowIndex == 0)
- {
- // ์๋จ์ ๊ณํต๊ฒ์ UI
- int CommID = 1;
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
- // ์๋จ์ ์ค๊ณ๊ธฐ UI
- DataGridViewCell repCell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int RepeaterID = (repCell.RowIndex * 10) + repCell.ColumnIndex + 1;
- int devID = cell.ColumnIndex + 1;
- // cyim 2015.7.6 ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ๋ ์
๋ ฅํ
์คํธ ๋ถ๊ฐ
- if (AnalogDetecterRepeaterID_Hashtable.ContainsKey(RepeaterID.ToString()) == true)
- {
- MessageBox.Show("์ค๊ณ๊ธฐ ํ์
2*2 ํน์ 4*4 ๋ง ๊ฐ๋ฅํฉ๋๋ค", Application.ProductName);
- return;
- }
- // cyim 2014.4.3 ์
๋ ฅ ๊ฐ์ ์ํ์์ ํ๋ก์ ๋ณด๊ฐ ์๋์ง ํ์ธ
- //
- // ํ๋ก ์ ๋ณด
- //
- RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
- RepeaterDeviceTypeInfo Info = GRIDCELL[RepeaterID - 1].DeviceInfo;
- if (Info == null || unit == null)
- {
- MessageBox.Show("ํ๋ก์ค์ ๋ฐ ๋ฐ์ดํฐ๋ฅผ ์ฝ์์ ์์ต๋๋ค", Application.ProductName);
- return;
- }
- // cyim 2015.2.23 ํ๋ก์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- if (Info.inDeviceTypeInfos[devID - 1].CutFlag == true
- // cyim 2015.2.23 ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- || LoopCut() == true
- // cyim 2015.2.23 ์ค๊ณ๊ธฐ์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- || Info.CutFlag == true)
- {
- MessageBox.Show("์ฐจ๋จ์ค์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค", Application.ProductName);
- return;
- }
- //if (MessageBox.Show(string.Format("cell = {0} {1} {2} {3} {4}", CommID, BoardID, LoopNo, RepeaterID, devID), "", MessageBoxButtons.OKCancel) == DialogResult.OK) {
- if (MessageBox.Show(string.Format("์
๋ ฅ ๊ฐ์ ์ํ์ ํ๊ฒ ์ต๋๊น? ์ถ๋ ฅ ์ฐ๋์ด ๋ ์ ์์ต๋๋ค"), "์
๋ ฅ ์ํ", MessageBoxButtons.OKCancel) == DialogResult.OK)
- {
- this.mdi.SetInputTestMode(true);
- SocketUI ui = mdi.ui;
- //๋ช
๋ น์์ฑ ๋ฐ ์คํ
- //์ค๊ณ๊ธฐ ์ค์ ๋ฐ์ดํฐ๋ฅผ CmdInfo์ ๋ฃ์ด์ค๋ค..
- CmdInfo cmd = new CmdInfo(
- prt_cmd_define.write_repeater_input_unit,
- mdi.myReceiverID,
- CommID,
- LoopNo,
- BoardID,
- RepeaterID,
- null);
- // cyim 2015.2.27 ์
๋ ฅ ์ฐ๊ธฐ ํ
์คํธ ๋ชจ๋ ์ฌ์ฉ์ค
- mdi.CommandLog(MappingStatus.Log, string.Format("์
๋ ฅํ
์คํธ ์คํ CommID:{0},LoopNo:{1},BoardID:{2},RepeaterID:{3},devID:{4}", CommID, LoopNo, BoardID, RepeaterID, devID));
- switch (devID)
- {
- case 1:
- {
- cmd.CommandData = (byte)0xFC;
- break;
- }
- case 2:
- {
- cmd.CommandData = (byte)0xF3;
- break;
- }
- case 3:
- {
- cmd.CommandData = (byte)0xCF;
- break;
- }
- case 4:
- {
- cmd.CommandData = (byte)0x3F;
- break;
- }
- }
- ui.runCommand(cmd);
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2013.3.13
- // ์
๋ ฅ์ฐ๊ธฐ ํ
์คํธ ์ดํ ๋ณต๊ตฌ ๋ฒํผ์ ๋๋ฌ์ ์ค๊ณ๊ธฐ ๋ณ๋ก ๋ณต๊ตฌํ๋๋ก ๋ช
๋ นํ๋ค
- // ์ค๊ณ๊ธฐ ๋ณต๊ตฌ
- private void btnRepeaterReset_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
- {
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
- if (no <= 127)
- {
- //2019-12-10 ์์ QAํํธ ์์ฒญ
- //if (MessageBox.Show(string.Format("์ค๊ณ๊ธฐ [" + no + "] ๋ฅผ ๋ณต๊ตฌํ ๊น์?"), "์ค๊ณ๊ธฐ ๋ณต๊ตฌ", MessageBoxButtons.OKCancel) == DialogResult.OK)
- if (MessageBox.Show(string.Format(Loop + "๋ฒ Loop๋ฅผ ๋ณต๊ตฌํ ๊น์?"), "์ค๊ณ๊ธฐ ๋ณต๊ตฌ", MessageBoxButtons.OKCancel) == DialogResult.OK)
- {
- // MDIParent
- LFC.Log("ํ์
: ์์ ๊ธฐ ์กฐ์ ๋ก๊ทธ, ๋ฉ์ธ์ง: ์ค๊ณ๊ธฐ ๊ฐ๋ณ๋ณต๊ตฌ ์คํ");
- SocketUI ui = this.mdi.ui;
- //์๋ฃ์ด๋ฒคํธ (์ฌ์ฉ๋์ด์ผ ํ ์ง๋ ๋ฏธ์ง์)
- dCommandResponse d = new dCommandResponse(RepeaterRecoverComplete);
- //๋ช
๋ น์์ฑ ๋ฐ ์คํ
- CmdInfo cmd = new CmdInfo(
- prt_cmd_define.reset_repeater_all, // ์ค๊ณ๊ธฐ Block ๋ณต๊ตฌ
- mdi.myReceiverID,
- 1, // ์ปดํฌํธ ์์ด๋
- Loop, // ์ฑ๋๊ณํต
- BoardID, // ํต์ ๋ณด๋
- no, // ์ค๊ณ๊ธฐ ์์ด๋
- null);
- 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);
- }
- }
- // cyim 2015.6.8 ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ์ฐ๋ ์ถ๊ฐ
- // ์ค๊ณ๊ธฐ ์ํ๋ณด๊ธฐ ๋ฉ์ธ - ์
์ ๋๋ธ ํด๋ฆญํ๋ ๊ฒฝ์ฐ
- private void dataGridView_Repeater_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
- {
- //int CommID = 1;
- // ๋ณด๋ ์์ด๋
- int BoardID = Util.StrToInt(txtBoardID.Text, 0);
- // ๋ฃจํ ๋ฒํธ
- int Loop = Util.StrToInt(txtLoopNo.Text, -1);
- // ์ค๊ณ๊ธฐ ์์ด๋
- DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
- int RepeaterID = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
- RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
- RepeaterDeviceTypeInfo Info = GRIDCELL[RepeaterID - 1].DeviceInfo;
- if (Info == null || unit == null)
- {
- MessageBox.Show("ํ๋ก์ค์ ๋ฐ ๋ฐ์ดํฐ๋ฅผ ์ฝ์์ ์์ต๋๋ค..", Application.ProductName);
- return;
- }
- // ๊ณํต์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- if (LoopCut() == true
- // ์ค๊ณ๊ธฐ์ฐจ๋จ์์๋ ์ฌ์ฉ๋ถ๊ฐ
- || Info.CutFlag == true)
- {
- MessageBox.Show("์ฐจ๋จ์ค์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค..", Application.ProductName);
- return;
- }
- // ์ฐฝ์ ํ๋๋ง ๋์ฐ๋๋ก ํจ
- if (mdi.AnalogDetect.Form_Active_AnalogDetecter == true) // cyim 2015.8.4 ์์ ๋ฐ์ ์ํ static ํด๋์ค ์ ๋ฆฌ
- {
- MessageBox.Show("์ด๋ฏธ ์คํ์ค์
๋๋ค...", Application.ProductName);
- return;
- }
- /*
- if (FormRepeater != null)
- {
- FormRepeater.Close();
- }
- FormRepeater = new FormRepeater(this.mdi);
- FormRepeater.Owner = this;
- FormRepeater.Visible = false;
- FormRepeater.Show();// ๋ฐ์ดํ๋ฅผ ์์ง ํ์ํ์ง ์์์ผ๋ฏ๋ก ํ์๋ ํ์ง ์๋๋ค.
- FormRepeater.Visible = false;
- string[] Input_locatin = new string[4];
- string[] output_locatin = new string[4];
- string[] Input_context = new string[4];
- string[] output_context = new string[4];
- string[] Input_circuit = new string[4];
- string[] output_circuit = new string[4];
- string InOut_Type = "I";
- //ํ๋ก์ค์ ๊ฐ
- DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID); // cyim 2015.7.30 ๋ฐ์ดํ๋ฒ ์ด์ค ์ ์ ๋ฃจํด ๋ณ๊ฒฝ
- for (var i = 0; i < 4; i++)
- {
- DataTable dt2 = dacUIProcess.Device_Select(mdi.myReceiverID, CommID, BoardID, Loop, RepeaterID, i + 1, InOut_Type);
- foreach (DataRow dr2 in dt2.Rows)
- {
- Input_context[i] = Util.NullToStr(dr2["DEVICE_TYPE_NAME"]);
- Input_locatin[i] = Util.NullToStr(dr2["POSITION_NAME"]);
- Input_circuit[i] = Util.NullToStr(dr2["DEVICE_NAME"]);
- }
- dt2.Clear();
- dt2.Dispose();
- }
- InOut_Type = "O";
- for (var i = 0; i < 4; i++)
- {
- DataTable dt2 = dacUIProcess.Device_Select(mdi.myReceiverID, CommID, BoardID, Loop, RepeaterID, i + 1, InOut_Type);
- foreach (DataRow dr2 in dt2.Rows)
- {
- output_context[i] = Util.NullToStr(dr2["DEVICE_TYPE_NAME"]);
- output_locatin[i] = Util.NullToStr(dr2["POSITION_NAME"]);
- output_circuit[i] = Util.NullToStr(dr2["DEVICE_NAME"]);
- }
- dt2.Clear();
- dt2.Dispose();
- }
- // ์
๋ ฅ
- FormRepeater.SetInputContext1(string.Format(
- "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input1, Info.inDeviceTypeInfos[0]) +
- "\r\n\r\n" + Input_context[0] +
- "\r\n\r\n" + Input_locatin[0] +
- "\r\n\r\n" + Input_circuit[0]));
- FormRepeater.SetInputContext2(string.Format(
- "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input2, Info.inDeviceTypeInfos[1]) +
- "\r\n\r\n" + Input_context[1] +
- "\r\n\r\n" + Input_locatin[1] +
- "\r\n\r\n" + Input_circuit[1]));
- FormRepeater.SetInputContext3(string.Format(
- "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input3, Info.inDeviceTypeInfos[2]) +
- "\r\n\r\n" + Input_context[2] +
- "\r\n\r\n" + Input_locatin[2] +
- "\r\n\r\n" + Input_circuit[2]));
- FormRepeater.SetInputContext4(string.Format(
- "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input4, Info.inDeviceTypeInfos[3]) +
- "\r\n\r\n" + Input_context[3] +
- "\r\n\r\n" + Input_locatin[3] +
- "\r\n\r\n" + Input_circuit[3]));
- // ์ถ๋ ฅํ๋ก
- FormRepeater.SetOutPutText1(string.Format(
- "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output1, Info.outDeviceTypeInfos[0]) +
- "\r\n\r\n" + output_context[0] +
- "\r\n\r\n" + output_locatin[0] +
- "\r\n\r\n" + output_circuit[0]));
- FormRepeater.SetOutPutText2(string.Format(
- "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output2, Info.outDeviceTypeInfos[1]) +
- "\r\n\r\n" + output_context[1] +
- "\r\n\r\n" + output_locatin[1] +
- "\r\n\r\n" + output_circuit[1]));
- FormRepeater.SetOutPutText3(string.Format(
- "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output3, Info.outDeviceTypeInfos[2]) +
- "\r\n\r\n" + output_context[2] +
- "\r\n\r\n" + output_locatin[2] +
- "\r\n\r\n" + output_circuit[2]));
- FormRepeater.SetOutPutText4(string.Format(
- "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output4, Info.outDeviceTypeInfos[3]) +
- "\r\n\r\n" + output_context[3] +
- "\r\n\r\n" + output_locatin[3] +
- "\r\n\r\n" + output_circuit[3]));
- // ์์น
- FormRepeater.Location = new Point(Control.MousePosition.X + 5, Control.MousePosition.Y + 5);
- //ํ์
- FormRepeater.Visible = true;
- */
- // ํด๋น ์
์ด ์ค๊ณ๊ธฐ๊ฐ ์๋ ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ์ธ ๊ฒฝ์ฐ์ ํํ์ฌ
- if (Info.RepeaterType.Equals("A") == true || Info.RepeaterType.Equals("B") == true)
- {
- // ํน๋ณํ ๊ฒฝ๊ณ ํ์
์ ์์ฑํ์ง ์๋๋ค
- return;
- }
- // cyim 2016.01.07 ์๋ ๋ก๊ทธ ๊ฐ์ง๊ธฐ ํต์ ์ด์, ์กด์ฌํ์ง์์์ ๊ฒฝ์ฐ์๋ ๋๋ธํด๋ฆญ์ ๋ชปํ๋๋ก ํจ
- if (unit.RepeaterNon == true // ์กด์ฌํ์ง ์๋ ๊ฐ์ง๊ธฐ
- || unit.RepeaterErr == true // ๊ฐ์ง๊ธฐ ํต์ ์๋ฌ
- || unit.RepeaterErr == true // ๊ฐ์ง๊ธฐ ์ ์ ์ด์
- )
- {
- // ํน๋ณํ ๊ฒฝ๊ณ ํ์
์ ์์ฑํ์ง ์๋๋ค
- return;
- }
- mdi = (MDIParent)this.MdiParent;
- txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
- Form_AnalogDetecter AnalogDetecter = new Form_AnalogDetecter(
- string.Format("{0:00}", mdi.myReceiverID),
- string.Format("{0:000}", BoardID),
- string.Format("{0:000}", Loop),
- string.Format("{0:000}", RepeaterID),
- Info.RepeaterType.ToString(),
- mdi);
- AnalogDetecter.Show();
- }
- }
- }
- }
|