TAS0030MF.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 "TAS0030MF.h"
  9. #include "TAS00301F.h"
  10. #include "CDSCodeF.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "cxButtons"
  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 "cxLookAndFeelPainters"
  21. #pragma link "cxLookAndFeels"
  22. #pragma link "cxMaskEdit"
  23. #pragma link "cxPC"
  24. #pragma link "cxPCdxBarPopupMenu"
  25. #pragma link "cxTextEdit"
  26. #pragma link "dxSkinBlack"
  27. #pragma link "dxSkinBlue"
  28. #pragma link "dxSkinsCore"
  29. #pragma link "dxSkinscxPCPainter"
  30. #pragma resource "*.dfm"
  31. TTAS0030M *TAS0030M = NULL;
  32. //---------------------------------------------------------------------------
  33. __fastcall TTAS0030M::TTAS0030M(TComponent* Owner)
  34. : TForm(Owner)
  35. {
  36. LangTrans->Translate(this, ITSDb_GetConnection());
  37. ITSSkin_Load(this);
  38. CMM_LoadForm(g_sFormsDir, this);
  39. FTitle = Caption;//"노선별속도분석";
  40. m_pFormList = new TList();
  41. TsList01->TabVisible = false;
  42. MyItsAtrdManager = new TItsAtrdManager();
  43. MyItsAtrdManager->LoadFromDb();
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TTAS0030M::CommClose()
  47. {
  48. try
  49. {
  50. if (MyItsAtrdManager)
  51. {
  52. delete MyItsAtrdManager;
  53. MyItsAtrdManager = NULL;
  54. }
  55. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  56. {
  57. m_pFormList->Delete(idx);
  58. }
  59. delete m_pFormList;
  60. CMM_SaveForm(g_sFormsDir, this);
  61. }
  62. catch(...)
  63. {
  64. }
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TTAS0030M::FormShow(TObject *Sender)
  68. {
  69. Refresh();
  70. FormInit();
  71. TmrShow->Enabled = true;
  72. }
  73. //---------------------------------------------------------------------------
  74. void __fastcall TTAS0030M::FormInit()
  75. {
  76. CbAtrd->Properties->Items->Clear();
  77. try
  78. {
  79. MyItsAtrdManager->FNameLists.Lock();
  80. FOR_STL(TItsAtrdName*, pObj, MyItsAtrdManager->FNameLists)
  81. {
  82. CbAtrd->Properties->Items->AddObject(pObj->Name, (TObject*)pObj);
  83. }
  84. }
  85. __finally
  86. {
  87. MyItsAtrdManager->FNameLists.UnLock();
  88. CbAtrd->ItemIndex = 0;
  89. }
  90. #if 0
  91. try
  92. {
  93. MyItsAtrdManager->FLists.Lock();
  94. FOR_STL(TItsAtrd*, pObj, MyItsAtrdManager->FLists)
  95. {
  96. if (pObj->DEL_YN == "Y") continue;
  97. String sDir = (pObj->DRCT_CD.Trim() == "0") ? FrmLang->lblUp->Caption : FrmLang->lblDown->Caption;String("상행") : String("하행");
  98. String sAtr = pObj->ATRD_NM;
  99. CbAtrd->Properties->Items->AddObject(sAtr + " [" + sDir + "]", (TObject*)pObj);
  100. }
  101. }
  102. __finally
  103. {
  104. MyItsAtrdManager->FLists.UnLock();
  105. CbAtrd->ItemIndex = 0;
  106. }
  107. #endif
  108. DtDay->Date = IncHour(Now(), -24);
  109. }
  110. //---------------------------------------------------------------------------
  111. void __fastcall TTAS0030M::TmrShowTimer(TObject *Sender)
  112. {
  113. TmrShow->Enabled = false;
  114. }
  115. //---------------------------------------------------------------------------
  116. void __fastcall TTAS0030M::RefreshData()
  117. {
  118. // 검색조건에 의한 링크 데이터 조회
  119. try
  120. {
  121. //SelListData();
  122. }
  123. __finally
  124. {
  125. }
  126. }
  127. //---------------------------------------------------------------------------
  128. void __fastcall TTAS0030M::BtnSearchClick(TObject *Sender)
  129. {
  130. Application->ProcessMessages();
  131. TSqlCursor sqlCrs((TControl*)BtnSearch);
  132. String sTitle;
  133. FQryDay = DtDay->Date.FormatString("yyyymmdd");
  134. FAtrdId = CbAtrd->Text.Trim();
  135. FAtrdNm = CbAtrd->Text.Trim();
  136. #if 0
  137. if (CbAtrd->ItemIndex == 0)
  138. {
  139. FAtrdId = "";
  140. FAtrdNm = FrmLang->lblChartTotal->Caption;//"전체";
  141. }
  142. #endif
  143. sTitle.printf(L"%s %s ", FQryDay.c_str(), FAtrdNm.c_str());
  144. try
  145. {
  146. Application->ProcessMessages();
  147. LockWindowUpdate(Handle);
  148. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  149. if (!pSheet) return;
  150. TAS00301 = new TTAS00301(this, Handle, FAtrdId, FAtrdNm, FQryDay, FPtrnWeek, FPtrnWeekName);
  151. TAS00301->Parent = pSheet;
  152. TAS00301->Show();
  153. PgTab->ActivePage = pSheet;
  154. pSheet = PgTab->ActivePage;
  155. m_pFormList->Add(TAS00301);
  156. }
  157. __finally
  158. {
  159. LockWindowUpdate(0);
  160. }
  161. }
  162. //---------------------------------------------------------------------------
  163. void __fastcall TTAS0030M::BtnCloseClick(TObject *Sender)
  164. {
  165. Close();
  166. }
  167. //---------------------------------------------------------------------------
  168. void __fastcall TTAS0030M::OnSubFormClose(TMessage Msg)
  169. {
  170. int nActiveIdx = PgTab->ActivePageIndex;
  171. if (nActiveIdx <= 0) return;
  172. LockWindowUpdate(Handle);
  173. TcxTabSheet *pSheet = PgTab->ActivePage;
  174. if (pSheet)
  175. {
  176. delete pSheet;
  177. }
  178. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  179. m_pFormList->Delete(nActiveIdx);
  180. LockWindowUpdate(0);
  181. }
  182. //---------------------------------------------------------------------------
  183. void __fastcall TTAS0030M::PgTabDblClick(TObject *Sender)
  184. {
  185. TPoint APoint;
  186. APoint = PgTab->MouseDownPos;
  187. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  188. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  189. }
  190. //---------------------------------------------------------------------------
  191. void __fastcall TTAS0030M::FormClose(TObject *Sender, TCloseAction &Action)
  192. {
  193. CommClose();
  194. TAS0030M = NULL;
  195. Action = caFree;
  196. }
  197. //---------------------------------------------------------------------------
  198. void __fastcall TTAS0030M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  199. {
  200. int nActiveIdx = ATabIndex;
  201. if (nActiveIdx <= 0) return;
  202. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  203. m_pFormList->Delete(nActiveIdx);
  204. }
  205. //---------------------------------------------------------------------------