VDSH080MF.cpp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 "VDSH080MF.h"
  9. #include "VDSH0801F.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalendar"
  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 "cxLabel"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxSpinEdit"
  27. #pragma link "cxSplitter"
  28. #pragma link "cxTextEdit"
  29. #pragma link "cxTimeEdit"
  30. #pragma link "dxSkinBlack"
  31. #pragma link "dxSkinBlue"
  32. #pragma link "dxSkinsCore"
  33. #pragma link "dxSkinscxPCPainter"
  34. #pragma link "FRAME_VdsDtctListF"
  35. #pragma resource "*.dfm"
  36. TVDSH080M *VDSH080M = NULL;
  37. //---------------------------------------------------------------------------
  38. __fastcall TVDSH080M::TVDSH080M(TComponent* Owner)
  39. : TForm(Owner)
  40. {
  41. LangTrans->Translate(this, ITSDb_GetConnection());
  42. ITSSkin_Load(this);
  43. CMM_LoadForm(g_sFormsDir, this);
  44. FTitle = Caption;//"VDS-검지기 개별차량 이력";
  45. m_pFormList = new TList();
  46. TsList01->TabVisible = false;
  47. FRAMEVdsDtctList1->PnlBottom->Visible = false;
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TVDSH080M::CommClose()
  51. {
  52. try
  53. {
  54. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  55. {
  56. m_pFormList->Delete(idx);
  57. }
  58. delete m_pFormList;
  59. CMM_SaveForm(g_sFormsDir, this);
  60. }
  61. catch(...)
  62. {
  63. }
  64. }
  65. //---------------------------------------------------------------------------
  66. void __fastcall TVDSH080M::FormShow(TObject *Sender)
  67. {
  68. Refresh();
  69. FormInit();
  70. TmrShow->Enabled = true;
  71. }
  72. //---------------------------------------------------------------------------
  73. void __fastcall TVDSH080M::FormInit()
  74. {
  75. DtStDate->Date = Now() - 1;
  76. DtEdDate->Date = Now() - 1;
  77. //DtEdTime->EditValue = Now().FormatString("hh");
  78. DtStTime->Time = StrToDateTime("00:00");
  79. DtEdTime->Time = StrToDateTime("23:59");
  80. }
  81. //---------------------------------------------------------------------------
  82. void __fastcall TVDSH080M::TmrShowTimer(TObject *Sender)
  83. {
  84. TmrShow->Enabled = false;
  85. FRAMEVdsDtctList1->UpdateList();
  86. }
  87. //---------------------------------------------------------------------------
  88. void __fastcall TVDSH080M::RefreshData()
  89. {
  90. // 검색조건에 의한 링크 데이터 조회
  91. try
  92. {
  93. //SelListData();
  94. }
  95. __finally
  96. {
  97. }
  98. }
  99. //---------------------------------------------------------------------------
  100. void __fastcall TVDSH080M::BtnSearchClick(TObject *Sender)
  101. {
  102. Application->ProcessMessages();
  103. TSqlCursor sqlCrs((TControl*)BtnSearch);
  104. #if 0
  105. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  106. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  107. #else
  108. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  109. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  110. #endif
  111. if (FStDateTime > FEdDateTime)
  112. {
  113. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  114. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  115. ActiveControl = DtStDate;
  116. return;
  117. }
  118. #if 0
  119. FStDateTime = FStDateTime + "0000";
  120. FEdDateTime = FEdDateTime + "5959";
  121. #else
  122. FStDateTime = FStDateTime + "00";
  123. FEdDateTime = FEdDateTime + "59";
  124. #endif
  125. FIdList = "";
  126. int nSelects = CMM_GetSelectCount(FRAMEVdsDtctList1->TvList, FRAMEVdsDtctList1->ColumnSel->Index, FRAMEVdsDtctList1->Column02->Index, FIdList);
  127. if (0 == nSelects)
  128. {
  129. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  130. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  131. FRAMEVdsDtctList1->CxList->SetFocus();
  132. return;
  133. }
  134. #if 0
  135. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  136. #else
  137. String sTitle = CMM_GetSelectTitle(FRAMEVdsDtctList1->TvList, FRAMEVdsDtctList1->ColumnSel->Index, FRAMEVdsDtctList1->Column02->Index);
  138. #endif
  139. try
  140. {
  141. Application->ProcessMessages();
  142. LockWindowUpdate(Handle);
  143. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  144. if (!pSheet) return;
  145. VDSH0801 = new TVDSH0801(this, Handle, FStDateTime, FEdDateTime, FIdList);
  146. VDSH0801->Parent = pSheet;
  147. VDSH0801->Show();
  148. PgTab->ActivePage = pSheet;
  149. pSheet = PgTab->ActivePage;
  150. m_pFormList->Add(VDSH0801);
  151. }
  152. __finally
  153. {
  154. LockWindowUpdate(0);
  155. }
  156. }
  157. //---------------------------------------------------------------------------
  158. void __fastcall TVDSH080M::BtnCloseClick(TObject *Sender)
  159. {
  160. Close();
  161. }
  162. //---------------------------------------------------------------------------
  163. void __fastcall TVDSH080M::OnSubFormClose(TMessage Msg)
  164. {
  165. int nActiveIdx = PgTab->ActivePageIndex;
  166. if (nActiveIdx <= 0) return;
  167. LockWindowUpdate(Handle);
  168. TcxTabSheet *pSheet = PgTab->ActivePage;
  169. if (pSheet)
  170. {
  171. delete pSheet;
  172. }
  173. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  174. m_pFormList->Delete(nActiveIdx);
  175. LockWindowUpdate(0);
  176. }
  177. //---------------------------------------------------------------------------
  178. void __fastcall TVDSH080M::PgTabDblClick(TObject *Sender)
  179. {
  180. TPoint APoint;
  181. APoint = PgTab->MouseDownPos;
  182. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  183. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  184. }
  185. //---------------------------------------------------------------------------
  186. void __fastcall TVDSH080M::FormClose(TObject *Sender, TCloseAction &Action)
  187. {
  188. CommClose();
  189. VDSH080M = NULL;
  190. Action = caFree;
  191. }
  192. //---------------------------------------------------------------------------
  193. void __fastcall TVDSH080M::FormCloseQuery(TObject *Sender, bool &CanClose)
  194. {
  195. FRAMEVdsDtctList1->OnCloseQuery(CanClose);
  196. }
  197. //---------------------------------------------------------------------------
  198. void __fastcall TVDSH080M::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. //---------------------------------------------------------------------------