IHS0050MF.cpp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "IHS0050MF.h"
  9. #include "IHS00501F.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalendar"
  14. #pragma link "cxContainer"
  15. #pragma link "cxControls"
  16. #pragma link "cxDropDownEdit"
  17. #pragma link "cxEdit"
  18. #pragma link "cxGraphics"
  19. #pragma link "cxGroupBox"
  20. #pragma link "cxLabel"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxSpinEdit"
  27. #pragma link "cxTextEdit"
  28. #pragma link "cxTimeEdit"
  29. #pragma link "dxSkinBlack"
  30. #pragma link "dxSkinBlue"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinscxPCPainter"
  33. #pragma resource "*.dfm"
  34. TIHS0050M *IHS0050M = NULL;
  35. //---------------------------------------------------------------------------
  36. __fastcall TIHS0050M::TIHS0050M(TComponent* Owner)
  37. : TForm(Owner)
  38. {
  39. LangTrans->Translate(this, ITSDb_GetConnection());
  40. ITSSkin_Load(this);
  41. CMM_LoadForm(g_sFormsDir, this);
  42. FTitle = Caption;//"시설물 장애내역";
  43. m_pFormList = new TList();
  44. TsList01->TabVisible = false;
  45. CbType->Properties->Items->Clear();
  46. CbType->Properties->Items->Add(lblAll->Caption);//"전 체");
  47. #ifdef USE_CCTV
  48. CbType->Properties->Items->Add("CCTV");
  49. #endif
  50. #ifdef USE_VMS
  51. CbType->Properties->Items->Add("VMS");
  52. #endif
  53. #ifdef USE_VDS
  54. CbType->Properties->Items->Add("VDS");
  55. #endif
  56. #ifdef USE_AVI
  57. CbType->Properties->Items->Add("AVI");
  58. #endif
  59. #ifdef USE_DSRC
  60. CbType->Properties->Items->Add("DSRC");
  61. #endif
  62. #ifdef USE_WCAM
  63. CbType->Properties->Items->Add(FrmLang->lblWebCam->Caption);//"웹카메라");
  64. #endif
  65. #ifdef USE_CCAM
  66. CbType->Properties->Items->Add(FrmLang->lblCrsCam->Caption);//"웹카메라");
  67. #endif
  68. #ifdef USE_PARK
  69. CbType->Properties->Items->Add("주차장");
  70. #endif
  71. CbType->ItemIndex = 1;
  72. }
  73. //---------------------------------------------------------------------------
  74. /*
  75. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  76. * Form과 DataModule class를 delete시킨다.
  77. * arguments
  78. *
  79. * return
  80. * void
  81. */
  82. void __fastcall TIHS0050M::CommClose()
  83. {
  84. try
  85. {
  86. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  87. {
  88. m_pFormList->Delete(idx);
  89. }
  90. delete m_pFormList;
  91. CMM_SaveForm(g_sFormsDir, this);
  92. }
  93. catch(...)
  94. {
  95. }
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TIHS0050M::FormShow(TObject *Sender)
  99. {
  100. Refresh();
  101. FormInit();
  102. TmrShow->Enabled = true;
  103. }
  104. //---------------------------------------------------------------------------
  105. void __fastcall TIHS0050M::FormInit()
  106. {
  107. DtStDate->Date = Now() - 1;
  108. DtEdDate->Date = Now() - 1;
  109. //DtStTime->EditValue = "00";//Now().FormatString("hh");
  110. //DtEdTime->EditValue = Now().FormatString("hh");
  111. DtStTime->Time = StrToDateTime("00:00");
  112. DtEdTime->Time = StrToDateTime("23:59");
  113. }
  114. //---------------------------------------------------------------------------
  115. void __fastcall TIHS0050M::TmrShowTimer(TObject *Sender)
  116. {
  117. TmrShow->Enabled = false;
  118. }
  119. //---------------------------------------------------------------------------
  120. void __fastcall TIHS0050M::RefreshData()
  121. {
  122. // 검색조건에 의한 링크 데이터 조회
  123. try
  124. {
  125. //SelListData();
  126. }
  127. __finally
  128. {
  129. }
  130. }
  131. //---------------------------------------------------------------------------
  132. void __fastcall TIHS0050M::BtnSearchClick(TObject *Sender)
  133. {
  134. Application->ProcessMessages();
  135. TSqlCursor sqlCrs((TControl*)BtnSearch);
  136. #if 0
  137. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  138. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  139. #else
  140. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  141. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  142. #endif
  143. if (FStDateTime > FEdDateTime)
  144. {
  145. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  146. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  147. ActiveControl = DtStDate;
  148. return;
  149. }
  150. #if 0
  151. FStDateTime = FStDateTime + "0000";
  152. FEdDateTime = FEdDateTime + "5959";
  153. #else
  154. FStDateTime = FStDateTime + "00";
  155. FEdDateTime = FEdDateTime + "59";
  156. #endif
  157. FIdList = String(CbType->ItemIndex);
  158. String sTypeNm = CbType->Text.Trim();
  159. #if 0
  160. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  161. #else
  162. String sTitle = CbType->Text;
  163. #endif
  164. try
  165. {
  166. Application->ProcessMessages();
  167. LockWindowUpdate(Handle);
  168. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, CbType->Text);
  169. if (!pSheet) return;
  170. IHS00501 = new TIHS00501(this, Handle, CbType->Text, FStDateTime, FEdDateTime, FIdList, sTypeNm);
  171. IHS00501->Parent = pSheet;
  172. IHS00501->Show();
  173. PgTab->ActivePage = pSheet;
  174. pSheet = PgTab->ActivePage;
  175. m_pFormList->Add(IHS00501);
  176. }
  177. __finally
  178. {
  179. LockWindowUpdate(0);
  180. }
  181. }
  182. //---------------------------------------------------------------------------
  183. void __fastcall TIHS0050M::BtnCloseClick(TObject *Sender)
  184. {
  185. Close();
  186. }
  187. //---------------------------------------------------------------------------
  188. void __fastcall TIHS0050M::OnSubFormClose(TMessage Msg)
  189. {
  190. int nActiveIdx = PgTab->ActivePageIndex;
  191. if (nActiveIdx <= 0) return;
  192. LockWindowUpdate(Handle);
  193. TcxTabSheet *pSheet = PgTab->ActivePage;
  194. if (pSheet)
  195. {
  196. delete pSheet;
  197. }
  198. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  199. m_pFormList->Delete(nActiveIdx);
  200. LockWindowUpdate(0);
  201. }
  202. //---------------------------------------------------------------------------
  203. void __fastcall TIHS0050M::PgTabDblClick(TObject *Sender)
  204. {
  205. TPoint APoint;
  206. APoint = PgTab->MouseDownPos;
  207. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  208. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  209. }
  210. //---------------------------------------------------------------------------
  211. void __fastcall TIHS0050M::FormClose(TObject *Sender, TCloseAction &Action)
  212. {
  213. CommClose();
  214. IHS0050M = NULL;
  215. Action = caFree;
  216. }
  217. //---------------------------------------------------------------------------
  218. void __fastcall TIHS0050M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  219. {
  220. int nActiveIdx = ATabIndex;
  221. if (nActiveIdx <= 0) return;
  222. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  223. m_pFormList->Delete(nActiveIdx);
  224. }
  225. //---------------------------------------------------------------------------