IST0050MF.cpp 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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. CbType->ItemIndex = 0;
  66. }
  67. //---------------------------------------------------------------------------
  68. /*
  69. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  70. * Form과 DataModule class를 delete시킨다.
  71. * arguments
  72. *
  73. * return
  74. * void
  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. /*
  93. * Form을 보여줄때 호출되는 event 메서드이다.
  94. * arguments
  95. * Sender : event handler 객체
  96. * return
  97. * void
  98. */
  99. void __fastcall TIST0050M::FormShow(TObject *Sender)
  100. {
  101. Refresh();
  102. FormInit();
  103. TmrShow->Enabled = true;
  104. }
  105. //---------------------------------------------------------------------------
  106. /*
  107. * form 초기화
  108. *
  109. * arguments
  110. *
  111. * return
  112. * void
  113. */
  114. void __fastcall TIST0050M::FormInit()
  115. {
  116. DtStDate->Date = Now() - 1;
  117. DtEdDate->Date = Now() - 1;
  118. //DtStTime->EditValue = "00";//Now().FormatString("hh");
  119. //DtEdTime->EditValue = "23";//Now().FormatString("hh");
  120. DtStTime->Time = StrToDateTime("00:00");
  121. DtEdTime->Time = StrToDateTime("23:59");
  122. }
  123. //---------------------------------------------------------------------------
  124. /*
  125. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  126. * arguments
  127. * Sender : event handler 객체
  128. * return
  129. * void
  130. */
  131. void __fastcall TIST0050M::TmrShowTimer(TObject *Sender)
  132. {
  133. TmrShow->Enabled = false;
  134. }
  135. //---------------------------------------------------------------------------
  136. /*
  137. * Refresh Data Event Function
  138. * arguments
  139. *
  140. * return
  141. * void
  142. */
  143. void __fastcall TIST0050M::RefreshData()
  144. {
  145. // 검색조건에 의한 링크 데이터 조회
  146. try
  147. {
  148. //SelListData();
  149. }
  150. __finally
  151. {
  152. }
  153. }
  154. //---------------------------------------------------------------------------
  155. /*
  156. * Search 버튼 클릭 이벤트 핸들러
  157. * arguments
  158. * Sender : event handler 객체
  159. * return
  160. * void
  161. */
  162. void __fastcall TIST0050M::BtnSearchClick(TObject *Sender)
  163. {
  164. Application->ProcessMessages();
  165. TSqlCursor sqlCrs((TControl*)BtnSearch);
  166. #if 0
  167. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  168. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  169. #else
  170. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  171. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  172. #endif
  173. if (FStDateTime > FEdDateTime)
  174. {
  175. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  176. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  177. ActiveControl = DtStDate;
  178. return;
  179. }
  180. #if 0
  181. FStDateTime = FStDateTime + "0000";
  182. FEdDateTime = FEdDateTime + "5959";
  183. #else
  184. FStDateTime = FStDateTime + "00";
  185. FEdDateTime = FEdDateTime + "59";
  186. #endif
  187. String sTypeNm = CbType->Text.Trim();
  188. if (sTypeNm == "" || CbType->ItemIndex < 0)
  189. {
  190. Application->MessageBox(lblSelErr->Caption.c_str(),//L"시설물을 선택하세요.",
  191. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  192. ActiveControl = CbType;
  193. return;
  194. }
  195. FIdList = String(CbType->ItemIndex);
  196. #if 0
  197. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  198. #else
  199. String sTitle = "[" + sTypeNm + "]";
  200. #endif
  201. try
  202. {
  203. Application->ProcessMessages();
  204. LockWindowUpdate(Handle);
  205. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  206. if (!pSheet) return;
  207. IST00501 = new TIST00501(this, Handle, CbType->Text, FStDateTime, FEdDateTime, FIdList, sTypeNm);
  208. IST00501->Parent = pSheet;
  209. IST00501->Show();
  210. PgTab->ActivePage = pSheet;
  211. pSheet = PgTab->ActivePage;
  212. m_pFormList->Add(IST00501);
  213. }
  214. __finally
  215. {
  216. LockWindowUpdate(0);
  217. }
  218. }
  219. //---------------------------------------------------------------------------
  220. /*
  221. * Close 버튼 클릭 이벤트 핸들러
  222. * arguments
  223. * Sender : event handler 객체
  224. * return
  225. * void
  226. */
  227. void __fastcall TIST0050M::BtnCloseClick(TObject *Sender)
  228. {
  229. Close();
  230. }
  231. //---------------------------------------------------------------------------
  232. /*
  233. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  234. * arguments
  235. * Sender : event handler 객체
  236. * return
  237. * void
  238. */
  239. void __fastcall TIST0050M::OnSubFormClose(TMessage Msg)
  240. {
  241. int nActiveIdx = PgTab->ActivePageIndex;
  242. if (nActiveIdx <= 0) return;
  243. LockWindowUpdate(Handle);
  244. TcxTabSheet *pSheet = PgTab->ActivePage;
  245. if (pSheet)
  246. {
  247. delete pSheet;
  248. }
  249. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  250. m_pFormList->Delete(nActiveIdx);
  251. LockWindowUpdate(0);
  252. }
  253. //---------------------------------------------------------------------------
  254. /*
  255. * Tab Control의 Tab을 더블클릭하여 닫는다.
  256. * arguments
  257. * Sender : event handler 객체
  258. * return
  259. * void
  260. */
  261. void __fastcall TIST0050M::PgTabDblClick(TObject *Sender)
  262. {
  263. TPoint APoint;
  264. APoint = PgTab->MouseDownPos;
  265. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  266. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  267. }
  268. //---------------------------------------------------------------------------
  269. void __fastcall TIST0050M::FormClose(TObject *Sender, TCloseAction &Action)
  270. {
  271. CommClose();
  272. IST0050M = NULL;
  273. Action = caFree;
  274. }
  275. //---------------------------------------------------------------------------
  276. void __fastcall TIST0050M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  277. {
  278. int nActiveIdx = ATabIndex;
  279. if (nActiveIdx <= 0) return;
  280. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  281. m_pFormList->Delete(nActiveIdx);
  282. }
  283. //---------------------------------------------------------------------------