FRAME_ProcessStatusListF.cpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "CDSProcessF.h"
  6. #include "FrmResourceF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "FRAME_ProcessStatusListF.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxClasses"
  13. #pragma link "cxControls"
  14. #pragma link "cxCustomData"
  15. #pragma link "cxData"
  16. #pragma link "cxDataStorage"
  17. #pragma link "cxEdit"
  18. #pragma link "cxFilter"
  19. #pragma link "cxGraphics"
  20. #pragma link "cxGrid"
  21. #pragma link "cxGridCustomTableView"
  22. #pragma link "cxGridCustomView"
  23. #pragma link "cxGridLevel"
  24. #pragma link "cxGridTableView"
  25. #pragma link "cxLookAndFeelPainters"
  26. #pragma link "cxLookAndFeels"
  27. #pragma link "cxStyles"
  28. #pragma link "cxTextEdit"
  29. #pragma link "dxSkinBlack"
  30. #pragma link "dxSkinBlue"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinscxPCPainter"
  33. #pragma resource "*.dfm"
  34. //TFRAMEProcessStatusList *FRAMEProcessStatusList;
  35. //---------------------------------------------------------------------------
  36. __fastcall TFRAMEProcessStatusList::TFRAMEProcessStatusList(TComponent* Owner)
  37. : TFrame(Owner)
  38. {
  39. LangTrans->Translate(this, ITSDb_GetConnection());
  40. m_pGDC = TvList->DataController;
  41. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<프로세스 정보가 없습니다>";
  42. FCodeCMS = ItsCodeManager->FLists.Find("CMS");
  43. FCodeCDS = ItsCodeManager->FLists.Find("CDS");
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TFRAMEProcessStatusList::UpdateList()
  47. {
  48. CMM_ClearGridTableView(TvList);
  49. int nRow = 0;
  50. try
  51. {
  52. TvList->BeginUpdate();
  53. TItsSubCode *pSubCode;
  54. try
  55. {
  56. ItsProcessManager->FLists.Lock();
  57. FOR_STL(TItsProcess*, pObj, ItsProcessManager->FLists)
  58. {
  59. pObj->FGridIndex = -1;
  60. if (pObj->DEL_YN == "Y") continue;
  61. if (pObj->STTS_DSPL_YN == "N") continue;
  62. nRow = m_pGDC->AppendRecord();
  63. pObj->FGridIndex = nRow;
  64. #if 0
  65. String sCMS = pObj->CommStatus;
  66. if (FCodeCMS)
  67. {
  68. pSubCode = FCodeCMS->FSubLists.Find(sCMS);
  69. if (pSubCode) sCMS = pSubCode->CMMN_CD_KOR_NM;
  70. }
  71. String sCDS = pObj->DoorStatus;
  72. if (FCodeCDS)
  73. {
  74. pSubCode = FCodeCDS->FSubLists.Find(sCDS);
  75. if (pSubCode) sCDS = pSubCode->CMMN_CD_KOR_NM;
  76. }
  77. #endif
  78. m_pGDC->Values[nRow][Column00->Index] = pObj->SYST_TYPE;
  79. m_pGDC->Values[nRow][Column01->Index] = pObj->SYST_NM;
  80. m_pGDC->Values[nRow][Column02->Index] = pObj->SYST_ID;
  81. m_pGDC->Values[nRow][Column03->Index] = pObj->CommStatus;
  82. m_pGDC->Values[nRow][Column04->Index] = pObj->CommStatus;
  83. //m_pGDC->Values[nRow][Column99->Index] = 0;
  84. }
  85. }
  86. __finally
  87. {
  88. ItsProcessManager->FLists.UnLock();
  89. }
  90. }
  91. __finally
  92. {
  93. TvList->EndUpdate();
  94. }
  95. }
  96. //---------------------------------------------------------------------------
  97. void __fastcall TFRAMEProcessStatusList::RefreshList()
  98. {
  99. int nRow = 0;
  100. try
  101. {
  102. int nTotalRows = m_pGDC->RecordCount;
  103. TvList->BeginUpdate();
  104. TItsSubCode *pSubCode;
  105. try
  106. {
  107. ItsProcessManager->FLists.Lock();
  108. FOR_STL(TItsProcess*, pObj, ItsProcessManager->FLists)
  109. {
  110. if (pObj->DEL_YN == "Y") continue;
  111. if (pObj->STTS_DSPL_YN == "N") continue;
  112. if (pObj->FGridIndex < 0) continue;
  113. nRow = pObj->FGridIndex;
  114. #if 0
  115. String sCMS = pObj->CommStatus;
  116. if (FCodeCMS)
  117. {
  118. pSubCode = FCodeCMS->FSubLists.Find(sCMS);
  119. if (pSubCode) sCMS = pSubCode->CMMN_CD_KOR_NM;
  120. }
  121. #endif
  122. m_pGDC->Values[nRow][Column03->Index] = pObj->CommStatus;
  123. m_pGDC->Values[nRow][Column04->Index] = pObj->CommStatus;
  124. }
  125. }
  126. __finally
  127. {
  128. ItsProcessManager->FLists.UnLock();
  129. }
  130. }
  131. __finally
  132. {
  133. TvList->EndUpdate();
  134. }
  135. }
  136. //---------------------------------------------------------------------------
  137. void __fastcall TFRAMEProcessStatusList::Column03CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  138. bool &ADone)
  139. {
  140. if (AViewInfo->GridRecord->RecordIndex < 0) return;
  141. Graphics::TBitmap *pBmp = NULL;
  142. pBmp = ImgState1->Picture->Bitmap;
  143. if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[Column03->Index]))
  144. {
  145. String sCode = AViewInfo->GridRecord->DisplayTexts[Column03->Index];
  146. if (sCode == "0") pBmp = ImgState1->Picture->Bitmap;
  147. else if (sCode == "1") pBmp = ImgState0->Picture->Bitmap;
  148. else if (sCode == "2") pBmp = ImgState2->Picture->Bitmap;
  149. }
  150. if (!pBmp) return;
  151. pBmp->Transparent = true;
  152. int nW, nH;
  153. nW = nH = 21;
  154. try
  155. {
  156. TColor bBrush = ACanvas->Brush->Color;
  157. if (AViewInfo->GridRecord->Selected)
  158. {
  159. if (AViewInfo->GridRecord->Index % 2 == 0)
  160. {
  161. bBrush = Sender->LookAndFeelPainter->DefaultContentEvenColor();
  162. }
  163. else
  164. {
  165. bBrush = Sender->LookAndFeelPainter->DefaultContentOddColor();
  166. }
  167. }
  168. ACanvas->Brush->Color = bBrush;
  169. TRect rc;
  170. TRect rcOrg = AViewInfo->Bounds;
  171. ACanvas->FillRect(rcOrg);
  172. nW = rcOrg.Bottom - rcOrg.Top - 4;
  173. rc.Top = rcOrg.Top+2;
  174. rc.Bottom = rcOrg.Bottom - 2;
  175. rc.Left = rcOrg.Left + (rcOrg.Width() - nW) / 2;
  176. rc.Right = rc.Left + nW;
  177. ACanvas->Canvas->StretchDraw(rc, pBmp);
  178. //ACanvas->Draw(AViewInfo->ContentBounds.Left, AViewInfo->ContentBounds.Top, pBmp);
  179. ADone = true;
  180. }
  181. catch(...) {}
  182. }
  183. //---------------------------------------------------------------------------
  184. void __fastcall TFRAMEProcessStatusList::TvListCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  185. bool &ADone)
  186. {
  187. //OptionsSelection.InvertSelect = False
  188. //OptionsView.FocusRect = False
  189. if (AViewInfo->GridRecord->Selected)
  190. {
  191. //ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentColor();
  192. //ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  193. if (AViewInfo->GridRecord->Index % 2 == 0)
  194. {
  195. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentEvenColor();
  196. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  197. }
  198. else
  199. {
  200. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentOddColor();
  201. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  202. }
  203. }
  204. else
  205. {
  206. }
  207. }
  208. //---------------------------------------------------------------------------