VDSH050MF.cpp 6.7 KB

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