FRAME_VdsDtctListF.cpp 6.8 KB

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