FRAME_BlackBoxListF.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "FrmResourceF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "FRAME_BlackBoxListF.h"
  9. //---------------------------------------------------------------------------
  10. #pragma package(smart_init)
  11. #pragma link "cxButtons"
  12. #pragma link "cxCalc"
  13. #pragma link "cxCheckBox"
  14. #pragma link "cxClasses"
  15. #pragma link "cxControls"
  16. #pragma link "cxCustomData"
  17. #pragma link "cxData"
  18. #pragma link "cxDataStorage"
  19. #pragma link "cxEdit"
  20. #pragma link "cxFilter"
  21. #pragma link "cxGraphics"
  22. #pragma link "cxGrid"
  23. #pragma link "cxGridCustomTableView"
  24. #pragma link "cxGridCustomView"
  25. #pragma link "cxGridLevel"
  26. #pragma link "cxGridTableView"
  27. #pragma link "cxLabel"
  28. #pragma link "cxLookAndFeelPainters"
  29. #pragma link "cxLookAndFeels"
  30. #pragma link "cxSpinEdit"
  31. #pragma link "cxStyles"
  32. #pragma link "cxTextEdit"
  33. #pragma link "dxSkinBlack"
  34. #pragma link "dxSkinBlue"
  35. #pragma link "dxSkinsCore"
  36. #pragma link "dxSkinscxPCPainter"
  37. #pragma resource "*.dfm"
  38. //TFRAMEBlackBoxList *FRAMEBlackBoxList;
  39. //---------------------------------------------------------------------------
  40. __fastcall TFRAMEBlackBoxList::TFRAMEBlackBoxList(TComponent* Owner)
  41. : TFrame(Owner)
  42. {
  43. ColumnSel->Options->Filtering = false;
  44. m_pGDC = TvList->DataController;
  45. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<단말기 정보가 없습니다>";
  46. //FCodeOper = ItsCodeManager->FLists.Find("POT");
  47. //FCodeType = ItsCodeManager->FLists.Find("PFT");
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TFRAMEBlackBoxList::UpdateList()
  51. {
  52. if (BlackBoxManager == NULL)
  53. {
  54. BlackBoxManager = new TBlackBoxManager();
  55. BlackBoxManager->LoadFromDb();
  56. }
  57. CMM_ClearGridTableView(TvList);
  58. int nRow = 0;
  59. try
  60. {
  61. TvList->BeginUpdate();
  62. try
  63. {
  64. BlackBoxManager->FLists.Lock();
  65. FOR_STL(TBlackBox*, pObj, BlackBoxManager->FLists)
  66. {
  67. if (pObj->MEM_DEL != "N") continue;
  68. nRow = m_pGDC->AppendRecord();
  69. m_pGDC->Values[nRow][ColumnSel->Index] = false; //선택
  70. m_pGDC->Values[nRow][Column00->Index] = "-"; //편집
  71. m_pGDC->Values[nRow][Column01->Index] = pObj->BDS_MNGM_NMBR;
  72. m_pGDC->Values[nRow][Column02->Index] = pObj->OPNC_NMBR;
  73. m_pGDC->Values[nRow][Column03->Index] = pObj->MDM_NMBR;
  74. m_pGDC->Values[nRow][Column04->Index] = pObj->USIM_NMBR;
  75. m_pGDC->Values[nRow][Column05->Index] = pObj->VHCL_NMBR;
  76. m_pGDC->Values[nRow][Column06->Index] = pObj->OWNR_NM;
  77. m_pGDC->Values[nRow][Column07->Index] = pObj->PRCT_NM;
  78. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  79. }
  80. }
  81. __finally
  82. {
  83. BlackBoxManager->FLists.UnLock();
  84. }
  85. }
  86. __finally
  87. {
  88. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  89. TvList->EndUpdate();
  90. TvList->DataController->GotoFirst();
  91. TvList->DataController->FocusedRecordIndex = 0;
  92. //CxList->SetFocus();
  93. }
  94. }
  95. //---------------------------------------------------------------------------
  96. void __fastcall TFRAMEBlackBoxList::BtnAllSelectClick(TObject *Sender)
  97. {
  98. TcxButton *pBtn = (TcxButton*)Sender;
  99. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  100. }
  101. //---------------------------------------------------------------------------
  102. int __fastcall TFRAMEBlackBoxList::GetSelIds(String &ALinkIds)
  103. {
  104. ALinkIds = "";
  105. if (TvList->ViewData->RecordCount <= 0) return 0;
  106. int nIndex = m_pGDC->FocusedRecordIndex;
  107. if( nIndex < 0 )
  108. return 0;
  109. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  110. ALinkIds = sLinkId;
  111. return 1;
  112. }
  113. //---------------------------------------------------------------------------
  114. int __fastcall TFRAMEBlackBoxList::GetSelIds(TStringList *AStringList)
  115. {
  116. int nSelCnt = 0;
  117. try
  118. {
  119. TvList->BeginUpdate();
  120. #if 0
  121. int nRowCnt = m_pGDC->RecordCount;
  122. for (int ii = 0; ii < nRowCnt; ii++)
  123. {
  124. if (((bool)m_pGDC->Values[ii][ColumnSel->Index]))
  125. {
  126. AStringList->Add(m_pGDC->Values[ii][Column00->Index]);
  127. nSelIdx++;
  128. }
  129. }
  130. #else
  131. int nRowCnt = TvList->ViewData->RecordCount;
  132. for (int ii = 0; ii < nRowCnt; ii++)
  133. {
  134. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  135. if (((bool)ARow->Values[ColumnSel->Index]))
  136. {
  137. AStringList->Add(ARow->Values[Column01->Index]);
  138. nSelCnt++;
  139. }
  140. }
  141. #endif
  142. }
  143. __finally
  144. {
  145. TvList->EndUpdate();
  146. }
  147. return nSelCnt;
  148. }
  149. //---------------------------------------------------------------------------
  150. void __fastcall TFRAMEBlackBoxList::TvListDataControllerFilterChanged(TObject *Sender)
  151. {
  152. CMM_SetFilterLike(TvList);
  153. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  154. }
  155. //---------------------------------------------------------------------------
  156. void __fastcall TFRAMEBlackBoxList::BtnExlSaveClick(TObject *Sender)
  157. {
  158. TcxGrid *pGrid = CxList;
  159. TcxGridTableView *pView = TvList;
  160. String sTitle= "블랙박스 단말기정보";
  161. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  162. }
  163. //---------------------------------------------------------------------------
  164. void __fastcall TFRAMEBlackBoxList::OnCloseQuery(bool &CanClose)
  165. {
  166. #if 0
  167. try {
  168. if (MyItsParkingManager)
  169. {
  170. delete MyItsParkingManager;
  171. MyItsParkingManager = NULL;
  172. }
  173. } catch(...) {}
  174. #endif
  175. }
  176. //---------------------------------------------------------------------------