IFM0030MF.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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 link "cxEditRepositoryItems"
  33. #pragma resource "*.dfm"
  34. TIFM0030M *IFM0030M = NULL;
  35. //---------------------------------------------------------------------------
  36. __fastcall TIFM0030M::TIFM0030M(TComponent* Owner)
  37. : TForm(Owner)
  38. {
  39. BtnErrorHistory->Visible = true;
  40. ITSSkin_Load(this);
  41. CMM_LoadForm(g_sFormsDir, this);
  42. FRAMEFacilityList1->PnlTop->Visible = false;
  43. FRAMEFacilityList1->PnlBottom->Visible = false;
  44. FRAMEFacilityList1->TvList->OptionsData->Editing = false;
  45. }
  46. //---------------------------------------------------------------------------
  47. /*
  48. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  49. * Form과 DataModule class를 delete시킨다.
  50. * arguments
  51. *
  52. * return
  53. * void
  54. */
  55. void __fastcall TIFM0030M::CommClose()
  56. {
  57. try
  58. {
  59. CMM_SaveForm(g_sFormsDir, this);
  60. }
  61. catch(...)
  62. {
  63. }
  64. }
  65. //---------------------------------------------------------------------------
  66. /*
  67. * form 초기화
  68. *
  69. * arguments
  70. *
  71. * return
  72. * void
  73. */
  74. void __fastcall TIFM0030M::FormInit()
  75. {
  76. m_pGDC = FRAMEFacilityList1->TvList->DataController;
  77. }
  78. //---------------------------------------------------------------------------
  79. /*
  80. * Form을 보여줄때 호출되는 event 메서드이다.
  81. * arguments
  82. * Sender : event handler 객체
  83. * return
  84. * void
  85. */
  86. void __fastcall TIFM0030M::FormShow(TObject *Sender)
  87. {
  88. Refresh();
  89. FormInit();
  90. TmrShow->Enabled = true;
  91. }
  92. //---------------------------------------------------------------------------
  93. /*
  94. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  95. * arguments
  96. * Sender : event handler 객체
  97. * return
  98. * void
  99. */
  100. void __fastcall TIFM0030M::TmrShowTimer(TObject *Sender)
  101. {
  102. TmrShow->Enabled = false;
  103. BtnSearchClick((TObject*)BtnSearch);
  104. }
  105. //---------------------------------------------------------------------------
  106. /*
  107. * Search 버튼 클릭 이벤트 핸들러
  108. * arguments
  109. * Sender : event handler 객체
  110. * return
  111. * void
  112. */
  113. void __fastcall TIFM0030M::BtnSearchClick(TObject *Sender)
  114. {
  115. RefreshData();
  116. }
  117. //---------------------------------------------------------------------------
  118. /*
  119. * Refresh Data Event Function
  120. * arguments
  121. *
  122. * return
  123. * void
  124. */
  125. void __fastcall TIFM0030M::RefreshData()
  126. {
  127. FRAMEFacilityList1->UpdateList();
  128. }
  129. //---------------------------------------------------------------------------
  130. /*
  131. * Close 버튼 클릭 이벤트 핸들러
  132. * arguments
  133. * Sender : event handler 객체
  134. * return
  135. * void
  136. */
  137. void __fastcall TIFM0030M::BtnCloseClick(TObject *Sender)
  138. {
  139. Close();
  140. }
  141. //---------------------------------------------------------------------------
  142. void __fastcall TIFM0030M::FormClose(TObject *Sender, TCloseAction &Action)
  143. {
  144. CommClose();
  145. IFM0030M = NULL;
  146. Action = caFree;
  147. }
  148. //---------------------------------------------------------------------------
  149. void __fastcall TIFM0030M::FRAMEFacilityList1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
  150. TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged)
  151. {
  152. if (!AFocusedRecord)
  153. {
  154. FRAMEFacilityFail1->UpdateCheck();
  155. FRAMEFacilityFail1->UpdateList(NULL);
  156. return;
  157. }
  158. if (FRAMEFacilityList1->TvList->ViewData->RecordCount <= 0) return;
  159. int nIndex = m_pGDC->FocusedRecordIndex;
  160. if (nIndex < 0) return;
  161. int nMemPtr = m_pGDC->Values[nIndex][FRAMEFacilityList1->Column99->Index];
  162. if (nMemPtr == 0) return;
  163. FRAMEFacilityFail1->UpdateCheck();
  164. FRAMEFacilityFail1->UpdateList((TItsFacility*)nMemPtr);
  165. }
  166. //---------------------------------------------------------------------------
  167. void __fastcall TIFM0030M::FRAMEFacilityFail1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
  168. TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged)
  169. {
  170. if (!AFocusedRecord)
  171. {
  172. FRAMEFacilityFailAction1->UpdateCheck();
  173. FRAMEFacilityFailAction1->UpdateList(NULL);
  174. return;
  175. }
  176. if (FRAMEFacilityFail1->TvList->ViewData->RecordCount <= 0) return;
  177. int nIndex = FRAMEFacilityFail1->TvList->DataController->FocusedRecordIndex;
  178. if (nIndex < 0) return;
  179. int nMemPtr = FRAMEFacilityFail1->TvList->DataController->Values[nIndex][FRAMEFacilityFail1->Column99->Index];
  180. if (nMemPtr == 0) return;
  181. FRAMEFacilityFailAction1->UpdateCheck();
  182. FRAMEFacilityFailAction1->UpdateList((TItsFacilityFail*)nMemPtr);
  183. }
  184. //---------------------------------------------------------------------------
  185. void __fastcall TIFM0030M::FormCloseQuery(TObject *Sender, bool &CanClose)
  186. {
  187. FRAMEFacilityFailAction1->OnCloseQuery(CanClose);
  188. FRAMEFacilityFail1->OnCloseQuery(CanClose);
  189. try
  190. {
  191. if (ItsFacilityFailManager)
  192. {
  193. delete ItsFacilityFailManager;
  194. ItsFacilityFailManager = NULL;
  195. }
  196. }
  197. catch(...)
  198. {
  199. }
  200. }
  201. //---------------------------------------------------------------------------
  202. void __fastcall TIFM0030M::BtnErrorHistoryClick(TObject *Sender)
  203. {
  204. if (IHS0050M)
  205. {
  206. try {
  207. ShowWindow(IHS0050M->Handle, SW_RESTORE);
  208. IHS0050M->BringToFront();
  209. } catch(...) {}
  210. }
  211. else
  212. {
  213. Application->CreateForm(__classid(TIHS0050M), &IHS0050M);
  214. if (IHS0050M) IHS0050M->Show();
  215. }
  216. }
  217. //---------------------------------------------------------------------------