ChoosePhotoForm.cpp 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  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 "ImportPhoto.h"
  9. #include "ChoosePhotoSkin2.h"
  10. #include "Login2.h"
  11. #include "ShowCut.h"
  12. #include "CompareContent.h"
  13. #include "SelBrunDevice.h"
  14. #include "DelHC.h"
  15. #include "DlgCloudSelection.h"
  16. #include "DlgCloundResult.h"
  17. using namespace helper_coffs;
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. #pragma comment(lib, "Shlwapi.lib")
  24. /////////////////////////////////////////////////////////////////////////////
  25. IMPLEMENT_DYNCREATE(ChoosePhotoForm, MyFormView)
  26. ChoosePhotoForm::ChoosePhotoForm(): MyFormView(ChoosePhotoForm::IDD)
  27. {
  28. m_filter = _T("");
  29. }
  30. ChoosePhotoForm::~ChoosePhotoForm()
  31. {
  32. }
  33. void ChoosePhotoForm::DoDataExchange(CDataExchange* pDX)
  34. {
  35. MyFormView::DoDataExchange(pDX);
  36. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  37. DDX_Control(pDX, IDC_LIST2, m_List1);
  38. DDX_Control(pDX, IDC_STATIC1, m_static1);
  39. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  40. }
  41. BEGIN_MESSAGE_MAP(ChoosePhotoForm, MyFormView)
  42. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  43. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  44. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  45. ON_WM_TIMER()
  46. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  47. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  48. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  49. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  50. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  51. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  52. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  53. ON_BN_CLICKED(IDC_BUTexportphoto3, OnBUTexportphoto3)
  54. ON_BN_CLICKED(BTN_ClounXP, OnBnClickedClounxp)
  55. ON_BN_CLICKED(BTN_ClounXPResult, OnBnClickedClounxpresult)
  56. END_MESSAGE_MAP()
  57. /////////////////////////////////////////////////////////////////////////////
  58. #ifdef _DEBUG
  59. void ChoosePhotoForm::AssertValid() const
  60. {
  61. MyFormView::AssertValid();
  62. }
  63. void ChoosePhotoForm::Dump(CDumpContext& dc) const
  64. {
  65. MyFormView::Dump(dc);
  66. }
  67. #endif //_DEBUG
  68. void ChoosePhotoForm::OnInitialUpdate()
  69. {
  70. MyFormView::OnInitialUpdate();
  71. CMyMdi Mdi;
  72. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  73. CRect rc2;
  74. GetWindowRect(rc2);
  75. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  76. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  77. int idarray[] = { IDC_BUTshowphoto, IDC_BUTexportphoto2, IDC_BUTexportphoto3, IDC_BUTexportphoto, IDC_BUTmoney, IDC_BUTclose };
  78. int idcount = 6;
  79. int btnwid;
  80. CRect prerc;
  81. for (int a = idcount - 2; a >= 0; a--)
  82. {
  83. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  84. ScreenToClient(prerc);
  85. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  86. ScreenToClient(rc2);
  87. btnwid = rc2.Width();
  88. rc2.right = prerc.left;
  89. rc2.left = rc2.right - btnwid;
  90. GetDlgItem(idarray[a])->MoveWindow(rc2);
  91. }
  92. // Jeff.在初修状态后添加精修日期;
  93. m_static1.SetFont(&g_titlefont);
  94. #ifdef CHILD_VERSION // 15列;
  95. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;修片日期,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;摄影师,100;初修师,100;引导师,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  96. #else
  97. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;修片日期,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;摄影师,100;初修师,100;化妆师,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  98. #endif
  99. m_List1.LoadColumnInfo(116);
  100. if (g_bShowOK == 0)
  101. {
  102. #ifdef LKAY_VERSION
  103. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  104. #else
  105. CString filter = "status3='未取'";
  106. #endif
  107. g_sendhead.bsql = 0;
  108. g_sendhead.code[0] = 28;
  109. g_sendhead.tabcount = 1;
  110. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  111. }
  112. else
  113. {
  114. g_sendhead.bsql = 0;
  115. g_sendhead.code[0] = 28;
  116. g_sendhead.tabcount = 1;
  117. #ifdef LKAY_VERSION
  118. CString filter="dindantype<>'意向客户' or dindantype is null";
  119. g_pMainWnd->ProcessChatMessageRequest2(filter);
  120. #else
  121. g_pMainWnd->ProcessChatMessageRequest2(1);
  122. #endif
  123. if (g_bSendOK == 0)return;
  124. }
  125. DataToArray(&m_List1array);
  126. HidePrice();
  127. m_combo1.AddString(g_user.name);
  128. for (int i = 0; i < g_userarray.GetSize(); i++)
  129. m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
  130. FillGrid();
  131. m_combo1.GetWindowRect(rc2);
  132. ScreenToClient(rc2);
  133. rc2.bottom += 200;
  134. m_combo1.MoveWindow(rc2);
  135. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  136. SetComboHei(&m_combo1, rc2.Height());
  137. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(IsHasRights2new(15));
  138. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(15));
  139. GetDlgItem(IDC_BUTexportphoto3)->EnableWindow(IsHasRights2new(15));
  140. if ( !g_bEnableClound )
  141. {
  142. GetDlgItem(BTN_ClounXP)->ShowWindow(SW_HIDE);
  143. GetDlgItem(BTN_ClounXPResult)->ShowWindow(SW_HIDE);
  144. }
  145. }
  146. void ChoosePhotoForm::FillGrid(BOOL bStatus)
  147. {
  148. if (g_bSearchFilter) // 条件查询;
  149. {
  150. m_List1.DeleteAllItems2();
  151. int ii = 0;
  152. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  153. int count = 0;
  154. {
  155. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  156. {
  157. // 查询条件==选片日期;
  158. if (g_filterdate1 != "")
  159. {
  160. if (m_List1array.ElementAt(ii).ElementAt(6) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(6) > g_filterdate2)
  161. continue;
  162. }
  163. // 查询条件==选片人;
  164. if (g_waiter1 != "")
  165. {
  166. if (m_List1array.ElementAt(ii).ElementAt(10) != g_waiter1)
  167. continue;
  168. }
  169. if(g_waiter2 != "")
  170. {
  171. if (m_List1array.ElementAt(ii).ElementAt(11) != g_waiter2)
  172. continue;
  173. }
  174. if(g_waiter3 != "")
  175. {
  176. if (m_List1array.ElementAt(ii).ElementAt(12) != g_waiter3)
  177. continue;
  178. }
  179. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  180. }
  181. }
  182. m_List1.m_arLabels.SetSize(count, 1);
  183. ii = count;
  184. m_List1.m_LabelCount = ii;
  185. m_List1.SetItemCountEx(ii);
  186. CString str;
  187. str.Format("单数:%d", ii);
  188. SetDlgItemText(IDC_STATIC2, str);
  189. }
  190. else
  191. {
  192. m_List1.DeleteAllItems2();
  193. int ii = 0;
  194. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  195. int count = 0;
  196. if (m_filter.IsEmpty())
  197. {
  198. if (bStatus) // 已修未选;
  199. {
  200. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  201. {
  202. // 查询条件==修片OK && 未选片;
  203. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK" && m_List1array.ElementAt(ii).ElementAt(5) != "OK")
  204. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  205. }
  206. }
  207. else
  208. {
  209. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  210. {
  211. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  212. }
  213. }
  214. }
  215. else
  216. {
  217. if (bStatus) // 已修未选;
  218. {
  219. int type = GetType(m_filter);
  220. if (type == 1)//电话
  221. {
  222. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  223. {
  224. // 查询条件==修片OK && 未选片 &&(手机1||手机2);
  225. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK"
  226. && m_List1array.ElementAt(ii).ElementAt(5) != "OK"
  227. //&&(m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1))
  228. && (m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(17).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. // 查询条件==修片OK && 未选片 &&(拼音1||拼音2);
  240. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK"
  241. &&m_List1array.ElementAt(ii).ElementAt(5) != "OK"
  242. //&&(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1))
  243. && (m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1))
  244. {
  245. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  246. }
  247. }
  248. }
  249. else
  250. {
  251. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  252. {
  253. // 查询条件==修片OK && 未选片 &&(……);
  254. if (m_List1array.ElementAt(ii).ElementAt(3) == "OK"
  255. &&m_List1array.ElementAt(ii).ElementAt(5) != "OK"
  256. && (
  257. m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || // 订单号;
  258. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || // 男宾姓名;
  259. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || // 女宾姓名;
  260. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || // 接单人;
  261. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || // 选片人;
  262. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || // 摄影师;
  263. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || // 初修师;
  264. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || // 化妆师;
  265. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || // 套系名称;
  266. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || // 手机1
  267. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1)) // 手机2
  268. {
  269. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  270. }
  271. }
  272. }
  273. }
  274. else
  275. {
  276. int type = GetType(m_filter);
  277. if (type == 1)//电话
  278. {
  279. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  280. {
  281. // 查询条件==手机1 || 手机2;
  282. if (m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 ||
  283. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1)
  284. {
  285. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  286. }
  287. }
  288. }
  289. else if (type == 2)//拼音
  290. {
  291. m_filter.MakeUpper();
  292. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  293. {
  294. // 查询条件==拼音1 || 拼音2;
  295. if (m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1 ||
  296. m_List1array.ElementAt(ii).ElementAt(19).Find(m_filter) != -1)
  297. {
  298. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  299. }
  300. }
  301. }
  302. else
  303. {
  304. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  305. {
  306. // 查询条件==修片OK && 未选片 &&(……);
  307. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || // 订单号;
  308. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || // 男宾姓名;
  309. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || // 女宾姓名;
  310. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || // 接单人;
  311. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || // 选片人;
  312. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || // 摄影师;
  313. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || // 初修师;
  314. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || // 化妆师;
  315. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || // 套系名称;
  316. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || // 手机1
  317. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1) // 手机2
  318. {
  319. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  320. }
  321. }
  322. }
  323. }
  324. }
  325. m_List1.m_arLabels.SetSize(count, 1);
  326. ii = count;
  327. m_List1.m_LabelCount = ii;
  328. m_List1.SetItemCountEx(ii);
  329. CString str;
  330. str.Format("单数:%d", ii);
  331. SetDlgItemText(IDC_STATIC2, str);
  332. }
  333. if (!g_id.IsEmpty())
  334. {
  335. for (int i = 0; i < m_List1.GetItemCount(); i++)
  336. {
  337. if (g_id == m_List1.GetItemText(i, 0))
  338. {
  339. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  340. m_List1.EnsureVisible(i, FALSE);
  341. break;
  342. }
  343. }
  344. }
  345. }
  346. void ChoosePhotoForm::OnBUTclose()
  347. {
  348. GetParent()->SendMessage(WM_CLOSE);
  349. }
  350. void ChoosePhotoForm::OnSelchangeCombo1()
  351. {
  352. SetTimer(1, 100, NULL);
  353. }
  354. void ChoosePhotoForm::OnTimer(UINT nIDEvent)
  355. {
  356. KillTimer(nIDEvent);
  357. OnButton1();
  358. }
  359. BOOL ChoosePhotoForm::PreTranslateMessage(MSG* pMsg)
  360. {
  361. try
  362. {
  363. if (pMsg->message == WM_KEYDOWN)
  364. {
  365. switch (pMsg->wParam)
  366. {
  367. case VK_RETURN:
  368. OnButton1();
  369. return 1;
  370. case 0x43: // copy
  371. if ((GetKeyState(VK_CONTROL) & 0x80))
  372. {
  373. GetFocus()->SendMessage(WM_COPY);
  374. return TRUE;
  375. }
  376. break;
  377. case 0x56: //Ctrl + V:
  378. if ((GetKeyState(VK_CONTROL) & 0x80))
  379. {
  380. GetFocus()->SendMessage(WM_PASTE);
  381. return TRUE;
  382. }
  383. break;
  384. case 0x58: // cut
  385. if ((GetKeyState(VK_CONTROL) & 0x80))
  386. {
  387. GetFocus()->SendMessage(WM_CUT);
  388. return TRUE;
  389. }
  390. break;
  391. case 0x5A: //undo
  392. case 0x59: //redo
  393. if ((GetKeyState(VK_CONTROL) & 0x80))
  394. {
  395. GetFocus()->SendMessage(WM_UNDO);
  396. return TRUE;
  397. }
  398. break;
  399. }
  400. }
  401. }
  402. catch (...)
  403. {
  404. }
  405. return MyFormView::PreTranslateMessage(pMsg);
  406. }
  407. // Jeff.门市流程 - 选片 - 开始选片
  408. void ChoosePhotoForm::OnBUTshowphoto() // Jeff.开始选片按钮;
  409. {
  410. if (IsHasRights2new(15) == 0) return;
  411. POSITION pos;
  412. pos = m_List1.GetFirstSelectedItemPosition();
  413. if (pos == NULL)
  414. {
  415. AfxMessageBox("请先选中您要选片的定单!", MB_ICONINFORMATION);
  416. return;
  417. }
  418. int iItem = m_List1.GetNextSelectedItem(pos);
  419. CString id = m_List1.GetItemText(iItem, 0);
  420. CString status = m_List1.GetItemText(iItem, 4); // 选片状态;
  421. ChoosePhotoSkin2 dlg;
  422. dlg.m_strStatusOfChoosePhoto = status;
  423. dlg.SetLiaPath("3.lia");
  424. dlg.m_strOrderNumber = id;
  425. dlg.m_path = g_path2 + "\\";
  426. dlg.m_path += dlg.m_strOrderNumber;
  427. dlg.m_path += "\\";
  428. // 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;
  429. dlg.DoModal();
  430. g_bInSkin = 0;
  431. if (dlg.m_bSave)
  432. {
  433. #if JEFF_TEST_ON
  434. if (g_bShowOK == 0)
  435. {
  436. #ifdef LKAY_VERSION
  437. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  438. #else
  439. CString filter = "status3='未取'";
  440. #endif //#ifdef LKAY_VERSION
  441. g_sendhead.bsql = 0;
  442. g_sendhead.code[0] = 28;
  443. g_sendhead.tabcount = 1;
  444. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  445. }
  446. else
  447. {
  448. g_sendhead.bsql = 0;
  449. g_sendhead.code[0] = 28;
  450. g_sendhead.tabcount = 1;
  451. #ifdef LKAY_VERSION
  452. CString filter = "dindantype<>'意向客户' or dindantype is null";
  453. g_pMainWnd->ProcessChatMessageRequest2(filter);
  454. #else
  455. g_pMainWnd->ProcessChatMessageRequest2(1);
  456. #endif //#ifdef LKAY_VERSION
  457. if (g_bSendOK == 0)return;
  458. }
  459. DataToArray(&m_List1array);
  460. HidePrice();
  461. m_combo1.AddString(g_user.name);
  462. for (int i = 0; i < g_userarray.GetSize(); i++)
  463. {
  464. m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
  465. }
  466. FillGrid();
  467. #else
  468. for (int i = 0; i < m_List1array.GetSize(); i++)
  469. {
  470. if (id == m_List1array.ElementAt(i).ElementAt(0))
  471. {
  472. m_List1array.ElementAt(i).SetAt(4+1, "OK");
  473. m_List1array.ElementAt(i).SetAt(5+1, dlg.m_time4);
  474. m_List1array.ElementAt(i).SetAt(6+1, dlg.m_money3);
  475. m_List1array.ElementAt(i).SetAt(7+1, dlg.m_choosezs);
  476. if (status != "OK") // Jeff.若选片状态已经OK,则不刷新选片人2014.08.30
  477. m_List1array.ElementAt(i).SetAt(9+1, dlg.m_waiter3);
  478. FillGrid();
  479. break;
  480. }
  481. }
  482. #endif //#if JEFF_TEST_ON
  483. }
  484. }
  485. void ChoosePhotoForm::OnBUTmoney() // 查看裁剪 按钮;
  486. {
  487. POSITION pos;
  488. pos = m_List1.GetFirstSelectedItemPosition();
  489. if (pos == NULL)
  490. {
  491. AfxMessageBox("请先选中您要查看的客人!", MB_ICONINFORMATION);
  492. return;
  493. }
  494. int iItem = m_List1.GetNextSelectedItem(pos);
  495. CString id = m_List1.GetItemText(iItem, 0);
  496. ShowCut dlg;
  497. dlg.m_mode = 2;
  498. dlg.m_strOrderNum = id;
  499. dlg.DoModal();
  500. }
  501. void ChoosePhotoForm::OnBUTexportphoto() // 选片更改 按钮;
  502. {
  503. UpdateData();
  504. POSITION pos;
  505. pos = m_List1.GetFirstSelectedItemPosition();
  506. if (pos == NULL)
  507. {
  508. AfxMessageBox("请先选中您要对比的定单!", MB_ICONINFORMATION);
  509. return;
  510. }
  511. int iItem = m_List1.GetNextSelectedItem(pos);
  512. if (m_List1.GetItemText(iItem, 5) != "OK")return;
  513. CCompareContent dlg;
  514. dlg.m_id = m_List1.GetItemText(iItem, 0);
  515. dlg.DoModal();
  516. }
  517. void ChoosePhotoForm::GetNo(CString str, CStringArray &array)
  518. {
  519. if (!str.IsEmpty())
  520. {
  521. #ifdef USE_SEP_VEB
  522. int pos = str.Find(SEPS_VEB);
  523. #else
  524. int pos = str.Find(",");
  525. #endif
  526. while (pos != -1)
  527. {
  528. array.Add(str.Left(pos));
  529. str = str.Right(str.GetLength() - pos - 1);
  530. #ifdef USE_SEP_VEB
  531. pos = str.Find(SEPS_VEB);
  532. #else
  533. pos = str.Find(",");
  534. #endif
  535. }
  536. array.Add(str);
  537. }
  538. }
  539. int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData)
  540. {
  541. switch (msg)
  542. {
  543. case BFFM_INITIALIZED:
  544. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  545. break;
  546. case BFFM_SELCHANGED:
  547. {
  548. char szFileName[MAX_PATH];
  549. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  550. SHGetPathFromIDList(pidlCurrent, szFileName);
  551. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  552. }
  553. break;
  554. }
  555. return 0;
  556. }
  557. void GetSavePath(CString &path)
  558. {
  559. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  560. LPITEMIDLIST pidlDesktop, pidlCurrent;
  561. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop) == NOERROR)
  562. {
  563. BROWSEINFO bi;
  564. bi.hwndOwner = g_pMainWnd->m_hWnd;
  565. bi.pidlRoot = pidlDesktop;
  566. bi.pszDisplayName = lpszDisplayName;
  567. bi.lpszTitle = "\n文档保存的目录:";
  568. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  569. bi.lpfn = BrowseProc;
  570. bi.lParam = 0;
  571. bi.iImage = 0;
  572. pidlCurrent = SHBrowseForFolder(&bi);
  573. SHGetPathFromIDList(pidlCurrent, szFileName);
  574. path = szFileName;
  575. }
  576. }
  577. int ChoosePhotoForm::FindArray(CStringArray *pArray, CString *pStr)
  578. {
  579. for (int i = 0; i < pArray->GetSize(); i++)
  580. {
  581. if (pArray->ElementAt(i) == *pStr)
  582. return i;
  583. }
  584. return -1;
  585. }
  586. void ChoosePhotoForm::OnButton1() // 查询 按钮;
  587. {
  588. UpdateData();
  589. m_filter.TrimLeft();
  590. m_filter.TrimRight();
  591. FillGrid();
  592. }
  593. void ChoosePhotoForm::OnButton2() // 已修未选 按钮;
  594. {
  595. UpdateData();
  596. m_filter.TrimLeft();
  597. m_filter.TrimRight();
  598. FillGrid(1);
  599. }
  600. void ChoosePhotoForm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  601. {
  602. POSITION pos;
  603. pos = m_List1.GetFirstSelectedItemPosition();
  604. if (pos == NULL)return;
  605. int iItem = m_List1.GetNextSelectedItem(pos);
  606. g_id = m_List1.GetItemText(iItem, 0);
  607. *pResult = 0;
  608. }
  609. void ChoosePhotoForm::HidePrice()
  610. {
  611. #ifdef LKAY_VERSION
  612. return;
  613. #else
  614. return;
  615. #endif
  616. }
  617. void ChoosePhotoForm::OnBtnsearchfilter() // 条件查询 按钮;
  618. {
  619. SearchFilter dlg;
  620. dlg.m_mode = 4;
  621. if (dlg.DoModal() == IDOK)
  622. FillGrid();
  623. g_bSearchFilter = 0;
  624. }
  625. BOOL ChoosePhotoForm::IsPhoto2Exist(CString m_id)
  626. {
  627. CString path2;
  628. CString path = g_path2 + "\\";
  629. path += m_id;
  630. path += "\\";
  631. using namespace helper_coffs;
  632. ffsco o;
  633. o.dirs(0);
  634. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  635. ffsco::typeT coo;
  636. coo = o.co_file();
  637. return coo.size();
  638. }
  639. void ChoosePhotoForm::OnBUTexportphoto2() // 按钮 缓存本机;
  640. {
  641. POSITION pos;
  642. pos = m_List1.GetFirstSelectedItemPosition();
  643. if (pos == NULL)
  644. {
  645. AfxMessageBox("请先选中您要缓存的定单!", MB_ICONINFORMATION);
  646. return;
  647. }
  648. ClearHC();
  649. int iItem = m_List1.GetNextSelectedItem(pos);
  650. // 订单号;
  651. CString strOrderNumber = m_List1.GetItemText(iItem, 0);
  652. //////////////////////
  653. CStringArray m_patharray1;
  654. int m_nChoosePhotoType = 0; // 0 = 初修片; 1 = 原片;
  655. if (m_patharray1.GetSize() == 0)
  656. {
  657. #if USE_SHARE_FLORD
  658. CStringArray photoArray;
  659. SelBrunDevice selbrundevicedlg;
  660. selbrundevicedlg.m_mode = 1;
  661. if (selbrundevicedlg.DoModal() == IDOK)
  662. m_nChoosePhotoType = selbrundevicedlg.m_sel;
  663. else
  664. m_nChoosePhotoType = 0;
  665. BOOL bGrowthTx = FALSE;
  666. CString strTxName = _T("");
  667. GetTXName(&strOrderNumber, 1, bGrowthTx, strTxName);
  668. GetPhotosDir(strOrderNumber, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray);
  669. GetPhotoFiles(&photoArray, m_patharray1);
  670. /*
  671. SelBrunDevice selbrundevicedlg;
  672. selbrundevicedlg.m_mode = 1;
  673. if (selbrundevicedlg.DoModal() == IDOK)
  674. m_nChoosePhotoType = selbrundevicedlg.m_sel;
  675. else
  676. m_nChoosePhotoType = 0;
  677. BOOL bGrowthTx = FALSE;
  678. CString strTxName = _T("");
  679. GetTXName(&m_id, 1, bGrowthTx, strTxName);
  680. CStringArray photoArray;
  681. if(m_nChoosePhotoType == 0)
  682. {// 初修片;
  683. for(int i = 0; i < 2; i++)
  684. {
  685. CStringArray patharr;
  686. GetPhotosDir(m_id, i, bGrowthTx, strTxName, photoArray);
  687. GetPhotoFiles(&photoArray, patharr);
  688. if(m_patharray1.GetSize() == 0)
  689. m_patharray1.Append(patharr);
  690. else
  691. {
  692. // 对比是否有同名的相片;
  693. for(int j=0; j<m_patharray1.GetSize(); j++)
  694. {
  695. for(int k=0; k<patharr.GetSize(); k++)
  696. {
  697. CString str1 = m_patharray1.ElementAt(j);
  698. str1 = str1.Right(str1.GetLength() - str1.ReverseFind('\\') - 1);
  699. CString str2 = patharr.ElementAt(k);
  700. str2 = str2.Right(str2.GetLength() - str2.ReverseFind('\\') - 1);
  701. if(str1 == str2)
  702. patharr.RemoveAt(k);
  703. }
  704. }
  705. if(patharr.GetSize() > 0)
  706. m_patharray1.Append(patharr);
  707. }
  708. }
  709. }
  710. else
  711. {// 原片;
  712. GetPhotosDir(m_id, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray);
  713. GetPhotoFiles(&photoArray, m_patharray1);
  714. }*/
  715. #else
  716. CString m_path, m_seltxname;
  717. m_path = g_path2 + "\\";
  718. m_path += m_id;
  719. m_path += "\\";
  720. if (IsPhoto2Exist(m_id))
  721. {
  722. SelBrunDevice dlg;
  723. dlg.m_mode = 1;
  724. if (dlg.DoModal() == IDOK)
  725. m_nChoosePhotoType = dlg.m_sel;
  726. else
  727. m_nChoosePhotoType = 0;
  728. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  729. }
  730. else
  731. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  732. {
  733. CString path, path2;
  734. m_path = g_path1 + "\\";
  735. m_path += m_id;
  736. m_path += "\\";
  737. if (m_seltxname != "" && m_seltxname != "全部")
  738. {
  739. m_path += m_seltxname; m_path += "\\";
  740. }
  741. if (m_nChoosePhotoType == 1)
  742. {
  743. m_path = g_path2 + "\\";
  744. m_path += m_id;
  745. m_path += "\\";
  746. }
  747. CString filename;
  748. ffsco o;
  749. o.dirs(1);
  750. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  751. ffsco::typeT coo;
  752. ffsco::typeT::iterator it;
  753. coo = o.co_file();
  754. for (it = coo.begin(); coo.end() != it; it++)
  755. {
  756. path = (*it).c_str();
  757. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  758. {
  759. path.MakeLower();
  760. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  761. if (filename.Find(".") != -1)
  762. filename = filename.Left(filename.Find("."));
  763. if (!myisdigit(filename))continue;
  764. if (m_nChoosePhotoType == 1)
  765. {
  766. m_patharray1.Add(path);
  767. }
  768. else
  769. {
  770. path2 = path;
  771. if (m_nChoosePhotoType == 0)
  772. path2.Replace("客户原片", "修好的片");
  773. if (1)
  774. {
  775. int pos = path2.Find(m_id);
  776. pos += m_id.GetLength();
  777. int pos2 = path2.ReverseFind('\\');
  778. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  779. }
  780. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  781. {
  782. m_patharray1.Add(path2);
  783. }
  784. else
  785. {
  786. path2.Replace(".raw", ".jpg");
  787. if (::PathFileExists(path2))
  788. {
  789. m_patharray1.Add(path2); continue;
  790. }
  791. path2.Replace(".nef", ".jpg");
  792. if (::PathFileExists(path2))
  793. {
  794. m_patharray1.Add(path2); continue;
  795. }
  796. path2.Replace(".cr2", ".jpg");
  797. if (::PathFileExists(path2))
  798. {
  799. m_patharray1.Add(path2); continue;
  800. }
  801. else
  802. {
  803. if (path.Right(3) != "jpg")continue;
  804. m_patharray1.Add(path);
  805. }
  806. }
  807. }
  808. }
  809. }
  810. }
  811. // if(0)
  812. {//多种修好的效果
  813. CString path, path2;
  814. path2 = g_path2 + "\\";
  815. path2 += m_id;
  816. path2 += "\\";
  817. using namespace helper_coffs;
  818. ffsco o;
  819. o.dirs(0);
  820. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  821. ffsco::typeT coo;
  822. ffsco::typeT::iterator it;
  823. coo = o.co_file();
  824. for (it = coo.begin();coo.end() != it;it++)
  825. {
  826. path = (*it).c_str();
  827. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  828. {
  829. path.MakeLower();
  830. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  831. if (path2.Find("-") != -1)
  832. {
  833. m_patharray1.Add(path);
  834. }
  835. }
  836. }
  837. }
  838. #endif //#if USE_SHARE_FLORD
  839. /////////////////////////
  840. TCHAR szSystemDir[MAX_PATH];
  841. ::GetSystemDirectory(szSystemDir, MAX_PATH);
  842. #ifdef VC60
  843. CString strCacheDirectory = szSystemDir;
  844. strCacheDirectory += _T("\\lyfz");
  845. ::CreateDirectory(strCacheDirectory, NULL);
  846. strCacheDirectory += _T("\\");
  847. strCacheDirectory += strOrderNumber;
  848. ::CreateDirectory(strCacheDirectory, NULL);
  849. strCacheDirectory += _T("\\");
  850. #else
  851. CString strCacheDirectory;
  852. strCacheDirectory.Format(_T("%s\\lyfz\\%s\\"), szSystemDir, strOrderNumber);
  853. SHCreateDirectoryEx(NULL, strCacheDirectory,NULL);
  854. #endif
  855. if (!PathFileExists(strCacheDirectory))
  856. {
  857. AfxMessageBox(_T("缓存目录创建失败"));
  858. return;
  859. }
  860. //----------------------------------------------------------------------------------------------
  861. // 缓存到本机的相片;
  862. //----------------------------------------------------------------------------------------------
  863. ImportPhoto dlg;
  864. dlg.m_bCopyToLocal = 1;
  865. dlg.m_mode = 1;
  866. dlg.m_pArray = &m_patharray1;
  867. dlg.m_savepath = strCacheDirectory;
  868. dlg.DoModal();
  869. AfxMessageBox("缓存成功!");
  870. }
  871. }
  872. CString GetCreateTime(CString path)
  873. {
  874. CFileFind finder;
  875. path.TrimRight("\\");
  876. BOOL bWorking = finder.FindFile(path);
  877. if (bWorking)
  878. {
  879. finder.FindNextFile();
  880. CTime tm;
  881. finder.GetCreationTime(tm);
  882. CTimeSpan dt = CTime::GetCurrentTime() - tm;
  883. int m_dtdays = AfxGetApp()->GetProfileInt(LYFZVERSION, "dtdays2", 5);
  884. if (dt.GetDays() >= m_dtdays)
  885. {
  886. ::DeleteDirectory(path); // 递归删除过期缓存;
  887. }
  888. }
  889. return "";
  890. }
  891. void ChoosePhotoForm::ClearHC()
  892. {
  893. char path[MAX_PATH];
  894. ::GetSystemDirectory(path, MAX_PATH);
  895. CString sysdir = path;
  896. sysdir += "\\lyfz";
  897. ::CreateDirectory(sysdir, NULL);
  898. sysdir += "\\";
  899. CString str;
  900. using namespace helper_coffs;
  901. ffsco o;
  902. o.dirs(0);
  903. o.find(LPCSTR(sysdir), LPCSTR("*.*"));
  904. ffsco::typeT coo;
  905. ffsco::typeT::iterator it;
  906. coo = o.co_dir();
  907. for (it = coo.begin(); coo.end() != it; it++)
  908. {
  909. str = (*it).c_str();
  910. if (str == sysdir)continue;
  911. GetCreateTime(str);
  912. }
  913. }
  914. void ChoosePhotoForm::OnBUTexportphoto3() // 管理缓存按钮;
  915. {
  916. DelHC dlg;
  917. dlg.DoModal();
  918. }
  919. /************************************************************************/
  920. /*
  921. 函数: GetTXName
  922. 描述: 获取套系名称
  923. 参数:
  924. const CString* pStrOrder, //订单号
  925. const int nModle, //
  926. BOOL& bGrowthTx, //返回是否成长套系0否,1是
  927. CString& strTxName //返回套系名
  928. 返回:
  929. */
  930. /************************************************************************/
  931. void ChoosePhotoForm::GetTXName(const CString* pStrOrder, const int nModle, BOOL& bGrowthTx, CString& strTxName)
  932. {
  933. if(pStrOrder == NULL || (*pStrOrder) == _T(""))
  934. return;
  935. IsGrowthTx growthtxdlg;
  936. growthtxdlg.m_mode = nModle;
  937. growthtxdlg.m_strOrderNumber = (*pStrOrder);
  938. growthtxdlg.DoModal();
  939. bGrowthTx = growthtxdlg.m_bGrowthTx;
  940. strTxName = growthtxdlg.m_seltxname;
  941. }
  942. /************************************************************************/
  943. /* 函数:GetPhotosDir[3/27/2016 IT];
  944. /* 描述:获取相片目录;
  945. /* 参数:;
  946. /* [IN] strID: 订单号;
  947. /* [IN] nMode: =1:修片; =2:原片;
  948. /* [IN] bGrowthTx: 是否成长套系;
  949. /* [IN] strTxName: 套系名;
  950. /* [OUT] photoDirArr: 返回路径集合;
  951. /* 返回:void;
  952. /* 注意:;
  953. /* 示例:;
  954. /*
  955. /* 修改:;
  956. /* 日期:;
  957. /* 内容:;
  958. /************************************************************************/
  959. void ChoosePhotoForm::GetPhotosDir(const CString& strID, const int nMode, const BOOL bGrowthTx, const CString& strTxName, CStringArray& photoDirArr)
  960. {
  961. TCHAR szShare[MAX_PATH] = {0};
  962. TCHAR szOrdePath[MAX_PATH] = {0};
  963. int i=0;
  964. int nSize = 0;
  965. switch(nMode)
  966. {
  967. case 0: // 初修;
  968. {
  969. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("修好的片(管理软件)$"));
  970. // 若是成长套系,初修片有子目录; 若是婚纱版,初修没了景点了目录;
  971. if ( bGrowthTx && ( !strTxName.IsEmpty() && strTxName != _T("全部")) )
  972. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, strID, strTxName);
  973. else
  974. sprintf(szOrdePath, _T("%s\\%s"), szShare, strID);
  975. if ( PathFileExists(szOrdePath) )
  976. photoDirArr.Add(CString(szOrdePath));
  977. nSize = g_aryOfSharePathInfo.GetSize();
  978. for (i = 0; i < nSize; i++)
  979. {
  980. if ( 2 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) )
  981. {
  982. if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname) != 0 )
  983. {
  984. continue;
  985. }
  986. // 逐一加载其他共享目录;
  987. // 如果是成长套系且套系名不为空或全部;
  988. sprintf(szShare,_T("%s"),g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  989. // 若是成长套系,初修片有子目录; 若是婚纱版,初修没了景点了目录;
  990. if ( bGrowthTx && ( !strTxName.IsEmpty() && strTxName != _T("全部")) )
  991. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, strID, strTxName);
  992. else
  993. sprintf(szOrdePath, _T("%s\\%s"), szShare, strID);
  994. if ( PathFileExists(szOrdePath) )
  995. photoDirArr.Add(CString(szOrdePath));
  996. }
  997. }
  998. }
  999. break;
  1000. case 1: // 原片;
  1001. {
  1002. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("客户原片(管理软件)$"));
  1003. sprintf(szOrdePath, _T("%s\\%s"), szShare, strID);
  1004. if ( PathFileExists(szOrdePath) )
  1005. photoDirArr.Add(CString(szOrdePath));
  1006. nSize = g_aryOfSharePathInfo.GetSize();
  1007. for (i = 0; i < nSize; i++)
  1008. {
  1009. if ( 1 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) )
  1010. {
  1011. if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname) != 0 )
  1012. {
  1013. continue;
  1014. }
  1015. // 逐一加载其他共享目录;
  1016. sprintf(szShare,"%s",g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  1017. sprintf(szOrdePath,"%s\\%s",szShare, strID);
  1018. if ( PathFileExists(szOrdePath) )
  1019. photoDirArr.Add(CString(szOrdePath));
  1020. }
  1021. }
  1022. }
  1023. break;
  1024. }
  1025. }
  1026. /************************************************************************/
  1027. /*
  1028. 函数: GetPhotoFiles
  1029. 描述: 获取指定目录下的相片
  1030. 参数:
  1031. CStringArray* photoDirArr, 相片目录
  1032. CStringArray& filesArr 返回相片集
  1033. 返回:
  1034. */
  1035. /************************************************************************/
  1036. void ChoosePhotoForm::GetPhotoFiles(CStringArray* photoDirArr, CStringArray& filesArr)
  1037. {
  1038. if(photoDirArr == NULL)
  1039. return;
  1040. CString path = _T("");
  1041. CString filename = _T("");
  1042. for(int i=0; i<photoDirArr->GetSize(); i++)
  1043. {
  1044. ffsco o;
  1045. o.dirs(1);
  1046. o.find(LPCSTR(photoDirArr->ElementAt(i)), LPCSTR("*.*"));
  1047. ffsco::typeT coo;
  1048. ffsco::typeT::iterator it;
  1049. coo = o.co_file();
  1050. for (it = coo.begin(); coo.end() != it; it++)
  1051. {
  1052. path = (*it).c_str();
  1053. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  1054. {
  1055. path.MakeLower();
  1056. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1057. if (filename.Find(".") != -1)
  1058. filename = filename.Left(filename.Find("."));
  1059. if (!g_bOriginal && !myisdigit(filename))
  1060. continue;
  1061. filesArr.Add(path);
  1062. }
  1063. }
  1064. }
  1065. }
  1066. void ChoosePhotoForm::OnBnClickedClounxp() // 云选片;
  1067. {
  1068. // TODO: 在此添加控件通知处理程序代码
  1069. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  1070. if ( pos == NULL)
  1071. {
  1072. AfxMessageBox(_T("请选中要使用云选片的订单!"));
  1073. return ;
  1074. }
  1075. INT nItem = m_List1.GetNextSelectedItem(pos);
  1076. CString strOrderNum = _T("");
  1077. CString strScenery = _T("");
  1078. CString strCustomerName = _T("");
  1079. CString strCustomerTel = _T("");
  1080. CString strStudioName = _T("");
  1081. CString strStudioTel = _T("");
  1082. CString strUniqueId = _T("");
  1083. CString strClounSite = _T("");
  1084. CString strTemp;
  1085. strOrderNum = m_List1.GetItemText(nItem, 0);
  1086. strCustomerName.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 1), m_List1.GetItemText(nItem,2));
  1087. #ifdef CHILD_VERSION // 15列;
  1088. strCustomerTel.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 15), m_List1.GetItemText(nItem,16));
  1089. #else
  1090. strCustomerTel.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 15), m_List1.GetItemText(nItem,16));
  1091. #endif
  1092. strStudioName = g_cominfoarray.ElementAt(0).ElementAt(10);
  1093. strStudioTel = g_cominfoarray.ElementAt(0).ElementAt(11);
  1094. strClounSite = m_List1.m_arLabels.ElementAt(nItem).ElementAt(19);
  1095. INT nIndex = 0;
  1096. strTemp = g_branchname.IsEmpty() ? g_domain : g_branchname;
  1097. if ( ( nIndex = strTemp.Find(_T(".ly.com"))) == -1)
  1098. {
  1099. AfxMessageBox(_T("域名无效!"));
  1100. return;
  1101. }
  1102. strTemp = strTemp.Left(nIndex);
  1103. strTemp = strTemp.Right(6);
  1104. strUniqueId.Format(_T("%s_A_%s_0"), strTemp, strOrderNum);
  1105. if ( lyfzLibrary::LoadCloudSelectionLib() )
  1106. {
  1107. CDlgCloudSelection dlg;
  1108. dlg.SetParamters(0, strUniqueId, g_branchname.IsEmpty() ? g_domain : g_branchname, strStudioName, strStudioTel, strOrderNum,strScenery, m_List1.GetItemText(nItem, 1),m_List1.GetItemText(nItem, 2), m_List1.GetItemText(nItem, 15),m_List1.GetItemText(nItem, 16), strClounSite);
  1109. dlg.DoModal();
  1110. lyfzLibrary::FreeCloudSelectionLib();
  1111. }
  1112. else
  1113. {
  1114. AfxMessageBox(_T("加载云选片失败,请检查模块文件是否在客户目录下!"));
  1115. }
  1116. }
  1117. void ChoosePhotoForm::OnBnClickedClounxpresult()
  1118. {
  1119. // TODO: 在此添加控件通知处理程序代码
  1120. #if 0
  1121. CArray<CStringArray,CStringArray> AryCloundOrder;
  1122. AryCloundOrder.SetSize(m_List1.m_arLabels.GetSize(),1);
  1123. int i = 0;
  1124. for ( i = 0; i < m_List1.m_arLabels.GetSize(); i++ )
  1125. {
  1126. // 取出生成云链接的订单;
  1127. AryCloundOrder.ElementAt(i).RemoveAll();
  1128. AryCloundOrder.ElementAt(i).Add(m_List1.m_arLabels.ElementAt(i).ElementAt(0)); // 订单号;
  1129. AryCloundOrder.ElementAt(i).Add(m_List1.m_arLabels.ElementAt(i).ElementAt(19)); // 云地址;
  1130. AryCloundOrder.ElementAt(i).Add(_T("")); // 用于存放选片结果,暂时置空;
  1131. }
  1132. INT nIndex = 0;
  1133. CString strTemp = g_branchname.IsEmpty() ? g_domain : g_branchname;
  1134. if ( ( nIndex = strTemp.Find(_T(".ly.com"))) == -1)
  1135. {
  1136. AfxMessageBox(_T("域名无效!"));
  1137. return;
  1138. }
  1139. strTemp = strTemp.Left(nIndex);
  1140. CString strBranchId = strTemp.Right(6);
  1141. // 获取云选片结果;
  1142. CString strUniqueId = _T("");
  1143. CArray<CStringArray,CStringArray> AryJson;
  1144. if ( lyfzLibrary::LoadCloudSelectionLib() )
  1145. {
  1146. nIndex = 0;
  1147. TCHAR szResultValue[8912] = {0};
  1148. for ( i = 0; i < AryCloundOrder.GetSize(); i++ )
  1149. {
  1150. strUniqueId.Format(_T("%s_A_%s_0"), strBranchId, AryCloundOrder.ElementAt(i).ElementAt(0));
  1151. if ( ( nIndex = AryCloundOrder.ElementAt(i).ElementAt(1).Find(lyfzLibrary::g_strCloundHost)) != -1)
  1152. {
  1153. strTemp = AryCloundOrder.ElementAt(i).ElementAt(1).Mid(lyfzLibrary::g_strCloundHost.GetLength() + nIndex);
  1154. lyfzLibrary::g_getcloundresult(0, strUniqueId, strTemp, szResultValue, 8912);
  1155. AryCloundOrder.ElementAt(i).SetAt(2, szResultValue);
  1156. // 解析Json;
  1157. //lyfzLibrary::getXPJsonresult(szResultValue,AryJson);
  1158. }
  1159. }
  1160. lyfzLibrary::FreeCloudSelectionLib();
  1161. }
  1162. // 获取数据库保存的云数据;
  1163. g_sendhead.bsql = 0;
  1164. g_sendhead.code[0] = 241;
  1165. g_sendhead.tabcount = 1;
  1166. CString strFilter = _T("CloundType = 0");
  1167. CArray<CStringArray, CStringArray> AryCloundInfo;
  1168. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1169. if ( !g_bSendOK )
  1170. return;
  1171. DataToArray(&AryCloundInfo);
  1172. // 显示并同步结果;
  1173. int j = 0;
  1174. BOOL bExist = FALSE;
  1175. CString strSQL = _T("");
  1176. for ( i = 0; i < AryCloundOrder.GetSize(); i++ )
  1177. {
  1178. if ( AryCloundOrder.ElementAt(i).ElementAt(2).IsEmpty() )
  1179. continue;
  1180. bExist = FALSE;
  1181. for ( j = 0; j < AryCloundInfo.GetSize(); j++ )
  1182. {
  1183. if ( AryCloundOrder.ElementAt(i).ElementAt(0) == AryCloundInfo.ElementAt(j).ElementAt(0) )
  1184. bExist = TRUE;
  1185. }
  1186. if ( bExist )
  1187. {
  1188. if ( AryCloundOrder.ElementAt(i).ElementAt(2) == AryCloundInfo.ElementAt(j-1).ElementAt(4) )
  1189. continue;
  1190. strSQL.Format(_T("update [CloundSelection] set [ResultJson] = '%s' where [order] = '%s'"), AryCloundOrder.ElementAt(i).ElementAt(0), AryCloundOrder.ElementAt(i).ElementAt(2));
  1191. }
  1192. else
  1193. strSQL.Format(_T("insert into [CloundSelection]( [order], [CloundType], [ResultJson]) values('%s', 0, '%s') "), AryCloundOrder.ElementAt(i).ElementAt(0), AryCloundOrder.ElementAt(i).ElementAt(2));
  1194. g_sendhead.bsql = true;
  1195. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  1196. }
  1197. #endif
  1198. CDlgCloundResult dlg;
  1199. dlg.m_pList = &m_List1;
  1200. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  1201. if ( pos != NULL )
  1202. {
  1203. INT nItem = m_List1.GetNextSelectedItem(pos);
  1204. dlg.m_nSelItem = nItem;
  1205. }
  1206. dlg.DoModal();
  1207. }