VDSH040MF.cpp 6.8 KB

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