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" );
  96. #else
  97. m_List1.SetHeadings("订单号,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(15).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(16).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(15).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(16).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(15).Find(m_filter) != -1 || // 手机1
  266. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1)) // 手机2
  267. {
  268. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  269. }
  270. }
  271. }
  272. }
  273. else
  274. {
  275. int type = GetType(m_filter);
  276. if (type == 1)//电话
  277. {
  278. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  279. {
  280. // 查询条件==手机1 || 手机2;
  281. if (m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 ||
  282. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1)
  283. {
  284. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  285. }
  286. }
  287. }
  288. else if (type == 2)//拼音
  289. {
  290. m_filter.MakeUpper();
  291. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  292. {
  293. // 查询条件==拼音1 || 拼音2;
  294. if (m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 ||
  295. m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1)
  296. {
  297. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  298. }
  299. }
  300. }
  301. else
  302. {
  303. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  304. {
  305. // 查询条件==修片OK && 未选片 &&(……);
  306. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || // 订单号;
  307. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || // 男宾姓名;
  308. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || // 女宾姓名;
  309. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || // 接单人;
  310. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || // 选片人;
  311. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || // 摄影师;
  312. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || // 初修师;
  313. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || // 套系名称;
  314. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || // 手机1
  315. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1) // 手机2
  316. {
  317. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  318. }
  319. }
  320. }
  321. }
  322. }
  323. m_List1.m_arLabels.SetSize(count, 1);
  324. ii = count;
  325. m_List1.m_LabelCount = ii;
  326. m_List1.SetItemCountEx(ii);
  327. CString str;
  328. str.Format("单数:%d", ii);
  329. SetDlgItemText(IDC_STATIC2, str);
  330. }
  331. if (!g_id.IsEmpty())
  332. {
  333. for (int i = 0; i < m_List1.GetItemCount(); i++)
  334. {
  335. if (g_id == m_List1.GetItemText(i, 0))
  336. {
  337. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  338. m_List1.EnsureVisible(i, FALSE);
  339. break;
  340. }
  341. }
  342. }
  343. }
  344. void ChoosePhotoForm::OnBUTclose()
  345. {
  346. GetParent()->SendMessage(WM_CLOSE);
  347. }
  348. void ChoosePhotoForm::OnSelchangeCombo1()
  349. {
  350. SetTimer(1, 100, NULL);
  351. }
  352. void ChoosePhotoForm::OnTimer(UINT nIDEvent)
  353. {
  354. KillTimer(nIDEvent);
  355. OnButton1();
  356. }
  357. BOOL ChoosePhotoForm::PreTranslateMessage(MSG* pMsg)
  358. {
  359. try
  360. {
  361. if (pMsg->message == WM_KEYDOWN)
  362. {
  363. switch (pMsg->wParam)
  364. {
  365. case VK_RETURN:
  366. OnButton1();
  367. return 1;
  368. case 0x43: // copy
  369. if ((GetKeyState(VK_CONTROL) & 0x80))
  370. {
  371. GetFocus()->SendMessage(WM_COPY);
  372. return TRUE;
  373. }
  374. break;
  375. case 0x56: //Ctrl + V:
  376. if ((GetKeyState(VK_CONTROL) & 0x80))
  377. {
  378. GetFocus()->SendMessage(WM_PASTE);
  379. return TRUE;
  380. }
  381. break;
  382. case 0x58: // cut
  383. if ((GetKeyState(VK_CONTROL) & 0x80))
  384. {
  385. GetFocus()->SendMessage(WM_CUT);
  386. return TRUE;
  387. }
  388. break;
  389. case 0x5A: //undo
  390. case 0x59: //redo
  391. if ((GetKeyState(VK_CONTROL) & 0x80))
  392. {
  393. GetFocus()->SendMessage(WM_UNDO);
  394. return TRUE;
  395. }
  396. break;
  397. }
  398. }
  399. }
  400. catch (...)
  401. {
  402. }
  403. return MyFormView::PreTranslateMessage(pMsg);
  404. }
  405. // Jeff.门市流程 - 选片 - 开始选片
  406. void ChoosePhotoForm::OnBUTshowphoto() // Jeff.开始选片按钮;
  407. {
  408. if (IsHasRights2new(15) == 0) return;
  409. POSITION pos;
  410. pos = m_List1.GetFirstSelectedItemPosition();
  411. if (pos == NULL)
  412. {
  413. AfxMessageBox("请先选中您要选片的定单!", MB_ICONINFORMATION);
  414. return;
  415. }
  416. int iItem = m_List1.GetNextSelectedItem(pos);
  417. CString id = m_List1.GetItemText(iItem, 0);
  418. CString status = m_List1.GetItemText(iItem, 4); // 选片状态;
  419. ChoosePhotoSkin2 dlg;
  420. dlg.m_strStatusOfChoosePhoto = status;
  421. dlg.SetLiaPath("3.lia");
  422. dlg.m_strOrderNumber = id;
  423. dlg.m_path = g_path2 + "\\";
  424. dlg.m_path += dlg.m_strOrderNumber;
  425. dlg.m_path += "\\";
  426. // 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;
  427. dlg.DoModal();
  428. g_bInSkin = 0;
  429. if (dlg.m_bSave)
  430. {
  431. #if JEFF_TEST_ON
  432. if (g_bShowOK == 0)
  433. {
  434. #ifdef LKAY_VERSION
  435. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  436. #else
  437. CString filter = "status3='未取'";
  438. #endif //#ifdef LKAY_VERSION
  439. g_sendhead.bsql = 0;
  440. g_sendhead.code[0] = 28;
  441. g_sendhead.tabcount = 1;
  442. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  443. }
  444. else
  445. {
  446. g_sendhead.bsql = 0;
  447. g_sendhead.code[0] = 28;
  448. g_sendhead.tabcount = 1;
  449. #ifdef LKAY_VERSION
  450. CString filter = "dindantype<>'意向客户' or dindantype is null";
  451. g_pMainWnd->ProcessChatMessageRequest2(filter);
  452. #else
  453. g_pMainWnd->ProcessChatMessageRequest2(1);
  454. #endif //#ifdef LKAY_VERSION
  455. if (g_bSendOK == 0)return;
  456. }
  457. DataToArray(&m_List1array);
  458. HidePrice();
  459. m_combo1.AddString(g_user.name);
  460. for (int i = 0; i < g_userarray.GetSize(); i++)
  461. {
  462. m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
  463. }
  464. FillGrid();
  465. #else
  466. for (int i = 0; i < m_List1array.GetSize(); i++)
  467. {
  468. if (id == m_List1array.ElementAt(i).ElementAt(0))
  469. {
  470. m_List1array.ElementAt(i).SetAt(4+1, "OK");
  471. m_List1array.ElementAt(i).SetAt(5+1, dlg.m_time4);
  472. m_List1array.ElementAt(i).SetAt(6+1, dlg.m_money3);
  473. m_List1array.ElementAt(i).SetAt(7+1, dlg.m_choosezs);
  474. if (status != "OK") // Jeff.若选片状态已经OK,则不刷新选片人2014.08.30
  475. m_List1array.ElementAt(i).SetAt(9+1, dlg.m_waiter3);
  476. FillGrid();
  477. break;
  478. }
  479. }
  480. #endif //#if JEFF_TEST_ON
  481. }
  482. }
  483. void ChoosePhotoForm::OnBUTmoney() // 查看裁剪 按钮;
  484. {
  485. POSITION pos;
  486. pos = m_List1.GetFirstSelectedItemPosition();
  487. if (pos == NULL)
  488. {
  489. AfxMessageBox("请先选中您要查看的客人!", MB_ICONINFORMATION);
  490. return;
  491. }
  492. int iItem = m_List1.GetNextSelectedItem(pos);
  493. CString id = m_List1.GetItemText(iItem, 0);
  494. ShowCut dlg;
  495. dlg.m_mode = 2;
  496. dlg.m_strOrderNum = id;
  497. dlg.DoModal();
  498. }
  499. void ChoosePhotoForm::OnBUTexportphoto() // 选片更改 按钮;
  500. {
  501. UpdateData();
  502. POSITION pos;
  503. pos = m_List1.GetFirstSelectedItemPosition();
  504. if (pos == NULL)
  505. {
  506. AfxMessageBox("请先选中您要对比的定单!", MB_ICONINFORMATION);
  507. return;
  508. }
  509. int iItem = m_List1.GetNextSelectedItem(pos);
  510. if (m_List1.GetItemText(iItem, 5) != "OK")return;
  511. CCompareContent dlg;
  512. dlg.m_id = m_List1.GetItemText(iItem, 0);
  513. dlg.DoModal();
  514. }
  515. void ChoosePhotoForm::GetNo(CString str, CStringArray &array)
  516. {
  517. if (!str.IsEmpty())
  518. {
  519. #ifdef USE_SEP_VEB
  520. int pos = str.Find(SEPS_VEB);
  521. #else
  522. int pos = str.Find(",");
  523. #endif
  524. while (pos != -1)
  525. {
  526. array.Add(str.Left(pos));
  527. str = str.Right(str.GetLength() - pos - 1);
  528. #ifdef USE_SEP_VEB
  529. pos = str.Find(SEPS_VEB);
  530. #else
  531. pos = str.Find(",");
  532. #endif
  533. }
  534. array.Add(str);
  535. }
  536. }
  537. int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData)
  538. {
  539. switch (msg)
  540. {
  541. case BFFM_INITIALIZED:
  542. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  543. break;
  544. case BFFM_SELCHANGED:
  545. {
  546. char szFileName[MAX_PATH];
  547. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  548. SHGetPathFromIDList(pidlCurrent, szFileName);
  549. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  550. }
  551. break;
  552. }
  553. return 0;
  554. }
  555. void GetSavePath(CString &path)
  556. {
  557. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  558. LPITEMIDLIST pidlDesktop, pidlCurrent;
  559. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop) == NOERROR)
  560. {
  561. BROWSEINFO bi;
  562. bi.hwndOwner = g_pMainWnd->m_hWnd;
  563. bi.pidlRoot = pidlDesktop;
  564. bi.pszDisplayName = lpszDisplayName;
  565. bi.lpszTitle = "\n文档保存的目录:";
  566. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  567. bi.lpfn = BrowseProc;
  568. bi.lParam = 0;
  569. bi.iImage = 0;
  570. pidlCurrent = SHBrowseForFolder(&bi);
  571. SHGetPathFromIDList(pidlCurrent, szFileName);
  572. path = szFileName;
  573. }
  574. }
  575. int ChoosePhotoForm::FindArray(CStringArray *pArray, CString *pStr)
  576. {
  577. for (int i = 0; i < pArray->GetSize(); i++)
  578. {
  579. if (pArray->ElementAt(i) == *pStr)
  580. return i;
  581. }
  582. return -1;
  583. }
  584. void ChoosePhotoForm::OnButton1() // 查询 按钮;
  585. {
  586. UpdateData();
  587. m_filter.TrimLeft();
  588. m_filter.TrimRight();
  589. FillGrid();
  590. }
  591. void ChoosePhotoForm::OnButton2() // 已修未选 按钮;
  592. {
  593. UpdateData();
  594. m_filter.TrimLeft();
  595. m_filter.TrimRight();
  596. FillGrid(1);
  597. }
  598. void ChoosePhotoForm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  599. {
  600. POSITION pos;
  601. pos = m_List1.GetFirstSelectedItemPosition();
  602. if (pos == NULL)return;
  603. int iItem = m_List1.GetNextSelectedItem(pos);
  604. g_id = m_List1.GetItemText(iItem, 0);
  605. *pResult = 0;
  606. }
  607. void ChoosePhotoForm::HidePrice()
  608. {
  609. #ifdef LKAY_VERSION
  610. if(IsHasRights2new(31))return;
  611. for(int i=0; i< m_List1array.GetSize (); i++)
  612. {
  613. m_List1array.ElementAt (i).SetAt (10, "***");
  614. m_List1array.ElementAt (i).SetAt (11, "***");
  615. m_List1array.ElementAt (i).SetAt (12, "***");
  616. m_List1array.ElementAt (i).SetAt (13, "***");
  617. m_List1array.ElementAt (i).SetAt (14, "***");
  618. m_List1array.ElementAt (i).SetAt (15, "***");
  619. m_List1array.ElementAt (i).SetAt (6, "***");
  620. }
  621. #else
  622. if (IsHasRights2new(31))return;
  623. for (int i = 0; i < m_List1array.GetSize(); i++)
  624. {
  625. m_List1array.ElementAt(i).SetAt(15, "***");
  626. m_List1array.ElementAt(i).SetAt(16, "***");
  627. }
  628. #endif
  629. }
  630. void ChoosePhotoForm::OnBtnsearchfilter() // 条件查询 按钮;
  631. {
  632. SearchFilter dlg;
  633. dlg.m_mode = 4;
  634. if (dlg.DoModal() == IDOK)
  635. FillGrid();
  636. g_bSearchFilter = 0;
  637. }
  638. BOOL ChoosePhotoForm::IsPhoto2Exist(CString m_id)
  639. {
  640. CString path2;
  641. CString path = g_path2 + "\\";
  642. path += m_id;
  643. path += "\\";
  644. using namespace helper_coffs;
  645. ffsco o;
  646. o.dirs(0);
  647. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  648. ffsco::typeT coo;
  649. coo = o.co_file();
  650. return coo.size();
  651. }
  652. void ChoosePhotoForm::OnBUTexportphoto2() // 按钮 缓存本机;
  653. {
  654. POSITION pos;
  655. pos = m_List1.GetFirstSelectedItemPosition();
  656. if (pos == NULL)
  657. {
  658. AfxMessageBox("请先选中您要缓存的定单!", MB_ICONINFORMATION);
  659. return;
  660. }
  661. ClearHC();
  662. int iItem = m_List1.GetNextSelectedItem(pos);
  663. CString m_id = m_List1.GetItemText(iItem, 0);
  664. //////////////////////
  665. CStringArray m_patharray1;
  666. int m_nChoosePhotoType = 0; // 0 = 初修片; 1 = 原片;
  667. if (m_patharray1.GetSize() == 0)
  668. {
  669. #if USE_SHARE_FLORD
  670. CStringArray photoArray;
  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. GetPhotosDir(m_id, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray);
  681. GetPhotoFiles(&photoArray, m_patharray1);
  682. /*
  683. SelBrunDevice selbrundevicedlg;
  684. selbrundevicedlg.m_mode = 1;
  685. if (selbrundevicedlg.DoModal() == IDOK)
  686. m_nChoosePhotoType = selbrundevicedlg.m_sel;
  687. else
  688. m_nChoosePhotoType = 0;
  689. BOOL bGrowthTx = FALSE;
  690. CString strTxName = _T("");
  691. GetTXName(&m_id, 1, bGrowthTx, strTxName);
  692. CStringArray photoArray;
  693. if(m_nChoosePhotoType == 0)
  694. {// 初修片;
  695. for(int i = 0; i < 2; i++)
  696. {
  697. CStringArray patharr;
  698. GetPhotosDir(m_id, i, bGrowthTx, strTxName, photoArray);
  699. GetPhotoFiles(&photoArray, patharr);
  700. if(m_patharray1.GetSize() == 0)
  701. m_patharray1.Append(patharr);
  702. else
  703. {
  704. // 对比是否有同名的相片;
  705. for(int j=0; j<m_patharray1.GetSize(); j++)
  706. {
  707. for(int k=0; k<patharr.GetSize(); k++)
  708. {
  709. CString str1 = m_patharray1.ElementAt(j);
  710. str1 = str1.Right(str1.GetLength() - str1.ReverseFind('\\') - 1);
  711. CString str2 = patharr.ElementAt(k);
  712. str2 = str2.Right(str2.GetLength() - str2.ReverseFind('\\') - 1);
  713. if(str1 == str2)
  714. patharr.RemoveAt(k);
  715. }
  716. }
  717. if(patharr.GetSize() > 0)
  718. m_patharray1.Append(patharr);
  719. }
  720. }
  721. }
  722. else
  723. {// 原片;
  724. GetPhotosDir(m_id, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray);
  725. GetPhotoFiles(&photoArray, m_patharray1);
  726. }*/
  727. #else
  728. CString m_path, m_seltxname;
  729. m_path = g_path2 + "\\";
  730. m_path += m_id;
  731. m_path += "\\";
  732. if (IsPhoto2Exist(m_id))
  733. {
  734. SelBrunDevice dlg;
  735. dlg.m_mode = 1;
  736. if (dlg.DoModal() == IDOK)
  737. m_nChoosePhotoType = dlg.m_sel;
  738. else
  739. m_nChoosePhotoType = 0;
  740. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  741. }
  742. else
  743. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  744. {
  745. CString path, path2;
  746. m_path = g_path1 + "\\";
  747. m_path += m_id;
  748. m_path += "\\";
  749. if (m_seltxname != "" && m_seltxname != "全部")
  750. {
  751. m_path += m_seltxname; m_path += "\\";
  752. }
  753. if (m_nChoosePhotoType == 1)
  754. {
  755. m_path = g_path2 + "\\";
  756. m_path += m_id;
  757. m_path += "\\";
  758. }
  759. CString filename;
  760. ffsco o;
  761. o.dirs(1);
  762. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  763. ffsco::typeT coo;
  764. ffsco::typeT::iterator it;
  765. coo = o.co_file();
  766. for (it = coo.begin(); coo.end() != it; it++)
  767. {
  768. path = (*it).c_str();
  769. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  770. {
  771. path.MakeLower();
  772. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  773. if (filename.Find(".") != -1)
  774. filename = filename.Left(filename.Find("."));
  775. if (!myisdigit(filename))continue;
  776. if (m_nChoosePhotoType == 1)
  777. {
  778. m_patharray1.Add(path);
  779. }
  780. else
  781. {
  782. path2 = path;
  783. if (m_nChoosePhotoType == 0)
  784. path2.Replace("客户原片", "修好的片");
  785. if (1)
  786. {
  787. int pos = path2.Find(m_id);
  788. pos += m_id.GetLength();
  789. int pos2 = path2.ReverseFind('\\');
  790. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  791. }
  792. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  793. {
  794. m_patharray1.Add(path2);
  795. }
  796. else
  797. {
  798. path2.Replace(".raw", ".jpg");
  799. if (::PathFileExists(path2))
  800. {
  801. m_patharray1.Add(path2); continue;
  802. }
  803. path2.Replace(".nef", ".jpg");
  804. if (::PathFileExists(path2))
  805. {
  806. m_patharray1.Add(path2); continue;
  807. }
  808. path2.Replace(".cr2", ".jpg");
  809. if (::PathFileExists(path2))
  810. {
  811. m_patharray1.Add(path2); continue;
  812. }
  813. else
  814. {
  815. if (path.Right(3) != "jpg")continue;
  816. m_patharray1.Add(path);
  817. }
  818. }
  819. }
  820. }
  821. }
  822. }
  823. // if(0)
  824. {//多种修好的效果
  825. CString path, path2;
  826. path2 = g_path2 + "\\";
  827. path2 += m_id;
  828. path2 += "\\";
  829. using namespace helper_coffs;
  830. ffsco o;
  831. o.dirs(0);
  832. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  833. ffsco::typeT coo;
  834. ffsco::typeT::iterator it;
  835. coo = o.co_file();
  836. for (it = coo.begin();coo.end() != it;it++)
  837. {
  838. path = (*it).c_str();
  839. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  840. {
  841. path.MakeLower();
  842. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  843. if (path2.Find("-") != -1)
  844. {
  845. m_patharray1.Add(path);
  846. }
  847. }
  848. }
  849. }
  850. #endif //#if USE_SHARE_FLORD
  851. /////////////////////////
  852. char path[MAX_PATH];
  853. ::GetSystemDirectory(path, MAX_PATH);
  854. CString sysdir = path;
  855. sysdir += "\\lyfz";
  856. ::CreateDirectory(sysdir, NULL);
  857. sysdir += "\\";
  858. sysdir += m_id; ::CreateDirectory(sysdir, NULL);
  859. sysdir += "\\";
  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 = sysdir;
  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. }