IHS0050MF.cpp 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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 resource "*.dfm"
  34. TIHS0050M *IHS0050M = NULL;
  35. //---------------------------------------------------------------------------
  36. __fastcall TIHS0050M::TIHS0050M(TComponent* Owner)
  37. : TForm(Owner)
  38. {
  39. LangTrans->Translate(this, ITSDb_GetConnection());
  40. ITSSkin_Load(this);
  41. CMM_LoadForm(g_sFormsDir, this);
  42. FTitle = Caption;//"시설물 장애내역";
  43. m_pFormList = new TList();
  44. TsList01->TabVisible = false;
  45. CbType->Properties->Items->Clear();
  46. CbType->Properties->Items->Add(lblAll->Caption);//"전 체");
  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 = 1;
  66. }
  67. //---------------------------------------------------------------------------
  68. /*
  69. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  70. * Form과 DataModule class를 delete시킨다.
  71. * arguments
  72. *
  73. * return
  74. * void
  75. */
  76. void __fastcall TIHS0050M::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 TIHS0050M::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 TIHS0050M::FormInit()
  115. {
  116. DtStDate->Date = Now() - 1;
  117. DtEdDate->Date = Now() - 1;
  118. //DtStTime->EditValue = "00";//Now().FormatString("hh");
  119. //DtEdTime->EditValue = 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 TIHS0050M::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 TIHS0050M::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 TIHS0050M::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. FIdList = String(CbType->ItemIndex);
  188. String sTypeNm = CbType->Text.Trim();
  189. #if 0
  190. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  191. #else
  192. String sTitle = CbType->Text;
  193. #endif
  194. try
  195. {
  196. Application->ProcessMessages();
  197. LockWindowUpdate(Handle);
  198. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, CbType->Text);
  199. if (!pSheet) return;
  200. IHS00501 = new TIHS00501(this, Handle, CbType->Text, FStDateTime, FEdDateTime, FIdList, sTypeNm);
  201. IHS00501->Parent = pSheet;
  202. IHS00501->Show();
  203. PgTab->ActivePage = pSheet;
  204. pSheet = PgTab->ActivePage;
  205. m_pFormList->Add(IHS00501);
  206. }
  207. __finally
  208. {
  209. LockWindowUpdate(0);
  210. }
  211. }
  212. //---------------------------------------------------------------------------
  213. /*
  214. * Close 버튼 클릭 이벤트 핸들러
  215. * arguments
  216. * Sender : event handler 객체
  217. * return
  218. * void
  219. */
  220. void __fastcall TIHS0050M::BtnCloseClick(TObject *Sender)
  221. {
  222. Close();
  223. }
  224. //---------------------------------------------------------------------------
  225. /*
  226. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  227. * arguments
  228. * Sender : event handler 객체
  229. * return
  230. * void
  231. */
  232. void __fastcall TIHS0050M::OnSubFormClose(TMessage Msg)
  233. {
  234. int nActiveIdx = PgTab->ActivePageIndex;
  235. if (nActiveIdx <= 0) return;
  236. LockWindowUpdate(Handle);
  237. TcxTabSheet *pSheet = PgTab->ActivePage;
  238. if (pSheet)
  239. {
  240. delete pSheet;
  241. }
  242. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  243. m_pFormList->Delete(nActiveIdx);
  244. LockWindowUpdate(0);
  245. }
  246. //---------------------------------------------------------------------------
  247. /*
  248. * Tab Control의 Tab을 더블클릭하여 닫는다.
  249. * arguments
  250. * Sender : event handler 객체
  251. * return
  252. * void
  253. */
  254. void __fastcall TIHS0050M::PgTabDblClick(TObject *Sender)
  255. {
  256. TPoint APoint;
  257. APoint = PgTab->MouseDownPos;
  258. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  259. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  260. }
  261. //---------------------------------------------------------------------------
  262. void __fastcall TIHS0050M::FormClose(TObject *Sender, TCloseAction &Action)
  263. {
  264. CommClose();
  265. IHS0050M = NULL;
  266. Action = caFree;
  267. }
  268. //---------------------------------------------------------------------------
  269. void __fastcall TIHS0050M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  270. {
  271. int nActiveIdx = ATabIndex;
  272. if (nActiveIdx <= 0) return;
  273. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  274. m_pFormList->Delete(nActiveIdx);
  275. }
  276. //---------------------------------------------------------------------------