WCAMH10MF.cpp 7.0 KB

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