VMSM520MF.cpp 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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 "ITSLangTransF.h"
  16. #pragma hdrstop
  17. #include "VMSM520MF.h"
  18. //---------------------------------------------------------------------------
  19. #pragma package(smart_init)
  20. #pragma link "cxButtons"
  21. #pragma link "cxCalendar"
  22. #pragma link "cxContainer"
  23. #pragma link "cxControls"
  24. #pragma link "cxDropDownEdit"
  25. #pragma link "cxEdit"
  26. #pragma link "cxGraphics"
  27. #pragma link "cxGroupBox"
  28. #pragma link "cxLabel"
  29. #pragma link "cxLookAndFeelPainters"
  30. #pragma link "cxLookAndFeels"
  31. #pragma link "cxMaskEdit"
  32. #pragma link "cxPC"
  33. #pragma link "cxPCdxBarPopupMenu"
  34. #pragma link "cxSpinEdit"
  35. #pragma link "cxSplitter"
  36. #pragma link "cxTextEdit"
  37. #pragma link "cxTimeEdit"
  38. #pragma link "dxSkinBlack"
  39. #pragma link "dxSkinBlue"
  40. #pragma link "dxSkinCaramel"
  41. #pragma link "dxSkinCoffee"
  42. #pragma link "dxSkinDarkRoom"
  43. #pragma link "dxSkinDarkSide"
  44. #pragma link "dxSkinFoggy"
  45. #pragma link "dxSkinGlassOceans"
  46. #pragma link "dxSkiniMaginary"
  47. #pragma link "dxSkinLilian"
  48. #pragma link "dxSkinLiquidSky"
  49. #pragma link "dxSkinLondonLiquidSky"
  50. #pragma link "dxSkinMcSkin"
  51. #pragma link "dxSkinMoneyTwins"
  52. #pragma link "dxSkinOffice2007Black"
  53. #pragma link "dxSkinOffice2007Blue"
  54. #pragma link "dxSkinOffice2007Green"
  55. #pragma link "dxSkinOffice2007Pink"
  56. #pragma link "dxSkinOffice2007Silver"
  57. #pragma link "dxSkinOffice2010Black"
  58. #pragma link "dxSkinOffice2010Blue"
  59. #pragma link "dxSkinOffice2010Silver"
  60. #pragma link "dxSkinsCore"
  61. #pragma link "dxSkinscxPCPainter"
  62. #pragma link "dxSkinSeven"
  63. #pragma link "dxSkinSharp"
  64. #pragma link "dxSkinSilver"
  65. #pragma link "dxSkinStardust"
  66. #pragma link "cxRadioGroup"
  67. #pragma link "cxClasses"
  68. #pragma link "cxCustomData"
  69. #pragma link "cxData"
  70. #pragma link "cxDataStorage"
  71. #pragma link "cxDBData"
  72. #pragma link "cxFilter"
  73. #pragma link "cxGrid"
  74. #pragma link "cxGridCustomTableView"
  75. #pragma link "cxGridCustomView"
  76. #pragma link "cxGridDBTableView"
  77. #pragma link "cxGridLevel"
  78. #pragma link "cxGridTableView"
  79. #pragma link "cxStyles"
  80. #pragma link "cxCheckBox"
  81. #pragma link "cxImage"
  82. #pragma link "cxButtonEdit"
  83. #pragma link "cxBlobEdit"
  84. #pragma resource "*.dfm"
  85. TVMSM520M *VMSM520M = NULL;
  86. //---------------------------------------------------------------------------
  87. __fastcall TVMSM520M::TVMSM520M(TComponent* Owner)
  88. : TForm(Owner)
  89. {
  90. LangTrans->Translate(this, ITSDb_GetConnection());
  91. ITSSkin_Load(this);
  92. //CMM_LoadForm(g_sFormsDir, this);
  93. FUpdate= false;
  94. FTitle = Caption;//"VMS 폼 유형 선택";
  95. FListSymb = new TList;
  96. EditMode = false;
  97. m_bSelected = false;
  98. TvList->OptionsView->DataRowHeight = 0;
  99. TvList->OptionsView->CellAutoHeight = true;
  100. TvList->OptionsView->Indicator = true;
  101. TvList->OptionsCustomize->ColumnMoving = false;
  102. TvList->OptionsCustomize->ColumnSorting = false;
  103. TvList->Columns[0]->Width = 60;
  104. TvList->Columns[0]->Options->HorzSizing = false;
  105. }
  106. //---------------------------------------------------------------------------
  107. /*
  108. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  109. * Form과 DataModule class를 delete시킨다.
  110. * arguments
  111. *
  112. * return
  113. * void
  114. */
  115. void __fastcall TVMSM520M::CommClose()
  116. {
  117. try
  118. {
  119. ClearSymbloList();
  120. SAFE_DELETE(FListSymb);
  121. //CMM_SaveForm(g_sFormsDir, this);
  122. }
  123. catch(...)
  124. {
  125. }
  126. }
  127. //---------------------------------------------------------------------------
  128. /*
  129. * Form을 보여줄때 호출되는 event 메서드이다.
  130. * arguments
  131. * Sender : event handler 객체
  132. * return
  133. * void
  134. */
  135. void __fastcall TVMSM520M::FormShow(TObject *Sender)
  136. {
  137. Refresh();
  138. FormInit();
  139. TmrShow->Enabled = true;
  140. }
  141. //---------------------------------------------------------------------------
  142. /*
  143. * form 초기화
  144. *
  145. * arguments
  146. *
  147. * return
  148. * void
  149. */
  150. void __fastcall TVMSM520M::FormInit()
  151. {
  152. EdNmbr->Text = "";
  153. ImgPreView->Picture->Bitmap->FreeImage();
  154. ImgPreView->Picture->Bitmap = NULL;
  155. FillVmsFormType();
  156. FNewDb = false;
  157. }
  158. //---------------------------------------------------------------------------
  159. void __fastcall TVMSM520M::FillVmsFormType()
  160. {
  161. String sQry;
  162. TADOQuery *pADO = NULL;
  163. CMM_ClearGridTableView(TvList);
  164. sQry = "SELECT VMS_FORM_TYPE_CD AS CD, \r\n"
  165. " VMS_FORM_TYPE_NM AS NM, \r\n"
  166. " EDTN_CD \r\n"
  167. " FROM TB_VMS_FORM_TYPE \r\n"
  168. " ORDER BY CD ASC \r\n";
  169. try
  170. {
  171. int nRow;
  172. TcxDataController *pGDC = TvList->DataController;
  173. TvList->BeginUpdate();
  174. try
  175. {
  176. pADO = new TADOQuery(NULL);
  177. pADO->Close();
  178. pADO->Connection = ITSDb_GetConnection();
  179. ITSDb_SQLText(pADO, sQry);
  180. ITSDb_SQLOpen(pADO);
  181. for( ; !pADO->Eof; pADO->Next())
  182. {
  183. String sUse = pADO->FieldByName("EDTN_CD")->AsString;
  184. if (sUse == "EDI2") continue;
  185. String sCd = pADO->FieldByName("CD")->AsString;
  186. String sNm = pADO->FieldByName("NM")->AsString;
  187. nRow = pGDC->AppendRecord();
  188. pGDC->Values[nRow][ColLink1->Index] = sCd;
  189. pGDC->Values[nRow][ColLink3->Index] = sNm;
  190. }
  191. }
  192. catch(EDatabaseError &E)
  193. {
  194. DBERRORMSG("FillVmsFormType", String(E.ClassName()), E.Message, sQry);
  195. throw Exception(String(E.ClassName()) + E.Message);
  196. }
  197. catch(Exception &exception)
  198. {
  199. DBERRORMSG("FillVmsFormType", String(exception.ClassName()), exception.Message, sQry);
  200. throw Exception(String(exception.ClassName()) + exception.Message);
  201. }
  202. }
  203. __finally
  204. {
  205. if (pADO)
  206. {
  207. pADO->Close();
  208. delete pADO;
  209. }
  210. TvList->EndUpdate();
  211. }
  212. }
  213. //---------------------------------------------------------------------------
  214. /*
  215. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  216. * arguments
  217. * Sender : event handler 객체
  218. * return
  219. * void
  220. */
  221. void __fastcall TVMSM520M::TmrShowTimer(TObject *Sender)
  222. {
  223. TmrShow->Enabled = false;
  224. }
  225. //---------------------------------------------------------------------------
  226. /*
  227. * Close 버튼 클릭 이벤트 핸들러
  228. * arguments
  229. * Sender : event handler 객체
  230. * return
  231. * void
  232. */
  233. void __fastcall TVMSM520M::BtnCloseClick(TObject *Sender)
  234. {
  235. Close();
  236. }
  237. //---------------------------------------------------------------------------
  238. void __fastcall TVMSM520M::FormClose(TObject *Sender, TCloseAction &Action)
  239. {
  240. CommClose();
  241. VMSM520M = NULL;
  242. Action = caFree;
  243. }
  244. //---------------------------------------------------------------------------
  245. void __fastcall TVMSM520M::FormCloseQuery(TObject *Sender, bool &CanClose)
  246. {
  247. //
  248. }
  249. //---------------------------------------------------------------------------
  250. void __fastcall TVMSM520M::DisplayInfo()
  251. {
  252. //FormInit();
  253. int nRow = TvList->DataController->FocusedRecordIndex;
  254. if( nRow <= -1 )
  255. return;
  256. TcxGridDataController *pDc = TvList->DataController;
  257. nRow = pDc->FocusedRecordIndex;
  258. #if 0
  259. if (nRow < FListSymb->Count)
  260. {
  261. Graphics::TBitmap *bitmap = (Graphics::TBitmap*)FListSymb->Items[nRow];
  262. ImgPreView->Picture->Bitmap->Assign(bitmap);
  263. }
  264. #endif
  265. EdNmbr->Text = VarToStr(pDc->Values[nRow][ColLink1->Index]);
  266. }
  267. //---------------------------------------------------------------------------
  268. void __fastcall TVMSM520M::ClearSymbloList()
  269. {
  270. for(int ii = 0; ii < FListSymb->Count; ii++)
  271. {
  272. Graphics::TBitmap *bitmap = (Graphics::TBitmap *)FListSymb->Items[ii];
  273. delete bitmap;
  274. }
  275. FListSymb->Clear();
  276. }
  277. //---------------------------------------------------------------------------
  278. void __fastcall TVMSM520M::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  279. TMouseButton AButton, TShiftState AShift,
  280. bool &AHandled)
  281. {
  282. if (!ACellViewInfo) return;
  283. DisplayInfo();
  284. //Sleep(200);
  285. BtnSelImageClick((TObject*)BtnSelImage);
  286. }
  287. //---------------------------------------------------------------------------
  288. void __fastcall TVMSM520M::TvListFocusedRecordChanged(TcxCustomGridTableView *Sender,
  289. TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord,
  290. bool ANewItemRecordFocusingChanged)
  291. {
  292. if (!AFocusedRecord) return;
  293. DisplayInfo();
  294. }
  295. //---------------------------------------------------------------------------
  296. void __fastcall TVMSM520M::BtnSelImageClick(TObject *Sender)
  297. {
  298. if (EdNmbr->Text == "")
  299. {
  300. Application->MessageBox(lblText1->Caption.c_str(),//L"VMS 폼 유형 선택\r\nVMS 폼 유형 목록에서 선택하세요.",
  301. FTitle.c_str(),
  302. MB_OK|MB_ICONERROR|MB_APPLMODAL);
  303. return;
  304. }
  305. m_bSelected = true;
  306. Close();
  307. }
  308. //---------------------------------------------------------------------------