FRAME_VmsListF.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "AppGlobalF.h"
  4. #pragma hdrstop
  5. #include "FRAME_VmsListF.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "cxButtons"
  9. #pragma link "cxCalc"
  10. #pragma link "cxCheckBox"
  11. #pragma link "cxClasses"
  12. #pragma link "cxContainer"
  13. #pragma link "cxControls"
  14. #pragma link "cxCustomData"
  15. #pragma link "cxData"
  16. #pragma link "cxDataStorage"
  17. #pragma link "cxDropDownEdit"
  18. #pragma link "cxEdit"
  19. #pragma link "cxFilter"
  20. #pragma link "cxGraphics"
  21. #pragma link "cxGrid"
  22. #pragma link "cxGridCustomTableView"
  23. #pragma link "cxGridCustomView"
  24. #pragma link "cxGridLevel"
  25. #pragma link "cxGridTableView"
  26. #pragma link "cxLookAndFeelPainters"
  27. #pragma link "cxLookAndFeels"
  28. #pragma link "cxMaskEdit"
  29. #pragma link "cxStyles"
  30. #pragma link "cxTextEdit"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinscxPCPainter"
  33. #pragma resource "*.dfm"
  34. //TFRAMEVmsList *FRAMEVmsList;
  35. //---------------------------------------------------------------------------
  36. __fastcall TFRAMEVmsList::TFRAMEVmsList(TComponent* Owner)
  37. : TFrame(Owner)
  38. {
  39. m_pGDC = TvList->DataController;
  40. TvList->OptionsView->NoDataToDisplayInfoText = "<VMS Á¤º¸°¡ ¾ø½À´Ï´Ù>";
  41. Column05->Visible = false;
  42. Column06->Visible = false;
  43. Column07->Visible = false;
  44. Column08->Visible = false;
  45. Column09->Visible = false;
  46. Column10->Visible = false;
  47. Column11->Visible = false;
  48. Column13->Visible = false;
  49. APP_FillCode(CbUsagType, "VUT");
  50. APP_FillCode(CbType, "VMP");
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TFRAMEVmsList::UpdateList()
  54. {
  55. CMM_ClearGridTableView(TvList);
  56. int nRow = 0;
  57. try
  58. {
  59. TvList->BeginUpdate();
  60. try
  61. {
  62. VmsManager->FLists.Lock();
  63. FOR_STL(TVmsCtlr*, pObj, VmsManager->FLists)
  64. {
  65. if (pObj->DEL_YN == "Y") continue;
  66. nRow = m_pGDC->AppendRecord();
  67. m_pGDC->Values[nRow][ColumnSel->Index] = false;
  68. m_pGDC->Values[nRow][Column00->Index] = "-";
  69. m_pGDC->Values[nRow][Column01->Index] = String(pObj->VMS_CTLR_NMBR);
  70. m_pGDC->Values[nRow][Column02->Index] = pObj->VMS_CTLR_ID;
  71. m_pGDC->Values[nRow][Column03->Index] = pObj->VMS_NM;
  72. m_pGDC->Values[nRow][Column04->Index] = APP_GetCodeName(CbUsagType, pObj->VMS_USAG_TYPE_CD);
  73. m_pGDC->Values[nRow][Column05->Index] = APP_GetCodeName(CbType, pObj->VMS_TYPE_CD);
  74. #if 0
  75. EdWebCamPort->Text = AObj->WEB_CMRA_PORT;
  76. EdWebCamId->Text = AObj->WEB_CMRA_ID;
  77. EdWebCamPswd->Text = AObj->WEB_CMRA_PWD;
  78. EdWebCamStrm->Text = AObj->STRM_SESN_NM;
  79. #endif
  80. m_pGDC->Values[nRow][Column06->Index] = pObj->VMS_CTLR_IP;
  81. m_pGDC->Values[nRow][Column07->Index] = pObj->VMS_CMNC_PORT;
  82. m_pGDC->Values[nRow][Column08->Index] = pObj->PANL_ON_TIME;
  83. m_pGDC->Values[nRow][Column09->Index] = pObj->PANL_OFF_TIME;
  84. m_pGDC->Values[nRow][Column10->Index] = pObj->WEB_CMRA_IP;
  85. m_pGDC->Values[nRow][Column13->Index] = pObj->VMS_MAX_PHSE_NUM;
  86. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  87. m_pGDC->Values[nRow][Column11->Index] = pObj->VMS_CTLR_NMBR;
  88. m_pGDC->Values[nRow][Column12->Index] = pObj->VMS_CTLR_ID;
  89. }
  90. }
  91. __finally
  92. {
  93. VmsManager->FLists.UnLock();
  94. }
  95. }
  96. __finally
  97. {
  98. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  99. TvList->EndUpdate();
  100. TvList->DataController->GotoFirst();
  101. TvList->DataController->FocusedRecordIndex = 0;
  102. Column11->SortIndex = Column11->Index;
  103. Column11->SortOrder = soAscending;
  104. }
  105. }
  106. //---------------------------------------------------------------------------
  107. void __fastcall TFRAMEVmsList::BtnAllSelectClick(TObject *Sender)
  108. {
  109. TcxButton *pBtn = (TcxButton*)Sender;
  110. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  111. }
  112. //---------------------------------------------------------------------------
  113. int __fastcall TFRAMEVmsList::GetSelIds(String &ALinkIds)
  114. {
  115. ALinkIds = "";
  116. if (TvList->ViewData->RecordCount <= 0) return 0;
  117. int nIndex = m_pGDC->FocusedRecordIndex;
  118. if( nIndex < 0 )
  119. return 0;
  120. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  121. ALinkIds = sLinkId;
  122. return 1;
  123. }
  124. //---------------------------------------------------------------------------
  125. int __fastcall TFRAMEVmsList::GetSelIds(TStringList *AStringList)
  126. {
  127. int nSelCnt = 0;
  128. try
  129. {
  130. TvList->BeginUpdate();
  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. }
  142. __finally
  143. {
  144. TvList->EndUpdate();
  145. }
  146. return nSelCnt;
  147. }
  148. //---------------------------------------------------------------------------
  149. void __fastcall TFRAMEVmsList::TvListDataControllerFilterChanged(TObject *Sender)
  150. {
  151. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TFRAMEVmsList::BtnExlSaveClick(TObject *Sender)
  155. {
  156. TcxGrid *pGrid = CxList;
  157. TcxGridTableView *pView = TvList;
  158. String sTitle= "VMSÁ¤º¸";
  159. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  160. }
  161. //---------------------------------------------------------------------------
  162. void __fastcall TFRAMEVmsList::OnCloseQuery(bool &CanClose)
  163. {
  164. }
  165. //---------------------------------------------------------------------------