//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "FrmResourceF.h" #include "ITSLangTransF.h" #include "ITS_OPLibF.h" #pragma hdrstop #include "FRAME_VdsDtctListF.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxCalc" #pragma link "cxCheckBox" #pragma link "cxClasses" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxCustomData" #pragma link "cxData" #pragma link "cxDataStorage" #pragma link "cxEdit" #pragma link "cxFilter" #pragma link "cxGraphics" #pragma link "cxGrid" #pragma link "cxGridCustomTableView" #pragma link "cxGridCustomView" #pragma link "cxGridLevel" #pragma link "cxGridTableView" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxStyles" #pragma link "cxTextEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma link "cxLabel" #pragma link "cxDropDownEdit" #pragma link "cxMaskEdit" #pragma link "dxSkinMcSkin" #pragma resource "*.dfm" //TFRAMEVdsDtctList *FRAMEVdsDtctList; //--------------------------------------------------------------------------- __fastcall TFRAMEVdsDtctList::TFRAMEVdsDtctList(TComponent* Owner) : TFrame(Owner) { LangTrans->Translate(this, ITSDb_GetConnection()); ColumnSel->Options->Filtering = false; m_pGDC = TvList->DataController; TvList->OptionsView->GroupByBox = false; TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//""; APP_FillCode(CbType, "DTT"); APP_FillCode(Cb_DTCT_DIR, "VCD"); } //--------------------------------------------------------------------------- void __fastcall TFRAMEVdsDtctList::UpdateList(int AType/*=0*/) { CMM_ClearGridTableView(TvList); int nRow = 0; try { TvList->BeginUpdate(); try { VdsCtlrManager->FLists.Lock(); FOR_STL(TVdsCtlr*, pVds, VdsCtlrManager->FLists) { if (pVds->DEL_YN == "Y") continue; if (AType == 1 && pVds->TYPE_CD == "C") continue; //±³Â÷·Î°¨½ÃÁ¦¾î±âÁ¦¿Ü if (AType == 2 && pVds->TYPE_CD == "I") continue; //¿µ»ó°ËÁö±âÁ¦¿Ü FOR_STL(TVdsDtct*, pObj, pVds->FDtcts) { if (pObj->DEL_YN == "Y") continue; //if (pObj->USE_YN != "Y") continue; nRow = m_pGDC->AppendRecord(); m_pGDC->Values[nRow][ColumnSel->Index] = false; //¼±Åà m_pGDC->Values[nRow][Column00->Index] = "-"; //ÆíÁý m_pGDC->Values[nRow][Column01->Index] = pVds->CTLR_NMBR+"."+pVds->NAME; //Á¦¾î±â À§Ä¡ //m_pGDC->Values[nRow][Column01->Index] = pVds->VDS_CTLR_NMBR; //Á¦¾î±â À§Ä¡ m_pGDC->Values[nRow][Column02->Index] = pObj->VDS_DTCT_NMBR; //°ËÁö±â¹øÈ£ m_pGDC->Values[nRow][Column09->Index] = String(pObj->DETECT_LANE); //°ËÁöÂ÷·Î m_pGDC->Values[nRow][Column04->Index] = String(pObj->ISTL_LANE); //¼³Ä¡Â÷·Î //m_pGDC->Values[nRow][Column05->Index] = pObj->VDS_DTCT_NM; if (pVds->TYPE_CD == "C") m_pGDC->Values[nRow][Column05->Index] = pObj->VDS_DTCT_NM; else m_pGDC->Values[nRow][Column05->Index] = pVds->NAME; m_pGDC->Values[nRow][Column06->Index] = pObj->VDS_DTCT_ID; m_pGDC->Values[nRow][Column07->Index] = APP_GetCodeName(CbType, pObj->DTCT_TYPE); m_pGDC->Values[nRow][Column08->Index] = APP_GetCodeName(Cb_DTCT_DIR, pObj->DTCT_DIR); m_pGDC->Values[nRow][Column99->Index] = (int)pObj; } } } __finally { VdsCtlrManager->FLists.UnLock(); } } __finally { LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")"; TvList->EndUpdate(); TvList->DataController->GotoFirst(); TvList->DataController->FocusedRecordIndex = 0; //CxList->SetFocus(); CMM_ExpandCollapseChk(TvList, true); } } //--------------------------------------------------------------------------- void __fastcall TFRAMEVdsDtctList::BtnAllSelectClick(TObject *Sender) { TcxButton *pBtn = (TcxButton*)Sender; CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag); } //--------------------------------------------------------------------------- int __fastcall TFRAMEVdsDtctList::GetSelIds(String &ALinkIds) { ALinkIds = ""; if (TvList->ViewData->RecordCount <= 0) return 0; int nIndex = m_pGDC->FocusedRecordIndex; if( nIndex < 0 ) return 0; String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column02->Index]); ALinkIds = sLinkId; return 1; } //--------------------------------------------------------------------------- int __fastcall TFRAMEVdsDtctList::GetSelIds(TStringList *AStringList) { int nSelCnt = 0; try { TvList->BeginUpdate(); int nRowCnt = TvList->ViewData->RecordCount; for (int ii = 0; ii < nRowCnt; ii++) { TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii]; if (((bool)ARow->Values[ColumnSel->Index])) { AStringList->Add(ARow->Values[Column02->Index]); nSelCnt++; } } } __finally { TvList->EndUpdate(); } return nSelCnt; } //--------------------------------------------------------------------------- void __fastcall TFRAMEVdsDtctList::TvListDataControllerFilterChanged(TObject *Sender) { CMM_SetFilterLike(TvList); LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")"; } //--------------------------------------------------------------------------- void __fastcall TFRAMEVdsDtctList::BtnExlSaveClick(TObject *Sender) { TcxGrid *pGrid = CxList; TcxGridTableView *pView = TvList; String sTitle= lblFileName->Caption;//"VDS°ËÁö±âÁ¤º¸"; CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this); } //--------------------------------------------------------------------------- void __fastcall TFRAMEVdsDtctList::OnCloseQuery(bool &CanClose) { } //--------------------------------------------------------------------------- void __fastcall TFRAMEVdsDtctList::ChkExpandClick(TObject *Sender) { CMM_ExpandCollapseChk(TvList, ChkExpand->Checked); } //---------------------------------------------------------------------------