10cbb1f7b5f5d0749fadc79dcbdf09a8c7fcaa76.svn-base 94 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017
  1. ๏ปฟusing System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Diagnostics;
  9. using System.Collections;
  10. using System.Threading;
  11. namespace FPER
  12. {
  13. public partial class frmRepeaterGroup : Form
  14. {
  15. int savBoardID = -1;
  16. int savLoop = -1;
  17. bool BoardGroup_change;
  18. MDIParent mdi;
  19. //FormRepeater FormRepeater = null;
  20. delegate void deleFormInit();
  21. LogFileCreate LFC = new LogFileCreate();
  22. //์ค‘๊ณ„๊ธฐ ์ฝ๊ธฐ๋ฅผ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด
  23. private Thread tRepeaterReadThread;
  24. private int tRepeaterReadThreadStatus = 0;
  25. // cyim 2015.7.2 ํ•ด์‰ฌํ…Œ์ด๋ธ”๋กœ ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ๋ ˆ๋ฒจ์„ ์•„์ด๋””๋ณ„๋กœ ์ €์žฅํ•ด๋‘”๋‹ค
  26. // ํ™”๋ฉด์—์„œ ๋ณด์ด๋Š” ๋ณด๋“œ,๋ฃจํ”„๋ฒˆํ˜ธ์— ํ•ด๋‹นํ•˜๋Š” ์•„๋‚ ๋กœ๊ทธ๊ฐ์ง€๊ธฐ ๋ ˆ๋ฒจ๊ฐ’ ์ •๋ณด๋ฅผ ๋ฏธ๋ฆฌ ๊ฐ€์ ธ์˜จ๋‹ค
  27. Hashtable AnalogDetecterRepeaterID_Hashtable = new Hashtable();
  28. //ํ™”๋ฉด์˜ GRIDVIEW ๊ฐ ์…€๊ด€๋ จ ์ค‘๊ณ„๊ธฐ๋‚ด์šฉ
  29. GridRepeater[] GRIDCELL = new GridRepeater[127];
  30. // ์ƒ์„ฑ์ž
  31. public frmRepeaterGroup()
  32. {
  33. InitializeComponent();
  34. // ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ (๋””์ž์ด๋„ˆ๊ฐ€ ์•„๋‹Œ ์ˆ˜๋™์œผ๋กœ ๋“ฑ๋ก)
  35. this.FormClosing += new FormClosingEventHandler(frmRepeaterGroup_FormClosing);
  36. }
  37. // cyim 2015.7.6 ๋ ˆ๋ฒจ๊ฐ’ ๊ฐฑ์‹  ์ด๋ฒคํŠธ ์ถ”๊ฐ€
  38. public void _Event_AnalogLevel_Update_SendMessage_Event(MDIParent mdi)
  39. {
  40. // Repeater_ SettingData ๋ฅผ ํ˜ธ์ถœ์€ ๋ฐ˜๋“œ์‹œ ํ•ด๋‹น ๋ณด๋“œ์•„์ด๋””์™€ ๋ฃจํ”„๊ฐ€ ๋ณ€๊ฒฝ๋ ๋•Œ๋งŒ ํ˜ธ์ถœ๋˜๋ฏ€๋กœ,
  41. // ์ง์ ‘ ํ•ด์‰ฌํ…Œ์ด๋ธ”์„ ๊ฐฑ์‹ ํ•˜๋„๋ก ํ•œ๋‹ค
  42. AnalogDetecterRepeaterID_Hashtable = mdi.GetAnalogDetecterRepeaterID(mdi.myReceiverID, savBoardID, savLoop);
  43. }
  44. // ์†Œ๋ฉธ์ž
  45. public void frmRepeaterGroup_FormClosing(object sender, FormClosingEventArgs e)
  46. {
  47. // cyim 2015.7.6 ๋ ˆ๋ฒจ๊ฐ’ ๊ฐฑ์‹  ์ด๋ฒคํŠธ ์ถ”๊ฐ€ : ํ•ด์ œ
  48. mdi.Event.AnalogLevel_Update_SendMessage_Event -= new _Event.AnalogLevel_Update_SendMessage_Handler(_Event_AnalogLevel_Update_SendMessage_Event); // cyim 2015.8.4 ์ˆ˜์‹ ๋ฐ˜์„ ์œ„ํ•œ static ํด๋ž˜์Šค ์ •๋ฆฌ
  49. }
  50. // ์ดˆ๊ธฐํ™”
  51. public void Form_Init()
  52. {
  53. try
  54. {
  55. if (this.InvokeRequired)
  56. {
  57. deleFormInit d = new deleFormInit(Form_Init);
  58. this.Invoke(d, new object[] { });
  59. }
  60. else
  61. {
  62. Repeater_SettingData();
  63. btnRepeaterAllInfo_Click(btnRepeaterAllInfo, EventArgs.Empty);
  64. }
  65. }
  66. catch (Exception ex)
  67. {
  68. Util.UErrorMessage(ex, 0, 0);
  69. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  70. }
  71. }
  72. bool load = false;
  73. // ์ดˆ๊ธฐํ™”
  74. private void frmRepeaterGroup_Load(object sender, EventArgs e)
  75. {
  76. // cyim 2013.8.1 : ๋”๋ธ”๋ฒ„ํผ๋ง ์ ์šฉ
  77. SetStyle(ControlStyles.UserPaint, true);
  78. //this.UpdateStyles();
  79. SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  80. //this.UpdateStyles();
  81. SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
  82. this.UpdateStyles();
  83. try
  84. {
  85. this.Cursor = Cursors.WaitCursor;
  86. mdi = (MDIParent)this.MdiParent;
  87. txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
  88. if (BoardGroup_change)
  89. {
  90. mdi.temptxtBoardID = txtBoardID.Text;
  91. mdi.temptxtLoopNo = txtLoopNo.Text;
  92. BoardGroup_change = false;
  93. }
  94. //DacBoardConfig dacBoardConfig = new DacBoardConfig();
  95. //ArrayList ary = dacBoardConfig.Board_List(mdi.myReceiverID);
  96. //Util.ComboSetting(cboBoardList, ary, null);
  97. load = true;
  98. Repeater_SettingData();
  99. btnRepeaterAllInfo_Click(btnRepeaterAllInfo, EventArgs.Empty);
  100. this.timer_RepeaterAllInfo_BlockRead.Start();
  101. // cyim 2015.7.6 ๋ ˆ๋ฒจ๊ฐ’ ๊ฐฑ์‹  ์ด๋ฒคํŠธ ์ถ”๊ฐ€
  102. mdi.Event.AnalogLevel_Update_SendMessage_Event += new _Event.AnalogLevel_Update_SendMessage_Handler(_Event_AnalogLevel_Update_SendMessage_Event); // cyim 2015.8.4 ์ˆ˜์‹ ๋ฐ˜์„ ์œ„ํ•œ static ํด๋ž˜์Šค ์ •๋ฆฌ
  103. // cyim 2015.7.23 NACK ์‘๋‹ต์ด ์ตœ๋Œ€ 7.2์ดˆ๊ฐ€ ๋”œ๋ ˆ์ด๋จ, ๋‹จ ๊ธฐ๋ณธ๊ฐ’์€ 4์ดˆ
  104. timer_RepeaterAllInfo_BlockRead_ChangeStart(4000);
  105. }
  106. catch (Exception ex)
  107. {
  108. Util.UErrorMessage(ex, 0, 0);
  109. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  110. }
  111. finally
  112. {
  113. this.Cursor = Cursors.Default;
  114. }
  115. }
  116. private void frmRepeaterGroup_Activated(object sender, EventArgs e)
  117. {
  118. this.mdi.SelectMenuIndex = 3;
  119. }
  120. private void frmRepeaterGroup_Disposed(object sender, EventArgs e)
  121. {
  122. this.mdi.SelectMenuIndex = 0;
  123. }
  124. // ์ค‘๊ณ„๊ธฐ ์ƒํƒœ๋ฅผ ์กฐํšŒํ•˜๊ธฐ ์œ„ํ•œ ํ†ต์‹ ๋ณด๋“œ, ๋ฃจํ”„๋ฒˆํ˜ธ๋ฅผ ์กฐํšŒํ•œ๋‹ค (UI ๊ธฐ์ค€)
  125. public void setBoardId(int boardId, int loopNo)
  126. {
  127. try
  128. {
  129. txtBoardID.Text = String.Format("{0:00}", boardId);
  130. txtLoopNo.Text = String.Format("{0}", loopNo);
  131. BoardGroup_change = true;
  132. }
  133. catch (Exception ex)
  134. {
  135. Util.UErrorMessage(ex, 0, 0);
  136. }
  137. }
  138. //GRID์— ์ค‘๊ณ„๊ธฐ ์„ค์ • ํ‘œ์‹œ
  139. private void Repeater_init()
  140. {
  141. // ์ค‘๊ณ„๊ธฐ ์ด๋ฏธ์ง€
  142. //imgListRepeaterBack.Images[0];
  143. //0 : ์ค‘๊ณ„๊ธฐ ๋นˆ๊ฒƒ
  144. //1 : ์ค‘๊ณ„๊ธฐ ์ฐจ๋‹จ
  145. //2 : ์ค‘๊ณ„๊ธฐ ์—๋Ÿฌ
  146. //3 : ์ค‘๊ณ„๊ธฐ ์—†์Œ
  147. try
  148. {
  149. this.dataGridView_Repeater_Main.Columns.Clear();
  150. DataGridViewCellStyle sty = new DataGridViewCellStyle();
  151. sty.Alignment = DataGridViewContentAlignment.MiddleCenter;
  152. for (int col = 0; col < 10; col++)
  153. {
  154. DataGridViewImageColumn imageColumn = new DataGridViewImageColumn();
  155. imageColumn.ImageLayout = DataGridViewImageCellLayout.Normal;
  156. // ์ฒ˜์Œ ๊ธฐ๋ณธ ๋ฐ”ํƒ•์ด๋ฏธ์ง€๋Š” ์ค‘๊ณ„๊ธฐ ๋นˆ๊ฒƒ์œผ๋กœ ๋Œ€์ฒด (ํฐ์ƒ‰)
  157. imageColumn.Image = imgListRepeaterBack.Images[0];
  158. dataGridView_Repeater_Main.Columns.Add(imageColumn);
  159. dataGridView_Repeater_Main.Columns[col].ReadOnly = true;
  160. dataGridView_Repeater_Main.Columns[col].Resizable = DataGridViewTriState.False;
  161. dataGridView_Repeater_Main.Columns[col].Width = 76;
  162. dataGridView_Repeater_Main.Columns[col].DefaultCellStyle = sty;
  163. }
  164. // 10๊ฐœ์˜ ์…€ ๋ฐ”ํƒ•์ด๋ฏธ์ง€๋Š” ์ค‘๊ณ„๊ธฐ ์—†์Œ์œผ๋กœ ๋Œ€์ฒด (ํšŒ์ƒ‰)
  165. Image[] rowData12 = new Image[10] {
  166. imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3] , imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3],
  167. imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3] , imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3], imgListRepeaterBack.Images[3]};
  168. try
  169. {
  170. this.dataGridView_Repeater_Main.Rows.Clear();
  171. DataGridViewRowCollection rows = dataGridView_Repeater_Main.Rows;
  172. for (int row = 0; row <= 12; row++)
  173. {
  174. rows.Add(rowData12);
  175. }
  176. }
  177. catch (Exception ex)
  178. {
  179. Util.UErrorMessage(ex, 0, 0);
  180. }
  181. // ์…€ ๋‹จ์œ„๋กœ ์ด๋ฏธ์ง€๋ฅผ ์…‹ํŒ…ํ•œ๋‹ค
  182. for (int row = 0; row <= 12; row++)
  183. {
  184. for (int col = 1; col <= 10; col++)
  185. {
  186. // no ๋Š” ์ค‘๊ณ„๊ธฐ ์•„์ด๋””
  187. int no = row * 10 + col;
  188. if (no <= 127)
  189. {
  190. GRIDCELL[no - 1] = new GridRepeater(dataGridView_Repeater_Main.Rows[row].Cells[col - 1], imgListRepeaterBack, no);
  191. }
  192. }
  193. dataGridView_Repeater_Main.Rows[row].Height = 45;
  194. //REP[no] = new RepeaterDeviceTypeInfo(no);
  195. }
  196. }
  197. catch (Exception ex)
  198. {
  199. Util.UErrorMessage(ex, 0, 0);
  200. throw ex;
  201. }
  202. }
  203. bool ex = false;
  204. //์ค‘๊ณ„๊ธฐ ์„ค์ •๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
  205. private void Repeater_SettingData()
  206. {
  207. try
  208. {
  209. if (this.InvokeRequired)
  210. {
  211. deleFormInit d = new deleFormInit(Repeater_SettingData);
  212. this.Invoke(d, new object[] { });
  213. }
  214. else
  215. {
  216. //if (cboBoardList.Items.Count < 1 || cboLoopList.Items.Count < 1) { Repeater_init(); return; }
  217. //if (cboBoardList.SelectedItem == null || cboLoopList.SelectedItem == null) { Repeater_init(); return; }
  218. //String BoardID = cboBoardList.SelectedItem.ToString();
  219. //String Loop = cboLoopList.SelectedItem.ToString();
  220. ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo;
  221. if (load)
  222. {
  223. if (mdi.temptxtBoardID != null && mdi.temptxtLoopNo != null)
  224. {
  225. int boardid = Convert.ToInt32(mdi.temptxtBoardID);
  226. int tempboard = boardid - 1;
  227. int loopid = Convert.ToInt32(mdi.temptxtLoopNo);
  228. if (Receiverinfo.MyBoardType[tempboard] != null)
  229. {
  230. if (Receiverinfo.MyBoardType[tempboard].UseFlag == true)
  231. {
  232. switch (loopid)
  233. {
  234. case 0:
  235. {
  236. if (Receiverinfo.MyBoardType[tempboard].Loop0UseFlag == true)
  237. {
  238. if (boardid > 9)
  239. {
  240. txtBoardID.Text = boardid.ToString();
  241. mdi.temptxtBoardID = txtBoardID.Text;
  242. }
  243. else
  244. {
  245. txtBoardID.Text = "0" + boardid.ToString();
  246. mdi.temptxtBoardID = boardid.ToString();
  247. }
  248. txtLoopNo.Text = "0";
  249. mdi.temptxtLoopNo = txtLoopNo.Text;
  250. ex = true;
  251. break;
  252. }
  253. ex = false;
  254. break;
  255. }
  256. case 1:
  257. {
  258. if (Receiverinfo.MyBoardType[tempboard].Loop1UseFlag == true)
  259. {
  260. if (boardid > 9)
  261. {
  262. txtBoardID.Text = boardid.ToString();
  263. mdi.temptxtBoardID = txtBoardID.Text;
  264. }
  265. else
  266. {
  267. txtBoardID.Text = "0" + boardid.ToString();
  268. mdi.temptxtBoardID = boardid.ToString();
  269. }
  270. txtLoopNo.Text = "1";
  271. mdi.temptxtLoopNo = txtLoopNo.Text;
  272. ex = true;
  273. break;
  274. }
  275. ex = false;
  276. break;
  277. }
  278. case 2:
  279. {
  280. if (Receiverinfo.MyBoardType[tempboard].Loop2UseFlag == true)
  281. {
  282. if (boardid > 9)
  283. {
  284. txtBoardID.Text = boardid.ToString();
  285. mdi.temptxtBoardID = txtBoardID.Text;
  286. }
  287. else
  288. {
  289. txtBoardID.Text = "0" + boardid.ToString();
  290. mdi.temptxtBoardID = boardid.ToString();
  291. }
  292. txtLoopNo.Text = "2";
  293. mdi.temptxtLoopNo = txtLoopNo.Text;
  294. ex = true;
  295. break;
  296. }
  297. ex = false;
  298. break;
  299. }
  300. case 3:
  301. {
  302. if (Receiverinfo.MyBoardType[tempboard].Loop3UseFlag == true)
  303. {
  304. if (boardid > 9)
  305. {
  306. txtBoardID.Text = boardid.ToString();
  307. mdi.temptxtBoardID = txtBoardID.Text;
  308. }
  309. else
  310. {
  311. txtBoardID.Text = "0" + boardid.ToString();
  312. mdi.temptxtBoardID = boardid.ToString();
  313. }
  314. txtLoopNo.Text = "3";
  315. mdi.temptxtLoopNo = txtLoopNo.Text;
  316. ex = true;
  317. break;
  318. }
  319. ex = false;
  320. break;
  321. }
  322. }
  323. }
  324. }
  325. }
  326. if (!ex)
  327. {
  328. for (var i = 0; i < Receiverinfo.MyBoardType.Length; i++)
  329. {
  330. if (Receiverinfo.MyBoardType[i] != null)
  331. {
  332. if (Receiverinfo.MyBoardType[i].UseFlag == true)
  333. {
  334. if (Receiverinfo.MyBoardType[i].Loop0UseFlag == true || Receiverinfo.MyBoardType[i].Loop1UseFlag == true || Receiverinfo.MyBoardType[i].Loop2UseFlag == true || Receiverinfo.MyBoardType[i].Loop3UseFlag == true)
  335. {
  336. int tempcnt = i + 1;
  337. if (tempcnt > 9)
  338. {
  339. txtBoardID.Text = tempcnt.ToString();
  340. }
  341. else
  342. {
  343. txtBoardID.Text = "0" + tempcnt.ToString();
  344. }
  345. if (Receiverinfo.MyBoardType[i].Loop0UseFlag == true)
  346. {
  347. txtLoopNo.Text = "0";
  348. break;
  349. }
  350. else if (Receiverinfo.MyBoardType[i].Loop1UseFlag == true)
  351. {
  352. txtLoopNo.Text = "1";
  353. break;
  354. }
  355. else if (Receiverinfo.MyBoardType[i].Loop2UseFlag == true)
  356. {
  357. txtLoopNo.Text = "2";
  358. break;
  359. }
  360. else
  361. {
  362. txtLoopNo.Text = "3";
  363. break;
  364. }
  365. }
  366. }
  367. }
  368. }
  369. }
  370. load = false;
  371. }
  372. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  373. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  374. if (txtBoardID.Text.Substring(0, 1) == "0")
  375. {
  376. mdi.temptxtBoardID = txtBoardID.Text.Substring(1, 1);
  377. }
  378. else
  379. {
  380. mdi.temptxtBoardID = txtBoardID.Text;
  381. }
  382. mdi.temptxtLoopNo = txtLoopNo.Text;
  383. if (BoardID == savBoardID && Loop == savLoop) return;
  384. this.Cursor = Cursors.WaitCursor;
  385. // ์ค‘๊ณ„๊ธฐ ์ƒํƒœ๋ณด๊ธฐ ์ด๋ฏธ์ง€๋ฅผ ์ดˆ๊ธฐํ™”
  386. Repeater_init();
  387. savBoardID = BoardID;
  388. savLoop = Loop;
  389. //์ˆ˜์‹ ๊ธฐ์„ค์ •
  390. //ํ†ต์‹ ๋ณด๋“œ savBoardID ์˜ loop ์˜ ์„ค์ •๊ฐ’
  391. BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID);
  392. RepeaterDeviceTypeInfo[] repinfo;
  393. RepeaterPointUnit[] repdata;
  394. bool LoopCutFlag = false;
  395. // cyim 2015.7.2 ํ•ด์‰ฌํ…Œ์ด๋ธ”๋กœ ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ๋ ˆ๋ฒจ์„ ์•„์ด๋””๋ณ„๋กœ ์ €์žฅํ•ด๋‘”๋‹ค
  396. // ์‚ฌ์ „์— ๊ฐ€์ ธ์˜จ ๋ฐ์ดํƒ€๋ฒ ์ด์Šค ์ •๋ณด๋ฅผ ํ† ๋Œ€๋กœ ํ•ด๋‹น ๋ณด๋“œ, ๋ฃจํ”„๋ฅผ ๋”ฐ์ ธ ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ์ •๋ณด๋ฅผ ๋ฏธ๋ฆฌ ์•Œ์•„๋‚ธ๋‹ค
  397. // ์ด ๋•Œ ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ๋ผ๋ฉด ๋ ˆ๋ฒจ๊ฐ’์„ ๋”ฐ์ ธ ํ˜„์žฌ ์ƒํƒœ๋ฅผ ์•Œ์•„๋‚ด์•ผ ํ•œ๋‹ค
  398. AnalogDetecterRepeaterID_Hashtable = mdi.GetAnalogDetecterRepeaterID(mdi.myReceiverID, savBoardID, savLoop);
  399. // cyim 2016.10.31 : ๊ณ„ํ†ต์ •๋ณด๋Š” 0,1,2,3 ์œผ๋กœ ๋ณ€๊ฒฝ
  400. // ํ†ต์‹ ๋ณด๋“œ์˜ Loop ์ •๋ณด
  401. if (savLoop == 0)
  402. {
  403. LoopCutFlag = brdinfo.Loop0CutFlag;
  404. repinfo = brdinfo.Loop0_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop0 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  405. repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  406. }
  407. else if (savLoop == 1)
  408. {
  409. LoopCutFlag = brdinfo.Loop1CutFlag;
  410. repinfo = brdinfo.Loop1_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop1 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  411. repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  412. }
  413. else if (savLoop == 2)
  414. {
  415. LoopCutFlag = brdinfo.Loop2CutFlag;
  416. repinfo = brdinfo.Loop2_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop2 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  417. repdata = brdinfo.Loop2_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  418. }
  419. else if (savLoop == 3)
  420. {
  421. LoopCutFlag = brdinfo.Loop3CutFlag;
  422. repinfo = brdinfo.Loop3_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop3 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  423. repdata = brdinfo.Loop3_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  424. }
  425. else
  426. {
  427. LoopCutFlag = brdinfo.Loop0CutFlag;
  428. repinfo = null;
  429. repdata = null;
  430. }
  431. // ์ฐจ๋‹จ ์ •๋ณด (๊ณ„ํ†ต)
  432. if (LoopCutFlag)
  433. {
  434. btnRepeaterRecoverCmd.Enabled = false;
  435. btnRepeaterSearchCmd.Enabled = false;
  436. btnInWrite.Enabled = false;
  437. btnOutWrite.Enabled = false;
  438. this.btnRepeaterReset.Enabled = false; // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  439. }
  440. else
  441. {
  442. btnRepeaterRecoverCmd.Enabled = true;
  443. btnRepeaterSearchCmd.Enabled = true;
  444. btnInWrite.Enabled = true;
  445. btnOutWrite.Enabled = true;
  446. this.btnRepeaterReset.Enabled = true; // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  447. }
  448. // ๊ฐ ์ค‘๊ณ„๊ธฐ์˜ ์ •๋ณด
  449. 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++ )
  450. {
  451. RepeaterDeviceTypeInfo dev = repinfo[i];
  452. GRIDCELL[i].LoopCutFlag = LoopCutFlag;
  453. //if (dev != null)
  454. //{
  455. int RepeaterID = i + 1;
  456. //๊ฐœ๋ณ„์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’์œผ๋กœ Grid UI ์ƒ์„ฑ
  457. GRIDCELL[i].Set_DeviceInfo(dev);
  458. //๊ฐœ๋ณ„์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ๊ฐ’์œผ๋กœ Grid UI ์ƒ์„ฑ - ์ค‘๊ณ„๊ธฐ ํƒ€์ž… ๊ฒฐ์ •
  459. GRIDCELL[i].Set_DeviceUnit(repdata[RepeaterID - 1]);
  460. //}
  461. }
  462. // ํ•˜๋‹จ์€ ํ•„์š”์—†์Œ
  463. //if (LoopCutFlag)
  464. //{
  465. // //MessageBox.Show(string.Format("ํ•ด๋‹น ๊ณ„ํ†ต์€ ์ฐจ๋‹จ์„ค์ • ์ค‘์ž…๋‹ˆ๋‹ค.. ํ†ต์‹ ๋ณด๋“œ[{0}] ๊ณ„ํ†ต[{1}] ์ฐจ๋‹จ์„ค์ • ํ•ด์ œํ›„ ์ œ์–ดํ•˜์‹ญ์‹œ์š”..", savBoardID, savLoop));
  466. //}
  467. }
  468. this.Cursor = Cursors.Default;
  469. }
  470. catch (Exception ex)
  471. {
  472. Util.UErrorMessage(ex, 0, 0);
  473. }
  474. }
  475. void RepeaterInfoRead()
  476. {
  477. try
  478. {
  479. while (tRepeaterReadThreadStatus > 0)
  480. {
  481. if (this.mdi.ui.Connected)
  482. {
  483. try
  484. {
  485. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  486. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  487. if (BoardID == 0)
  488. {
  489. tRepeaterReadThreadStatus = 0;
  490. }
  491. if (Loop != 0 && Loop != 1)
  492. {
  493. tRepeaterReadThreadStatus = 0;
  494. }
  495. tRepeaterReadThreadStatus++;
  496. //์ค‘๊ณ„๊ธฐ ์ „์ฒด ์ฝ๊ธฐ ๋ช…๋ น
  497. dCommandResponse d = new dCommandResponse(RepeaterInfoAll);
  498. //๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  499. CmdInfo cmd = new CmdInfo(prt_cmd_define.read_repeater_all, mdi.myReceiverID, 1, Loop, BoardID, d);
  500. this.mdi.ui.runCommand(cmd);
  501. if (tRepeaterReadThreadStatus > 4) tRepeaterReadThreadStatus = 0;
  502. }
  503. catch (Exception ex)
  504. {
  505. Util.UErrorMessage(ex, 0, 0);
  506. tRepeaterReadThreadStatus = 0;
  507. }
  508. Thread.Sleep(1000);
  509. }
  510. else
  511. {
  512. tRepeaterReadThreadStatus = 0;
  513. }
  514. }
  515. }
  516. catch (Exception ex)
  517. {
  518. Util.UErrorMessage(ex, 0, 0);
  519. tRepeaterReadThreadStatus = 0;
  520. }
  521. }
  522. //์„ ํƒ์…€์ด ๋ฐ”๋€”๋•Œ๋งˆ๋‹ค ํ•ด๋‹น์ค‘๊ณ„๊ธฐ ์„ค์ •๋‚ด์šฉ ๋ฐ ๋ฐ์ดํ„ฐ ํ‘œ์‹œ
  523. private void dataGridView1_SelectionChanged(object sender, EventArgs e)
  524. {
  525. try
  526. {
  527. if (dataGridView_Repeater_Main.SelectedCells.Count > 0)
  528. {
  529. DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
  530. int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
  531. if (no > 127)
  532. {
  533. lblRepeaterID.Text = "";
  534. DeviceStatus(null, null);
  535. return;
  536. }
  537. else
  538. {
  539. lblRepeaterID.Text = String.Format("{0:000} ์•„์ด๋””", no);
  540. if (GRIDCELL[no - 1] != null)
  541. {
  542. lblInfoMessage.Text = GRIDCELL[no - 1].InfoMessage;
  543. //dataGridView2์— ๋ฐ์ดํ„ฐ ํ‘œ์‹œ
  544. RepeaterDeviceTypeInfo dev = GRIDCELL[no - 1].DeviceInfo;
  545. RepeaterPointUnit unit = GRIDCELL[no - 1].DeviceUnit;
  546. DeviceStatus(dev, unit);
  547. }
  548. else
  549. {
  550. lblRepeaterID.Text = "";
  551. }
  552. }
  553. }
  554. }
  555. catch (Exception ex)
  556. {
  557. Util.UErrorMessage(ex, 0, 0);
  558. }
  559. }
  560. // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  561. // ํ˜„์žฌ ๋ผ์ธ์ด ์ฐจ๋‹จ๋˜์—ˆ๋Š”์ง€ ์•Œ์•„๋ณด๋Š” ํ•จ์ˆ˜
  562. private bool LoopCut()
  563. {
  564. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  565. ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //์ˆ˜์‹ ๊ธฐ์„ค์ •
  566. BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(BoardID); //ํ†ต์‹ ๋ณด๋“œsavBoardID์˜ loop0์˜ ์„ค์ •๊ฐ’
  567. //RepeaterDeviceTypeInfo[] repinfo;
  568. //RepeaterPointUnit[] repdata;
  569. bool LoopCutFlag = false;
  570. // cyim 2016.10.31 : ๊ณ„ํ†ต์ •๋ณด๋Š” 0,1,2,3 ์œผ๋กœ ๋ณ€๊ฒฝ
  571. if (savLoop == 0)
  572. {
  573. LoopCutFlag = brdinfo.Loop0CutFlag;
  574. //repinfo = brdinfo.Loop0_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop0 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  575. //repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  576. }
  577. else if (savLoop == 1)
  578. {
  579. LoopCutFlag = brdinfo.Loop1CutFlag;
  580. //repinfo = brdinfo.Loop1_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop1 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  581. //repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  582. }
  583. else if (savLoop == 2)
  584. {
  585. LoopCutFlag = brdinfo.Loop2CutFlag;
  586. //repinfo = brdinfo.Loop1_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop2 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  587. //repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  588. }
  589. else if (savLoop == 3)
  590. {
  591. LoopCutFlag = brdinfo.Loop3CutFlag;
  592. //repinfo = brdinfo.Loop1_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop3 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  593. //repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  594. }
  595. return LoopCutFlag;
  596. }
  597. //dataGridView2์— ์ค‘๊ณ„๊ธฐ ํšŒ๋กœ์ •๋ณด ํ‘œ์‹œ
  598. private void DeviceStatus(RepeaterDeviceTypeInfo dt, RepeaterPointUnit unit)
  599. {
  600. try
  601. {
  602. if (dt != null && dt.UseFlag == true)
  603. {
  604. if (dt.RepeaterType.Equals("")
  605. // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  606. || LoopCut() == true
  607. // cyim 2015.2.23 ์ค‘๊ณ„๊ธฐ์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  608. || dt.CutFlag == true
  609. )
  610. {
  611. btnInWrite.Enabled = false;
  612. btnOutWrite.Enabled = false;
  613. btnRepeaterRecoverCmd.Enabled = false;
  614. btnRepeaterSearchCmd.Enabled = false;
  615. this.btnRepeaterReset.Enabled = false; // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  616. }
  617. //else if (dt.CutFlag
  618. else
  619. {
  620. btnInWrite.Enabled = true;
  621. btnOutWrite.Enabled = true;
  622. btnRepeaterRecoverCmd.Enabled = true;
  623. btnRepeaterSearchCmd.Enabled = true;
  624. this.btnRepeaterReset.Enabled = true; // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  625. }
  626. // ์‚ฌ์šฉํ•˜๋Š” ์…€ (ํฐ์ƒ‰)
  627. DataGridViewCellStyle sty = new DataGridViewCellStyle();
  628. sty.Alignment = DataGridViewContentAlignment.MiddleCenter;
  629. sty.BackColor = System.Drawing.Color.White;
  630. // ๋ฏธ์‚ฌ์šฉํ•˜๋Š” ์…€ (ํšŒ์ƒ‰)
  631. DataGridViewCellStyle styGray = new DataGridViewCellStyle();
  632. styGray.Alignment = DataGridViewContentAlignment.MiddleCenter;
  633. styGray.BackColor = System.Drawing.Color.Gray;
  634. styGray.SelectionBackColor = System.Drawing.Color.Gray;
  635. // cyim 2015.6.8 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ์—ฐ๋™ ์ถ”๊ฐ€ : ํƒ€์ž…์— ๊ด€๊ณ„์—†์ด ๋™์ผํ•œ ์Šคํƒ€์ผ์ด ์ ์šฉ๋œ๋‹ค
  636. for (int col = 0; col < 4; col++)
  637. {
  638. dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
  639. dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
  640. dataGridView_Repeater_Sub.Columns[col].Width = 70;
  641. dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
  642. }
  643. //if (dt.RepeaterType.Equals("A"))
  644. //{
  645. // for (int col = 0; col < 4; col++)
  646. // {
  647. // //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn());
  648. // dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
  649. // dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
  650. // dataGridView_Repeater_Sub.Columns[col].Width = 140;
  651. // dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
  652. // }
  653. // //dt.InType3 = "";
  654. // //dt.InType4 = "";
  655. // //dt.OutType3 = "";
  656. // //dt.OutType4 = "";
  657. // // cyim 2015.6.8 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ์—ฐ๋™ ์ถ”๊ฐ€ : ์•„๋ž˜ ์†Œ์Šค๋Š” ํ•„์š”์—†์Œ
  658. // //dataGridView_Repeater_Sub.Columns[2].ReadOnly = true;
  659. // //dataGridView_Repeater_Sub.Columns[2].Resizable = DataGridViewTriState.False;
  660. // //dataGridView_Repeater_Sub.Columns[2].Width = 140;
  661. // //dataGridView_Repeater_Sub.Columns[2].DefaultCellStyle = styGray;
  662. // //dataGridView_Repeater_Sub.Columns[3].ReadOnly = true;
  663. // //dataGridView_Repeater_Sub.Columns[3].Resizable = DataGridViewTriState.False;
  664. // //dataGridView_Repeater_Sub.Columns[3].Width = 140;
  665. // //dataGridView_Repeater_Sub.Columns[3].DefaultCellStyle = styGray;
  666. //}
  667. //else if (dt.RepeaterType.Equals("B"))
  668. //{
  669. // for (int col = 0; col < 4; col++)
  670. // {
  671. // //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn());
  672. // dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
  673. // dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
  674. // dataGridView_Repeater_Sub.Columns[col].Width = 70;
  675. // dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
  676. // }
  677. //}
  678. //else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D"))
  679. //{
  680. // for (int col = 0; col < 1; col++)
  681. // {
  682. // //dataGridView2.Columns.Add(new DataGridViewTextBoxColumn());
  683. // dataGridView_Repeater_Sub.Columns[col].ReadOnly = true;
  684. // dataGridView_Repeater_Sub.Columns[col].Resizable = DataGridViewTriState.False;
  685. // dataGridView_Repeater_Sub.Columns[col].Width = 140;
  686. // dataGridView_Repeater_Sub.Columns[col].DefaultCellStyle = sty;
  687. // }
  688. //}
  689. //ํšŒ๋กœ์ž…๋ ฅ,์ถœ๋ ฅ๊ฐ’ ํ‘œ์‹œ
  690. if (unit != null)
  691. {
  692. DataGridViewRowCollection rows2 = this.dataGridView_Repeater_Sub.Rows;
  693. if (dt != null)
  694. {
  695. if (dt.RepeaterType.Equals("A"))
  696. {
  697. //sdkim , 2011.11.22. bug fix , 2in2out type repeater - null point exception bug.
  698. String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1,dt.inDeviceTypeInfos[0]),
  699. DeviceStatusText.InputText(unit.Repeater_Input2,dt.inDeviceTypeInfos[1]),
  700. "",
  701. "" };
  702. String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1,dt.outDeviceTypeInfos[0]),
  703. DeviceStatusText.OutputText(unit.Repeater_Output2,dt.outDeviceTypeInfos[1]),
  704. "",
  705. "" };
  706. rows2.Clear();
  707. rows2.Add(inData);
  708. rows2.Add(outData);
  709. }
  710. else if (dt.RepeaterType.Equals("B"))
  711. {
  712. String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1,dt.inDeviceTypeInfos[0]),
  713. DeviceStatusText.InputText(unit.Repeater_Input2,dt.inDeviceTypeInfos[1]),
  714. DeviceStatusText.InputText(unit.Repeater_Input3,dt.inDeviceTypeInfos[2]),
  715. DeviceStatusText.InputText(unit.Repeater_Input4,dt.inDeviceTypeInfos[3]) };
  716. String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1,dt.outDeviceTypeInfos[0]),
  717. DeviceStatusText.OutputText(unit.Repeater_Output2,dt.outDeviceTypeInfos[1]),
  718. DeviceStatusText.OutputText(unit.Repeater_Output3,dt.outDeviceTypeInfos[2]),
  719. DeviceStatusText.OutputText(unit.Repeater_Output4,dt.outDeviceTypeInfos[3])};
  720. rows2.Clear();
  721. rows2.Add(inData);
  722. rows2.Add(outData);
  723. }
  724. // cyim 2015.6.8 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ์—ฐ๋™ ์ถ”๊ฐ€
  725. else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D"))
  726. {
  727. String[] inData = { DeviceStatusText.InputText(unit.Repeater_Input1, dt.inDeviceTypeInfos[0]) };
  728. String[] outData = { DeviceStatusText.OutputText(unit.Repeater_Output1, dt.outDeviceTypeInfos[0]) };
  729. rows2.Clear();
  730. rows2.Add(inData);
  731. rows2.Add(outData);
  732. }
  733. }
  734. }
  735. else
  736. {
  737. DataGridViewRowCollection rows2 = this.dataGridView_Repeater_Sub.Rows;
  738. if (dt != null)
  739. {
  740. rows2.Clear();
  741. // cyim 2014.4.3 : ์ดˆ๊ธฐ๊ฐ’ ์ˆ˜์ • 1,2,3,4 -> "-"
  742. if (dt.RepeaterType.Equals("A"))
  743. {
  744. String[] inData = { "-", "-", "", "" };
  745. String[] outData = { "-", "-", "", "" };
  746. rows2.Add(inData);
  747. rows2.Add(outData);
  748. }
  749. else if (dt.RepeaterType.Equals("B"))
  750. {
  751. String[] inData = { "-", "-", "-", "-" };
  752. String[] outData = { "-", "-", "-", "-" };
  753. rows2.Add(inData);
  754. rows2.Add(outData);
  755. }
  756. // cyim 2015.6.8 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ์—ฐ๋™ ์ถ”๊ฐ€
  757. else if (dt.RepeaterType.Equals("C") || dt.RepeaterType.Equals("D"))
  758. {
  759. String[] inData = { "-", "", "", "" };
  760. String[] outData = { "-", "", "", "" };
  761. rows2.Add(inData);
  762. rows2.Add(outData);
  763. }
  764. }
  765. }
  766. }
  767. else
  768. {
  769. this.dataGridView_Repeater_Sub.Rows.Clear();
  770. btnInWrite.Enabled = false;
  771. btnOutWrite.Enabled = false;
  772. btnRepeaterRecoverCmd.Enabled = false;
  773. btnRepeaterSearchCmd.Enabled = false;
  774. lblRepeaterID.Text = "";
  775. this.btnRepeaterReset.Enabled = false; // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  776. }
  777. }
  778. catch (Exception ex)
  779. {
  780. Util.UErrorMessage(ex, 0, 0);
  781. }
  782. }
  783. private Boolean dtCutFlag(DeviceTypeInfo dtInfo)
  784. {
  785. bool cutFlag = false;
  786. try
  787. {
  788. if (dtInfo != null) cutFlag = dtInfo.CutFlag;
  789. }
  790. catch (Exception ex)
  791. {
  792. Util.UErrorMessage(ex, 0, 0);
  793. }
  794. return cutFlag;
  795. }
  796. /*******************************************
  797. * ์ค‘๊ณ„๊ธฐ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ํ†ต์‹ ๋ถ€๋ถ„ ---์‹œ์ž‘
  798. ******************************************/
  799. private void btnRepeaterAllInfo_Click(object sender, EventArgs e)
  800. {
  801. try
  802. {
  803. SocketUI ui = this.mdi.ui;
  804. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  805. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  806. if (BoardID == 0)
  807. {
  808. this.label_Warning.Text = string.Format("ํ†ต์‹ ๋ณด๋“œID๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ์ฃผ์‹ญ์‹œ์š”.");
  809. this.label_Warning.Visible = true;
  810. txtBoardID.Focus();
  811. return;
  812. }
  813. else
  814. if (Loop != 0 && Loop != 1 && Loop != 2 && Loop != 3)
  815. {
  816. this.label_Warning.Text = string.Format("Loop No๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž…๋ ฅํ•˜์—ฌ ์ฃผ์‹ญ์‹œ์š”.");
  817. this.label_Warning.Visible = true;
  818. txtLoopNo.Focus();
  819. return;
  820. }
  821. else
  822. {
  823. this.label_Warning.Visible = false;
  824. }
  825. button_end(false);//๋ฒ„ํŠผ ๋น„ํ™œ์„ฑ ์„ค์ •
  826. dCommandResponse d = new dCommandResponse(RepeaterInfoAll);//์ค‘๊ณ„๊ธฐ ์ „์ฒด ์ฝ๊ธฐ ๋ช…๋ น
  827. CmdInfo cmd = new CmdInfo(prt_cmd_define.read_repeater_all, mdi.myReceiverID, 1, Loop, BoardID, d);//๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  828. ui.runCommand(cmd);
  829. }
  830. catch (Exception ex)
  831. {
  832. Util.UErrorMessage(ex, 0, 0);
  833. }
  834. }
  835. //ํ™”๋ฉด ๋งˆ์šฐ์Šค ์ปค์„œ ๋ฐ ๋ฒ„ํŠผ ๋‹ค์‹œ ํด๋ฆญ ๋ชปํ•˜๋„๋ก ์„ค์ • ๋ฐ ํ•ด์ œ
  836. private void button_end(Boolean val)
  837. {
  838. try
  839. {
  840. if (val)
  841. {
  842. this.btnRepeaterAllInfo.Enabled = true;
  843. this.Cursor = Cursors.Default;
  844. }
  845. else
  846. {
  847. this.btnRepeaterAllInfo.Enabled = false;
  848. this.Cursor = Cursors.WaitCursor;
  849. }
  850. }
  851. catch (Exception ex)
  852. {
  853. Util.UErrorMessage(ex, 0, 0);
  854. }
  855. }
  856. // cyim 2015.7.23 NACK ์‘๋‹ต์ด ์ตœ๋Œ€ 7.2์ดˆ๊ฐ€ ๋”œ๋ ˆ์ด๋จ, ๋‹จ ๊ธฐ๋ณธ๊ฐ’์€ 4์ดˆ
  857. public void timer_RepeaterAllInfo_BlockRead_ChangeStart(int interval)
  858. {
  859. if (timer_RepeaterAllInfo_BlockRead.Interval != interval) // ์ค‘๊ฐ„์— ์ฃผ๊ธฐ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ํƒ€์ด๋จธ๋ฅผ ์žฌ์‹œ์ž‘ํ•œ๋‹ค
  860. {
  861. timer_RepeaterAllInfo_BlockRead.Stop();
  862. timer_RepeaterAllInfo_BlockRead.Interval = interval;
  863. timer_RepeaterAllInfo_BlockRead.Start();
  864. }
  865. }
  866. //*********************************************************************//
  867. // ์ค‘๊ณ„๊ธฐ ์ „์ฒด์ฝ๊ธฐ ์‘๋‹ต๋ฐ์ดํ„ฐ ์ด๋ฒคํŠธ //
  868. //*********************************************************************//
  869. public void RepeaterInfoAll(CmdInfo cmd)
  870. {
  871. try
  872. {
  873. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadRepeaterPointAll")) // cyim 2015.7.23 NACK ์ฒ˜๋ฆฌ ๋ถ€๋ถ„ ์˜ค๋ฅ˜
  874. {
  875. //์—๋Ÿฌ์‘๋‹ต์ฒ˜๋ฆฌ
  876. button_end(true);
  877. // cyim 2015.7.23 NACK ์‘๋‹ต์ด ์ตœ๋Œ€ 7.2์ดˆ๊ฐ€ ๋”œ๋ ˆ์ด๋จ, ๋‹จ ๊ธฐ๋ณธ๊ฐ’์€ 4์ดˆ
  878. timer_RepeaterAllInfo_BlockRead_ChangeStart(7200);
  879. return;
  880. }
  881. // cyim 2015.7.23 NACK ์‘๋‹ต์ด ์ตœ๋Œ€ 7.2์ดˆ๊ฐ€ ๋”œ๋ ˆ์ด๋จ, ๋‹จ ๊ธฐ๋ณธ๊ฐ’์€ 4์ดˆ
  882. timer_RepeaterAllInfo_BlockRead_ChangeStart(4000);
  883. RCVData_ReadRepeaterPointAll ResponseData = (RCVData_ReadRepeaterPointAll)cmd.ResponseData;
  884. RepeaterData[] data = ResponseData.Data;
  885. if (cmd.Command == prt_cmd_define.read_repeater_all || cmd.ResCommand == prt_res_define.read_repeater_all)
  886. {
  887. if (savBoardID == cmd.boardNo && savLoop == cmd.loopNo)
  888. {
  889. ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //์ˆ˜์‹ ๊ธฐ์„ค์ •
  890. BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(savBoardID); //ํ†ต์‹ ๋ณด๋“œsavBoardID์˜ loop0์˜ ์„ค์ •๊ฐ’
  891. RepeaterDeviceTypeInfo[] repinfo;
  892. RepeaterPointUnit[] repdata;
  893. // cyim 2016.10.31 : ๊ณ„ํ†ต์ •๋ณด๋Š” 0,1,2,3 ์œผ๋กœ ๋ณ€๊ฒฝ
  894. if (savLoop == 0)
  895. {
  896. repinfo = brdinfo.Loop0_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop0 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  897. repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  898. }
  899. else if (savLoop == 1)
  900. {
  901. repinfo = brdinfo.Loop1_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop1 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  902. repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  903. }
  904. else if (savLoop == 2)
  905. {
  906. repinfo = brdinfo.Loop2_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop2 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  907. repdata = brdinfo.Loop2_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  908. }
  909. else if (savLoop == 3)
  910. {
  911. repinfo = brdinfo.Loop3_RepeaterType; //ํ†ต์‹ ๋ณด๋“œ + Loop3 + 127๊ฐœ ์ค‘๊ณ„๊ธฐ ์„ค์ •๊ฐ’
  912. repdata = brdinfo.Loop3_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  913. }
  914. else
  915. {
  916. repinfo = null;
  917. repdata = null;
  918. }
  919. bool dataChanged = false;
  920. for (int repeaterNo = 0; repeaterNo < data.Length; repeaterNo++)
  921. {
  922. if (repinfo[repeaterNo] != null)
  923. {
  924. // cyim 2015.6.8 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ์—ฐ๋™ ์ถ”๊ฐ€ : ํ•ด๋‹น ์ค‘๊ณ„๊ธฐ ์•„์ด๋””๊ฐ€ ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ํƒ€์ž…์ด๋‹ค
  925. if (repinfo[repeaterNo].RepeaterType.Equals("C") || repinfo[repeaterNo].RepeaterType.Equals("D"))
  926. {
  927. // cyim 2015.7.2 ํ•ด์‰ฌํ…Œ์ด๋ธ”๋กœ ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ๋ ˆ๋ฒจ์„ ์•„์ด๋””๋ณ„๋กœ ์ €์žฅํ•ด๋‘”๋‹ค
  928. // ํ•ด๋‹น ์ค‘๊ณ„๊ธฐ์˜ ์•„๋‚ ๋กœ๊ทธ ๋ ˆ๋ฒจ ๊ฐ’์„ ์ƒ์„ฑ์ž๋กœ ์ „๋‹ฌํ•œ๋‹ค
  929. AnalogLevel analoglevel = (AnalogLevel)AnalogDetecterRepeaterID_Hashtable[(repeaterNo + 1).ToString()];
  930. if (GRIDCELL[repeaterNo].Unit == null)
  931. {
  932. RepeaterPointUnit newdata = new RepeaterPointUnit(repeaterNo + 1, data[repeaterNo], analoglevel, mdi); // cyim 2015.8.4 ์ˆ˜์‹ ๋ฐ˜์„ ์œ„ํ•œ static ํด๋ž˜์Šค ์ •๋ฆฌ
  933. repdata[repeaterNo] = newdata;
  934. GRIDCELL[repeaterNo].Set_DeviceUnit(newdata);
  935. dataChanged = true;
  936. }
  937. else if (GRIDCELL[repeaterNo].UpdateDeviceUnit(data[repeaterNo], analoglevel, mdi)) // cyim 2015.8.4 ์ˆ˜์‹ ๋ฐ˜์„ ์œ„ํ•œ static ํด๋ž˜์Šค ์ •๋ฆฌ
  938. {
  939. dataChanged = true;
  940. }
  941. }
  942. // ์ผ๋ฐ˜ ์ค‘๊ณ„๊ธฐ ํƒ€์ž…์ด๋‹ค
  943. else
  944. {
  945. if (GRIDCELL[repeaterNo].Unit == null)
  946. {
  947. RepeaterPointUnit newdata = new RepeaterPointUnit(repeaterNo + 1, data[repeaterNo]);
  948. repdata[repeaterNo] = newdata;
  949. GRIDCELL[repeaterNo].Set_DeviceUnit(newdata);
  950. dataChanged = true;
  951. }
  952. else if (GRIDCELL[repeaterNo].UpdateDeviceUnit(data[repeaterNo]))
  953. {
  954. dataChanged = true;
  955. }
  956. }
  957. }
  958. }
  959. if (dataChanged)
  960. {
  961. dataGridView1_SelectionChanged(dataGridView_Repeater_Main, System.EventArgs.Empty);//์„ ํƒ๋œ ์…€์˜ ๋ฐ์ดํ„ฐ๋ฅผ dataGridView2์— ํ‘œ์‹œํ•œ๋‹ค..
  962. }
  963. }
  964. }
  965. button_end(true);//๋ฒ„ํŠผ ๋น„ํ™œ์„ฑ ํ•ด์ œ
  966. }
  967. catch (Exception ex)
  968. {
  969. Util.UErrorMessage(ex, 0, 0);
  970. }
  971. //finally
  972. //{
  973. // button_end(true);//๋ฒ„ํŠผ ๋น„ํ™œ์„ฑ ํ•ด์ œ
  974. //}
  975. }
  976. private void btnInputOpen_Click(object sender, EventArgs e)
  977. {
  978. try
  979. {
  980. InputIDVo vo = new InputIDVo();
  981. vo.ReceiverID = int.Parse(txtThisReceiverID.Text);
  982. vo.CommID = 1;
  983. vo.BoardID = Util.StrToInt(txtBoardID.Text, 0);
  984. vo.LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
  985. IWin32Window window = this;
  986. // cyim 2017.01.12 : ๋ชจ๋ธ์— ๋”ฐ๋ผ ์„ ํƒํ• ์ˆ˜ ์žˆ๋Š” ํ†ต์‹ ๋ณด๋“œ๊ฐ€ ํ‹€๋ฆฌ๋‹ค
  987. frmModalLoopSelect frm = new frmModalLoopSelect(mdi);
  988. frm.InputVo = vo;
  989. frm.ShowDialog(window);
  990. vo = frm.InputVo;
  991. //์ž…๋ ฅํ•œ ์ฝ”๋“œ๊ฐ€ ์žˆ๋‹ค๋ฉด
  992. if (vo.InputOK)
  993. {
  994. txtThisReceiverID.Text = String.Format("{0:00}", vo.ReceiverID);
  995. txtBoardID.Text = String.Format("{0:00}", vo.BoardID);
  996. txtLoopNo.Text = String.Format("{0}", vo.LoopNo);
  997. Repeater_SettingData();
  998. btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); //์ค‘๊ณ„๊ธฐ์ •๋ณด์ฝ๊ธฐ
  999. }
  1000. }
  1001. catch (Exception ex)
  1002. {
  1003. Util.UErrorMessage(ex, 0, 0);
  1004. }
  1005. }
  1006. private void btnOK_Click(object sender, EventArgs e)
  1007. {
  1008. try
  1009. {
  1010. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1011. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1012. if (BoardID == 0)
  1013. {
  1014. this.label_Warning.Text = string.Format("ํ†ต์‹ ๋ณด๋“œID๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ์ฃผ์‹ญ์‹œ์š”.");
  1015. this.label_Warning.Visible = true;
  1016. //MessageBox.Show("ํ†ต์‹ ๋ณด๋“œID๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ์ฃผ์‹ญ์‹œ์š”.", Application.ProductName);
  1017. txtBoardID.Focus();
  1018. return;
  1019. }
  1020. else
  1021. if (Loop != 0 && Loop != 1 && Loop != 2 && Loop != 3)
  1022. {
  1023. this.label_Warning.Text = string.Format("Loop No๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž…๋ ฅํ•˜์—ฌ ์ฃผ์‹ญ์‹œ์š”.");
  1024. this.label_Warning.Visible = true;
  1025. //MessageBox.Show("Loop No๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž…๋ ฅํ•˜์—ฌ ์ฃผ์‹ญ์‹œ์š”.", Application.ProductName);
  1026. txtLoopNo.Focus();
  1027. return;
  1028. }
  1029. else
  1030. {
  1031. this.label_Warning.Visible = false;
  1032. }
  1033. Repeater_SettingData();
  1034. btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty);
  1035. }
  1036. catch (Exception ex)
  1037. {
  1038. Util.UErrorMessage(ex, 0, 0);
  1039. }
  1040. }
  1041. private void btnWinClose_Click(object sender, EventArgs e)
  1042. {
  1043. try
  1044. {
  1045. this.Close();
  1046. }
  1047. catch (Exception ex)
  1048. {
  1049. Util.UErrorMessage(ex, 0, 0);
  1050. }
  1051. }
  1052. private void btnRepeaterRecoverCmd_Click(object sender, EventArgs e)
  1053. {
  1054. try
  1055. {
  1056. if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
  1057. {
  1058. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1059. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1060. DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1061. int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
  1062. if (no <= 127)
  1063. {
  1064. SocketUI ui = this.mdi.ui;
  1065. //์™„๋ฃŒ์ด๋ฒคํŠธ
  1066. dCommandResponse d = new dCommandResponse(RepeaterRecoverComplete);
  1067. //๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  1068. CmdInfo cmd = new CmdInfo(prt_cmd_define.reset_repeater_unit, mdi.myReceiverID, 1, Loop, BoardID, no, d);
  1069. ui.runCommand(cmd);
  1070. }
  1071. }
  1072. }
  1073. catch (Exception ex)
  1074. {
  1075. Util.UErrorMessage(ex, 0, 0);
  1076. }
  1077. }
  1078. public void RepeaterRecoverComplete(CmdInfo cmd)
  1079. {
  1080. try
  1081. {
  1082. //์—๋Ÿฌ์‘๋‹ต์ฒ˜๋ฆฌ
  1083. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ACK")) // cyim 2015.7.23 NACK ์ฒ˜๋ฆฌ ๋ถ€๋ถ„ ์˜ค๋ฅ˜
  1084. {
  1085. button_end(true);
  1086. return;
  1087. }
  1088. MessageBox.Show("์ค‘๊ณ„๊ธฐ๋ณต๊ตฌ ์™„๋ฃŒ");
  1089. btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); //์ค‘๊ณ„๊ธฐ ์ฝ๊ธฐ ๋ช…๋ น
  1090. }
  1091. catch (Exception ex)
  1092. {
  1093. Util.UErrorMessage(ex, 0, 0);
  1094. }
  1095. }
  1096. //์„ ํƒ์…€์ด ๋ฐ”๋€”๋•Œ๋งˆ๋‹ค ํ•ด๋‹น์ค‘๊ณ„๊ธฐ ์„ค์ •๋‚ด์šฉ ๋ฐ ๋ฐ์ดํ„ฐ ํ‘œ์‹œ
  1097. private void dataGridView2_SelectionChanged(object sender, EventArgs e)
  1098. {
  1099. try
  1100. {
  1101. txtDeviceTypeName.Text = "";
  1102. txtPositionName.Text = "";
  1103. txtDeviceMemo.Text = "";
  1104. if (dataGridView_Repeater_Main.SelectedCells.Count > 0 && dataGridView_Repeater_Sub.SelectedCells.Count > 0)
  1105. {
  1106. int CommID = 1;
  1107. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1108. int LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
  1109. DataGridViewCell repCell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1110. int RepeaterID = (repCell.RowIndex * 10) + repCell.ColumnIndex + 1;
  1111. DataGridViewCell devCell = this.dataGridView_Repeater_Sub.SelectedCells[0];
  1112. string InOut_Type = "I";
  1113. if (devCell.RowIndex > 0) InOut_Type = "O";
  1114. int deviceId = devCell.ColumnIndex + 1;
  1115. //ํšŒ๋กœ์„ค์ •๊ฐ’
  1116. DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID); // cyim 2015.7.30 ๋ฐ์ดํƒ€๋ฒ ์ด์Šค ์ ‘์† ๋ฃจํ‹ด ๋ณ€๊ฒฝ
  1117. DataTable dt2 = dacUIProcess.Device_Select(mdi.myReceiverID, CommID, BoardID, LoopNo, RepeaterID, deviceId, InOut_Type);
  1118. foreach (DataRow dr2 in dt2.Rows)
  1119. {
  1120. txtDeviceTypeName.Text = Util.NullToStr(dr2["DEVICE_TYPE_NAME"]);
  1121. txtPositionName.Text = Util.NullToStr(dr2["POSITION_NAME"]);
  1122. txtDeviceMemo.Text = Util.NullToStr(dr2["DEVICE_NAME"]);
  1123. }
  1124. }
  1125. }
  1126. catch (Exception ex)
  1127. {
  1128. Util.UErrorMessage(ex, 0, 0);
  1129. }
  1130. }
  1131. //์ค‘๊ณ„๊ธฐ๊ฒ€์ƒ‰
  1132. private void btnRepeaterSearchCmd_Click(object sender, EventArgs e)
  1133. {
  1134. try
  1135. {
  1136. if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
  1137. {
  1138. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1139. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1140. DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1141. int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
  1142. if (no <= 127)
  1143. {
  1144. SocketUI ui = this.mdi.ui;
  1145. //์™„๋ฃŒ์ด๋ฒคํŠธ
  1146. dCommandResponse d = new dCommandResponse(RepeaterSearchComplete);
  1147. //๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  1148. CmdInfo cmd = new CmdInfo(prt_cmd_define.search_repeater_unit, mdi.myReceiverID, 1, Loop, BoardID, no, d);
  1149. ui.runCommand(cmd);
  1150. }
  1151. }
  1152. }
  1153. catch (Exception ex)
  1154. {
  1155. Util.UErrorMessage(ex, 0, 0);
  1156. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1157. }
  1158. }
  1159. //์ค‘๊ณ„๊ธฐ๊ฒ€์ƒ‰์™„๋ฃŒ
  1160. public void RepeaterSearchComplete(CmdInfo cmd)
  1161. {
  1162. //์—๋Ÿฌ์‘๋‹ต์ฒ˜๋ฆฌ
  1163. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_SearchRepeaterUNIT")) // cyim 2015.7.23 NACK ์ฒ˜๋ฆฌ ๋ถ€๋ถ„ ์˜ค๋ฅ˜
  1164. {
  1165. button_end(true);
  1166. return;
  1167. }
  1168. try
  1169. {
  1170. RCVData_SearchRepeaterUNIT unit = (RCVData_SearchRepeaterUNIT)cmd.ResponseData;
  1171. if (unit == null) throw new Exception("์ค‘๊ณ„๊ธฐ ๊ฒ€์ƒ‰์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค. ํ†ต์‹ ์ƒํƒœ ๋ฐ ์ค‘๊ณ„๊ธฐ ์„ค์ •์„ ํ™•์ธํ•˜์‹ญ์‹œ์š”.");
  1172. if (unit.Data == null) throw new Exception("์ค‘๊ณ„๊ธฐ ๊ฒ€์ƒ‰์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค. ํ†ต์‹ ์ƒํƒœ ๋ฐ ์ค‘๊ณ„๊ธฐ ์„ค์ •์„ ํ™•์ธํ•˜์‹ญ์‹œ์š”.");
  1173. RepeaterData dat = (RepeaterData)unit.Data;
  1174. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1175. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1176. if (BoardID == cmd.boardNo && cmd.loopNo == Loop)
  1177. {
  1178. int RepeaterID = cmd.repeaterNo;
  1179. RepeaterPointUnit rep = new RepeaterPointUnit(cmd.repeaterNo, dat);
  1180. GRIDCELL[RepeaterID - 1].Set_DeviceUnit(rep); //๊ฐœ๋ณ„์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ๊ฐ’์œผ๋กœ Grid UI ์ƒ์„ฑ
  1181. //๊ฒ€์ƒ‰์™„๋ฃŒ์—ฌ๋ถ€
  1182. if (rep.RepeaterS == false)
  1183. {
  1184. MessageBox.Show(string.Format("์ค‘๊ณ„๊ธฐ๊ฒ€์ƒ‰ ์™„๋ฃŒ. ์ค‘๊ณ„๊ธฐ๋ฒˆํ˜ธ:{0}", RepeaterID));
  1185. }
  1186. else
  1187. {
  1188. MessageBox.Show(string.Format("์ค‘๊ณ„๊ธฐ๊ฒ€์ƒ‰ ์‹คํŒจ. ์ค‘๊ณ„๊ธฐ๋ฒˆํ˜ธ:{0}", RepeaterID));
  1189. }
  1190. btnRepeaterAllInfo_Click(btnRepeaterAllInfo, System.EventArgs.Empty); //์ค‘๊ณ„๊ธฐ ์ฝ๊ธฐ ๋ช…๋ น
  1191. }
  1192. }
  1193. catch (Exception ex)
  1194. {
  1195. Util.UErrorMessage(ex, 0, 0);
  1196. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  1197. }
  1198. finally
  1199. {
  1200. //๋ฒ„ํŠผ ๋น„ํ™œ์„ฑ ํ•ด์ œ
  1201. button_end(true);
  1202. }
  1203. }
  1204. private void btnInWrite_Click(object sender, EventArgs e)
  1205. {
  1206. try
  1207. {
  1208. if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
  1209. {
  1210. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1211. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1212. DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1213. int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
  1214. if (no <= 127)
  1215. {
  1216. SocketUI ui = this.mdi.ui;
  1217. //ํšŒ๋กœ
  1218. RepeaterPointUnit unit = GRIDCELL[no - 1].DeviceUnit;
  1219. RepeaterDeviceTypeInfo Info = GRIDCELL[no - 1].DeviceInfo;
  1220. if (Info == null || unit == null)
  1221. {
  1222. MessageBox.Show("ํšŒ๋กœ์„ค์ • ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์„์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค..ํ†ต์‹ ์ƒํƒœ๋ฅผ ํ™•์ธํ•˜์‹ญ์‹œ์š”..", Application.ProductName);
  1223. return;
  1224. }
  1225. if (MessageBox.Show("TEST์šฉ ํšŒ๋กœ๋งŒ ์ž…๋ ฅ์“ฐ๊ธฐ๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค..๊ทธ๋ž˜๋„ ์ž…๋ ฅ์“ฐ๊ธฐ๋ฅผ ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?", Application.ProductName, MessageBoxButtons.OKCancel)
  1226. == DialogResult.OK)
  1227. {
  1228. //int deviceNo = cell2.ColumnIndex + 1;
  1229. InputIDVo vo = new InputIDVo();
  1230. vo.ReceiverID = int.Parse(txtThisReceiverID.Text);
  1231. vo.CommID = 1;
  1232. vo.BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1233. vo.LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
  1234. vo.RepeaterID = no;
  1235. vo.RepeaterType = Info.RepeaterType;
  1236. vo.InoutType = "I";
  1237. InputDeviceStatus[] devData = new InputDeviceStatus[4]{ unit.Repeater_Input1
  1238. ,unit.Repeater_Input2
  1239. ,unit.Repeater_Input3
  1240. ,unit.Repeater_Input4};
  1241. vo.InputUnitData = devData;
  1242. IWin32Window window = this;
  1243. frmModalUnitDataSelect frm = new frmModalUnitDataSelect(Info); // cyim 2015.2.23 ํšŒ๋กœ์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1244. frm.InputVo = vo;
  1245. frm.ShowDialog(window);
  1246. vo = frm.InputVo;
  1247. //์ž…๋ ฅํ•œ ์ฝ”๋“œ๊ฐ€ ์žˆ๋‹ค๋ฉด
  1248. if (vo.InputOK)
  1249. {
  1250. devData = vo.InputUnitData;
  1251. //ํšŒ๋กœ
  1252. RepeaterData inputdata = new RepeaterData((byte)vo.RepeaterID);
  1253. inputdata.Set_Input_Data((int)devData[3], (int)devData[2], (int)devData[1], (int)devData[0]);
  1254. //์™„๋ฃŒ์ด๋ฒคํŠธ
  1255. dCommandResponse d = new dCommandResponse(RepeaterInputWriteComplete);
  1256. //๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  1257. CmdInfo cmd = new CmdInfo(prt_cmd_define.write_repeater_input_unit, mdi.myReceiverID, 1, vo.LoopNo, vo.BoardID, vo.RepeaterID, d);
  1258. cmd.CommandData = inputdata;
  1259. ui.runCommand(cmd);
  1260. }
  1261. }
  1262. }
  1263. }
  1264. }
  1265. catch (Exception ex)
  1266. {
  1267. Util.UErrorMessage(ex, 0, 0);
  1268. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1269. }
  1270. }
  1271. //์ค‘๊ณ„๊ธฐ ์ž…๋ ฅ์“ฐ๊ธฐ ์™„๋ฃŒ
  1272. public void RepeaterInputWriteComplete(CmdInfo cmd)
  1273. {
  1274. //์—๋Ÿฌ์‘๋‹ต์ฒ˜๋ฆฌ
  1275. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_WriteRepeaterInputUNIT")) // cyim 2015.7.23 NACK ์ฒ˜๋ฆฌ ๋ถ€๋ถ„ ์˜ค๋ฅ˜
  1276. {
  1277. button_end(true);
  1278. return;
  1279. }
  1280. try
  1281. {
  1282. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1283. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1284. if (BoardID == cmd.boardNo && cmd.loopNo == Loop)
  1285. {
  1286. int RepeaterID = cmd.repeaterNo;
  1287. RCVData_WriteRepeaterInputUNIT ResponseData = (RCVData_WriteRepeaterInputUNIT)cmd.ResponseData;
  1288. RepeaterPointUnit newdata = new RepeaterPointUnit(BoardID, ResponseData.Data);
  1289. //๋ฐ์ดํ„ฐ์ €์žฅ
  1290. ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //์ˆ˜์‹ ๊ธฐ์„ค์ •
  1291. BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(BoardID); //ํ†ต์‹ ๋ณด๋“œsavBoardID์˜ loop0์˜ ์„ค์ •๊ฐ’
  1292. RepeaterPointUnit[] repdata;
  1293. if (savLoop == 0)
  1294. {
  1295. repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  1296. }
  1297. else
  1298. {
  1299. repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  1300. }
  1301. repdata[RepeaterID - 1] = newdata;
  1302. //๊ฐ ์…€์— ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ ํ‘œ์‹œ
  1303. GRIDCELL[RepeaterID - 1].Set_DeviceUnit(newdata);
  1304. //dataGridView2์— ๋ฐ์ดํ„ฐ ํ‘œ์‹œ
  1305. RepeaterDeviceTypeInfo dev = GRIDCELL[RepeaterID - 1].DeviceInfo;
  1306. RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
  1307. DeviceStatus(dev, unit);
  1308. }
  1309. }
  1310. catch (Exception ex)
  1311. {
  1312. Util.UErrorMessage(ex, 0, 0);
  1313. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  1314. }
  1315. finally
  1316. {
  1317. //๋ฒ„ํŠผ ๋น„ํ™œ์„ฑ ํ•ด์ œ
  1318. button_end(true);
  1319. }
  1320. }
  1321. // cyim 2016.10.31 : ๊ณ„ํ†ต์ •๋ณด๋Š” 0,1,2,3 ์œผ๋กœ ๋ณ€๊ฒฝ
  1322. //์ค‘๊ณ„๊ธฐ ์ถœ๋ ฅ์“ฐ๊ธฐ ์™„๋ฃŒ
  1323. public void RepeaterOutputWriteComplete(CmdInfo cmd)
  1324. {
  1325. //์—๋Ÿฌ์‘๋‹ต์ฒ˜๋ฆฌ
  1326. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_WriteRepeaterOutputUNIT")) // cyim 2015.7.23 NACK ์ฒ˜๋ฆฌ ๋ถ€๋ถ„ ์˜ค๋ฅ˜
  1327. {
  1328. button_end(true);
  1329. return;
  1330. }
  1331. try
  1332. {
  1333. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1334. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1335. if (BoardID == cmd.boardNo && cmd.loopNo == Loop)
  1336. {
  1337. int RepeaterID = cmd.repeaterNo;
  1338. RCVData_WriteRepeaterOutputUNIT ResponseData = (RCVData_WriteRepeaterOutputUNIT)cmd.ResponseData;
  1339. RepeaterPointUnit newdata = new RepeaterPointUnit(BoardID, ResponseData.Data);
  1340. //๋ฐ์ดํ„ฐ์ €์žฅ
  1341. ReceiverTypeInfo Receiverinfo = mdi.ui.MyReceiverTypeInfo; //์ˆ˜์‹ ๊ธฐ์„ค์ •
  1342. BoardTypeInfo brdinfo = Receiverinfo.Get_RepeaterType(BoardID); //ํ†ต์‹ ๋ณด๋“œsavBoardID์˜ loop0์˜ ์„ค์ •๊ฐ’
  1343. RepeaterPointUnit[] repdata;
  1344. if (savLoop == 0)
  1345. {
  1346. repdata = brdinfo.Loop0_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  1347. }
  1348. else if (savLoop == 1)
  1349. {
  1350. repdata = brdinfo.Loop1_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  1351. }
  1352. else if (savLoop == 2)
  1353. {
  1354. repdata = brdinfo.Loop2_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  1355. }
  1356. else if (savLoop == 3)
  1357. {
  1358. repdata = brdinfo.Loop3_RepeaterUnit_Data; //127๊ฐœ ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ
  1359. }
  1360. else
  1361. {
  1362. repdata = null;
  1363. }
  1364. repdata[RepeaterID - 1] = newdata;
  1365. //๊ฐ ์…€์— ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํ„ฐ ํ‘œ์‹œ
  1366. GRIDCELL[RepeaterID - 1].Set_DeviceUnit(newdata);
  1367. //dataGridView2์— ๋ฐ์ดํ„ฐ ํ‘œ์‹œ
  1368. RepeaterDeviceTypeInfo dev = GRIDCELL[RepeaterID - 1].DeviceInfo;
  1369. RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
  1370. DeviceStatus(dev, unit);
  1371. if (this.tRepeaterReadThreadStatus == 1)
  1372. {
  1373. this.tRepeaterReadThread = new Thread(this.RepeaterInfoRead);
  1374. this.tRepeaterReadThreadStatus = 1;
  1375. this.tRepeaterReadThread.Start();
  1376. }
  1377. }
  1378. }
  1379. catch (Exception ex)
  1380. {
  1381. Util.UErrorMessage(ex, 0, 0);
  1382. }
  1383. finally
  1384. {
  1385. //๋ฒ„ํŠผ ๋น„ํ™œ์„ฑ ํ•ด์ œ
  1386. button_end(true);
  1387. }
  1388. }
  1389. // ์“ฐ๊ธฐ๋ฒ„ํŠผ
  1390. private void btnOutWrite_Click(object sender, EventArgs e)
  1391. {
  1392. try
  1393. {
  1394. if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
  1395. {
  1396. // ์ƒ์œ„์— ํ†ต์‹ ๋ณด๋“œ ์•„์ด๋””์™€ ์ฑ„๋„๊ณ„ํ†ต ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค
  1397. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1398. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1399. // ์ค‘๊ณ„๊ธฐ ์ธ๋ฑ์Šค
  1400. DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1401. int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
  1402. if (no <= 127)
  1403. {
  1404. SocketUI ui = this.mdi.ui;
  1405. //
  1406. // ํšŒ๋กœ ์ •๋ณด
  1407. //
  1408. RepeaterPointUnit unit = GRIDCELL[no - 1].DeviceUnit;
  1409. RepeaterDeviceTypeInfo Info = GRIDCELL[no - 1].DeviceInfo;
  1410. if (Info == null || unit == null)
  1411. {
  1412. MessageBox.Show("ํšŒ๋กœ์„ค์ • ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์„์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค", Application.ProductName);
  1413. return;
  1414. }
  1415. // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1416. if (LoopCut() == true
  1417. // cyim 2015.2.23 ์ค‘๊ณ„๊ธฐ์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1418. || Info.CutFlag == true)
  1419. {
  1420. MessageBox.Show("์ฐจ๋‹จ์ค‘์—๋Š” ์‚ฌ์šฉํ• ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค", Application.ProductName);
  1421. return;
  1422. }
  1423. // cyim 2015.2.24 ํ†ต์‹ ์—๋Ÿฌ๋Š” ์“ฐ๊ธฐ ๊ธˆ์ง€
  1424. if (unit.RepeaterErr == true)
  1425. {
  1426. MessageBox.Show("ํ†ต์‹  ์—๋Ÿฌ์ค‘์—๋Š” ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค", Application.ProductName);
  1427. return;
  1428. }
  1429. //
  1430. // ์ถœ๋ ฅ ํšŒ๋กœ ๊ฐ’ ์“ฐ๊ธฐ
  1431. //
  1432. if (MessageBox.Show("์‹ค์ œ๋กœ ํ™”์žฌ ๋ฐ ์„ค๋น„ ์—ฐ๋™๊ฐ์ง€๊ฐ€ ๋ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜๋„ ์ถœ๋ ฅ์“ฐ๊ธฐ๋ฅผ ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?", Application.ProductName, MessageBoxButtons.OKCancel)
  1433. == DialogResult.OK)
  1434. {
  1435. //
  1436. // ํšŒ๋กœ ์ •๋ณด๋ฅผ ๋‹ด๋Š” ํด๋ž˜์Šค
  1437. //
  1438. InputIDVo vo = new InputIDVo();
  1439. vo.ReceiverID = int.Parse(txtThisReceiverID.Text);
  1440. vo.CommID = 1;
  1441. vo.BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1442. vo.LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
  1443. vo.RepeaterID = no;
  1444. vo.RepeaterType = Info.RepeaterType;
  1445. vo.InoutType = "O";
  1446. //
  1447. // ์ถœ๋ ฅ๋””๋ฐ”์ด์Šค ์ƒํƒœ (InputIDVo ์ „์šฉ)
  1448. //
  1449. //์ถœ๋ ฅํšŒ๋กœ์ƒํƒœ๊ฐ’ ์ดˆ๊ธฐ์ƒํƒœ(-1),์ถœ๋ ฅ์—†์Œ(0),์ถœ๋ ฅ์žˆ์Œ(1),์ฐจ๋‹จ(3)
  1450. //public enum OutputDeviceStatus { Init = -1, NotWrite = 0, Write = 1, Blocking = 3 }
  1451. OutputDeviceStatus[] devData = new OutputDeviceStatus[4]{
  1452. unit.Repeater_Output1 // NotWrite
  1453. ,unit.Repeater_Output2 // NotWrite
  1454. ,unit.Repeater_Output3 // NotWrite
  1455. ,unit.Repeater_Output4};// NotWrite
  1456. // ์ถœ๋ ฅ๋””๋ฐ”์ด์Šค ์ƒํƒœ ์ถ”๊ฐ€
  1457. vo.OutputUnitData = devData;
  1458. //
  1459. // ๋ชจ๋‹ฌ๋Œ€ํ™”์ƒ์ž๋ฅผ ์ถœ๋ ฅ
  1460. //
  1461. IWin32Window window = this;
  1462. frmModalUnitDataSelect frm = new frmModalUnitDataSelect(Info); // cyim 2015.2.23 ํšŒ๋กœ์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1463. frm.InputVo = vo;
  1464. frm.ShowDialog(window);
  1465. vo = frm.InputVo; // ๋‹ค์ด์–ผ๋กœ๊ทธ ์ถœ๋ ฅ์ดํ›„ ์›ํ•˜๋Š” ํšŒ๋กœ๊ฐ’์ด ์ƒ์ดํ•จ
  1466. // ํ™•์ธ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฆ„ (์ž…๋ ฅํ•œ ์ฝ”๋“œ๊ฐ€ ์žˆ๋‹ค๋ฉด)
  1467. if (vo.InputOK)
  1468. {
  1469. // cyim 2013.9.3 ์ถœ๋ ฅ์“ฐ๊ธฐ ์‹œ๋„์‹œ ํ…Œ์ŠคํŠธ ๋ชจ๋“œ๋กœ ์ง„์ž…
  1470. this.mdi.SetInputTestMode(true);
  1471. // cyim 2015.2.27 ์ถœ๋ ฅ ์“ฐ๊ธฐ ์‚ฌ์šฉ์ค‘
  1472. mdi.CommandLog(MappingStatus.Log, string.Format("์ถœ๋ ฅํ…Œ์ŠคํŠธ ์‹คํ–‰ CommID:{0},LoopNo:{1},BoardID:{2},RepeaterID:{3},devID:{4}-{5}-{6}-{7}",
  1473. vo.CommID, vo.LoopNo, vo.BoardID, vo.RepeaterID, vo.OutputUnitData[0], vo.OutputUnitData[1], vo.OutputUnitData[2], vo.OutputUnitData[3]));
  1474. // ์ค‘๊ณ„๊ธฐ ๋ฐ์ดํƒ€
  1475. RepeaterData outputdata = new RepeaterData((byte)vo.RepeaterID);
  1476. devData = vo.OutputUnitData;
  1477. outputdata.Set_Output_Data(
  1478. devData[3] == OutputDeviceStatus.Blocking ? true : false
  1479. , devData[2] == OutputDeviceStatus.Blocking ? true : false
  1480. , devData[1] == OutputDeviceStatus.Blocking ? true : false
  1481. , devData[0] == OutputDeviceStatus.Blocking ? true : false
  1482. , devData[3] == OutputDeviceStatus.Write ? true : false
  1483. , devData[2] == OutputDeviceStatus.Write ? true : false
  1484. , devData[1] == OutputDeviceStatus.Write ? true : false
  1485. , devData[0] == OutputDeviceStatus.Write ? true : false
  1486. );
  1487. //์™„๋ฃŒ์ด๋ฒคํŠธ
  1488. dCommandResponse d = new dCommandResponse(RepeaterOutputWriteComplete);
  1489. //๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  1490. CmdInfo cmd = new CmdInfo(
  1491. prt_cmd_define.write_repeater_output_unit,
  1492. mdi.myReceiverID, // ์ˆ˜์‹ ๊ธฐ ์•„์ด๋””
  1493. 1, // CommID (1-ํ†ต์‹ ๋ณด๋“œ 3-IO๋ณด๋“œ 4-KEYPAD 5-๋น„์ƒ๋ฐฉ์†ก)
  1494. vo.LoopNo, //์ฑ„๋„๊ณ„ํ†ต
  1495. vo.BoardID, // ํ†ต์‹ ๋ณด๋“œ
  1496. vo.RepeaterID, // ์ค‘๊ณ„๊ธฐ ์•„์ด๋””
  1497. d); // ์™„๋ฃŒ์ด๋ฒคํŠธ
  1498. cmd.CommandData = outputdata;
  1499. ui.runCommand(cmd);
  1500. //์—ฐ๋™์œผ๋กœ ์ธํ•ด ์ถœ๋ ฅ๊ฐ’์ด ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ๊ณ„์† ์ฝ๋Š”๋‹ค..
  1501. //this.tRepeaterReadThread = new Thread(this.RepeaterInfoRead);
  1502. this.tRepeaterReadThreadStatus = 1;
  1503. //this.tRepeaterReadThread.Start();
  1504. }
  1505. }
  1506. }
  1507. }
  1508. }
  1509. catch (Exception ex)
  1510. {
  1511. Util.UErrorMessage(ex, 0, 0);
  1512. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1513. }
  1514. }
  1515. private void timer1_Tick(object sender, EventArgs e)
  1516. {
  1517. this.btnRepeaterAllInfo_Click(null, null);
  1518. }
  1519. // ๋”๋ธ” ํด๋ฆญ์‹œ ์ž…๋ ฅ ๊ฐ•์ œ ํ…Œ์ŠคํŠธ ์‹คํ–‰
  1520. private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1521. {
  1522. try
  1523. {
  1524. // ์ž…๋ ฅ์‹ ํ˜ธ ์ค‘ 1๊ฐœ ์„ ํƒ์‹œ์—๋งŒ ๋™์ž‘
  1525. if (this.dataGridView_Repeater_Sub.SelectedCells.Count == 1)
  1526. {
  1527. DataGridViewCell cell = this.dataGridView_Repeater_Sub.SelectedCells[0];
  1528. // ์ž…๋ ฅ ํšŒ๋กœ ์„ ํƒ์‹œ
  1529. if (cell.RowIndex == 0)
  1530. {
  1531. // ์ƒ๋‹จ์˜ ๊ณ„ํ†ต๊ฒ€์ƒ‰ UI
  1532. int CommID = 1;
  1533. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1534. int LoopNo = Util.StrToInt(txtLoopNo.Text, 0);
  1535. // ์ƒ๋‹จ์˜ ์ค‘๊ณ„๊ธฐ UI
  1536. DataGridViewCell repCell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1537. int RepeaterID = (repCell.RowIndex * 10) + repCell.ColumnIndex + 1;
  1538. int devID = cell.ColumnIndex + 1;
  1539. // cyim 2015.7.6 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ๋Š” ์ž…๋ ฅํ…Œ์ŠคํŠธ ๋ถˆ๊ฐ€
  1540. if (AnalogDetecterRepeaterID_Hashtable.ContainsKey(RepeaterID.ToString()) == true)
  1541. {
  1542. MessageBox.Show("์ค‘๊ณ„๊ธฐ ํƒ€์ž… 2*2 ํ˜น์€ 4*4 ๋งŒ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค", Application.ProductName);
  1543. return;
  1544. }
  1545. // cyim 2014.4.3 ์ž…๋ ฅ ๊ฐ•์ œ ์‹œํ—˜์‹œ์— ํšŒ๋กœ์ •๋ณด๊ฐ€ ์—†๋Š”์ง€ ํ™•์ธ
  1546. //
  1547. // ํšŒ๋กœ ์ •๋ณด
  1548. //
  1549. RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
  1550. RepeaterDeviceTypeInfo Info = GRIDCELL[RepeaterID - 1].DeviceInfo;
  1551. if (Info == null || unit == null)
  1552. {
  1553. MessageBox.Show("ํšŒ๋กœ์„ค์ • ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์„์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค", Application.ProductName);
  1554. return;
  1555. }
  1556. // cyim 2015.2.23 ํšŒ๋กœ์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1557. if (Info.inDeviceTypeInfos[devID - 1].CutFlag == true
  1558. // cyim 2015.2.23 ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1559. || LoopCut() == true
  1560. // cyim 2015.2.23 ์ค‘๊ณ„๊ธฐ์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1561. || Info.CutFlag == true)
  1562. {
  1563. MessageBox.Show("์ฐจ๋‹จ์ค‘์—๋Š” ์‚ฌ์šฉํ• ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค", Application.ProductName);
  1564. return;
  1565. }
  1566. //if (MessageBox.Show(string.Format("cell = {0} {1} {2} {3} {4}", CommID, BoardID, LoopNo, RepeaterID, devID), "", MessageBoxButtons.OKCancel) == DialogResult.OK) {
  1567. if (MessageBox.Show(string.Format("์ž…๋ ฅ ๊ฐ•์ œ ์‹œํ—˜์„ ํ•˜๊ฒ ์Šต๋‹ˆ๊นŒ? ์ถœ๋ ฅ ์—ฐ๋™์ด ๋ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค"), "์ž…๋ ฅ ์‹œํ—˜", MessageBoxButtons.OKCancel) == DialogResult.OK)
  1568. {
  1569. this.mdi.SetInputTestMode(true);
  1570. SocketUI ui = mdi.ui;
  1571. //๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  1572. //์ค‘๊ณ„๊ธฐ ์„ค์ • ๋ฐ์ดํ„ฐ๋ฅผ CmdInfo์— ๋„ฃ์–ด์ค€๋‹ค..
  1573. CmdInfo cmd = new CmdInfo(
  1574. prt_cmd_define.write_repeater_input_unit,
  1575. mdi.myReceiverID,
  1576. CommID,
  1577. LoopNo,
  1578. BoardID,
  1579. RepeaterID,
  1580. null);
  1581. // cyim 2015.2.27 ์ž…๋ ฅ ์“ฐ๊ธฐ ํ…Œ์ŠคํŠธ ๋ชจ๋“œ ์‚ฌ์šฉ์ค‘
  1582. mdi.CommandLog(MappingStatus.Log, string.Format("์ž…๋ ฅํ…Œ์ŠคํŠธ ์‹คํ–‰ CommID:{0},LoopNo:{1},BoardID:{2},RepeaterID:{3},devID:{4}", CommID, LoopNo, BoardID, RepeaterID, devID));
  1583. switch (devID)
  1584. {
  1585. case 1:
  1586. {
  1587. cmd.CommandData = (byte)0xFC;
  1588. break;
  1589. }
  1590. case 2:
  1591. {
  1592. cmd.CommandData = (byte)0xF3;
  1593. break;
  1594. }
  1595. case 3:
  1596. {
  1597. cmd.CommandData = (byte)0xCF;
  1598. break;
  1599. }
  1600. case 4:
  1601. {
  1602. cmd.CommandData = (byte)0x3F;
  1603. break;
  1604. }
  1605. }
  1606. ui.runCommand(cmd);
  1607. }
  1608. }
  1609. }
  1610. }
  1611. catch (Exception ex)
  1612. {
  1613. Util.UErrorMessage(ex, 0, 0);
  1614. }
  1615. }
  1616. // cyim 2013.3.13
  1617. // ์ž…๋ ฅ์“ฐ๊ธฐ ํ…Œ์ŠคํŠธ ์ดํ›„ ๋ณต๊ตฌ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์„œ ์ค‘๊ณ„๊ธฐ ๋ณ„๋กœ ๋ณต๊ตฌํ•˜๋„๋ก ๋ช…๋ นํ•œ๋‹ค
  1618. // ์ค‘๊ณ„๊ธฐ ๋ณต๊ตฌ
  1619. private void btnRepeaterReset_Click(object sender, EventArgs e)
  1620. {
  1621. try
  1622. {
  1623. if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
  1624. {
  1625. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1626. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1627. DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1628. int no = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
  1629. if (no <= 127)
  1630. {
  1631. //2019-12-10 ์ˆ˜์ • QAํŒŒํŠธ ์š”์ฒญ
  1632. //if (MessageBox.Show(string.Format("์ค‘๊ณ„๊ธฐ [" + no + "] ๋ฅผ ๋ณต๊ตฌํ• ๊นŒ์š”?"), "์ค‘๊ณ„๊ธฐ ๋ณต๊ตฌ", MessageBoxButtons.OKCancel) == DialogResult.OK)
  1633. if (MessageBox.Show(string.Format(Loop + "๋ฒˆ Loop๋ฅผ ๋ณต๊ตฌํ• ๊นŒ์š”?"), "์ค‘๊ณ„๊ธฐ ๋ณต๊ตฌ", MessageBoxButtons.OKCancel) == DialogResult.OK)
  1634. {
  1635. // MDIParent
  1636. LFC.Log("ํƒ€์ž…: ์ˆ˜์‹ ๊ธฐ ์กฐ์ž‘ ๋กœ๊ทธ, ๋ฉ”์„ธ์ง€: ์ค‘๊ณ„๊ธฐ ๊ฐœ๋ณ„๋ณต๊ตฌ ์‹คํ–‰");
  1637. SocketUI ui = this.mdi.ui;
  1638. //์™„๋ฃŒ์ด๋ฒคํŠธ (์‚ฌ์šฉ๋˜์–ด์•ผ ํ• ์ง€๋Š” ๋ฏธ์ง€์ˆ˜)
  1639. dCommandResponse d = new dCommandResponse(RepeaterRecoverComplete);
  1640. //๋ช…๋ น์ƒ์„ฑ ๋ฐ ์‹คํ–‰
  1641. CmdInfo cmd = new CmdInfo(
  1642. prt_cmd_define.reset_repeater_all, // ์ค‘๊ณ„๊ธฐ Block ๋ณต๊ตฌ
  1643. mdi.myReceiverID,
  1644. 1, // ์ปดํฌํŠธ ์•„์ด๋””
  1645. Loop, // ์ฑ„๋„๊ณ„ํ†ต
  1646. BoardID, // ํ†ต์‹ ๋ณด๋“œ
  1647. no, // ์ค‘๊ณ„๊ธฐ ์•„์ด๋””
  1648. null);
  1649. ui.runCommand(cmd);
  1650. }
  1651. }
  1652. }
  1653. }
  1654. catch (Exception ex)
  1655. {
  1656. Util.UErrorMessage(ex, 0, 0);
  1657. //MessageBox.Show(ex.Message, Application.ProductName);
  1658. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1659. }
  1660. }
  1661. // cyim 2015.6.8 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ์—ฐ๋™ ์ถ”๊ฐ€
  1662. // ์ค‘๊ณ„๊ธฐ ์ƒํƒœ๋ณด๊ธฐ ๋ฉ”์ธ - ์…€์„ ๋”๋ธ” ํด๋ฆญํ•˜๋Š” ๊ฒฝ์šฐ
  1663. private void dataGridView_Repeater_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1664. {
  1665. if (this.dataGridView_Repeater_Main.SelectedCells.Count > 0)
  1666. {
  1667. //int CommID = 1;
  1668. // ๋ณด๋“œ ์•„์ด๋””
  1669. int BoardID = Util.StrToInt(txtBoardID.Text, 0);
  1670. // ๋ฃจํ”„ ๋ฒˆํ˜ธ
  1671. int Loop = Util.StrToInt(txtLoopNo.Text, -1);
  1672. // ์ค‘๊ณ„๊ธฐ ์•„์ด๋””
  1673. DataGridViewCell cell = this.dataGridView_Repeater_Main.SelectedCells[0];
  1674. int RepeaterID = (cell.RowIndex * 10) + cell.ColumnIndex + 1;
  1675. RepeaterPointUnit unit = GRIDCELL[RepeaterID - 1].DeviceUnit;
  1676. RepeaterDeviceTypeInfo Info = GRIDCELL[RepeaterID - 1].DeviceInfo;
  1677. if (Info == null || unit == null)
  1678. {
  1679. MessageBox.Show("ํšŒ๋กœ์„ค์ • ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์„์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค..", Application.ProductName);
  1680. return;
  1681. }
  1682. // ๊ณ„ํ†ต์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1683. if (LoopCut() == true
  1684. // ์ค‘๊ณ„๊ธฐ์ฐจ๋‹จ์‹œ์—๋Š” ์‚ฌ์šฉ๋ถˆ๊ฐ€
  1685. || Info.CutFlag == true)
  1686. {
  1687. MessageBox.Show("์ฐจ๋‹จ์ค‘์—๋Š” ์‚ฌ์šฉํ• ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค..", Application.ProductName);
  1688. return;
  1689. }
  1690. // ์ฐฝ์€ ํ•˜๋‚˜๋งŒ ๋„์šฐ๋„๋ก ํ•จ
  1691. if (mdi.AnalogDetect.Form_Active_AnalogDetecter == true) // cyim 2015.8.4 ์ˆ˜์‹ ๋ฐ˜์„ ์œ„ํ•œ static ํด๋ž˜์Šค ์ •๋ฆฌ
  1692. {
  1693. MessageBox.Show("์ด๋ฏธ ์‹คํ–‰์ค‘์ž…๋‹ˆ๋‹ค...", Application.ProductName);
  1694. return;
  1695. }
  1696. /*
  1697. if (FormRepeater != null)
  1698. {
  1699. FormRepeater.Close();
  1700. }
  1701. FormRepeater = new FormRepeater(this.mdi);
  1702. FormRepeater.Owner = this;
  1703. FormRepeater.Visible = false;
  1704. FormRepeater.Show();// ๋ฐ์ดํƒ€๋ฅผ ์•„์ง ํ‘œ์‹œํ•˜์ง€ ์•Š์•˜์œผ๋ฏ€๋กœ ํ‘œ์‹œ๋Š” ํ•˜์ง€ ์•Š๋Š”๋‹ค.
  1705. FormRepeater.Visible = false;
  1706. string[] Input_locatin = new string[4];
  1707. string[] output_locatin = new string[4];
  1708. string[] Input_context = new string[4];
  1709. string[] output_context = new string[4];
  1710. string[] Input_circuit = new string[4];
  1711. string[] output_circuit = new string[4];
  1712. string InOut_Type = "I";
  1713. //ํšŒ๋กœ์„ค์ •๊ฐ’
  1714. DacUIProcess dacUIProcess = new DacUIProcess(mdi.myReceiverID); // cyim 2015.7.30 ๋ฐ์ดํƒ€๋ฒ ์ด์Šค ์ ‘์† ๋ฃจํ‹ด ๋ณ€๊ฒฝ
  1715. for (var i = 0; i < 4; i++)
  1716. {
  1717. DataTable dt2 = dacUIProcess.Device_Select(mdi.myReceiverID, CommID, BoardID, Loop, RepeaterID, i + 1, InOut_Type);
  1718. foreach (DataRow dr2 in dt2.Rows)
  1719. {
  1720. Input_context[i] = Util.NullToStr(dr2["DEVICE_TYPE_NAME"]);
  1721. Input_locatin[i] = Util.NullToStr(dr2["POSITION_NAME"]);
  1722. Input_circuit[i] = Util.NullToStr(dr2["DEVICE_NAME"]);
  1723. }
  1724. dt2.Clear();
  1725. dt2.Dispose();
  1726. }
  1727. InOut_Type = "O";
  1728. for (var i = 0; i < 4; i++)
  1729. {
  1730. DataTable dt2 = dacUIProcess.Device_Select(mdi.myReceiverID, CommID, BoardID, Loop, RepeaterID, i + 1, InOut_Type);
  1731. foreach (DataRow dr2 in dt2.Rows)
  1732. {
  1733. output_context[i] = Util.NullToStr(dr2["DEVICE_TYPE_NAME"]);
  1734. output_locatin[i] = Util.NullToStr(dr2["POSITION_NAME"]);
  1735. output_circuit[i] = Util.NullToStr(dr2["DEVICE_NAME"]);
  1736. }
  1737. dt2.Clear();
  1738. dt2.Dispose();
  1739. }
  1740. // ์ž…๋ ฅ
  1741. FormRepeater.SetInputContext1(string.Format(
  1742. "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input1, Info.inDeviceTypeInfos[0]) +
  1743. "\r\n\r\n" + Input_context[0] +
  1744. "\r\n\r\n" + Input_locatin[0] +
  1745. "\r\n\r\n" + Input_circuit[0]));
  1746. FormRepeater.SetInputContext2(string.Format(
  1747. "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input2, Info.inDeviceTypeInfos[1]) +
  1748. "\r\n\r\n" + Input_context[1] +
  1749. "\r\n\r\n" + Input_locatin[1] +
  1750. "\r\n\r\n" + Input_circuit[1]));
  1751. FormRepeater.SetInputContext3(string.Format(
  1752. "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input3, Info.inDeviceTypeInfos[2]) +
  1753. "\r\n\r\n" + Input_context[2] +
  1754. "\r\n\r\n" + Input_locatin[2] +
  1755. "\r\n\r\n" + Input_circuit[2]));
  1756. FormRepeater.SetInputContext4(string.Format(
  1757. "\r\n" + DeviceStatusText.InputText(unit.Repeater_Input4, Info.inDeviceTypeInfos[3]) +
  1758. "\r\n\r\n" + Input_context[3] +
  1759. "\r\n\r\n" + Input_locatin[3] +
  1760. "\r\n\r\n" + Input_circuit[3]));
  1761. // ์ถœ๋ ฅํšŒ๋กœ
  1762. FormRepeater.SetOutPutText1(string.Format(
  1763. "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output1, Info.outDeviceTypeInfos[0]) +
  1764. "\r\n\r\n" + output_context[0] +
  1765. "\r\n\r\n" + output_locatin[0] +
  1766. "\r\n\r\n" + output_circuit[0]));
  1767. FormRepeater.SetOutPutText2(string.Format(
  1768. "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output2, Info.outDeviceTypeInfos[1]) +
  1769. "\r\n\r\n" + output_context[1] +
  1770. "\r\n\r\n" + output_locatin[1] +
  1771. "\r\n\r\n" + output_circuit[1]));
  1772. FormRepeater.SetOutPutText3(string.Format(
  1773. "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output3, Info.outDeviceTypeInfos[2]) +
  1774. "\r\n\r\n" + output_context[2] +
  1775. "\r\n\r\n" + output_locatin[2] +
  1776. "\r\n\r\n" + output_circuit[2]));
  1777. FormRepeater.SetOutPutText4(string.Format(
  1778. "\r\n" + DeviceStatusText.OutputText(unit.Repeater_Output4, Info.outDeviceTypeInfos[3]) +
  1779. "\r\n\r\n" + output_context[3] +
  1780. "\r\n\r\n" + output_locatin[3] +
  1781. "\r\n\r\n" + output_circuit[3]));
  1782. // ์œ„์น˜
  1783. FormRepeater.Location = new Point(Control.MousePosition.X + 5, Control.MousePosition.Y + 5);
  1784. //ํ‘œ์‹œ
  1785. FormRepeater.Visible = true;
  1786. */
  1787. // ํ•ด๋‹น ์…€์ด ์ค‘๊ณ„๊ธฐ๊ฐ€ ์•„๋‹Œ ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ์ธ ๊ฒฝ์šฐ์— ํ•œํ•˜์—ฌ
  1788. if (Info.RepeaterType.Equals("A") == true || Info.RepeaterType.Equals("B") == true)
  1789. {
  1790. // ํŠน๋ณ„ํžˆ ๊ฒฝ๊ณ  ํŒ์—…์€ ์ƒ์„ฑํ•˜์ง€ ์•Š๋Š”๋‹ค
  1791. return;
  1792. }
  1793. // cyim 2016.01.07 ์•„๋‚ ๋กœ๊ทธ ๊ฐ์ง€๊ธฐ ํ†ต์‹ ์ด์ƒ, ์กด์žฌํ•˜์ง€์•Š์Œ์˜ ๊ฒฝ์šฐ์—๋Š” ๋”๋ธ”ํด๋ฆญ์„ ๋ชปํ•˜๋„๋ก ํ•จ
  1794. if (unit.RepeaterNon == true // ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ฐ์ง€๊ธฐ
  1795. || unit.RepeaterErr == true // ๊ฐ์ง€๊ธฐ ํ†ต์‹  ์—๋Ÿฌ
  1796. || unit.RepeaterErr == true // ๊ฐ์ง€๊ธฐ ์ „์› ์ด์ƒ
  1797. )
  1798. {
  1799. // ํŠน๋ณ„ํžˆ ๊ฒฝ๊ณ  ํŒ์—…์€ ์ƒ์„ฑํ•˜์ง€ ์•Š๋Š”๋‹ค
  1800. return;
  1801. }
  1802. mdi = (MDIParent)this.MdiParent;
  1803. txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
  1804. Form_AnalogDetecter AnalogDetecter = new Form_AnalogDetecter(
  1805. string.Format("{0:00}", mdi.myReceiverID),
  1806. string.Format("{0:000}", BoardID),
  1807. string.Format("{0:000}", Loop),
  1808. string.Format("{0:000}", RepeaterID),
  1809. Info.RepeaterType.ToString(),
  1810. mdi);
  1811. AnalogDetecter.Show();
  1812. }
  1813. }
  1814. }
  1815. }