UIControl.cs 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using System.Drawing;
  6. using System.Diagnostics;
  7. namespace FPER
  8. {
  9. // cyim 2015.7.1 입력회로 상태값 추가
  10. //입력회로상태값 초기상태(-1),감지(0),정상(1),단선(3),PreFire(4)
  11. public enum InputDeviceStatus { Init = -1, Use = 0, Normal = 1, Blocking = 3, PreFire = 4 }
  12. //출력회로상태값 초기상태(-1),출력없음(0),출력있음(1),차단(3)
  13. public enum OutputDeviceStatus { Init = -1, NotWrite = 0, Write = 1, Blocking = 3 }
  14. //입력출력회로 상태 text표시----------------------------------------------------시작
  15. static public class DeviceStatusText
  16. {
  17. static public String InputText(InputDeviceStatus ins, bool cutFlag)
  18. {
  19. String toText = "";
  20. try
  21. {
  22. if (cutFlag)
  23. {
  24. toText = "차단";
  25. }
  26. else
  27. {
  28. switch (ins)
  29. {
  30. case InputDeviceStatus.Init: toText = " - "; break;
  31. case InputDeviceStatus.Use: toText = "감지"; break;
  32. case InputDeviceStatus.Normal: toText = "정상"; break;
  33. case InputDeviceStatus.Blocking: toText = "단선"; break;
  34. case InputDeviceStatus.PreFire: toText = "PreFire"; break; // cyim 2015.7.1 입력회로 상태값 추가
  35. }
  36. }
  37. }
  38. catch (Exception ex)
  39. {
  40. Util.UErrorMessage(ex, 0, 0);
  41. }
  42. return toText;
  43. }
  44. static public String InputText(InputDeviceStatus ins, DeviceTypeInfo dev)
  45. {//sdkim, 2011.11.22, don't use device => ' - '
  46. String toText = " - ";
  47. try
  48. {
  49. if (dev == null || !dev.UseFlag)
  50. {
  51. toText = " - ";
  52. }
  53. else if (dev.CutFlag)
  54. {
  55. toText = "차단";
  56. }
  57. else
  58. {
  59. switch (ins)
  60. {
  61. case InputDeviceStatus.Init:
  62. toText = " - ";
  63. break;
  64. case InputDeviceStatus.Use:
  65. toText = "감지";
  66. break;
  67. case InputDeviceStatus.Normal:
  68. toText = "정상";
  69. break;
  70. case InputDeviceStatus.Blocking:
  71. toText = "단선";
  72. break;
  73. case InputDeviceStatus.PreFire: // cyim 2015.7.1 입력회로 상태값 추가
  74. toText = "PreFire";
  75. break;
  76. }
  77. }
  78. }
  79. catch (Exception ex)
  80. {
  81. Util.UErrorMessage(ex, 0, 0);
  82. }
  83. return toText;
  84. }
  85. static public String OutputText(OutputDeviceStatus outs, bool cutFlag)
  86. {
  87. String outText = "";
  88. try
  89. {
  90. if (cutFlag)
  91. {
  92. outText = "차단";
  93. }
  94. else
  95. {
  96. switch (outs)
  97. {
  98. case OutputDeviceStatus.NotWrite: outText = "정상"; break;
  99. case OutputDeviceStatus.Write: outText = "출력"; break;
  100. case OutputDeviceStatus.Blocking: outText = "차단"; break;
  101. }
  102. }
  103. }
  104. catch (Exception ex)
  105. {
  106. Util.UErrorMessage(ex, 0, 0);
  107. }
  108. return outText;
  109. }
  110. static public String OutputText(OutputDeviceStatus outs, DeviceTypeInfo dev)
  111. {//sdkim, 2011.11.22, don't use device => ' - ' , 없음 => 꺼짐, 출력 => 동작
  112. String outText = " - ";
  113. try
  114. {
  115. if (dev == null || !dev.UseFlag)
  116. {
  117. outText = " - ";
  118. }
  119. else if (dev.CutFlag)
  120. {
  121. outText = "차단";
  122. }
  123. else
  124. {
  125. switch (outs)
  126. {
  127. case OutputDeviceStatus.NotWrite:
  128. outText = "꺼짐";
  129. break;
  130. case OutputDeviceStatus.Write:
  131. outText = "동작";
  132. break;
  133. case OutputDeviceStatus.Blocking:
  134. outText = "차단";
  135. break;
  136. }
  137. }
  138. }
  139. catch (Exception ex)
  140. {
  141. Util.UErrorMessage(ex, 0, 0);
  142. }
  143. return outText;
  144. }
  145. }
  146. //입력출력회로 상태 text표시----------------------------------------------------끝
  147. /************************************************************************************************************************/
  148. /* DataGridView에 중계기 표시 class -frmRepeaterGroup [시작] */
  149. /************************************************************************************************************************/
  150. public class GridRepeater
  151. {
  152. DataGridViewCell repCell;
  153. //int repNo = -1;
  154. ImageList backmg;
  155. bool loopCutFlag = false;
  156. //중계기회로 설정값
  157. RepeaterDeviceTypeInfo dev;
  158. //중계기회로데이터값
  159. RepeaterPointUnit unit = null;
  160. public RepeaterPointUnit Unit { get { return this.unit; } }
  161. //중계기 상태메세지
  162. String infoMessage = "";
  163. public GridRepeater(DataGridViewCell repCell, ImageList backmg, int repNo)
  164. {
  165. try
  166. {
  167. this.repCell = repCell;
  168. this.backmg = backmg;
  169. //if (repNo <= 127)
  170. //{
  171. this.repCell.Value = this.backmg.Images[0]; //정상
  172. //}
  173. //else
  174. //{
  175. // this.repCell.Value = this.backmg.Images[3]; //없음
  176. //}
  177. }
  178. catch (Exception ex)
  179. {
  180. Util.UErrorMessage(ex, 0, 0);
  181. }
  182. }
  183. // cyim 2015.7.2 중계기 및 회로 설정값 중복루틴 제거, 하단코드는 dev 변수 처리외, Set_DeviceUnit 와 동일하므로 삭제해버림
  184. //중계기및회로 설정값 넣기
  185. public void Set_DeviceInfo(RepeaterDeviceTypeInfo dev)
  186. {
  187. try
  188. {
  189. this.dev = dev;
  190. //if (this.dev == null)
  191. //{
  192. // if (this.loopCutFlag) repCell.Value = new Bitmap(this.backmg.Images[1]); //차단이미지
  193. // return;
  194. //}
  195. //if (this.dev.UseFlag)
  196. //{
  197. // //중계기타입별 표시
  198. // if (this.dev.RepeaterType.Equals("A")) repCell.Value = A_typeImage();
  199. // else if (this.dev.RepeaterType.Equals("B")) repCell.Value = B_typeImage();
  200. //}
  201. }
  202. catch (Exception ex)
  203. {
  204. Util.UErrorMessage(ex, 0, 0);
  205. }
  206. }
  207. //중계기및회로 입력,출력값 넣기
  208. public void Set_DeviceUnit(RepeaterPointUnit unit)
  209. {
  210. try
  211. {
  212. this.unit = unit;
  213. this.reset = true;
  214. if (this.dev == null)
  215. {
  216. if (this.loopCutFlag) repCell.Value = new Bitmap(this.backmg.Images[1]); //차단이미지
  217. return;
  218. }
  219. if (this.dev.UseFlag)
  220. {
  221. if (unit != null)
  222. {
  223. //중계기타입별 표시
  224. if (this.dev.RepeaterType.Equals("A")) repCell.Value = A_typeImage();
  225. else if (this.dev.RepeaterType.Equals("B")) repCell.Value = B_typeImage();
  226. // cyim 2015.6.8 아날로그 감지기 연동 추가
  227. else if (this.dev.RepeaterType.Equals("C")) repCell.Value = C_typeImage(unit.AnalogDetecterValue_Input);
  228. else if (this.dev.RepeaterType.Equals("D")) repCell.Value = C_typeImage(unit.AnalogDetecterValue_Input);
  229. }
  230. }
  231. }
  232. catch (Exception ex)
  233. {
  234. Util.UErrorMessage(ex, 0, 0);
  235. //Debug.WriteLine("GridRepeater.Set_DeviceUnit()" + ex.Message);
  236. }
  237. }
  238. bool reset = true;
  239. //중계기및회로 입력,출력값 넣기
  240. public bool UpdateDeviceUnit(RepeaterData data)
  241. {
  242. bool ret = false;
  243. try
  244. {
  245. if (this.unit.UpdateData(data) || this.reset)
  246. {
  247. ret = true;
  248. this.reset = false;
  249. if (this.dev == null)
  250. {
  251. if (this.loopCutFlag)
  252. {
  253. //repCell.Value = new Bitmap(this.backmg.Images[1]); //차단이미지
  254. repCell.Value = this.backmg.Images[1]; //차단이미지
  255. }
  256. return ret;
  257. }
  258. if (this.dev.UseFlag)
  259. {
  260. //중계기타입별 표시
  261. if (this.dev.RepeaterType.Equals("A"))
  262. repCell.Value = this.A_typeImage();
  263. else if (this.dev.RepeaterType.Equals("B"))
  264. repCell.Value = this.B_typeImage();
  265. }
  266. }
  267. }
  268. catch (Exception ex)
  269. {
  270. Util.UErrorMessage(ex, 0, 0);
  271. //Debug.WriteLine("GridRepeater.Set_DeviceUnit()" + ex.Message);
  272. }
  273. return ret;
  274. }
  275. // cyim 2015.7.1 입력회로 상태값 추가
  276. // 아날로그 감지기 값을 기존 중계기 입력 상태와 맞출수가 없어서 결국 UpdateData 함수를 변형함.
  277. // UpdateData 는 함수오버로딩되어있어서 아날로그 타입인 경우와 구분되도록 루틴을 변경한다
  278. //중계기및회로 입력,출력값 넣기
  279. public bool UpdateDeviceUnit(RepeaterData data, AnalogLevel analogLevel, MDIParent mdi) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  280. {
  281. bool ret = false;
  282. try
  283. {
  284. if (this.unit.UpdateData(data, analogLevel, mdi) || this.reset) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  285. {
  286. ret = true;
  287. this.reset = false;
  288. if (this.dev == null)
  289. {
  290. if (this.loopCutFlag)
  291. {
  292. //repCell.Value = new Bitmap(this.backmg.Images[1]); //차단이미지
  293. repCell.Value = this.backmg.Images[1]; //차단이미지
  294. }
  295. return ret;
  296. }
  297. if (this.dev.UseFlag)
  298. {
  299. //중계기타입별 표시
  300. if (this.dev.RepeaterType.Equals("A"))
  301. repCell.Value = this.A_typeImage();
  302. else if (this.dev.RepeaterType.Equals("B"))
  303. repCell.Value = this.B_typeImage();
  304. // cyim 2015.6.8 아날로그 감지기 연동 추가
  305. else if (this.dev.RepeaterType.Equals("C") || this.dev.RepeaterType.Equals("D"))
  306. repCell.Value = this.C_typeImage(data.AnalogDetecterValue_Input);
  307. }
  308. }
  309. }
  310. catch (Exception ex)
  311. {
  312. Util.UErrorMessage(ex, 0, 0);
  313. //Debug.WriteLine("GridRepeater.Set_DeviceUnit()" + ex.Message);
  314. }
  315. return ret;
  316. }
  317. public RepeaterDeviceTypeInfo DeviceInfo { get { return this.dev; } }
  318. public RepeaterPointUnit DeviceUnit { get { return this.unit; } }
  319. public String InfoMessage { get { return this.infoMessage; } }
  320. public bool LoopCutFlag { get { return this.loopCutFlag; } set { this.loopCutFlag = value; } }
  321. //중계기 이미지 표시생성 -- 2회로
  322. private Image A_typeImage()
  323. {
  324. Point posIn1 = new Point(13, 8);
  325. Point posIn2 = new Point(13, 23);
  326. Point posOut1 = new Point(49, 8);
  327. Point posOut2 = new Point(49, 23);
  328. System.Drawing.Color StColor_in1 = System.Drawing.Color.Silver;
  329. System.Drawing.Color StColor_in2 = System.Drawing.Color.Silver;
  330. System.Drawing.Color StColor_out1 = System.Drawing.Color.Silver;
  331. System.Drawing.Color StColor_out2 = System.Drawing.Color.Silver;
  332. //중계기 입출력 데이터 별 색상값
  333. if (this.unit != null)
  334. {
  335. StColor_in1 = InputValue(this.unit.Repeater_Input1, this.dev.getDeviceTypeInfo(1, "I"));
  336. StColor_in2 = InputValue(this.unit.Repeater_Input2, this.dev.getDeviceTypeInfo(2, "I"));
  337. StColor_out1 = OutputValue(this.unit.Repeater_Output1, this.dev.getDeviceTypeInfo(1, "O"));
  338. StColor_out2 = OutputValue(this.unit.Repeater_Output2, this.dev.getDeviceTypeInfo(2, "O"));
  339. }
  340. Bitmap bmp;
  341. //중계기차단여부에 따른 이미지
  342. if (this.dev.CutFlag || this.loopCutFlag)
  343. {
  344. bmp = new Bitmap(this.backmg.Images[1]); //차단이미지
  345. this.infoMessage = "차단된 중계기"; // cyim 2015.2.16 차단된 중계기 문구로 조정
  346. }
  347. else
  348. {
  349. bmp = new Bitmap(this.backmg.Images[0]); //정상이미지
  350. if (this.unit != null)
  351. {
  352. if (this.unit.RepeaterNon == true)
  353. {
  354. bmp = new Bitmap(this.backmg.Images[3]);
  355. this.infoMessage = "존재하지 않는 중계기";
  356. }
  357. else if (this.unit.RepeaterErr == true)
  358. {
  359. bmp = new Bitmap(this.backmg.Images[2]); //에러이미지 //2010.4.13_moon >0 -> == true
  360. this.infoMessage = "중계기 통신 에러";
  361. }
  362. else if (this.unit.RepeaterR0 == true)
  363. {
  364. bmp = new Bitmap(this.backmg.Images[2]); //에러이미지 //2010.4.13_moon >0 -> == true
  365. this.infoMessage = "중계기 전원 이상";
  366. }
  367. else
  368. {
  369. this.infoMessage = "";
  370. }
  371. }
  372. }
  373. try
  374. {
  375. int Width = 12, Height = 12;
  376. // cyim 2015.6.19 속도개선작업 : 입력1,2 출력1,2
  377. FillRectangle(bmp, posIn1.X, posIn1.Y, Width, Height, StColor_in1);
  378. FillRectangle(bmp, posIn2.X, posIn2.Y, Width, Height, StColor_in2);
  379. FillRectangle(bmp, posOut1.X, posOut1.Y, Width, Height, StColor_out1);
  380. FillRectangle(bmp, posOut2.X, posOut2.Y, Width, Height, StColor_out2);
  381. ////입력1
  382. //for (int Xcount = posIn1.X; Xcount < posIn1.X + Width; Xcount++)
  383. // for (int Ycount = posIn1.Y; Ycount < posIn1.Y + Height; Ycount++)
  384. // bmp.SetPixel(Xcount, Ycount, StColor_in1);
  385. ////입력2
  386. //for (int Xcount = posIn2.X; Xcount < posIn2.X + Width; Xcount++)
  387. // for (int Ycount = posIn2.Y; Ycount < posIn2.Y + Height; Ycount++)
  388. // bmp.SetPixel(Xcount, Ycount, StColor_in2);
  389. ////출력1
  390. //for (int Xcount = posOut1.X; Xcount < posOut1.X + Width; Xcount++)
  391. // for (int Ycount = posOut1.Y; Ycount < posOut1.Y + Height; Ycount++)
  392. // bmp.SetPixel(Xcount, Ycount, StColor_out1);
  393. ////출력2
  394. //for (int Xcount = posOut2.X; Xcount < posOut2.X + Width; Xcount++)
  395. // for (int Ycount = posOut2.Y; Ycount < posOut2.Y + Height; Ycount++)
  396. // bmp.SetPixel(Xcount, Ycount, StColor_out2);
  397. }
  398. catch (Exception ex)
  399. {
  400. Util.UErrorMessage(ex, 0, 0);
  401. }
  402. return bmp;
  403. }
  404. //중계기 이미지 표시생성 --4회로
  405. private Image B_typeImage()
  406. {
  407. Point posIn1 = new Point(6, 9);
  408. Point posIn2 = new Point(20, 9);
  409. Point posIn3 = new Point(6, 23);
  410. Point posIn4 = new Point(20, 23);
  411. Point posOut1 = new Point(43, 9);
  412. Point posOut2 = new Point(57, 9);
  413. Point posOut3 = new Point(43, 23);
  414. Point posOut4 = new Point(57, 23);
  415. System.Drawing.Color StColor_in1 = System.Drawing.Color.Silver;
  416. System.Drawing.Color StColor_in2 = System.Drawing.Color.Silver;
  417. System.Drawing.Color StColor_in3 = System.Drawing.Color.Silver;
  418. System.Drawing.Color StColor_in4 = System.Drawing.Color.Silver;
  419. System.Drawing.Color StColor_out1 = System.Drawing.Color.Silver;
  420. System.Drawing.Color StColor_out2 = System.Drawing.Color.Silver;
  421. System.Drawing.Color StColor_out3 = System.Drawing.Color.Silver;
  422. System.Drawing.Color StColor_out4 = System.Drawing.Color.Silver;
  423. //중계기 입출력 데이터 별 색상값
  424. if (this.unit != null)
  425. {
  426. StColor_in1 = InputValue(this.unit.Repeater_Input1, this.dev.getDeviceTypeInfo(1, "I"));
  427. StColor_in2 = InputValue(this.unit.Repeater_Input2, this.dev.getDeviceTypeInfo(2, "I"));
  428. StColor_in3 = InputValue(this.unit.Repeater_Input3, this.dev.getDeviceTypeInfo(3, "I"));
  429. StColor_in4 = InputValue(this.unit.Repeater_Input4, this.dev.getDeviceTypeInfo(4, "I"));
  430. StColor_out1 = OutputValue(this.unit.Repeater_Output1, this.dev.getDeviceTypeInfo(1, "O"));
  431. StColor_out2 = OutputValue(this.unit.Repeater_Output2, this.dev.getDeviceTypeInfo(2, "O"));
  432. StColor_out3 = OutputValue(this.unit.Repeater_Output3, this.dev.getDeviceTypeInfo(3, "O"));
  433. StColor_out4 = OutputValue(this.unit.Repeater_Output4, this.dev.getDeviceTypeInfo(4, "O"));
  434. }
  435. Bitmap bmp;
  436. //중계기차단여부에 따른 이미지
  437. if (this.dev.CutFlag || this.loopCutFlag)
  438. {
  439. bmp = new Bitmap(this.backmg.Images[1]); //차단이미지
  440. this.infoMessage = "차단된 중계기"; // cyim 2015.2.16 차단된 중계기 문구로 조정
  441. }
  442. else
  443. {
  444. bmp = new Bitmap(this.backmg.Images[0]); //정상이미지
  445. if (this.unit != null)
  446. {
  447. if (this.unit.RepeaterNon == true)
  448. {
  449. bmp = new Bitmap(this.backmg.Images[3]);
  450. this.infoMessage = "존재하지 않는 중계기";
  451. }
  452. else if (this.unit.RepeaterErr == true)
  453. {
  454. bmp = new Bitmap(this.backmg.Images[2]); //에러이미지 //2010.4.13_moon >0 -> == true
  455. this.infoMessage = "중계기 통신 에러";
  456. }
  457. else if (this.unit.RepeaterR0 == true)
  458. {
  459. bmp = new Bitmap(this.backmg.Images[2]); //에러이미지 //2010.4.13_moon >0 -> == true
  460. this.infoMessage = "중계기 전원 이상";
  461. }
  462. else
  463. {
  464. this.infoMessage = "";
  465. }
  466. }
  467. }
  468. try
  469. {
  470. int Width = 12, Height = 12;
  471. // cyim 2015.6.19 속도개선작업 : //입력1,2,3,4 출력1,2,3,4
  472. FillRectangle(bmp, posIn1.X, posIn1.Y, Width, Height, StColor_in1);
  473. FillRectangle(bmp, posIn2.X, posIn2.Y, Width, Height, StColor_in2);
  474. FillRectangle(bmp, posIn3.X, posIn3.Y, Width, Height, StColor_in3);
  475. FillRectangle(bmp, posIn4.X, posIn4.Y, Width, Height, StColor_in4);
  476. FillRectangle(bmp, posOut1.X, posOut1.Y, Width, Height, StColor_out1);
  477. FillRectangle(bmp, posOut2.X, posOut2.Y, Width, Height, StColor_out2);
  478. FillRectangle(bmp, posOut3.X, posOut3.Y, Width, Height, StColor_out3);
  479. FillRectangle(bmp, posOut4.X, posOut4.Y, Width, Height, StColor_out4);
  480. ////입력1--색상표시
  481. //for (int Xcount = posIn1.X; Xcount < posIn1.X + Width; Xcount++)
  482. // for (int Ycount = posIn1.Y; Ycount < posIn1.Y + Height; Ycount++)
  483. // bmp.SetPixel(Xcount, Ycount, StColor_in1);
  484. ////입력2--색상표시
  485. //for (int Xcount = posIn2.X; Xcount < posIn2.X + Width; Xcount++)
  486. // for (int Ycount = posIn2.Y; Ycount < posIn2.Y + Height; Ycount++)
  487. // bmp.SetPixel(Xcount, Ycount, StColor_in2);
  488. ////입력3--색상표시
  489. //for (int Xcount = posIn3.X; Xcount < posIn3.X + Width; Xcount++)
  490. // for (int Ycount = posIn3.Y; Ycount < posIn3.Y + Height; Ycount++)
  491. // bmp.SetPixel(Xcount, Ycount, StColor_in3);
  492. ////입력4--색상표시
  493. //for (int Xcount = posIn4.X; Xcount < posIn4.X + Width; Xcount++)
  494. // for (int Ycount = posIn4.Y; Ycount < posIn4.Y + Height; Ycount++)
  495. // bmp.SetPixel(Xcount, Ycount, StColor_in4);
  496. ////출력1--색상표시
  497. //for (int Xcount = posOut1.X; Xcount < posOut1.X + Width; Xcount++)
  498. // for (int Ycount = posOut1.Y; Ycount < posOut1.Y + Height; Ycount++)
  499. // bmp.SetPixel(Xcount, Ycount, StColor_out1);
  500. ////출력2--색상표시
  501. //for (int Xcount = posOut2.X; Xcount < posOut2.X + Width; Xcount++)
  502. // for (int Ycount = posOut2.Y; Ycount < posOut2.Y + Height; Ycount++)
  503. // bmp.SetPixel(Xcount, Ycount, StColor_out2);
  504. ////출력3--색상표시
  505. //for (int Xcount = posOut3.X; Xcount < posOut3.X + Width; Xcount++)
  506. // for (int Ycount = posOut3.Y; Ycount < posOut3.Y + Height; Ycount++)
  507. // bmp.SetPixel(Xcount, Ycount, StColor_out3);
  508. ////출력4--색상표시
  509. //for (int Xcount = posOut4.X; Xcount < posOut4.X + Width; Xcount++)
  510. // for (int Ycount = posOut4.Y; Ycount < posOut4.Y + Height; Ycount++)
  511. // bmp.SetPixel(Xcount, Ycount, StColor_out4);
  512. }
  513. catch (Exception ex)
  514. {
  515. Util.UErrorMessage(ex, 0, 0);
  516. }
  517. return bmp;
  518. }
  519. // cyim 2015.6.8 아날로그 감지기 연동 추가
  520. // '1' = A : 2X2
  521. // '2' = B : 4X4
  522. // '4' = C : 아날로그연감지기
  523. // '5' = D : 아날로그열감지기
  524. private Image C_typeImage(int AnalogDetecterValue_Input)
  525. {
  526. //Point posIn1 = new Point(3,3);
  527. Point posIn1 = new Point(6, 9);
  528. System.Drawing.Color StColor_in1 = System.Drawing.Color.Silver;
  529. //중계기 입출력 데이터 별 색상값
  530. if (this.unit != null)
  531. {
  532. StColor_in1 = AnalogInputValue(this.unit.Repeater_Input1, this.dev.getDeviceTypeInfo(1, "I"));
  533. }
  534. Bitmap bmp;
  535. //중계기차단여부에 따른 이미지
  536. if (this.dev.CutFlag || this.loopCutFlag)
  537. {
  538. bmp = new Bitmap(this.backmg.Images[1]); //차단이미지
  539. this.infoMessage = "차단된 감지기"; // cyim 2015.2.16 차단된 중계기 문구로 조정 // cyim 2016.01.07 아날로그 감지기 문구로 수정
  540. }
  541. else
  542. {
  543. bmp = new Bitmap(this.backmg.Images[0]); //정상이미지
  544. if (this.unit != null)
  545. {
  546. if (this.unit.RepeaterNon == true)
  547. {
  548. bmp = new Bitmap(this.backmg.Images[3]);
  549. this.infoMessage = "존재하지 않는 감지기"; // cyim 2016.01.07 아날로그 감지기 문구로 수정
  550. StColor_in1 = System.Drawing.Color.Silver; // cyim 2016.01.07 아날로그 감지기 통신이상, 존재하지않음, 전원이상 회색표시 하고 글자 표시안함
  551. }
  552. else if (this.unit.RepeaterErr == true)
  553. {
  554. bmp = new Bitmap(this.backmg.Images[2]); //에러이미지 //2010.4.13_moon >0 -> == true
  555. this.infoMessage = "감지기 통신 에러"; // cyim 2016.01.07 아날로그 감지기 문구로 수정
  556. StColor_in1 = System.Drawing.Color.Silver; // cyim 2016.01.07 아날로그 감지기 통신이상, 존재하지않음, 전원이상 회색표시 하고 글자 표시안함
  557. }
  558. else if (this.unit.RepeaterR0 == true)
  559. {
  560. bmp = new Bitmap(this.backmg.Images[2]); //에러이미지 //2010.4.13_moon >0 -> == true
  561. this.infoMessage = "감지기 전원 이상"; // cyim 2016.01.07 아날로그 감지기 문구로 수정
  562. StColor_in1 = System.Drawing.Color.Silver; // cyim 2016.01.07 아날로그 감지기 통신이상, 존재하지않음, 전원이상 회색표시 하고 글자 표시안함
  563. }
  564. else
  565. {
  566. this.infoMessage = "";
  567. }
  568. }
  569. }
  570. try
  571. {
  572. //int Width = 68 , Height = 37;
  573. int Width = 62, Height = 25;
  574. //입력1
  575. FillRectangle(bmp, posIn1.X, posIn1.Y, Width, Height, StColor_in1, AnalogDetecterValue_Input);
  576. }
  577. catch (Exception ex)
  578. {
  579. Util.UErrorMessage(ex, 0, 0);
  580. }
  581. return bmp;
  582. }
  583. // cyim 2015.6.19 속도개선작업
  584. // 기존 코드는 픽셀로 점을 찍는 코드로 구성되어 있다.
  585. // 속도 개선을 위해 영역으로 색상을 칠하도록 수정한다
  586. private void FillRectangle(Bitmap bmp, int x, int y, int w, int h, Color color)
  587. {
  588. Graphics gBuffer = Graphics.FromImage(bmp);
  589. SolidBrush cbrush = new SolidBrush(color);
  590. Rectangle rect = new Rectangle(x, y, w, h);
  591. gBuffer.FillRectangle(cbrush, rect);
  592. }
  593. // cyim 2015.7.2 아날로그감지기 값 표시 (내부 텍스트)
  594. private void FillRectangle(Bitmap bmp, int x, int y, int w, int h, Color color, int AnalogDetecterValue)
  595. {
  596. Graphics gBuffer = Graphics.FromImage(bmp);
  597. SolidBrush cbrush = new SolidBrush(color);
  598. Rectangle rect = new Rectangle(x, y, w, h);
  599. gBuffer.FillRectangle(cbrush, rect);
  600. // 아날로그 감지기의 경우 색상을 칠하고 별도로 현재값을 표시해야 한다. 이때 글자는 검정이지만, 단선의 경우 흰색으로 표시하도록 한다
  601. if (color == Color.Black)
  602. cbrush = new SolidBrush(Color.White);
  603. // cyim 2016.01.07 아날로그 감지기 통신이상, 존재하지않음, 전원이상 회색표시 하고 글자 표시안함
  604. else if (color == Color.Silver)
  605. cbrush = new SolidBrush(Color.Silver);
  606. else
  607. cbrush = new SolidBrush(Color.Black);
  608. gBuffer.DrawString(
  609. string.Format("{0:000}", AnalogDetecterValue),
  610. new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point),
  611. cbrush,
  612. new PointF(22, 13));
  613. }
  614. //입력값별 상태색상
  615. //private Color InputValue(InputDeviceStatus inputValue)
  616. //{
  617. // System.Drawing.Color StColor_in = System.Drawing.Color.Silver;
  618. // try
  619. // {
  620. // //if (inputValue != null)
  621. // //{
  622. // switch (inputValue)
  623. // {
  624. // case InputDeviceStatus.Init: StColor_in = System.Drawing.Color.Silver; break; //초기
  625. // case InputDeviceStatus.Blocking: StColor_in = System.Drawing.Color.Black; break; //차단
  626. // case InputDeviceStatus.Normal: StColor_in = System.Drawing.Color.Lime; break; //정상
  627. // case InputDeviceStatus.Use: StColor_in = System.Drawing.Color.Red; break; //감지
  628. // }
  629. // //}
  630. // }
  631. // catch (Exception ex)
  632. // {
  633. // Util.UErrorMessage(ex, 0, 0);
  634. // }
  635. // return StColor_in;
  636. //}
  637. //입력값별 상태색상
  638. private Color InputValue(InputDeviceStatus inputValue, DeviceTypeInfo d)
  639. {
  640. System.Drawing.Color StColor_in = System.Drawing.Color.Silver;
  641. try
  642. {
  643. if (d == null)
  644. {
  645. StColor_in = System.Drawing.Color.Silver;
  646. }
  647. else
  648. {
  649. switch (inputValue)
  650. {
  651. case InputDeviceStatus.Init:
  652. StColor_in = System.Drawing.Color.Silver;
  653. break; //초기
  654. case InputDeviceStatus.Blocking:
  655. StColor_in = System.Drawing.Color.Black;
  656. break; //차단
  657. case InputDeviceStatus.Normal:
  658. StColor_in = System.Drawing.Color.Lime;
  659. break; //정상
  660. case InputDeviceStatus.Use:
  661. // 설비와 화재는 색상이 틀리다
  662. if (d.DeviceType == "IC")
  663. {
  664. StColor_in = System.Drawing.Color.Blue; //작동
  665. }
  666. else
  667. {
  668. StColor_in = System.Drawing.Color.Red; //감지
  669. }
  670. break;
  671. }
  672. }
  673. }
  674. catch (Exception ex)
  675. {
  676. Util.UErrorMessage(ex, 0, 0);
  677. }
  678. return StColor_in;
  679. }
  680. // cyim 2015.7.1 입력회로 상태값 추가
  681. private Color AnalogInputValue(InputDeviceStatus inputValue, DeviceTypeInfo d)
  682. {
  683. System.Drawing.Color StColor_in = System.Drawing.Color.Silver;
  684. try
  685. {
  686. if (d == null)
  687. {
  688. StColor_in = System.Drawing.Color.Silver;
  689. }
  690. else
  691. {
  692. switch (inputValue)
  693. {
  694. //초기
  695. case InputDeviceStatus.Init:
  696. StColor_in = System.Drawing.Color.Silver;
  697. break;
  698. // 단선 (falut)
  699. case InputDeviceStatus.Blocking:
  700. StColor_in = System.Drawing.Color.Black;
  701. break;
  702. //정상
  703. case InputDeviceStatus.Normal:
  704. StColor_in = System.Drawing.Color.Lime;
  705. break;
  706. //화재
  707. case InputDeviceStatus.Use:
  708. StColor_in = System.Drawing.Color.Red;
  709. break;
  710. // PreFire
  711. case InputDeviceStatus.PreFire:
  712. StColor_in = System.Drawing.Color.HotPink;
  713. break;
  714. }
  715. }
  716. }
  717. catch (Exception ex)
  718. {
  719. Util.UErrorMessage(ex, 0, 0);
  720. }
  721. return StColor_in;
  722. }
  723. //출력값별 상태색상
  724. //private Color OutputValue(OutputDeviceStatus outputValue)
  725. //{
  726. // System.Drawing.Color StColor_out = System.Drawing.Color.Silver;
  727. // try
  728. // {
  729. // //if (outputValue != null)
  730. // //{
  731. // switch (outputValue)
  732. // {
  733. // case OutputDeviceStatus.Init: StColor_out = System.Drawing.Color.Silver; break; //초기
  734. // case OutputDeviceStatus.Blocking: StColor_out = System.Drawing.Color.Black; break; //차단
  735. // case OutputDeviceStatus.NotWrite: StColor_out = System.Drawing.Color.Green; break; //출력없음
  736. // case OutputDeviceStatus.Write: StColor_out = System.Drawing.Color.Firebrick; break; //출력있음
  737. // }
  738. // //}
  739. // }
  740. // catch (Exception ex)
  741. // {
  742. // Util.UErrorMessage(ex, 0, 0);
  743. // }
  744. // return StColor_out;
  745. //}
  746. //출력값별 상태색상
  747. private Color OutputValue(OutputDeviceStatus outputValue, DeviceTypeInfo d)
  748. {
  749. System.Drawing.Color StColor_out = System.Drawing.Color.Silver;
  750. try
  751. {
  752. //if (outputValue != null)
  753. //{
  754. if (d == null) // 설정 없음.
  755. {
  756. StColor_out = System.Drawing.Color.Silver;
  757. }
  758. else
  759. {
  760. switch (outputValue)
  761. {
  762. case OutputDeviceStatus.Init: // 초기
  763. StColor_out = System.Drawing.Color.Silver;
  764. break;
  765. case OutputDeviceStatus.Blocking: // 차단
  766. StColor_out = System.Drawing.Color.Black;
  767. break;
  768. case OutputDeviceStatus.NotWrite: // 출력없음
  769. StColor_out = System.Drawing.Color.Green;
  770. break;
  771. case OutputDeviceStatus.Write: // 출력
  772. StColor_out = System.Drawing.Color.Firebrick;
  773. break;
  774. }
  775. }
  776. //}
  777. }
  778. catch (Exception ex)
  779. {
  780. Util.UErrorMessage(ex, 0, 0);
  781. }
  782. return StColor_out;
  783. }
  784. }
  785. /************************************************************************************************************************/
  786. /* DataGridView에 중계기 표시 class -frmRepeaterGroup [끝] */
  787. /************************************************************************************************************************/
  788. /*****************************************************************************************************************
  789. /* 수신기설정값 [시작]*/
  790. /*****************************************************************************************************************/
  791. public class ReceiverTypeInfo
  792. {
  793. private int receiverNo = -1; //수신기ID
  794. private Boolean frontLoop_UseFlag = true; //frontLoop 사용여부
  795. private Boolean backLoop_UseFlag = true; //backLoop 사용여부
  796. private Boolean io_UseFlag = true; //io보드 사용여부
  797. private Boolean keypad_UseFlag = true; //keypad 사용여부
  798. // cyim 2017.01.12 : IFC3300 은 통신보드 0번이 존재한다
  799. // cyim 2016.11.03 : 통신보드(중계반)는 최대 64
  800. private BoardTypeInfo[] myBoardType = new BoardTypeInfo[65]; //통신보드설정값
  801. public ReceiverTypeInfo(int receiverNo)
  802. {
  803. try
  804. {
  805. this.receiverNo = receiverNo;
  806. }
  807. catch (Exception ex)
  808. {
  809. Util.UErrorMessage(ex, 0, 0);
  810. }
  811. }
  812. public int ReceiverNo { get { return this.receiverNo; } }
  813. public Boolean FrontLoop_UseFlag { get { return this.frontLoop_UseFlag; } set { this.frontLoop_UseFlag = value; } }
  814. public Boolean BackLoop_UseFlag { get { return this.backLoop_UseFlag; } set { this.backLoop_UseFlag = value; } }
  815. public Boolean Io_UseFlag { get { return this.io_UseFlag; } set { this.io_UseFlag = value; } }
  816. public Boolean Keypad_UseFlag { get { return this.keypad_UseFlag; } set { this.keypad_UseFlag = value; } }
  817. public BoardTypeInfo[] MyBoardType { get { return this.myBoardType; } set { this.myBoardType = value; } } //통신보드설정값
  818. //개별통신보드 설정값 넣기
  819. public void Set_RepeaterType(BoardTypeInfo info)
  820. {
  821. try
  822. {
  823. this.myBoardType[info.BoardNo - 1] = info;
  824. }
  825. catch (Exception ex)
  826. {
  827. Util.UErrorMessage(ex, 0, 0);
  828. }
  829. }
  830. //개별통신보드 설정값 읽기
  831. public BoardTypeInfo Get_RepeaterType(int boardNo)
  832. {
  833. BoardTypeInfo info = null;
  834. try
  835. {
  836. info = this.myBoardType[boardNo - 1];
  837. }
  838. catch (Exception ex)
  839. {
  840. Util.UErrorMessage(ex, 0, 0);
  841. }
  842. return info;
  843. }
  844. }
  845. /*****************************************************************************************************************/
  846. /* 수신기설정값 [끝] */
  847. /*****************************************************************************************************************/
  848. // cyim 2016.10.31 : 대용량 수신기용 UI 변경
  849. /************************************************************************************************************************/
  850. /* 통신보드설정값 [시작] */
  851. /************************************************************************************************************************/
  852. public class BoardTypeInfo
  853. {
  854. private int boardNo = -1; //통신보드No
  855. private Boolean loop0UseFlag = false; //loop 0 사용여부
  856. private Boolean loop1UseFlag = false; //loop 1 사용여부
  857. private Boolean loop2UseFlag = false; //loop 0 사용여부
  858. private Boolean loop3UseFlag = false; //loop 1 사용여부
  859. private Boolean useFlag = false; //통신보드 사용여부
  860. private Boolean loop0CutFlag = false; //loop 0 차단여부
  861. private Boolean loop1CutFlag = false; //loop 1 차단여부
  862. private Boolean loop2CutFlag = false; //loop 0 차단여부
  863. private Boolean loop3CutFlag = false; //loop 1 차단여부
  864. private Boolean loop0CutFlag_change = false; //loop 0 차단여부 변경여부
  865. private Boolean loop1CutFlag_change = false; //loop 1 차단여부 변경여부
  866. private Boolean loop2CutFlag_change = false; //loop 2 차단여부 변경여부
  867. private Boolean loop3CutFlag_change = false; //loop 3 차단여부 변경여부
  868. private RepeaterDeviceTypeInfo[] loop0_RepeaterType = new RepeaterDeviceTypeInfo[127]; //loop 0 의 127개 중계기및회로 설정정보
  869. private RepeaterDeviceTypeInfo[] loop1_RepeaterType = new RepeaterDeviceTypeInfo[127]; //loop 1 의 127개 중계기및회로 설정정보
  870. private RepeaterDeviceTypeInfo[] loop2_RepeaterType = new RepeaterDeviceTypeInfo[127]; //loop 2 의 127개 중계기및회로 설정정보
  871. private RepeaterDeviceTypeInfo[] loop3_RepeaterType = new RepeaterDeviceTypeInfo[127]; //loop 3 의 127개 중계기및회로 설정정보
  872. private RepeaterPointUnit[] loop0_RepeaterUnit_Data = new RepeaterPointUnit[127]; //loop 0 의 127개 중계기및회로 데이터값
  873. private RepeaterPointUnit[] loop1_RepeaterUnit_Data = new RepeaterPointUnit[127]; //loop 1 의 127개 중계기및회로 데이터값
  874. private RepeaterPointUnit[] loop2_RepeaterUnit_Data = new RepeaterPointUnit[127]; //loop 2 의 127개 중계기및회로 데이터값
  875. private RepeaterPointUnit[] loop3_RepeaterUnit_Data = new RepeaterPointUnit[127]; //loop 3 의 127개 중계기및회로 데이터값
  876. public BoardTypeInfo(int boardNo)
  877. {
  878. try
  879. {
  880. this.boardNo = boardNo;
  881. }
  882. catch (Exception ex)
  883. {
  884. Util.UErrorMessage(ex, 0, 0);
  885. }
  886. }
  887. public BoardTypeInfo(int boardNo, Boolean useFlag, Boolean loop0UseFlag, Boolean loop1UseFlag, Boolean loop2UseFlag, Boolean loop3UseFlag)
  888. {
  889. try
  890. {
  891. this.boardNo = boardNo;
  892. this.useFlag = useFlag;
  893. this.loop0UseFlag = loop0UseFlag;
  894. this.loop1UseFlag = loop1UseFlag;
  895. this.loop2UseFlag = loop2UseFlag;
  896. this.loop3UseFlag = loop3UseFlag;
  897. }
  898. catch (Exception ex)
  899. {
  900. Util.UErrorMessage(ex, 0, 0);
  901. }
  902. }
  903. public int BoardNo { get { return this.boardNo; } }
  904. public Boolean UseFlag { get { return this.useFlag; } set { this.useFlag = value; } }
  905. public Boolean Loop0UseFlag { get { return this.loop0UseFlag; } set { this.loop0UseFlag = value; } }
  906. public Boolean Loop1UseFlag { get { return this.loop1UseFlag; } set { this.loop1UseFlag = value; } }
  907. public Boolean Loop2UseFlag { get { return this.loop2UseFlag; } set { this.loop2UseFlag = value; } }
  908. public Boolean Loop3UseFlag { get { return this.loop3UseFlag; } set { this.loop3UseFlag = value; } }
  909. public Boolean Loop0CutFlag { get { return this.loop0CutFlag; } set { this.loop0CutFlag = value; } }
  910. public Boolean Loop1CutFlag { get { return this.loop1CutFlag; } set { this.loop1CutFlag = value; } }
  911. public Boolean Loop2CutFlag { get { return this.loop2CutFlag; } set { this.loop2CutFlag = value; } }
  912. public Boolean Loop3CutFlag { get { return this.loop3CutFlag; } set { this.loop3CutFlag = value; } }
  913. public RepeaterDeviceTypeInfo[] Loop0_RepeaterType { get { return this.loop0_RepeaterType; } set { this.loop0_RepeaterType = value; } }
  914. public RepeaterDeviceTypeInfo[] Loop1_RepeaterType { get { return this.loop1_RepeaterType; } set { this.loop1_RepeaterType = value; } }
  915. public RepeaterDeviceTypeInfo[] Loop2_RepeaterType { get { return this.loop2_RepeaterType; } set { this.loop2_RepeaterType = value; } }
  916. public RepeaterDeviceTypeInfo[] Loop3_RepeaterType { get { return this.loop3_RepeaterType; } set { this.loop3_RepeaterType = value; } }
  917. public RepeaterPointUnit[] Loop0_RepeaterUnit_Data { get { return this.loop0_RepeaterUnit_Data; } set { this.loop0_RepeaterUnit_Data = value; } }
  918. public RepeaterPointUnit[] Loop1_RepeaterUnit_Data { get { return this.loop1_RepeaterUnit_Data; } set { this.loop1_RepeaterUnit_Data = value; } }
  919. public RepeaterPointUnit[] Loop2_RepeaterUnit_Data { get { return this.loop2_RepeaterUnit_Data; } set { this.loop2_RepeaterUnit_Data = value; } }
  920. public RepeaterPointUnit[] Loop3_RepeaterUnit_Data { get { return this.loop3_RepeaterUnit_Data; } set { this.loop3_RepeaterUnit_Data = value; } }
  921. public void Loop0CutFlagChangeReset()
  922. {
  923. try
  924. {
  925. loop0CutFlag_change = false;
  926. }
  927. catch (Exception ex)
  928. {
  929. Util.UErrorMessage(ex, 0, 0);
  930. }
  931. }
  932. public void Loop1CutFlagChangeReset()
  933. {
  934. try
  935. {
  936. loop1CutFlag_change = false;
  937. }
  938. catch (Exception ex)
  939. {
  940. Util.UErrorMessage(ex, 0, 0);
  941. }
  942. }
  943. public void Loop2CutFlagChangeReset()
  944. {
  945. try
  946. {
  947. loop2CutFlag_change = false;
  948. }
  949. catch (Exception ex)
  950. {
  951. Util.UErrorMessage(ex, 0, 0);
  952. }
  953. }
  954. public void Loop3CutFlagChangeReset()
  955. {
  956. try
  957. {
  958. loop3CutFlag_change = false;
  959. }
  960. catch (Exception ex)
  961. {
  962. Util.UErrorMessage(ex, 0, 0);
  963. }
  964. }
  965. public Boolean Loop0CutFlagChange
  966. {
  967. get { return this.loop0CutFlag_change; }
  968. set
  969. {
  970. bool cutFlag = value;
  971. //차단설정데이터 변경여부를 저장한다.
  972. if (this.loop0CutFlag != cutFlag) loop0CutFlag_change = true;
  973. this.loop0CutFlag = value;
  974. }
  975. }
  976. public Boolean Loop1CutFlagChange
  977. {
  978. get { return this.loop1CutFlag_change; }
  979. set
  980. {
  981. bool cutFlag = value;
  982. //차단설정데이터 변경여부를 저장한다.
  983. if (this.loop1CutFlag != cutFlag) loop1CutFlag_change = true;
  984. this.loop1CutFlag = value;
  985. }
  986. }
  987. public Boolean Loop2CutFlagChange
  988. {
  989. get { return this.loop2CutFlag_change; }
  990. set
  991. {
  992. bool cutFlag = value;
  993. //차단설정데이터 변경여부를 저장한다.
  994. if (this.loop2CutFlag != cutFlag) loop2CutFlag_change = true;
  995. this.loop2CutFlag = value;
  996. }
  997. }
  998. public Boolean Loop3CutFlagChange
  999. {
  1000. get { return this.loop3CutFlag_change; }
  1001. set
  1002. {
  1003. bool cutFlag = value;
  1004. //차단설정데이터 변경여부를 저장한다.
  1005. if (this.loop3CutFlag != cutFlag) loop3CutFlag_change = true;
  1006. this.loop3CutFlag = value;
  1007. }
  1008. }
  1009. }
  1010. /************************************************************************************************************************/
  1011. /* 통신보드설정값 [끝] */
  1012. /************************************************************************************************************************/
  1013. /************************************************************************************************************************/
  1014. /* 중계기회로설정값 -frmReceiverConfig [시작] */
  1015. /************************************************************************************************************************/
  1016. public class RepeaterDeviceTypeInfo
  1017. {
  1018. int repeaterNo = -1;
  1019. DeviceTypeInfo[] inDeviceTypeInfo;
  1020. DeviceTypeInfo[] outDeviceTypeInfo;
  1021. //String[] intype = new String[4]; //회로타입 [TB_DEVICE_TYPE , SYMBOL_TYPE = "I"인경우]
  1022. //String[] intypeName = new String[4]; //회로 설명(입력)
  1023. //Boolean[] inCutFlag = new Boolean[4]; //회로차단 설정(입력)
  1024. //String[] outtype = new String[4]; //회로타입 [TB_DEVICE_TYPE , SYMBOL_TYPE = "O"인경우]
  1025. //String[] outtypeName = new String[4]; //회로타입 설명(출력)
  1026. //Boolean[] outCutFlag = new Boolean[4]; //회로차단 설정(출력)
  1027. // cyim 2015.6.8 아날로그 감지기 연동 추가
  1028. // '1' = A : 2X2
  1029. // '2' = B : 4X4
  1030. // '4' = C : 아날로그연감지기
  1031. // '5' = D : 아날로그열감지기
  1032. String repeaterType = "";
  1033. Boolean cutFlag = false; //중계기 차단여부
  1034. Boolean useFlag = false; //중계기 사용여부
  1035. Boolean cutFlag_change = false; //중계기 차단여부 설정 변경 여부
  1036. Boolean fireResetFlag = false; //비화재보호기능
  1037. public void CutFlagChangeReset()
  1038. {
  1039. try
  1040. {
  1041. cutFlag_change = false;
  1042. }
  1043. catch (Exception ex)
  1044. {
  1045. Util.UErrorMessage(ex, 0, 0);
  1046. }
  1047. }
  1048. public Boolean CutFlagChange
  1049. {
  1050. get { return this.cutFlag_change; }
  1051. set
  1052. {
  1053. bool cutFlag = value;
  1054. //차단설정데이터 변경여부를 저장한다.
  1055. if (this.cutFlag != cutFlag) cutFlag_change = true;
  1056. this.cutFlag = value;
  1057. }
  1058. }
  1059. public RepeaterDeviceTypeInfo(int repeaterNo)
  1060. {
  1061. try
  1062. {
  1063. this.repeaterNo = repeaterNo;
  1064. }
  1065. catch (Exception ex)
  1066. {
  1067. Util.UErrorMessage(ex, 0, 0);
  1068. }
  1069. }
  1070. public RepeaterDeviceTypeInfo(int repeaterNo, String repeaterType)
  1071. {
  1072. try
  1073. {
  1074. this.repeaterNo = repeaterNo;
  1075. this.repeaterType = repeaterType;
  1076. this.useFlag = true;
  1077. if (repeaterType.Equals("A"))
  1078. {
  1079. this.inDeviceTypeInfo = new DeviceTypeInfo[2];
  1080. this.outDeviceTypeInfo = new DeviceTypeInfo[2];
  1081. }
  1082. else if (repeaterType.Equals("B"))
  1083. {
  1084. this.inDeviceTypeInfo = new DeviceTypeInfo[4];
  1085. this.outDeviceTypeInfo = new DeviceTypeInfo[4];
  1086. }
  1087. // cyim 2015.6.8 아날로그 감지기 연동 추가
  1088. else if (repeaterType.Equals("C") || repeaterType.Equals("D"))
  1089. {
  1090. this.inDeviceTypeInfo = new DeviceTypeInfo[1];
  1091. this.outDeviceTypeInfo = new DeviceTypeInfo[1];
  1092. }
  1093. }
  1094. catch (Exception ex)
  1095. {
  1096. Util.UErrorMessage(ex, 0, 0);
  1097. }
  1098. }
  1099. public RepeaterDeviceTypeInfo(int repeaterNo, String repeaterType, Boolean cutFlag)
  1100. {
  1101. try
  1102. {
  1103. this.repeaterNo = repeaterNo;
  1104. this.repeaterType = repeaterType;
  1105. this.cutFlag = cutFlag;
  1106. this.useFlag = true;
  1107. if (repeaterType.Equals("A"))
  1108. {
  1109. this.inDeviceTypeInfo = new DeviceTypeInfo[2];
  1110. this.outDeviceTypeInfo = new DeviceTypeInfo[2];
  1111. }
  1112. else if (repeaterType.Equals("B"))
  1113. {
  1114. this.inDeviceTypeInfo = new DeviceTypeInfo[4];
  1115. this.outDeviceTypeInfo = new DeviceTypeInfo[4];
  1116. }
  1117. // cyim 2015.6.8 아날로그 감지기 연동 추가
  1118. else if (repeaterType.Equals("C") || repeaterType.Equals("D"))
  1119. {
  1120. this.inDeviceTypeInfo = new DeviceTypeInfo[1];
  1121. this.outDeviceTypeInfo = new DeviceTypeInfo[1];
  1122. }
  1123. }
  1124. catch (Exception ex)
  1125. {
  1126. Util.UErrorMessage(ex, 0, 0);
  1127. }
  1128. }
  1129. public void setInputDeviceTypeInfo(int deviceNo, String deviceType, String deviceName, String positionCode, Boolean cutFlag)
  1130. {
  1131. try
  1132. {
  1133. if (this.inDeviceTypeInfo == null) return;
  1134. if (this.inDeviceTypeInfo[deviceNo - 1] == null) this.inDeviceTypeInfo[deviceNo - 1] = new DeviceTypeInfo(deviceNo);
  1135. this.inDeviceTypeInfo[deviceNo - 1].DeviceType = deviceType;
  1136. this.inDeviceTypeInfo[deviceNo - 1].DeviceName = deviceName;
  1137. this.inDeviceTypeInfo[deviceNo - 1].PositionCode = positionCode;
  1138. this.inDeviceTypeInfo[deviceNo - 1].CutFlag = cutFlag;
  1139. this.inDeviceTypeInfo[deviceNo - 1].UseFlag = true;
  1140. }
  1141. catch (Exception ex)
  1142. {
  1143. Util.UErrorMessage(ex, 0, 0);
  1144. }
  1145. }
  1146. public void setOutputDeviceTypeInfo(int deviceNo, String deviceType, String deviceName, String positionCode, Boolean cutFlag)
  1147. {
  1148. try
  1149. {
  1150. if (this.outDeviceTypeInfo == null) return;
  1151. if (this.outDeviceTypeInfo[deviceNo - 1] == null) this.outDeviceTypeInfo[deviceNo - 1] = new DeviceTypeInfo(deviceNo);
  1152. this.outDeviceTypeInfo[deviceNo - 1].DeviceType = deviceType;
  1153. this.outDeviceTypeInfo[deviceNo - 1].DeviceName = deviceName;
  1154. this.outDeviceTypeInfo[deviceNo - 1].PositionCode = positionCode;
  1155. this.outDeviceTypeInfo[deviceNo - 1].CutFlag = cutFlag;
  1156. this.outDeviceTypeInfo[deviceNo - 1].UseFlag = true;
  1157. }
  1158. catch (Exception ex)
  1159. {
  1160. Util.UErrorMessage(ex, 0, 0);
  1161. }
  1162. }
  1163. public int RepeaterNo { get { return this.repeaterNo; } set { this.repeaterNo = value; } }
  1164. public bool FireResetFlag { get { return this.fireResetFlag; } set { this.fireResetFlag = value; } }
  1165. //public String InType1 { get { return this.intype[0]; } set { this.intype[0] = value; } }
  1166. //public String InType2 { get { return this.intype[1]; } set { this.intype[1] = value; } }
  1167. //public String InType3 { get { return this.intype[2]; } set { this.intype[2] = value; } }
  1168. //public String InType4 { get { return this.intype[3]; } set { this.intype[3] = value; } }
  1169. //public String InTypeName1 { get { return this.intypeName[0]; } set { this.intypeName[0] = value; } }
  1170. //public String InTypeName2 { get { return this.intypeName[1]; } set { this.intypeName[1] = value; } }
  1171. //public String InTypeName3 { get { return this.intypeName[2]; } set { this.intypeName[2] = value; } }
  1172. //public String InTypeName4 { get { return this.intypeName[3]; } set { this.intypeName[3] = value; } }
  1173. //public Boolean InCutFlag1 { get { return this.inCutFlag[0]; } set { this.inCutFlag[0] = value; } }
  1174. //public Boolean InCutFlag2 { get { return this.inCutFlag[1]; } set { this.inCutFlag[1] = value; } }
  1175. //public Boolean InCutFlag3 { get { return this.inCutFlag[2]; } set { this.inCutFlag[2] = value; } }
  1176. //public Boolean InCutFlag4 { get { return this.inCutFlag[3]; } set { this.inCutFlag[3] = value; } }
  1177. //public String OutType1 { get { return this.outtype[0]; } set { this.outtype[0] = value; } }
  1178. //public String OutType2 { get { return this.outtype[1]; } set { this.outtype[1] = value; } }
  1179. //public String OutType3 { get { return this.outtype[2]; } set { this.outtype[2] = value; } }
  1180. //public String OutType4 { get { return this.outtype[3]; } set { this.outtype[3] = value; } }
  1181. //public String OutTypeName1 { get { return this.outtypeName[0]; } set { this.outtypeName[0] = value; } }
  1182. //public String OutTypeName2 { get { return this.outtypeName[1]; } set { this.outtypeName[1] = value; } }
  1183. //public String OutTypeName3 { get { return this.outtypeName[2]; } set { this.outtypeName[2] = value; } }
  1184. //public String OutTypeName4 { get { return this.outtypeName[3]; } set { this.outtypeName[3] = value; } }
  1185. //public Boolean OutCutFlag1 { get { return this.outCutFlag[0]; } set { this.outCutFlag[0] = value; } }
  1186. //public Boolean OutCutFlag2 { get { return this.outCutFlag[1]; } set { this.outCutFlag[1] = value; } }
  1187. //public Boolean OutCutFlag3 { get { return this.outCutFlag[2]; } set { this.outCutFlag[2] = value; } }
  1188. //public Boolean OutCutFlag4 { get { return this.outCutFlag[3]; } set { this.outCutFlag[3] = value; } }
  1189. //public String[] InType { get { return this.intype; } set { this.intype= value; } }
  1190. //public String[] InTypeName { get { return this.intypeName; } set { this.intypeName = value; } }
  1191. //public Boolean[] InCutFlag { get { return this.inCutFlag; } set { this.inCutFlag = value; } }
  1192. //public String[] OutType { get { return this.outtype; } set { this.outtype = value; } }
  1193. //public String[] OuttypeName { get { return this.outtypeName; } set { this.outtypeName = value; } }
  1194. //public Boolean[] OutCutFlag { get { return this.outCutFlag; } set { this.outCutFlag = value; } }
  1195. public void setDeviceTypeInfo(DeviceTypeInfo dev, string inoutType)
  1196. {
  1197. try
  1198. {
  1199. if (inoutType.Equals(code_InOutType.Input)) this.inDeviceTypeInfo[dev.DeviceNo - 1] = dev;
  1200. else if (inoutType.Equals(code_InOutType.Output)) this.outDeviceTypeInfos[dev.DeviceNo - 1] = dev;
  1201. }
  1202. catch (Exception ex)
  1203. {
  1204. Util.UErrorMessage(ex, 0, 0);
  1205. }
  1206. }
  1207. public DeviceTypeInfo getDeviceTypeInfo(int deviceNo, string inoutType)
  1208. {
  1209. DeviceTypeInfo dev = null;
  1210. try
  1211. {
  1212. if (inoutType.Equals(code_InOutType.Input)) dev = this.inDeviceTypeInfo[deviceNo - 1];
  1213. else if (inoutType.Equals(code_InOutType.Output)) dev = this.outDeviceTypeInfos[deviceNo - 1];
  1214. }
  1215. catch (Exception ex)
  1216. {
  1217. Util.UErrorMessage(ex, 0, 0);
  1218. }
  1219. return dev;
  1220. }
  1221. public DeviceTypeInfo[] inDeviceTypeInfos { get { return this.inDeviceTypeInfo; } set { this.inDeviceTypeInfo = value; } }
  1222. public DeviceTypeInfo[] outDeviceTypeInfos { get { return this.outDeviceTypeInfo; } set { this.outDeviceTypeInfo = value; } }
  1223. // cyim 2015.6.8 아날로그 감지기 연동 추가
  1224. // '1' = A : 2X2
  1225. // '2' = B : 4X4
  1226. // '4' = C : 아날로그연감지기
  1227. // '5' = D : 아날로그열감지기
  1228. public String RepeaterType
  1229. {
  1230. get { return this.repeaterType; }
  1231. set
  1232. {
  1233. this.repeaterType = value;
  1234. // 2회로
  1235. if (this.repeaterType.Equals("A"))
  1236. {
  1237. if (this.inDeviceTypeInfo == null)
  1238. {
  1239. this.inDeviceTypeInfo = new DeviceTypeInfo[2];
  1240. this.outDeviceTypeInfo = new DeviceTypeInfo[2];
  1241. }
  1242. }
  1243. // 4회로
  1244. else if (this.repeaterType.Equals("B"))
  1245. {
  1246. if (this.inDeviceTypeInfo == null)
  1247. {
  1248. this.inDeviceTypeInfo = new DeviceTypeInfo[4];
  1249. this.outDeviceTypeInfo = new DeviceTypeInfo[4];
  1250. }
  1251. }
  1252. // cyim 2015.6.8 아날로그 감지기 연동 추가
  1253. else if (this.repeaterType.Equals("C") || this.repeaterType.Equals("D"))
  1254. {
  1255. if (this.inDeviceTypeInfo == null)
  1256. {
  1257. this.inDeviceTypeInfo = new DeviceTypeInfo[1];
  1258. this.outDeviceTypeInfo = new DeviceTypeInfo[1];
  1259. }
  1260. }
  1261. }
  1262. }
  1263. public Boolean CutFlag { get { return this.cutFlag; } set { this.cutFlag = value; } }
  1264. public Boolean UseFlag { get { return this.useFlag; } set { this.useFlag = value; } }
  1265. }
  1266. /************************************************************************************************************************/
  1267. /* 중계기회로설정값 -frmReceiverConfig [끝] */
  1268. /************************************************************************************************************************/
  1269. /************************************************************************************************************************/
  1270. /* 회로설정값 -frmReceiverConfig [시작] */
  1271. /************************************************************************************************************************/
  1272. public class DeviceTypeInfo
  1273. {
  1274. int deviceNo = -1;
  1275. string deviceType = null; //연동타입
  1276. string deviceName = null; //회로설명
  1277. bool cutFlag = false; //차단여부
  1278. bool useFlag = false; //사용여부
  1279. string positionCode = null; //위치코드
  1280. public DeviceTypeInfo(int deviceNo)
  1281. {
  1282. try
  1283. {
  1284. this.deviceNo = deviceNo;
  1285. }
  1286. catch (Exception ex)
  1287. {
  1288. Util.UErrorMessage(ex, 0, 0);
  1289. }
  1290. }
  1291. public int DeviceNo { get { return this.deviceNo; } }
  1292. public String DeviceType { get { return this.deviceType; } set { this.deviceType = value; } }
  1293. public String DeviceName { get { return this.deviceName; } set { this.deviceName = value; } }
  1294. public bool CutFlag { get { return this.cutFlag; } set { this.cutFlag = value; } }
  1295. public bool UseFlag { get { return this.useFlag; } set { this.useFlag = value; } }
  1296. public String PositionCode { get { return this.positionCode; } set { this.positionCode = value; } }
  1297. }
  1298. /************************************************************************************************************************/
  1299. /* 중계기 상태값 및 회로 데이터 [시작] */
  1300. /************************************************************************************************************************/
  1301. public class RepeaterPointUnit
  1302. {
  1303. //입력회로 데이터값
  1304. private InputDeviceStatus input1 = InputDeviceStatus.Init;
  1305. private InputDeviceStatus input2 = InputDeviceStatus.Init;
  1306. private InputDeviceStatus input3 = InputDeviceStatus.Init;
  1307. private InputDeviceStatus input4 = InputDeviceStatus.Init;
  1308. //출력회로 데이터값
  1309. private OutputDeviceStatus output1 = OutputDeviceStatus.Init;
  1310. private OutputDeviceStatus output2 = OutputDeviceStatus.Init;
  1311. private OutputDeviceStatus output3 = OutputDeviceStatus.Init;
  1312. private OutputDeviceStatus output4 = OutputDeviceStatus.Init;
  1313. //Tprotocol의 중계기 데이터
  1314. // RCVData_ReadRepeaterPoint_unit unitData; //2010.4.13_moon
  1315. //RepeaterData unitData;
  1316. // repeater id//
  1317. private int repeater_ID = 0;
  1318. // repeater state //
  1319. private bool repeaterErr = false; //에러상태
  1320. private bool repeaterNon = false; //존재하지 않는 중계기
  1321. private bool repeaterR0 = false; //Reserved--24Voltage Fault발생
  1322. private bool repeaterR1 = false; //Reserved
  1323. private bool repeaterR2 = false; //Reserved
  1324. private bool repeaterR = false; //중계기 복구 명령 0-완료,1-완료안함
  1325. private bool repeaterW = false; //출력쓰기 완료 0-완료,1-완료안함
  1326. private bool repeaterS = false; //Search Complete 0-완료,1-완료안함
  1327. // cyim 2015.7.1 입력회로 상태값 추가 : 아날로그 감지기 연동으로 인하여 입력값은 중계기든 아날로그 감지기는 반드시 1byte 저장하게 된다
  1328. public int AnalogDetecterValue_Input = 0;
  1329. // cyim 2015.7.1 입력회로 상태값 추가
  1330. // 아날로그 감지기 레벨값은 데이타베이스가 기준이 되므로, 결국 메모리 할당 직전에 아날로그 감지기인지 확인하고 아래의 값을 셋팅할 수 밖에 없다.
  1331. // 함수오버로딩으로 기본으로 사용하는 생성자외에, 아날로그 타입인지 아닌지 구분하기 위해서 Fault, PreFire, FireDay, FireNight 가 모두 0 이면
  1332. // 이는 중계기이고 그렇지 않으면 아날로그 감지기라고 판단하고 동작해야 한다.
  1333. public AnalogLevel AnalogDetecterLevel = new AnalogLevel(0, 0, 0, 0);
  1334. // 기본
  1335. public RepeaterPointUnit(int repeater_ID, RepeaterData unitData) // public RepeaterPointUnit(int repeater_ID, RCVData_ReadRepeaterPoint_unit unitData) //2010.4.13_moon
  1336. {
  1337. try
  1338. {
  1339. // 중계기 아이디
  1340. this.repeater_ID = repeater_ID;
  1341. // 상태값 넣기
  1342. this.SetStateData(unitData);
  1343. // 입력값 넣기
  1344. this.SetInputData(unitData);
  1345. // 출력값 넣기
  1346. this.SetOutputData(unitData);
  1347. }
  1348. catch (Exception ex)
  1349. {
  1350. Util.UErrorMessage(ex, 0, 0);
  1351. }
  1352. }
  1353. // cyim 2015.7.3 아날로그 감지기와 중계기 생성자 구분
  1354. // 생성자의 경우 함수오버로딩을 통하여 기존의 중계기는 그대로 이용하되 별도로 아날로그 중계기 전용 생성자를 이용하도록 한다
  1355. // 중요한 것은 생성자가 실행되기 직전에 미리 내부적으로 중계기 아이디만을 가지고 이것이 아날로그 감지기 인지 아닌지를 판단할수 밖에 없는 구조를 안고 구성된다는 점이다.
  1356. // 결국 분기된 생성자는 별도로 업데이트 함수가 필요할 수 밖에 없을 것 같다.
  1357. public RepeaterPointUnit(int repeater_ID, RepeaterData unitData, AnalogLevel analogLevel, MDIParent mdi) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1358. {
  1359. try
  1360. {
  1361. // 아날로그 감지기 레벨 정보 추가
  1362. this.AnalogDetecterLevel = analogLevel;
  1363. // 중계기 아이디
  1364. this.repeater_ID = repeater_ID;
  1365. // 상태값 넣기
  1366. this.SetStateData(unitData);
  1367. // 입력값 넣기
  1368. this.SetInputData(unitData.AnalogDetecterValue_Input, analogLevel, mdi); // 특별처리 아날로그 감지기는 입력이 틀리다 상위1비트를 제외한 나머지 7 bir 의 아날로그 값이 입력값이다. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1369. // 출력값 넣기
  1370. this.SetOutputData(unitData); //출력값 넣기
  1371. }
  1372. catch (Exception ex)
  1373. {
  1374. Util.UErrorMessage(ex, 0, 0);
  1375. }
  1376. }
  1377. // 일반 중계기용
  1378. public bool UpdateData(RepeaterData unitData)
  1379. {
  1380. bool ret = false;
  1381. try
  1382. {
  1383. if (this.UpdateStateData(unitData))
  1384. {
  1385. ret = true;
  1386. }
  1387. if (this.UpdateInputData(unitData))
  1388. {
  1389. ret = true;
  1390. }
  1391. if (this.UpdateOutputData(unitData))
  1392. {
  1393. ret = true;
  1394. }
  1395. }
  1396. catch (Exception ex)
  1397. {
  1398. Util.UErrorMessage(ex, 0, 0);
  1399. }
  1400. return ret;
  1401. }
  1402. // cyim 2015.7.3 아날로그 감지기와 중계기 생성자 구분 -> 아날로그 감지기용
  1403. public bool UpdateData(RepeaterData unitData, AnalogLevel analogLevel, MDIParent mdi) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1404. {
  1405. bool ret = false;
  1406. try
  1407. {
  1408. if (this.UpdateStateData(unitData))
  1409. {
  1410. ret = true;
  1411. }
  1412. if (this.UpdateInputData(unitData.AnalogDetecterValue_Input, analogLevel, mdi)) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1413. {
  1414. ret = true;
  1415. }
  1416. if (this.UpdateOutputData(unitData))
  1417. {
  1418. ret = true;
  1419. }
  1420. }
  1421. catch (Exception ex)
  1422. {
  1423. Util.UErrorMessage(ex, 0, 0);
  1424. }
  1425. return ret;
  1426. }
  1427. bool UpdateStateData(RepeaterData unitData)
  1428. {
  1429. bool ret = false;
  1430. try
  1431. {
  1432. // cyim 2013.7.18 중계기상태보기 오류
  1433. if (repeaterNon != unitData.Non)
  1434. {
  1435. repeaterNon = unitData.Non;
  1436. ret = true;
  1437. }
  1438. if (repeaterErr != unitData.Err)
  1439. {
  1440. repeaterErr = unitData.Err;
  1441. ret = true;
  1442. }
  1443. if (repeaterR0 != unitData.R0)
  1444. {
  1445. repeaterR0 = unitData.R0;
  1446. ret = true;
  1447. }
  1448. if (repeaterR1 != unitData.R1)
  1449. {
  1450. repeaterR1 = unitData.R1;
  1451. ret = true;
  1452. }
  1453. if (repeaterR2 != unitData.R2)
  1454. {
  1455. repeaterR2 = unitData.R2;
  1456. ret = true;
  1457. }
  1458. if (repeaterR != unitData.R)
  1459. {
  1460. repeaterR = unitData.R;
  1461. ret = true;
  1462. }
  1463. if (repeaterW != unitData.W)
  1464. {
  1465. repeaterW = unitData.W;
  1466. ret = true;
  1467. }
  1468. if (repeaterS != unitData.S)
  1469. {
  1470. repeaterS = unitData.S;
  1471. ret = true;
  1472. }
  1473. }
  1474. catch (Exception ex)
  1475. {
  1476. Util.UErrorMessage(ex, 0, 0);
  1477. }
  1478. return ret;
  1479. }
  1480. //중계기 상태값 저장
  1481. private void SetStateData(RepeaterData unitData)
  1482. {
  1483. try
  1484. {
  1485. repeaterErr = unitData.Err;
  1486. repeaterNon = unitData.Non;
  1487. repeaterR0 = unitData.R0;
  1488. repeaterR1 = unitData.R1;
  1489. repeaterR2 = unitData.R2;
  1490. repeaterR = unitData.R;
  1491. repeaterW = unitData.W;
  1492. repeaterS = unitData.S;
  1493. }
  1494. catch (Exception ex)
  1495. {
  1496. Util.UErrorMessage(ex, 0, 0);
  1497. }
  1498. }
  1499. //입력데이터 저장
  1500. private void SetInputData(RepeaterData unitData)
  1501. {
  1502. try
  1503. {
  1504. input1 = inputCompute(unitData.Repeater_state_1); //2010.4.13_moon repeater -> Repeater
  1505. input2 = inputCompute(unitData.Repeater_state_2);//2010.4.13_moon repeater -> Repeater
  1506. input3 = inputCompute(unitData.Repeater_state_3);//2010.4.13_moon repeater -> Repeater
  1507. input4 = inputCompute(unitData.Repeater_state_4);//2010.4.13_moon repeater -> Repeater
  1508. }
  1509. catch (Exception ex)
  1510. {
  1511. Util.UErrorMessage(ex, 0, 0);
  1512. }
  1513. }
  1514. // cyim 2015.7.3 아날로그 감지기와 중계기 생성자 구분 -> 아날로그 감지기 입력데이터 저장하는 경우에는 매개변수가 int 값
  1515. private void SetInputData(int analogValue, AnalogLevel analogLevel, MDIParent mdi) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1516. {
  1517. try
  1518. {
  1519. input1 = inputCompute(analogValue, analogLevel, mdi); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1520. }
  1521. catch (Exception ex)
  1522. {
  1523. Util.UErrorMessage(ex, 0, 0);
  1524. }
  1525. }
  1526. // cyim 2015.7.3 아날로그 감지기와 중계기 생성자 구분 -> 일반 중계기용
  1527. bool UpdateInputData(RepeaterData unitData)
  1528. {
  1529. bool ret = false;
  1530. try
  1531. {
  1532. if (input1 != inputCompute(unitData.Repeater_state_1))
  1533. {
  1534. input1 = inputCompute(unitData.Repeater_state_1); //2010.4.13_moon repeater -> Repeater
  1535. ret = true;
  1536. }
  1537. if (input2 != inputCompute(unitData.Repeater_state_2))
  1538. {
  1539. input2 = inputCompute(unitData.Repeater_state_2); //2010.4.13_moon repeater -> Repeater
  1540. ret = true;
  1541. }
  1542. if (input3 != inputCompute(unitData.Repeater_state_3))
  1543. {
  1544. input3 = inputCompute(unitData.Repeater_state_3); //2010.4.13_moon repeater -> Repeater
  1545. ret = true;
  1546. }
  1547. if (input4 != inputCompute(unitData.Repeater_state_4))
  1548. {
  1549. input4 = inputCompute(unitData.Repeater_state_4); //2010.4.13_moon repeater -> Repeater
  1550. ret = true;
  1551. }
  1552. }
  1553. catch (Exception ex)
  1554. {
  1555. Util.UErrorMessage(ex, 0, 0);
  1556. }
  1557. return ret;
  1558. }
  1559. // cyim 2015.7.3 아날로그 감지기와 중계기 생성자 구분 -> 아날로그 감지기용
  1560. bool UpdateInputData(int analogValue, AnalogLevel analogLevel, MDIParent mdi) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1561. {
  1562. bool ret = false;
  1563. try
  1564. {
  1565. if (input1 != inputCompute(analogValue, analogLevel, mdi) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1566. || AnalogDetecterValue_Input != analogValue) // 아날로그 감지기는 정상인 상태이더라도 결국 값자체는 지속적으로 변하게된다. 값이 변경되어도 업데이트 조건에 해당된다
  1567. {
  1568. input1 = inputCompute(analogValue, analogLevel, mdi); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1569. ret = true;
  1570. }
  1571. }
  1572. catch (Exception ex)
  1573. {
  1574. Util.UErrorMessage(ex, 0, 0);
  1575. }
  1576. return ret;
  1577. }
  1578. //출력데이터 저장
  1579. private void SetOutputData(RepeaterData unitData)
  1580. {
  1581. try
  1582. {
  1583. output1 = outputCompute(unitData.Repeater_output_1_C, unitData.Repeater_output_1_W);//2010.4.13_moon repeater -> Repeater
  1584. output2 = outputCompute(unitData.Repeater_output_2_C, unitData.Repeater_output_2_W);//2010.4.13_moon repeater -> Repeater
  1585. output3 = outputCompute(unitData.Repeater_output_3_C, unitData.Repeater_output_3_W);//2010.4.13_moon repeater -> Repeater
  1586. output4 = outputCompute(unitData.Repeater_output_4_C, unitData.Repeater_output_4_W);//2010.4.13_moon repeater -> Repeater
  1587. }
  1588. catch (Exception ex)
  1589. {
  1590. Util.UErrorMessage(ex, 0, 0);
  1591. }
  1592. }
  1593. bool UpdateOutputData(RepeaterData unitData)
  1594. {
  1595. bool ret = false;
  1596. try
  1597. {
  1598. if (output1 != outputCompute(unitData.Repeater_output_1_C, unitData.Repeater_output_1_W))
  1599. {
  1600. output1 = outputCompute(unitData.Repeater_output_1_C, unitData.Repeater_output_1_W); //2010.4.13_moon repeater -> Repeater
  1601. ret = true;
  1602. }
  1603. if (output2 != outputCompute(unitData.Repeater_output_2_C, unitData.Repeater_output_2_W))
  1604. {
  1605. output2 = outputCompute(unitData.Repeater_output_2_C, unitData.Repeater_output_2_W); //2010.4.13_moon repeater -> Repeater
  1606. ret = true;
  1607. }
  1608. if (output3 != outputCompute(unitData.Repeater_output_3_C, unitData.Repeater_output_3_W))
  1609. {
  1610. output3 = outputCompute(unitData.Repeater_output_3_C, unitData.Repeater_output_3_W); //2010.4.13_moon repeater -> Repeater
  1611. ret = true;
  1612. }
  1613. if (output4 != outputCompute(unitData.Repeater_output_4_C, unitData.Repeater_output_4_W))
  1614. {
  1615. output4 = outputCompute(unitData.Repeater_output_4_C, unitData.Repeater_output_4_W); //2010.4.13_moon repeater -> Repeater
  1616. ret = true;
  1617. }
  1618. }
  1619. catch (Exception ex)
  1620. {
  1621. Util.UErrorMessage(ex, 0, 0);
  1622. }
  1623. return ret;
  1624. }
  1625. // cyim 2015.7.1 입력회로 상태값 추가
  1626. // 아날로그 감지기 연동으로 인하여 변형된 입력회로 값은 아래와 같다
  1627. //
  1628. //입력회로상태값 초기상태(-1),감지(0),정상(1),단선(3),PreFire(4)
  1629. //public enum InputDeviceStatus { Init = -1, Use = 0, Normal = 1, Blocking = 3, PreFire = 4 }
  1630. //출력회로상태값 초기상태(-1),출력없음(0),출력있음(1),차단(3)
  1631. //public enum OutputDeviceStatus { Init = -1, NotWrite = 0, Write = 1, Blocking = 3 }
  1632. //출력데이터를 UI확인값으로 형변환
  1633. private OutputDeviceStatus outputCompute(bool repeater_output_C, bool repeater_output_W)//2010.4.13_moon repeater -> Repeater
  1634. {
  1635. if (repeater_output_C == true) return OutputDeviceStatus.Blocking; //차단 //2010.4.13_moon == 1 -> == true
  1636. else if (repeater_output_W == true) return OutputDeviceStatus.Write; //출력있음 //2010.4.13_moon == 1 -> == true
  1637. else if (repeater_output_W == false) return OutputDeviceStatus.NotWrite; //출력없음 //2010.4.13_moon == 0 -> == true
  1638. else return OutputDeviceStatus.Init;
  1639. }
  1640. //입력데이터를 UI확인값으로 형변환
  1641. private InputDeviceStatus inputCompute(int repeater_state)
  1642. {
  1643. if (repeater_state == 0) return InputDeviceStatus.Use; //감지
  1644. else if (repeater_state == 1) return InputDeviceStatus.Normal; //정상
  1645. else if (repeater_state == 3) return InputDeviceStatus.Blocking; //단선
  1646. else if (repeater_state == 4) return InputDeviceStatus.PreFire; //PreFire
  1647. else return InputDeviceStatus.Init;
  1648. }
  1649. // 아날로그 감지기 연동을 위해 별도로 레벨 값 정보가 필요하다
  1650. private InputDeviceStatus inputCompute(int analogValue, AnalogLevel analogLevel, MDIParent mdi) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1651. {
  1652. // (Normal : 0, Fault :1, PreFire : 2, Fire : 3)
  1653. int repeater_state = mdi.AnalogDetect.Get_LevelStatus(analogValue, analogLevel); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1654. if (repeater_state == 3) return InputDeviceStatus.Use; //감지
  1655. else if (repeater_state == 0) return InputDeviceStatus.Normal; //정상
  1656. else if (repeater_state == 1) return InputDeviceStatus.Blocking; //단선
  1657. else if (repeater_state == 2) return InputDeviceStatus.PreFire; //PreFire
  1658. else return InputDeviceStatus.Init;
  1659. }
  1660. public bool RepeaterErr { get { return this.repeaterErr; } } //2010.4.13_moon int -> bool
  1661. public bool RepeaterNon { get { return this.repeaterNon; } } //2010.4.13_moon int -> bool
  1662. public bool RepeaterR0 { get { return this.repeaterR0; } } //2010.4.13_moon int -> bool
  1663. public bool RepeaterR1 { get { return this.repeaterR1; } } //2010.4.13_moon int -> bool
  1664. public bool RepeaterR2 { get { return this.repeaterR2; } } //2010.4.13_moon int -> bool
  1665. public bool RepeaterR { get { return this.repeaterR; } } //2010.4.13_moon int -> bool
  1666. public bool RepeaterW { get { return this.repeaterW; } } //2010.4.13_moon int -> bool
  1667. public bool RepeaterS { get { return this.repeaterS; } } //2010.4.13_moon int -> bool
  1668. public InputDeviceStatus[] Repeater_Input
  1669. {
  1670. get
  1671. {
  1672. InputDeviceStatus[] indata = new InputDeviceStatus[4] {
  1673. this.input1,this.input2,this.input3,this.input4
  1674. };
  1675. return indata;
  1676. }
  1677. }
  1678. public InputDeviceStatus Repeater_Input1 { get { return this.input1; } }
  1679. public InputDeviceStatus Repeater_Input2 { get { return this.input2; } }
  1680. public InputDeviceStatus Repeater_Input3 { get { return this.input3; } }
  1681. public InputDeviceStatus Repeater_Input4 { get { return this.input4; } }
  1682. public OutputDeviceStatus[] Repeater_Output
  1683. {
  1684. get
  1685. {
  1686. OutputDeviceStatus[] outdata = new OutputDeviceStatus[4] {
  1687. this.output1,this.output2,this.output3,this.output4
  1688. };
  1689. return outdata;
  1690. }
  1691. set
  1692. {
  1693. this.output1 = value[0];
  1694. this.output2 = value[1];
  1695. this.output3 = value[2];
  1696. this.output4 = value[3];
  1697. }
  1698. }
  1699. public OutputDeviceStatus Repeater_Output1 { get { return this.output1; } }
  1700. public OutputDeviceStatus Repeater_Output2 { get { return this.output2; } }
  1701. public OutputDeviceStatus Repeater_Output3 { get { return this.output3; } }
  1702. public OutputDeviceStatus Repeater_Output4 { get { return this.output4; } }
  1703. }
  1704. /************************************************************************************************************************/
  1705. /* 중계기 상태값 및 회로 데이터 [끝] */
  1706. /************************************************************************************************************************/
  1707. }