IHS0020MF.cpp 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "CDSProcessF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "IHS0020MF.h"
  10. #include "IHS00201F.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  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. TIHS0020M *IHS0020M = NULL;
  37. //---------------------------------------------------------------------------
  38. __fastcall TIHS0020M::TIHS0020M(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. }
  48. //---------------------------------------------------------------------------
  49. /*
  50. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  51. * Form과 DataModule class를 delete시킨다.
  52. * arguments
  53. *
  54. * return
  55. * void
  56. */
  57. void __fastcall TIHS0020M::CommClose()
  58. {
  59. try
  60. {
  61. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  62. {
  63. m_pFormList->Delete(idx);
  64. }
  65. delete m_pFormList;
  66. CMM_SaveForm(g_sFormsDir, this);
  67. }
  68. catch(...)
  69. {
  70. }
  71. }
  72. //---------------------------------------------------------------------------
  73. /*
  74. * Form을 보여줄때 호출되는 event 메서드이다.
  75. * arguments
  76. * Sender : event handler 객체
  77. * return
  78. * void
  79. */
  80. void __fastcall TIHS0020M::FormShow(TObject *Sender)
  81. {
  82. Refresh();
  83. FormInit();
  84. TmrShow->Enabled = true;
  85. }
  86. //---------------------------------------------------------------------------
  87. /*
  88. * form 초기화
  89. *
  90. * arguments
  91. *
  92. * return
  93. * void
  94. */
  95. void __fastcall TIHS0020M::FormInit()
  96. {
  97. DtStDate->Date = Now();// - 1;
  98. DtEdDate->Date = Now();// - 1;
  99. DtStTime->EditValue = "00";//Now().FormatString("hh");
  100. DtEdTime->EditValue = "23";//Now().FormatString("hh");
  101. CbType->Properties->Items->Clear();
  102. try
  103. {
  104. ItsProcessManager->FLists.Lock();
  105. FOR_STL(TItsProcess*, pObj, ItsProcessManager->FLists)
  106. {
  107. if (pObj->DEL_YN == "Y") continue;
  108. if (pObj->STTS_DSPL_YN == "N") continue;
  109. String sSystType = pObj->SYST_TYPE;
  110. String sSystName = pObj->SYST_NM;
  111. String sSystId = pObj->SYST_ID;
  112. CbType->Properties->Items->Add("[" + sSystId + "] " + sSystName);
  113. }
  114. }
  115. __finally
  116. {
  117. ItsProcessManager->FLists.UnLock();
  118. }
  119. CbType->ItemIndex = 0;
  120. }
  121. //---------------------------------------------------------------------------
  122. /*
  123. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  124. * arguments
  125. * Sender : event handler 객체
  126. * return
  127. * void
  128. */
  129. void __fastcall TIHS0020M::TmrShowTimer(TObject *Sender)
  130. {
  131. TmrShow->Enabled = false;
  132. }
  133. //---------------------------------------------------------------------------
  134. /*
  135. * Refresh Data Event Function
  136. * arguments
  137. *
  138. * return
  139. * void
  140. */
  141. void __fastcall TIHS0020M::RefreshData()
  142. {
  143. // 검색조건에 의한 링크 데이터 조회
  144. try
  145. {
  146. //SelListData();
  147. }
  148. __finally
  149. {
  150. }
  151. }
  152. //---------------------------------------------------------------------------
  153. /*
  154. * Search 버튼 클릭 이벤트 핸들러
  155. * arguments
  156. * Sender : event handler 객체
  157. * return
  158. * void
  159. */
  160. void __fastcall TIHS0020M::BtnSearchClick(TObject *Sender)
  161. {
  162. Application->ProcessMessages();
  163. TSqlCursor sqlCrs((TControl*)BtnSearch);
  164. String sStDateTime = DtStDate->Date.FormatString("yyyymmdd");
  165. String sEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  166. #if 0
  167. if (sStDateTime > sEdDateTime)
  168. {
  169. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  170. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  171. ActiveControl = DtStDate;
  172. return;
  173. }
  174. FStDateTime = sStDateTime + "0000";
  175. FEdDateTime = sEdDateTime + "5959";
  176. #endif
  177. FStDateTime = sStDateTime + "000000";
  178. FEdDateTime = sStDateTime + "235959";
  179. FIdList = "";
  180. int FRptType = CbType->ItemIndex;
  181. String sType = CbType->Text;
  182. String sTitle;
  183. sTitle = sType + "[" + sStDateTime + "]";
  184. String sSystId = ITSUtil_GetCode(CbType->Text);
  185. try
  186. {
  187. Application->ProcessMessages();
  188. LockWindowUpdate(Handle);
  189. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  190. if (!pSheet) return;
  191. IHS00201 = new TIHS00201(this, Handle, FRptType, sSystId, FStDateTime, FEdDateTime, sTitle);
  192. IHS00201->Parent = pSheet;
  193. IHS00201->Show();
  194. PgTab->ActivePage = pSheet;
  195. pSheet = PgTab->ActivePage;
  196. m_pFormList->Add(IHS00201);
  197. }
  198. __finally
  199. {
  200. LockWindowUpdate(0);
  201. }
  202. }
  203. //---------------------------------------------------------------------------
  204. /*
  205. * Close 버튼 클릭 이벤트 핸들러
  206. * arguments
  207. * Sender : event handler 객체
  208. * return
  209. * void
  210. */
  211. void __fastcall TIHS0020M::BtnCloseClick(TObject *Sender)
  212. {
  213. Close();
  214. }
  215. //---------------------------------------------------------------------------
  216. /*
  217. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  218. * arguments
  219. * Sender : event handler 객체
  220. * return
  221. * void
  222. */
  223. void __fastcall TIHS0020M::OnSubFormClose(TMessage Msg)
  224. {
  225. int nActiveIdx = PgTab->ActivePageIndex;
  226. if (nActiveIdx <= 0) return;
  227. LockWindowUpdate(Handle);
  228. TcxTabSheet *pSheet = PgTab->ActivePage;
  229. if (pSheet)
  230. {
  231. delete pSheet;
  232. }
  233. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  234. m_pFormList->Delete(nActiveIdx);
  235. LockWindowUpdate(0);
  236. }
  237. //---------------------------------------------------------------------------
  238. /*
  239. * Tab Control의 Tab을 더블클릭하여 닫는다.
  240. * arguments
  241. * Sender : event handler 객체
  242. * return
  243. * void
  244. */
  245. void __fastcall TIHS0020M::PgTabDblClick(TObject *Sender)
  246. {
  247. TPoint APoint;
  248. APoint = PgTab->MouseDownPos;
  249. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  250. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  251. }
  252. //---------------------------------------------------------------------------
  253. void __fastcall TIHS0020M::FormClose(TObject *Sender, TCloseAction &Action)
  254. {
  255. CommClose();
  256. IHS0020M = NULL;
  257. Action = caFree;
  258. }
  259. //---------------------------------------------------------------------------
  260. void __fastcall TIHS0020M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  261. {
  262. int nActiveIdx = ATabIndex;
  263. if (nActiveIdx <= 0) return;
  264. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  265. m_pFormList->Delete(nActiveIdx);
  266. }
  267. //---------------------------------------------------------------------------