IHS0060MF.cpp 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. /*
  60. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  61. * Form과 DataModule class를 delete시킨다.
  62. * arguments
  63. *
  64. * return
  65. * void
  66. */
  67. void __fastcall TIHS0060M::CommClose()
  68. {
  69. try
  70. {
  71. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  72. {
  73. m_pFormList->Delete(idx);
  74. }
  75. delete m_pFormList;
  76. CMM_SaveForm(g_sFormsDir, this);
  77. }
  78. catch(...)
  79. {
  80. }
  81. }
  82. //---------------------------------------------------------------------------
  83. /*
  84. * Form을 보여줄때 호출되는 event 메서드이다.
  85. * arguments
  86. * Sender : event handler 객체
  87. * return
  88. * void
  89. */
  90. void __fastcall TIHS0060M::FormShow(TObject *Sender)
  91. {
  92. Refresh();
  93. FormInit();
  94. TmrShow->Enabled = true;
  95. }
  96. //---------------------------------------------------------------------------
  97. /*
  98. * form 초기화
  99. *
  100. * arguments
  101. *
  102. * return
  103. * void
  104. */
  105. void __fastcall TIHS0060M::FormInit()
  106. {
  107. DtStDate->Date = Now() - 1;
  108. DtEdDate->Date = Now() - 1;
  109. //DtStTime->EditValue = Now().FormatString("hh");
  110. //DtEdTime->EditValue = Now().FormatString("hh");
  111. DtStTime->Time = StrToDateTime("00:00");
  112. DtEdTime->Time = StrToDateTime("23:59");
  113. }
  114. //---------------------------------------------------------------------------
  115. /*
  116. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  117. * arguments
  118. * Sender : event handler 객체
  119. * return
  120. * void
  121. */
  122. void __fastcall TIHS0060M::TmrShowTimer(TObject *Sender)
  123. {
  124. TmrShow->Enabled = false;
  125. //FRAMELinkList1->UpdateList();
  126. FRAMEItsRoad1->InitFilter(true);
  127. FRAMEItsRoad1->InitItsRoad();
  128. }
  129. //---------------------------------------------------------------------------
  130. /*
  131. * Refresh Data Event Function
  132. * arguments
  133. *
  134. * return
  135. * void
  136. */
  137. void __fastcall TIHS0060M::RefreshData()
  138. {
  139. // 검색조건에 의한 링크 데이터 조회
  140. try
  141. {
  142. //SelListData();
  143. }
  144. __finally
  145. {
  146. }
  147. }
  148. //---------------------------------------------------------------------------
  149. /*
  150. * Search 버튼 클릭 이벤트 핸들러
  151. * arguments
  152. * Sender : event handler 객체
  153. * return
  154. * void
  155. */
  156. void __fastcall TIHS0060M::BtnSearchClick(TObject *Sender)
  157. {
  158. Application->ProcessMessages();
  159. TSqlCursor sqlCrs((TControl*)BtnSearch);
  160. #if 0
  161. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  162. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  163. #else
  164. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  165. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  166. #endif
  167. if (FStDateTime > FEdDateTime)
  168. {
  169. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  170. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  171. ActiveControl = DtStDate;
  172. return;
  173. }
  174. #if 0
  175. FStDateTime = FStDateTime + "0000";
  176. FEdDateTime = FEdDateTime + "5959";
  177. #else
  178. FStDateTime = FStDateTime + "00";
  179. FEdDateTime = FEdDateTime + "59";
  180. #endif
  181. FIdList = "";
  182. #if 0
  183. int nSelects = FRAMELinkList1->GetSelLinkIds(FIdList);
  184. if (0 == nSelects)
  185. {
  186. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  187. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  188. FRAMELinkList1->CxList->SetFocus();
  189. return;
  190. }
  191. #endif
  192. STCodeCondition m_CrossCond;
  193. FRAMEItsRoad1->GetCondition(m_CrossCond);
  194. String sWhere = m_CrossCond.ToSQLInString("A.LINK_ID");
  195. FIdList = sWhere;
  196. #if 0
  197. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  198. #else
  199. String sTitle = FRAMEItsRoad1->FSelNm;
  200. #endif
  201. try
  202. {
  203. Application->ProcessMessages();
  204. LockWindowUpdate(Handle);
  205. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  206. if (!pSheet) return;
  207. IHS00601 = new TIHS00601(this, Handle, FStDateTime, FEdDateTime, FIdList);
  208. IHS00601->Parent = pSheet;
  209. IHS00601->Show();
  210. PgTab->ActivePage = pSheet;
  211. pSheet = PgTab->ActivePage;
  212. m_pFormList->Add(IHS00601);
  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 TIHS0060M::BtnCloseClick(TObject *Sender)
  228. {
  229. Close();
  230. }
  231. //---------------------------------------------------------------------------
  232. /*
  233. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  234. * arguments
  235. * Sender : event handler 객체
  236. * return
  237. * void
  238. */
  239. void __fastcall TIHS0060M::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 TIHS0060M::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 TIHS0060M::FormClose(TObject *Sender, TCloseAction &Action)
  270. {
  271. CommClose();
  272. IHS0060M = NULL;
  273. Action = caFree;
  274. }
  275. //---------------------------------------------------------------------------
  276. void __fastcall TIHS0060M::btnFilterClick(TObject *Sender)
  277. {
  278. String sFilter = EdFilter->Text.Trim();
  279. FRAMEItsRoad1->FilterItsRoad(sFilter);
  280. //fnUpdateConditionHtmlState();
  281. }
  282. //---------------------------------------------------------------------------
  283. void __fastcall TIHS0060M::EdFilterKeyPress(TObject *Sender, wchar_t &Key)
  284. {
  285. if (VK_RETURN == Key)
  286. {
  287. btnFilterClick(NULL);
  288. }
  289. }
  290. //---------------------------------------------------------------------------
  291. void __fastcall TIHS0060M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  292. {
  293. int nActiveIdx = ATabIndex;
  294. if (nActiveIdx <= 0) return;
  295. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  296. m_pFormList->Delete(nActiveIdx);
  297. }
  298. //---------------------------------------------------------------------------