IST0050MF.cpp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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 "IST0050MF.h"
  9. #include "IST00501F.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 "cxSplitter"
  28. #pragma link "cxTextEdit"
  29. #pragma link "cxTimeEdit"
  30. #pragma link "dxSkinBlack"
  31. #pragma link "dxSkinBlue"
  32. #pragma link "dxSkinsCore"
  33. #pragma link "dxSkinscxPCPainter"
  34. #pragma resource "*.dfm"
  35. TIST0050M *IST0050M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TIST0050M::TIST0050M(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. #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->Properties->Items->Add("기상연계");
  72. CbType->ItemIndex = 0;
  73. }
  74. //---------------------------------------------------------------------------
  75. void __fastcall TIST0050M::CommClose()
  76. {
  77. try
  78. {
  79. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  80. {
  81. m_pFormList->Delete(idx);
  82. }
  83. delete m_pFormList;
  84. CMM_SaveForm(g_sFormsDir, this);
  85. }
  86. catch(...)
  87. {
  88. }
  89. }
  90. //---------------------------------------------------------------------------
  91. void __fastcall TIST0050M::FormShow(TObject *Sender)
  92. {
  93. Refresh();
  94. FormInit();
  95. TmrShow->Enabled = true;
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TIST0050M::FormInit()
  99. {
  100. DtStDate->Date = Now() - 1;
  101. DtEdDate->Date = Now() - 1;
  102. //DtStTime->EditValue = "00";//Now().FormatString("hh");
  103. //DtEdTime->EditValue = "23";//Now().FormatString("hh");
  104. DtStTime->Time = StrToDateTime("00:00");
  105. DtEdTime->Time = StrToDateTime("23:59");
  106. }
  107. //---------------------------------------------------------------------------
  108. void __fastcall TIST0050M::TmrShowTimer(TObject *Sender)
  109. {
  110. TmrShow->Enabled = false;
  111. }
  112. //---------------------------------------------------------------------------
  113. void __fastcall TIST0050M::RefreshData()
  114. {
  115. // 검색조건에 의한 링크 데이터 조회
  116. try
  117. {
  118. //SelListData();
  119. }
  120. __finally
  121. {
  122. }
  123. }
  124. //---------------------------------------------------------------------------
  125. void __fastcall TIST0050M::BtnSearchClick(TObject *Sender)
  126. {
  127. Application->ProcessMessages();
  128. TSqlCursor sqlCrs((TControl*)BtnSearch);
  129. #if 0
  130. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  131. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  132. #else
  133. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  134. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  135. #endif
  136. if (FStDateTime > FEdDateTime)
  137. {
  138. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  139. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  140. ActiveControl = DtStDate;
  141. return;
  142. }
  143. #if 0
  144. FStDateTime = FStDateTime + "0000";
  145. FEdDateTime = FEdDateTime + "5959";
  146. #else
  147. FStDateTime = FStDateTime + "00";
  148. FEdDateTime = FEdDateTime + "59";
  149. #endif
  150. String sTypeNm = CbType->Text.Trim();
  151. if (sTypeNm == "" || CbType->ItemIndex < 0)
  152. {
  153. Application->MessageBox(lblSelErr->Caption.c_str(),//L"시설물을 선택하세요.",
  154. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  155. ActiveControl = CbType;
  156. return;
  157. }
  158. FIdList = String(CbType->ItemIndex);
  159. #if 0
  160. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  161. #else
  162. String sTitle = "[" + sTypeNm + "]";
  163. #endif
  164. try
  165. {
  166. Application->ProcessMessages();
  167. LockWindowUpdate(Handle);
  168. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  169. if (!pSheet) return;
  170. IST00501 = new TIST00501(this, Handle, CbType->Text, FStDateTime, FEdDateTime, FIdList, sTypeNm);
  171. IST00501->Parent = pSheet;
  172. IST00501->Show();
  173. PgTab->ActivePage = pSheet;
  174. pSheet = PgTab->ActivePage;
  175. m_pFormList->Add(IST00501);
  176. }
  177. __finally
  178. {
  179. LockWindowUpdate(0);
  180. }
  181. }
  182. //---------------------------------------------------------------------------
  183. void __fastcall TIST0050M::BtnCloseClick(TObject *Sender)
  184. {
  185. Close();
  186. }
  187. //---------------------------------------------------------------------------
  188. void __fastcall TIST0050M::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 TIST0050M::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 TIST0050M::FormClose(TObject *Sender, TCloseAction &Action)
  212. {
  213. CommClose();
  214. IST0050M = NULL;
  215. Action = caFree;
  216. }
  217. //---------------------------------------------------------------------------
  218. void __fastcall TIST0050M::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. //---------------------------------------------------------------------------