IST0050MF.cpp 7.0 KB

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