123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "ITSLangTransF.h"
- #pragma hdrstop
- #include "FRAME_VmsSchListF.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 "cxLabel"
- #pragma resource "*.dfm"
- //TFRAMEVmsSchList *FRAMEVmsSchList;
- //---------------------------------------------------------------------------
- __fastcall TFRAMEVmsSchList::TFRAMEVmsSchList(TComponent* Owner)
- : TFrame(Owner)
- {
- LangTrans->Translate(this, ITSDb_GetConnection());
- m_pGDC = TvList->DataController;
- //TvList->OptionsView->NoDataToDisplayInfoText = "<등록되어 있는 VMS 정보가 없습니다>";
- FTitle = lblTitle->Caption;
- FEN_DSPL_SCH_TYPE = enScheduleAuto;
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::UpdateList(String AVmsTypeCd)
- {
- CMM_ClearGridTableView(TvList);
- int nRow = 0;
- TvList->BeginUpdate();
- try
- {
- VmsCtlrManager->FLists.Lock();
- try
- {
- FOR_STL(TVmsCtlr*, pObj, VmsCtlrManager->FLists)
- {
- if (pObj->DEL_YN == "Y") continue;
- if (pObj->VMS_TYPE_CD != AVmsTypeCd) continue;
- nRow = m_pGDC->AppendRecord();
- PSCHEDULE_USAGE Use = &pObj->FormCnt[FEN_DSPL_SCH_TYPE];
- m_pGDC->Values[nRow][ColumnSel->Index] = false;
- m_pGDC->Values[nRow][Column00->Index] = "-";
- m_pGDC->Values[nRow][Column01->Index] = (pObj->VMS_CTLR_NMBR);
- m_pGDC->Values[nRow][Column02->Index] = pObj->VMS_CTLR_ID;
- m_pGDC->Values[nRow][Column03->Index] = pObj->VMS_NM;
- m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
- m_pGDC->Values[nRow][Column11->Index] = pObj->VMS_CTLR_NMBR.ToIntDef(0);
- m_pGDC->Values[nRow][Column12->Index] = pObj->VMS_CTLR_ID;
- int nTotal = 0;
- int nUse = 0;
- for (int ii = 0; ii < eSchTp_max; ii++)
- {
- String sColName;
- sColName.printf(L"Col%02d", ii);
- TcxGridColumn *pCol = (TcxGridColumn*)FindComponent(sColName);
- if (pCol) {
- m_pGDC->Values[nRow][pCol->Index] = String(Use->Use[ii]) + "/" + String(Use->Total[ii]);
- }
- nTotal += Use->Total[ii];
- nUse += Use->Use[ii];
- }
- m_pGDC->Values[nRow][ColAuto->Index] = String(nUse) + "/" + String(nTotal);
- m_pGDC->Values[nRow][ColFix->Index] = String(nUse) + "/" + String(nTotal);
- m_pGDC->Values[nRow][ColBase->Index] = String(nUse) + "/" + String(nTotal);
- }
- }
- __finally
- {
- VmsCtlrManager->FLists.UnLock();
- }
- }
- __finally
- {
- LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
- TvList->EndUpdate();
- TvList->DataController->GotoFirst();
- TvList->DataController->FocusedRecordIndex = 0;
- Column11->SortIndex = Column11->Index;
- Column11->SortOrder = soAscending;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::BtnAllSelectClick(TObject *Sender)
- {
- TcxButton *pBtn = (TcxButton*)Sender;
- CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
- }
- //---------------------------------------------------------------------------
- int __fastcall TFRAMEVmsSchList::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][Column01->Index]);
- ALinkIds = sLinkId;
- return 1;
- }
- //---------------------------------------------------------------------------
- int __fastcall TFRAMEVmsSchList::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[Column01->Index]);
- nSelCnt++;
- }
- }
- }
- __finally
- {
- TvList->EndUpdate();
- }
- return nSelCnt;
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::TvListDataControllerFilterChanged(TObject *Sender)
- {
- LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::BtnExlSaveClick(TObject *Sender)
- {
- TcxGrid *pGrid = CxList;
- TcxGridTableView *pView = TvList;
- String sTitle= FTitle;//"VMS정보";
- CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::OnCloseQuery(bool &CanClose)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::ColSchenarioGetDataText(TcxCustomGridTableItem *Sender,
- int ARecordIndex, UnicodeString &AText)
- {
- if (ARecordIndex < 0) return;
- int nIdx = Sender->Tag;
- try
- {
- int nMemPtr = (int)(TvList->DataController->Values[ARecordIndex][Column99->Index]);
- TVmsCtlr *pObj = (TVmsCtlr*)nMemPtr;
- if (pObj)
- {
- AText = String(pObj->FormCnt[FEN_DSPL_SCH_TYPE].Use[nIdx]) + "/" + String(pObj->FormCnt[FEN_DSPL_SCH_TYPE].Total[nIdx]);
- }
- } catch(Exception &e) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::Col06GetDataText(TcxCustomGridTableItem *Sender,
- int ARecordIndex, UnicodeString &AText)
- {
- if (ARecordIndex < 0) return;
- int nIdx = Sender->Tag;
- try
- {
- int nMemPtr = (int)(TvList->DataController->Values[ARecordIndex][Column99->Index]);
- TVmsCtlr *pObj = (TVmsCtlr*)nMemPtr;
- if (pObj)
- {
- int nTotal = 0;
- int nUse = 0;
- for (int ii = 0; ii < eSchTp_max; ii++)
- {
- nTotal += pObj->FormCnt[nIdx].Total[ii];
- nUse += pObj->FormCnt[nIdx].Use[ii];
- }
- AText = String(nUse) + "/" + String(nTotal);
- }
- } catch(Exception &e) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEVmsSchList::RefreshVmsFormUsage()
- {
- CxList->LayoutChanged();
- }
- //---------------------------------------------------------------------------
|