BurnCD.cpp 22 KB

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