123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "ITSDbF.h"
- #include "AppGlobalF.h"
- #include "CDSCodeF.h"
- #include "CDSNodeF.h"
- #include "CDSLinkF.h"
- #include "CDSIfscF.h"
- #include "CDSRoadF.h"
- #include "ITSLangTransF.h"
- #pragma hdrstop
- #include "ITS0040MF.h"
- #include "ITSSEL2MF.h"
- #include "ITSSELAMF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtonEdit"
- #pragma link "cxButtons"
- #pragma link "cxCalc"
- #pragma link "cxClasses"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxDropDownEdit"
- #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 "cxGroupBox"
- #pragma link "cxLabel"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxMaskEdit"
- #pragma link "cxSpinEdit"
- #pragma link "cxSplitter"
- #pragma link "cxStyles"
- #pragma link "cxTextEdit"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinscxPCPainter"
- #pragma resource "*.dfm"
- TITS0040M *ITS0040M = NULL;
- //---------------------------------------------------------------------------
- __fastcall TITS0040M::TITS0040M(TComponent* Owner)
- : TForm(Owner)
- {
- LangTrans->Translate(this, ITSDb_GetConnection());
- ITSSkin_Load(this);
- CMM_LoadForm(g_sFormsDir, this);
- FTitle = Caption;//"반복정체구간 관리";
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::CommClose()
- {
- try
- {
- CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::FormInit()
- {
- //SendMessage(DateTimePicker1->Handle, DTM_SETFORMAT, 0, Longint("HH:mm:ss"));
- //DateTimePicker1->Time = FormatDateTime("HH:mm:ss", Time());
- m_pGDC1 = TvList1->DataController;
- m_pGDC2 = TvList2->DataController;
- TvList1->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<예상 반복정체구간 정보가 없습니다>";
- TvList2->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<확정 반복정체구간 정보가 없습니다>";
- FCodeRCS = ItsCodeManager->FLists.Find("RCS"); //반복정체구간 출처 유형
- FCodeDTW = ItsCodeManager->FLists.Find("DTW"); //요일유형
- FCodeLTC = ItsCodeManager->FLists.Find("LTC"); //소통등급
- FCodeIFD = ItsCodeManager->FLists.Find("IFD"); //정보제공구간 방향코드
- if (FCodeDTW)
- {
- CbDayType->Properties->Items->Clear();
- FOR_STL(TItsSubCode *, pSubCode, FCodeDTW->FSubLists)
- {
- CbDayType->Properties->Items->Add("[" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
- }
- CbDayType->ItemIndex = 0;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::FormShow(TObject *Sender)
- {
- Refresh();
- FormInit();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- BtnSearchClick((TObject*)BtnSearch);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::BtnSearchClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TSqlCursor sqlCrs((TControl*)BtnSearch);
- RefreshData();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::RefreshData()
- {
- ItsRepeatCongestManager->LoadFromDb();
- SelConfirmList();
- SelUnConfirmList();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::SelConfirmList()
- {
- TItsIfsc *pSvcLink;
- TItsSubCode *pSubCode;
- CMM_ClearGridTableView(TvList2);
- int nRow2 = 0;
- try
- {
- TvList2->BeginUpdate();
- try
- {
- ItsRepeatCongestManager->FListsCnfm.Lock();
- FOR_STL(TItsRepeatCongest*, pRpLink, ItsRepeatCongestManager->FListsCnfm)
- {
- //링크기본정보
- pSvcLink = ItsIfscManager->FLists.Find(pRpLink->IFSC_ID);
- if (!pSvcLink) continue; //기본정보가 없는 것은 보여줄 필요가 없다.
- String sStatTm = pRpLink->STAT_YM;
- if (sStatTm != "") sStatTm.Insert("-", 5);
- String sDTW = "[" + pRpLink->DAY_TYPE_CD + "] "; //요일 유형 코드
- if (FCodeDTW)
- {
- pSubCode = FCodeDTW->FSubLists.Find(pRpLink->DAY_TYPE_CD);
- if (pSubCode) sDTW = sDTW + pSubCode->CMMN_CD_KOR_NM;
- }
- String sStTm = pRpLink->CNFS_STRT_HM;
- sStTm.Insert(":", 3);
- String sEdTm = pRpLink->CNFS_END_HM;
- sEdTm.Insert(":", 3);
- #if 0
- String sCrtDt = pRpLink->CRTN_YMD;
- if (sCrtDt.Length() > 7)
- {
- sCrtDt.Insert("-", 7);
- }
- sCrtDt.Insert("-", 5);
- #endif
- String sRCS = "[" + pRpLink->REPT_CNGS_SECT_ORGN_CD + "] "; //반복 정체 구간 원본 코드
- if (FCodeRCS)
- {
- pSubCode = FCodeRCS->FSubLists.Find(pRpLink->REPT_CNGS_SECT_ORGN_CD);
- if (pSubCode) sRCS = sRCS + pSubCode->CMMN_CD_KOR_NM;
- }
- if (pRpLink->REPT_CNGS_SECT_ORGN_CD == "") sRCS = "";
- String sIFD = "[" + pSvcLink->DRCT_CD + "] ";
- if (FCodeIFD)
- {
- pSubCode = FCodeIFD->FSubLists.Find(pSvcLink->DRCT_CD); // 방향코드
- if (pSubCode) sIFD = sIFD + pSubCode->CMMN_CD_KOR_NM;
- }
- // if (pRpLink->DCSN_YN != "Y")
- nRow2 = m_pGDC2->AppendRecord();
- m_pGDC2->Values[nRow2][BColumn01->Index] = pSvcLink->IFSC_ID; //ID
- m_pGDC2->Values[nRow2][BColumn02->Index] = ITSUtil_FormatStr(pRpLink->STAT_YM, STR_MM); //통계년월
- m_pGDC2->Values[nRow2][BColumn03->Index] = sDTW; //요일
- m_pGDC2->Values[nRow2][BColumn04->Index] = sStTm; //혼잡시작시분
- m_pGDC2->Values[nRow2][BColumn05->Index] = sEdTm; //혼잡종료시분
- m_pGDC2->Values[nRow2][BColumn06->Index] = pRpLink->AVRG_SPED; //평균속도
- m_pGDC2->Values[nRow2][BColumn07->Index] = pRpLink->AVRG_TRVL_HH;//평균통행시간
- m_pGDC2->Values[nRow2][BColumn08->Index] = pRpLink->DCSN_YN; //확정여부
- //m_pGDC2->Values[nRow2][BColumn09->Index] = sCrtDt; //생성일자
- m_pGDC2->Values[nRow2][BColumn09->Index] = ITSUtil_FormatStr(pRpLink->CRTN_YMD, STR_DATE); //생성일자
- m_pGDC2->Values[nRow2][BColumn10->Index] = sRCS; //생성자
- m_pGDC2->Values[nRow2][BColumn11->Index] = pSvcLink->IFSC_NM; //명칭
- m_pGDC2->Values[nRow2][BColumn12->Index] = sIFD; //방향
- m_pGDC2->Values[nRow2][BColumn13->Index] = pSvcLink->STRT_NM; //시점명
- m_pGDC2->Values[nRow2][BColumn14->Index] = pSvcLink->END_NM; //종점명
- m_pGDC2->Values[nRow2][BColumn99->Index] = (int)pRpLink;
- }
- }
- __finally
- {
- ItsRepeatCongestManager->FListsCnfm.UnLock();
- }
- }
- __finally
- {
- TvList2->EndUpdate();
- TvList2->DataController->GotoFirst();
- TvList2->DataController->FocusedRecordIndex = 0;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::SelUnConfirmList()
- {
- TItsIfsc *pSvcLink;
- TItsSubCode *pSubCode;
- CMM_ClearGridTableView(TvList1);
- int nRow1 = 0;
- try
- {
- TvList1->BeginUpdate();
- try
- {
- ItsRepeatCongestManager->FLists.Lock();
- FOR_STL(TItsRepeatCongest*, pRpLink, ItsRepeatCongestManager->FLists)
- {
- //링크기본정보
- pSvcLink = ItsIfscManager->FLists.Find(pRpLink->IFSC_ID);
- if (!pSvcLink) continue; //기본정보가 없는 것은 보여줄 필요가 없다.
- String sStatTm = pRpLink->STAT_YM;
- if (sStatTm != "") sStatTm.Insert("-", 5);
- String sDTW = "[" + pRpLink->DAY_TYPE_CD + "] "; //요일 유형 코드
- if (FCodeDTW)
- {
- pSubCode = FCodeDTW->FSubLists.Find(pRpLink->DAY_TYPE_CD);
- if (pSubCode) sDTW = sDTW + pSubCode->CMMN_CD_KOR_NM;
- }
- String sStTm = pRpLink->CNFS_STRT_HM;
- sStTm.Insert(":", 3);
- String sEdTm = pRpLink->CNFS_END_HM;
- sEdTm.Insert(":", 3);
- #if 0
- String sCrtDt = pRpLink->CRTN_YMD;
- if (sCrtDt.Length() > 7)
- {
- sCrtDt.Insert("-", 7);
- }
- sCrtDt.Insert("-", 5);
- #endif
- String sRCS = "[" + pRpLink->REPT_CNGS_SECT_ORGN_CD + "] "; //반복 정체 구간 원본 코드
- if (FCodeRCS)
- {
- pSubCode = FCodeRCS->FSubLists.Find(pRpLink->REPT_CNGS_SECT_ORGN_CD);
- if (pSubCode) sRCS = sRCS + pSubCode->CMMN_CD_KOR_NM;
- }
- if (pRpLink->REPT_CNGS_SECT_ORGN_CD == "") sRCS = "";
- String sIFD = "[" + pSvcLink->DRCT_CD + "] ";
- if (FCodeIFD)
- {
- pSubCode = FCodeIFD->FSubLists.Find(pSvcLink->DRCT_CD); // 방향코드
- if (pSubCode) sIFD = sIFD + pSubCode->CMMN_CD_KOR_NM;
- }
- // if (pRpLink->DCSN_YN != "Y")
- nRow1 = m_pGDC1->AppendRecord();
- m_pGDC1->Values[nRow1][AColumn01->Index] = pSvcLink->IFSC_ID; //ID
- m_pGDC1->Values[nRow1][AColumn02->Index] = ITSUtil_FormatStr(pRpLink->STAT_YM, STR_MM); //통계년월
- m_pGDC1->Values[nRow1][AColumn03->Index] = sDTW; //요일
- m_pGDC1->Values[nRow1][AColumn04->Index] = sStTm; //혼잡시작시분
- m_pGDC1->Values[nRow1][AColumn05->Index] = sEdTm; //혼잡종료시분
- m_pGDC1->Values[nRow1][AColumn06->Index] = pRpLink->AVRG_SPED; //평균속도
- m_pGDC1->Values[nRow1][AColumn07->Index] = pRpLink->AVRG_TRVL_HH;//평균통행시간
- m_pGDC1->Values[nRow1][AColumn08->Index] = pRpLink->DCSN_YN; //확정여부
- //m_pGDC1->Values[nRow1][AColumn09->Index] = sCrtDt; //생성일자
- m_pGDC1->Values[nRow1][AColumn09->Index] = ITSUtil_FormatStr(pRpLink->CRTN_YMD, STR_DATE); //생성일자
- m_pGDC1->Values[nRow1][AColumn10->Index] = sRCS; //생성자
- m_pGDC1->Values[nRow1][AColumn11->Index] = pSvcLink->IFSC_NM; //명칭
- m_pGDC1->Values[nRow1][AColumn12->Index] = sIFD; //방향
- m_pGDC1->Values[nRow1][AColumn13->Index] = pSvcLink->STRT_NM; //시점명
- m_pGDC1->Values[nRow1][AColumn14->Index] = pSvcLink->END_NM; //종점명
- m_pGDC1->Values[nRow1][AColumn99->Index] = (int)pRpLink;
- }
- }
- __finally
- {
- ItsRepeatCongestManager->FLists.UnLock();
- }
- }
- __finally
- {
- TvList1->EndUpdate();
- TvList1->DataController->GotoFirst();
- TvList1->DataController->FocusedRecordIndex = 0;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::BtnCloseClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- CommClose();
- ITS0040M = NULL;
- Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::BtnOperatorInputClick(TObject *Sender)
- {
- GrpOperatroInput->Visible = !GrpOperatroInput->Visible;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::EdLinkIdPropertiesButtonClick(TObject *Sender, int AButtonIndex)
- {
- PopupAddLink->Popup(EdLinkId->ClientOrigin.x, EdLinkId->ClientOrigin.y + EdLinkId->Height);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::MnuListListClick(TObject *Sender)
- {
- try {
- TITSSEL2M *pSelForm = new TITSSEL2M(this);
- pSelForm->m_bSelected = false;
- pSelForm->ShowModal();
- if (pSelForm->m_bSelected)
- {
- EdLinkId->Text = pSelForm->m_sSelLinkId;
- }
- delete pSelForm;
- } catch(...) { }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::MnuGisAddClick(TObject *Sender)
- {
- try {
- TITSSELAM *pSelForm = new TITSSELAM(this);
- pSelForm->MultiSelect = false;
- pSelForm->LinkLevel = 2;
- pSelForm->ShowModal();
- Application->ProcessMessages();
- if (pSelForm->Selected)
- {
- if (pSelForm->TvList->DataController->RecordCount > 0)
- {
- String sLinkId = pSelForm->TvList->DataController->Values[0][pSelForm->Column01->Index];
- TItsIfsc *pIfsc = ItsIfscManager->FLists.Find(sLinkId);
- if (!pIfsc)
- {
- Application->MessageBox(lblSelErr->Caption.c_str(),//L"정보가 없는 구간을 선택하였습니다. 다른 구간을 선택하세요.",
- FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- EdLinkId->Text = sLinkId;
- }
- }
- delete pSelForm;
- } catch(...) { }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::BtnCnfmCancelClick(TObject *Sender)
- {
- UnconfirmData(true);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::BtnAppCancelClick(TObject *Sender)
- {
- UnconfirmData(false);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::UnconfirmData(bool AConfirm)
- {
- TcxGridTableView *TvList = TvList1;
- TcxDataController *pGDC = m_pGDC1;
- int nIdx = AColumn99->Index;
- String sTitle = lblGss1->Caption + " " + lblCancel->Caption;//"예상 반복정체구간 취소";
- if (AConfirm)
- {
- TvList = TvList2;
- pGDC = m_pGDC2;
- nIdx = BColumn99->Index;
- sTitle = lblGss2->Caption + " " + lblCancel->Caption;//"확정 반복정체구간 취소";
- }
- int nSelRows = TvList->Controller->SelectedRowCount;
- if (nSelRows <= 0)
- {
- Application->MessageBox(lblSelErr2->Caption.c_str(),//L"작업 할 정체구간을 선택하세요.",
- sTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
- return;
- }
- if (Application->MessageBox(lblCancel2->Caption.c_str(),//L"선택한 정체구간을 취소 하시겠습니까?",
- sTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
- TADOQuery *pADO = NULL;
- String sQry;
- try
- {
- TItsRepeatCongest *pRpLink;
- int nSelIdx, nMemPtr;
- TvList->BeginUpdate();
- sQry = "DELETE TB_REPT_CNGS_SECT \r\n"
- " WHERE IFSC_ID = :p01 \r\n"
- " AND STAT_YM = :p02 \r\n"
- " AND DAY_TYPE_CD = :p03 \r\n"
- " AND CNFS_STRT_HM = :p04 \r\n";
- try
- {
- pADO = new TADOQuery(NULL);
- pADO->Close();
- pADO->Connection = ITSDb_GetConnection();
- ITSDb_SQLText(pADO, sQry);
- ITSDb_GetConnection()->BeginTrans();
- for (int ii = 0; ii < nSelRows; ii++)
- {
- nSelIdx = TvList->Controller->SelectedRows[ii]->RecordIndex;
- nMemPtr = pGDC->Values[nSelIdx][nIdx];
- pRpLink = (TItsRepeatCongest *)nMemPtr;
- ITSDb_SQLBind(pADO, "p01", pRpLink->IFSC_ID);
- ITSDb_SQLBind(pADO, "p02", pRpLink->STAT_YM);
- ITSDb_SQLBind(pADO, "p03", pRpLink->DAY_TYPE_CD);
- ITSDb_SQLBind(pADO, "p04", pRpLink->CNFS_STRT_HM);
- ITSDb_SQLExec(pADO);
- }
- ITSDb_GetConnection()->CommitTrans();
- Application->MessageBox(lblCancel3->Caption.c_str(),//L"반복정체구간 취소 작업을 완료하였습니다.",
- sTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
- }
- catch(EDatabaseError &E)
- {
- ITSDb_GetConnection()->RollbackTrans();
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
- throw Exception(String(E.ClassName()) + E.Message);
- }
- catch(Exception &e)
- {
- ITSDb_GetConnection()->RollbackTrans();
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
- throw Exception(String(e.ClassName()) + e.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- TvList->EndUpdate();
- RefreshData();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::BtnApplyClick(TObject *Sender)
- {
- int nSelRows = TvList1->Controller->SelectedRowCount;
- if (nSelRows <= 0)
- {
- Application->MessageBox(lblQry1->Caption.c_str(),//L"반복정체구간으로 확정할 구간을 선택하세요.",
- lblCnfm->Caption.c_str(),//L"반복정체구간 확정",
- MB_OK|MB_ICONWARNING|MB_APPLMODAL);
- return;
- }
- if (Application->MessageBox(lblQry2->Caption.c_str(),//L"선택한 구간을 반복정체구간으로 확정 하시겠습니까?",
- lblCnfm->Caption.c_str(),//L"반복정체구간 확정",
- MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
- TADOQuery *pADO = NULL;
- String sQry;
- try
- {
- TItsRepeatCongest *pRpLink;
- int nSelIdx, nMemPtr;
- TvList1->BeginUpdate();
- sQry = "UPDATE TB_REPT_CNGS_SECT \r\n"
- " SET DCSN_YN = 'Y' \r\n"
- " WHERE IFSC_ID = :p01 \r\n"
- " AND STAT_YM = :p02 \r\n"
- " AND DAY_TYPE_CD = :p03 \r\n"
- " AND CNFS_STRT_HM = :p04 \r\n";
- try
- {
- pADO = new TADOQuery(NULL);
- pADO->Close();
- pADO->Connection = ITSDb_GetConnection();
- ITSDb_SQLText(pADO, sQry);
- ITSDb_GetConnection()->BeginTrans();
- for (int ii = 0; ii < nSelRows; ii++)
- {
- nSelIdx = TvList1->Controller->SelectedRows[ii]->RecordIndex;
- nMemPtr = m_pGDC1->Values[nSelIdx][AColumn99->Index];
- pRpLink = (TItsRepeatCongest *)nMemPtr;
- if (pRpLink)
- {
- ITSDb_SQLBind(pADO, "p01", pRpLink->IFSC_ID);
- ITSDb_SQLBind(pADO, "p02", pRpLink->STAT_YM);
- ITSDb_SQLBind(pADO, "p03", pRpLink->DAY_TYPE_CD);
- ITSDb_SQLBind(pADO, "p04", pRpLink->CNFS_STRT_HM);
- ITSDb_SQLExec(pADO);
- }
- }
- ITSDb_GetConnection()->CommitTrans();
- Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"예상 반복정체구간을 확정 반복정체구간으로 저장 하였습니다.",
- lblCnfm->Caption.c_str(),//L"반복정체구간 확정",
- MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
- }
- catch(EDatabaseError &E)
- {
- ITSDb_GetConnection()->RollbackTrans();
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
- throw Exception(String(E.ClassName()) + E.Message);
- }
- catch(Exception &e)
- {
- ITSDb_GetConnection()->RollbackTrans();
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
- throw Exception(String(e.ClassName()) + e.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- TvList1->EndUpdate();
- RefreshData();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::BtnSaveClick(TObject *Sender)
- {
- String sSvcId = EdLinkId->Text.Trim();
- TItsIfsc *pIfsc;
- pIfsc = ItsIfscManager->FLists.Find(sSvcId);
- if (!pIfsc)
- {
- Application->MessageBox(lblQry3->Caption.c_str(),//L"등록되어 있지 않은 서비스 구간이거나 서비스 구간을 선택하지 않으셨습니다.\r\n서비스 구간을 확인 후 작업하세요.",
- lblOpr->Caption.c_str(),//L"반복정체구간 운영자등록",
- MB_OK|MB_ICONWARNING|MB_APPLMODAL);
- ActiveControl = EdLinkId;
- return;
- }
- String sStTime = DtStTime->Time.FormatString("hhnn");
- String sEdTime = DtEdTime->Time.FormatString("hhnn");
- if (sStTime > sEdTime)
- {
- Application->MessageBox(lblQry4->Caption.c_str(),//L"혼잡 시작시분 과 혼잡 종료시분이 정확히 입력되지 않았습니다.\r\n혼잡 시작/종료 시각을 확인 후 작업하세요.",
- lblOpr->Caption.c_str(),//L"반복정체구간 운영자등록",
- MB_OK|MB_ICONWARNING|MB_APPLMODAL);
- ActiveControl = DtStTime;
- return;
- }
- String sDayType = ITSUtil_GetCode(CbDayType->Text);
- TADOQuery *pADO = NULL;
- String sQry;
- try
- {
- TItsRepeatCongest *pRpLink;
- int nSelIdx;
- TvList1->BeginUpdate();
- sQry = "INSERT INTO TB_REPT_CNGS_SECT ( \r\n"
- " IFSC_ID , \r\n"
- " STAT_YM , \r\n"
- " DAY_TYPE_CD , \r\n"
- " CNFS_STRT_HM , \r\n"
- " CNFS_END_HM , \r\n"
- " AVRG_SPED , \r\n"
- " AVRG_TRVL_HH , \r\n"
- " DCSN_YN , \r\n"
- " CRTN_YMD , \r\n"
- " REPT_CNGS_SECT_ORGN_CD ) \r\n"
- " VALUES ( \r\n"
- " :p01, \r\n"
- " TO_CHAR(SYSDATE, 'YYYYMM'), \r\n"
- " :p02, \r\n"
- " :p03, \r\n"
- " :p04, \r\n"
- " :p05, \r\n"
- " :p06, \r\n"
- " 'Y', \r\n"
- " TO_CHAR(SYSDATE, 'YYYYMMDD'), \r\n"
- " 'RCS2' ) \r\n";
- try
- {
- pADO = new TADOQuery(NULL);
- pADO->Close();
- pADO->Connection = ITSDb_GetConnection();
- ITSDb_SQLText(pADO, sQry);
- ITSDb_GetConnection()->BeginTrans();
- ITSDb_SQLBind(pADO, "p01", sSvcId);
- ITSDb_SQLBind(pADO, "p02", sDayType);
- ITSDb_SQLBind(pADO, "p03", sStTime);
- ITSDb_SQLBind(pADO, "p04", sEdTime);
- ITSDb_SQLBind(pADO, "p05", SpSpeed->Value);
- ITSDb_SQLBind(pADO, "p06", SpAvgTm->Value);
- ITSDb_SQLExec(pADO);
- ITSDb_GetConnection()->CommitTrans();
- Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"운영자 등록 반복정체구간 정보를 저장 하였습니다.",
- lblOpr->Caption.c_str(),//L"반복정체구간 운영자등록",
- MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
- EdLinkId->Text = "";
- BtnOperatorInputClick(NULL);
- }
- catch(EDatabaseError &E)
- {
- ITSDb_GetConnection()->RollbackTrans();
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
- throw Exception(String(E.ClassName()) + E.Message);
- }
- catch(Exception &e)
- {
- ITSDb_GetConnection()->RollbackTrans();
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
- throw Exception(String(e.ClassName()) + e.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- TvList1->EndUpdate();
- RefreshData();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITS0040M::TvList1DataControllerFilterChanged(TObject *Sender)
- {
- CMM_SetFilterLike(TvList1);
- }
- //---------------------------------------------------------------------------
|