123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815 |
- /****************************************************************************
- * @source :
- * @description :
- ****************************************************************************
- * DATE AUTHOR DESCRIPTION
- * --------------------------------------------------------------------------
- * 2016/07/10 shjung 최초작성
- *
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "AppGlobalF.h"
- #include "CDSVmsIfscF.h"
- #include "ITSLangTransF.h"
- #pragma hdrstop
- #include "VMSM800MF.h"
- #include "VMSSEL0MF.h"
- #include "VMSEDT0MF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtons"
- #pragma link "cxCalendar"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxDropDownEdit"
- #pragma link "cxEdit"
- #pragma link "cxGraphics"
- #pragma link "cxGroupBox"
- #pragma link "cxLabel"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxMaskEdit"
- #pragma link "cxPC"
- #pragma link "cxPCdxBarPopupMenu"
- #pragma link "cxSpinEdit"
- #pragma link "cxSplitter"
- #pragma link "cxTextEdit"
- #pragma link "cxTimeEdit"
- #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 "cxRadioGroup"
- #pragma link "cxClasses"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxDBData"
- #pragma link "cxFilter"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridDBTableView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxStyles"
- #pragma link "cxCheckBox"
- #pragma link "cxImage"
- #pragma link "cxButtonEdit"
- #pragma link "cxBlobEdit"
- #pragma link "cxColorComboBox"
- #pragma link "cxCalc"
- #pragma link "VmsDesignerF"
- #pragma link "FRAME_VmsSchListF"
- #pragma resource "*.dfm"
- TVMSM800M *VMSM800M = NULL;
- //---------------------------------------------------------------------------
- __fastcall TVMSM800M::TVMSM800M(TComponent* Owner)
- : TForm(Owner)
- {
- LangTrans->Translate(this, ITSDb_GetConnection());
- ITSSkin_Load(this);
- CMM_LoadForm(g_sFormsDir, this);
- FUpdate= false;
- FTitle = Caption;//"VMS 기본 스케줄 관리";
- FListSymb = new TList;
- EditMode = false;
- APP_InitDisplayColor();
- PgVmsSch->Properties->ActivePage = TabFixed;
- PgVmsSch->Properties->HideTabs = true;
- LblInfo1->Height = 25;
- FRAMEVmsSchList1->PnlTop->Visible = false;
- FRAMEVmsSchList1->PnlBottom->Visible = false;
- FRAMEVmsSchList1->Col09->Visible = false;
- FRAMEVmsSchList1->Col10->Visible = false;
- FRAMEVmsSchList1->Col11->Visible = true;
- FVmsHeight = 64;
- FListSch[0] = NULL;
- FListSch[1] = NULL;
- FListSch[2] = NULL;
- FListSch[3] = NULL;
- FListSch[4] = NULL;
- FListSch[5] = NULL;
- FListSch[6] = TvGrid6;
- FListSch[7] = NULL;
- FListFrm[0] = NULL;
- FListFrm[1] = NULL;
- FListFrm[2] = NULL;
- FListFrm[3] = NULL;
- FListFrm[4] = NULL;
- FListFrm[5] = NULL;
- FListFrm[6] = TvForm6;
- FListFrm[7] = NULL;
- for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
- {
- if (FListSch[ii]) InitTcxList(FListSch[ii]);
- if (FListFrm[ii]) InitTcxList(FListFrm[ii]);
- }
- //BtnSave->Caption = "Save Schedule";
- //BtnSave->Hint = "Save scheduled tasks for the currently selected VMS";
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::InitTcxList(TcxGridTableView *AView)
- {
- AView->OptionsView->DataRowHeight = 0;
- AView->OptionsView->CellAutoHeight = true;
- AView->OptionsView->Indicator = false;
- AView->OptionsCustomize->ColumnMoving = false;
- AView->OptionsCustomize->ColumnSorting = false;
- AView->Columns[0]->Width = 40;
- AView->Columns[0]->Options->HorzSizing = false;
- AView->Columns[1]->Width = 330;
- }
- //---------------------------------------------------------------------------
- /*
- * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
- * Form과 DataModule class를 delete시킨다.
- * arguments
- *
- * return
- * void
- */
- void __fastcall TVMSM800M::CommClose()
- {
- try
- {
- APP_DelVmsSizeCombo(CbSizeType);
- ClearSymbloList();
- SAFE_DELETE(FListSymb);
- CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::FormCreate(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- /*
- * Form을 보여줄때 호출되는 event 메서드이다.
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TVMSM800M::FormShow(TObject *Sender)
- {
- Refresh();
- FormInit();
- ChangeEditMode(1);
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- /*
- * form 초기화
- *
- * arguments
- *
- * return
- * void
- */
- void __fastcall TVMSM800M::FormInit()
- {
- for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
- {
- if (FListSch[ii]) FListSch[ii]->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoSchedule->Caption;//"<등록되어 있는 스케줄 정보가 없습니다>";
- if (FListFrm[ii]) FListFrm[ii]->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoForm->Caption;//"<등록되어 있는 폼 정보가 없습니다>";
- }
- //VMS사이즈
- APP_FillVmsSizeType(CbSizeType, "VUTN", false);
- VmsManager->LoadVmsFormUsage();
- FRAMEVmsSchList1->RefreshVmsFormUsage();
- FNewDb = false;
- }
- //---------------------------------------------------------------------------
- /*
- * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TVMSM800M::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- }
- //---------------------------------------------------------------------------
- /*
- * Close 버튼 클릭 이벤트 핸들러
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TVMSM800M::BtnCloseClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- CommClose();
- VMSM800M = NULL;
- Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::FormCloseQuery(TObject *Sender, bool &CanClose)
- {
- if (FUpdate)
- {
- POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_14, 0);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::ChangeEditMode(int AEdit)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::ClearSymbloList()
- {
- for(int ii = 0; ii < FListSymb->Count; ii++)
- {
- Graphics::TBitmap *bitmap = (Graphics::TBitmap *)FListSymb->Items[ii];
- delete bitmap;
- }
- FListSymb->Clear();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::FRAMEVmsSchList1TvListCellDblClick(TcxCustomGridTableView *Sender,
- TcxGridTableDataCellViewInfo *ACellViewInfo, TMouseButton AButton,
- TShiftState AShift, bool &AHandled)
- {
- if (!ACellViewInfo) return;
- DisplayInfo();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::FRAMEVmsSchList1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender,
- TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord,
- bool ANewItemRecordFocusingChanged)
- {
- if (!AFocusedRecord) return;
- DisplayInfo();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::CbSizeTypePropertiesChange(TObject *Sender)
- {
- BtnSearchClick(NULL);
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::BtnSearchClick(TObject *Sender)
- {
- RefreshData();
- EdFocus->SetFocus();
- ChangeEditMode(1);
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::RefreshData()
- {
- FormClear();
- TVmsSizeType *pVmsSizeType = APP_GetVmsSizeTypeObject(CbSizeType);
- if (pVmsSizeType == NULL) return;
- FVmsTypeCd = pVmsSizeType->TypeCd;
- FVmsWidth = pVmsSizeType->Width;
- FVmsHeight = pVmsSizeType->Height;
- FRAMEVmsSchList1->UpdateList(FVmsTypeCd);
- LoadVmsFormList(FVmsTypeCd);
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::FormClear()
- {
- FSelIdx = -1;
- EdVmsNmbr->Clear();
- for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
- {
- if (FListSch[ii]) CMM_ClearGridTableView(FListSch[ii]);
- }
- GrpSchedule->Caption = lblTitle->Caption;//"▶ 기본 스케줄 설정";
- FNewDb = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::DisplayInfo()
- {
- FormClear();
- FSelIdx = CMM_GetRecordIndex(FRAMEVmsSchList1->TvList);
- if (FSelIdx < 0) return;
- TcxDataController *pGDC = FRAMEVmsSchList1->TvList->DataController;
- String sVmsNmbr = VarToStr(pGDC->Values[FSelIdx][FRAMEVmsSchList1->Column01->Index]);
- EdVmsNmbr->Text = sVmsNmbr;
- GrpSchedule->Caption = lblTitle->Caption + " (" + VarToStr(pGDC->Values[FSelIdx][FRAMEVmsSchList1->Column02->Index]) + ": " + VarToStr(pGDC->Values[FSelIdx][FRAMEVmsSchList1->Column03->Index]) + ")";
- LoadVmsScheduleInfo(sVmsNmbr);
- ChangeEditMode(3);
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::TvFormCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift,
- bool &AHandled)
- {
- if (!ACellViewInfo) return;
- int nRow = Sender->DataController->FocusedRecordIndex;
- if( nRow <= -1 )
- return;
- TcxButton *pBtn = NULL;
- switch(Sender->Tag)
- {
- case enFormBase: pBtn = BtnListAdd6; break;
- default: return;
- }
- BtnListAddClick((TObject*)pBtn);
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::BtnListAddClick(TObject *Sender)
- {
- String sUse = "Y";
- String sTime= "4";
- TcxButton *pBtn = (TcxButton*)Sender;
- int nTag = pBtn->Tag;
- if (nTag < 0 || nTag >= MAX_FORM_SCHED) return;
- int nSelIdx = CMM_GetRecordIndex(FRAMEVmsSchList1->TvList);
- if (nSelIdx < 0) return;
- if (!FListFrm[nTag] || !FListSch[nTag]) return;
- TcxGridDataController *pDcFrm = FListFrm[nTag]->DataController;
- TcxGridDataController *pDcSch = FListSch[nTag]->DataController;
- int nFormIdx = CMM_GetRecordIndex(FListFrm[nTag]);
- if (nFormIdx < 0) return;
- if (nTag == enFormTraffic)
- {
- sUse = "N";
- }
- String sStrDate = "";
- String sEndDate = "";
- bool bSelected= false;
- TVMSSEL0M *pSelDate = new TVMSSEL0M(this);
- pSelDate->ShowModal();
- bSelected = pSelDate->FSelected;
- sStrDate = pSelDate->FStrTime;
- sEndDate = pSelDate->FEndTime;
- delete pSelDate;
- pSelDate = NULL;
- if (!bSelected) return;
- int nRow = pDcSch->AppendRecord();
- pDcSch->Values[nRow][0] = pDcFrm->Values[nFormIdx][0];
- pDcSch->Values[nRow][1] = pDcFrm->Values[nFormIdx][1];
- pDcSch->Values[nRow][3] = sTime;
- pDcSch->Values[nRow][4] = ITSUtil_FormatStr(sStrDate, STR_HHNN);;
- pDcSch->Values[nRow][5] = ITSUtil_FormatStr(sEndDate, STR_HHNN);;
- pDcSch->Values[nRow][6] = sUse;
- pDcSch->Values[nRow][7] = sStrDate;
- pDcSch->Values[nRow][8] = sEndDate;
- pDcSch->Values[nRow][15] = pDcFrm->Values[nFormIdx][2];
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::BtnListDeleteClick(TObject *Sender)
- {
- TcxButton *pBtn = (TcxButton*)Sender;
- int nTag = pBtn->Tag;
- if (nTag >= MAX_FORM_SCHED) return;
- int nSelIdx = CMM_GetRecordIndex(FRAMEVmsSchList1->TvList);
- if (nSelIdx < 0) return;
- if (!FListSch[nTag]) return;
- TcxGridDataController *pDcSch = FListSch[nTag]->DataController;
- nSelIdx = CMM_GetRecordIndex(FListSch[nTag]);
- if (nSelIdx < 0) return;
- FListSch[nTag]->DataController->DeleteRecord(nSelIdx);
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::TvGridCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift,
- bool &AHandled)
- {
- if (!ACellViewInfo) return;
- int nRow = Sender->DataController->FocusedRecordIndex;
- if( nRow <= -1 )
- return;
- TcxGridDataController *pGDC = (TcxGridDataController*)Sender->DataController;
- int nColIdx = ACellViewInfo->Item->Index;
- //ShowMessage(String(Sender->Tag) + " " + String(nColIdx));
- String sFormId = VarToStr(pGDC->Values[nRow][0]);
- String sStrDate = VarToStr(pGDC->Values[nRow][7]);
- String sEndDate = VarToStr(pGDC->Values[nRow][8]);
- if (nColIdx == 4 || nColIdx == 5)
- {
- //표출기간설정
- TVMSSEL0M *pSelDate = new TVMSSEL0M(this);
- pSelDate->FStrTime = sStrDate;
- pSelDate->FEndTime = sEndDate;
- pSelDate->ShowModal();
- bool bSelected = pSelDate->FSelected;
- sStrDate = pSelDate->FStrTime;
- sEndDate = pSelDate->FEndTime;
- delete pSelDate;
- pSelDate = NULL;
- if (bSelected)
- {
- pGDC->Values[nRow][4] = ITSUtil_FormatStr(sStrDate, STR_HHNN);;
- pGDC->Values[nRow][5] = ITSUtil_FormatStr(sEndDate, STR_HHNN);;
- pGDC->Values[nRow][7] = sStrDate;
- pGDC->Values[nRow][8] = sEndDate;
- }
- return;
- }
- if (Sender->Tag != enFormTraffic) return;
- if (VarToStr(pGDC->Values[nRow][15]).ToIntDef(0) == 15)
- {
- //도형식배경 소통정보 폼
- Application->MessageBox(FrmLang->lblSchErr1->Caption.c_str(),//L"VMS 교통정보 폼 구간 설정\r\n도형식 배경소통정보 폼은 폼관리 화면에서 설정 가능합니다.",
- FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::BtnAllEditClick(TObject *Sender)
- {
- TcxButton *pBtn = (TcxButton*)Sender;
- //등록되어 있는 스케줄 폼을 전체 VMS에 편집하는 기능
- int nTag = PgVmsSch->Properties->ActivePage->Tag;
- if (nTag < 0 || nTag >= MAX_FORM_SCHED)
- {
- Application->MessageBox(FrmLang->lblRegErr1->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\n알수 없는 스케줄 유형입니다.",
- FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- if (!FListSch[nTag]) return;
- TcxGridTableView *pTvList = FListSch[nTag];
- TcxGridDataController *pGDC;
- String sMode = "E";
- if (pBtn->Tag == 1)
- {
- sMode = "A"; //추가
- pTvList = FListFrm[nTag];
- }
- if (!pTvList) return;
- pGDC = pTvList->DataController;
- int nFormIdx = CMM_GetRecordIndex(pTvList);
- if (nFormIdx < 0)
- {
- Application->MessageBox(FrmLang->lblRegErr2->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\n등록되어 있는 스케줄 폼을 목록에서 먼저 선택하세요.",
- FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- String sFormId = pGDC->Values[nFormIdx][0];
- TVmsSizeType *pVmsSizeType = APP_GetVmsSizeTypeObject(CbSizeType);
- if (pVmsSizeType == NULL)
- {
- Application->MessageBox(FrmLang->lblRegErr3->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\nVMS 유형을 알수 없습니다. VMS 크기 유형을 먼저 선택하세요.",
- FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- String sVmsType = pVmsSizeType->TypeCd;
- TVMSEDT0M *pFrmEdt = new TVMSEDT0M(this);
- pFrmEdt->FVmsTypeCd = sVmsType;
- pFrmEdt->FScheType = String(nTag);
- pFrmEdt->FFormId = sFormId;
- pFrmEdt->FMode = sMode;
- pFrmEdt->FVmsNmbr = "";
- pFrmEdt->ShowModal();
- bool bOk = pFrmEdt->FSelected;
- delete pFrmEdt;
- pFrmEdt = NULL;
- if (bOk)
- {
- DisplayInfo();
- }
- VmsManager->LoadVmsFormUsage();
- FRAMEVmsSchList1->RefreshVmsFormUsage();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSM800M::BtnSaveClick(TObject *Sender)
- {
- //작업한 스케줄 정보를 저장한다.
- if (EdVmsNmbr->Text.Trim().IsEmpty())
- {
- Application->MessageBox(lblErr2->Caption.c_str(),//L"VMS 기본 스케줄 관리\r\nVMS 목록에서 VMS를 먼저 선택한 후 작업을 진행하세요.",
- FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- bool bUpdate = true;
- String sVmsNmbr = EdVmsNmbr->Text.Trim();
- if (bUpdate)
- {
- String sMsg;
- sMsg = "VMS: " + sVmsNmbr;
- sMsg+= "\r\n" + lblErr3->Caption;//선택한 VMS의 기본 스케줄 정보를 저장하시겠습니까?";
- if (Application->MessageBox(sMsg.c_str(), FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
- }
- try
- {
- ITSDb_GetConnection()->BeginTrans();
- DeleteVmsFixedScenario(sVmsNmbr);
- for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
- {
- if (FListSch[ii]) SaveVmsFixedScenario(sVmsNmbr, FListSch[ii]);
- }
- }
- __finally
- {
- ITSDb_GetConnection()->CommitTrans();
- }
- Application->MessageBox(lblErr2->Caption.c_str(),//L"VMS 기본 스케줄 관리\r\nVMS 기본 스케줄 정보를 저장 하였습니다.",
- FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
- VmsManager->LoadVmsFormUsage();
- FRAMEVmsSchList1->RefreshVmsFormUsage();
- CMM_SetGridRow(FRAMEVmsSchList1->CxList, FRAMEVmsSchList1->TvList, sVmsNmbr, FRAMEVmsSchList1->Column01->Index);
- DisplayInfo();
- }
- //---------------------------------------------------------------------------
- bool __fastcall TVMSM800M::SaveVmsFixedScenario(String AVmsNmbr, TcxGridTableView *AListSch)
- {
- bool bResult = false;
- String sQry;
- TADOQuery *pADO = NULL;
- TcxDataController *pGDC = AListSch->DataController;
- String sTypeCd = String(AListSch->Tag);
- sQry = "INSERT INTO TB_VMS_TRFC_INFR_DSPL_SCH ( \r\n"
- " VMS_CTLR_NMBR, \r\n"
- " TRFC_SITU_TYPE_CD, \r\n"
- " PHASE, \r\n"
- " VMS_FORM_ID, \r\n"
- " VMS_FORM_PRRT_CD, \r\n"
- " DSPL_HH, \r\n"
- " DSPL_STRT_HH, \r\n"
- " DSPL_END_HH, \r\n"
- " FRST_VMS_IFSC_ID, \r\n"
- " SECD_VMS_IFSC_ID, \r\n"
- " THIR_VMS_IFSC_ID, \r\n"
- " FOUR_VMS_IFSC_ID, \r\n"
- " USE_YN \r\n"
- " ) \r\n"
- " VALUES( \r\n"
- " :p01, :p02, :p03, \r\n"
- " :p04, :p05, :p06, \r\n"
- " :p07, :p08, :p09, \r\n"
- " :p10, :p11, :p12, \r\n"
- " :p13 \r\n"
- " ) \r\n";
- try
- {
- AListSch->BeginUpdate();
- pGDC->BeginUpdate();
- int nRows = pGDC->RecordCount;
- try
- {
- pADO = new TADOQuery(NULL);
- pADO->Close();
- pADO->Connection = ITSDb_GetConnection();
- ITSDb_SQLText(pADO, sQry);
- for (int ii = 0; ii < nRows; ii++)
- {
- String sFormId = VarToStr(pGDC->Values[ii][0]);
- String sDispHH = VarToStr(pGDC->Values[ii][3]);
- String sUseYn = VarToStr(pGDC->Values[ii][6]);
- String sStrTime = VarToStr(pGDC->Values[ii][7]);
- String sEndTime = VarToStr(pGDC->Values[ii][8]);
- String sIfscId1 = VarToStr(pGDC->Values[ii][ 9]);
- String sIfscId2 = VarToStr(pGDC->Values[ii][10]);
- String sIfscId3 = VarToStr(pGDC->Values[ii][11]);
- String sIfscId4 = VarToStr(pGDC->Values[ii][12]);
- String sPrrtCd = "";
- ITSDb_SQLBind(pADO, "p01", AVmsNmbr);
- ITSDb_SQLBind(pADO, "p02", sTypeCd);
- ITSDb_SQLBind(pADO, "p03", String(ii+1));
- ITSDb_SQLBind(pADO, "p04", sFormId);
- ITSDb_SQLBind(pADO, "p05", sPrrtCd);
- ITSDb_SQLBind(pADO, "p06", sDispHH);
- ITSDb_SQLBind(pADO, "p07", sStrTime);
- ITSDb_SQLBind(pADO, "p08", sEndTime);
- ITSDb_SQLBind(pADO, "p09", sIfscId1);
- ITSDb_SQLBind(pADO, "p10", sIfscId2);
- ITSDb_SQLBind(pADO, "p11", sIfscId3);
- ITSDb_SQLBind(pADO, "p12", sIfscId4);
- ITSDb_SQLBind(pADO, "p13", sUseYn);
- pADO->ExecSQL();
- }
- bResult = true;
- }
- catch(EDatabaseError &E)
- {
- ITSDb_GetConnection()->RollbackTrans();
- DBERRORMSG("VMS Default Schedule Save", String(E.ClassName()), E.Message, sQry);
- throw Exception(String(E.ClassName()) + E.Message);
- }
- catch(Exception &e)
- {
- ITSDb_GetConnection()->RollbackTrans();
- DBERRORMSG("VMS Default Schedule Save", String(e.ClassName()), e.Message, sQry);
- throw Exception(String(e.ClassName()) + e.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- pGDC->EndUpdate();
- AListSch->EndUpdate();
- }
- return bResult;
- }
- //---------------------------------------------------------------------------
- bool __fastcall TVMSM800M::DeleteVmsFixedScenario(String AVmsNmbr)
- {
- bool bResult = false;
- String sQry;
- TADOQuery *pADO = NULL;
- sQry = "DELETE TB_VMS_TRFC_INFR_DSPL_SCH \r\n"
- " WHERE VMS_CTLR_NMBR = :p01 \r\n"
- " AND TRFC_SITU_TYPE_CD IN ('6') \r\n";
- try
- {
- try
- {
- pADO = new TADOQuery(NULL);
- pADO->Close();
- pADO->Connection = ITSDb_GetConnection();
- ITSDb_SQLText(pADO, sQry);
- ITSDb_SQLBind(pADO, "p01", AVmsNmbr);
- pADO->ExecSQL();
- bResult = true;
- }
- catch(EDatabaseError &E)
- {
- ITSDb_GetConnection()->RollbackTrans();
- DBERRORMSG("VMS Default Schedule Delete", String(E.ClassName()), E.Message, sQry);
- throw Exception(String(E.ClassName()) + E.Message);
- }
- catch(Exception &e)
- {
- ITSDb_GetConnection()->RollbackTrans();
- DBERRORMSG("VMS Default Schedule Delete", String(e.ClassName()), e.Message, sQry);
- throw Exception(String(e.ClassName()) + e.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- }
- return bResult;
- }
- //---------------------------------------------------------------------------
|