ShowPic.cpp 31 KB

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