IHS0050MF.cpp 6.8 KB

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