VMSM700MF.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. /****************************************************************************
  2. * @source :
  3. * @description :
  4. ****************************************************************************
  5. * DATE AUTHOR DESCRIPTION
  6. * --------------------------------------------------------------------------
  7. * 2016/07/10 shjung 최초작성
  8. *
  9. ****************************************************************************/
  10. //---------------------------------------------------------------------------
  11. #include <vcl.h>
  12. #include "ITSSkinF.h"
  13. #include "ITSUtilF.h"
  14. #include "AppGlobalF.h"
  15. #include "CDSVmsIfscF.h"
  16. #include "ITSLangTransF.h"
  17. #pragma hdrstop
  18. #include "VMSM700MF.h"
  19. #include "VMSM610MF.h"
  20. #include "VMSSEL0MF.h"
  21. #include "VMSEDT0MF.h"
  22. //---------------------------------------------------------------------------
  23. #pragma package(smart_init)
  24. #pragma link "cxButtons"
  25. #pragma link "cxCalendar"
  26. #pragma link "cxContainer"
  27. #pragma link "cxControls"
  28. #pragma link "cxDropDownEdit"
  29. #pragma link "cxEdit"
  30. #pragma link "cxGraphics"
  31. #pragma link "cxGroupBox"
  32. #pragma link "cxLabel"
  33. #pragma link "cxLookAndFeelPainters"
  34. #pragma link "cxLookAndFeels"
  35. #pragma link "cxMaskEdit"
  36. #pragma link "cxPC"
  37. #pragma link "cxPCdxBarPopupMenu"
  38. #pragma link "cxSpinEdit"
  39. #pragma link "cxSplitter"
  40. #pragma link "cxTextEdit"
  41. #pragma link "cxTimeEdit"
  42. #pragma link "dxSkinBlack"
  43. #pragma link "dxSkinBlue"
  44. #pragma link "dxSkinCaramel"
  45. #pragma link "dxSkinCoffee"
  46. #pragma link "dxSkinDarkRoom"
  47. #pragma link "dxSkinDarkSide"
  48. #pragma link "dxSkinFoggy"
  49. #pragma link "dxSkinGlassOceans"
  50. #pragma link "dxSkiniMaginary"
  51. #pragma link "dxSkinLilian"
  52. #pragma link "dxSkinLiquidSky"
  53. #pragma link "dxSkinLondonLiquidSky"
  54. #pragma link "dxSkinMcSkin"
  55. #pragma link "dxSkinMoneyTwins"
  56. #pragma link "dxSkinOffice2007Black"
  57. #pragma link "dxSkinOffice2007Blue"
  58. #pragma link "dxSkinOffice2007Green"
  59. #pragma link "dxSkinOffice2007Pink"
  60. #pragma link "dxSkinOffice2007Silver"
  61. #pragma link "dxSkinOffice2010Black"
  62. #pragma link "dxSkinOffice2010Blue"
  63. #pragma link "dxSkinOffice2010Silver"
  64. #pragma link "dxSkinsCore"
  65. #pragma link "dxSkinscxPCPainter"
  66. #pragma link "dxSkinSeven"
  67. #pragma link "dxSkinSharp"
  68. #pragma link "dxSkinSilver"
  69. #pragma link "dxSkinStardust"
  70. #pragma link "cxRadioGroup"
  71. #pragma link "cxClasses"
  72. #pragma link "cxCustomData"
  73. #pragma link "cxData"
  74. #pragma link "cxDataStorage"
  75. #pragma link "cxDBData"
  76. #pragma link "cxFilter"
  77. #pragma link "cxGrid"
  78. #pragma link "cxGridCustomTableView"
  79. #pragma link "cxGridCustomView"
  80. #pragma link "cxGridDBTableView"
  81. #pragma link "cxGridLevel"
  82. #pragma link "cxGridTableView"
  83. #pragma link "cxStyles"
  84. #pragma link "cxCheckBox"
  85. #pragma link "cxImage"
  86. #pragma link "cxButtonEdit"
  87. #pragma link "cxBlobEdit"
  88. #pragma link "cxColorComboBox"
  89. #pragma link "cxCalc"
  90. #pragma link "VmsDesignerF"
  91. #pragma link "FRAME_VmsSchListF"
  92. #pragma resource "*.dfm"
  93. TVMSM700M *VMSM700M = NULL;
  94. //---------------------------------------------------------------------------
  95. __fastcall TVMSM700M::TVMSM700M(TComponent* Owner)
  96. : TForm(Owner)
  97. {
  98. LangTrans->Translate(this, ITSDb_GetConnection());
  99. ITSSkin_Load(this);
  100. CMM_LoadForm(g_sFormsDir, this);
  101. FUpdate= false;
  102. FTitle = Caption;//"VMS 고정 스케줄 관리";
  103. FListSymb = new TList;
  104. EditMode = false;
  105. APP_InitDisplayColor();
  106. PgVmsSch->Properties->ActivePage = TabFixed;
  107. PgVmsSch->Properties->HideTabs = true;
  108. LblInfo->Height = 25;
  109. FRAMEVmsSchList1->PnlTop->Visible = false;
  110. FRAMEVmsSchList1->PnlBottom->Visible = false;
  111. FRAMEVmsSchList1->Col09->Visible = true;
  112. FRAMEVmsSchList1->Col10->Visible = false;
  113. FVmsHeight = 64;
  114. FListSch[0] = NULL;
  115. FListSch[1] = NULL;
  116. FListSch[2] = NULL;
  117. FListSch[3] = NULL;
  118. FListSch[4] = NULL;
  119. FListSch[5] = TvGrid6;
  120. FListSch[6] = NULL;
  121. FListSch[7] = NULL;
  122. FListFrm[0] = NULL;
  123. FListFrm[1] = NULL;
  124. FListFrm[2] = NULL;
  125. FListFrm[3] = NULL;
  126. FListFrm[4] = NULL;
  127. FListFrm[5] = TvForm6;
  128. FListFrm[6] = NULL;
  129. FListFrm[7] = NULL;
  130. for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
  131. {
  132. if (FListSch[ii]) InitTcxList(FListSch[ii]);
  133. if (FListFrm[ii]) InitTcxList(FListFrm[ii]);
  134. }
  135. //BtnSave->Caption = "Save Schedule";
  136. //BtnSave->Hint = "Save scheduled tasks for the currently selected VMS";
  137. }
  138. //---------------------------------------------------------------------------
  139. void __fastcall TVMSM700M::InitTcxList(TcxGridTableView *AView)
  140. {
  141. AView->OptionsView->DataRowHeight = 0;
  142. AView->OptionsView->CellAutoHeight = true;
  143. AView->OptionsView->Indicator = false;
  144. AView->OptionsCustomize->ColumnMoving = false;
  145. AView->OptionsCustomize->ColumnSorting = false;
  146. AView->Columns[0]->Width = 40;
  147. AView->Columns[0]->Options->HorzSizing = false;
  148. AView->Columns[1]->Width = 330;
  149. }
  150. //---------------------------------------------------------------------------
  151. /*
  152. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  153. * Form과 DataModule class를 delete시킨다.
  154. * arguments
  155. *
  156. * return
  157. * void
  158. */
  159. void __fastcall TVMSM700M::CommClose()
  160. {
  161. try
  162. {
  163. APP_DelVmsSizeCombo(CbSizeType);
  164. ClearSymbloList();
  165. SAFE_DELETE(FListSymb);
  166. CMM_SaveForm(g_sFormsDir, this);
  167. }
  168. catch(...)
  169. {
  170. }
  171. }
  172. //---------------------------------------------------------------------------
  173. void __fastcall TVMSM700M::FormCreate(TObject *Sender)
  174. {
  175. //
  176. }
  177. //---------------------------------------------------------------------------
  178. /*
  179. * Form을 보여줄때 호출되는 event 메서드이다.
  180. * arguments
  181. * Sender : event handler 객체
  182. * return
  183. * void
  184. */
  185. void __fastcall TVMSM700M::FormShow(TObject *Sender)
  186. {
  187. Refresh();
  188. FormInit();
  189. ChangeEditMode(1);
  190. TmrShow->Enabled = true;
  191. }
  192. //---------------------------------------------------------------------------
  193. /*
  194. * form 초기화
  195. *
  196. * arguments
  197. *
  198. * return
  199. * void
  200. */
  201. void __fastcall TVMSM700M::FormInit()
  202. {
  203. for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
  204. {
  205. if (FListSch[ii]) FListSch[ii]->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoSchedule->Caption;//"<등록되어 있는 스케줄 정보가 없습니다>";
  206. if (FListFrm[ii]) FListFrm[ii]->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoForm->Caption;//"<등록되어 있는 폼 정보가 없습니다>";
  207. }
  208. //VMS사이즈
  209. APP_FillVmsSizeType(CbSizeType, "VUTN", false);
  210. VmsManager->LoadVmsFormUsage();
  211. FRAMEVmsSchList1->RefreshVmsFormUsage();
  212. FNewDb = false;
  213. }
  214. //---------------------------------------------------------------------------
  215. /*
  216. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  217. * arguments
  218. * Sender : event handler 객체
  219. * return
  220. * void
  221. */
  222. void __fastcall TVMSM700M::TmrShowTimer(TObject *Sender)
  223. {
  224. TmrShow->Enabled = false;
  225. }
  226. //---------------------------------------------------------------------------
  227. /*
  228. * Close 버튼 클릭 이벤트 핸들러
  229. * arguments
  230. * Sender : event handler 객체
  231. * return
  232. * void
  233. */
  234. void __fastcall TVMSM700M::BtnCloseClick(TObject *Sender)
  235. {
  236. Close();
  237. }
  238. //---------------------------------------------------------------------------
  239. void __fastcall TVMSM700M::FormClose(TObject *Sender, TCloseAction &Action)
  240. {
  241. CommClose();
  242. VMSM700M = NULL;
  243. Action = caFree;
  244. }
  245. //---------------------------------------------------------------------------
  246. void __fastcall TVMSM700M::FormCloseQuery(TObject *Sender, bool &CanClose)
  247. {
  248. if (FUpdate)
  249. {
  250. POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_14, 0);
  251. }
  252. }
  253. //---------------------------------------------------------------------------
  254. void __fastcall TVMSM700M::ChangeEditMode(int AEdit)
  255. {
  256. }
  257. //---------------------------------------------------------------------------
  258. void __fastcall TVMSM700M::ClearSymbloList()
  259. {
  260. for(int ii = 0; ii < FListSymb->Count; ii++)
  261. {
  262. Graphics::TBitmap *bitmap = (Graphics::TBitmap *)FListSymb->Items[ii];
  263. delete bitmap;
  264. }
  265. FListSymb->Clear();
  266. }
  267. //---------------------------------------------------------------------------
  268. void __fastcall TVMSM700M::FRAMEVmsSchList1TvListCellDblClick(TcxCustomGridTableView *Sender,
  269. TcxGridTableDataCellViewInfo *ACellViewInfo, TMouseButton AButton,
  270. TShiftState AShift, bool &AHandled)
  271. {
  272. if (!ACellViewInfo) return;
  273. DisplayInfo();
  274. }
  275. //---------------------------------------------------------------------------
  276. void __fastcall TVMSM700M::FRAMEVmsSchList1TvListFocusedRecordChanged(TcxCustomGridTableView *Sender,
  277. TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord,
  278. bool ANewItemRecordFocusingChanged)
  279. {
  280. if (!AFocusedRecord) return;
  281. DisplayInfo();
  282. }
  283. //---------------------------------------------------------------------------
  284. void __fastcall TVMSM700M::CbSizeTypePropertiesChange(TObject *Sender)
  285. {
  286. BtnSearchClick(NULL);
  287. }
  288. //---------------------------------------------------------------------------
  289. void __fastcall TVMSM700M::BtnSearchClick(TObject *Sender)
  290. {
  291. RefreshData();
  292. EdFocus->SetFocus();
  293. ChangeEditMode(1);
  294. }
  295. //---------------------------------------------------------------------------
  296. void __fastcall TVMSM700M::RefreshData()
  297. {
  298. FormClear();
  299. TVmsSizeType *pVmsSizeType = APP_GetVmsSizeTypeObject(CbSizeType);
  300. if (pVmsSizeType == NULL) return;
  301. FVmsTypeCd = pVmsSizeType->TypeCd;
  302. FVmsWidth = pVmsSizeType->Width;
  303. FVmsHeight = pVmsSizeType->Height;
  304. FRAMEVmsSchList1->UpdateList(FVmsTypeCd);
  305. LoadVmsFormList(FVmsTypeCd);
  306. }
  307. //---------------------------------------------------------------------------
  308. void __fastcall TVMSM700M::FormClear()
  309. {
  310. FSelIdx = -1;
  311. EdVmsNmbr->Clear();
  312. for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
  313. {
  314. if (FListSch[ii]) CMM_ClearGridTableView(FListSch[ii]);
  315. }
  316. GrpSchedule->Caption = lblTitle->Caption;//"▶ 고정 스케줄 설정";
  317. FNewDb = false;
  318. }
  319. //---------------------------------------------------------------------------
  320. void __fastcall TVMSM700M::DisplayInfo()
  321. {
  322. FormClear();
  323. FSelIdx = CMM_GetRecordIndex(FRAMEVmsSchList1->TvList);
  324. if (FSelIdx < 0) return;
  325. TcxDataController *pGDC = FRAMEVmsSchList1->TvList->DataController;
  326. String sVmsNmbr = VarToStr(pGDC->Values[FSelIdx][FRAMEVmsSchList1->Column01->Index]);
  327. EdVmsNmbr->Text = sVmsNmbr;
  328. GrpSchedule->Caption = lblTitle->Caption + " (" + VarToStr(pGDC->Values[FSelIdx][FRAMEVmsSchList1->Column02->Index]) + ": " + VarToStr(pGDC->Values[FSelIdx][FRAMEVmsSchList1->Column03->Index]) + ")";
  329. LoadVmsScheduleInfo(sVmsNmbr);
  330. ChangeEditMode(3);
  331. }
  332. //---------------------------------------------------------------------------
  333. void __fastcall TVMSM700M::TvFormCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  334. TMouseButton AButton, TShiftState AShift,
  335. bool &AHandled)
  336. {
  337. if (!ACellViewInfo) return;
  338. int nRow = Sender->DataController->FocusedRecordIndex;
  339. if( nRow <= -1 )
  340. return;
  341. TcxButton *pBtn = NULL;
  342. switch(Sender->Tag)
  343. {
  344. case enFormFixed: pBtn = BtnListAdd6; break;
  345. default: return;
  346. }
  347. BtnListAddClick((TObject*)pBtn);
  348. }
  349. //---------------------------------------------------------------------------
  350. void __fastcall TVMSM700M::BtnListAddClick(TObject *Sender)
  351. {
  352. String sUse = "N";
  353. String sTime= "4";
  354. TcxButton *pBtn = (TcxButton*)Sender;
  355. int nTag = pBtn->Tag;
  356. if (nTag < 0 || nTag >= MAX_FORM_SCHED) return;
  357. int nSelIdx = CMM_GetRecordIndex(FRAMEVmsSchList1->TvList);
  358. if (nSelIdx < 0) return;
  359. if (!FListFrm[nTag] || !FListSch[nTag]) return;
  360. TcxGridDataController *pDcFrm = FListFrm[nTag]->DataController;
  361. TcxGridDataController *pDcSch = FListSch[nTag]->DataController;
  362. int nFormIdx = CMM_GetRecordIndex(FListFrm[nTag]);
  363. if (nFormIdx < 0) return;
  364. if (nTag == enFormTraffic)
  365. {
  366. sUse = "N";
  367. }
  368. String sStrDate = "";
  369. String sEndDate = "";
  370. bool bSelected= false;
  371. TVMSSEL0M *pSelDate = new TVMSSEL0M(this);
  372. pSelDate->ShowModal();
  373. bSelected = pSelDate->FSelected;
  374. sStrDate = pSelDate->FStrTime;
  375. sEndDate = pSelDate->FEndTime;
  376. delete pSelDate;
  377. pSelDate = NULL;
  378. if (!bSelected) return;
  379. int nRow = pDcSch->AppendRecord();
  380. pDcSch->Values[nRow][0] = pDcFrm->Values[nFormIdx][0];
  381. pDcSch->Values[nRow][1] = pDcFrm->Values[nFormIdx][1];
  382. pDcSch->Values[nRow][3] = sTime;
  383. pDcSch->Values[nRow][4] = ITSUtil_FormatStr(sStrDate, STR_HHNN);;
  384. pDcSch->Values[nRow][5] = ITSUtil_FormatStr(sEndDate, STR_HHNN);;
  385. pDcSch->Values[nRow][6] = sUse;
  386. pDcSch->Values[nRow][7] = sStrDate;
  387. pDcSch->Values[nRow][8] = sEndDate;
  388. pDcSch->Values[nRow][15] = pDcFrm->Values[nFormIdx][2];
  389. }
  390. //---------------------------------------------------------------------------
  391. void __fastcall TVMSM700M::BtnListDeleteClick(TObject *Sender)
  392. {
  393. TcxButton *pBtn = (TcxButton*)Sender;
  394. int nTag = pBtn->Tag;
  395. if (nTag >= MAX_FORM_SCHED) return;
  396. int nSelIdx = CMM_GetRecordIndex(FRAMEVmsSchList1->TvList);
  397. if (nSelIdx < 0) return;
  398. if (!FListSch[nTag]) return;
  399. TcxGridDataController *pDcSch = FListSch[nTag]->DataController;
  400. nSelIdx = CMM_GetRecordIndex(FListSch[nTag]);
  401. if (nSelIdx < 0) return;
  402. FListSch[nTag]->DataController->DeleteRecord(nSelIdx);
  403. }
  404. //---------------------------------------------------------------------------
  405. void __fastcall TVMSM700M::TvGridCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  406. TMouseButton AButton, TShiftState AShift,
  407. bool &AHandled)
  408. {
  409. if (!ACellViewInfo) return;
  410. int nRow = Sender->DataController->FocusedRecordIndex;
  411. if( nRow <= -1 )
  412. return;
  413. TcxGridDataController *pGDC = (TcxGridDataController*)Sender->DataController;
  414. int nColIdx = ACellViewInfo->Item->Index;
  415. //ShowMessage(String(Sender->Tag) + " " + String(nColIdx));
  416. String sFormId = VarToStr(pGDC->Values[nRow][0]);
  417. String sStrDate = VarToStr(pGDC->Values[nRow][7]);
  418. String sEndDate = VarToStr(pGDC->Values[nRow][8]);
  419. if (nColIdx == 4 || nColIdx == 5)
  420. {
  421. //표출기간설정
  422. TVMSSEL0M *pSelDate = new TVMSSEL0M(this);
  423. pSelDate->FStrTime = sStrDate;
  424. pSelDate->FEndTime = sEndDate;
  425. pSelDate->ShowModal();
  426. bool bSelected = pSelDate->FSelected;
  427. sStrDate = pSelDate->FStrTime;
  428. sEndDate = pSelDate->FEndTime;
  429. delete pSelDate;
  430. pSelDate = NULL;
  431. if (bSelected)
  432. {
  433. pGDC->Values[nRow][4] = ITSUtil_FormatStr(sStrDate, STR_HHNN);;
  434. pGDC->Values[nRow][5] = ITSUtil_FormatStr(sEndDate, STR_HHNN);;
  435. pGDC->Values[nRow][7] = sStrDate;
  436. pGDC->Values[nRow][8] = sEndDate;
  437. }
  438. return;
  439. }
  440. if (Sender->Tag != enFormTraffic) return;
  441. if (VarToStr(pGDC->Values[nRow][15]).ToIntDef(0) == 15)
  442. {
  443. //도형식배경 소통정보 폼
  444. Application->MessageBox(FrmLang->lblSchErr1->Caption.c_str(),//L"VMS 교통정보 폼 구간 설정\r\n도형식 배경소통정보 폼은 폼관리 화면에서 설정 가능합니다.",
  445. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  446. return;
  447. }
  448. }
  449. //---------------------------------------------------------------------------
  450. void __fastcall TVMSM700M::BtnAllEditClick(TObject *Sender)
  451. {
  452. TcxButton *pBtn = (TcxButton*)Sender;
  453. //등록되어 있는 스케줄 폼을 전체 VMS에 편집하는 기능
  454. int nTag = PgVmsSch->Properties->ActivePage->Tag;
  455. if (nTag < 0 || nTag >= MAX_FORM_SCHED)
  456. {
  457. Application->MessageBox(FrmLang->lblRegErr1->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\n알수 없는 스케줄 유형입니다.",
  458. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  459. return;
  460. }
  461. if (!FListSch[nTag]) return;
  462. TcxGridTableView *pTvList = FListSch[nTag];
  463. TcxGridDataController *pGDC;
  464. String sMode = "E";
  465. if (pBtn->Tag == 1)
  466. {
  467. sMode = "A"; //추가
  468. pTvList = FListFrm[nTag];
  469. }
  470. if (!pTvList) return;
  471. pGDC = pTvList->DataController;
  472. int nFormIdx = CMM_GetRecordIndex(pTvList);
  473. if (nFormIdx < 0)
  474. {
  475. Application->MessageBox(FrmLang->lblRegErr2->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\n등록되어 있는 스케줄 폼을 목록에서 먼저 선택하세요.",
  476. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  477. return;
  478. }
  479. String sFormId = pGDC->Values[nFormIdx][0];
  480. TVmsSizeType *pVmsSizeType = APP_GetVmsSizeTypeObject(CbSizeType);
  481. if (pVmsSizeType == NULL)
  482. {
  483. Application->MessageBox(FrmLang->lblRegErr3->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\nVMS 유형을 알수 없습니다. VMS 크기 유형을 먼저 선택하세요.",
  484. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  485. return;
  486. }
  487. String sVmsType = pVmsSizeType->TypeCd;
  488. TVMSEDT0M *pFrmEdt = new TVMSEDT0M(this);
  489. pFrmEdt->FVmsTypeCd = sVmsType;
  490. pFrmEdt->FScheType = String(nTag);
  491. pFrmEdt->FFormId = sFormId;
  492. pFrmEdt->FMode = sMode;
  493. pFrmEdt->FVmsNmbr = "";
  494. pFrmEdt->ShowModal();
  495. bool bOk = pFrmEdt->FSelected;
  496. delete pFrmEdt;
  497. pFrmEdt = NULL;
  498. if (bOk)
  499. {
  500. DisplayInfo();
  501. }
  502. VmsManager->LoadVmsFormUsage();
  503. FRAMEVmsSchList1->RefreshVmsFormUsage();
  504. }
  505. //---------------------------------------------------------------------------
  506. void __fastcall TVMSM700M::BtnSaveClick(TObject *Sender)
  507. {
  508. //작업한 스케줄 정보를 저장한다.
  509. if (EdVmsNmbr->Text.Trim().IsEmpty())
  510. {
  511. Application->MessageBox(lblErr2->Caption.c_str(),//L"VMS 고정 스케줄 관리\r\nVMS 목록에서 VMS를 먼저 선택한 후 작업을 진행하세요.",
  512. FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  513. return;
  514. }
  515. bool bUpdate = true;
  516. String sVmsNmbr = EdVmsNmbr->Text.Trim();
  517. if (bUpdate)
  518. {
  519. String sMsg;
  520. sMsg = "VMS: " + sVmsNmbr;
  521. sMsg+= "\r\n" + lblErr3->Caption;//선택한 VMS의 고정 스케줄 정보를 저장하시겠습니까?";
  522. if (Application->MessageBox(sMsg.c_str(), FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  523. }
  524. try
  525. {
  526. ITSDb_GetConnection()->BeginTrans();
  527. DeleteVmsFixedScenario(sVmsNmbr);
  528. for (int ii = 0; ii < MAX_FORM_SCHED; ii++)
  529. {
  530. if (FListSch[ii]) SaveVmsFixedScenario(sVmsNmbr, FListSch[ii]);
  531. }
  532. }
  533. __finally
  534. {
  535. ITSDb_GetConnection()->CommitTrans();
  536. }
  537. Application->MessageBox(lblErr4->Caption.c_str(),//L"VMS 고정 스케줄 관리\r\nVMS 고정 스케줄 정보를 저장 하였습니다.",
  538. FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  539. VmsManager->LoadVmsFormUsage();
  540. FRAMEVmsSchList1->RefreshVmsFormUsage();
  541. CMM_SetGridRow(FRAMEVmsSchList1->CxList, FRAMEVmsSchList1->TvList, sVmsNmbr, FRAMEVmsSchList1->Column01->Index);
  542. DisplayInfo();
  543. }
  544. //---------------------------------------------------------------------------
  545. bool __fastcall TVMSM700M::SaveVmsFixedScenario(String AVmsNmbr, TcxGridTableView *AListSch)
  546. {
  547. bool bResult = false;
  548. String sQry;
  549. TADOQuery *pADO = NULL;
  550. TcxDataController *pGDC = AListSch->DataController;
  551. String sTypeCd = String(AListSch->Tag);
  552. sQry = "INSERT INTO TB_VMS_TRFC_INFR_DSPL_SCH ( \r\n"
  553. " VMS_CTLR_NMBR, \r\n"
  554. " TRFC_SITU_TYPE_CD, \r\n"
  555. " PHASE, \r\n"
  556. " VMS_FORM_ID, \r\n"
  557. " VMS_FORM_PRRT_CD, \r\n"
  558. " DSPL_HH, \r\n"
  559. " DSPL_STRT_HH, \r\n"
  560. " DSPL_END_HH, \r\n"
  561. " FRST_VMS_IFSC_ID, \r\n"
  562. " SECD_VMS_IFSC_ID, \r\n"
  563. " THIR_VMS_IFSC_ID, \r\n"
  564. " FOUR_VMS_IFSC_ID, \r\n"
  565. " USE_YN \r\n"
  566. " ) \r\n"
  567. " VALUES( \r\n"
  568. " :p01, :p02, :p03, \r\n"
  569. " :p04, :p05, :p06, \r\n"
  570. " :p07, :p08, :p09, \r\n"
  571. " :p10, :p11, :p12, \r\n"
  572. " :p13 \r\n"
  573. " ) \r\n";
  574. try
  575. {
  576. AListSch->BeginUpdate();
  577. pGDC->BeginUpdate();
  578. int nRows = pGDC->RecordCount;
  579. try
  580. {
  581. pADO = new TADOQuery(NULL);
  582. pADO->Close();
  583. pADO->Connection = ITSDb_GetConnection();
  584. ITSDb_SQLText(pADO, sQry);
  585. for (int ii = 0; ii < nRows; ii++)
  586. {
  587. String sFormId = VarToStr(pGDC->Values[ii][0]);
  588. String sDispHH = VarToStr(pGDC->Values[ii][3]);
  589. String sUseYn = VarToStr(pGDC->Values[ii][6]);
  590. String sStrTime = VarToStr(pGDC->Values[ii][7]);
  591. String sEndTime = VarToStr(pGDC->Values[ii][8]);
  592. String sIfscId1 = VarToStr(pGDC->Values[ii][ 9]);
  593. String sIfscId2 = VarToStr(pGDC->Values[ii][10]);
  594. String sIfscId3 = VarToStr(pGDC->Values[ii][11]);
  595. String sIfscId4 = VarToStr(pGDC->Values[ii][12]);
  596. String sPrrtCd = "";
  597. ITSDb_SQLBind(pADO, "p01", AVmsNmbr);
  598. ITSDb_SQLBind(pADO, "p02", sTypeCd);
  599. ITSDb_SQLBind(pADO, "p03", String(ii+1));
  600. ITSDb_SQLBind(pADO, "p04", sFormId);
  601. ITSDb_SQLBind(pADO, "p05", sPrrtCd);
  602. ITSDb_SQLBind(pADO, "p06", sDispHH);
  603. ITSDb_SQLBind(pADO, "p07", sStrTime);
  604. ITSDb_SQLBind(pADO, "p08", sEndTime);
  605. ITSDb_SQLBind(pADO, "p09", sIfscId1);
  606. ITSDb_SQLBind(pADO, "p10", sIfscId2);
  607. ITSDb_SQLBind(pADO, "p11", sIfscId3);
  608. ITSDb_SQLBind(pADO, "p12", sIfscId4);
  609. ITSDb_SQLBind(pADO, "p13", sUseYn);
  610. pADO->ExecSQL();
  611. }
  612. bResult = true;
  613. }
  614. catch(EDatabaseError &E)
  615. {
  616. ITSDb_GetConnection()->RollbackTrans();
  617. DBERRORMSG("VMS Fixed Schedule Save", String(E.ClassName()), E.Message, sQry);
  618. throw Exception(String(E.ClassName()) + E.Message);
  619. }
  620. catch(Exception &e)
  621. {
  622. ITSDb_GetConnection()->RollbackTrans();
  623. DBERRORMSG("VMS Fixed Schedule Save", String(e.ClassName()), e.Message, sQry);
  624. throw Exception(String(e.ClassName()) + e.Message);
  625. }
  626. }
  627. __finally
  628. {
  629. if (pADO)
  630. {
  631. pADO->Close();
  632. delete pADO;
  633. }
  634. pGDC->EndUpdate();
  635. AListSch->EndUpdate();
  636. }
  637. return bResult;
  638. }
  639. //---------------------------------------------------------------------------
  640. bool __fastcall TVMSM700M::DeleteVmsFixedScenario(String AVmsNmbr)
  641. {
  642. bool bResult = false;
  643. String sQry;
  644. TADOQuery *pADO = NULL;
  645. sQry = "DELETE TB_VMS_TRFC_INFR_DSPL_SCH \r\n"
  646. " WHERE VMS_CTLR_NMBR = :p01 \r\n"
  647. " AND TRFC_SITU_TYPE_CD IN ('5') \r\n";
  648. try
  649. {
  650. try
  651. {
  652. pADO = new TADOQuery(NULL);
  653. pADO->Close();
  654. pADO->Connection = ITSDb_GetConnection();
  655. ITSDb_SQLText(pADO, sQry);
  656. ITSDb_SQLBind(pADO, "p01", AVmsNmbr);
  657. pADO->ExecSQL();
  658. bResult = true;
  659. }
  660. catch(EDatabaseError &E)
  661. {
  662. ITSDb_GetConnection()->RollbackTrans();
  663. DBERRORMSG("VMS Fixed Schedule Delete", String(E.ClassName()), E.Message, sQry);
  664. throw Exception(String(E.ClassName()) + E.Message);
  665. }
  666. catch(Exception &e)
  667. {
  668. ITSDb_GetConnection()->RollbackTrans();
  669. DBERRORMSG("VMS Fixed Schedule Delete", String(e.ClassName()), e.Message, sQry);
  670. throw Exception(String(e.ClassName()) + e.Message);
  671. }
  672. }
  673. __finally
  674. {
  675. if (pADO)
  676. {
  677. pADO->Close();
  678. delete pADO;
  679. }
  680. }
  681. return bResult;
  682. }
  683. //---------------------------------------------------------------------------