FRAME_ParkingListF.cpp 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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_ParkingListF.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 "cxStyles"
  31. #pragma link "cxTextEdit"
  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. //TFRAMEParkingList *FRAMEParkingList;
  39. //---------------------------------------------------------------------------
  40. __fastcall TFRAMEParkingList::TFRAMEParkingList(TComponent* Owner)
  41. : TFrame(Owner)
  42. {
  43. LangTrans->Translate(this, ITSDb_GetConnection());
  44. ColumnSel->Options->Filtering = false;
  45. m_pGDC = TvList->DataController;
  46. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<주차장 정보가 없습니다>";
  47. FCodeOper = ItsCodeManager->FLists.Find("POT");
  48. FCodeType = ItsCodeManager->FLists.Find("PFT");
  49. }
  50. //---------------------------------------------------------------------------
  51. void __fastcall TFRAMEParkingList::UpdateList(bool ARealYn/*=false*/)
  52. {
  53. CMM_ClearGridTableView(TvList);
  54. int nRow = 0;
  55. try
  56. {
  57. TvList->BeginUpdate();
  58. TItsSubCode *pSubCode;
  59. try
  60. {
  61. PrkPlceManager->FLists.Lock();
  62. FOR_STL(TPrkPlce*, pObj, PrkPlceManager->FLists)
  63. {
  64. if (pObj->DEL_YN != "N") continue;
  65. nRow = m_pGDC->AppendRecord();
  66. m_pGDC->Values[nRow][ColumnSel->Index] = false; //선택
  67. m_pGDC->Values[nRow][Column00->Index] = "-"; //편집
  68. m_pGDC->Values[nRow][Column01->Index] = pObj->CTLR_NMBR;
  69. m_pGDC->Values[nRow][Column11->Index] = pObj->CTLR_ID;
  70. #if 0
  71. m_pGDC->Values[nRow][Column02->Index] = "";
  72. if (FCodeOper)
  73. {
  74. pSubCode = FCodeOper->FSubLists.Find(pObj->PRLT_OPER_DVSN_CD);
  75. if (pSubCode) m_pGDC->Values[nRow][Column02->Index] = pSubCode->CMMN_CD_KOR_NM;
  76. }
  77. m_pGDC->Values[nRow][Column03->Index] = "";
  78. if (FCodeType)
  79. {
  80. pSubCode = FCodeType->FSubLists.Find(pObj->PRLT_TYPE_DVSN_CD);
  81. if (pSubCode) m_pGDC->Values[nRow][Column03->Index] = pSubCode->CMMN_CD_KOR_NM;
  82. }
  83. #endif
  84. m_pGDC->Values[nRow][Column04->Index] = pObj->NAME;
  85. //m_pGDC->Values[nRow][Column05->Index] = pObj->VALD_YN == "Y" ? "사용" : "사용안함";
  86. #if 0
  87. m_pGDC->Values[nRow][Column06->Index] = pObj->PRLT_CTLR_IP;
  88. m_pGDC->Values[nRow][Column07->Index] = pObj->PRLT_CTLR_PORT;
  89. m_pGDC->Values[nRow][Column08->Index] = pObj->CTLR_CLCT_CYCL;
  90. m_pGDC->Values[nRow][Column09->Index] = pObj->CTLR_STTS_CYCL;
  91. m_pGDC->Values[nRow][Column10->Index] = pObj->WHOL_NPLS;
  92. #endif
  93. m_pGDC->Values[nRow][Column13->Index] = "사용";
  94. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  95. }
  96. }
  97. __finally
  98. {
  99. PrkPlceManager->FLists.UnLock();
  100. }
  101. }
  102. __finally
  103. {
  104. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  105. TvList->EndUpdate();
  106. TvList->DataController->GotoFirst();
  107. TvList->DataController->FocusedRecordIndex = 0;
  108. //CxList->SetFocus();
  109. }
  110. }
  111. //---------------------------------------------------------------------------
  112. void __fastcall TFRAMEParkingList::BtnAllSelectClick(TObject *Sender)
  113. {
  114. TcxButton *pBtn = (TcxButton*)Sender;
  115. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  116. }
  117. //---------------------------------------------------------------------------
  118. int __fastcall TFRAMEParkingList::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][Column01->Index]);
  126. ALinkIds = sLinkId;
  127. return 1;
  128. }
  129. //---------------------------------------------------------------------------
  130. int __fastcall TFRAMEParkingList::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[Column01->Index]);
  143. nSelCnt++;
  144. }
  145. }
  146. }
  147. __finally
  148. {
  149. TvList->EndUpdate();
  150. }
  151. return nSelCnt;
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TFRAMEParkingList::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 TFRAMEParkingList::BtnExlSaveClick(TObject *Sender)
  161. {
  162. TcxGrid *pGrid = CxList;
  163. TcxGridTableView *pView = TvList;
  164. String sTitle= "주차장정보";
  165. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  166. }
  167. //---------------------------------------------------------------------------
  168. void __fastcall TFRAMEParkingList::OnCloseQuery(bool &CanClose)
  169. {
  170. //
  171. }
  172. //---------------------------------------------------------------------------