VDSH070MF.cpp 9.0 KB

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