IST0050MF.cpp 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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_PARK2
  70. CbType->Properties->Items->Add("주차장");
  71. #endif
  72. #ifdef USE_PARK
  73. CbType->Properties->Items->Add(FrmLang->lblPrkPlce->Caption);
  74. #endif
  75. //CbType->Properties->Items->Add("기상연계");
  76. CbType->ItemIndex = 0;
  77. }
  78. //---------------------------------------------------------------------------
  79. void __fastcall TIST0050M::CommClose()
  80. {
  81. try
  82. {
  83. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  84. {
  85. m_pFormList->Delete(idx);
  86. }
  87. delete m_pFormList;
  88. CMM_SaveForm(g_sFormsDir, this);
  89. }
  90. catch(...)
  91. {
  92. }
  93. }
  94. //---------------------------------------------------------------------------
  95. void __fastcall TIST0050M::FormShow(TObject *Sender)
  96. {
  97. Refresh();
  98. FormInit();
  99. TmrShow->Enabled = true;
  100. }
  101. //---------------------------------------------------------------------------
  102. void __fastcall TIST0050M::FormInit()
  103. {
  104. DtStDate->Date = Now() - 1;
  105. DtEdDate->Date = Now() - 1;
  106. //DtStTime->EditValue = "00";//Now().FormatString("hh");
  107. //DtEdTime->EditValue = "23";//Now().FormatString("hh");
  108. DtStTime->Time = StrToDateTime("00:00");
  109. DtEdTime->Time = StrToDateTime("23:59");
  110. }
  111. //---------------------------------------------------------------------------
  112. void __fastcall TIST0050M::TmrShowTimer(TObject *Sender)
  113. {
  114. TmrShow->Enabled = false;
  115. }
  116. //---------------------------------------------------------------------------
  117. void __fastcall TIST0050M::RefreshData()
  118. {
  119. // 검색조건에 의한 링크 데이터 조회
  120. try
  121. {
  122. //SelListData();
  123. }
  124. __finally
  125. {
  126. }
  127. }
  128. //---------------------------------------------------------------------------
  129. void __fastcall TIST0050M::BtnSearchClick(TObject *Sender)
  130. {
  131. Application->ProcessMessages();
  132. TSqlCursor sqlCrs((TControl*)BtnSearch);
  133. #if 0
  134. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  135. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  136. #else
  137. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  138. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  139. #endif
  140. if (FStDateTime > FEdDateTime)
  141. {
  142. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  143. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  144. ActiveControl = DtStDate;
  145. return;
  146. }
  147. #if 0
  148. FStDateTime = FStDateTime + "0000";
  149. FEdDateTime = FEdDateTime + "5959";
  150. #else
  151. FStDateTime = FStDateTime + "00";
  152. FEdDateTime = FEdDateTime + "59";
  153. #endif
  154. String sTypeNm = CbType->Text.Trim();
  155. if (sTypeNm == "" || CbType->ItemIndex < 0)
  156. {
  157. Application->MessageBox(lblSelErr->Caption.c_str(),//L"시설물을 선택하세요.",
  158. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  159. ActiveControl = CbType;
  160. return;
  161. }
  162. FIdList = String(CbType->ItemIndex);
  163. #if 0
  164. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  165. #else
  166. String sTitle = "[" + sTypeNm + "]";
  167. #endif
  168. try
  169. {
  170. Application->ProcessMessages();
  171. LockWindowUpdate(Handle);
  172. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  173. if (!pSheet) return;
  174. IST00501 = new TIST00501(this, Handle, CbType->Text, FStDateTime, FEdDateTime, FIdList, sTypeNm);
  175. IST00501->Parent = pSheet;
  176. IST00501->Show();
  177. PgTab->ActivePage = pSheet;
  178. pSheet = PgTab->ActivePage;
  179. m_pFormList->Add(IST00501);
  180. }
  181. __finally
  182. {
  183. LockWindowUpdate(0);
  184. }
  185. }
  186. //---------------------------------------------------------------------------
  187. void __fastcall TIST0050M::BtnCloseClick(TObject *Sender)
  188. {
  189. Close();
  190. }
  191. //---------------------------------------------------------------------------
  192. void __fastcall TIST0050M::OnSubFormClose(TMessage Msg)
  193. {
  194. int nActiveIdx = PgTab->ActivePageIndex;
  195. if (nActiveIdx <= 0) return;
  196. LockWindowUpdate(Handle);
  197. TcxTabSheet *pSheet = PgTab->ActivePage;
  198. if (pSheet)
  199. {
  200. delete pSheet;
  201. }
  202. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  203. m_pFormList->Delete(nActiveIdx);
  204. LockWindowUpdate(0);
  205. }
  206. //---------------------------------------------------------------------------
  207. void __fastcall TIST0050M::PgTabDblClick(TObject *Sender)
  208. {
  209. TPoint APoint;
  210. APoint = PgTab->MouseDownPos;
  211. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  212. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  213. }
  214. //---------------------------------------------------------------------------
  215. void __fastcall TIST0050M::FormClose(TObject *Sender, TCloseAction &Action)
  216. {
  217. CommClose();
  218. IST0050M = NULL;
  219. Action = caFree;
  220. }
  221. //---------------------------------------------------------------------------
  222. void __fastcall TIST0050M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  223. {
  224. int nActiveIdx = ATabIndex;
  225. if (nActiveIdx <= 0) return;
  226. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  227. m_pFormList->Delete(nActiveIdx);
  228. }
  229. //---------------------------------------------------------------------------