FRAME_VdsDtctListF.cpp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "FrmResourceF.h"
  6. #include "ITSLangTransF.h"
  7. #include "AppGlobalF.h"
  8. #include "ITS_OPLibF.h"
  9. #pragma hdrstop
  10. #include "FRAME_VdsDtctListF.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "cxButtons"
  14. #pragma link "cxCalc"
  15. #pragma link "cxCheckBox"
  16. #pragma link "cxClasses"
  17. #pragma link "cxContainer"
  18. #pragma link "cxControls"
  19. #pragma link "cxCustomData"
  20. #pragma link "cxData"
  21. #pragma link "cxDataStorage"
  22. #pragma link "cxEdit"
  23. #pragma link "cxFilter"
  24. #pragma link "cxGraphics"
  25. #pragma link "cxGrid"
  26. #pragma link "cxGridCustomTableView"
  27. #pragma link "cxGridCustomView"
  28. #pragma link "cxGridLevel"
  29. #pragma link "cxGridTableView"
  30. #pragma link "cxLookAndFeelPainters"
  31. #pragma link "cxLookAndFeels"
  32. #pragma link "cxStyles"
  33. #pragma link "cxTextEdit"
  34. #pragma link "dxSkinBlack"
  35. #pragma link "dxSkinBlue"
  36. #pragma link "dxSkinsCore"
  37. #pragma link "dxSkinscxPCPainter"
  38. #pragma link "cxLabel"
  39. #pragma link "cxDropDownEdit"
  40. #pragma link "cxMaskEdit"
  41. #pragma link "dxSkinMcSkin"
  42. #pragma resource "*.dfm"
  43. //TFRAMEVdsDtctList *FRAMEVdsDtctList;
  44. //---------------------------------------------------------------------------
  45. __fastcall TFRAMEVdsDtctList::TFRAMEVdsDtctList(TComponent* Owner)
  46. : TFrame(Owner)
  47. {
  48. LangTrans->Translate(this, ITSDb_GetConnection());
  49. ColumnSel->Options->Filtering = false;
  50. m_pGDC = TvList->DataController;
  51. TvList->OptionsView->GroupByBox = false;
  52. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<VDS 검지기 정보가 없습니다>";
  53. APP_FillCode(CbType, "DTT");
  54. APP_FillCode(Cb_DTCT_DIR, "VCD");
  55. }
  56. //---------------------------------------------------------------------------
  57. void __fastcall TFRAMEVdsDtctList::UpdateList(int AType/*=0*/)
  58. {
  59. CMM_ClearGridTableView(TvList);
  60. int nRow = 0;
  61. try
  62. {
  63. TvList->BeginUpdate();
  64. try
  65. {
  66. VdsCtlrManager->FLists.Lock();
  67. FOR_STL(TVdsCtlr*, pVds, VdsCtlrManager->FLists)
  68. {
  69. if (pVds->DEL_YN == "Y") continue;
  70. if (AType == 1 && pVds->VDS_TYPE_CD == "C") continue; //교차로감시제어기제외
  71. if (AType == 2 && pVds->VDS_TYPE_CD == "I") continue; //영상검지기제외
  72. FOR_STL(TVdsDtct*, pObj, pVds->FDtcts)
  73. {
  74. if (pObj->DEL_YN == "Y") continue;
  75. //if (pObj->USE_YN != "Y") continue;
  76. nRow = m_pGDC->AppendRecord();
  77. m_pGDC->Values[nRow][ColumnSel->Index] = false; //선택
  78. m_pGDC->Values[nRow][Column00->Index] = "-"; //편집
  79. m_pGDC->Values[nRow][Column01->Index] = pVds->VDS_CTLR_NMBR+"."+pVds->VDS_NM; //제어기 위치
  80. //m_pGDC->Values[nRow][Column01->Index] = pVds->VDS_CTLR_NMBR; //제어기 위치
  81. m_pGDC->Values[nRow][Column02->Index] = pObj->VDS_DTCT_NMBR; //검지기번호
  82. m_pGDC->Values[nRow][Column09->Index] = String(pObj->DETECT_LANE); //검지차로
  83. m_pGDC->Values[nRow][Column04->Index] = String(pObj->ISTL_LANE); //설치차로
  84. //m_pGDC->Values[nRow][Column05->Index] = pObj->VDS_DTCT_NM;
  85. if (pVds->VDS_TYPE_CD == "C")
  86. m_pGDC->Values[nRow][Column05->Index] = pObj->VDS_DTCT_NM;
  87. else
  88. m_pGDC->Values[nRow][Column05->Index] = pVds->VDS_NM;
  89. m_pGDC->Values[nRow][Column06->Index] = pObj->VDS_DTCT_ID;
  90. m_pGDC->Values[nRow][Column07->Index] = APP_GetCodeName(CbType, pObj->DTCT_TYPE);
  91. m_pGDC->Values[nRow][Column08->Index] = APP_GetCodeName(Cb_DTCT_DIR, pObj->DTCT_DIR);
  92. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  93. }
  94. }
  95. }
  96. __finally
  97. {
  98. VdsCtlrManager->FLists.UnLock();
  99. }
  100. }
  101. __finally
  102. {
  103. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  104. TvList->EndUpdate();
  105. TvList->DataController->GotoFirst();
  106. TvList->DataController->FocusedRecordIndex = 0;
  107. //CxList->SetFocus();
  108. CMM_ExpandCollapseChk(TvList, true);
  109. }
  110. }
  111. //---------------------------------------------------------------------------
  112. void __fastcall TFRAMEVdsDtctList::BtnAllSelectClick(TObject *Sender)
  113. {
  114. TcxButton *pBtn = (TcxButton*)Sender;
  115. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  116. }
  117. //---------------------------------------------------------------------------
  118. int __fastcall TFRAMEVdsDtctList::GetSelIds(String &ALinkIds)
  119. {
  120. ALinkIds = "";
  121. if (TvList->ViewData->RecordCount <= 0) return 0;
  122. int nIndex = m_pGDC->FocusedRecordIndex;
  123. if( nIndex < 0 )
  124. return 0;
  125. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column02->Index]);
  126. ALinkIds = sLinkId;
  127. return 1;
  128. }
  129. //---------------------------------------------------------------------------
  130. int __fastcall TFRAMEVdsDtctList::GetSelIds(TStringList *AStringList)
  131. {
  132. int nSelCnt = 0;
  133. try
  134. {
  135. TvList->BeginUpdate();
  136. int nRowCnt = TvList->ViewData->RecordCount;
  137. for (int ii = 0; ii < nRowCnt; ii++)
  138. {
  139. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  140. if (((bool)ARow->Values[ColumnSel->Index]))
  141. {
  142. AStringList->Add(ARow->Values[Column02->Index]);
  143. nSelCnt++;
  144. }
  145. }
  146. }
  147. __finally
  148. {
  149. TvList->EndUpdate();
  150. }
  151. return nSelCnt;
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TFRAMEVdsDtctList::TvListDataControllerFilterChanged(TObject *Sender)
  155. {
  156. CMM_SetFilterLike(TvList);
  157. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  158. }
  159. //---------------------------------------------------------------------------
  160. void __fastcall TFRAMEVdsDtctList::BtnExlSaveClick(TObject *Sender)
  161. {
  162. TcxGrid *pGrid = CxList;
  163. TcxGridTableView *pView = TvList;
  164. String sTitle= lblFileName->Caption;//"VDS검지기정보";
  165. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  166. }
  167. //---------------------------------------------------------------------------
  168. void __fastcall TFRAMEVdsDtctList::OnCloseQuery(bool &CanClose)
  169. {
  170. }
  171. //---------------------------------------------------------------------------
  172. void __fastcall TFRAMEVdsDtctList::ChkExpandClick(TObject *Sender)
  173. {
  174. CMM_ExpandCollapseChk(TvList, ChkExpand->Checked);
  175. }
  176. //---------------------------------------------------------------------------