DSRH060MF.cpp 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #pragma hdrstop
  7. #include "DSRH060MF.h"
  8. #include "DSRH0601F.h"
  9. //---------------------------------------------------------------------------
  10. #pragma package(smart_init)
  11. #pragma link "FRAME_DsrcListF"
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalendar"
  14. #pragma link "cxContainer"
  15. #pragma link "cxControls"
  16. #pragma link "cxDropDownEdit"
  17. #pragma link "cxEdit"
  18. #pragma link "cxGraphics"
  19. #pragma link "cxGroupBox"
  20. #pragma link "cxLabel"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxSpinEdit"
  27. #pragma link "cxSplitter"
  28. #pragma link "cxTextEdit"
  29. #pragma link "cxTimeEdit"
  30. #pragma link "dxSkinBlack"
  31. #pragma link "dxSkinBlue"
  32. #pragma link "dxSkinsCore"
  33. #pragma link "dxSkinscxPCPainter"
  34. #pragma resource "*.dfm"
  35. TDSRH060M *DSRH060M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TDSRH060M::TDSRH060M(TComponent* Owner)
  38. : TForm(Owner)
  39. {
  40. ITSSkin_Load(this);
  41. CMM_LoadForm(g_sFormsDir, this);
  42. FTitle = "DSRC-RSE OBU 수집 이력조회";
  43. m_pFormList = new TList();
  44. TsList01->TabVisible = false;
  45. FRAMEDsrcList1->PnlBottom->Visible = false;
  46. }
  47. //---------------------------------------------------------------------------
  48. /*
  49. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  50. * Form과 DataModule class를 delete시킨다.
  51. * arguments
  52. *
  53. * return
  54. * void
  55. */
  56. void __fastcall TDSRH060M::CommClose()
  57. {
  58. try
  59. {
  60. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  61. {
  62. m_pFormList->Delete(idx);
  63. }
  64. delete m_pFormList;
  65. CMM_SaveForm(g_sFormsDir, this);
  66. }
  67. catch(...)
  68. {
  69. }
  70. }
  71. //---------------------------------------------------------------------------
  72. /*
  73. * Form을 보여줄때 호출되는 event 메서드이다.
  74. * arguments
  75. * Sender : event handler 객체
  76. * return
  77. * void
  78. */
  79. void __fastcall TDSRH060M::FormShow(TObject *Sender)
  80. {
  81. Refresh();
  82. FormInit();
  83. TmrShow->Enabled = true;
  84. }
  85. //---------------------------------------------------------------------------
  86. /*
  87. * form 초기화
  88. *
  89. * arguments
  90. *
  91. * return
  92. * void
  93. */
  94. void __fastcall TDSRH060M::FormInit()
  95. {
  96. DtStDate->Date = Now() - 1;// - 1;
  97. DtEdDate->Date = Now() - 1;
  98. //DtEdTime->EditValue = Now().FormatString("hh");
  99. DtStTime->Time = StrToDateTime("00:00");
  100. DtEdTime->Time = StrToDateTime("23:59");
  101. InitCode();
  102. }
  103. //---------------------------------------------------------------------------
  104. /*
  105. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  106. * arguments
  107. * Sender : event handler 객체
  108. * return
  109. * void
  110. */
  111. void __fastcall TDSRH060M::TmrShowTimer(TObject *Sender)
  112. {
  113. TmrShow->Enabled = false;
  114. FRAMEDsrcList1->UpdateList();
  115. }
  116. //---------------------------------------------------------------------------
  117. /*
  118. * Refresh Data Event Function
  119. * arguments
  120. *
  121. * return
  122. * void
  123. */
  124. void __fastcall TDSRH060M::RefreshData()
  125. {
  126. // 검색조건에 의한 링크 데이터 조회
  127. try
  128. {
  129. //SelListData();
  130. }
  131. __finally
  132. {
  133. }
  134. }
  135. //---------------------------------------------------------------------------
  136. /*
  137. * Search 버튼 클릭 이벤트 핸들러
  138. * arguments
  139. * Sender : event handler 객체
  140. * return
  141. * void
  142. */
  143. void __fastcall TDSRH060M::BtnSearchClick(TObject *Sender)
  144. {
  145. Application->ProcessMessages();
  146. TSqlCursor sqlCrs((TControl*)BtnSearch);
  147. #if 0
  148. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  149. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  150. #else
  151. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  152. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  153. #endif
  154. if (FStDateTime > FEdDateTime)
  155. {
  156. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  157. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  158. ActiveControl = DtStDate;
  159. return;
  160. }
  161. #if 0
  162. FStDateTime = FStDateTime + "0000";
  163. FEdDateTime = FEdDateTime + "5959";
  164. #else
  165. FStDateTime = FStDateTime + "00";
  166. FEdDateTime = FEdDateTime + "59";
  167. #endif
  168. FIdList = "";
  169. int nSelects = CMM_GetSelectCount(FRAMEDsrcList1->TvList, FRAMEDsrcList1->ColumnSel->Index, FRAMEDsrcList1->Column01->Index, FIdList);
  170. if (0 == nSelects)
  171. {
  172. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  173. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  174. FRAMEDsrcList1->CxList->SetFocus();
  175. return;
  176. }
  177. //String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  178. String sTitle = "[" + FStDateTime.SubString(1, 12) + " ~ " + FEdDateTime.SubString(1, 12) + "]";
  179. String CTYP = APP_GetCode(CbCTyp);
  180. String OBU_KIND = APP_GetCode(CbObuKind);
  181. try
  182. {
  183. Application->ProcessMessages();
  184. LockWindowUpdate(Handle);
  185. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  186. if (!pSheet) return;
  187. DSRH0601 = new TDSRH0601(this, Handle, FStDateTime, FEdDateTime, FIdList, CTYP, OBU_KIND);
  188. DSRH0601->Parent = pSheet;
  189. DSRH0601->Show();
  190. PgTab->ActivePage = pSheet;
  191. pSheet = PgTab->ActivePage;
  192. m_pFormList->Add(DSRH0601);
  193. }
  194. __finally
  195. {
  196. LockWindowUpdate(0);
  197. }
  198. }
  199. //---------------------------------------------------------------------------
  200. /*
  201. * Close 버튼 클릭 이벤트 핸들러
  202. * arguments
  203. * Sender : event handler 객체
  204. * return
  205. * void
  206. */
  207. void __fastcall TDSRH060M::BtnCloseClick(TObject *Sender)
  208. {
  209. Close();
  210. }
  211. //---------------------------------------------------------------------------
  212. /*
  213. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  214. * arguments
  215. * Sender : event handler 객체
  216. * return
  217. * void
  218. */
  219. void __fastcall TDSRH060M::OnSubFormClose(TMessage Msg)
  220. {
  221. int nActiveIdx = PgTab->ActivePageIndex;
  222. if (nActiveIdx <= 0) return;
  223. LockWindowUpdate(Handle);
  224. TcxTabSheet *pSheet = PgTab->ActivePage;
  225. if (pSheet)
  226. {
  227. delete pSheet;
  228. }
  229. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  230. m_pFormList->Delete(nActiveIdx);
  231. LockWindowUpdate(0);
  232. }
  233. //---------------------------------------------------------------------------
  234. /*
  235. * Tab Control의 Tab을 더블클릭하여 닫는다.
  236. * arguments
  237. * Sender : event handler 객체
  238. * return
  239. * void
  240. */
  241. void __fastcall TDSRH060M::PgTabDblClick(TObject *Sender)
  242. {
  243. TPoint APoint;
  244. APoint = PgTab->MouseDownPos;
  245. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  246. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  247. }
  248. //---------------------------------------------------------------------------
  249. void __fastcall TDSRH060M::FormClose(TObject *Sender, TCloseAction &Action)
  250. {
  251. CommClose();
  252. DSRH060M = NULL;
  253. Action = caFree;
  254. }
  255. //---------------------------------------------------------------------------
  256. void __fastcall TDSRH060M::FormCloseQuery(TObject *Sender, bool &CanClose)
  257. {
  258. FRAMEDsrcList1->OnCloseQuery(CanClose);
  259. }
  260. //---------------------------------------------------------------------------
  261. void __fastcall TDSRH060M::InitCode()
  262. {
  263. TItsCode *FCodeRCT;
  264. TItsCode *FCodeOBU;
  265. FCodeRCT = ItsCodeManager->FLists.Find("RCT");
  266. FCodeOBU = ItsCodeManager->FLists.Find("OBU");
  267. // 차종
  268. CbCTyp->Properties->Items->Clear();
  269. CbCTyp->Properties->Items->Add(" [ALL] 전체");
  270. if (FCodeRCT)
  271. {
  272. FOR_STL(TItsSubCode *, pSubCode, FCodeRCT->FSubLists)
  273. {
  274. if (pSubCode->USE_YN == "N") continue;
  275. CbCTyp->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  276. }
  277. }
  278. CbCTyp->ItemIndex = 0;
  279. // OBU 종류
  280. CbObuKind->Properties->Items->Clear();
  281. CbObuKind->Properties->Items->Add(" [ALL] 전체");
  282. if (FCodeOBU)
  283. {
  284. FOR_STL(TItsSubCode *, pSubCode, FCodeOBU->FSubLists)
  285. {
  286. if (pSubCode->USE_YN == "N") continue;
  287. CbObuKind->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  288. }
  289. }
  290. CbObuKind->ItemIndex = 0;
  291. }
  292. //---------------------------------------------------------------------------
  293. void __fastcall TDSRH060M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  294. {
  295. int nActiveIdx = ATabIndex;
  296. if (nActiveIdx <= 0) return;
  297. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  298. m_pFormList->Delete(nActiveIdx);
  299. }
  300. //---------------------------------------------------------------------------