IHS0040MF.cpp 8.5 KB

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