IFM0030MF.cpp 7.1 KB

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