BeautifySkinFrom2.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. // BeautifySkinFrom2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "BeautifySkinFrom2.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "ClientDlg.h"
  10. #include "ImportPhoto.h"
  11. #include "ShowPic.h"
  12. #include "SelectPhotoDlg.h"
  13. #include "./helper/ffsco.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. //#pragma comment(lib, "Shlwapi.lib")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // BeautifySkinFrom2
  22. IMPLEMENT_DYNCREATE(BeautifySkinFrom2, CFormView)
  23. BeautifySkinFrom2::BeautifySkinFrom2()
  24. : CFormView(BeautifySkinFrom2::IDD)
  25. {
  26. //{{AFX_DATA_INIT(BeautifySkinFrom2)
  27. m_filter = _T("");
  28. //}}AFX_DATA_INIT
  29. }
  30. BeautifySkinFrom2::~BeautifySkinFrom2()
  31. {
  32. }
  33. void BeautifySkinFrom2::DoDataExchange(CDataExchange* pDX)
  34. {
  35. CFormView::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(BeautifySkinFrom2)
  37. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  38. DDX_Control(pDX, IDC_LIST2, m_List1);
  39. DDX_Control(pDX, IDC_STATIC1, m_static1);
  40. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(BeautifySkinFrom2, CFormView)
  44. //{{AFX_MSG_MAP(BeautifySkinFrom2)
  45. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  46. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  47. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  48. ON_WM_TIMER()
  49. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  50. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  51. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  52. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  53. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  54. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  55. //}}AFX_MSG_MAP
  56. END_MESSAGE_MAP()
  57. /////////////////////////////////////////////////////////////////////////////
  58. // BeautifySkinFrom2 diagnostics
  59. #ifdef _DEBUG
  60. void BeautifySkinFrom2::AssertValid() const
  61. {
  62. CFormView::AssertValid();
  63. }
  64. void BeautifySkinFrom2::Dump(CDumpContext& dc) const
  65. {
  66. CFormView::Dump(dc);
  67. }
  68. #endif //_DEBUG
  69. /////////////////////////////////////////////////////////////////////////////
  70. // BeautifySkinFrom2 message handlers
  71. void BeautifySkinFrom2::OnInitialUpdate()
  72. {
  73. CFormView::OnInitialUpdate();
  74. // TODO: Add your specialized code here and/or call the base class
  75. CMyMdi Mdi;
  76. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  77. // Here we create the outbar control using the splitter as its parent
  78. // and setting its id to the first pane.
  79. CRect rc2;
  80. GetWindowRect(rc2);
  81. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  82. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  83. m_static1.SetFont (&g_titlefont);
  84. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;精修,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  85. m_List1.LoadColumnInfo (122);
  86. if(g_bShowOK==0)
  87. {
  88. CString filter="status3='未取'";
  89. g_sendhead.bsql=0;
  90. g_sendhead.code[0]=35;
  91. g_sendhead.tabcount=1;
  92. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  93. }
  94. else
  95. {
  96. g_sendhead.bsql=0;
  97. g_sendhead.code[0]=35;
  98. g_sendhead.tabcount=1;
  99. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  100. }
  101. DataToArray(&m_List1array);
  102. m_combo1.AddString (g_user.name);
  103. for(int i=0; i<g_userarray.GetSize (); i++)
  104. {
  105. m_combo1.AddString (g_userarray.ElementAt (i).ElementAt (1) );
  106. }
  107. FillGrid();
  108. m_combo1.GetWindowRect (rc2);
  109. ScreenToClient(rc2);
  110. rc2.bottom +=200;
  111. m_combo1.MoveWindow (rc2);
  112. GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(10));
  113. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(11));
  114. }
  115. void BeautifySkinFrom2::FillGrid(BOOL bStatus)
  116. {
  117. m_List1.DeleteAllItems2 ();
  118. int ii=0;
  119. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  120. int count=0;
  121. if(m_filter.IsEmpty ())
  122. {
  123. if(bStatus)
  124. {
  125. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  126. {
  127. if(m_List1array.ElementAt (ii).ElementAt (4)=="OK"&&m_List1array.ElementAt (ii).ElementAt (5)!="OK")
  128. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  129. }
  130. }
  131. else
  132. {
  133. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  134. {
  135. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  136. }
  137. }
  138. }
  139. else
  140. {
  141. if(bStatus)
  142. {
  143. int type=GetType(m_filter);
  144. if(type==1)//电话
  145. {
  146. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  147. {
  148. if(m_List1array.ElementAt (ii).ElementAt (4)=="OK"&&m_List1array.ElementAt (ii).ElementAt (5)!="OK" && (m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  149. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1) )
  150. {
  151. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  152. }
  153. }
  154. }
  155. else if(type==2)//拼音
  156. {
  157. m_filter.MakeUpper ();
  158. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  159. {
  160. if(m_List1array.ElementAt (ii).ElementAt (4)=="OK"&&m_List1array.ElementAt (ii).ElementAt (5)!="OK" &&(m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1 || \
  161. m_List1array.ElementAt (ii).ElementAt (16).Find (m_filter)!=-1))
  162. {
  163. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  164. }
  165. }
  166. }
  167. else
  168. {
  169. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  170. {
  171. if(m_List1array.ElementAt (ii).ElementAt (4)=="OK"&&m_List1array.ElementAt (ii).ElementAt (5)!="OK" &&(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  172. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  173. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  174. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  175. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1 || \
  176. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1|| \
  177. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1|| \
  178. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  179. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1) )
  180. {
  181. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  182. }
  183. }
  184. }
  185. }
  186. else
  187. {
  188. int type=GetType(m_filter);
  189. if(type==1)//电话
  190. {
  191. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  192. {
  193. if(m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  194. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1)
  195. {
  196. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  197. }
  198. }
  199. }
  200. else if(type==2)//拼音
  201. {
  202. m_filter.MakeUpper ();
  203. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  204. {
  205. if(m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1 || \
  206. m_List1array.ElementAt (ii).ElementAt (16).Find (m_filter)!=-1)
  207. {
  208. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  209. }
  210. }
  211. }
  212. else
  213. {
  214. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  215. {
  216. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  217. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  218. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  219. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  220. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1 || \
  221. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1|| \
  222. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1|| \
  223. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  224. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 )
  225. {
  226. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  227. }
  228. }
  229. }
  230. }
  231. }
  232. m_List1.m_arLabels.SetSize(count, 1);
  233. ii=count;
  234. m_List1.m_LabelCount=ii;
  235. m_List1.SetItemCountEx (ii);
  236. CString str;
  237. str.Format ("单数:%d", ii);
  238. SetDlgItemText(IDC_STATIC2, str);
  239. }
  240. void BeautifySkinFrom2::OnBUTclose()
  241. {
  242. // TODO: Add your control notification handler code here
  243. GetParent()->SendMessage(WM_CLOSE);
  244. }
  245. void BeautifySkinFrom2::OnSelchangeCombo1()
  246. {
  247. // TODO: Add your control notification handler code here
  248. SetTimer(1, 100, NULL);
  249. }
  250. void BeautifySkinFrom2::OnTimer(UINT nIDEvent)
  251. {
  252. // TODO: Add your message handler code here and/or call default
  253. KillTimer(nIDEvent);
  254. OnButton1();
  255. }
  256. BOOL BeautifySkinFrom2::PreTranslateMessage(MSG* pMsg)
  257. {
  258. // TODO: Add your specialized code here and/or call the base class
  259. try
  260. {
  261. if(pMsg->message==WM_KEYDOWN)
  262. {
  263. switch (pMsg->wParam)
  264. {
  265. case VK_RETURN:
  266. OnButton1();
  267. return 1;
  268. case 0x43: // copy
  269. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  270. {
  271. GetFocus()->SendMessage(WM_COPY);
  272. return TRUE;
  273. }
  274. break;
  275. case 0x56: //Ctrl + V:
  276. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  277. {
  278. GetFocus()->SendMessage(WM_PASTE);
  279. return TRUE;
  280. }
  281. break;
  282. case 0x58: // cut
  283. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  284. {
  285. GetFocus()->SendMessage(WM_CUT);
  286. return TRUE;
  287. }
  288. break;
  289. case 0x5A: //undo
  290. case 0x59: //redo
  291. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  292. {
  293. GetFocus()->SendMessage(WM_UNDO);
  294. return TRUE;
  295. }
  296. break;
  297. }
  298. }
  299. return CFormView::PreTranslateMessage(pMsg);
  300. }
  301. catch(...)
  302. {
  303. }
  304. }
  305. void BeautifySkinFrom2::OnBUTimportphoto()
  306. {
  307. // TODO: Add your control notification handler code here
  308. POSITION pos;
  309. pos=m_List1.GetFirstSelectedItemPosition();
  310. if(pos==NULL)
  311. {
  312. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  313. return;
  314. }
  315. int iItem=m_List1.GetNextSelectedItem(pos);
  316. CString id=m_List1.GetItemText (iItem, 0);
  317. CString oldstatus=m_List1.GetItemText (iItem, 5);
  318. CString name=m_List1.GetItemText (iItem, 1)+","+m_List1.GetItemText (iItem, 2);
  319. name.TrimLeft (",");
  320. name.TrimRight (",");
  321. name="客人:"+name;
  322. CString phone=m_List1.GetItemText (iItem, 13)+","+m_List1.GetItemText (iItem, 14);
  323. phone.TrimLeft (",");
  324. phone.TrimRight (",");
  325. phone="电话:"+phone;
  326. if(g_path4.IsEmpty ())
  327. {
  328. AfxMessageBox("未设置精修片保存机器, 请通知系统管理员!", MB_ICONINFORMATION);
  329. return;
  330. }
  331. if(!::PathFileExists (g_path4))
  332. {
  333. AfxMessageBox("精修片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  334. return;
  335. }
  336. CString savepath=g_path4+"\\";
  337. savepath+=id+"\\";
  338. if(::PathFileExists (savepath)==0)
  339. ::CreateDirectory (savepath, NULL);
  340. CString srcdir;CString str;
  341. GetSavePath(srcdir);
  342. if(srcdir.IsEmpty())
  343. {
  344. CString status6;
  345. if(AfxMessageBox("客照是否全部精修完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  346. status6="OK";
  347. else
  348. status6="修片中";
  349. CString sql;
  350. sql="update dindan set status6='"+status6+"' where id='"+id+"'";
  351. sql+=DINDAN_REF;
  352. g_sendhead.bsql=1;
  353. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  354. for(int i=0; i<m_List1array.GetSize (); i++)
  355. {
  356. if(id==m_List1array.ElementAt (i).ElementAt (0))
  357. {
  358. m_List1array.ElementAt (i).SetAt (5, status6);
  359. FillGrid();
  360. break;
  361. }
  362. }
  363. return;
  364. }
  365. if(srcdir.GetLength ()<4)
  366. {
  367. AfxMessageBox("请选择正确的您文件所在的目录!", MB_ICONSTOP);
  368. return;
  369. }
  370. if(oldstatus!="未修")
  371. {
  372. str.Format ("%s\r\n%s\r\n此单已导入过修片,确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone );
  373. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)
  374. return;
  375. }
  376. else
  377. {
  378. str.Format ("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone );
  379. if(AfxMessageBox(str, MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  380. return;
  381. }
  382. CStringArray array;
  383. CStringArray desarray;
  384. CStringArray dirarray;
  385. if(1)
  386. {
  387. using namespace helper_coffs;
  388. ffsco o;
  389. o.dirs(1);
  390. o.find(LPCSTR(srcdir), LPCSTR("*.*"));
  391. ffsco::typeT coo;
  392. ffsco::typeT::iterator it;
  393. coo = o.co_dir();
  394. for (it = coo.begin();
  395. coo.end() != it;
  396. it ++)
  397. {
  398. str=(*it).c_str();
  399. if(FindArray(&dirarray, str)==-1)
  400. {
  401. dirarray.Add (str);
  402. if(str!=dirarray.ElementAt (0))
  403. {
  404. str=savepath+str.Right (str.GetLength ()-dirarray.ElementAt (0).GetLength ());
  405. if(::PathFileExists (str)==0)
  406. ::CreateDirectory (str, NULL);
  407. }
  408. }
  409. }
  410. }
  411. if(1)
  412. {
  413. for(int i=0; i<dirarray.GetSize (); i++)
  414. {
  415. using namespace helper_coffs;
  416. ffsco o;
  417. o.dirs(0);
  418. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  419. ffsco::typeT coo;
  420. ffsco::typeT::iterator it;
  421. coo = o.co_file();
  422. for (it = coo.begin();
  423. coo.end() != it;
  424. it ++)
  425. {
  426. str=(*it).c_str();
  427. array.Add (str);
  428. desarray.Add (savepath+dirarray.ElementAt (i).Right (dirarray.ElementAt (i).GetLength ()-dirarray.ElementAt (0).GetLength ())+str.Right (str.GetLength ()-str.ReverseFind ('\\')-1));
  429. }
  430. }
  431. }
  432. if(array.GetSize ()==0)return;
  433. ImportPhoto dlg;
  434. dlg.m_bOverWrite=1;
  435. dlg.m_pArray=&array;
  436. dlg.m_pDesArray=&desarray;
  437. dlg.m_savepath =savepath;
  438. dlg.DoModal ();
  439. CString status6;
  440. if(AfxMessageBox("客照是否全部精修完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  441. status6="OK";
  442. else
  443. status6="修片中";
  444. CString sql;
  445. sql="update dindan set status6='"+status6+"',waiter7='"+g_user.name+"' where id='"+id+"'";
  446. sql+=DINDAN_REF;
  447. g_sendhead.bsql=1;
  448. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  449. savepath+="ok";
  450. ::DeleteFile (savepath);
  451. AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
  452. for(int i=0; i<m_List1array.GetSize (); i++)
  453. {
  454. if(id==m_List1array.ElementAt (i).ElementAt (0))
  455. {
  456. m_List1array.ElementAt (i).SetAt (5, status6);
  457. m_List1array.ElementAt (i).SetAt (9, g_user.name);
  458. FillGrid();
  459. break;
  460. }
  461. }
  462. }
  463. void BeautifySkinFrom2::OnBUTshowphoto()
  464. {
  465. // TODO: Add your control notification handler code here
  466. POSITION pos;
  467. pos=m_List1.GetFirstSelectedItemPosition();
  468. if(pos==NULL)
  469. {
  470. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  471. return;
  472. }
  473. int iItem=m_List1.GetNextSelectedItem(pos);
  474. CString status=m_List1.GetItemText (iItem, 5);
  475. CString id=m_List1.GetItemText (iItem, 0);
  476. if(status=="未修")
  477. {
  478. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  479. return;
  480. }
  481. ShowPic dlg;
  482. dlg.m_mode=3;
  483. dlg.m_path=g_path4+"\\";
  484. dlg.m_path+=id;
  485. dlg.m_path +="\\";
  486. dlg.DoModal ();
  487. }
  488. int FindArray(CStringArray *pArray, CString Str)
  489. {
  490. for(int i=0; i<pArray->GetSize (); i++)
  491. {
  492. if(pArray->ElementAt (i)==Str)
  493. return i;
  494. }
  495. return -1;
  496. }
  497. void BeautifySkinFrom2::GetNo(CString str, CStringArray &array)
  498. {
  499. if(!str.IsEmpty ())
  500. {
  501. int pos=str.Find (",");
  502. while(pos!=-1)
  503. {
  504. if(FindArray(&array, str.Left (pos))==-1)
  505. array.Add (str.Left (pos));
  506. str=str.Right (str.GetLength ()-pos-1);
  507. pos=str.Find (",");
  508. }
  509. if(FindArray(&array, str)==-1)
  510. array.Add(str);
  511. }
  512. }
  513. CString BeautifySkinFrom2::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  514. {
  515. CString ret;
  516. name=","+name+",";
  517. CString str;
  518. for(int i=0; i<spnamearray.GetSize (); i++)
  519. {
  520. str=","+spnamearray.ElementAt (i).ElementAt (6)+",";
  521. if(str.Find (name)!=-1)
  522. {
  523. ret+=spnamearray.ElementAt (i).ElementAt (5);
  524. ret+=";";
  525. }
  526. }
  527. ret.TrimRight (";");
  528. ret.Replace ("*", "x");
  529. return ret;
  530. }
  531. void BeautifySkinFrom2::OnBUTexportphoto()
  532. {
  533. if(IsHasRights2new(10)==0)return;
  534. // TODO: Add your control notification handler code here
  535. UpdateData();
  536. POSITION pos;
  537. pos=m_List1.GetFirstSelectedItemPosition();
  538. if(pos==NULL)
  539. {
  540. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  541. return;
  542. }
  543. int iItem=m_List1.GetNextSelectedItem(pos);
  544. CString status2=m_List1.GetItemText (iItem, 4);
  545. if(status2!="OK")
  546. {
  547. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  548. return;
  549. }
  550. CString id=m_List1.GetItemText (iItem, 0);
  551. CString name1=m_List1.GetItemText (iItem, 1);
  552. CString name2=m_List1.GetItemText (iItem, 2);
  553. CString filter="id='"+id+"';id='"+id+"'";
  554. g_sendhead.bsql=0;
  555. g_sendhead.code[0]=50;
  556. g_sendhead.code[1]=11;
  557. g_sendhead.tabcount=2;
  558. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  559. CArray<CStringArray, CStringArray>sparray;
  560. DataToArray( &sparray, &g_List1array);
  561. CString path=g_path2+"\\";
  562. SelectPhotoDlg selectdlg;
  563. selectdlg.DoModal ();
  564. path+=id;
  565. path +="\\";
  566. ////////////////////////////////////////
  567. CString str,spname;
  568. CStringArray noarray;
  569. CStringArray spnamearray;
  570. for(int i=0; i<sparray.GetSize (); i++)
  571. {
  572. str=sparray.ElementAt (i).ElementAt (6);
  573. spname=sparray.ElementAt (i).ElementAt (5);
  574. GetNo(str, noarray);
  575. }
  576. if(noarray.GetSize ()==0)
  577. {
  578. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  579. return;
  580. }
  581. spnamearray.SetSize(noarray.GetSize ());
  582. for( i=0; i<noarray.GetSize (); i++)
  583. {
  584. str=noarray.ElementAt (i);
  585. spnamearray.SetAt (i, GetSelName(str, sparray)+"-"+str );
  586. }
  587. CString dir;
  588. GetSavePath(dir);
  589. if(dir.IsEmpty())return;
  590. dir.TrimRight ('\\');
  591. dir+="\\";
  592. dir+=id;
  593. dir+=name1;
  594. dir+=name2;
  595. dir+="选片";
  596. dir+="\\";
  597. CStringArray array;
  598. CStringArray spnamearray2;
  599. CString src,des;
  600. if(selectdlg.m_mode==0)
  601. {
  602. for(i=0; i<noarray.GetSize (); i++)
  603. {
  604. src.Format ("%s%s.jpg", path, noarray.ElementAt (i));
  605. if(::PathFileExists (src))
  606. {
  607. array.Add (src);
  608. if(selectdlg.m_check1)
  609. spnamearray2.Add (spnamearray.ElementAt (i));
  610. else
  611. spnamearray2.Add (noarray.ElementAt (i));
  612. }
  613. else
  614. AfxMessageBox("未找到初修过的文件:"+src.Right (src.GetLength ()-src.ReverseFind ('\\')-1), MB_ICONINFORMATION);
  615. }
  616. }
  617. if(array.GetSize ()==0)
  618. {
  619. if(selectdlg.m_mode==0)
  620. AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
  621. path=g_path1+"\\";
  622. path+=id;
  623. path +="\\";
  624. dir.Delete (dir.GetLength ()-1, 1);
  625. dir+="(未修)\\";
  626. for(i=0; i<noarray.GetSize (); i++)
  627. {
  628. src.Format ("%s%s.jpg", path, noarray.ElementAt (i));
  629. if(!::PathFileExists (src))
  630. src.Format ("%s%s.jpeg", path, noarray.ElementAt (i));
  631. if(::PathFileExists (src))
  632. {
  633. array.Add (src);
  634. if(selectdlg.m_check1)
  635. spnamearray2.Add (spnamearray.ElementAt (i));
  636. else
  637. spnamearray2.Add (noarray.ElementAt (i));
  638. }
  639. }
  640. }
  641. if(array.GetSize ()==0)
  642. {
  643. AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
  644. return;
  645. }
  646. ::CreateDirectory (dir, NULL);
  647. ImportPhoto dlg;
  648. dlg.m_mode =1;
  649. dlg.m_pArray=&array;
  650. dlg.m_pArray2=&spnamearray2;
  651. dlg.m_savepath =dir;
  652. dlg.DoModal ();
  653. //////////////
  654. if(g_List1array.GetSize ())
  655. {
  656. CStdioFile fp;
  657. fp.Open (dir+"客户要求.txt", CFile::modeCreate|CFile::modeWrite);
  658. fp.WriteString (g_List1array.ElementAt (0).ElementAt (39));
  659. fp.Close ();
  660. }
  661. //////////////
  662. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  663. }
  664. void BeautifySkinFrom2::OnBUTexportphoto2()
  665. {
  666. if(IsHasRights2new(11)==0)return;
  667. // TODO: Add your control notification handler code here
  668. POSITION pos;
  669. pos=m_List1.GetFirstSelectedItemPosition();
  670. if(pos==NULL)
  671. {
  672. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  673. return;
  674. }
  675. int iItem=m_List1.GetNextSelectedItem(pos);
  676. CString id=m_List1.GetItemText (iItem, 0);
  677. CString path;
  678. path=g_path4+"\\";
  679. path+=id;
  680. path +="\\";
  681. CStringArray array;
  682. CString dir;
  683. GetSavePath(dir);
  684. if(dir.IsEmpty())
  685. {
  686. return;
  687. }
  688. CString name1=m_List1.GetItemText (iItem, 1);
  689. CString name2=m_List1.GetItemText (iItem, 2);
  690. dir.TrimRight ('\\');
  691. dir+="\\";
  692. dir+=id;
  693. dir+=name1;
  694. dir+=name2;
  695. dir+="精修好的片";
  696. dir+="\\";
  697. ::CreateDirectory (dir, NULL);
  698. CStringArray desarray;
  699. CStringArray dirarray;
  700. CString savepath=dir;
  701. CString str;
  702. if(1)
  703. {
  704. using namespace helper_coffs;
  705. ffsco o;
  706. o.dirs(1);
  707. o.find(LPCSTR(path), LPCSTR("*.*"));
  708. ffsco::typeT coo;
  709. ffsco::typeT::iterator it;
  710. coo = o.co_dir();
  711. for (it = coo.begin();
  712. coo.end() != it;
  713. it ++)
  714. {
  715. str=(*it).c_str();
  716. if(FindArray(&dirarray, str)==-1)
  717. {
  718. dirarray.Add (str);
  719. if(str!=dirarray.ElementAt (0))
  720. {
  721. str=savepath+str.Right (str.GetLength ()-dirarray.ElementAt (0).GetLength ());
  722. if(::PathFileExists (str)==0)
  723. ::CreateDirectory (str, NULL);
  724. }
  725. }
  726. }
  727. }
  728. if(1)
  729. {
  730. for(int i=0; i<dirarray.GetSize (); i++)
  731. {
  732. using namespace helper_coffs;
  733. ffsco o;
  734. o.dirs(0);
  735. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  736. ffsco::typeT coo;
  737. ffsco::typeT::iterator it;
  738. coo = o.co_file();
  739. for (it = coo.begin();
  740. coo.end() != it;
  741. it ++)
  742. {
  743. str=(*it).c_str();
  744. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  745. array.Add (str);
  746. desarray.Add (savepath+dirarray.ElementAt (i).Right (dirarray.ElementAt (i).GetLength ()-dirarray.ElementAt (0).GetLength ())+str.Right (str.GetLength ()-str.ReverseFind ('\\')-1));
  747. }
  748. }
  749. }
  750. if(array.GetSize ()==0)
  751. {
  752. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  753. return;
  754. }
  755. ImportPhoto dlg;
  756. dlg.m_mode =1;
  757. dlg.m_pArray=&array;
  758. dlg.m_pDesArray=&desarray;
  759. dlg.m_savepath =dir;
  760. dlg.DoModal (); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  761. }
  762. void BeautifySkinFrom2::OnButton1()
  763. {
  764. // TODO: Add your control notification handler code here
  765. UpdateData();
  766. m_filter.TrimLeft ();
  767. m_filter.TrimRight ();
  768. FillGrid();
  769. }
  770. void BeautifySkinFrom2::OnButton2()
  771. {
  772. // TODO: Add your control notification handler code here
  773. UpdateData();
  774. m_filter.TrimLeft ();
  775. m_filter.TrimRight ();
  776. FillGrid(1);
  777. }
  778. void BeautifySkinFrom2::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  779. {
  780. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  781. // TODO: Add your control notification handler code here
  782. POSITION pos;
  783. pos=m_List1.GetFirstSelectedItemPosition();
  784. if(pos==NULL)
  785. {
  786. return;
  787. }
  788. int iItem=m_List1.GetNextSelectedItem(pos);
  789. CString waiter7=m_List1.GetItemText (iItem, 9);
  790. if(waiter7.IsEmpty () && IsHasRights2new(6) || IsHasRights2new(49))
  791. {
  792. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  793. }
  794. else if(waiter7==g_user.name && IsHasRights2new(6) )
  795. {
  796. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  797. }
  798. else
  799. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  800. *pResult = 0;
  801. }