ProcessAlarm.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. // ProcessAlarm.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ProcessAlarm.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "NeroDlg.h"
  9. #include "ClientRequirement.h"
  10. #include "./helper/ffsco.h"
  11. #include "TakeMoney4.h"
  12. #include "AlarmDays.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. #pragma comment(lib, "Shlwapi.lib")
  19. /////////////////////////////////////////////////////////////////////////////
  20. // ProcessAlarm
  21. IMPLEMENT_DYNCREATE(ProcessAlarm, MyFormView)
  22. ProcessAlarm::ProcessAlarm()
  23. : MyFormView(ProcessAlarm::IDD)
  24. {
  25. //{{AFX_DATA_INIT(ProcessAlarm)
  26. m_filter = _T("");
  27. m_check1 = FALSE;
  28. m_check2 = FALSE;
  29. //}}AFX_DATA_INIT
  30. }
  31. ProcessAlarm::~ProcessAlarm()
  32. {
  33. }
  34. void ProcessAlarm::DoDataExchange(CDataExchange* pDX)
  35. {
  36. MyFormView::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(ProcessAlarm)
  38. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  39. DDX_Control(pDX, IDC_LIST2, m_List1);
  40. DDX_Control(pDX, IDC_STATIC1, m_static1);
  41. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  42. DDX_Check(pDX, IDC_CHECK1, m_check1);
  43. DDX_Check(pDX, IDC_CHECK2, m_check2);
  44. //}}AFX_DATA_MAP
  45. }
  46. BEGIN_MESSAGE_MAP(ProcessAlarm, MyFormView)
  47. //{{AFX_MSG_MAP(ProcessAlarm)
  48. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  49. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  50. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  51. ON_WM_TIMER()
  52. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  53. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  54. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  55. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  56. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  57. ON_BN_CLICKED(IDC_BUTburncd, OnBUTProcessAlarm)
  58. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  59. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  60. ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
  61. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  62. ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
  63. //}}AFX_MSG_MAP
  64. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  65. END_MESSAGE_MAP()
  66. /////////////////////////////////////////////////////////////////////////////
  67. // ProcessAlarm diagnostics
  68. #ifdef _DEBUG
  69. void ProcessAlarm::AssertValid() const
  70. {
  71. MyFormView::AssertValid();
  72. }
  73. void ProcessAlarm::Dump(CDumpContext& dc) const
  74. {
  75. MyFormView::Dump(dc);
  76. }
  77. #endif //_DEBUG
  78. /////////////////////////////////////////////////////////////////////////////
  79. // ProcessAlarm message handlers
  80. void ProcessAlarm::OnInitialUpdate()
  81. {
  82. MyFormView::OnInitialUpdate();
  83. // TODO: Add your specialized code here and/or call the base class
  84. CMyMdi Mdi;
  85. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  86. GetDlgItem(IDC_BUTburncd2)->EnableWindow(IsHasRights2new(49));
  87. // Here we create the outbar control using the splitter as its parent
  88. // and setting its id to the first pane.
  89. tmdoday = ::GetTmFromStr(g_date);
  90. //tmdt tmdindan
  91. CRect rc2;
  92. GetWindowRect(rc2);
  93. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  94. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  95. m_static1.SetFont(&g_titlefont);
  96. #ifdef CHILD_VERSION
  97. m_List1.SetHeadings("订单号,109;家长姓名,85;宝宝姓名,85;门市,85;订单日期,86;拍照时间,86;选片时间,86;拍照,70;拍完,70;选片,50;看样,50;件齐,50;取走,50;手机,100;固定电话,100");
  98. #else
  99. m_List1.SetHeadings("订单号,109;男宾姓名,85;女宾姓名,85;门市,85;订单日期,86;拍照时间,86;选片时间,86;拍照,70;拍完,70;选片,50;看样,50;件齐,50;取走,50;男宾电话,100;女宾电话,100" );
  100. #endif
  101. m_List1.LoadColumnInfo(303);
  102. // 获取alarmview视图数据,并转换;
  103. g_sendhead.bsql = 0;
  104. g_sendhead.code[0] = 229; // alarmview需要重新设计;
  105. g_sendhead.tabcount = 1;
  106. g_pMainWnd->ProcessChatMessageRequest2(1);
  107. if (g_bSendOK == 0) return;
  108. DataToArray(&m_List1array);
  109. // 初始化列表框数据记录;
  110. FillGrid();
  111. m_combo1.GetWindowRect(rc2);
  112. ScreenToClient(rc2);
  113. rc2.bottom += 200;
  114. m_combo1.MoveWindow(rc2);
  115. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  116. SetComboHei(&m_combo1, rc2.Height());
  117. }
  118. void ProcessAlarm::FillGrid(BOOL bStatus)//对list列表框初始化数据记录;
  119. {
  120. HidePrice();
  121. m_List1.DeleteAllItems2();
  122. int ii = 0;
  123. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  124. //m_List1.m_arLabels.SetSize( m_List1array.GetSize()-2, 1 );
  125. int count = 0;
  126. if (m_filter.IsEmpty())
  127. {
  128. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  129. {
  130. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  131. }
  132. }
  133. else
  134. {
  135. int type = GetType(m_filter);
  136. if (type == 1)//电话
  137. {
  138. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  139. {
  140. if (m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || \
  141. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1)
  142. {
  143. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  144. }
  145. }
  146. }
  147. else if (type == 2)//手机、固话;
  148. {
  149. m_filter.MakeUpper();
  150. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  151. {
  152. if (m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || \
  153. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1)
  154. {
  155. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  156. }
  157. }
  158. }
  159. else
  160. {
  161. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  162. {
  163. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  164. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  165. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  166. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  167. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  168. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || \
  169. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || \
  170. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1)
  171. {
  172. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  173. }
  174. }
  175. }
  176. }
  177. m_List1.m_arLabels.SetSize(count, 1);
  178. ii = count;
  179. m_List1.m_LabelCount = ii;
  180. m_List1.SetItemCountEx(ii);
  181. CString str;
  182. str.Format("单数:%d", ii);
  183. SetDlgItemText(IDC_STATIC2, str);
  184. if (!g_id.IsEmpty())
  185. {
  186. for (int i = 0; i < m_List1.GetItemCount(); i++)
  187. {
  188. if (g_id == m_List1.GetItemText(i, 0))
  189. {
  190. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  191. m_List1.EnsureVisible(i, FALSE);
  192. break;
  193. }
  194. }
  195. }
  196. }
  197. void ProcessAlarm::OnBUTclose()
  198. {
  199. GetParent()->SendMessage(WM_CLOSE);
  200. }
  201. void ProcessAlarm::OnSelchangeCombo1()
  202. {
  203. SetTimer(1, 100, NULL);
  204. }
  205. void ProcessAlarm::OnTimer(UINT nIDEvent)
  206. {
  207. KillTimer(nIDEvent);
  208. OnButton1();
  209. }
  210. BOOL ProcessAlarm::PreTranslateMessage(MSG* pMsg)
  211. {
  212. try
  213. {
  214. if (pMsg->message == WM_KEYDOWN)
  215. {
  216. switch (pMsg->wParam)
  217. {
  218. case VK_RETURN:
  219. OnButton1();
  220. return 1;
  221. case 0x43: // copy
  222. if ((GetKeyState(VK_CONTROL) & 0x80))
  223. {
  224. GetFocus()->SendMessage(WM_COPY);
  225. return TRUE;
  226. }
  227. break;
  228. case 0x56: //Ctrl + V:
  229. if ((GetKeyState(VK_CONTROL) & 0x80))
  230. {
  231. GetFocus()->SendMessage(WM_PASTE);
  232. return TRUE;
  233. }
  234. break;
  235. case 0x58: // cut
  236. if ((GetKeyState(VK_CONTROL) & 0x80))
  237. {
  238. GetFocus()->SendMessage(WM_CUT);
  239. return TRUE;
  240. }
  241. break;
  242. case 0x5A: //undo
  243. case 0x59: //redo
  244. if ((GetKeyState(VK_CONTROL) & 0x80))
  245. {
  246. GetFocus()->SendMessage(WM_UNDO);
  247. return TRUE;
  248. }
  249. break;
  250. }
  251. }
  252. return MyFormView::PreTranslateMessage(pMsg);
  253. }
  254. catch (...)
  255. {
  256. }
  257. }
  258. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  259. void ProcessAlarm::GetSavePath(CString &path)
  260. {
  261. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  262. LPITEMIDLIST pidlDesktop, pidlCurrent;
  263. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop) == NOERROR)
  264. {
  265. BROWSEINFO bi;
  266. bi.hwndOwner = this->m_hWnd;
  267. bi.pidlRoot = pidlDesktop;
  268. bi.pszDisplayName = lpszDisplayName;
  269. bi.lpszTitle = "\n文档保存的目录:";
  270. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  271. bi.lpfn = BrowseProc;
  272. bi.lParam = 0;
  273. bi.iImage = 0;
  274. pidlCurrent = SHBrowseForFolder(&bi);
  275. SHGetPathFromIDList(pidlCurrent, szFileName);
  276. path = szFileName;
  277. }
  278. }
  279. int ProcessAlarm::FindArray(CStringArray *pArray, CString Str)
  280. {
  281. for (int i = 0; i < pArray->GetSize(); i++)
  282. {
  283. if (pArray->ElementAt(i) == Str)
  284. return i;
  285. }
  286. return -1;
  287. }
  288. //-----------------------------------------------------------------
  289. // remark by Jeff 2014-12-12
  290. // 函数:GetNo
  291. // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
  292. // 参数:
  293. // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
  294. // array:空的数组,用来存放解析后的相片名;
  295. // 返回:
  296. // 注意:更换分隔符造成的问题,在该函数已解决;
  297. //-----------------------------------------------------------------
  298. void ProcessAlarm::GetNo(CString str, CStringArray &array)
  299. {
  300. if (!str.IsEmpty())
  301. {
  302. #ifdef USE_SEP_VEB
  303. int pos = str.Find(SEPS_VEB);
  304. #else
  305. int pos = str.Find(",");
  306. #endif
  307. while (pos != -1)
  308. {
  309. if (FindArray(&array, str.Left(pos)) == -1)
  310. array.Add(str.Left(pos));
  311. str = str.Right(str.GetLength() - pos - 1);
  312. #ifdef USE_SEP_VEB
  313. pos = str.Find(SEPS_VEB);
  314. #else
  315. pos = str.Find(",");
  316. #endif
  317. }
  318. if (FindArray(&array, str) == -1)
  319. array.Add(str);
  320. }
  321. }
  322. //-----------------------------------------------------------------
  323. // remark by Jeff 2014-12-12
  324. // 函数:GetSelName
  325. // 描述:
  326. // 参数:
  327. // name:由GetNo解析出来后的单个相片名,如:"001"
  328. // spnamearray:订单下的商品数组,case 50所得;
  329. // 返回:
  330. // 注意:更换分隔符造成的问题,在该函数已解决;
  331. //-----------------------------------------------------------------
  332. CString ProcessAlarm::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  333. {
  334. CString ret;
  335. #ifdef USE_SEP_VEB
  336. name = SEPS_VEB + name + SEPS_VEB;
  337. #else
  338. name = "," + name + ",";
  339. #endif
  340. CString str;
  341. for (int i = 0; i < spnamearray.GetSize(); i++)
  342. {
  343. #ifdef USE_SEP_VEB
  344. str = SEPS_VEB + spnamearray.ElementAt(i).ElementAt(6) + SEPS_VEB;
  345. #else
  346. str = "," + spnamearray.ElementAt(i).ElementAt(6) + ",";
  347. #endif
  348. if (str.Find(name) != -1)
  349. {
  350. ret += spnamearray.ElementAt(i).ElementAt(5);
  351. ret += ";";
  352. }
  353. }
  354. ret.TrimRight(";");
  355. ret.Replace("*", "x");
  356. return ret;
  357. }
  358. void ProcessAlarm::OnBUTexportphoto()
  359. {
  360. }
  361. void ProcessAlarm::OnBUTimportphoto()
  362. {
  363. }
  364. void ProcessAlarm::OnBUTshowphoto()
  365. {
  366. }
  367. void ProcessAlarm::OnButton1()
  368. {
  369. UpdateData();
  370. m_filter.TrimLeft();
  371. m_filter.TrimRight();
  372. FillGrid();
  373. }
  374. void ProcessAlarm::OnButton2()
  375. {
  376. }
  377. void ProcessAlarm::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  378. {
  379. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  380. *pResult = 0;
  381. }
  382. void ProcessAlarm::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  383. {
  384. *pResult = 0;
  385. }
  386. void ProcessAlarm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  387. {
  388. POSITION pos;
  389. pos = m_List1.GetFirstSelectedItemPosition();
  390. if (pos == NULL)return;
  391. int iItem = m_List1.GetNextSelectedItem(pos);
  392. g_id = m_List1.GetItemText(iItem, 0);
  393. *pResult = 0;
  394. }
  395. void ProcessAlarm::HidePrice()
  396. {
  397. if (IsHasRights2new(31))return;
  398. for ( int i = 0; i < m_List1array.GetSize(); i++ )
  399. {
  400. m_List1array.ElementAt(i).SetAt(13, "***");
  401. m_List1array.ElementAt(i).SetAt(14, "***");
  402. }
  403. }
  404. //lYFZ
  405. void ProcessAlarm::OnCheck1()
  406. {
  407. UpdateData();
  408. FillGrid();
  409. }
  410. void ProcessAlarm::OnCheck2()
  411. {
  412. OnCheck1();
  413. }
  414. void ProcessAlarm::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
  415. {
  416. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
  417. // Take the default processing unless we set this to something else below.
  418. *pResult = 0;
  419. // First thing - check the draw stage. If it's the control's prepaint
  420. // stage, then tell Windows we want messages for every item.
  421. if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
  422. {
  423. *pResult = CDRF_NOTIFYITEMDRAW;
  424. }
  425. else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
  426. {
  427. // This is the prepaint stage for an item. Here's where we set the
  428. // item's text color. Our return value will tell Windows to draw the
  429. // item itself, but it will use the new color we set here.
  430. // We'll cycle the colors through red, green, and light blue.
  431. *pResult = CDRF_NOTIFYSUBITEMDRAW;
  432. /* if(pLVCD->nmcd.dwItemSpec%2)
  433. pLVCD->clrTextBk = g_gridcol1;
  434. else
  435. pLVCD->clrTextBk = g_gridcol2;
  436. if(pLVCD->nmcd.dwItemSpec==0)pLVCD->clrTextBk = RGB(220,0,0);
  437. if(pLVCD->nmcd.dwItemSpec==2)pLVCD->clrTextBk = RGB(20,133,20);
  438. */
  439. }
  440. else if ((CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
  441. {
  442. // This is the prepaint stage for a subitem. Here's where we set the
  443. // item's text and background colors. Our return value will tell
  444. // Windows to draw the subitem itself, but it will use the new colors
  445. // we set here.
  446. // The text color will cycle through red, green, and light blue.
  447. // The background color will be light blue for column 0, red for
  448. // column 1, and black for column 2.
  449. COLORREF crBkgnd;
  450. if (1)
  451. {
  452. if (pLVCD->nmcd.dwItemSpec % 2)
  453. crBkgnd = g_gridcol1;
  454. else
  455. crBkgnd = g_gridcol2;
  456. }
  457. #if 0
  458. static BOOL b1 = FALSE;
  459. static BOOL b2 = FALSE;
  460. static BOOL b3 = FALSE;
  461. static BOOL b4 = FALSE;
  462. static BOOL b5 = FALSE;
  463. if ( 7 == pLVCD->iSubItem ) // 拍照字段; **不修改对比时间
  464. {
  465. tmdindan= ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(4));
  466. tmdt=tmdoday-tmdindan;
  467. if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(141)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(7)=="未拍")
  468. {
  469. b1 = FALSE;
  470. crBkgnd = RGB(220,0,0); // 红
  471. }
  472. else
  473. {
  474. b1 = TRUE;
  475. crBkgnd = RGB(20,133,20); // 绿
  476. }
  477. }
  478. else if ( 8 == pLVCD->iSubItem ) // 拍完字段; **不修改对比时间
  479. {
  480. tmdindan= ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(4));
  481. tmdt=tmdoday-tmdindan;
  482. if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(142)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(8)=="未拍完" || b1==FALSE)
  483. //if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(142)) && b1==FALSE)
  484. {
  485. b2 = FALSE;
  486. crBkgnd = RGB(220,0,0);
  487. }
  488. else
  489. {
  490. b2 = TRUE;
  491. crBkgnd = RGB(20,133,20);
  492. }
  493. }
  494. else if ( 9 == pLVCD->iSubItem ) // 选片字段; **对比拍完时间
  495. {
  496. tmdindan= ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(5)); // (5).拍照时间 && 拍照状态=ok
  497. tmdt=tmdoday-tmdindan;
  498. //if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(143)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(9)!="OK" || b2==FALSE/*&& m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(8)=="未拍完"*/ )
  499. if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(143)) && b2==FALSE )
  500. {
  501. b3 = FALSE;
  502. crBkgnd = RGB(220,0,0);
  503. }
  504. else
  505. {
  506. b3 = TRUE;
  507. crBkgnd = RGB(20,133,20);
  508. }
  509. }
  510. else if ( 10 == pLVCD->iSubItem ) // 看样字段; **对比选完时间
  511. {
  512. tmdindan= ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6)); // (6).选片时间 && 选片状态=ok
  513. tmdt=tmdoday-tmdindan;
  514. //if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(144)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt (10)!="OK" || b3 == FALSE/* && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(9)=="未选"*/)
  515. if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(144)) && b3 == FALSE)
  516. {
  517. b4 = FALSE;
  518. crBkgnd = RGB(220,0,0);
  519. }
  520. else
  521. {
  522. b4 = TRUE;
  523. crBkgnd = RGB(20,133,20);
  524. }
  525. }
  526. else if ( 11 == pLVCD->iSubItem ) // 件齐字段; **对比选完时间
  527. {
  528. tmdindan= ::GetTmFromStr(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt(6)); // (6).选片时间 && 选片状态=ok
  529. tmdt=tmdoday-tmdindan;
  530. //if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(145)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt (11)!="OK" || b4==FALSE/* && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(9)=="未选"*/)
  531. if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(145)) && b4==FALSE)
  532. {
  533. b5 = FALSE;
  534. crBkgnd = RGB(220,0,0);
  535. }
  536. else
  537. {
  538. b5 = TRUE;
  539. crBkgnd = RGB(20,133,20);
  540. }
  541. }
  542. else if ( 12 == pLVCD->iSubItem ) // 取走字段; **对比选完时间
  543. {
  544. tmdindan= ::GetTmFromStr(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt(6)); // (6).选片时间 && 选片状态=ok
  545. tmdt=tmdoday-tmdindan;
  546. //if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(146)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt (12)=="未取" || b5==FALSE/*&& m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(9)=="未选"*/)
  547. if(tmdt.GetDays()>=atoi(g_cominfoarray.ElementAt(0).ElementAt(146)) && b5==FALSE)
  548. crBkgnd = RGB(220,0,0);
  549. else
  550. crBkgnd = RGB(20,133,20);
  551. }
  552. #else
  553. static BOOL b1 = FALSE;
  554. static BOOL b2 = FALSE;
  555. static BOOL b3 = FALSE;
  556. switch (pLVCD->iSubItem)
  557. {
  558. case 7:// 拍照字段; **不修改对比时间
  559. tmdindan = ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(4));
  560. tmdt = tmdoday - tmdindan;
  561. if (tmdt.GetDays() >= atoi(g_cominfoarray.ElementAt(0).ElementAt(141)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(7) == "未拍")
  562. {
  563. b1 = FALSE;
  564. crBkgnd = RGB(220, 0, 0); // 红
  565. }
  566. else
  567. {
  568. b1 = TRUE;
  569. crBkgnd = RGB(20, 133, 20); // 绿
  570. }
  571. break;
  572. case 8: // 拍完字段 red = !b1 && tmdt>(142) && 未拍完
  573. tmdindan = ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(4));
  574. //printf("Jeff:订单号:%s,订单时间:%s\n\n",m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(1),m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(4));//Jeff Printf;
  575. //printf("Jeff:订单号;%s,订单时间:%s,订单后%s天\n\n",m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(1),m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(4),g_cominfoarray.ElementAt(0).ElementAt(142));//Jeff Printf;
  576. tmdt = tmdoday - tmdindan;
  577. //printf("Jeff:离订单时间后:%d天\n\n",tmdt.GetDays());// Jeff Printf;
  578. if ( /*b1==FALSE ||*/ tmdt.GetDays() >= atoi(g_cominfoarray.ElementAt(0).ElementAt(142)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(8) == "未拍完")
  579. {
  580. b2 = FALSE;
  581. crBkgnd = RGB(220, 0, 0);
  582. }
  583. else
  584. {
  585. b2 = TRUE;
  586. crBkgnd = RGB(20, 133, 20);
  587. }
  588. break;
  589. case 9: // 选片字段
  590. if (m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(5) == "") // 拍照时间空;
  591. {
  592. crBkgnd = RGB(20, 133, 20);
  593. }
  594. else
  595. {
  596. tmdindan = ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(5)); // (5).拍照时间 && 拍照状态=ok
  597. tmdt = tmdoday - tmdindan;
  598. if (b2 == FALSE || tmdt.GetDays() >= atoi(g_cominfoarray.ElementAt(0).ElementAt(143)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(9) != "OK" /*&& m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(8)=="未拍完"*/)
  599. {
  600. b3 = FALSE;
  601. crBkgnd = RGB(220, 0, 0);
  602. }
  603. else
  604. {
  605. b3 = TRUE;
  606. crBkgnd = RGB(20, 133, 20);
  607. }
  608. }
  609. break;
  610. case 10: // 看样字段;
  611. if (m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6) == "") // 选片时间空;
  612. {
  613. //printf("Jeff:选片时间为空\n\n");//Jeff Printf;
  614. crBkgnd = RGB(20, 133, 20);
  615. }
  616. else
  617. {
  618. tmdindan = ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6)); // (6).选片时间 && 选片状态=ok // 若没有选片时间,该值为空;
  619. tmdt = tmdoday - tmdindan;
  620. if (b3 == FALSE || tmdt.GetDays() >= atoi(g_cominfoarray.ElementAt(0).ElementAt(144)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(10) != "OK")
  621. {
  622. //b4 = FALSE;
  623. crBkgnd = RGB(220, 0, 0);
  624. }
  625. else
  626. {
  627. //b4 = TRUE;
  628. crBkgnd = RGB(20, 133, 20);
  629. }
  630. }
  631. break;
  632. case 11: // 件齐字段;
  633. if (m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6) == "")
  634. {
  635. crBkgnd = RGB(20, 133, 20);
  636. }
  637. else
  638. {
  639. tmdindan = ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6)); // (6).选片时间 && 选片状态=ok
  640. tmdt = tmdoday - tmdindan;
  641. if (b3 == FALSE || tmdt.GetDays() >= atoi(g_cominfoarray.ElementAt(0).ElementAt(145)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(11) != "OK" /* && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(9)=="未选"*/)
  642. {
  643. /*b5 = FALSE;*/
  644. crBkgnd = RGB(220, 0, 0);
  645. }
  646. else
  647. {
  648. //b5 = TRUE;
  649. crBkgnd = RGB(20, 133, 20);
  650. }
  651. }
  652. break;
  653. case 12: // 取走字段;
  654. if (m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6) == "")
  655. {
  656. crBkgnd = RGB(20, 133, 20);
  657. }
  658. else
  659. {
  660. tmdindan = ::GetTmFromStr(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6)); // (6).选片时间 && 选片状态=ok
  661. tmdt = tmdoday - tmdindan;
  662. if (b3 == FALSE || tmdt.GetDays() >= atoi(g_cominfoarray.ElementAt(0).ElementAt(146)) && m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(12) == "未取" /*&& m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(9)=="未选"*/)
  663. crBkgnd = RGB(220, 0, 0);
  664. else
  665. crBkgnd = RGB(20, 133, 20);
  666. }
  667. break;
  668. default:
  669. break;
  670. }
  671. #endif
  672. // Store the colors back in the NMLVCUSTOMDRAW struct.
  673. pLVCD->clrText = RGB(0, 0, 0);
  674. pLVCD->clrTextBk = crBkgnd;
  675. // Tell Windows to paint the control itself.
  676. *pResult = CDRF_DODEFAULT;
  677. }
  678. }
  679. void ProcessAlarm::OnBUTProcessAlarm()
  680. {
  681. // TODO: Add your control notification handler code here
  682. AlarmDays dlg;
  683. if (IDOK == dlg.DoModal())
  684. OnButton1();
  685. }
  686. void ProcessAlarm::OnBUTburncd2()
  687. {
  688. ListToXLS(&m_List1, "c:\\客人流程.xls", 0);
  689. }