IFM0030MF.cpp 6.6 KB

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