ChoosePhotoForm.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. // ChoosePhotoForm.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ChoosePhotoForm.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "ImportPhoto.h"
  10. #include "ChoosePhotoSkin2.h"
  11. #include "Login2.h"
  12. #include "ShowCut.h"
  13. #include "CompareContent.h"
  14. #include "SelBrunDevice.h"
  15. #include "DelHC.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. #pragma comment(lib, "Shlwapi.lib")
  22. /////////////////////////////////////////////////////////////////////////////
  23. IMPLEMENT_DYNCREATE(ChoosePhotoForm, MyFormView)
  24. ChoosePhotoForm::ChoosePhotoForm(): MyFormView(ChoosePhotoForm::IDD)
  25. {
  26. m_filter = _T("");
  27. }
  28. ChoosePhotoForm::~ChoosePhotoForm()
  29. {
  30. }
  31. void ChoosePhotoForm::DoDataExchange(CDataExchange* pDX)
  32. {
  33. MyFormView::DoDataExchange(pDX);
  34. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  35. DDX_Control(pDX, IDC_LIST2, m_List1);
  36. DDX_Control(pDX, IDC_STATIC1, m_static1);
  37. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  38. }
  39. BEGIN_MESSAGE_MAP(ChoosePhotoForm, MyFormView)
  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_BUTmoney, OnBUTmoney)
  46. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  47. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  48. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  49. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  50. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  51. ON_BN_CLICKED(IDC_BUTexportphoto3, OnBUTexportphoto3)
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. #ifdef _DEBUG
  55. void ChoosePhotoForm::AssertValid() const
  56. {
  57. MyFormView::AssertValid();
  58. }
  59. void ChoosePhotoForm::Dump(CDumpContext& dc) const
  60. {
  61. MyFormView::Dump(dc);
  62. }
  63. #endif //_DEBUG
  64. void ChoosePhotoForm::OnInitialUpdate()
  65. {
  66. MyFormView::OnInitialUpdate();
  67. CMyMdi Mdi;
  68. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  69. CRect rc2;
  70. GetWindowRect(rc2);
  71. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  72. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  73. int idarray[] = { IDC_BUTshowphoto, IDC_BUTexportphoto2, IDC_BUTexportphoto3, IDC_BUTexportphoto, IDC_BUTmoney, IDC_BUTclose };
  74. int idcount = 6;
  75. int btnwid;
  76. CRect prerc;
  77. for (int a = idcount - 2; a >= 0; a--)
  78. {
  79. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  80. ScreenToClient(prerc);
  81. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  82. ScreenToClient(rc2);
  83. btnwid = rc2.Width();
  84. rc2.right = prerc.left;
  85. rc2.left = rc2.right - btnwid;
  86. GetDlgItem(idarray[a])->MoveWindow(rc2);
  87. }
  88. // Jeff.在初修状态后添加精修日期;
  89. m_static1.SetFont(&g_titlefont);
  90. #ifdef CHILD_VERSION // 15列;
  91. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;修片日期,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  92. #else
  93. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;修片日期,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  94. #endif
  95. m_List1.LoadColumnInfo(116);
  96. if (g_bShowOK == 0)
  97. {
  98. #ifdef LKAY_VERSION
  99. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  100. #else
  101. CString filter = "status3='未取'";
  102. #endif
  103. g_sendhead.bsql = 0;
  104. g_sendhead.code[0] = 28;
  105. g_sendhead.tabcount = 1;
  106. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  107. }
  108. else
  109. {
  110. g_sendhead.bsql = 0;
  111. g_sendhead.code[0] = 28;
  112. g_sendhead.tabcount = 1;
  113. #ifdef LKAY_VERSION
  114. CString filter="dindantype<>'意向客户' or dindantype is null";
  115. g_pMainWnd->ProcessChatMessageRequest2(filter);
  116. #else
  117. g_pMainWnd->ProcessChatMessageRequest2(1);
  118. #endif
  119. if (g_bSendOK == 0)return;
  120. }
  121. DataToArray(&m_List1array);
  122. HidePrice();
  123. m_combo1.AddString(g_user.name);
  124. for (int i = 0; i < g_userarray.GetSize(); i++)
  125. {
  126. m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
  127. }
  128. FillGrid();
  129. m_combo1.GetWindowRect(rc2);
  130. ScreenToClient(rc2);
  131. rc2.bottom += 200;
  132. m_combo1.MoveWindow(rc2);
  133. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  134. SetComboHei(&m_combo1, rc2.Height());
  135. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(IsHasRights2new(15));
  136. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(15));
  137. GetDlgItem(IDC_BUTexportphoto3)->EnableWindow(IsHasRights2new(15));
  138. }
  139. void ChoosePhotoForm::FillGrid(BOOL bStatus)
  140. {
  141. if (g_bSearchFilter) // 条件查询;
  142. {
  143. m_List1.DeleteAllItems2();
  144. int ii = 0;
  145. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  146. int count = 0;
  147. {
  148. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  149. {
  150. // 查询条件==选片日期;
  151. if (g_filterdate1 != "")
  152. {
  153. if (m_List1array.ElementAt(ii).ElementAt(6) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(6) > g_filterdate2)
  154. continue;
  155. }
  156. // 查询条件==选片人;
  157. if (g_waiter1 != "")
  158. {
  159. if (m_List1array.ElementAt(ii).ElementAt(10) != g_waiter1)
  160. continue;
  161. }
  162. if (1)
  163. {
  164. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  165. }
  166. }
  167. }
  168. m_List1.m_arLabels.SetSize(count, 1);
  169. ii = count;
  170. m_List1.m_LabelCount = ii;
  171. m_List1.SetItemCountEx(ii);
  172. CString str;
  173. str.Format("单数:%d", ii);
  174. SetDlgItemText(IDC_STATIC2, str);
  175. }
  176. else
  177. {
  178. m_List1.DeleteAllItems2();
  179. int ii = 0;
  180. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  181. int count = 0;
  182. if (m_filter.IsEmpty())
  183. {
  184. if (bStatus) // 已修未选;
  185. {
  186. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  187. {
  188. // 查询条件==修片OK && 未选片;
  189. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK" && m_List1array.ElementAt(ii).ElementAt(5) != "OK")
  190. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  191. }
  192. }
  193. else
  194. {
  195. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  196. {
  197. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  198. }
  199. }
  200. }
  201. else
  202. {
  203. if (bStatus) // 已修未选;
  204. {
  205. int type = GetType(m_filter);
  206. if (type == 1)//电话
  207. {
  208. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  209. {
  210. // 查询条件==修片OK && 未选片 &&(手机1||手机2);
  211. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK"
  212. && m_List1array.ElementAt(ii).ElementAt(5) != "OK"
  213. //&&(m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1))
  214. && (m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1))
  215. {
  216. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  217. }
  218. }
  219. }
  220. else if (type == 2)//拼音
  221. {
  222. m_filter.MakeUpper();
  223. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  224. {
  225. // 查询条件==修片OK && 未选片 &&(拼音1||拼音2);
  226. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK"
  227. &&m_List1array.ElementAt(ii).ElementAt(5) != "OK"
  228. //&&(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1))
  229. && (m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1))
  230. {
  231. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  232. }
  233. }
  234. }
  235. else
  236. {
  237. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  238. {
  239. // 查询条件==修片OK && 未选片 &&(……);
  240. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK"
  241. &&m_List1array.ElementAt(ii).ElementAt(5) != "OK"
  242. && (
  243. m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || // 订单号;
  244. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || // 男宾姓名;
  245. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || // 女宾姓名;
  246. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || // 接单人;
  247. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || // 选片人;
  248. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || // 套系名称;
  249. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || // 手机1
  250. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1)) // 手机2
  251. {
  252. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  253. }
  254. }
  255. }
  256. }
  257. else
  258. {
  259. int type = GetType(m_filter);
  260. if (type == 1)//电话
  261. {
  262. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  263. {
  264. // 查询条件==手机1 || 手机2;
  265. if (m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 ||
  266. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1)
  267. {
  268. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  269. }
  270. }
  271. }
  272. else if (type == 2)//拼音
  273. {
  274. m_filter.MakeUpper();
  275. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  276. {
  277. // 查询条件==拼音1 || 拼音2;
  278. if (m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 ||
  279. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1)
  280. {
  281. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  282. }
  283. }
  284. }
  285. else
  286. {
  287. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  288. {
  289. // 查询条件==修片OK && 未选片 &&(……);
  290. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || // 订单号;
  291. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || // 男宾姓名;
  292. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || // 女宾姓名;
  293. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || // 接单人;
  294. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || // 选片人;
  295. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || // 套系名称;
  296. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || // 手机1
  297. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1) // 手机2
  298. {
  299. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  300. }
  301. }
  302. }
  303. }
  304. }
  305. m_List1.m_arLabels.SetSize(count, 1);
  306. ii = count;
  307. m_List1.m_LabelCount = ii;
  308. m_List1.SetItemCountEx(ii);
  309. CString str;
  310. str.Format("单数:%d", ii);
  311. SetDlgItemText(IDC_STATIC2, str);
  312. }
  313. if (!g_id.IsEmpty())
  314. {
  315. for (int i = 0; i < m_List1.GetItemCount(); i++)
  316. {
  317. if (g_id == m_List1.GetItemText(i, 0))
  318. {
  319. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  320. m_List1.EnsureVisible(i, FALSE);
  321. break;
  322. }
  323. }
  324. }
  325. }
  326. void ChoosePhotoForm::OnBUTclose()
  327. {
  328. GetParent()->SendMessage(WM_CLOSE);
  329. }
  330. void ChoosePhotoForm::OnSelchangeCombo1()
  331. {
  332. SetTimer(1, 100, NULL);
  333. }
  334. void ChoosePhotoForm::OnTimer(UINT nIDEvent)
  335. {
  336. KillTimer(nIDEvent);
  337. OnButton1();
  338. }
  339. BOOL ChoosePhotoForm::PreTranslateMessage(MSG* pMsg)
  340. {
  341. try
  342. {
  343. if (pMsg->message == WM_KEYDOWN)
  344. {
  345. switch (pMsg->wParam)
  346. {
  347. case VK_RETURN:
  348. OnButton1();
  349. return 1;
  350. case 0x43: // copy
  351. if ((GetKeyState(VK_CONTROL) & 0x80))
  352. {
  353. GetFocus()->SendMessage(WM_COPY);
  354. return TRUE;
  355. }
  356. break;
  357. case 0x56: //Ctrl + V:
  358. if ((GetKeyState(VK_CONTROL) & 0x80))
  359. {
  360. GetFocus()->SendMessage(WM_PASTE);
  361. return TRUE;
  362. }
  363. break;
  364. case 0x58: // cut
  365. if ((GetKeyState(VK_CONTROL) & 0x80))
  366. {
  367. GetFocus()->SendMessage(WM_CUT);
  368. return TRUE;
  369. }
  370. break;
  371. case 0x5A: //undo
  372. case 0x59: //redo
  373. if ((GetKeyState(VK_CONTROL) & 0x80))
  374. {
  375. GetFocus()->SendMessage(WM_UNDO);
  376. return TRUE;
  377. }
  378. break;
  379. }
  380. }
  381. return MyFormView::PreTranslateMessage(pMsg);
  382. }
  383. catch (...)
  384. {
  385. }
  386. }
  387. // Jeff.门市流程 - 选片 - 开始选片
  388. void ChoosePhotoForm::OnBUTshowphoto() // Jeff.开始选片按钮;
  389. {
  390. if (IsHasRights2new(15) == 0) return;
  391. POSITION pos;
  392. pos = m_List1.GetFirstSelectedItemPosition();
  393. if (pos == NULL)
  394. {
  395. AfxMessageBox("请先选中您要选片的定单!", MB_ICONINFORMATION);
  396. return;
  397. }
  398. int iItem = m_List1.GetNextSelectedItem(pos);
  399. CString id = m_List1.GetItemText(iItem, 0);
  400. CString status = m_List1.GetItemText(iItem, 4); // 选片状态;
  401. /* if(atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && status=="OK" && IsHasRights2new(20)==0 )
  402. {
  403. Login2 dlg;
  404. if(dlg.DoModal ()!=IDOK)return;
  405. if(IsHasRightsnew2(20, dlg.m_rights)==0)return;
  406. }*/
  407. // Jeff。向ChoosePhotoSkin2传选片状态值;
  408. ChoosePhotoSkin2 dlg;
  409. dlg.m_strStatusOfChoosePhoto = status;
  410. dlg.SetLiaPath("3.lia");
  411. dlg.m_strOrderNumber = id;
  412. dlg.m_path = g_path2 + "\\";
  413. dlg.m_path += dlg.m_strOrderNumber;
  414. dlg.m_path += "\\";
  415. // printf("Jeff:ChoosePhotoSkin2::m_id=%s\n ChoosePhotoSkin2::m_path=%s\n ChoosePhotoSkin2::m_mode\n\n",dlg.m_id,dlg.m_path,dlg.m_mode);// Jeff Printf;
  416. dlg.DoModal();
  417. g_bInSkin = 0;
  418. if (dlg.m_bSave)
  419. {
  420. #if JEFF_TEST_ON
  421. if (g_bShowOK == 0)
  422. {
  423. #ifdef LKAY_VERSION
  424. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  425. #else
  426. CString filter = "status3='未取'";
  427. #endif
  428. g_sendhead.bsql = 0;
  429. g_sendhead.code[0] = 28;
  430. g_sendhead.tabcount = 1;
  431. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  432. }
  433. else
  434. {
  435. g_sendhead.bsql = 0;
  436. g_sendhead.code[0] = 28;
  437. g_sendhead.tabcount = 1;
  438. #ifdef LKAY_VERSION
  439. CString filter = "dindantype<>'意向客户' or dindantype is null";
  440. g_pMainWnd->ProcessChatMessageRequest2(filter);
  441. #else
  442. g_pMainWnd->ProcessChatMessageRequest2(1);
  443. #endif
  444. if (g_bSendOK == 0)return;
  445. }
  446. DataToArray(&m_List1array);
  447. HidePrice();
  448. m_combo1.AddString(g_user.name);
  449. for (int i = 0; i < g_userarray.GetSize(); i++)
  450. {
  451. m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
  452. }
  453. FillGrid();
  454. #else
  455. for (int i = 0; i < m_List1array.GetSize(); i++)
  456. {
  457. if (id == m_List1array.ElementAt(i).ElementAt(0))
  458. {
  459. m_List1array.ElementAt(i).SetAt(4+1, "OK");
  460. m_List1array.ElementAt(i).SetAt(5+1, dlg.m_time4);
  461. m_List1array.ElementAt(i).SetAt(6+1, dlg.m_money3);
  462. m_List1array.ElementAt(i).SetAt(7+1, dlg.m_choosezs);
  463. if (status != "OK") // Jeff.若选片状态已经OK,则不刷新选片人2014.08.30
  464. m_List1array.ElementAt(i).SetAt(9+1, dlg.m_waiter3);
  465. FillGrid();
  466. break;
  467. }
  468. }
  469. #endif
  470. }
  471. }
  472. void ChoosePhotoForm::OnBUTmoney() // 查看裁剪 按钮;
  473. {
  474. POSITION pos;
  475. pos = m_List1.GetFirstSelectedItemPosition();
  476. if (pos == NULL)
  477. {
  478. AfxMessageBox("请先选中您要查看的客人!", MB_ICONINFORMATION);
  479. return;
  480. }
  481. int iItem = m_List1.GetNextSelectedItem(pos);
  482. CString id = m_List1.GetItemText(iItem, 0);
  483. ShowCut dlg;
  484. dlg.m_mode = 2;
  485. dlg.m_id = id;
  486. dlg.DoModal();
  487. }
  488. void ChoosePhotoForm::OnBUTexportphoto() // 选片更改 按钮;
  489. {
  490. UpdateData();
  491. POSITION pos;
  492. pos = m_List1.GetFirstSelectedItemPosition();
  493. if (pos == NULL)
  494. {
  495. AfxMessageBox("请先选中您要对比的定单!", MB_ICONINFORMATION);
  496. return;
  497. }
  498. int iItem = m_List1.GetNextSelectedItem(pos);
  499. if (m_List1.GetItemText(iItem, 5) != "OK")return;
  500. CCompareContent dlg;
  501. dlg.m_id = m_List1.GetItemText(iItem, 0);
  502. dlg.DoModal();
  503. }
  504. void ChoosePhotoForm::GetNo(CString str, CStringArray &array)
  505. {
  506. if (!str.IsEmpty())
  507. {
  508. int pos = str.Find(",");
  509. while (pos != -1)
  510. {
  511. array.Add(str.Left(pos));
  512. str = str.Right(str.GetLength() - pos - 1);
  513. pos = str.Find(",");
  514. }
  515. array.Add(str);
  516. }
  517. }
  518. int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData)
  519. {
  520. switch (msg)
  521. {
  522. case BFFM_INITIALIZED:
  523. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  524. break;
  525. case BFFM_SELCHANGED:
  526. {
  527. char szFileName[MAX_PATH];
  528. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  529. SHGetPathFromIDList(pidlCurrent, szFileName);
  530. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  531. }
  532. break;
  533. }
  534. return 0;
  535. }
  536. void GetSavePath(CString &path)
  537. {
  538. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  539. LPITEMIDLIST pidlDesktop, pidlCurrent;
  540. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop) == NOERROR)
  541. {
  542. BROWSEINFO bi;
  543. bi.hwndOwner = g_pMainWnd->m_hWnd;
  544. bi.pidlRoot = pidlDesktop;
  545. bi.pszDisplayName = lpszDisplayName;
  546. bi.lpszTitle = "\n文档保存的目录:";
  547. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  548. bi.lpfn = BrowseProc;
  549. bi.lParam = 0;
  550. bi.iImage = 0;
  551. pidlCurrent = SHBrowseForFolder(&bi);
  552. SHGetPathFromIDList(pidlCurrent, szFileName);
  553. path = szFileName;
  554. }
  555. }
  556. int ChoosePhotoForm::FindArray(CStringArray *pArray, CString *pStr)
  557. {
  558. for (int i = 0; i < pArray->GetSize(); i++)
  559. {
  560. if (pArray->ElementAt(i) == *pStr)
  561. return i;
  562. }
  563. return -1;
  564. }
  565. void ChoosePhotoForm::OnButton1() // 查询 按钮;
  566. {
  567. UpdateData();
  568. m_filter.TrimLeft();
  569. m_filter.TrimRight();
  570. FillGrid();
  571. }
  572. void ChoosePhotoForm::OnButton2() // 已修未选 按钮;
  573. {
  574. UpdateData();
  575. m_filter.TrimLeft();
  576. m_filter.TrimRight();
  577. FillGrid(1);
  578. }
  579. void ChoosePhotoForm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  580. {
  581. POSITION pos;
  582. pos = m_List1.GetFirstSelectedItemPosition();
  583. if (pos == NULL)return;
  584. int iItem = m_List1.GetNextSelectedItem(pos);
  585. g_id = m_List1.GetItemText(iItem, 0);
  586. *pResult = 0;
  587. }
  588. void ChoosePhotoForm::HidePrice()
  589. {
  590. #ifdef LKAY_VERSION
  591. if(IsHasRights2new(31))return;
  592. for(int i=0; i< m_List1array.GetSize (); i++)
  593. {
  594. m_List1array.ElementAt (i).SetAt (10, "***");
  595. m_List1array.ElementAt (i).SetAt (11, "***");
  596. m_List1array.ElementAt (i).SetAt (12, "***");
  597. m_List1array.ElementAt (i).SetAt (13, "***");
  598. m_List1array.ElementAt (i).SetAt (6, "***");
  599. }
  600. #else
  601. if (IsHasRights2new(31))return;
  602. for (int i = 0; i < m_List1array.GetSize(); i++)
  603. {
  604. m_List1array.ElementAt(i).SetAt(12, "***");
  605. m_List1array.ElementAt(i).SetAt(13, "***");
  606. }
  607. #endif
  608. }
  609. void ChoosePhotoForm::OnBtnsearchfilter() // 条件查询 按钮;
  610. {
  611. SearchFilter dlg;
  612. dlg.m_mode = 3;
  613. if (dlg.DoModal() == IDOK)
  614. FillGrid();
  615. g_bSearchFilter = 0;
  616. }
  617. BOOL ChoosePhotoForm::IsPhoto2Exist(CString m_id)
  618. {
  619. CString path2;
  620. CString path = g_path2 + "\\";
  621. path += m_id;
  622. path += "\\";
  623. using namespace helper_coffs;
  624. ffsco o;
  625. o.dirs(0);
  626. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  627. ffsco::typeT coo;
  628. coo = o.co_file();
  629. return coo.size();
  630. }
  631. void ChoosePhotoForm::OnBUTexportphoto2() // 缓存本机 按钮;
  632. {
  633. POSITION pos;
  634. pos = m_List1.GetFirstSelectedItemPosition();
  635. if (pos == NULL)
  636. {
  637. AfxMessageBox("请先选中您要缓存的定单!", MB_ICONINFORMATION);
  638. return;
  639. }
  640. ClearHC();
  641. int iItem = m_List1.GetNextSelectedItem(pos);
  642. CString m_id = m_List1.GetItemText(iItem, 0);
  643. CString m_path, m_seltxname;
  644. m_path = g_path2 + "\\";
  645. m_path += m_id;
  646. m_path += "\\";
  647. //////////////////////
  648. CStringArray m_patharray1;
  649. int m_nChoosePhotoType = 2;
  650. if (m_patharray1.GetSize() == 0)
  651. {
  652. if (IsPhoto2Exist(m_id))
  653. {
  654. SelBrunDevice dlg;
  655. dlg.m_mode = 1;
  656. if (dlg.DoModal() == IDOK)
  657. m_nChoosePhotoType = dlg.m_sel;
  658. else
  659. m_nChoosePhotoType = 0;
  660. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  661. }
  662. else
  663. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  664. {
  665. CString path, path2;
  666. m_path = g_path1 + "\\";
  667. m_path += m_id;
  668. m_path += "\\";
  669. if (m_seltxname != "" && m_seltxname != "全部")
  670. {
  671. m_path += m_seltxname; m_path += "\\";
  672. }
  673. if (m_nChoosePhotoType == 1)
  674. {
  675. m_path = g_path2 + "\\";
  676. m_path += m_id;
  677. m_path += "\\";
  678. }
  679. CString filename;
  680. using namespace helper_coffs;
  681. ffsco o;
  682. o.dirs(1);
  683. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  684. ffsco::typeT coo;
  685. ffsco::typeT::iterator it;
  686. coo = o.co_file();
  687. for (it = coo.begin(); coo.end() != it; it++)
  688. {
  689. path = (*it).c_str();
  690. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  691. {
  692. path.MakeLower();
  693. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  694. if (filename.Find(".") != -1)
  695. filename = filename.Left(filename.Find("."));
  696. if (!myisdigit(filename))continue;
  697. if (m_nChoosePhotoType == 1)
  698. {
  699. m_patharray1.Add(path);
  700. }
  701. else
  702. {
  703. path2 = path;
  704. if (m_nChoosePhotoType == 0)
  705. path2.Replace("客户原片", "修好的片");
  706. if (1)
  707. {
  708. int pos = path2.Find(m_id);
  709. pos += m_id.GetLength();
  710. int pos2 = path2.ReverseFind('\\');
  711. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  712. }
  713. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  714. {
  715. m_patharray1.Add(path2);
  716. }
  717. else
  718. {
  719. path2.Replace(".raw", ".jpg");
  720. if (::PathFileExists(path2))
  721. {
  722. m_patharray1.Add(path2); continue;
  723. }
  724. path2.Replace(".nef", ".jpg");
  725. if (::PathFileExists(path2))
  726. {
  727. m_patharray1.Add(path2); continue;
  728. }
  729. path2.Replace(".cr2", ".jpg");
  730. if (::PathFileExists(path2))
  731. {
  732. m_patharray1.Add(path2); continue;
  733. }
  734. else
  735. {
  736. if (path.Right(3) != "jpg")continue;
  737. m_patharray1.Add(path);
  738. }
  739. }
  740. }
  741. }
  742. }
  743. }
  744. // if(0)
  745. {//多种修好的效果
  746. CString path, path2;
  747. path2 = g_path2 + "\\";
  748. path2 += m_id;
  749. path2 += "\\";
  750. using namespace helper_coffs;
  751. ffsco o;
  752. o.dirs(0);
  753. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  754. ffsco::typeT coo;
  755. ffsco::typeT::iterator it;
  756. coo = o.co_file();
  757. for (it = coo.begin();coo.end() != it;it++)
  758. {
  759. path = (*it).c_str();
  760. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  761. {
  762. path.MakeLower();
  763. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  764. if (path2.Find("-") != -1)
  765. {
  766. m_patharray1.Add(path);
  767. }
  768. }
  769. }
  770. }
  771. /////////////////////////
  772. char path[MAX_PATH];
  773. ::GetSystemDirectory(path, MAX_PATH);
  774. CString sysdir = path;
  775. sysdir += "\\lyfz";
  776. ::CreateDirectory(sysdir, NULL);
  777. sysdir += "\\";
  778. sysdir += m_id; ::CreateDirectory(sysdir, NULL);
  779. sysdir += "\\";
  780. //----------------------------------------------------------------------------------------------
  781. // 缓存到本机的相片;
  782. //----------------------------------------------------------------------------------------------
  783. ImportPhoto dlg;
  784. dlg.m_bCopyToLocal = 1;
  785. dlg.m_mode = 1;
  786. dlg.m_pArray = &m_patharray1;
  787. dlg.m_savepath = sysdir;
  788. dlg.DoModal();
  789. AfxMessageBox("缓存成功!");
  790. }
  791. }
  792. CString GetCreateTime(CString path)
  793. {
  794. CFileFind finder;
  795. path.TrimRight("\\");
  796. BOOL bWorking = finder.FindFile(path);
  797. if (bWorking)
  798. {
  799. finder.FindNextFile();
  800. CTime tm;
  801. finder.GetCreationTime(tm);
  802. CTimeSpan dt = CTime::GetCurrentTime() - tm;
  803. CString version = _T("Version 1.0");
  804. int m_dtdays = AfxGetApp()->GetProfileInt(version, "dtdays2", 5);
  805. if (dt.GetDays() >= m_dtdays)
  806. {
  807. ::DeleteDirectory(path); // 递归删除过期缓存;
  808. }
  809. }
  810. return "";
  811. }
  812. void ChoosePhotoForm::ClearHC()
  813. {
  814. char path[MAX_PATH];
  815. ::GetSystemDirectory(path, MAX_PATH);
  816. CString sysdir = path;
  817. sysdir += "\\lyfz";
  818. ::CreateDirectory(sysdir, NULL);
  819. sysdir += "\\";
  820. CString str;
  821. using namespace helper_coffs;
  822. ffsco o;
  823. o.dirs(0);
  824. o.find(LPCSTR(sysdir), LPCSTR("*.*"));
  825. ffsco::typeT coo;
  826. ffsco::typeT::iterator it;
  827. coo = o.co_dir();
  828. for (it = coo.begin(); coo.end() != it; it++)
  829. {
  830. str = (*it).c_str();
  831. if (str == sysdir)continue;
  832. GetCreateTime(str);
  833. }
  834. }
  835. void ChoosePhotoForm::OnBUTexportphoto3() // 管理缓存 按钮;
  836. {
  837. DelHC dlg;
  838. dlg.DoModal();
  839. }