VDSH040MF.cpp 6.7 KB

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