IAN0030MF.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 "IAN0030MF.h"
  9. #include "IAN00301F.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. TIAN0030M *IAN0030M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TIAN0030M::TIAN0030M(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. CbLinkLevel->Properties->Items->Clear();
  47. CbLinkLevel->Properties->Items->Add(FrmLang->lblNmLink->Caption);//"링크 ( 1레벨 )");
  48. CbLinkLevel->Properties->Items->Add(FrmLang->lblNmIfsc->Caption);//"서비스링크 ( 2레벨 )");
  49. CbLinkLevel->Properties->Items->Add(FrmLang->lblNmRoad->Caption);//"도로 ( 3레벨 )");
  50. //CbLinkLevel->Properties->Items->Add("VMS");
  51. CbLinkLevel->ItemIndex = 0;
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TIAN0030M::CommClose()
  55. {
  56. try
  57. {
  58. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  59. {
  60. m_pFormList->Delete(idx);
  61. }
  62. delete m_pFormList;
  63. CMM_SaveForm(g_sFormsDir, this);
  64. }
  65. catch(...)
  66. {
  67. }
  68. }
  69. //---------------------------------------------------------------------------
  70. void __fastcall TIAN0030M::FormShow(TObject *Sender)
  71. {
  72. Refresh();
  73. FormInit();
  74. TmrShow->Enabled = true;
  75. }
  76. //---------------------------------------------------------------------------
  77. void __fastcall TIAN0030M::FormInit()
  78. {
  79. DtStDate->Date = Now() - 1;
  80. DtEdDate->Date = Now() - 1;
  81. //DtEdTime->EditValue = Now().FormatString("hh");
  82. DtStTime->Time = StrToDateTime("00:00");
  83. DtEdTime->Time = StrToDateTime("23:59");
  84. }
  85. //---------------------------------------------------------------------------
  86. void __fastcall TIAN0030M::TmrShowTimer(TObject *Sender)
  87. {
  88. TmrShow->Enabled = false;
  89. }
  90. //---------------------------------------------------------------------------
  91. void __fastcall TIAN0030M::RefreshData()
  92. {
  93. // 검색조건에 의한 링크 데이터 조회
  94. try
  95. {
  96. //SelListData();
  97. }
  98. __finally
  99. {
  100. }
  101. }
  102. //---------------------------------------------------------------------------
  103. void __fastcall TIAN0030M::BtnSearchClick(TObject *Sender)
  104. {
  105. Application->ProcessMessages();
  106. TSqlCursor sqlCrs((TControl*)BtnSearch);
  107. #if 0
  108. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  109. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  110. #else
  111. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  112. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  113. #endif
  114. if (FStDateTime > FEdDateTime)
  115. {
  116. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  117. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  118. ActiveControl = DtStDate;
  119. return;
  120. }
  121. #if 0
  122. FStDateTime = FStDateTime + "0000";
  123. FEdDateTime = FEdDateTime + "5959";
  124. #else
  125. FStDateTime = FStDateTime + "00";
  126. FEdDateTime = FEdDateTime + "59";
  127. #endif
  128. FIdList = String(CbLinkLevel->ItemIndex+1);
  129. String sTitle = "[" + FStDateTime.SubString(1, 12) + "-" + FEdDateTime.SubString(1, 12) + "]";
  130. try
  131. {
  132. Application->ProcessMessages();
  133. LockWindowUpdate(Handle);
  134. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  135. if (!pSheet) return;
  136. IAN00301 = new TIAN00301(this, Handle, FStDateTime, FEdDateTime, FIdList);
  137. IAN00301->Parent = pSheet;
  138. IAN00301->Show();
  139. PgTab->ActivePage = pSheet;
  140. pSheet = PgTab->ActivePage;
  141. m_pFormList->Add(IAN00301);
  142. }
  143. __finally
  144. {
  145. LockWindowUpdate(0);
  146. }
  147. }
  148. //---------------------------------------------------------------------------
  149. void __fastcall TIAN0030M::BtnCloseClick(TObject *Sender)
  150. {
  151. Close();
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TIAN0030M::OnSubFormClose(TMessage Msg)
  155. {
  156. int nActiveIdx = PgTab->ActivePageIndex;
  157. if (nActiveIdx <= 0) return;
  158. LockWindowUpdate(Handle);
  159. TcxTabSheet *pSheet = PgTab->ActivePage;
  160. if (pSheet)
  161. {
  162. delete pSheet;
  163. }
  164. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  165. m_pFormList->Delete(nActiveIdx);
  166. LockWindowUpdate(0);
  167. }
  168. //---------------------------------------------------------------------------
  169. void __fastcall TIAN0030M::PgTabDblClick(TObject *Sender)
  170. {
  171. TPoint APoint;
  172. APoint = PgTab->MouseDownPos;
  173. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  174. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  175. }
  176. //---------------------------------------------------------------------------
  177. void __fastcall TIAN0030M::FormClose(TObject *Sender, TCloseAction &Action)
  178. {
  179. CommClose();
  180. IAN0030M = NULL;
  181. Action = caFree;
  182. }
  183. //---------------------------------------------------------------------------
  184. void __fastcall TIAN0030M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  185. {
  186. int nActiveIdx = ATabIndex;
  187. if (nActiveIdx <= 0) return;
  188. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  189. m_pFormList->Delete(nActiveIdx);
  190. }
  191. //---------------------------------------------------------------------------