IHS0040MF.cpp 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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 link "dxSkinMcSkin"
  38. #pragma resource "*.dfm"
  39. TIHS0040M *IHS0040M = NULL;
  40. //---------------------------------------------------------------------------
  41. __fastcall TIHS0040M::TIHS0040M(TComponent* Owner)
  42. : TForm(Owner)
  43. {
  44. LangTrans->Translate(this, ITSDb_GetConnection());
  45. ITSSkin_Load(this);
  46. CMM_LoadForm(g_sFormsDir, this);
  47. FTitle = Caption;//"가공데이터 이력조회";
  48. m_pFormList = new TList();
  49. TsList01->TabVisible = false;
  50. FRAMELinkList1->PnlTop->Visible = false;
  51. FRAMELinkList1->PnlBottom->Visible = false;
  52. FRAMEIfscList1->PnlTop->Visible = false;
  53. FRAMEIfscList1->PnlBottom->Visible = false;
  54. FRAMERoadList1->PnlTop->Visible = false;
  55. FRAMERoadList1->PnlBottom->Visible = false;
  56. cxPageControl1->ActivePageIndex = 0;
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TIHS0040M::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. void __fastcall TIHS0040M::FormShow(TObject *Sender)
  76. {
  77. Refresh();
  78. FormInit();
  79. TmrShow->Enabled = true;
  80. }
  81. //---------------------------------------------------------------------------
  82. void __fastcall TIHS0040M::FormInit()
  83. {
  84. DtStDate->Date = Now() - 1;
  85. DtEdDate->Date = Now() - 1;
  86. //DtEdTime->EditValue = Now().FormatString("hh");
  87. DtStTime->Time = StrToDateTime("00:00");
  88. DtEdTime->Time = StrToDateTime("23:59");
  89. }
  90. //---------------------------------------------------------------------------
  91. void __fastcall TIHS0040M::TmrShowTimer(TObject *Sender)
  92. {
  93. TmrShow->Enabled = false;
  94. FRAMELinkList1->UpdateList();
  95. FRAMEIfscList1->UpdateList();
  96. FRAMERoadList1->UpdateList();
  97. }
  98. //---------------------------------------------------------------------------
  99. void __fastcall TIHS0040M::RefreshData()
  100. {
  101. // 검색조건에 의한 링크 데이터 조회
  102. try
  103. {
  104. //SelListData();
  105. }
  106. __finally
  107. {
  108. }
  109. }
  110. //---------------------------------------------------------------------------
  111. void __fastcall TIHS0040M::BtnSearchClick(TObject *Sender)
  112. {
  113. Application->ProcessMessages();
  114. TSqlCursor sqlCrs((TControl*)BtnSearch);
  115. #if 0
  116. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  117. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  118. #else
  119. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  120. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  121. #endif
  122. if (FStDateTime > FEdDateTime)
  123. {
  124. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  125. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  126. ActiveControl = DtStDate;
  127. return;
  128. }
  129. #if 0
  130. FStDateTime = FStDateTime + "0000";
  131. FEdDateTime = FEdDateTime + "5959";
  132. #else
  133. FStDateTime = FStDateTime + "00";
  134. FEdDateTime = FEdDateTime + "59";
  135. #endif
  136. TcxGrid *pCxList;
  137. TcxGridTableView *pTvList = NULL;
  138. int nIdCol = -1;
  139. if (cxPageControl1->Properties->ActivePage->PageIndex == 0)
  140. {
  141. pCxList = FRAMELinkList1->CxList;
  142. pTvList = FRAMELinkList1->TvList;
  143. nIdCol = FRAMELinkList1->Column01->Index;
  144. FLinkLevel = 1;
  145. }
  146. else
  147. if (cxPageControl1->Properties->ActivePage->PageIndex == 1)
  148. {
  149. pCxList = FRAMEIfscList1->CxList;
  150. pTvList = FRAMEIfscList1->TvList;
  151. nIdCol = FRAMEIfscList1->Column01->Index;
  152. FLinkLevel = 2;
  153. }
  154. else
  155. {
  156. pCxList = FRAMERoadList1->CxList;
  157. pTvList = FRAMERoadList1->TvList;
  158. nIdCol = FRAMERoadList1->Column01->Index;
  159. FLinkLevel = 3;
  160. }
  161. if (!pTvList) return;
  162. TcxDataController *pGDC = pTvList->DataController;
  163. int nIndex = pGDC->FocusedRecordIndex;
  164. if( nIndex < 0 )
  165. {
  166. Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"링크를 먼저 선택 하세요.",
  167. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  168. ActiveControl = pCxList;
  169. return;
  170. }
  171. FIdList = VarToStr(pGDC->Values[nIndex][nIdCol]);
  172. #if 0
  173. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  174. #else
  175. String sTitle = FIdList;
  176. #endif
  177. try
  178. {
  179. Application->ProcessMessages();
  180. LockWindowUpdate(Handle);
  181. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  182. if (!pSheet) return;
  183. IHS00401 = new TIHS00401(this, Handle, FStDateTime, FEdDateTime, FIdList, FLinkLevel);
  184. IHS00401->Parent = pSheet;
  185. IHS00401->Show();
  186. PgTab->ActivePage = pSheet;
  187. pSheet = PgTab->ActivePage;
  188. m_pFormList->Add(IHS00401);
  189. }
  190. __finally
  191. {
  192. LockWindowUpdate(0);
  193. }
  194. }
  195. //---------------------------------------------------------------------------
  196. void __fastcall TIHS0040M::BtnCloseClick(TObject *Sender)
  197. {
  198. Close();
  199. }
  200. //---------------------------------------------------------------------------
  201. void __fastcall TIHS0040M::OnSubFormClose(TMessage Msg)
  202. {
  203. int nActiveIdx = PgTab->ActivePageIndex;
  204. if (nActiveIdx <= 0) return;
  205. LockWindowUpdate(Handle);
  206. TcxTabSheet *pSheet = PgTab->ActivePage;
  207. if (pSheet)
  208. {
  209. delete pSheet;
  210. }
  211. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  212. m_pFormList->Delete(nActiveIdx);
  213. LockWindowUpdate(0);
  214. }
  215. //---------------------------------------------------------------------------
  216. void __fastcall TIHS0040M::PgTabDblClick(TObject *Sender)
  217. {
  218. TPoint APoint;
  219. APoint = PgTab->MouseDownPos;
  220. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  221. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  222. }
  223. //---------------------------------------------------------------------------
  224. void __fastcall TIHS0040M::FormClose(TObject *Sender, TCloseAction &Action)
  225. {
  226. CommClose();
  227. IHS0040M = NULL;
  228. Action = caFree;
  229. }
  230. //---------------------------------------------------------------------------
  231. void __fastcall TIHS0040M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  232. {
  233. int nActiveIdx = ATabIndex;
  234. if (nActiveIdx <= 0) return;
  235. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  236. m_pFormList->Delete(nActiveIdx);
  237. }
  238. //---------------------------------------------------------------------------