BeautifySkinFrom.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. // BeautifySkinFrom.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZSendMsg.h"
  5. #include "BeautifySkinFrom.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. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. //#pragma comment(lib, "Shlwapi.lib")
  18. /////////////////////////////////////////////////////////////////////////////
  19. // BeautifySkinFrom
  20. IMPLEMENT_DYNCREATE(BeautifySkinFrom, CFormView)
  21. BeautifySkinFrom::BeautifySkinFrom()
  22. : CFormView(BeautifySkinFrom::IDD)
  23. {
  24. //{{AFX_DATA_INIT(BeautifySkinFrom)
  25. m_filter = _T("");
  26. //}}AFX_DATA_INIT
  27. }
  28. BeautifySkinFrom::~BeautifySkinFrom()
  29. {
  30. }
  31. void BeautifySkinFrom::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CFormView::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(BeautifySkinFrom)
  35. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  36. DDX_Control(pDX, IDC_LIST2, m_List1);
  37. DDX_Control(pDX, IDC_STATIC1, m_static1);
  38. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(BeautifySkinFrom, CFormView)
  42. //{{AFX_MSG_MAP(BeautifySkinFrom)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  48. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  49. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  50. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  51. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  52. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  53. //}}AFX_MSG_MAP
  54. END_MESSAGE_MAP()
  55. /////////////////////////////////////////////////////////////////////////////
  56. // BeautifySkinFrom diagnostics
  57. #ifdef _DEBUG
  58. void BeautifySkinFrom::AssertValid() const
  59. {
  60. CFormView::AssertValid();
  61. }
  62. void BeautifySkinFrom::Dump(CDumpContext& dc) const
  63. {
  64. CFormView::Dump(dc);
  65. }
  66. #endif //_DEBUG
  67. /////////////////////////////////////////////////////////////////////////////
  68. // BeautifySkinFrom message handlers
  69. void BeautifySkinFrom::OnInitialUpdate()
  70. {
  71. CFormView::OnInitialUpdate();
  72. // TODO: Add your specialized code here and/or call the base class
  73. CMyMdi Mdi;
  74. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  75. // Here we create the outbar control using the splitter as its parent
  76. // and setting its id to the first pane.
  77. CRect rc2;
  78. GetWindowRect(rc2);
  79. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  80. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  81. m_static1.SetFont (&g_titlefont);
  82. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;拍照,100;修片,100;加急,100;取件日期,100;摄影师,100;修片人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  83. m_List1.LoadColumnInfo (118);
  84. if(g_bShowOK==0)
  85. {
  86. CString filter="status3='未取'";
  87. g_sendhead.bsql=0;
  88. g_sendhead.code[0]=30;
  89. g_sendhead.tabcount=1;
  90. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  91. }
  92. else
  93. {
  94. g_sendhead.bsql=0;
  95. g_sendhead.code[0]=30;
  96. g_sendhead.tabcount=1;
  97. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  98. }
  99. DataToArray(&m_List1array);
  100. m_combo1.AddString (g_user.name);
  101. for(int i=0; i<g_userarray.GetSize (); i++)
  102. {
  103. m_combo1.AddString (g_userarray.ElementAt (i).ElementAt (1) );
  104. }
  105. FillGrid();
  106. m_combo1.GetWindowRect (rc2);
  107. ScreenToClient(rc2);
  108. rc2.bottom +=200;
  109. m_combo1.MoveWindow (rc2);
  110. GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(8));
  111. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(9));
  112. }
  113. void BeautifySkinFrom::FillGrid(BOOL bStatus)
  114. {
  115. m_List1.DeleteAllItems2 ();
  116. int ii=0;
  117. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  118. int count=0;
  119. if(m_filter.IsEmpty ())
  120. {
  121. if(bStatus)
  122. {
  123. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  124. {
  125. if(m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK")
  126. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  127. }
  128. }
  129. else
  130. {
  131. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  132. {
  133. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  134. }
  135. }
  136. }
  137. else
  138. {
  139. if(bStatus)
  140. {
  141. int type=GetType(m_filter);
  142. if(type==1)//电话
  143. {
  144. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  145. {
  146. if(m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK" && (m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  147. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1) )
  148. {
  149. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  150. }
  151. }
  152. }
  153. else if(type==2)//拼音
  154. {
  155. m_filter.MakeUpper ();
  156. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  157. {
  158. if(m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK" &&(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  159. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1))
  160. {
  161. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  162. }
  163. }
  164. }
  165. else
  166. {
  167. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  168. {
  169. if(m_List1array.ElementAt (ii).ElementAt (3)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4)!="OK" &&(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  170. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  171. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  172. m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1 || \
  173. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  174. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1|| \
  175. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1|| \
  176. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  177. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1) )
  178. {
  179. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  180. }
  181. }
  182. }
  183. }
  184. else
  185. {
  186. int type=GetType(m_filter);
  187. if(type==1)//电话
  188. {
  189. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  190. {
  191. if(m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  192. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1)
  193. {
  194. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  195. }
  196. }
  197. }
  198. else if(type==2)//拼音
  199. {
  200. m_filter.MakeUpper ();
  201. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  202. {
  203. if(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  204. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1)
  205. {
  206. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  207. }
  208. }
  209. }
  210. else
  211. {
  212. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  213. {
  214. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  215. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  216. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  217. m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1 || \
  218. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  219. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1|| \
  220. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1|| \
  221. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  222. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 )
  223. {
  224. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  225. }
  226. }
  227. }
  228. }
  229. }
  230. m_List1.m_arLabels.SetSize(count, 1);
  231. ii=count;
  232. m_List1.m_LabelCount=ii;
  233. m_List1.SetItemCountEx (ii);
  234. CString str;
  235. str.Format ("单数:%d", ii);
  236. SetDlgItemText(IDC_STATIC2, str);
  237. }
  238. void BeautifySkinFrom::OnBUTclose()
  239. {
  240. // TODO: Add your control notification handler code here
  241. GetParent()->SendMessage(WM_CLOSE);
  242. }
  243. void BeautifySkinFrom::OnSelchangeCombo1()
  244. {
  245. // TODO: Add your control notification handler code here
  246. SetTimer(1, 100, NULL);
  247. }
  248. void BeautifySkinFrom::OnTimer(UINT nIDEvent)
  249. {
  250. // TODO: Add your message handler code here and/or call default
  251. KillTimer(nIDEvent);
  252. OnButton1();
  253. }
  254. BOOL BeautifySkinFrom::PreTranslateMessage(MSG* pMsg)
  255. {
  256. // TODO: Add your specialized code here and/or call the base class
  257. try
  258. {
  259. if(pMsg->message==WM_KEYDOWN)
  260. {
  261. switch (pMsg->wParam)
  262. {
  263. case VK_RETURN:
  264. OnButton1();
  265. return 1;
  266. case 0x43: // copy
  267. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  268. {
  269. GetFocus()->SendMessage(WM_COPY);
  270. return TRUE;
  271. }
  272. break;
  273. case 0x56: //Ctrl + V:
  274. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  275. {
  276. GetFocus()->SendMessage(WM_PASTE);
  277. return TRUE;
  278. }
  279. break;
  280. case 0x58: // cut
  281. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  282. {
  283. GetFocus()->SendMessage(WM_CUT);
  284. return TRUE;
  285. }
  286. break;
  287. case 0x5A: //undo
  288. case 0x59: //redo
  289. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  290. {
  291. GetFocus()->SendMessage(WM_UNDO);
  292. return TRUE;
  293. }
  294. break;
  295. }
  296. }
  297. return CFormView::PreTranslateMessage(pMsg);
  298. }
  299. catch(...)
  300. {
  301. }
  302. }
  303. void BeautifySkinFrom::OnBUTimportphoto()
  304. {
  305. // TODO: Add your control notification handler code here
  306. POSITION pos;
  307. pos=m_List1.GetFirstSelectedItemPosition();
  308. if(pos==NULL)
  309. {
  310. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  311. return;
  312. }
  313. int iItem=m_List1.GetNextSelectedItem(pos);
  314. CString id=m_List1.GetItemText (iItem, 0);
  315. CString oldstatus=m_List1.GetItemText (iItem, 4);
  316. CString name=m_List1.GetItemText (iItem, 1)+","+m_List1.GetItemText (iItem, 2);
  317. name.TrimLeft (",");
  318. name.TrimRight (",");
  319. name="客人:"+name;
  320. CString phone=m_List1.GetItemText (iItem, 12)+","+m_List1.GetItemText (iItem, 13);
  321. phone.TrimLeft (",");
  322. phone.TrimRight (",");
  323. phone="电话:"+phone;
  324. if(g_path2.IsEmpty ())
  325. {
  326. AfxMessageBox("未设置已修片保存机器, 请通知系统管理员!", MB_ICONINFORMATION);
  327. return;
  328. }
  329. if(!::PathFileExists (g_path2))
  330. {
  331. AfxMessageBox("已修片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  332. return;
  333. }
  334. CString savepath=g_path2+"\\";
  335. savepath+=id+"\\";
  336. if(::PathFileExists (savepath)==0)
  337. ::CreateDirectory (savepath, NULL);
  338. CFileDialog fdlg(true, NULL,"openfile", OFN_ALLOWMULTISELECT,"jpg文件(*.jpg)|*.jpg||");
  339. TCHAR szBuffer[6000]={0};
  340. fdlg.m_ofn.lpstrFile = szBuffer;
  341. fdlg.m_ofn.nMaxFile = 6000;
  342. if(fdlg.DoModal ()!=IDOK)
  343. {
  344. CString status4;
  345. if(AfxMessageBox("客照是否全部修饰完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  346. status4="OK";
  347. else
  348. status4="修片中";
  349. CString sql;
  350. sql="update dindan set status4='"+status4+"' 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 (4, status4);
  359. FillGrid();
  360. break;
  361. }
  362. }
  363. return;
  364. }
  365. pos=fdlg.GetStartPosition ();
  366. CStringArray array;
  367. CString str,temp;
  368. while(pos!=NULL)
  369. {
  370. str=fdlg.GetNextPathName (pos);
  371. temp=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  372. temp=temp.Left (temp.Find ('.'));
  373. if(CheckOK(temp)==0)
  374. {
  375. temp.Format ("%s.jpg\r\n文件名非法, 此文件将被忽略! 照片必须从软件中'导出原片'处导出, 文件名必须为3位数字!", temp);
  376. AfxMessageBox(temp, MB_ICONSTOP);
  377. continue;
  378. }
  379. array.Add(str);
  380. }
  381. if(array.GetSize ()==0)return;
  382. if(oldstatus!="未修")
  383. {
  384. str.Format ("%s\r\n%s\r\n此单已导入过修片,确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone );
  385. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)
  386. return;
  387. }
  388. else
  389. {
  390. CString str;
  391. str.Format ("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone );
  392. if(AfxMessageBox(str, MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  393. return;
  394. }
  395. ImportPhoto dlg;
  396. dlg.m_pArray=&array;
  397. dlg.m_savepath =savepath;
  398. dlg.DoModal ();
  399. CString status4;
  400. if(AfxMessageBox("客照是否全部修饰完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  401. status4="OK";
  402. else
  403. status4="修片中";
  404. CString sql;
  405. sql="update dindan set status4='"+status4+"',waiter5='"+g_user.name+"' where id='"+id+"'";
  406. sql+=DINDAN_REF;
  407. g_sendhead.bsql=1;
  408. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  409. savepath+="ok";
  410. ::DeleteFile (savepath);
  411. AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
  412. for(int i=0; i<m_List1array.GetSize (); i++)
  413. {
  414. if(id==m_List1array.ElementAt (i).ElementAt (0))
  415. {
  416. m_List1array.ElementAt (i).SetAt (4, status4);
  417. m_List1array.ElementAt (i).SetAt (8, g_user.name);
  418. FillGrid();
  419. break;
  420. }
  421. }
  422. }
  423. void BeautifySkinFrom::OnBUTshowphoto()
  424. {
  425. // TODO: Add your control notification handler code here
  426. POSITION pos;
  427. pos=m_List1.GetFirstSelectedItemPosition();
  428. if(pos==NULL)
  429. {
  430. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  431. return;
  432. }
  433. int iItem=m_List1.GetNextSelectedItem(pos);
  434. CString status=m_List1.GetItemText (iItem, 4);
  435. CString id=m_List1.GetItemText (iItem, 0);
  436. if(status=="未修")
  437. {
  438. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  439. return;
  440. }
  441. ShowPic dlg;
  442. dlg.m_mode=2;
  443. dlg.m_path=g_path2+"\\";
  444. dlg.m_path+=id;
  445. dlg.m_path +="\\";
  446. dlg.DoModal ();
  447. }
  448. void BeautifySkinFrom::OnBUTexportphoto()
  449. {
  450. // TODO: Add your control notification handler code here
  451. if(IsHasRights2new(8)==0)return;
  452. POSITION pos;
  453. pos=m_List1.GetFirstSelectedItemPosition();
  454. if(pos==NULL)
  455. {
  456. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  457. return;
  458. }
  459. int iItem=m_List1.GetNextSelectedItem(pos);
  460. CString id=m_List1.GetItemText (iItem, 0);
  461. CString path;
  462. path=g_path1+"\\";
  463. path+=id;
  464. path +="\\";
  465. CString temp;
  466. CStringArray array;
  467. using namespace helper_coffs;
  468. ffsco o;
  469. o.dirs(0);
  470. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  471. ffsco::typeT coo;
  472. ffsco::typeT::iterator it;
  473. coo = o.co_file();
  474. for (it = coo.begin();
  475. coo.end() != it;
  476. it ++)
  477. {
  478. temp=(*it).c_str();
  479. if(temp.GetAt (temp.ReverseFind ('\\')+1)!='s')
  480. {
  481. array.Add (temp);
  482. }
  483. }
  484. if(array.GetSize ()==0)
  485. {
  486. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  487. return;
  488. }
  489. CString dir;
  490. GetSavePath(dir);
  491. if(dir.IsEmpty())
  492. {
  493. return;
  494. }
  495. CString name1=m_List1.GetItemText (iItem, 1);
  496. CString name2=m_List1.GetItemText (iItem, 2);
  497. dir.TrimRight ('\\');
  498. dir+="\\";
  499. dir+=id;
  500. dir+=name1;
  501. dir+=name2;
  502. dir+="原片";
  503. dir+="\\";
  504. ::CreateDirectory (dir, NULL);
  505. ImportPhoto dlg;
  506. dlg.m_mode =1;
  507. dlg.m_pArray=&array;
  508. dlg.m_savepath =dir;
  509. dlg.DoModal (); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  510. }
  511. void BeautifySkinFrom::OnBUTexportphoto2()
  512. {
  513. if(IsHasRights2new(9)==0)return;
  514. // TODO: Add your control notification handler code here
  515. POSITION pos;
  516. pos=m_List1.GetFirstSelectedItemPosition();
  517. if(pos==NULL)
  518. {
  519. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  520. return;
  521. }
  522. int iItem=m_List1.GetNextSelectedItem(pos);
  523. CString id=m_List1.GetItemText (iItem, 0);
  524. CString path;
  525. path=g_path2+"\\";
  526. path+=id;
  527. path +="\\";
  528. CString temp;
  529. CStringArray array;
  530. using namespace helper_coffs;
  531. ffsco o;
  532. o.dirs(0);
  533. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  534. ffsco::typeT coo;
  535. ffsco::typeT::iterator it;
  536. coo = o.co_file();
  537. for (it = coo.begin();
  538. coo.end() != it;
  539. it ++)
  540. {
  541. temp=(*it).c_str();
  542. if(temp.GetAt (temp.ReverseFind ('\\')+1)!='s')
  543. {
  544. array.Add (temp);
  545. }
  546. }
  547. if(array.GetSize ()==0)
  548. {
  549. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  550. return;
  551. }
  552. CString dir;
  553. GetSavePath(dir);
  554. if(dir.IsEmpty())
  555. {
  556. return;
  557. }
  558. CString name1=m_List1.GetItemText (iItem, 1);
  559. CString name2=m_List1.GetItemText (iItem, 2);
  560. dir.TrimRight ('\\');
  561. dir+="\\";
  562. dir+=id;
  563. dir+=name1;
  564. dir+=name2;
  565. dir+="修好的片";
  566. dir+="\\";
  567. ::CreateDirectory (dir, NULL);
  568. ImportPhoto dlg;
  569. dlg.m_mode =1;
  570. dlg.m_pArray=&array;
  571. dlg.m_savepath =dir;
  572. dlg.DoModal (); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  573. }
  574. void BeautifySkinFrom::OnButton1()
  575. {
  576. // TODO: Add your control notification handler code here
  577. UpdateData();
  578. m_filter.TrimLeft ();
  579. m_filter.TrimRight ();
  580. FillGrid();
  581. }
  582. void BeautifySkinFrom::OnButton2()
  583. {
  584. // TODO: Add your control notification handler code here
  585. UpdateData();
  586. m_filter.TrimLeft ();
  587. m_filter.TrimRight ();
  588. FillGrid(1);
  589. }
  590. void BeautifySkinFrom::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  591. {
  592. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  593. // TODO: Add your control notification handler code here
  594. POSITION pos;
  595. pos=m_List1.GetFirstSelectedItemPosition();
  596. if(pos==NULL)
  597. {
  598. return;
  599. }
  600. int iItem=m_List1.GetNextSelectedItem(pos);
  601. CString waiter5=m_List1.GetItemText (iItem, 8);
  602. if(waiter5.IsEmpty () && IsHasRights2new(5) || IsHasRights2new(49))
  603. {
  604. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  605. }
  606. else if(waiter5==g_user.name && IsHasRights2new(5) )
  607. {
  608. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  609. }
  610. else
  611. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  612. *pResult = 0;
  613. }
  614. BOOL BeautifySkinFrom::CheckOK(CString name)
  615. {
  616. if(name.GetLength ()>4)return 0;
  617. for(int i=0; i<name.GetLength (); i++)
  618. {
  619. if(name.GetAt (i)<'0'||name.GetAt (i)>'9')return 0;
  620. }
  621. return 1;
  622. }