IHS0040MF.cpp 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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_RoadListF"
  14. #pragma link "cxButtons"
  15. #pragma link "cxCalendar"
  16. #pragma link "cxContainer"
  17. #pragma link "cxControls"
  18. #pragma link "cxDropDownEdit"
  19. #pragma link "cxEdit"
  20. #pragma link "cxGraphics"
  21. #pragma link "cxGroupBox"
  22. #pragma link "cxLabel"
  23. #pragma link "cxLookAndFeelPainters"
  24. #pragma link "cxLookAndFeels"
  25. #pragma link "cxMaskEdit"
  26. #pragma link "cxPC"
  27. #pragma link "cxPCdxBarPopupMenu"
  28. #pragma link "cxSpinEdit"
  29. #pragma link "cxSplitter"
  30. #pragma link "cxTextEdit"
  31. #pragma link "cxTimeEdit"
  32. #pragma link "dxSkinBlack"
  33. #pragma link "dxSkinBlue"
  34. #pragma link "dxSkinsCore"
  35. #pragma link "dxSkinscxPCPainter"
  36. #pragma link "FRAME_IfscListF"
  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. FRAMEIfscList1->PnlTop->Visible = false;
  52. FRAMEIfscList1->PnlBottom->Visible = false;
  53. FRAMERoadList1->PnlTop->Visible = false;
  54. FRAMERoadList1->PnlBottom->Visible = false;
  55. cxPageControl1->ActivePageIndex = 0;
  56. }
  57. //---------------------------------------------------------------------------
  58. void __fastcall TIHS0040M::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 TIHS0040M::FormShow(TObject *Sender)
  75. {
  76. Refresh();
  77. FormInit();
  78. TmrShow->Enabled = true;
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TIHS0040M::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 TIHS0040M::TmrShowTimer(TObject *Sender)
  91. {
  92. TmrShow->Enabled = false;
  93. FRAMELinkList1->UpdateList();
  94. FRAMEIfscList1->UpdateList();
  95. FRAMERoadList1->UpdateList();
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TIHS0040M::RefreshData()
  99. {
  100. // 검색조건에 의한 링크 데이터 조회
  101. try
  102. {
  103. //SelListData();
  104. }
  105. __finally
  106. {
  107. }
  108. }
  109. //---------------------------------------------------------------------------
  110. void __fastcall TIHS0040M::BtnSearchClick(TObject *Sender)
  111. {
  112. Application->ProcessMessages();
  113. TSqlCursor sqlCrs((TControl*)BtnSearch);
  114. #if 0
  115. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  116. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  117. #else
  118. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  119. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  120. #endif
  121. if (FStDateTime > FEdDateTime)
  122. {
  123. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  124. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  125. ActiveControl = DtStDate;
  126. return;
  127. }
  128. #if 0
  129. FStDateTime = FStDateTime + "0000";
  130. FEdDateTime = FEdDateTime + "5959";
  131. #else
  132. FStDateTime = FStDateTime + "00";
  133. FEdDateTime = FEdDateTime + "59";
  134. #endif
  135. TcxGrid *pCxList;
  136. TcxGridTableView *pTvList = NULL;
  137. int nIdCol = -1;
  138. if (cxPageControl1->Properties->ActivePage->PageIndex == 0)
  139. {
  140. pCxList = FRAMELinkList1->CxList;
  141. pTvList = FRAMELinkList1->TvList;
  142. nIdCol = FRAMELinkList1->Column01->Index;
  143. FLinkLevel = 1;
  144. }
  145. else
  146. if (cxPageControl1->Properties->ActivePage->PageIndex == 1)
  147. {
  148. pCxList = FRAMEIfscList1->CxList;
  149. pTvList = FRAMEIfscList1->TvList;
  150. nIdCol = FRAMEIfscList1->Column01->Index;
  151. FLinkLevel = 2;
  152. }
  153. else
  154. {
  155. pCxList = FRAMERoadList1->CxList;
  156. pTvList = FRAMERoadList1->TvList;
  157. nIdCol = FRAMERoadList1->Column01->Index;
  158. FLinkLevel = 3;
  159. }
  160. if (!pTvList) return;
  161. TcxDataController *pGDC = pTvList->DataController;
  162. int nIndex = pGDC->FocusedRecordIndex;
  163. if( nIndex < 0 )
  164. {
  165. Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"링크를 먼저 선택 하세요.",
  166. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  167. ActiveControl = pCxList;
  168. return;
  169. }
  170. FIdList = VarToStr(pGDC->Values[nIndex][nIdCol]);
  171. #if 0
  172. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  173. #else
  174. String sTitle = FIdList;
  175. #endif
  176. try
  177. {
  178. Application->ProcessMessages();
  179. LockWindowUpdate(Handle);
  180. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  181. if (!pSheet) return;
  182. IHS00401 = new TIHS00401(this, Handle, FStDateTime, FEdDateTime, FIdList, FLinkLevel);
  183. IHS00401->Parent = pSheet;
  184. IHS00401->Show();
  185. PgTab->ActivePage = pSheet;
  186. pSheet = PgTab->ActivePage;
  187. m_pFormList->Add(IHS00401);
  188. }
  189. __finally
  190. {
  191. LockWindowUpdate(0);
  192. }
  193. }
  194. //---------------------------------------------------------------------------
  195. void __fastcall TIHS0040M::BtnCloseClick(TObject *Sender)
  196. {
  197. Close();
  198. }
  199. //---------------------------------------------------------------------------
  200. void __fastcall TIHS0040M::OnSubFormClose(TMessage Msg)
  201. {
  202. int nActiveIdx = PgTab->ActivePageIndex;
  203. if (nActiveIdx <= 0) return;
  204. LockWindowUpdate(Handle);
  205. TcxTabSheet *pSheet = PgTab->ActivePage;
  206. if (pSheet)
  207. {
  208. delete pSheet;
  209. }
  210. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  211. m_pFormList->Delete(nActiveIdx);
  212. LockWindowUpdate(0);
  213. }
  214. //---------------------------------------------------------------------------
  215. void __fastcall TIHS0040M::PgTabDblClick(TObject *Sender)
  216. {
  217. TPoint APoint;
  218. APoint = PgTab->MouseDownPos;
  219. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  220. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  221. }
  222. //---------------------------------------------------------------------------
  223. void __fastcall TIHS0040M::FormClose(TObject *Sender, TCloseAction &Action)
  224. {
  225. CommClose();
  226. IHS0040M = NULL;
  227. Action = caFree;
  228. }
  229. //---------------------------------------------------------------------------
  230. void __fastcall TIHS0040M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  231. {
  232. int nActiveIdx = ATabIndex;
  233. if (nActiveIdx <= 0) return;
  234. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  235. m_pFormList->Delete(nActiveIdx);
  236. }
  237. //---------------------------------------------------------------------------