TAS0080MF.cpp 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #include "ITSSEL5MF.h"
  8. #pragma hdrstop
  9. #include "TAS0080MF.h"
  10. #include "TAS00801F.h"
  11. #include "CDSCodeF.h"
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma link "cxButtons"
  15. #pragma link "cxContainer"
  16. #pragma link "cxControls"
  17. #pragma link "cxDropDownEdit"
  18. #pragma link "cxEdit"
  19. #pragma link "cxGraphics"
  20. #pragma link "cxGroupBox"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxTextEdit"
  27. #pragma link "dxSkinBlack"
  28. #pragma link "dxSkinBlue"
  29. #pragma link "dxSkinsCore"
  30. #pragma link "dxSkinscxPCPainter"
  31. #pragma link "cxCheckBox"
  32. #pragma link "cxButtonEdit"
  33. #pragma resource "*.dfm"
  34. TTAS0080M *TAS0080M = NULL;
  35. //---------------------------------------------------------------------------
  36. __fastcall TTAS0080M::TTAS0080M(TComponent* Owner)
  37. : TForm(Owner)
  38. {
  39. LangTrans->Translate(this, ITSDb_GetConnection());
  40. ITSSkin_Load(this);
  41. CMM_LoadForm(g_sFormsDir, this);
  42. FTitle = Caption;//"노선별속도분석";
  43. m_pFormList = new TList();
  44. TsList01->TabVisible = false;
  45. MyManager = new TVdsCtlrManager();
  46. MyManager->LoadFromDbVdsLink();
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TTAS0080M::CommClose()
  50. {
  51. try
  52. {
  53. if (MyManager)
  54. {
  55. delete MyManager;
  56. MyManager = NULL;
  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 TTAS0080M::FormShow(TObject *Sender)
  71. {
  72. Refresh();
  73. FormInit();
  74. TmrShow->Enabled = true;
  75. }
  76. //---------------------------------------------------------------------------
  77. void __fastcall TTAS0080M::FormInit()
  78. {
  79. DtStDay->Date = Now() - 2;
  80. DtEdDay->Date = Now() - 1;
  81. int ii;
  82. String sHour;
  83. CbStHour->Properties->Items->Clear();
  84. for(ii = 0; ii < 24; ii++)
  85. {
  86. sHour.printf(L" %02d시", ii);
  87. CbStHour->Properties->Items->Add(sHour);
  88. }
  89. CbStHour->ItemIndex = 0;
  90. }
  91. //---------------------------------------------------------------------------
  92. void __fastcall TTAS0080M::CbStHourPropertiesChange(TObject *Sender)
  93. {
  94. int nStHour = CbStHour->Text.Trim().SubString(1,2).ToIntDef(0);
  95. int ii;
  96. String sHour;
  97. CbEdHour->Properties->Items->Clear();
  98. for(ii = nStHour; ii < 24; ii++)
  99. {
  100. sHour.printf(L" %02d시", ii);
  101. CbEdHour->Properties->Items->Add(sHour);
  102. }
  103. CbEdHour->ItemIndex = CbEdHour->Properties->Items->Count-1;
  104. }
  105. //---------------------------------------------------------------------------
  106. void __fastcall TTAS0080M::TmrShowTimer(TObject *Sender)
  107. {
  108. TmrShow->Enabled = false;
  109. }
  110. //---------------------------------------------------------------------------
  111. void __fastcall TTAS0080M::RefreshData()
  112. {
  113. }
  114. //---------------------------------------------------------------------------
  115. void __fastcall TTAS0080M::BtnSearchClick(TObject *Sender)
  116. {
  117. Application->ProcessMessages();
  118. TSqlCursor sqlCrs((TControl*)BtnSearch);
  119. String sTitle;
  120. FStDay = DtStDay->Date.FormatString("yyyymmdd");
  121. FEdDay = DtStDay->Date.FormatString("yyyymmdd");
  122. FStHour = CbStHour->Text.Trim().SubString(1,2);
  123. FEdHour = CbEdHour->Text.Trim().SubString(1,2);
  124. FWeek = "";
  125. FDir = "";
  126. FAtrdNm = "";
  127. FOR_STL(TVdsLink*, pObj, MyManager->FLinkLists)
  128. {
  129. if (pObj->IsSelected)
  130. {
  131. FAtrdNm += "'" + pObj->LINK_ID +"',";
  132. }
  133. }
  134. FAtrdNm.Delete(FAtrdNm.Length(), 1);
  135. FTable = 0;
  136. FQryType = 0;
  137. FStDay = FStDay + FStHour;
  138. FEdDay = FEdDay + FEdHour;
  139. if (FStDay > FEdDay)
  140. {
  141. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  142. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  143. ActiveControl = DtStDay;
  144. return;
  145. }
  146. sTitle.printf(L"%s ~ %s ", FStDay.c_str(), FEdDay.c_str());
  147. FStDay = FStDay + "0000";
  148. FEdDay = FEdDay + "5959";
  149. try
  150. {
  151. Application->ProcessMessages();
  152. LockWindowUpdate(Handle);
  153. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  154. if (!pSheet) return;
  155. TAS00801 = new TTAS00801(this, Handle, FStDay, FEdDay, FStHour, FEdHour, FWeek, FDir, FAtrdNm, FTable, FQryType, MyManager);
  156. TAS00801->Parent = pSheet;
  157. TAS00801->Show();
  158. PgTab->ActivePage = pSheet;
  159. pSheet = PgTab->ActivePage;
  160. m_pFormList->Add(TAS00801);
  161. }
  162. __finally
  163. {
  164. LockWindowUpdate(0);
  165. }
  166. }
  167. //---------------------------------------------------------------------------
  168. void __fastcall TTAS0080M::BtnCloseClick(TObject *Sender)
  169. {
  170. Close();
  171. }
  172. //---------------------------------------------------------------------------
  173. void __fastcall TTAS0080M::OnSubFormClose(TMessage Msg)
  174. {
  175. int nActiveIdx = PgTab->ActivePageIndex;
  176. if (nActiveIdx <= 0) return;
  177. LockWindowUpdate(Handle);
  178. TcxTabSheet *pSheet = PgTab->ActivePage;
  179. if (pSheet)
  180. {
  181. delete pSheet;
  182. }
  183. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  184. m_pFormList->Delete(nActiveIdx);
  185. LockWindowUpdate(0);
  186. }
  187. //---------------------------------------------------------------------------
  188. void __fastcall TTAS0080M::PgTabDblClick(TObject *Sender)
  189. {
  190. TPoint APoint;
  191. APoint = PgTab->MouseDownPos;
  192. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  193. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  194. }
  195. //---------------------------------------------------------------------------
  196. void __fastcall TTAS0080M::FormClose(TObject *Sender, TCloseAction &Action)
  197. {
  198. CommClose();
  199. TAS0080M = NULL;
  200. Action = caFree;
  201. }
  202. //---------------------------------------------------------------------------
  203. void __fastcall TTAS0080M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  204. {
  205. int nActiveIdx = ATabIndex;
  206. if (nActiveIdx <= 0) return;
  207. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  208. m_pFormList->Delete(nActiveIdx);
  209. }
  210. //---------------------------------------------------------------------------
  211. void __fastcall TTAS0080M::EdAtrdPropertiesButtonClick(TObject *Sender, int AButtonIndex)
  212. {
  213. TITSSEL5M *pSelForm = NULL;
  214. try
  215. {
  216. try {
  217. pSelForm = new TITSSEL5M(this, MyManager);
  218. pSelForm->ShowModal();
  219. if (pSelForm->m_bSelected)
  220. {
  221. if (MyManager->FLinkSelCnt == MyManager->FLinkLists.Size())
  222. {
  223. EdAtrd->Text = "[전체]";
  224. }
  225. else
  226. {
  227. String LINK_NM = "";
  228. FOR_STL(TVdsLink*, pObj, MyManager->FLinkLists)
  229. {
  230. if (pObj->IsSelected)
  231. {
  232. LINK_NM = pObj->STR_NAME + " → " + pObj->END_NAME;
  233. break;
  234. }
  235. }
  236. if (MyManager->FLinkSelCnt == 1)
  237. {
  238. EdAtrd->Text = LINK_NM;
  239. }
  240. else
  241. {
  242. EdAtrd->Text = "[" + LINK_NM + "] 외" + String(MyManager->FLinkSelCnt-1) + " 개 구간";
  243. }
  244. }
  245. }
  246. } catch(...) { }
  247. }
  248. __finally
  249. {
  250. if (pSelForm) delete pSelForm;
  251. }
  252. }
  253. //---------------------------------------------------------------------------