IFM0030MF.cpp 6.2 KB

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