BurnCD.cpp 23 KB

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