IFM0030MF.cpp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "ITSDbF.h"
  6. #include "AppGlobalF.h"
  7. #include "CDSFacilityF.h"
  8. #include "CDSFacilityFailF.h"
  9. #pragma hdrstop
  10. #include "IFM0030MF.h"
  11. #include "IHS0050MF.h"
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma link "cxCalc"
  15. #pragma link "cxCheckBox"
  16. #pragma link "cxClasses"
  17. #pragma link "cxCustomData"
  18. #pragma link "cxData"
  19. #pragma link "cxDataStorage"
  20. #pragma link "cxFilter"
  21. #pragma link "cxGrid"
  22. #pragma link "cxGridCustomTableView"
  23. #pragma link "cxGridCustomView"
  24. #pragma link "cxGridLevel"
  25. #pragma link "cxGridTableView"
  26. #pragma link "cxLabel"
  27. #pragma link "cxStyles"
  28. #pragma link "dxSkinscxPCPainter"
  29. #pragma link "FRAME_FacilityFailF"
  30. #pragma link "FRAME_FacilityFailActionF"
  31. #pragma link "dxSkinsForm"
  32. #pragma resource "*.dfm"
  33. TIFM0030M *IFM0030M = NULL;
  34. //---------------------------------------------------------------------------
  35. __fastcall TIFM0030M::TIFM0030M(TComponent* Owner)
  36. : TForm(Owner)
  37. {
  38. #ifdef D_GJ
  39. BtnErrorHistory->Visible = true;
  40. #else
  41. BtnErrorHistory->Visible = false;
  42. #endif
  43. ITSSkin_Load(this);
  44. CMM_LoadForm(g_sFormsDir, this);
  45. FRAMEFacilityList1->PnlTop->Visible = false;
  46. FRAMEFacilityList1->TvList->OptionsData->Editing = false;
  47. }
  48. //---------------------------------------------------------------------------
  49. /*
  50. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  51. * Form과 DataModule class를 delete시킨다.
  52. * arguments
  53. *
  54. * return
  55. * void
  56. */
  57. void __fastcall TIFM0030M::CommClose()
  58. {
  59. try
  60. {
  61. CMM_SaveForm(g_sFormsDir, this);
  62. }
  63. catch(...)
  64. {
  65. }
  66. }
  67. //---------------------------------------------------------------------------
  68. /*
  69. * form 초기화
  70. *
  71. * arguments
  72. *
  73. * return
  74. * void
  75. */
  76. void __fastcall TIFM0030M::FormInit()
  77. {
  78. m_pGDC = FRAMEFacilityList1->TvList->DataController;
  79. }
  80. //---------------------------------------------------------------------------
  81. /*
  82. * Form을 보여줄때 호출되는 event 메서드이다.
  83. * arguments
  84. * Sender : event handler 객체
  85. * return
  86. * void
  87. */
  88. void __fastcall TIFM0030M::FormShow(TObject *Sender)
  89. {
  90. Refresh();
  91. FormInit();
  92. TmrShow->Enabled = true;
  93. }
  94. //---------------------------------------------------------------------------
  95. /*
  96. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  97. * arguments
  98. * Sender : event handler 객체
  99. * return
  100. * void
  101. */
  102. void __fastcall TIFM0030M::TmrShowTimer(TObject *Sender)
  103. {
  104. TmrShow->Enabled = false;
  105. BtnSearchClick((TObject*)BtnSearch);
  106. }
  107. //---------------------------------------------------------------------------
  108. /*
  109. * Search 버튼 클릭 이벤트 핸들러
  110. * arguments
  111. * Sender : event handler 객체
  112. * return
  113. * void
  114. */
  115. void __fastcall TIFM0030M::BtnSearchClick(TObject *Sender)
  116. {
  117. RefreshData();
  118. }
  119. //---------------------------------------------------------------------------
  120. /*
  121. * Refresh Data Event Function
  122. * arguments
  123. *
  124. * return
  125. * void
  126. */
  127. void __fastcall TIFM0030M::RefreshData()
  128. {
  129. FRAMEFacilityList1->UpdateList();
  130. }
  131. //---------------------------------------------------------------------------
  132. /*
  133. * Close 버튼 클릭 이벤트 핸들러
  134. * arguments
  135. * Sender : event handler 객체
  136. * return
  137. * void
  138. */
  139. void __fastcall TIFM0030M::BtnCloseClick(TObject *Sender)
  140. {
  141. Close();
  142. }
  143. //---------------------------------------------------------------------------
  144. void __fastcall TIFM0030M::FormClose(TObject *Sender, TCloseAction &Action)
  145. {
  146. CommClose();
  147. IFM0030M = NULL;
  148. Action = caFree;
  149. }
  150. //---------------------------------------------------------------------------
  151. void __fastcall TIFM0030M::FRAMEFacilityList1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
  152. TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged)
  153. {
  154. if (!AFocusedRecord)
  155. {
  156. FRAMEFacilityFail1->UpdateCheck();
  157. FRAMEFacilityFail1->UpdateList(NULL);
  158. return;
  159. }
  160. if (FRAMEFacilityList1->TvList->ViewData->RecordCount <= 0) return;
  161. int nIndex = m_pGDC->FocusedRecordIndex;
  162. if (nIndex < 0) return;
  163. int nMemPtr = m_pGDC->Values[nIndex][FRAMEFacilityList1->Column99->Index];
  164. if (nMemPtr == 0) return;
  165. FRAMEFacilityFail1->UpdateCheck();
  166. FRAMEFacilityFail1->UpdateList((TItsFacility*)nMemPtr);
  167. }
  168. //---------------------------------------------------------------------------
  169. void __fastcall TIFM0030M::FRAMEFacilityFail1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
  170. TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged)
  171. {
  172. if (!AFocusedRecord)
  173. {
  174. FRAMEFacilityFailAction1->UpdateCheck();
  175. FRAMEFacilityFailAction1->UpdateList(NULL);
  176. return;
  177. }
  178. if (FRAMEFacilityFail1->TvList->ViewData->RecordCount <= 0) return;
  179. int nIndex = FRAMEFacilityFail1->TvList->DataController->FocusedRecordIndex;
  180. if (nIndex < 0) return;
  181. int nMemPtr = FRAMEFacilityFail1->TvList->DataController->Values[nIndex][FRAMEFacilityFail1->Column99->Index];
  182. if (nMemPtr == 0) return;
  183. FRAMEFacilityFailAction1->UpdateCheck();
  184. FRAMEFacilityFailAction1->UpdateList((TItsFacilityFail*)nMemPtr);
  185. }
  186. //---------------------------------------------------------------------------
  187. void __fastcall TIFM0030M::FormCloseQuery(TObject *Sender, bool &CanClose)
  188. {
  189. FRAMEFacilityFailAction1->OnCloseQuery(CanClose);
  190. FRAMEFacilityFail1->OnCloseQuery(CanClose);
  191. try
  192. {
  193. if (ItsFacilityFailManager)
  194. {
  195. delete ItsFacilityFailManager;
  196. ItsFacilityFailManager = NULL;
  197. }
  198. }
  199. catch(...)
  200. {
  201. }
  202. }
  203. //---------------------------------------------------------------------------
  204. void __fastcall TIFM0030M::BtnErrorHistoryClick(TObject *Sender)
  205. {
  206. if (IHS0050M)
  207. {
  208. try {
  209. ShowWindow(IHS0050M->Handle, SW_RESTORE);
  210. IHS0050M->BringToFront();
  211. } catch(...) {}
  212. }
  213. else
  214. {
  215. Application->CreateForm(__classid(TIHS0050M), &IHS0050M);
  216. if (IHS0050M) IHS0050M->Show();
  217. }
  218. }
  219. //---------------------------------------------------------------------------
  220. DWORD CUSTOM_ITEMS[2] = { COLOR_ACTIVECAPTION, COLOR_CAPTIONTEXT };
  221. TColor CUSTOM_COLORS[2] = { clRed, clYellow };
  222. TColor FStandardColors[2];
  223. void __fastcall TIFM0030M::FormActivate(TObject *Sender)
  224. {
  225. #if 0
  226. FStandardColors[0] = GetSysColor(COLOR_ACTIVECAPTION);
  227. FStandardColors[1] = GetSysColor(COLOR_CAPTIONTEXT );
  228. SetSysColors(2, (CONST INT *)CUSTOM_ITEMS, (CONST COLORREF *)CUSTOM_COLORS);
  229. #endif
  230. }
  231. //---------------------------------------------------------------------------