IHS0020MF.cpp 6.3 KB

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