IHS0060MF.cpp 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "CDSItsRoadInfoF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "IHS0060MF.h"
  10. #include "IHS00601F.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "FRAME_ItsRoadF"
  14. #pragma link "cxButtons"
  15. #pragma link "cxCalendar"
  16. #pragma link "cxContainer"
  17. #pragma link "cxControls"
  18. #pragma link "cxDropDownEdit"
  19. #pragma link "cxEdit"
  20. #pragma link "cxGraphics"
  21. #pragma link "cxGroupBox"
  22. #pragma link "cxLabel"
  23. #pragma link "cxLookAndFeelPainters"
  24. #pragma link "cxLookAndFeels"
  25. #pragma link "cxMaskEdit"
  26. #pragma link "cxPC"
  27. #pragma link "cxPCdxBarPopupMenu"
  28. #pragma link "cxSpinEdit"
  29. #pragma link "cxSplitter"
  30. #pragma link "cxTextEdit"
  31. #pragma link "cxTimeEdit"
  32. #pragma link "dxSkinBlack"
  33. #pragma link "dxSkinBlue"
  34. #pragma link "dxSkinsCore"
  35. #pragma link "dxSkinscxPCPainter"
  36. #pragma resource "*.dfm"
  37. TIHS0060M *IHS0060M = NULL;
  38. //---------------------------------------------------------------------------
  39. __fastcall TIHS0060M::TIHS0060M(TComponent* Owner)
  40. : TForm(Owner)
  41. {
  42. LangTrans->Translate(this, ITSDb_GetConnection());
  43. FTitle = Caption;//"수집데이터 분석";
  44. ITSSkin_Load(this);
  45. CMM_LoadForm(g_sFormsDir, this);
  46. m_pFormList = new TList();
  47. TsList01->TabVisible = false;
  48. //FRAMELinkList1->PnlTop->Visible = false;
  49. //FRAMELinkList1->PnlBottom->Visible = false;
  50. if (!RLinkManager)
  51. {
  52. RLinkManager = new TRLinkManager();
  53. RLinkManager->LoadSido();
  54. RLinkManager->LoadRoad();
  55. RLinkManager->LoadLink();
  56. }
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TIHS0060M::CommClose()
  60. {
  61. try
  62. {
  63. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  64. {
  65. m_pFormList->Delete(idx);
  66. }
  67. delete m_pFormList;
  68. CMM_SaveForm(g_sFormsDir, this);
  69. }
  70. catch(...)
  71. {
  72. }
  73. }
  74. //---------------------------------------------------------------------------
  75. void __fastcall TIHS0060M::FormShow(TObject *Sender)
  76. {
  77. Refresh();
  78. FormInit();
  79. TmrShow->Enabled = true;
  80. }
  81. //---------------------------------------------------------------------------
  82. void __fastcall TIHS0060M::FormInit()
  83. {
  84. DtStDate->Date = Now() - 1;
  85. DtEdDate->Date = Now() - 1;
  86. //DtStTime->EditValue = Now().FormatString("hh");
  87. //DtEdTime->EditValue = Now().FormatString("hh");
  88. DtStTime->Time = StrToDateTime("00:00");
  89. DtEdTime->Time = StrToDateTime("23:59");
  90. }
  91. //---------------------------------------------------------------------------
  92. void __fastcall TIHS0060M::TmrShowTimer(TObject *Sender)
  93. {
  94. TmrShow->Enabled = false;
  95. //FRAMELinkList1->UpdateList();
  96. FRAMEItsRoad1->InitFilter(true);
  97. FRAMEItsRoad1->InitItsRoad();
  98. }
  99. //---------------------------------------------------------------------------
  100. void __fastcall TIHS0060M::RefreshData()
  101. {
  102. // 검색조건에 의한 링크 데이터 조회
  103. try
  104. {
  105. //SelListData();
  106. }
  107. __finally
  108. {
  109. }
  110. }
  111. //---------------------------------------------------------------------------
  112. void __fastcall TIHS0060M::BtnSearchClick(TObject *Sender)
  113. {
  114. Application->ProcessMessages();
  115. TSqlCursor sqlCrs((TControl*)BtnSearch);
  116. #if 0
  117. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  118. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  119. #else
  120. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  121. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  122. #endif
  123. if (FStDateTime > FEdDateTime)
  124. {
  125. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  126. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  127. ActiveControl = DtStDate;
  128. return;
  129. }
  130. #if 0
  131. FStDateTime = FStDateTime + "0000";
  132. FEdDateTime = FEdDateTime + "5959";
  133. #else
  134. FStDateTime = FStDateTime + "00";
  135. FEdDateTime = FEdDateTime + "59";
  136. #endif
  137. FIdList = "";
  138. #if 0
  139. int nSelects = FRAMELinkList1->GetSelLinkIds(FIdList);
  140. if (0 == nSelects)
  141. {
  142. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  143. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  144. FRAMELinkList1->CxList->SetFocus();
  145. return;
  146. }
  147. #endif
  148. STCodeCondition m_CrossCond;
  149. FRAMEItsRoad1->GetCondition(m_CrossCond);
  150. String sWhere = m_CrossCond.ToSQLInString("A.LINK_ID");
  151. FIdList = sWhere;
  152. #if 0
  153. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  154. #else
  155. String sTitle = FRAMEItsRoad1->FSelNm;
  156. #endif
  157. try
  158. {
  159. Application->ProcessMessages();
  160. LockWindowUpdate(Handle);
  161. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  162. if (!pSheet) return;
  163. IHS00601 = new TIHS00601(this, Handle, FStDateTime, FEdDateTime, FIdList);
  164. IHS00601->Parent = pSheet;
  165. IHS00601->Show();
  166. PgTab->ActivePage = pSheet;
  167. pSheet = PgTab->ActivePage;
  168. m_pFormList->Add(IHS00601);
  169. }
  170. __finally
  171. {
  172. LockWindowUpdate(0);
  173. }
  174. }
  175. //---------------------------------------------------------------------------
  176. void __fastcall TIHS0060M::BtnCloseClick(TObject *Sender)
  177. {
  178. Close();
  179. }
  180. //---------------------------------------------------------------------------
  181. void __fastcall TIHS0060M::OnSubFormClose(TMessage Msg)
  182. {
  183. int nActiveIdx = PgTab->ActivePageIndex;
  184. if (nActiveIdx <= 0) return;
  185. LockWindowUpdate(Handle);
  186. TcxTabSheet *pSheet = PgTab->ActivePage;
  187. if (pSheet)
  188. {
  189. delete pSheet;
  190. }
  191. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  192. m_pFormList->Delete(nActiveIdx);
  193. LockWindowUpdate(0);
  194. }
  195. //---------------------------------------------------------------------------
  196. void __fastcall TIHS0060M::PgTabDblClick(TObject *Sender)
  197. {
  198. TPoint APoint;
  199. APoint = PgTab->MouseDownPos;
  200. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  201. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  202. }
  203. //---------------------------------------------------------------------------
  204. void __fastcall TIHS0060M::FormClose(TObject *Sender, TCloseAction &Action)
  205. {
  206. CommClose();
  207. IHS0060M = NULL;
  208. Action = caFree;
  209. }
  210. //---------------------------------------------------------------------------
  211. void __fastcall TIHS0060M::btnFilterClick(TObject *Sender)
  212. {
  213. String sFilter = EdFilter->Text.Trim();
  214. FRAMEItsRoad1->FilterItsRoad(sFilter);
  215. //fnUpdateConditionHtmlState();
  216. }
  217. //---------------------------------------------------------------------------
  218. void __fastcall TIHS0060M::EdFilterKeyPress(TObject *Sender, wchar_t &Key)
  219. {
  220. if (VK_RETURN == Key)
  221. {
  222. btnFilterClick(NULL);
  223. }
  224. }
  225. //---------------------------------------------------------------------------
  226. void __fastcall TIHS0060M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  227. {
  228. int nActiveIdx = ATabIndex;
  229. if (nActiveIdx <= 0) return;
  230. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  231. m_pFormList->Delete(nActiveIdx);
  232. }
  233. //---------------------------------------------------------------------------