IHS0030MF.cpp 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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 "IHS0030MF.h"
  9. #include "IHS00301F.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "FRAME_LinkListF"
  13. #pragma link "cxButtons"
  14. #pragma link "cxCalendar"
  15. #pragma link "cxContainer"
  16. #pragma link "cxControls"
  17. #pragma link "cxDropDownEdit"
  18. #pragma link "cxEdit"
  19. #pragma link "cxGraphics"
  20. #pragma link "cxGroupBox"
  21. #pragma link "cxLabel"
  22. #pragma link "cxLookAndFeelPainters"
  23. #pragma link "cxLookAndFeels"
  24. #pragma link "cxMaskEdit"
  25. #pragma link "cxPC"
  26. #pragma link "cxPCdxBarPopupMenu"
  27. #pragma link "cxSpinEdit"
  28. #pragma link "cxSplitter"
  29. #pragma link "cxTextEdit"
  30. #pragma link "cxTimeEdit"
  31. #pragma link "dxSkinBlack"
  32. #pragma link "dxSkinBlue"
  33. #pragma link "dxSkinsCore"
  34. #pragma link "dxSkinscxPCPainter"
  35. #pragma resource "*.dfm"
  36. TIHS0030M *IHS0030M = NULL;
  37. //---------------------------------------------------------------------------
  38. __fastcall TIHS0030M::TIHS0030M(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;//"수집데이터 이력조회";
  45. m_pFormList = new TList();
  46. TsList01->TabVisible = false;
  47. FRAMELinkList1->PnlTop->Visible = false;
  48. FRAMELinkList1->PnlBottom->Visible = false;
  49. }
  50. //---------------------------------------------------------------------------
  51. /*
  52. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  53. * Form과 DataModule class를 delete시킨다.
  54. * arguments
  55. *
  56. * return
  57. * void
  58. */
  59. void __fastcall TIHS0030M::CommClose()
  60. {
  61. try
  62. {
  63. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  64. {
  65. m_pFormList->Delete(idx);
  66. }
  67. delete m_pFormList;
  68. CMM_SaveForm(g_sFormsDir, this);
  69. }
  70. catch(...)
  71. {
  72. }
  73. }
  74. //---------------------------------------------------------------------------
  75. /*
  76. * Form을 보여줄때 호출되는 event 메서드이다.
  77. * arguments
  78. * Sender : event handler 객체
  79. * return
  80. * void
  81. */
  82. void __fastcall TIHS0030M::FormShow(TObject *Sender)
  83. {
  84. Refresh();
  85. FormInit();
  86. TmrShow->Enabled = true;
  87. }
  88. //---------------------------------------------------------------------------
  89. /*
  90. * form 초기화
  91. *
  92. * arguments
  93. *
  94. * return
  95. * void
  96. */
  97. void __fastcall TIHS0030M::FormInit()
  98. {
  99. DtStDate->Date = Now() - 1;
  100. DtEdDate->Date = Now() - 1;
  101. //DtEdTime->EditValue = Now().FormatString("hh");
  102. DtStTime->Time = StrToDateTime("00:00");
  103. DtEdTime->Time = StrToDateTime("23:59");
  104. }
  105. //---------------------------------------------------------------------------
  106. /*
  107. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  108. * arguments
  109. * Sender : event handler 객체
  110. * return
  111. * void
  112. */
  113. void __fastcall TIHS0030M::TmrShowTimer(TObject *Sender)
  114. {
  115. TmrShow->Enabled = false;
  116. FRAMELinkList1->UpdateList();
  117. }
  118. //---------------------------------------------------------------------------
  119. /*
  120. * Refresh Data Event Function
  121. * arguments
  122. *
  123. * return
  124. * void
  125. */
  126. void __fastcall TIHS0030M::RefreshData()
  127. {
  128. // 검색조건에 의한 링크 데이터 조회
  129. try
  130. {
  131. //SelListData();
  132. }
  133. __finally
  134. {
  135. }
  136. }
  137. //---------------------------------------------------------------------------
  138. /*
  139. * Search 버튼 클릭 이벤트 핸들러
  140. * arguments
  141. * Sender : event handler 객체
  142. * return
  143. * void
  144. */
  145. void __fastcall TIHS0030M::BtnSearchClick(TObject *Sender)
  146. {
  147. Application->ProcessMessages();
  148. TSqlCursor sqlCrs((TControl*)BtnSearch);
  149. #if 0
  150. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  151. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  152. #else
  153. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  154. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  155. #endif
  156. if (FStDateTime > FEdDateTime)
  157. {
  158. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  159. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  160. ActiveControl = DtStDate;
  161. return;
  162. }
  163. #if 0
  164. FStDateTime = FStDateTime + "0000";
  165. FEdDateTime = FEdDateTime + "5959";
  166. #else
  167. FStDateTime = FStDateTime + "00";
  168. FEdDateTime = FEdDateTime + "59";
  169. #endif
  170. FIdList = "";
  171. int nSelects = FRAMELinkList1->GetSelLinkIds(FIdList);
  172. if (0 == nSelects)
  173. {
  174. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  175. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  176. FRAMELinkList1->CxList->SetFocus();
  177. return;
  178. }
  179. #if 0
  180. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  181. #else
  182. String sTitle = FIdList;
  183. #endif
  184. try
  185. {
  186. Application->ProcessMessages();
  187. LockWindowUpdate(Handle);
  188. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  189. if (!pSheet) return;
  190. IHS00301 = new TIHS00301(this, Handle, FStDateTime, FEdDateTime, FIdList);
  191. IHS00301->Parent = pSheet;
  192. IHS00301->Show();
  193. PgTab->ActivePage = pSheet;
  194. pSheet = PgTab->ActivePage;
  195. m_pFormList->Add(IHS00301);
  196. }
  197. __finally
  198. {
  199. LockWindowUpdate(0);
  200. }
  201. }
  202. //---------------------------------------------------------------------------
  203. /*
  204. * Close 버튼 클릭 이벤트 핸들러
  205. * arguments
  206. * Sender : event handler 객체
  207. * return
  208. * void
  209. */
  210. void __fastcall TIHS0030M::BtnCloseClick(TObject *Sender)
  211. {
  212. Close();
  213. }
  214. //---------------------------------------------------------------------------
  215. /*
  216. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  217. * arguments
  218. * Sender : event handler 객체
  219. * return
  220. * void
  221. */
  222. void __fastcall TIHS0030M::OnSubFormClose(TMessage Msg)
  223. {
  224. int nActiveIdx = PgTab->ActivePageIndex;
  225. if (nActiveIdx <= 0) return;
  226. LockWindowUpdate(Handle);
  227. TcxTabSheet *pSheet = PgTab->ActivePage;
  228. if (pSheet)
  229. {
  230. delete pSheet;
  231. }
  232. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  233. m_pFormList->Delete(nActiveIdx);
  234. LockWindowUpdate(0);
  235. }
  236. //---------------------------------------------------------------------------
  237. /*
  238. * Tab Control의 Tab을 더블클릭하여 닫는다.
  239. * arguments
  240. * Sender : event handler 객체
  241. * return
  242. * void
  243. */
  244. void __fastcall TIHS0030M::PgTabDblClick(TObject *Sender)
  245. {
  246. TPoint APoint;
  247. APoint = PgTab->MouseDownPos;
  248. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  249. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  250. }
  251. //---------------------------------------------------------------------------
  252. void __fastcall TIHS0030M::FormClose(TObject *Sender, TCloseAction &Action)
  253. {
  254. CommClose();
  255. IHS0030M = NULL;
  256. Action = caFree;
  257. }
  258. //---------------------------------------------------------------------------
  259. void __fastcall TIHS0030M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  260. {
  261. int nActiveIdx = ATabIndex;
  262. if (nActiveIdx <= 0) return;
  263. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  264. m_pFormList->Delete(nActiveIdx);
  265. }
  266. //---------------------------------------------------------------------------