ChoosePhotoForm.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. // ChoosePhotoForm.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ChoosePhotoForm.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "ImportPhoto.h"
  10. #include "ImportPhoto.h"
  11. #include "ChoosePhotoSkin2.h"
  12. #include "Login2.h"
  13. #include "ShowCut.h"
  14. #include "CompareContent.h"
  15. #include "SelBrunDevice.h"
  16. #include "DelHC.h"
  17. #ifdef _DEBUG
  18. #define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22. #pragma comment(lib, "Shlwapi.lib")
  23. /////////////////////////////////////////////////////////////////////////////
  24. // ChoosePhotoForm
  25. IMPLEMENT_DYNCREATE(ChoosePhotoForm, MyFormView)
  26. ChoosePhotoForm::ChoosePhotoForm()
  27. : MyFormView(ChoosePhotoForm::IDD)
  28. {
  29. //{{AFX_DATA_INIT(ChoosePhotoForm)
  30. m_filter = _T("");
  31. //}}AFX_DATA_INIT
  32. }
  33. ChoosePhotoForm::~ChoosePhotoForm()
  34. {
  35. }
  36. void ChoosePhotoForm::DoDataExchange(CDataExchange* pDX)
  37. {
  38. MyFormView::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(ChoosePhotoForm)
  40. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  41. DDX_Control(pDX, IDC_LIST2, m_List1);
  42. DDX_Control(pDX, IDC_STATIC1, m_static1);
  43. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  44. //}}AFX_DATA_MAP
  45. }
  46. BEGIN_MESSAGE_MAP(ChoosePhotoForm, MyFormView)
  47. //{{AFX_MSG_MAP(ChoosePhotoForm)
  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_BUTmoney, OnBUTmoney)
  54. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  55. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  56. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  57. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  58. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  59. ON_BN_CLICKED(IDC_BUTexportphoto3, OnBUTexportphoto3)
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. /////////////////////////////////////////////////////////////////////////////
  63. // ChoosePhotoForm diagnostics
  64. #ifdef _DEBUG
  65. void ChoosePhotoForm::AssertValid() const
  66. {
  67. MyFormView::AssertValid();
  68. }
  69. void ChoosePhotoForm::Dump(CDumpContext& dc) const
  70. {
  71. MyFormView::Dump(dc);
  72. }
  73. #endif //_DEBUG
  74. /////////////////////////////////////////////////////////////////////////////
  75. // ChoosePhotoForm message handlers
  76. void ChoosePhotoForm::OnInitialUpdate()
  77. {
  78. MyFormView::OnInitialUpdate();
  79. // TODO: Add your specialized code here and/or call the base class
  80. CMyMdi Mdi;
  81. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  82. // Here we create the outbar control using the splitter as its parent
  83. // and setting its id to the first pane.
  84. CRect rc2;
  85. GetWindowRect(rc2);
  86. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  87. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  88. int idarray[]={IDC_BUTshowphoto,IDC_BUTexportphoto2,IDC_BUTexportphoto3,IDC_BUTexportphoto,IDC_BUTmoney,IDC_BUTclose};
  89. int idcount=6;
  90. int btnwid;
  91. CRect prerc;
  92. for(int a=idcount-2; a>=0; a--)
  93. {
  94. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  95. ScreenToClient(prerc);
  96. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  97. ScreenToClient(rc2);
  98. btnwid=rc2.Width ();
  99. rc2.right =prerc.left ;
  100. rc2.left =rc2.right -btnwid;
  101. GetDlgItem(idarray[a])->MoveWindow (rc2);
  102. }
  103. m_static1.SetFont (&g_titlefont);
  104. #ifdef CHILD_VERSION
  105. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  106. #else
  107. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  108. #endif
  109. m_List1.LoadColumnInfo (116);
  110. if(g_bShowOK==0)
  111. {
  112. #ifdef LKAY_VERSION
  113. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  114. #else
  115. CString filter="status3='未取'";
  116. #endif
  117. g_sendhead.bsql=0;
  118. g_sendhead.code[0]=28;
  119. g_sendhead.tabcount=1;
  120. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  121. }
  122. else
  123. {
  124. g_sendhead.bsql=0;
  125. g_sendhead.code[0]=28;
  126. g_sendhead.tabcount=1;
  127. #ifdef LKAY_VERSION
  128. CString filter="dindantype<>'意向客户' or dindantype is null";
  129. g_pMainWnd->ProcessChatMessageRequest2(filter);
  130. #else
  131. g_pMainWnd->ProcessChatMessageRequest2(1);
  132. #endif
  133. if(g_bSendOK==0)return;
  134. }
  135. DataToArray(&m_List1array);HidePrice();
  136. m_combo1.AddString (g_user.name);
  137. for(int i=0; i<g_userarray.GetSize (); i++)
  138. {
  139. m_combo1.AddString (g_userarray.ElementAt (i).ElementAt (1) );
  140. }
  141. FillGrid();
  142. m_combo1.GetWindowRect (rc2);
  143. ScreenToClient(rc2);
  144. rc2.bottom +=200;
  145. m_combo1.MoveWindow (rc2);
  146. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  147. SetComboHei(&m_combo1, rc2.Height ());
  148. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(IsHasRights2new(15));
  149. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(15));
  150. GetDlgItem(IDC_BUTexportphoto3)->EnableWindow(IsHasRights2new(15));
  151. }
  152. void ChoosePhotoForm::FillGrid(BOOL bStatus)
  153. {
  154. if(g_bSearchFilter)
  155. {
  156. m_List1.DeleteAllItems2 ();
  157. int ii=0;
  158. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  159. int count=0;
  160. {
  161. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  162. {
  163. if(g_filterdate1!="")
  164. {
  165. if(m_List1array.ElementAt (ii).ElementAt (5)<g_filterdate1 || m_List1array.ElementAt (ii).ElementAt (5)>g_filterdate2)
  166. continue;
  167. }
  168. if(g_waiter1!="")
  169. {
  170. if(m_List1array.ElementAt (ii).ElementAt (9)!=g_waiter1)
  171. continue;
  172. }
  173. if(1)
  174. {
  175. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  176. }
  177. }
  178. }
  179. m_List1.m_arLabels.SetSize(count, 1);
  180. ii=count;
  181. m_List1.m_LabelCount=ii;
  182. m_List1.SetItemCountEx (ii);
  183. CString str;
  184. str.Format ("单数:%d", ii);
  185. SetDlgItemText(IDC_STATIC2, str);
  186. }
  187. else
  188. {
  189. m_List1.DeleteAllItems2 ();
  190. int ii=0;
  191. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  192. int count=0;
  193. if(m_filter.IsEmpty ())
  194. {
  195. if(bStatus)
  196. {
  197. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  198. {
  199. if(m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK")
  200. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  201. }
  202. }
  203. else
  204. {
  205. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  206. {
  207. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  208. }
  209. }
  210. }
  211. else
  212. {
  213. if(bStatus)
  214. {
  215. int type=GetType(m_filter);
  216. if(type==1)//电话
  217. {
  218. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  219. {
  220. if( m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK"&&(m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  221. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1))
  222. {
  223. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  224. }
  225. }
  226. }
  227. else if(type==2)//拼音
  228. {
  229. m_filter.MakeUpper ();
  230. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  231. {
  232. if( m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK"&&(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  233. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1))
  234. {
  235. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  236. }
  237. }
  238. }
  239. else
  240. {
  241. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  242. {
  243. if( m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK"&&(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  244. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  245. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  246. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  247. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1|| \
  248. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1 || \
  249. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  250. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 ))
  251. {
  252. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  253. }
  254. }
  255. }
  256. }
  257. else
  258. {
  259. int type=GetType(m_filter);
  260. if(type==1)//电话
  261. {
  262. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  263. {
  264. if(m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  265. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1)
  266. {
  267. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  268. }
  269. }
  270. }
  271. else if(type==2)//拼音
  272. {
  273. m_filter.MakeUpper ();
  274. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  275. {
  276. if(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  277. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1)
  278. {
  279. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  280. }
  281. }
  282. }
  283. else
  284. {
  285. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  286. {
  287. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  288. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  289. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  290. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  291. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1|| \
  292. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1 || \
  293. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  294. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 )
  295. {
  296. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  297. }
  298. }
  299. }
  300. }
  301. }
  302. m_List1.m_arLabels.SetSize(count, 1);
  303. ii=count;
  304. m_List1.m_LabelCount=ii;
  305. m_List1.SetItemCountEx (ii);
  306. CString str;
  307. str.Format ("单数:%d", ii);
  308. SetDlgItemText(IDC_STATIC2, str);
  309. }
  310. if(!g_id.IsEmpty ())
  311. {
  312. for(int i=0; i<m_List1.GetItemCount (); i++)
  313. {
  314. if(g_id==m_List1.GetItemText (i, 0))
  315. {
  316. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  317. m_List1.EnsureVisible(i,FALSE);
  318. break;
  319. }
  320. }
  321. }
  322. }
  323. void ChoosePhotoForm::OnBUTclose()
  324. {
  325. // TODO: Add your control notification handler code here
  326. GetParent()->SendMessage(WM_CLOSE);
  327. }
  328. void ChoosePhotoForm::OnSelchangeCombo1()
  329. {
  330. // TODO: Add your control notification handler code here
  331. SetTimer(1, 100, NULL);
  332. }
  333. void ChoosePhotoForm::OnTimer(UINT nIDEvent)
  334. {
  335. // TODO: Add your message handler code here and/or call default
  336. KillTimer(nIDEvent);
  337. OnButton1();
  338. }
  339. BOOL ChoosePhotoForm::PreTranslateMessage(MSG* pMsg)
  340. {
  341. // TODO: Add your specialized code here and/or call the base class
  342. try
  343. {
  344. if(pMsg->message==WM_KEYDOWN)
  345. {
  346. switch (pMsg->wParam)
  347. {
  348. case VK_RETURN:
  349. OnButton1();
  350. return 1;
  351. case 0x43: // copy
  352. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  353. {
  354. GetFocus()->SendMessage(WM_COPY);
  355. return TRUE;
  356. }
  357. break;
  358. case 0x56: //Ctrl + V:
  359. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  360. {
  361. GetFocus()->SendMessage(WM_PASTE);
  362. return TRUE;
  363. }
  364. break;
  365. case 0x58: // cut
  366. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  367. {
  368. GetFocus()->SendMessage(WM_CUT);
  369. return TRUE;
  370. }
  371. break;
  372. case 0x5A: //undo
  373. case 0x59: //redo
  374. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  375. {
  376. GetFocus()->SendMessage(WM_UNDO);
  377. return TRUE;
  378. }
  379. break;
  380. }
  381. }
  382. return MyFormView::PreTranslateMessage(pMsg);
  383. }
  384. catch(...)
  385. {
  386. }
  387. }
  388. // Jeff.门市流程 - 选片 - 开始选片
  389. void ChoosePhotoForm::OnBUTshowphoto() // Jeff.开始选片;
  390. {
  391. if(IsHasRights2new(15)==0) return;
  392. // TODO: Add your control notification handler code here
  393. POSITION pos;
  394. pos=m_List1.GetFirstSelectedItemPosition();
  395. if(pos==NULL)
  396. {
  397. AfxMessageBox("请先选中您要选片的定单!", MB_ICONINFORMATION);
  398. return;
  399. }
  400. int iItem=m_List1.GetNextSelectedItem(pos);
  401. CString id=m_List1.GetItemText (iItem, 0);
  402. CString status=m_List1.GetItemText (iItem, 4);
  403. /* if(atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && status=="OK" && IsHasRights2new(20)==0 )
  404. {
  405. Login2 dlg;
  406. if(dlg.DoModal ()!=IDOK)return;
  407. if(IsHasRightsnew2(20, dlg.m_rights)==0)return;
  408. }*/
  409. ChoosePhotoSkin2 dlg;
  410. dlg.SetLiaPath ("3.lia");
  411. dlg.m_strOrderNumber=id;
  412. dlg.m_path=g_path2+"\\";
  413. dlg.m_path+=dlg.m_strOrderNumber;
  414. dlg.m_path +="\\";
  415. // printf("Jeff:ChoosePhotoSkin2::m_id=%s\n ChoosePhotoSkin2::m_path=%s\n ChoosePhotoSkin2::m_mode\n\n",dlg.m_id,dlg.m_path,dlg.m_mode);// Jeff Printf;
  416. dlg.DoModal();
  417. g_bInSkin=0;
  418. if(dlg.m_bSave)
  419. {
  420. for(int i=0; i<m_List1array.GetSize (); i++)
  421. {
  422. if(id==m_List1array.ElementAt (i).ElementAt (0))
  423. {
  424. m_List1array.ElementAt (i).SetAt (4, "OK");
  425. m_List1array.ElementAt (i).SetAt (5, dlg.m_time4);
  426. m_List1array.ElementAt (i).SetAt (6, dlg.m_money3);
  427. m_List1array.ElementAt (i).SetAt (7, dlg.m_choosezs);
  428. m_List1array.ElementAt (i).SetAt (9, dlg.m_waiter3);
  429. FillGrid();
  430. break;
  431. }
  432. }
  433. }
  434. }
  435. void ChoosePhotoForm::OnBUTmoney()
  436. {
  437. POSITION pos;
  438. pos=m_List1.GetFirstSelectedItemPosition();
  439. if(pos==NULL)
  440. {
  441. AfxMessageBox("请先选中您要查看的客人!", MB_ICONINFORMATION);
  442. return;
  443. }
  444. int iItem=m_List1.GetNextSelectedItem(pos);
  445. CString id=m_List1.GetItemText (iItem, 0);
  446. ShowCut dlg;
  447. dlg.m_mode=2;
  448. dlg.m_id =id;
  449. dlg.DoModal ();
  450. }
  451. void ChoosePhotoForm::OnBUTexportphoto()
  452. {
  453. // TODO: Add your control notification handler code here
  454. UpdateData();
  455. POSITION pos;
  456. pos=m_List1.GetFirstSelectedItemPosition();
  457. if(pos==NULL)
  458. {
  459. AfxMessageBox("请先选中您要对比的定单!", MB_ICONINFORMATION);
  460. return;
  461. }
  462. int iItem=m_List1.GetNextSelectedItem(pos);
  463. if(m_List1.GetItemText (iItem, 4)!="OK")return;
  464. CCompareContent dlg;
  465. dlg.m_id=m_List1.GetItemText (iItem, 0);
  466. dlg.DoModal();
  467. }
  468. void ChoosePhotoForm::GetNo(CString str, CStringArray &array)
  469. {
  470. if(!str.IsEmpty ())
  471. {
  472. int pos=str.Find (",");
  473. while(pos!=-1)
  474. {
  475. array.Add (str.Left (pos));
  476. str=str.Right (str.GetLength ()-pos-1);
  477. pos=str.Find (",");
  478. }
  479. array.Add(str);
  480. }
  481. }
  482. int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData)
  483. {
  484. switch(msg)
  485. {
  486. case BFFM_INITIALIZED:
  487. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  488. break;
  489. case BFFM_SELCHANGED:
  490. {
  491. char szFileName[MAX_PATH];
  492. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  493. SHGetPathFromIDList(pidlCurrent, szFileName);
  494. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  495. }
  496. break;
  497. }
  498. return 0;
  499. }
  500. void GetSavePath(CString &path)
  501. {
  502. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  503. LPITEMIDLIST pidlDesktop, pidlCurrent;
  504. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop) == NOERROR)
  505. {
  506. BROWSEINFO bi;
  507. bi.hwndOwner = g_pMainWnd->m_hWnd;
  508. bi.pidlRoot = pidlDesktop;
  509. bi.pszDisplayName = lpszDisplayName;
  510. bi.lpszTitle = "\n文档保存的目录:";
  511. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  512. bi.lpfn = BrowseProc;
  513. bi.lParam = 0;
  514. bi.iImage = 0;
  515. pidlCurrent = SHBrowseForFolder(&bi);
  516. SHGetPathFromIDList(pidlCurrent, szFileName);
  517. path = szFileName;
  518. }
  519. }
  520. int ChoosePhotoForm::FindArray(CStringArray *pArray, CString *pStr)
  521. {
  522. for(int i=0; i<pArray->GetSize (); i++)
  523. {
  524. if(pArray->ElementAt (i)==*pStr)
  525. return i;
  526. }
  527. return -1;
  528. }
  529. void ChoosePhotoForm::OnButton1()
  530. {
  531. // TODO: Add your control notification handler code here
  532. UpdateData();
  533. m_filter.TrimLeft ();
  534. m_filter.TrimRight ();
  535. FillGrid();
  536. }
  537. void ChoosePhotoForm::OnButton2()
  538. {
  539. // TODO: Add your control notification handler code here
  540. UpdateData();
  541. m_filter.TrimLeft ();
  542. m_filter.TrimRight ();
  543. FillGrid(1);
  544. }
  545. void ChoosePhotoForm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  546. {
  547. // TODO: Add your control notification handler code here
  548. POSITION pos;
  549. pos=m_List1.GetFirstSelectedItemPosition();
  550. if(pos==NULL)return;
  551. int iItem=m_List1.GetNextSelectedItem(pos);
  552. g_id = m_List1.GetItemText (iItem, 0);
  553. *pResult = 0;
  554. }
  555. void ChoosePhotoForm::HidePrice()
  556. {
  557. #ifdef LKAY_VERSION
  558. if(IsHasRights2new(31))return;
  559. for(int i=0; i< m_List1array.GetSize (); i++)
  560. {
  561. m_List1array.ElementAt (i).SetAt (10, "***");
  562. m_List1array.ElementAt (i).SetAt (11, "***");
  563. m_List1array.ElementAt (i).SetAt (12, "***");
  564. m_List1array.ElementAt (i).SetAt (13, "***");
  565. m_List1array.ElementAt (i).SetAt (6, "***");
  566. }
  567. #else
  568. if(IsHasRights2new(31))return;
  569. for(int i=0; i< m_List1array.GetSize (); i++)
  570. {
  571. m_List1array.ElementAt (i).SetAt (12, "***");
  572. m_List1array.ElementAt (i).SetAt (13, "***");
  573. }
  574. #endif
  575. }
  576. void ChoosePhotoForm::OnBtnsearchfilter()
  577. {
  578. // TODO: Add your control notification handler code here
  579. SearchFilter dlg;
  580. dlg.m_mode =3;
  581. if(dlg.DoModal ()==IDOK)FillGrid();
  582. g_bSearchFilter=0;
  583. }
  584. BOOL ChoosePhotoForm::IsPhoto2Exist(CString m_id)
  585. {
  586. CString path2;
  587. CString path=g_path2+"\\";
  588. path+=m_id;
  589. path +="\\";
  590. using namespace helper_coffs;
  591. ffsco o;
  592. o.dirs(0);
  593. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  594. ffsco::typeT coo;
  595. coo = o.co_file();
  596. return coo.size();
  597. }
  598. void ChoosePhotoForm::OnBUTexportphoto2()
  599. {
  600. // TODO: Add your control notification handler code here
  601. POSITION pos;
  602. pos=m_List1.GetFirstSelectedItemPosition();
  603. if(pos==NULL)
  604. {
  605. AfxMessageBox("请先选中您要缓存的定单!", MB_ICONINFORMATION);
  606. return;
  607. }
  608. ClearHC();
  609. int iItem=m_List1.GetNextSelectedItem(pos);
  610. CString m_id=m_List1.GetItemText (iItem, 0);
  611. CString m_path,m_seltxname;
  612. m_path=g_path2+"\\";
  613. m_path+=m_id;
  614. m_path +="\\";
  615. //////////////////////
  616. CStringArray m_patharray1;
  617. int m_nChoosePhotoType=2;
  618. if(m_patharray1.GetSize ()==0)
  619. {
  620. if(IsPhoto2Exist(m_id))
  621. {
  622. SelBrunDevice dlg;
  623. dlg.m_mode=1;
  624. if(dlg.DoModal ()==IDOK)
  625. m_nChoosePhotoType=dlg.m_sel;
  626. else
  627. m_nChoosePhotoType=0;
  628. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  629. }
  630. else
  631. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  632. {
  633. CString path,path2;
  634. m_path=g_path1+"\\";
  635. m_path+=m_id;
  636. m_path +="\\";
  637. if(m_seltxname!="" && m_seltxname!="全部")
  638. {
  639. m_path+=m_seltxname; m_path +="\\";
  640. }
  641. if(m_nChoosePhotoType==1)
  642. {
  643. m_path=g_path2+"\\";
  644. m_path+=m_id;
  645. m_path +="\\";
  646. }
  647. CString filename;
  648. using namespace helper_coffs;
  649. ffsco o;
  650. o.dirs(1);
  651. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  652. ffsco::typeT coo;
  653. ffsco::typeT::iterator it;
  654. coo = o.co_file();
  655. for (it = coo.begin();
  656. coo.end() != it;
  657. it ++)
  658. {
  659. path=(*it).c_str();
  660. if(path.GetAt (path.ReverseFind ('\\')+1)!='s' && path.GetAt (path.ReverseFind ('\\')+1)!='m')
  661. {
  662. path.MakeLower ();
  663. filename=path.Right(path.GetLength()-path.ReverseFind ('\\')-1);
  664. if(filename.Find(".")!=-1)
  665. filename=filename.Left(filename.Find("."));
  666. if(!myisdigit(filename))continue;
  667. if(m_nChoosePhotoType==1)
  668. {
  669. m_patharray1.Add (path);
  670. }
  671. else
  672. {
  673. path2=path;
  674. if(m_nChoosePhotoType==0)
  675. path2.Replace ("客户原片", "修好的片");
  676. if(1)
  677. {
  678. int pos=path2.Find (m_id);
  679. pos+=m_id.GetLength ();
  680. int pos2=path2.ReverseFind ('\\');
  681. path2=path2.Left (pos)+path2.Right (path2.GetLength ()-pos2);
  682. }
  683. if(m_nChoosePhotoType==0 && ::PathFileExists (path2))
  684. {
  685. m_patharray1.Add (path2);
  686. }
  687. else
  688. {
  689. path2.Replace (".raw", ".jpg");
  690. if(::PathFileExists (path2))
  691. {
  692. m_patharray1.Add (path2);continue;
  693. }
  694. path2.Replace (".nef", ".jpg");
  695. if(::PathFileExists (path2))
  696. {
  697. m_patharray1.Add (path2);continue;
  698. }
  699. path2.Replace (".cr2", ".jpg");
  700. if(::PathFileExists (path2))
  701. {
  702. m_patharray1.Add (path2);continue;
  703. }
  704. else
  705. {
  706. if(path.Right(3)!="jpg")continue;
  707. m_patharray1.Add (path);
  708. }
  709. }
  710. }
  711. }
  712. }
  713. }
  714. // if(0)
  715. {//多种修好的效果
  716. CString path,path2;
  717. path2=g_path2+"\\";
  718. path2+=m_id;
  719. path2 +="\\";
  720. using namespace helper_coffs;
  721. ffsco o;
  722. o.dirs(0);
  723. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  724. ffsco::typeT coo;
  725. ffsco::typeT::iterator it;
  726. coo = o.co_file();
  727. for (it = coo.begin();
  728. coo.end() != it;
  729. it ++)
  730. {
  731. path=(*it).c_str();
  732. if(path.GetAt (path.ReverseFind ('\\')+1)!='s' && path.GetAt (path.ReverseFind ('\\')+1)!='m')
  733. {
  734. path.MakeLower ();
  735. path2=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
  736. if(path2.Find ("-")!=-1)
  737. {
  738. m_patharray1.Add (path);
  739. }
  740. }
  741. }
  742. }
  743. /////////////////////////
  744. char path[MAX_PATH];
  745. ::GetSystemDirectory (path, MAX_PATH);
  746. CString sysdir=path;
  747. sysdir+="\\lyfz";
  748. ::CreateDirectory (sysdir, NULL);
  749. sysdir+="\\";
  750. sysdir+=m_id; ::CreateDirectory (sysdir, NULL);
  751. sysdir+="\\";
  752. ImportPhoto dlg;
  753. dlg.m_bCopyToLocal=1;
  754. dlg.m_mode =1;
  755. dlg.m_pArray=&m_patharray1;
  756. dlg.m_savepath =sysdir;
  757. dlg.DoModal ();
  758. AfxMessageBox("缓存成功!");
  759. }
  760. }
  761. CString GetCreateTime(CString path)
  762. {
  763. CFileFind finder;
  764. path.TrimRight("\\");
  765. BOOL bWorking = finder.FindFile(path);
  766. if(bWorking)
  767. {
  768. finder.FindNextFile( );
  769. CTime tm;
  770. finder.GetCreationTime(tm);
  771. CTimeSpan dt=CTime::GetCurrentTime()-tm;
  772. CString version = _T ("Version 1.0");
  773. int m_dtdays=AfxGetApp()->GetProfileInt (version, "dtdays2", 5);
  774. if(dt.GetDays()>=m_dtdays)
  775. {
  776. ::DeleteDirectory (path);
  777. }
  778. }
  779. return "";
  780. }
  781. void ChoosePhotoForm::ClearHC()
  782. {
  783. char path[MAX_PATH];
  784. ::GetSystemDirectory (path, MAX_PATH);
  785. CString sysdir=path;
  786. sysdir+="\\lyfz";
  787. ::CreateDirectory (sysdir, NULL);
  788. sysdir+="\\";
  789. CString str;
  790. using namespace helper_coffs;
  791. ffsco o;
  792. o.dirs(0);
  793. o.find(LPCSTR(sysdir), LPCSTR("*.*"));
  794. ffsco::typeT coo;
  795. ffsco::typeT::iterator it;
  796. coo = o.co_dir();
  797. for (it = coo.begin();
  798. coo.end() != it;
  799. it ++)
  800. {
  801. str=(*it).c_str();
  802. if(str==sysdir)continue;
  803. GetCreateTime(str);
  804. }
  805. }
  806. void ChoosePhotoForm::OnBUTexportphoto3()
  807. {
  808. // TODO: Add your control notification handler code here yesno
  809. DelHC dlg;
  810. dlg.DoModal();
  811. }