IHS0060MF.cpp 7.3 KB

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