ShowPic.cpp 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  1. // ShowPic.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowPic.h"
  6. #include "ShowPic22.h"
  7. #include "ImportPhoto.h"
  8. #include "JPEG.h"
  9. #include "MyLock.h"
  10. #include "ZipTypeDlg.h"
  11. #include "SetDesignNo.h"
  12. #define THUMBNAIL_WIDTH 100
  13. #define THUMBNAIL_HEIGHT 90
  14. /////////////////////////////////////////////////////////////////////////////
  15. // ShowPic dialog IDC_BU IDC_COMBO2
  16. ShowPic::ShowPic(CWnd* pParent /*=NULL*/)
  17. : CDialog(ShowPic::IDD, pParent)
  18. {
  19. //{{AFX_DATA_INIT(ShowPic)
  20. m_branchname = _T("");
  21. //}}AFX_DATA_INIT
  22. m_bTerminate=false;
  23. m_bRunning=false;
  24. m_hThread = NULL;
  25. m_mode=0;
  26. m_bdelall=0;
  27. }
  28. void ShowPic::DoDataExchange(CDataExchange* pDX)
  29. {
  30. CDialog::DoDataExchange(pDX);
  31. //{{AFX_DATA_MAP(ShowPic)
  32. DDX_Control(pDX, IDC_COMBO2, m_combobranch);
  33. DDX_Control(pDX, IDC_LIST1, m_List1);
  34. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  35. DDX_CBString(pDX, IDC_COMBO2, m_branchname);
  36. //}}AFX_DATA_MAP
  37. }
  38. BEGIN_MESSAGE_MAP(ShowPic, CDialog)
  39. //{{AFX_MSG_MAP(ShowPic)
  40. ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
  41. ON_WM_DESTROY()
  42. ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall)
  43. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  44. ON_BN_CLICKED(IDC_BUTupload, OnBUTupload)
  45. ON_BN_CLICKED(IDC_BUTselall, OnBUTselall)
  46. ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2)
  47. ON_BN_CLICKED(IDC_BUTSetDesignNo, OnBUTSetDesignNo)
  48. ON_BN_CLICKED(IDC_BUTexport, OnBUTexport)
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // ShowPic message handlers
  53. BOOL ShowPic::OnInitDialog()
  54. {
  55. CDialog::OnInitDialog();
  56. CRect rc2;
  57. GetWindowRect(rc2);
  58. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  59. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  60. GetDlgItem(IDOK)->GetWindowRect(rc2);
  61. ScreenToClient(rc2);
  62. int hei=rc2.Height ();
  63. GetClientRect(rc2);
  64. rc2.top =hei+10;
  65. m_List1.MoveWindow (rc2);
  66. int right=rc2.right ;
  67. GetDlgItem(IDOK)->GetWindowRect(rc2);
  68. ScreenToClient(rc2);
  69. int dtx=right-rc2.right-5 ;
  70. rc2.top =5;
  71. rc2.bottom =rc2.top +hei;
  72. rc2.left += dtx;
  73. rc2.right +=dtx;
  74. GetDlgItem(IDOK)->MoveWindow(rc2);
  75. GetDlgItem(IDC_BUTdel)->GetWindowRect(rc2);
  76. ScreenToClient(rc2);
  77. rc2.top =5;
  78. rc2.bottom =rc2.top +hei;
  79. rc2.left += dtx;
  80. rc2.right +=dtx;
  81. GetDlgItem(IDC_BUTdel)->MoveWindow(rc2);
  82. GetDlgItem(IDC_BUTdelall)->GetWindowRect(rc2);
  83. ScreenToClient(rc2);
  84. rc2.top =5;
  85. rc2.bottom =rc2.top +hei;
  86. rc2.left += dtx;
  87. rc2.right +=dtx;
  88. GetDlgItem(IDC_BUTdelall)->MoveWindow(rc2);
  89. GetDlgItem(IDC_BUTSetDesignNo)->GetWindowRect(rc2);
  90. ScreenToClient(rc2);
  91. rc2.top =5;
  92. rc2.bottom =rc2.top +hei;
  93. rc2.left += dtx;
  94. rc2.right +=dtx;
  95. GetDlgItem(IDC_BUTSetDesignNo)->MoveWindow(rc2);
  96. GetDlgItem(IDC_BUTexport)->GetWindowRect(rc2);
  97. ScreenToClient(rc2);
  98. rc2.top =5;
  99. rc2.bottom =rc2.top +hei;
  100. rc2.left += dtx;
  101. rc2.right +=dtx;
  102. GetDlgItem(IDC_BUTexport)->MoveWindow(rc2);
  103. //////////////////////////////////////////////////////////
  104. GetDlgItem(IDC_BUTupload)->GetWindowRect(rc2);
  105. ScreenToClient(rc2);
  106. rc2.top =5;
  107. rc2.bottom =rc2.top +hei;
  108. GetDlgItem(IDC_BUTupload)->MoveWindow(rc2);
  109. GetDlgItem(IDC_BUTselall)->GetWindowRect(rc2);
  110. ScreenToClient(rc2);
  111. rc2.top =5;
  112. rc2.bottom =rc2.top +hei;
  113. GetDlgItem(IDC_BUTselall)->MoveWindow(rc2);
  114. GetDlgItem(IDC_COMBO2)->GetWindowRect(rc2);
  115. ScreenToClient(rc2);
  116. rc2.top =5;
  117. rc2.bottom =rc2.top +hei+300;
  118. GetDlgItem(IDC_COMBO2)->MoveWindow(rc2);
  119. m_combobranch.ShowWindow(0);
  120. if(g_branchname=="")
  121. {
  122. GetDlgItem(IDC_BUTupload)->ShowWindow(0);
  123. GetDlgItem(IDC_BUTselall)->ShowWindow(0);
  124. }
  125. // else
  126. // GetDlgItem(IDC_BUTupload)->SetWindowText("上传至"+g_branchname);
  127. #ifdef ENTERPRISE_VERSION
  128. if(1)//g_branchname=="")
  129. {
  130. m_combobranch.ShowWindow(1);
  131. for(int i=0; i<g_brancharray.GetSize ()-1; i++)
  132. {
  133. if(m_iparray.GetSize ())
  134. {
  135. if(g_brancharray.ElementAt (i).ElementAt (2)==m_iparray.ElementAt (m_iparray.GetSize ()-1))continue;
  136. }
  137. m_combobranch.AddString (g_brancharray.ElementAt (i).ElementAt (0));
  138. m_iparray.Add (g_brancharray.ElementAt (i).ElementAt (2));
  139. }
  140. GetDlgItem(IDC_BUTupload)->ShowWindow(1);
  141. GetDlgItem(IDC_BUTselall)->ShowWindow(1);
  142. }
  143. #endif
  144. if(m_mode==1 && IsHasRights2new(4)==0 )//拍照
  145. {
  146. GetDlgItem(IDC_BUTupload)->ShowWindow(0);
  147. GetDlgItem(IDC_BUTselall)->ShowWindow(0);
  148. }
  149. if(m_mode==2 && IsHasRights2new(5)==0 )
  150. {
  151. GetDlgItem(IDC_BUTupload)->ShowWindow(0);
  152. GetDlgItem(IDC_BUTselall)->ShowWindow(0);
  153. }
  154. if(m_mode==3 && IsHasRights2new(6)==0 )
  155. {
  156. GetDlgItem(IDC_BUTupload)->ShowWindow(0);
  157. GetDlgItem(IDC_BUTselall)->ShowWindow(0);
  158. }
  159. if(m_mode==5 && IsHasRights2new(7)==0 )
  160. {
  161. GetDlgItem(IDC_BUTupload)->ShowWindow(0);
  162. GetDlgItem(IDC_BUTselall)->ShowWindow(0);
  163. }
  164. if(m_mode==4)//礼服
  165. {
  166. GetDlgItem(IDC_BUTupload)->ShowWindow(0);
  167. GetDlgItem(IDC_BUTselall)->ShowWindow(0);
  168. }
  169. if(m_mode==1)//拍照
  170. {
  171. GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(34));
  172. GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(34));
  173. }
  174. else if(m_mode==2)//初修
  175. {
  176. GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(35));
  177. GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(35));
  178. }
  179. else if(m_mode==3)//精修
  180. {
  181. GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(36));
  182. GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(36));
  183. }
  184. else if(m_mode==5)//设计
  185. {
  186. GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(37));
  187. GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(37));
  188. GetDlgItem(IDC_BUTSetDesignNo)->EnableWindow(IsHasRights2new(7));
  189. GetDlgItem(IDC_BUTSetDesignNo)->ShowWindow(SW_SHOW);
  190. GetDlgItem(IDC_BUTexport)->EnableWindow(IsHasRights2new(12));
  191. GetDlgItem(IDC_BUTexport)->ShowWindow(SW_SHOW);
  192. }
  193. else if(m_mode==4)//礼服
  194. {
  195. SetWindowText("礼服查看");
  196. GetDlgItem(IDC_BUTdelall)->EnableWindow(0);
  197. GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(43));
  198. m_combobranch.ShowWindow(1);
  199. g_sendhead.bsql=0;
  200. g_sendhead.code[0]=72;
  201. g_sendhead.tabcount=1;
  202. g_pMainWnd->ProcessChatMessageRequest2(0);
  203. if(g_bSendOK==0)
  204. {
  205. CDialog::OnCancel ();
  206. return 0;
  207. }
  208. DataToArray(&m_List1array);
  209. CStringArray typearray;
  210. int i = 0;
  211. for( i=0; i<m_List1array.GetSize (); i++)
  212. {
  213. if(-1==::FindArray (&typearray, m_List1array.ElementAt (i).ElementAt (0)))
  214. typearray.Add( m_List1array.ElementAt (i).ElementAt (0));
  215. }
  216. m_combobranch.AddString("全部");
  217. for(i=0; i<typearray.GetSize (); i++)
  218. {
  219. m_combobranch.AddString (typearray.ElementAt (i));
  220. }
  221. m_combobranch.SetCurSel (0);
  222. }
  223. m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
  224. m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
  225. LoadPhotos();
  226. return TRUE; // return TRUE unless you set the focus to a control
  227. // EXCEPTION: OCX Property Pages should return FALSE
  228. }
  229. unsigned __stdcall LoadThumbNail(LPVOID lpParam)
  230. {
  231. try
  232. {
  233. ShowPic *pDlg=(ShowPic*)lpParam;
  234. CListCtrl *ListCtrl=&pDlg->m_List1;
  235. CImageList* pImgList=&pDlg->m_ImageListThumb;
  236. // reset our image list
  237. for(int i=0; i<pImgList->GetImageCount(); i++)
  238. pImgList->Remove(i);
  239. // remove all items from list view
  240. ListCtrl->DeleteAllItems();
  241. pImgList->SetImageCount(pDlg->m_vFileName.size());
  242. TCHAR path[MAX_PATH];
  243. vector<CString>::iterator iter;
  244. // Set redraw to FALSE to avoid flickering during adding new items
  245. ListCtrl->SetRedraw(FALSE);
  246. int nIndex=0;
  247. CString str, spath;
  248. for(iter=pDlg->m_vFileName.begin(); iter!=pDlg->m_vFileName.end() && pDlg->m_bTerminate!=true; iter++, nIndex++)
  249. {
  250. str=*iter;
  251. spath.Empty ();
  252. if(str.Left (str.ReverseFind ('\\')+1)!=pDlg->m_path)
  253. {
  254. spath=str.Left (str.ReverseFind ('\\')+1);
  255. spath= spath.Right (spath.GetLength ()-pDlg->m_path.GetLength ());
  256. }
  257. str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  258. str=spath+str.Left (str.GetLength ()-4);
  259. ListCtrl->InsertItem(nIndex, str, nIndex);
  260. }
  261. ListCtrl->SetRedraw(TRUE);
  262. ListCtrl->Invalidate();
  263. const float fRatio=(float)THUMBNAIL_HEIGHT/THUMBNAIL_WIDTH;
  264. int XDest, YDest, nDestWidth, nDestHeight;
  265. nIndex=0;
  266. SolidBrush whitebrush(Color(255,255,255,255));
  267. for(iter=pDlg->m_vFileName.begin(); iter!=pDlg->m_vFileName.end() && pDlg->m_bTerminate!=true; iter++, nIndex++)
  268. {
  269. // Load Image File
  270. Image *image=NULL;
  271. Bitmap *pBmp=NULL;
  272. str=*iter;
  273. spath=str.Left (str.ReverseFind ('\\')+1);
  274. spath+="s";
  275. spath+=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  276. if(::CheckFileExist (spath))
  277. ::LoadImageFromBuf (&image, spath);
  278. else
  279. {
  280. str.MakeLower();
  281. if(str.Right(3)!="jpg")continue;
  282. ::LoadImageFromBuf (&image, str);
  283. }
  284. if(image==NULL)continue;
  285. int orientation=GetOrientation(image);
  286. if(orientation==8)
  287. image->RotateFlip( Rotate270FlipNone );
  288. else if(orientation==6)
  289. image->RotateFlip( Rotate90FlipNone );
  290. if(image->GetWidth()==0)
  291. continue;
  292. // Calculate Rect to fit to canvas
  293. const float fImgRatio=(float)image->GetHeight()/image->GetWidth();
  294. if(fImgRatio > fRatio)
  295. {
  296. nDestWidth=THUMBNAIL_HEIGHT/fImgRatio;
  297. XDest=(THUMBNAIL_WIDTH-nDestWidth)/2;
  298. YDest=0;
  299. nDestHeight=THUMBNAIL_HEIGHT;
  300. }
  301. else
  302. {
  303. XDest=0;
  304. nDestWidth=THUMBNAIL_WIDTH;
  305. nDestHeight=THUMBNAIL_WIDTH*fImgRatio;
  306. YDest=(THUMBNAIL_HEIGHT-nDestHeight)/2;
  307. }
  308. pBmp=new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB );
  309. Graphics graph2(pBmp);
  310. graph2.Clear(Color(255,192,192,192));
  311. graph2.FillRectangle (&whitebrush,1, 1, THUMBNAIL_WIDTH-2, THUMBNAIL_HEIGHT-2);
  312. Graphics graph(pBmp);
  313. Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
  314. // Draw Image
  315. graph.DrawImage(image, desRect, 0,0,image->GetWidth(),image->GetHeight(),UnitPixel);
  316. delete image;
  317. // Attach to Bitmap and Replace image in CImageList
  318. CBitmap bitmap;
  319. HBITMAP hbmp;
  320. pBmp->GetHBITMAP(Color(255,255,255,255), &hbmp);
  321. bitmap.Attach(hbmp);
  322. pImgList->Replace(nIndex, &bitmap, NULL);
  323. delete pBmp;
  324. // Redraw only a current item for removing flickering and fast speed.
  325. ListCtrl->RedrawItems(nIndex, nIndex);
  326. // Release used DC and Object
  327. }
  328. ListCtrl->Invalidate();
  329. pDlg->m_bRunning=false;
  330. pDlg->m_bTerminate=false;
  331. _endthreadex( 0 );
  332. return 0;
  333. }
  334. catch(...)
  335. {
  336. }
  337. }
  338. void ShowPic::LoadThumbImages()
  339. {
  340. TerminateThread();
  341. m_hThread = (HANDLE)_beginthreadex(NULL,0, LoadThumbNail,(LPVOID)this,0/* CREATE_SUSPENDED*/,&m_dwThreadID);
  342. m_bRunning=true;
  343. }
  344. BOOL ShowPic::TerminateThread()
  345. {
  346. if ( !m_bRunning )
  347. return TRUE;
  348. m_bTerminate=true;
  349. for( ; ; )
  350. {
  351. if ( ::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0 )
  352. break;
  353. MSG msg;
  354. while (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
  355. {
  356. if (!AfxGetApp()->PumpMessage())
  357. break;
  358. }
  359. }
  360. ::CloseHandle(m_hThread);
  361. return TRUE;
  362. }
  363. void ShowPic::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
  364. {
  365. // TODO: Add your control notification handler code here
  366. POSITION pos;
  367. pos=m_List1.GetFirstSelectedItemPosition();
  368. if(pos==NULL)
  369. {
  370. return;
  371. }
  372. int iItem=m_List1.GetNextSelectedItem(pos);
  373. ShowPic22 dlg;
  374. dlg.m_pos=iItem;
  375. dlg.m_pPathArray=&m_patharray1;
  376. dlg.DoModal ();
  377. *pResult = 0;
  378. }
  379. void ShowPic::OnDestroy()
  380. {
  381. TerminateThread();
  382. CDialog::OnDestroy();
  383. // TODO: Add your message handler code here
  384. }
  385. void ShowPic::LoadPhotos()
  386. {
  387. m_patharray1.RemoveAll ();
  388. m_path.MakeLower ();
  389. CStringArray dirarray;
  390. CString str;
  391. if(m_mode==4)//礼服
  392. {
  393. CString savepath=g_path5+"\\";
  394. for(int i=0; i<m_List1array.GetSize (); i++)
  395. {
  396. if(m_type!="" && m_type!="全部" && m_type!=m_List1array.ElementAt (i).ElementAt (0))
  397. continue;
  398. // str=savepath+"s"+m_List1array.ElementAt (i).ElementAt (1)+".jpg";
  399. str=savepath+m_List1array.ElementAt (i).ElementAt (1)+".jpg";
  400. if(::PathFileExists (str))
  401. m_patharray1.Add (str);
  402. }
  403. }
  404. else
  405. {
  406. if(1)
  407. {
  408. using namespace helper_coffs;
  409. ffsco o;
  410. o.dirs(1);
  411. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  412. ffsco::typeT coo;
  413. ffsco::typeT::iterator it;
  414. coo = o.co_dir();
  415. for (it = coo.begin();
  416. coo.end() != it;
  417. it ++)
  418. {
  419. str=(*it).c_str();
  420. if(FindArray(&dirarray, str)==-1)
  421. {
  422. dirarray.Add (str);
  423. }
  424. }
  425. }
  426. if(1)
  427. {
  428. CString filename;
  429. for(int i=0; i<dirarray.GetSize (); i++)
  430. {
  431. using namespace helper_coffs;
  432. ffsco o;
  433. o.dirs(0);
  434. if(m_mode==1)//拍照
  435. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.*"));
  436. else
  437. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  438. ffsco::typeT coo;
  439. ffsco::typeT::iterator it;
  440. coo = o.co_file();
  441. for (it = coo.begin();
  442. coo.end() != it;
  443. it ++)
  444. {
  445. str=(*it).c_str();
  446. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  447. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  448. str.MakeLower ();
  449. if(m_mode==1)//拍照
  450. {
  451. filename=str.Right(str.GetLength()-str.ReverseFind ('\\')-1);
  452. if(filename.Find(".")!=-1)
  453. filename=filename.Left(filename.Find("."));
  454. if(!myisdigit(filename))continue;
  455. }
  456. m_patharray1.Add (str);
  457. }
  458. }
  459. }
  460. }
  461. if(m_bRunning)return;
  462. CStringArray *pArray=&m_patharray1;
  463. m_vFileName.clear();
  464. for(int i=0; i<pArray->GetSize (); i++)
  465. {
  466. CString filePath=pArray->ElementAt (i);
  467. filePath.MakeLower();
  468. m_vFileName.push_back(filePath);
  469. }
  470. LoadThumbImages();
  471. }
  472. void ShowPic::OnBUTdelall() // 全部删除按钮;
  473. {
  474. // TODO: Add your control notification handler code here
  475. if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  476. CString path=m_path;
  477. path.TrimRight ('\\');
  478. DeleteDirectory(path);
  479. LoadPhotos();
  480. if(m_mode==1)
  481. {
  482. CString sql;
  483. sql="update dindan set [curno]='1' where [id]='"+m_id+"'";
  484. g_sendhead.bsql=1;
  485. g_pMainWnd->ProcessChatMessageRequest2(sql);
  486. m_bdelall=1;
  487. }
  488. #if 0
  489. CString str;
  490. str="清除客人";
  491. str+=m_name;
  492. str+=m_id;
  493. if(m_mode==1)
  494. str+="原片";
  495. else if(m_mode==2)
  496. str+="初修片";
  497. else if(m_mode==3)
  498. str+="精修片";
  499. else if(m_mode==5)
  500. str+="设计片";
  501. WriteLog(str);
  502. #else
  503. CString str;
  504. str="清除";
  505. str+=m_name;
  506. str+=m_id;
  507. str+="全部";//Jeff.add;
  508. if(m_mode==1)
  509. str+="原片";
  510. else if(m_mode==2)
  511. str+="初修片";
  512. else if(m_mode==3)
  513. str+="精修片";
  514. else if(m_mode==5)
  515. str+="设计片";
  516. WriteLog(str);
  517. #endif
  518. if(g_branchname!="")
  519. {
  520. str.Format("是否同步删除分店 %s 的照片?", g_branchname);
  521. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  522. CString sql="deletephotos";
  523. if(m_mode==1)//拍照
  524. sql+="0";
  525. else if(m_mode==2)//初修
  526. sql+="1";
  527. else if(m_mode==3)//精修
  528. sql+="2";
  529. else if(m_mode==5)//设计
  530. sql+="3";
  531. sql+=m_id;
  532. sql+=";";
  533. CString jd;
  534. if(m_mode==1)
  535. { //拍照,加景点
  536. CString file2=m_path;
  537. int pos=file2.Find (m_id);
  538. pos+=m_id.GetLength ();
  539. int pos2=file2.ReverseFind ('\\');
  540. if(pos2>pos)
  541. {
  542. jd=file2.Mid(pos+1, pos2-pos-1);
  543. }
  544. }
  545. sql+="all";
  546. sql+=jd;
  547. g_sendhead.bsql=1;
  548. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  549. AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
  550. #if 1//Jeff add;
  551. CString strDelContent;
  552. if(m_mode==1)
  553. str+="原片";
  554. else if(m_mode==2)
  555. str+="初修片";
  556. else if(m_mode==3)
  557. str+="精修片";
  558. else if(m_mode==5)
  559. str+="设计片";
  560. strDelContent.Format("客人%s,订单号%s的分店%s的全部%s被同步删除",m_name,m_id,g_branchname,str);
  561. WriteLog(strDelContent);
  562. #endif
  563. }
  564. else if(m_branch!="")
  565. {
  566. if(GetBranchPhotoPath(m_branch)=="")return;
  567. str.Format("是否同步删除分店 %s 的照片?", m_branch);
  568. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  569. CString sql="deletephotos";
  570. if(m_mode==1)//拍照
  571. sql+="0";
  572. else if(m_mode==2)//初修
  573. sql+="1";
  574. else if(m_mode==3)//精修
  575. sql+="2";
  576. else if(m_mode==5)//设计
  577. sql+="3";
  578. sql+=m_id;
  579. sql+=";";
  580. CString jd;
  581. if(m_mode==1)
  582. { //拍照,加景点
  583. CString file2=m_path;
  584. int pos=file2.Find (m_id);
  585. pos+=m_id.GetLength ();
  586. int pos2=file2.ReverseFind ('\\');
  587. if(pos2>pos)
  588. {
  589. jd=file2.Mid(pos+1, pos2-pos-1);
  590. }
  591. }
  592. sql+="all";
  593. sql+=jd;
  594. g_sendhead.bsql=1;
  595. g_branchip=GetIP(m_branch);
  596. g_pMainWnd->OnDisconnect();
  597. g_branchname=m_branch;
  598. g_bBranchModify=1;
  599. g_pMainWnd->ProcessChatMessageRequest2(sql);
  600. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  601. if(g_bSendOK==0)return;
  602. AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
  603. #if 1//Jeff add;
  604. CString strDelContent;
  605. if(m_mode==1)
  606. str+="原片";
  607. else if(m_mode==2)
  608. str+="初修片";
  609. else if(m_mode==3)
  610. str+="精修片";
  611. else if(m_mode==5)
  612. str+="设计片";
  613. strDelContent.Format("客人%s,订单号%s的分店%s的全部%s被同步删除",m_name,m_id,g_branchname,str);
  614. WriteLog(strDelContent);
  615. #endif
  616. }
  617. }
  618. void ShowPic::OnBUTdel() // 删除按钮;
  619. {
  620. // TODO: Add your control notification handler code here
  621. POSITION pos;
  622. pos=m_List1.GetFirstSelectedItemPosition();
  623. if(pos==NULL)
  624. {
  625. AfxMessageBox("请先选中您要删除的照片!", MB_ICONINFORMATION);
  626. return;
  627. }
  628. if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  629. CStringArray delarray;
  630. int nDelCount = 0; // Jeff add:被删除的相片数量;
  631. CString strDelContent; // Jeff add:删除操作的日志内容;
  632. //CStringArray strDelArray; // Jeff add:被删除的相片名称;
  633. while(pos)
  634. {
  635. int iItem=m_List1.GetNextSelectedItem(pos);
  636. CString title=m_List1.GetItemText(iItem, 0);
  637. #if 0// Jeff.
  638. ::DeleteFile(m_path+title+".jpg");
  639. ::DeleteFile(m_path+title+".NEF");
  640. ::DeleteFile(m_path+title+".CR2");
  641. ::DeleteFile(m_path+title+".raw");
  642. #else
  643. // log的内容字段长度有限,写不下这么多文字;
  644. // 被删除的文件名不记录,只记录删除的张数;
  645. /* if(::DeleteFile(m_path+title+".jpg"))
  646. strDelArray.Add(title+".jpb");
  647. if(::DeleteFile(m_path+title+".NEF"))
  648. strDelArray.Add(title+".NEF");
  649. if(::DeleteFile(m_path+title+".CR2"))
  650. strDelArray.Add(title+".CR2");
  651. if(::DeleteFile(m_path+title+".raw"))
  652. strDelArray.Add(title+".raw");*/
  653. ::DeleteFile(m_path+title+".jpg");
  654. ::DeleteFile(m_path+title+".NEF");
  655. ::DeleteFile(m_path+title+".CR2");
  656. ::DeleteFile(m_path+title+".raw");
  657. nDelCount++;
  658. #endif
  659. int pos=title.ReverseFind ('\\');
  660. if(pos!=-1)
  661. {
  662. ::DeleteFile(m_path+title.Left(pos+1)+"s"+title.Right (title.GetLength ()-pos-1)+".jpg");
  663. ::DeleteFile(m_path+title.Left(pos+1)+"m"+title.Right (title.GetLength ()-pos-1)+".jpg");
  664. }
  665. else
  666. {
  667. ::DeleteFile(m_path+"s"+title+".jpg");
  668. ::DeleteFile(m_path+"m"+title+".jpg");
  669. }
  670. if(m_mode==1 && g_branchname!="")
  671. { //拍照,加景点
  672. CString file2=m_path+title;
  673. int pos=file2.Find(m_id);
  674. pos+=m_id.GetLength();
  675. int pos2=file2.ReverseFind('\\');
  676. CString jd;
  677. if(pos2>pos)
  678. {
  679. jd=file2.Mid(pos+1, pos2-pos-1);
  680. }
  681. CString task;
  682. if(jd!="")
  683. task=jd+"\\"+file2.Right (file2.GetLength ()-pos2-1);
  684. else
  685. task=file2.Right (file2.GetLength ()-pos2-1);
  686. delarray.Add(task);
  687. }
  688. else
  689. {
  690. delarray.Add(title);
  691. }
  692. }
  693. LoadPhotos();
  694. #if 0//Jeff.
  695. CString str;
  696. str="删除客人";
  697. str+=m_name;
  698. str+=m_id;
  699. if(m_mode==1)
  700. str+="原片";
  701. else if(m_mode==2)
  702. str+="初修片";
  703. else if(m_mode==3)
  704. str+="精修片";
  705. else if(m_mode==5)
  706. str+="设计片";
  707. WriteLog(str);
  708. #else
  709. CString str;
  710. if(m_mode==1)
  711. str+="原片";
  712. else if(m_mode==2)
  713. str+="初修片";
  714. else if(m_mode==3)
  715. str+="精修片";
  716. else if(m_mode==5)
  717. str+="设计片";
  718. strDelContent.Format("删除%s, 订单号%s的%s:共删除%d张",m_name,m_id,str,nDelCount);
  719. WriteLog(strDelContent);
  720. strDelContent = str;
  721. #endif
  722. if(delarray.GetSize()&&g_branchname!="")
  723. {
  724. str.Format("是否同步删除分店 %s 的照片?", g_branchname);
  725. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  726. CString sql="deletephotos";
  727. if(m_mode==1)//拍照
  728. sql+="0";
  729. else if(m_mode==2)//初修
  730. sql+="1";
  731. else if(m_mode==3)//精修
  732. sql+="2";
  733. else if(m_mode==5)//设计
  734. sql+="3";
  735. sql+=m_id;
  736. sql+=";";
  737. for(int i=0; i<delarray.GetSize(); i++)
  738. {
  739. sql+=delarray.ElementAt(i);
  740. sql+=",";
  741. }
  742. g_sendhead.bsql=1;
  743. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  744. AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
  745. #if 1//Jeff add;
  746. if(m_mode==1)
  747. str+="原片";
  748. else if(m_mode==2)
  749. str+="初修片";
  750. else if(m_mode==3)
  751. str+="精修片";
  752. else if(m_mode==5)
  753. str+="设计片";
  754. strDelContent.Format("客人%s,订单号%s的分店%s的%s被同步删除",m_name,m_id,g_branchname,str);
  755. WriteLog(strDelContent);
  756. #endif
  757. }
  758. else if(delarray.GetSize()&& m_branch!="")
  759. {
  760. if(GetBranchPhotoPath(m_branch)=="")return;
  761. str.Format("是否同步删除分店 %s 的照片?", m_branch);
  762. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  763. CString sql="deletephotos";
  764. if(m_mode==1)//拍照
  765. sql+="0";
  766. else if(m_mode==2)//初修
  767. sql+="1";
  768. else if(m_mode==3)//精修
  769. sql+="2";
  770. else if(m_mode==5)//设计
  771. sql+="3";
  772. sql+=m_id;
  773. sql+=";";
  774. for(int i=0; i<delarray.GetSize(); i++)
  775. {
  776. sql+=delarray.ElementAt(i);
  777. sql+=",";
  778. }
  779. g_sendhead.bsql=1;
  780. g_branchip=GetIP(m_branch);
  781. g_pMainWnd->OnDisconnect();
  782. g_branchname=m_branch;
  783. g_bBranchModify=1;
  784. g_pMainWnd->ProcessChatMessageRequest2(sql);
  785. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  786. if(g_bSendOK==0)return;
  787. AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
  788. #if 1//Jeff add;
  789. if(m_mode==1)
  790. str+="原片";
  791. else if(m_mode==2)
  792. str+="初修片";
  793. else if(m_mode==3)
  794. str+="精修片";
  795. else if(m_mode==5)
  796. str+="设计片";
  797. strDelContent.Format("客人%s,订单号%s的分店%s的%s被同步删除",m_name,m_id,g_branchname,str);
  798. WriteLog(strDelContent);
  799. #endif
  800. }
  801. }
  802. extern void SaveTaskPath(CString path);
  803. void ShowPic::OnBUTupload() //上传照片;
  804. {
  805. // TODO: Add your control notification handler code here
  806. if(1)//g_branchname=="")
  807. {
  808. OnBUTupload2();
  809. return;
  810. }
  811. // ZipTypeDlg dlg;
  812. // dlg.DoModal ();
  813. CString m_sel;
  814. if(m_mode==1)//拍照
  815. {
  816. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(78);
  817. }
  818. else if(m_mode==2)//初修
  819. {
  820. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(79);
  821. }
  822. else if(m_mode==3)//精修
  823. {
  824. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(80);
  825. }
  826. else if(m_mode==5)//设计
  827. {
  828. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(81);
  829. }
  830. CStringArray m_uploadtaskarray;
  831. m_uploadtaskarray .Add (m_id+";"+m_name);
  832. m_uploadtaskarray .Add ("");
  833. m_uploadtaskarray .Add ("");
  834. m_uploadtaskarray .Add (m_sel);
  835. m_uploadtaskarray .Add ("");
  836. m_uploadtaskarray .Add ("");
  837. m_uploadtaskarray .Add ("");
  838. m_uploadtaskarray .Add ("");
  839. m_uploadtaskarray .Add ("");
  840. m_uploadtaskarray .Add ("");
  841. MyLock lock("uploadtaskaccess");
  842. CFile fp;
  843. CString pathdir=m_path+"uploadtask";
  844. {
  845. int pos=pathdir.Find (m_id);
  846. pos+=m_id.GetLength ();
  847. int pos2=pathdir.ReverseFind ('\\');
  848. pathdir=pathdir.Left (pos)+pathdir.Right (pathdir.GetLength ()-pos2);
  849. }
  850. CString path;
  851. int taskpos=1;
  852. CStringArray m_olduploadtaskarray;
  853. for(int i=0; i<200; i++)
  854. {
  855. path.Format ("%s%d.dat", pathdir, i+1);
  856. if(::CheckFileExist (path))
  857. {
  858. CFile fp;
  859. if(fp.Open (path, CFile::modeRead))
  860. {
  861. DWORD length=fp.GetLength ();
  862. if(!length)continue;
  863. CStringArray m_array;
  864. CArchive ar(&fp, CArchive::load);
  865. m_array.Serialize (ar);
  866. fp.Close ();
  867. for(int j=10; j<m_array.GetSize (); j+=2)
  868. {
  869. m_olduploadtaskarray.Add (m_array.ElementAt (j));
  870. }
  871. }
  872. }
  873. }
  874. BOOL bexist=0;
  875. POSITION pos;
  876. pos=m_List1.GetFirstSelectedItemPosition();
  877. if(pos==NULL)
  878. {
  879. AfxMessageBox("请选择您要上传的文件!");return;
  880. }
  881. else
  882. {
  883. while (pos)
  884. {
  885. int iItem=m_List1.GetNextSelectedItem(pos);
  886. CString title=m_List1.GetItemText (iItem, 0);
  887. CString file2=m_path+title+".jpg";
  888. if(m_mode==1)
  889. { //拍照,加景点
  890. int pos=file2.Find (m_id);
  891. pos+=m_id.GetLength ();
  892. int pos2=file2.ReverseFind ('\\');
  893. CString jd;
  894. if(pos2>pos)
  895. {
  896. jd=file2.Mid(pos+1, pos2-pos-1);
  897. }
  898. CString task;
  899. if(jd!="")
  900. task=jd+"\\"+file2.Right (file2.GetLength ()-pos2-1);
  901. else
  902. task=file2.Right (file2.GetLength ()-pos2-1);
  903. if(::FindArray (&m_olduploadtaskarray, task)==-1)
  904. {
  905. m_uploadtaskarray.Add (task);
  906. m_uploadtaskarray.Add ("");
  907. }
  908. else
  909. bexist=1;
  910. }
  911. else
  912. {
  913. if(::FindArray (&m_olduploadtaskarray, file2.Right (file2.GetLength ()-m_path.GetLength ()))==-1)
  914. {
  915. m_uploadtaskarray.Add (file2.Right (file2.GetLength ()-m_path.GetLength ()));
  916. m_uploadtaskarray.Add ("");
  917. }
  918. else
  919. bexist=1;
  920. }
  921. }
  922. }
  923. {
  924. if(m_uploadtaskarray.GetSize ()>10)
  925. {
  926. CFile fp;
  927. CString path;
  928. int taskpos=1;
  929. path.Format ("%s%d.dat", pathdir, taskpos);
  930. CString dir=path.Left (path.ReverseFind ('\\')+1);
  931. pathdir=g_path1+"\\上传任务\\";
  932. ::CreateDirectory(pathdir, NULL);
  933. path.Format ("%s%d.dat", pathdir, taskpos);
  934. while(::CheckFileExist (path))
  935. {
  936. taskpos++;
  937. path.Format ("%s%d.dat", pathdir, taskpos);
  938. }
  939. fp.Open (path, CFile::modeCreate|CFile::modeWrite);
  940. CArchive ar(&fp, CArchive::store);
  941. m_uploadtaskarray.SetAt(4, dir);
  942. m_uploadtaskarray.Serialize (ar);
  943. ar.Close();
  944. fp.Close ();
  945. // SaveTaskPath(path);
  946. }
  947. if(bexist)
  948. AfxMessageBox("已有存在的任务,存在的任务被忽略,保存上传任务成功!");
  949. else
  950. AfxMessageBox("保存上传任务成功!");
  951. }
  952. }
  953. void ShowPic::OnBUTselall()
  954. {
  955. // TODO: Add your control notification handler code here
  956. for(int i=0; i<m_List1.GetItemCount (); i++)
  957. m_List1.SetItemState (i, LVIS_SELECTED, LVIS_SELECTED);
  958. }
  959. void ShowPic::OnSelchangeCombo2()
  960. {
  961. // TODO: Add your control notification handler code here
  962. int pos=m_combobranch.GetCurSel ();
  963. if(pos==-1)return;
  964. CString str;
  965. m_combobranch.GetLBText (pos, str);
  966. if(m_mode==4)//礼服
  967. {
  968. m_type=str;
  969. LoadPhotos();
  970. return;
  971. }
  972. GetDlgItem(IDC_BUTupload)->SetWindowText("上传至"+str);
  973. GetDlgItem(IDC_BUTupload)->Invalidate();
  974. }
  975. void ShowPic::OnBUTupload2()
  976. {
  977. int combopos=m_combobranch.GetCurSel ();
  978. if(combopos==-1)
  979. {
  980. AfxMessageBox("请选择您要上传到的分店!");
  981. return;
  982. }
  983. CString domain=m_iparray.ElementAt (combopos);
  984. CString savedomain;
  985. if(m_branch!="")
  986. {
  987. savedomain=GetDomainFromBranch(m_branch);
  988. }
  989. else
  990. {
  991. savedomain=GetDomainFromBranch(g_branchname);
  992. if(g_branchname=="")
  993. savedomain=g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (2);
  994. }
  995. /* if(g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (2)=="")
  996. {
  997. AfxMessageBox("加密锁未设置,请到服务器设置加密锁,重启服务器,重启客户端再试!");
  998. return;
  999. }*/
  1000. // ZipTypeDlg dlg;
  1001. // dlg.DoModal ();
  1002. CString m_sel;
  1003. if(m_mode==1)//拍照
  1004. {
  1005. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(78);
  1006. }
  1007. else if(m_mode==2)//初修
  1008. {
  1009. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(79);
  1010. }
  1011. else if(m_mode==3)//精修
  1012. {
  1013. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(80);
  1014. }
  1015. else if(m_mode==5)//设计
  1016. {
  1017. m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(81);
  1018. }
  1019. CStringArray m_uploadtaskarray;
  1020. m_uploadtaskarray .Add (m_id+";"+m_name);
  1021. m_uploadtaskarray .Add (domain);
  1022. m_uploadtaskarray .Add (savedomain);
  1023. m_uploadtaskarray .Add (m_sel);
  1024. m_uploadtaskarray .Add ("");
  1025. m_uploadtaskarray .Add ("");
  1026. m_uploadtaskarray .Add ("");
  1027. m_uploadtaskarray .Add ("");
  1028. m_uploadtaskarray .Add ("");
  1029. m_uploadtaskarray .Add ("");
  1030. MyLock lock("uploadtaskaccess");
  1031. CFile fp;
  1032. CString pathdir=m_path+"uploadtask";
  1033. {
  1034. int pos=pathdir.Find (m_id);
  1035. pos+=m_id.GetLength ();
  1036. int pos2=pathdir.ReverseFind ('\\');
  1037. pathdir=pathdir.Left (pos)+pathdir.Right (pathdir.GetLength ()-pos2);
  1038. }
  1039. CString path;
  1040. int taskpos=1;
  1041. CStringArray m_olduploadtaskarray;
  1042. for(int i=0; i<200; i++)
  1043. {
  1044. path.Format ("%s%d.dat", pathdir, i+1);
  1045. if(::CheckFileExist (path))
  1046. {
  1047. CFile fp;
  1048. if(fp.Open (path, CFile::modeRead))
  1049. {
  1050. DWORD length=fp.GetLength ();
  1051. if(!length)continue;
  1052. CStringArray m_array;
  1053. CArchive ar(&fp, CArchive::load);
  1054. m_array.Serialize (ar);
  1055. fp.Close ();
  1056. if(domain!=m_array.ElementAt (1))continue;
  1057. for(int j=10; j<m_array.GetSize (); j+=2)
  1058. {
  1059. m_olduploadtaskarray.Add (m_array.ElementAt (j));
  1060. }
  1061. }
  1062. }
  1063. }
  1064. BOOL bexist=0;
  1065. POSITION pos;
  1066. pos=m_List1.GetFirstSelectedItemPosition();
  1067. if(pos==NULL)
  1068. {
  1069. AfxMessageBox("请选择您要上传的文件!");return;
  1070. }
  1071. else
  1072. {
  1073. while (pos)
  1074. {
  1075. int iItem=m_List1.GetNextSelectedItem(pos);
  1076. CString title=m_List1.GetItemText (iItem, 0);
  1077. CString file2=m_path+title+".jpg";
  1078. if(m_mode==1)
  1079. { //拍照,加景点
  1080. int pos=file2.Find (m_id);
  1081. pos+=m_id.GetLength ();
  1082. int pos2=file2.ReverseFind ('\\');
  1083. CString jd;
  1084. if(pos2>pos)
  1085. {
  1086. jd=file2.Mid(pos+1, pos2-pos-1);
  1087. }
  1088. CString task;
  1089. if(jd!="")
  1090. task=jd+"\\"+file2.Right (file2.GetLength ()-pos2-1);
  1091. else
  1092. task=file2.Right (file2.GetLength ()-pos2-1);
  1093. if(::FindArray (&m_olduploadtaskarray, task)==-1)
  1094. {
  1095. m_uploadtaskarray.Add (task);
  1096. // AfxMessageBox(task);
  1097. m_uploadtaskarray.Add ("");
  1098. }
  1099. else
  1100. bexist=1;
  1101. }
  1102. else
  1103. {
  1104. if(::FindArray (&m_olduploadtaskarray, file2.Right (file2.GetLength ()-m_path.GetLength ()))==-1)
  1105. {
  1106. m_uploadtaskarray.Add (file2.Right (file2.GetLength ()-m_path.GetLength ()));
  1107. m_uploadtaskarray.Add ("");
  1108. }
  1109. else
  1110. bexist=1;
  1111. }
  1112. }
  1113. }
  1114. {
  1115. if(m_uploadtaskarray.GetSize ()>10)
  1116. {
  1117. CFile fp;
  1118. CString path;
  1119. int taskpos=1;
  1120. path.Format ("%s%d.dat", pathdir, taskpos);
  1121. CString dir=path.Left (path.ReverseFind ('\\')+1);
  1122. pathdir=g_path1+"\\上传任务\\";
  1123. ::CreateDirectory(pathdir, NULL);
  1124. path.Format ("%s%d.dat", pathdir, taskpos);
  1125. while(::CheckFileExist (path))
  1126. {
  1127. taskpos++;
  1128. path.Format ("%s%d.dat", pathdir, taskpos);
  1129. }
  1130. fp.Open (path, CFile::modeCreate|CFile::modeWrite);
  1131. CArchive ar(&fp, CArchive::store);
  1132. m_uploadtaskarray.SetAt(4, dir);
  1133. m_uploadtaskarray.Serialize (ar);
  1134. ar.Close();
  1135. fp.Close ();
  1136. // SaveTaskPath(path);
  1137. // CString dir=path.Left (path.ReverseFind ('\\')+1);
  1138. // AfxMessageBox(dir);
  1139. }
  1140. if(bexist)
  1141. AfxMessageBox("已有存在的任务,存在的任务被忽略,保存上传任务成功!");
  1142. else
  1143. AfxMessageBox("保存上传任务成功!");
  1144. }
  1145. }
  1146. void ShowPic::OnBUTSetDesignNo()
  1147. {
  1148. // TODO: Add your control notification handler code here
  1149. SetDesignNo dlg;
  1150. dlg.m_id =m_id;
  1151. dlg.DoModal ();
  1152. }
  1153. void ShowPic::OnBUTexport()
  1154. {
  1155. // TODO: Add your control notification handler code here
  1156. if(IsHasRights2new(12)==0)return;
  1157. // TODO: Add your control notification handler code here
  1158. POSITION pos;
  1159. pos=m_List1.GetFirstSelectedItemPosition();
  1160. if(pos==NULL)
  1161. {
  1162. AfxMessageBox("请先选中您要导出的照片!", MB_ICONINFORMATION);
  1163. return;
  1164. }
  1165. CStringArray array;
  1166. CString dir;
  1167. GetSavePath(dir);
  1168. if(dir.IsEmpty())
  1169. {
  1170. return;
  1171. }
  1172. dir.TrimRight ('\\');
  1173. dir+="\\";
  1174. dir+=m_id;
  1175. dir+=m_name2;
  1176. dir+="设计好的片修";
  1177. dir+="\\";
  1178. ::CreateDirectory (dir, NULL);
  1179. CStringArray desarray;
  1180. CStringArray dirarray;
  1181. CString str,str2;
  1182. int pos2;
  1183. while (pos)
  1184. {
  1185. int iItem=m_List1.GetNextSelectedItem(pos);
  1186. str=m_List1.GetItemText (iItem, 0);
  1187. str=m_path+str+".jpg";
  1188. array.Add (str);
  1189. str2=dir+m_List1.GetItemText (iItem, 0)+".jpg";
  1190. desarray.Add(str2);
  1191. str2="";
  1192. str=m_List1.GetItemText (iItem, 0);
  1193. pos2=str.Find("\\");
  1194. while(pos2!=-1)
  1195. {
  1196. str2+=str.Left(pos2)+"\\";
  1197. if(::FindArray(&dirarray, str2)==-1)
  1198. {
  1199. dirarray.Add(str2);
  1200. ::CreateDirectory (dir+str2, NULL);
  1201. }
  1202. str=str.Right(str.GetLength()-pos2-1);
  1203. pos2=str.Find("\\");
  1204. }
  1205. }
  1206. CStdioFile fp;
  1207. fp.Open (dir+"客户要求.txt", CFile::modeCreate|CFile::modeWrite);
  1208. fp.WriteString (remark);
  1209. fp.Close ();
  1210. ImportPhoto dlg;
  1211. dlg.m_mode =1;
  1212. dlg.m_pArray=&array;
  1213. dlg.m_pDesArray=&desarray;
  1214. dlg.m_savepath =dir;
  1215. dlg.DoModal (); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1216. // CString str;
  1217. str=" 导出设计片 ";
  1218. str+="客人:";
  1219. str+=m_name+m_id;
  1220. WriteLog(str);
  1221. }