//--------------------------------------------------------------------------- #include #include "AppGlobalF.h" #include "ITSSkinF.h" #include "ITSUtilF.h" #pragma hdrstop #include "FRAME_VmsStateListF.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 "dxSkinCaramel" #pragma link "dxSkinCoffee" #pragma link "dxSkinDarkRoom" #pragma link "dxSkinDarkSide" #pragma link "dxSkinFoggy" #pragma link "dxSkinGlassOceans" #pragma link "dxSkiniMaginary" #pragma link "dxSkinLilian" #pragma link "dxSkinLiquidSky" #pragma link "dxSkinLondonLiquidSky" #pragma link "dxSkinMcSkin" #pragma link "dxSkinMoneyTwins" #pragma link "dxSkinOffice2007Black" #pragma link "dxSkinOffice2007Blue" #pragma link "dxSkinOffice2007Green" #pragma link "dxSkinOffice2007Pink" #pragma link "dxSkinOffice2007Silver" #pragma link "dxSkinOffice2010Black" #pragma link "dxSkinOffice2010Blue" #pragma link "dxSkinOffice2010Silver" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma link "dxSkinSeven" #pragma link "dxSkinSharp" #pragma link "dxSkinSilver" #pragma link "dxSkinStardust" #pragma link "cxGridBandedTableView" #pragma link "cxSpinEdit" #pragma link "cxLabel" #pragma resource "*.dfm" //TFRAMEVmsStateList *FRAMEVmsStateList; //--------------------------------------------------------------------------- __fastcall TFRAMEVmsStateList::TFRAMEVmsStateList(TComponent* Owner) : TFrame(Owner) { m_pGDC = TvList->DataController; //TvList->OptionsView->NoDataToDisplayInfoText = ""; FTitle = lblTitle->Caption; } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::UpdateList() { CMM_ClearGridTableView(TvList); int ii, jj; int nCols = 0; TcxDataController *pGDC = TvList->DataController; TvList->BeginUpdate(); pGDC->BeginUpdate(); VmsCtlrManager->FLists.Lock(); try { int nRow; FOR_STL(TVmsCtlr*, pObj, VmsCtlrManager->FLists) { if (pObj->USE_YN != "Y") continue; nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColumnSel->Index] = false; pGDC->Values[nRow][Col01->Index] = pObj->VMS_CTLR_ID; pGDC->Values[nRow][Col02->Index] = pObj->VMS_CTLR_ID; pGDC->Values[nRow][Col03->Index] = pObj->VMS_NM; pGDC->Values[nRow][Col04->Index] = pObj->VMS_MODL_KIND_NM; #if 0 TVmsSize *pSize = VmsCtlrManager->FVmsSize.Find(pObj->VMS_MODL_KIND); if (pSize) pGDC->Values[nRow][Col05->Index] = pSize->TypeNm+" "; else pGDC->Values[nRow][Col05->Index] = "--?-- "; pGDC->Values[nRow][Col06->Index] = VmsOperMode(pObj); //pGDC->Values[nRow][Col33->Index] = pObj->VMS_PHSE_CHNG_CYCL; pGDC->Values[nRow][Col07->Index] = ITSUtil_FormatStr(pObj->VmsMsg->OFFER_DT, STR_DATETIME); pGDC->Values[nRow][Col08->Index] = String(pObj->VmsMsg->Total); pGDC->Values[nRow][Col09->Index] = pObj->VmsMsg->OFFER_YN ? "Y" : "N"; pGDC->Values[nRow][Col10->Index] = VmsComm(pObj); //Åë½Å»óÅ pGDC->Values[nRow][Col11->Index] = VmsModuleState(pObj); //¸ðµâ»óÅ pGDC->Values[nRow][Col12->Index] = VmsModulePower(pObj); //Àü¿ø»óÅ pGDC->Values[nRow][Col13->Index] = VmsModuleLuminance(pObj); //ÈÖµµ pGDC->Values[nRow][Col34->Index] = VmsModuleState(pObj); //Àü±¤ÆÇÁ¦¾î(ÄÑÁü/²¨Áü)»óÅ pGDC->Values[nRow][Col14->Index] = VmsModuleDoor(pObj); //µµ¾î pGDC->Values[nRow][Col15->Index] = VmsModuleFan(pObj); //ÆÒ pGDC->Values[nRow][Col16->Index] = VmsModuleHeater(pObj); //È÷ÅÍ pGDC->Values[nRow][Col17->Index] = VmsModuleTemp(pObj); //¿Âµµ pGDC->Values[nRow][Col18->Index] = String(pObj->STATE.ModuleOperatingTemperature); //¸ðµâÁ¤Áö¿Âµµ pGDC->Values[nRow][Col19->Index] = String(pObj->STATE.FanOperatingTemperature); //ÆÒµ¿Àۿµµ pGDC->Values[nRow][Col20->Index] = String(pObj->STATE.HeaterOperatingTemperature); //È÷Å͵¿Àۿµµ pGDC->Values[nRow][Col21->Index] = String(pObj->STATE.ModuleBasicFailureRate); //¸ðµâÀå¾ÖÀ² pGDC->Values[nRow][Col28->Index] = String(pObj->STATE.ScheduledMessageOperatingTime); //°èȹµÈ ¸Þ½ÃÁöÀÇ µ¿À۽ð£(ÃÊ) pGDC->Values[nRow][Col29->Index] = pObj->VMS_ON_HM; //Àü±¤ÆÇ ON pGDC->Values[nRow][Col30->Index] = pObj->VMS_OFF_HM; //Àü±¤ÆÇ OFF #endif pGDC->Values[nRow][Col99->Index] = (int)pObj; } } __finally { VmsCtlrManager->FLists.UnLock(); pGDC->EndUpdate(); TvList->EndUpdate(); //RefreshStatus(); } } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::RefreshStatus() { TcxDataController *pGDC = TvList->DataController; try { TvList->BeginUpdate(); pGDC->BeginUpdate(); int nRows = pGDC->RecordCount; for(int nRow = 0; nRow < nRows; nRow++) { int nMemPtr = TvList->DataController->Values[nRow][Col99->Index]; TVmsCtlr *pObj = (TVmsCtlr*)nMemPtr; if (!pObj) continue; #if 0 pGDC->Values[nRow][Col06->Index] = VmsOperMode(pObj); //pGDC->Values[nRow][Col33->Index] = pObj->VMS_PHSE_CHNG_CYCL; pGDC->Values[nRow][Col07->Index] = ITSUtil_FormatStr(pObj->VmsMsg->OFFER_DT, STR_DATETIME); pGDC->Values[nRow][Col08->Index] = String(pObj->VmsMsg->Total); pGDC->Values[nRow][Col09->Index] = pObj->VmsMsg->OFFER_YN ? "Y" : "N"; pGDC->Values[nRow][Col10->Index] = VmsComm(pObj); //Åë½Å»óÅ pGDC->Values[nRow][Col11->Index] = VmsModuleState(pObj); //¸ðµâ»óÅ pGDC->Values[nRow][Col12->Index] = VmsModulePower(pObj); //Àü¿ø»óÅ pGDC->Values[nRow][Col13->Index] = VmsModuleLuminance(pObj); //ÈÖµµ pGDC->Values[nRow][Col34->Index] = VmsModuleState(pObj); //Àü±¤ÆÇÁ¦¾î(ÄÑÁü/²¨Áü)»óÅ pGDC->Values[nRow][Col14->Index] = VmsModuleDoor(pObj); //µµ¾î pGDC->Values[nRow][Col15->Index] = VmsModuleFan(pObj); //ÆÒ pGDC->Values[nRow][Col16->Index] = VmsModuleHeater(pObj); //È÷ÅÍ pGDC->Values[nRow][Col17->Index] = VmsModuleTemp(pObj); //¿Âµµ pGDC->Values[nRow][Col18->Index] = String(pObj->STATE.ModuleOperatingTemperature); //¸ðµâÁ¤Áö¿Âµµ pGDC->Values[nRow][Col19->Index] = String(pObj->STATE.FanOperatingTemperature); //ÆÒµ¿Àۿµµ pGDC->Values[nRow][Col20->Index] = String(pObj->STATE.HeaterOperatingTemperature); //È÷Å͵¿Àۿµµ pGDC->Values[nRow][Col21->Index] = String(pObj->STATE.ModuleBasicFailureRate); //¸ðµâÀå¾ÖÀ² pGDC->Values[nRow][Col28->Index] = String(pObj->STATE.ScheduledMessageOperatingTime); //°èȹµÈ ¸Þ½ÃÁöÀÇ µ¿À۽ð£(ÃÊ) pGDC->Values[nRow][Col29->Index] = pObj->VMS_ON_HM; //Àü±¤ÆÇ ON pGDC->Values[nRow][Col30->Index] = pObj->VMS_OFF_HM; //Àü±¤ÆÇ OFF #endif } } __finally { pGDC->EndUpdate(); TvList->EndUpdate(); //CxList->LayoutChanged(); } #if 0 if (ARecordIndex < 0) return; int nMemPtr = TvList->DataController->Values[ARecordIndex][Col99->Index]; TVmsCtlr *pObj = (TVmsCtlr*)nMemPtr; if (!pObj) return; switch(Sender->Tag) { case 0: AText = VmsOperMode(pObj); break; case 1: AText = ITSUtil_FormatStr(pObj->VmsMsg->OFFER_DT, STR_DATETIME); break; case 2: AText = String(pObj->VmsMsg->Total); break; case 3: AText = pObj->VmsMsg->OFFER_YN ? "Y" : "N"; break; } #endif } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::BtnAllSelectClick(TObject *Sender) { TcxButton *pBtn = (TcxButton*)Sender; CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag); } //--------------------------------------------------------------------------- int __fastcall TFRAMEVmsStateList::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][Col01->Index]); ALinkIds = sLinkId; return 1; } //--------------------------------------------------------------------------- int __fastcall TFRAMEVmsStateList::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[Col01->Index]); nSelCnt++; } } } __finally { TvList->EndUpdate(); } return nSelCnt; } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::TvListDataControllerFilterChanged(TObject *Sender) { LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")"; } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::BtnExlSaveClick(TObject *Sender) { TcxGrid *pGrid = CxList; TcxGridTableView *pView = TvList; String sTitle= FTitle;//"VMS»óÅÂÁ¤º¸"; CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this); } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::OnCloseQuery(bool &CanClose) { } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::Col06CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { try { TColor tColor; String sVmsMode = AViewInfo->GridRecord->DisplayTexts[AViewInfo->Item->Index]; tColor = ACanvas->Brush->Color; if (sVmsMode == "ÀÚµ¿") tColor = clLime; else if (sVmsMode == "°íÁ¤") tColor = clFuchsia; else tColor = clYellow; ACanvas->SetBrushColor(tColor); ACanvas->Font->Color = clBlack; } catch(Exception &e) { } #if 0 int nRecordIdx = AViewInfo->GridRecord->RecordIndex; if (nRecordIdx >= 0) { int nIdx = AViewInfo->Item->Index; String sVmsMode = AViewInfo->GridRecord->DisplayTexts[nIdx]; if (sVmsMode == "°íÁ¤") ACanvas->Canvas->Brush->Color = clLime; } #endif } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::Col07CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { try { if (AViewInfo->GridRecord->RecordIndex < 0) return; String sResult = AViewInfo->GridRecord->DisplayTexts[Col09->Index]; if (sResult == "N") { ACanvas->Canvas->Brush->Color = clRed; } } catch(Exception &e) { } } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::Col10CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { try { TColor tColor; String sStatus = AViewInfo->GridRecord->DisplayTexts[AViewInfo->Item->Index]; tColor = ACanvas->Brush->Color; if (sStatus.Pos("-")) tColor = clGray; else if (sStatus.Pos("Àå¾Ö")) tColor = clRed; else if (sStatus.Pos("ÄÑÁü")) tColor = clYellow; else if (sStatus.Pos("¿­¸²")) tColor = clRed; else if (sStatus.Pos("µ¿ÀÛ")) tColor = clYellow; else if (sStatus.Pos("°¡µ¿")) tColor = clYellow; else tColor = clLime; ACanvas->SetBrushColor(tColor); ACanvas->Font->Color = clBlack; /*if (AViewInfo->GridRecord->Selected) { ACanvas->Font->Color = clBlack; }*/ } catch(Exception &e) { } } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::Col12CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { try { TColor tColor; String sStatus = AViewInfo->GridRecord->DisplayTexts[AViewInfo->Item->Index]; tColor = ACanvas->Brush->Color; if (sStatus.Pos("-")) tColor = clGray; else if (sStatus.Pos("Àå¾Ö")) tColor = clRed; else if (sStatus.Pos("ÄÑÁü")) tColor = clYellow; else if (sStatus.Pos("¿­¸²")) tColor = clRed; else if (sStatus.Pos("µ¿ÀÛ")) tColor = clYellow; else if (sStatus.Pos("°¡µ¿")) tColor = clYellow; else tColor = clLime; ACanvas->SetBrushColor(tColor); ACanvas->Font->Color = clBlack; /*if (AViewInfo->GridRecord->Selected) { ACanvas->Font->Color = clBlack; }*/ } catch(Exception &e) { } } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::Col34CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { try { TColor tColor; String sStatus = AViewInfo->GridRecord->DisplayTexts[AViewInfo->Item->Index]; tColor = ACanvas->Brush->Color; if (sStatus.Pos("-")) tColor = clGray; else if (sStatus.Pos("²¨Áü")) tColor = clRed; else tColor = clLime; ACanvas->SetBrushColor(tColor); ACanvas->Font->Color = clBlack; } catch(Exception &e) { } } //--------------------------------------------------------------------------- void __fastcall TFRAMEVmsStateList::Col17CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { try { TColor tBrush = ACanvas->Brush->Color; TColor tFont = ACanvas->Font->Color; String sValue = AViewInfo->GridRecord->DisplayTexts[AViewInfo->Item->Index]; if (sValue != "-" && sValue.ToIntDef(0) > g_AppCfg.Temp.AlarmValue) { tBrush = clFuchsia; tFont = clWhite; } ACanvas->SetBrushColor(tBrush); ACanvas->Font->Color = tFont; } catch(Exception &e) { } } //---------------------------------------------------------------------------