DSRH060MF.cpp 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #include "ITS_OPLibF.h"
  8. #pragma hdrstop
  9. #include "DSRH060MF.h"
  10. #include "DSRH0601F.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "FRAME_DsrcListF"
  14. #pragma link "cxButtons"
  15. #pragma link "cxCalendar"
  16. #pragma link "cxContainer"
  17. #pragma link "cxControls"
  18. #pragma link "cxDropDownEdit"
  19. #pragma link "cxEdit"
  20. #pragma link "cxGraphics"
  21. #pragma link "cxGroupBox"
  22. #pragma link "cxLabel"
  23. #pragma link "cxLookAndFeelPainters"
  24. #pragma link "cxLookAndFeels"
  25. #pragma link "cxMaskEdit"
  26. #pragma link "cxPC"
  27. #pragma link "cxPCdxBarPopupMenu"
  28. #pragma link "cxSpinEdit"
  29. #pragma link "cxSplitter"
  30. #pragma link "cxTextEdit"
  31. #pragma link "cxTimeEdit"
  32. #pragma link "dxSkinBlack"
  33. #pragma link "dxSkinBlue"
  34. #pragma link "dxSkinsCore"
  35. #pragma link "dxSkinscxPCPainter"
  36. #pragma link "dxSkinMcSkin"
  37. #pragma resource "*.dfm"
  38. TDSRH060M *DSRH060M = NULL;
  39. //---------------------------------------------------------------------------
  40. __fastcall TDSRH060M::TDSRH060M(TComponent* Owner)
  41. : TForm(Owner)
  42. {
  43. LangTrans->Translate(this, ITSDb_GetConnection());
  44. ITSSkin_Load(this);
  45. CMM_LoadForm(g_sFormsDir, this);
  46. FTitle = Caption;
  47. m_pFormList = new TList();
  48. TsList01->TabVisible = false;
  49. FRAMEDsrcList1->PnlBottom->Visible = false;
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TDSRH060M::CommClose()
  53. {
  54. try
  55. {
  56. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  57. {
  58. m_pFormList->Delete(idx);
  59. }
  60. delete m_pFormList;
  61. CMM_SaveForm(g_sFormsDir, this);
  62. }
  63. catch(...)
  64. {
  65. }
  66. }
  67. //---------------------------------------------------------------------------
  68. void __fastcall TDSRH060M::FormShow(TObject *Sender)
  69. {
  70. Refresh();
  71. FormInit();
  72. TmrShow->Enabled = true;
  73. }
  74. //---------------------------------------------------------------------------
  75. void __fastcall TDSRH060M::FormInit()
  76. {
  77. DtStDate->Date = Now() - 1;// - 1;
  78. DtEdDate->Date = Now() - 1;
  79. //DtEdTime->EditValue = Now().FormatString("hh");
  80. DtStTime->Time = StrToDateTime("00:00");
  81. DtEdTime->Time = StrToDateTime("23:59");
  82. InitCode();
  83. }
  84. //---------------------------------------------------------------------------
  85. void __fastcall TDSRH060M::TmrShowTimer(TObject *Sender)
  86. {
  87. TmrShow->Enabled = false;
  88. FRAMEDsrcList1->UpdateList();
  89. }
  90. //---------------------------------------------------------------------------
  91. void __fastcall TDSRH060M::RefreshData()
  92. {
  93. // 검색조건에 의한 링크 데이터 조회
  94. try
  95. {
  96. //SelListData();
  97. }
  98. __finally
  99. {
  100. }
  101. }
  102. //---------------------------------------------------------------------------
  103. void __fastcall TDSRH060M::BtnSearchClick(TObject *Sender)
  104. {
  105. Application->ProcessMessages();
  106. TSqlCursor sqlCrs((TControl*)BtnSearch);
  107. #if 0
  108. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  109. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  110. #else
  111. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  112. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  113. #endif
  114. if (FStDateTime > FEdDateTime)
  115. {
  116. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  117. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  118. ActiveControl = DtStDate;
  119. return;
  120. }
  121. #if 0
  122. FStDateTime = FStDateTime + "0000";
  123. FEdDateTime = FEdDateTime + "5959";
  124. #else
  125. FStDateTime = FStDateTime + "00";
  126. FEdDateTime = FEdDateTime + "59";
  127. #endif
  128. FIdList = "";
  129. int nSelects = CMM_GetSelectCount(FRAMEDsrcList1->TvList, FRAMEDsrcList1->ColumnSel->Index, FRAMEDsrcList1->Column01->Index, FIdList);
  130. if (0 == nSelects)
  131. {
  132. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  133. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  134. FRAMEDsrcList1->CxList->SetFocus();
  135. return;
  136. }
  137. //String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  138. String sTitle = "[" + FStDateTime.SubString(1, 12) + " ~ " + FEdDateTime.SubString(1, 12) + "]";
  139. String CTYP = APP_GetCode(CbCTyp);
  140. String OBU_KIND = APP_GetCode(CbObuKind);
  141. try
  142. {
  143. Application->ProcessMessages();
  144. LockWindowUpdate(Handle);
  145. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  146. if (!pSheet) return;
  147. DSRH0601 = new TDSRH0601(this, Handle, FStDateTime, FEdDateTime, FIdList, CTYP, OBU_KIND);
  148. DSRH0601->Parent = pSheet;
  149. DSRH0601->Show();
  150. PgTab->ActivePage = pSheet;
  151. pSheet = PgTab->ActivePage;
  152. m_pFormList->Add(DSRH0601);
  153. }
  154. __finally
  155. {
  156. LockWindowUpdate(0);
  157. }
  158. }
  159. //---------------------------------------------------------------------------
  160. void __fastcall TDSRH060M::BtnCloseClick(TObject *Sender)
  161. {
  162. Close();
  163. }
  164. //---------------------------------------------------------------------------
  165. void __fastcall TDSRH060M::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 TDSRH060M::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 TDSRH060M::FormClose(TObject *Sender, TCloseAction &Action)
  189. {
  190. CommClose();
  191. DSRH060M = NULL;
  192. Action = caFree;
  193. }
  194. //---------------------------------------------------------------------------
  195. void __fastcall TDSRH060M::FormCloseQuery(TObject *Sender, bool &CanClose)
  196. {
  197. FRAMEDsrcList1->OnCloseQuery(CanClose);
  198. }
  199. //---------------------------------------------------------------------------
  200. void __fastcall TDSRH060M::InitCode()
  201. {
  202. TItsCode *FCodeRCT;
  203. TItsCode *FCodeOBU;
  204. FCodeRCT = ItsCodeManager->FLists.Find("RCT");
  205. FCodeOBU = ItsCodeManager->FLists.Find("OBU");
  206. // 차종
  207. CbCTyp->Properties->Items->Clear();
  208. CbCTyp->Properties->Items->Add(" [ALL] 전체");
  209. if (FCodeRCT)
  210. {
  211. FOR_STL(TItsSubCode *, pSubCode, FCodeRCT->FSubLists)
  212. {
  213. if (pSubCode->USE_YN == "N") continue;
  214. CbCTyp->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  215. }
  216. }
  217. CbCTyp->ItemIndex = 0;
  218. // OBU 종류
  219. CbObuKind->Properties->Items->Clear();
  220. CbObuKind->Properties->Items->Add(" [ALL] 전체");
  221. if (FCodeOBU)
  222. {
  223. FOR_STL(TItsSubCode *, pSubCode, FCodeOBU->FSubLists)
  224. {
  225. if (pSubCode->USE_YN == "N") continue;
  226. CbObuKind->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  227. }
  228. }
  229. CbObuKind->ItemIndex = 0;
  230. }
  231. //---------------------------------------------------------------------------
  232. void __fastcall TDSRH060M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  233. {
  234. int nActiveIdx = ATabIndex;
  235. if (nActiveIdx <= 0) return;
  236. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  237. m_pFormList->Delete(nActiveIdx);
  238. }
  239. //---------------------------------------------------------------------------