IHS0020MF.cpp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. void __fastcall TIHS0020M::CommClose()
  50. {
  51. try
  52. {
  53. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  54. {
  55. m_pFormList->Delete(idx);
  56. }
  57. delete m_pFormList;
  58. CMM_SaveForm(g_sFormsDir, this);
  59. }
  60. catch(...)
  61. {
  62. }
  63. }
  64. //---------------------------------------------------------------------------
  65. void __fastcall TIHS0020M::FormShow(TObject *Sender)
  66. {
  67. Refresh();
  68. FormInit();
  69. TmrShow->Enabled = true;
  70. }
  71. //---------------------------------------------------------------------------
  72. void __fastcall TIHS0020M::FormInit()
  73. {
  74. DtStDate->Date = Now();// - 1;
  75. DtEdDate->Date = Now();// - 1;
  76. DtStTime->EditValue = "00";//Now().FormatString("hh");
  77. DtEdTime->EditValue = "23";//Now().FormatString("hh");
  78. CbType->Properties->Items->Clear();
  79. try
  80. {
  81. ItsProcessManager->FLists.Lock();
  82. FOR_STL(TItsProcess*, pObj, ItsProcessManager->FLists)
  83. {
  84. if (pObj->DEL_YN == "Y") continue;
  85. if (pObj->STTS_DSPL_YN == "N") continue;
  86. String sSystType = pObj->SYST_TYPE;
  87. String sSystName = pObj->SYST_NM;
  88. String sSystId = pObj->SYST_ID;
  89. CbType->Properties->Items->Add("[" + sSystId + "] " + sSystName);
  90. }
  91. }
  92. __finally
  93. {
  94. ItsProcessManager->FLists.UnLock();
  95. }
  96. CbType->ItemIndex = 0;
  97. }
  98. //---------------------------------------------------------------------------
  99. void __fastcall TIHS0020M::TmrShowTimer(TObject *Sender)
  100. {
  101. TmrShow->Enabled = false;
  102. }
  103. //---------------------------------------------------------------------------
  104. void __fastcall TIHS0020M::RefreshData()
  105. {
  106. // 검색조건에 의한 링크 데이터 조회
  107. try
  108. {
  109. //SelListData();
  110. }
  111. __finally
  112. {
  113. }
  114. }
  115. //---------------------------------------------------------------------------
  116. void __fastcall TIHS0020M::BtnSearchClick(TObject *Sender)
  117. {
  118. Application->ProcessMessages();
  119. TSqlCursor sqlCrs((TControl*)BtnSearch);
  120. String sStDateTime = DtStDate->Date.FormatString("yyyymmdd");
  121. String sEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  122. #if 0
  123. if (sStDateTime > sEdDateTime)
  124. {
  125. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  126. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  127. ActiveControl = DtStDate;
  128. return;
  129. }
  130. FStDateTime = sStDateTime + "0000";
  131. FEdDateTime = sEdDateTime + "5959";
  132. #endif
  133. FStDateTime = sStDateTime + "000000";
  134. FEdDateTime = sStDateTime + "235959";
  135. FIdList = "";
  136. int FRptType = CbType->ItemIndex;
  137. String sType = CbType->Text;
  138. String sTitle;
  139. sTitle = sType + "[" + sStDateTime + "]";
  140. String sSystId = ITSUtil_GetCode(CbType->Text);
  141. try
  142. {
  143. Application->ProcessMessages();
  144. LockWindowUpdate(Handle);
  145. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  146. if (!pSheet) return;
  147. IHS00201 = new TIHS00201(this, Handle, FRptType, sSystId, FStDateTime, FEdDateTime, sTitle);
  148. IHS00201->Parent = pSheet;
  149. IHS00201->Show();
  150. PgTab->ActivePage = pSheet;
  151. pSheet = PgTab->ActivePage;
  152. m_pFormList->Add(IHS00201);
  153. }
  154. __finally
  155. {
  156. LockWindowUpdate(0);
  157. }
  158. }
  159. //---------------------------------------------------------------------------
  160. void __fastcall TIHS0020M::BtnCloseClick(TObject *Sender)
  161. {
  162. Close();
  163. }
  164. //---------------------------------------------------------------------------
  165. void __fastcall TIHS0020M::OnSubFormClose(TMessage Msg)
  166. {
  167. int nActiveIdx = PgTab->ActivePageIndex;
  168. if (nActiveIdx <= 0) return;
  169. LockWindowUpdate(Handle);
  170. TcxTabSheet *pSheet = PgTab->ActivePage;
  171. if (pSheet)
  172. {
  173. delete pSheet;
  174. }
  175. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  176. m_pFormList->Delete(nActiveIdx);
  177. LockWindowUpdate(0);
  178. }
  179. //---------------------------------------------------------------------------
  180. void __fastcall TIHS0020M::PgTabDblClick(TObject *Sender)
  181. {
  182. TPoint APoint;
  183. APoint = PgTab->MouseDownPos;
  184. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  185. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  186. }
  187. //---------------------------------------------------------------------------
  188. void __fastcall TIHS0020M::FormClose(TObject *Sender, TCloseAction &Action)
  189. {
  190. CommClose();
  191. IHS0020M = NULL;
  192. Action = caFree;
  193. }
  194. //---------------------------------------------------------------------------
  195. void __fastcall TIHS0020M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  196. {
  197. int nActiveIdx = ATabIndex;
  198. if (nActiveIdx <= 0) return;
  199. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  200. m_pFormList->Delete(nActiveIdx);
  201. }
  202. //---------------------------------------------------------------------------