ChoosePhotoForm.cpp 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  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. return;
  611. #else
  612. return;
  613. #endif
  614. }
  615. void ChoosePhotoForm::OnBtnsearchfilter() // 条件查询 按钮;
  616. {
  617. SearchFilter dlg;
  618. dlg.m_mode = 4;
  619. if (dlg.DoModal() == IDOK)
  620. FillGrid();
  621. g_bSearchFilter = 0;
  622. }
  623. BOOL ChoosePhotoForm::IsPhoto2Exist(CString m_id)
  624. {
  625. CString path2;
  626. CString path = g_path2 + "\\";
  627. path += m_id;
  628. path += "\\";
  629. using namespace helper_coffs;
  630. ffsco o;
  631. o.dirs(0);
  632. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  633. ffsco::typeT coo;
  634. coo = o.co_file();
  635. return coo.size();
  636. }
  637. void ChoosePhotoForm::OnBUTexportphoto2() // 缓存本机.;
  638. {
  639. POSITION pos;
  640. pos = m_List1.GetFirstSelectedItemPosition();
  641. if (pos == NULL)
  642. {
  643. AfxMessageBox("请先选中您要缓存的定单!", MB_ICONINFORMATION);
  644. return;
  645. }
  646. ClearHC();
  647. int iItem = m_List1.GetNextSelectedItem(pos);
  648. // 订单号;
  649. CString strOrderNumber = m_List1.GetItemText(iItem, 0);
  650. //////////////////////
  651. CStringArray m_patharray1;
  652. int m_nChoosePhotoType = 0; // 0 = 初修片; 1 = 原片;
  653. if (m_patharray1.GetSize() == 0)
  654. {
  655. #if USE_SHARE_FLORD
  656. CStringArray photoArray;
  657. SelBrunDevice selbrundevicedlg;
  658. selbrundevicedlg.m_mode = 1;
  659. if (selbrundevicedlg.DoModal() == IDOK)
  660. m_nChoosePhotoType = selbrundevicedlg.m_sel;
  661. else
  662. m_nChoosePhotoType = 0;
  663. BOOL bGrowthTx = FALSE;
  664. CString strTxName = _T("");
  665. GetTXName(&strOrderNumber, 1, bGrowthTx, strTxName);
  666. GetPhotosDir(strOrderNumber, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray);
  667. GetPhotoFiles(&photoArray, m_patharray1);
  668. /*
  669. SelBrunDevice selbrundevicedlg;
  670. selbrundevicedlg.m_mode = 1;
  671. if (selbrundevicedlg.DoModal() == IDOK)
  672. m_nChoosePhotoType = selbrundevicedlg.m_sel;
  673. else
  674. m_nChoosePhotoType = 0;
  675. BOOL bGrowthTx = FALSE;
  676. CString strTxName = _T("");
  677. GetTXName(&m_id, 1, bGrowthTx, strTxName);
  678. CStringArray photoArray;
  679. if(m_nChoosePhotoType == 0)
  680. {// 初修片;
  681. for(int i = 0; i < 2; i++)
  682. {
  683. CStringArray patharr;
  684. GetPhotosDir(m_id, i, bGrowthTx, strTxName, photoArray);
  685. GetPhotoFiles(&photoArray, patharr);
  686. if(m_patharray1.GetSize() == 0)
  687. m_patharray1.Append(patharr);
  688. else
  689. {
  690. // 对比是否有同名的相片;
  691. for(int j=0; j<m_patharray1.GetSize(); j++)
  692. {
  693. for(int k=0; k<patharr.GetSize(); k++)
  694. {
  695. CString str1 = m_patharray1.ElementAt(j);
  696. str1 = str1.Right(str1.GetLength() - str1.ReverseFind('\\') - 1);
  697. CString str2 = patharr.ElementAt(k);
  698. str2 = str2.Right(str2.GetLength() - str2.ReverseFind('\\') - 1);
  699. if(str1 == str2)
  700. patharr.RemoveAt(k);
  701. }
  702. }
  703. if(patharr.GetSize() > 0)
  704. m_patharray1.Append(patharr);
  705. }
  706. }
  707. }
  708. else
  709. {// 原片;
  710. GetPhotosDir(m_id, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray);
  711. GetPhotoFiles(&photoArray, m_patharray1);
  712. }*/
  713. #else
  714. CString m_path, m_seltxname;
  715. m_path = g_path2 + "\\";
  716. m_path += m_id;
  717. m_path += "\\";
  718. if (IsPhoto2Exist(m_id))
  719. {
  720. SelBrunDevice dlg;
  721. dlg.m_mode = 1;
  722. if (dlg.DoModal() == IDOK)
  723. m_nChoosePhotoType = dlg.m_sel;
  724. else
  725. m_nChoosePhotoType = 0;
  726. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  727. }
  728. else
  729. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  730. {
  731. CString path, path2;
  732. m_path = g_path1 + "\\";
  733. m_path += m_id;
  734. m_path += "\\";
  735. if (m_seltxname != "" && m_seltxname != "全部")
  736. {
  737. m_path += m_seltxname; m_path += "\\";
  738. }
  739. if (m_nChoosePhotoType == 1)
  740. {
  741. m_path = g_path2 + "\\";
  742. m_path += m_id;
  743. m_path += "\\";
  744. }
  745. CString filename;
  746. ffsco o;
  747. o.dirs(1);
  748. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  749. ffsco::typeT coo;
  750. ffsco::typeT::iterator it;
  751. coo = o.co_file();
  752. for (it = coo.begin(); coo.end() != it; it++)
  753. {
  754. path = (*it).c_str();
  755. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  756. {
  757. path.MakeLower();
  758. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  759. if (filename.Find(".") != -1)
  760. filename = filename.Left(filename.Find("."));
  761. if (!myisdigit(filename))continue;
  762. if (m_nChoosePhotoType == 1)
  763. {
  764. m_patharray1.Add(path);
  765. }
  766. else
  767. {
  768. path2 = path;
  769. if (m_nChoosePhotoType == 0)
  770. path2.Replace("客户原片", "修好的片");
  771. if (1)
  772. {
  773. int pos = path2.Find(m_id);
  774. pos += m_id.GetLength();
  775. int pos2 = path2.ReverseFind('\\');
  776. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  777. }
  778. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  779. {
  780. m_patharray1.Add(path2);
  781. }
  782. else
  783. {
  784. path2.Replace(".raw", ".jpg");
  785. if (::PathFileExists(path2))
  786. {
  787. m_patharray1.Add(path2); continue;
  788. }
  789. path2.Replace(".nef", ".jpg");
  790. if (::PathFileExists(path2))
  791. {
  792. m_patharray1.Add(path2); continue;
  793. }
  794. path2.Replace(".cr2", ".jpg");
  795. if (::PathFileExists(path2))
  796. {
  797. m_patharray1.Add(path2); continue;
  798. }
  799. else
  800. {
  801. if (path.Right(3) != "jpg")continue;
  802. m_patharray1.Add(path);
  803. }
  804. }
  805. }
  806. }
  807. }
  808. }
  809. // if(0)
  810. {//多种修好的效果
  811. CString path, path2;
  812. path2 = g_path2 + "\\";
  813. path2 += m_id;
  814. path2 += "\\";
  815. using namespace helper_coffs;
  816. ffsco o;
  817. o.dirs(0);
  818. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  819. ffsco::typeT coo;
  820. ffsco::typeT::iterator it;
  821. coo = o.co_file();
  822. for (it = coo.begin();coo.end() != it;it++)
  823. {
  824. path = (*it).c_str();
  825. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  826. {
  827. path.MakeLower();
  828. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  829. if (path2.Find("-") != -1)
  830. {
  831. m_patharray1.Add(path);
  832. }
  833. }
  834. }
  835. }
  836. #endif //#if USE_SHARE_FLORD
  837. /////////////////////////
  838. TCHAR szSystemDir[MAX_PATH];
  839. ::GetSystemDirectory(szSystemDir, MAX_PATH);
  840. #ifdef VC60
  841. CString strCacheDirectory = szSystemDir;
  842. strCacheDirectory += _T("\\lyfz");
  843. ::CreateDirectory(strCacheDirectory, NULL);
  844. strCacheDirectory += _T("\\");
  845. strCacheDirectory += strOrderNumber;
  846. ::CreateDirectory(strCacheDirectory, NULL);
  847. strCacheDirectory += _T("\\");
  848. #else
  849. CString strCacheDirectory;
  850. strCacheDirectory.Format(_T("%s\\lyfz\\%s\\"), szSystemDir, strOrderNumber);
  851. SHCreateDirectoryEx(NULL, strCacheDirectory,NULL);
  852. #endif
  853. if (!PathFileExists(strCacheDirectory))
  854. {
  855. AfxMessageBox(_T("缓存目录创建失败"));
  856. return;
  857. }
  858. //----------------------------------------------------------------------------------------------
  859. // 缓存到本机的相片;
  860. //----------------------------------------------------------------------------------------------
  861. ImportPhoto dlg;
  862. dlg.m_bCopyToLocal = 1;
  863. dlg.m_mode = 1;
  864. dlg.m_pArray = &m_patharray1;
  865. dlg.m_savepath = strCacheDirectory;
  866. dlg.DoModal();
  867. AfxMessageBox("缓存成功!");
  868. }
  869. }
  870. CString GetCreateTime(CString path)
  871. {
  872. CFileFind finder;
  873. path.TrimRight("\\");
  874. BOOL bWorking = finder.FindFile(path);
  875. if (bWorking)
  876. {
  877. finder.FindNextFile();
  878. CTime tm;
  879. finder.GetCreationTime(tm);
  880. CTimeSpan dt = CTime::GetCurrentTime() - tm;
  881. int m_dtdays = AfxGetApp()->GetProfileInt(LYFZVERSION, "dtdays2", 5);
  882. if (dt.GetDays() >= m_dtdays)
  883. {
  884. ::DeleteDirectory(path); // 递归删除过期缓存;
  885. }
  886. }
  887. return "";
  888. }
  889. void ChoosePhotoForm::ClearHC()
  890. {
  891. char path[MAX_PATH];
  892. ::GetSystemDirectory(path, MAX_PATH);
  893. CString sysdir = path;
  894. sysdir += "\\lyfz";
  895. ::CreateDirectory(sysdir, NULL);
  896. sysdir += "\\";
  897. CString str;
  898. using namespace helper_coffs;
  899. ffsco o;
  900. o.dirs(0);
  901. o.find(LPCSTR(sysdir), LPCSTR("*.*"));
  902. ffsco::typeT coo;
  903. ffsco::typeT::iterator it;
  904. coo = o.co_dir();
  905. for (it = coo.begin(); coo.end() != it; it++)
  906. {
  907. str = (*it).c_str();
  908. if (str == sysdir)continue;
  909. GetCreateTime(str);
  910. }
  911. }
  912. void ChoosePhotoForm::OnBUTexportphoto3() // 管理缓存按钮;
  913. {
  914. DelHC dlg;
  915. dlg.DoModal();
  916. }
  917. /************************************************************************/
  918. /*
  919. 函数: GetTXName
  920. 描述: 获取套系名称
  921. 参数:
  922. const CString* pStrOrder, //订单号
  923. const int nModle, //
  924. BOOL& bGrowthTx, //返回是否成长套系0否,1是
  925. CString& strTxName //返回套系名
  926. 返回:
  927. */
  928. /************************************************************************/
  929. void ChoosePhotoForm::GetTXName(const CString* pStrOrder, const int nModle, BOOL& bGrowthTx, CString& strTxName)
  930. {
  931. if(pStrOrder == NULL || (*pStrOrder) == _T(""))
  932. return;
  933. IsGrowthTx growthtxdlg;
  934. growthtxdlg.m_mode = nModle;
  935. growthtxdlg.m_strOrderNumber = (*pStrOrder);
  936. growthtxdlg.DoModal();
  937. bGrowthTx = growthtxdlg.m_bGrowthTx;
  938. strTxName = growthtxdlg.m_seltxname;
  939. }
  940. /************************************************************************/
  941. /* 函数:GetPhotosDir[3/27/2016 IT];
  942. /* 描述:获取相片目录;
  943. /* 参数:;
  944. /* [IN] strID: 订单号;
  945. /* [IN] nMode: =1:修片; =2:原片;
  946. /* [IN] bGrowthTx: 是否成长套系;
  947. /* [IN] strTxName: 套系名;
  948. /* [OUT] photoDirArr: 返回路径集合;
  949. /* 返回:void;
  950. /* 注意:;
  951. /* 示例:;
  952. /*
  953. /* 修改:;
  954. /* 日期:;
  955. /* 内容:;
  956. /************************************************************************/
  957. void ChoosePhotoForm::GetPhotosDir(const CString& strID, const int nMode, const BOOL bGrowthTx, const CString& strTxName, CStringArray& photoDirArr)
  958. {
  959. TCHAR szShare[MAX_PATH] = {0};
  960. TCHAR szOrdePath[MAX_PATH] = {0};
  961. int i=0;
  962. int nSize = 0;
  963. switch(nMode)
  964. {
  965. case 0: // 初修;
  966. {
  967. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("修好的片(管理软件)$"));
  968. // 若是成长套系,初修片有子目录; 若是婚纱版,初修没了景点了目录;
  969. if ( bGrowthTx && ( !strTxName.IsEmpty() && strTxName != _T("全部")) )
  970. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, strID, strTxName);
  971. else
  972. sprintf(szOrdePath, _T("%s\\%s"), szShare, strID);
  973. if ( PathFileExists(szOrdePath) )
  974. photoDirArr.Add(CString(szOrdePath));
  975. nSize = g_aryOfSharePathInfo.GetSize();
  976. for (i = 0; i < nSize; i++)
  977. {
  978. if ( 2 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) )
  979. {
  980. if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname) != 0 )
  981. {
  982. continue;
  983. }
  984. // 逐一加载其他共享目录;
  985. // 如果是成长套系且套系名不为空或全部;
  986. sprintf(szShare,_T("%s"),g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  987. // 若是成长套系,初修片有子目录; 若是婚纱版,初修没了景点了目录;
  988. if ( bGrowthTx && ( !strTxName.IsEmpty() && strTxName != _T("全部")) )
  989. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, strID, strTxName);
  990. else
  991. sprintf(szOrdePath, _T("%s\\%s"), szShare, strID);
  992. if ( PathFileExists(szOrdePath) )
  993. photoDirArr.Add(CString(szOrdePath));
  994. }
  995. }
  996. }
  997. break;
  998. case 1: // 原片;
  999. {
  1000. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("客户原片(管理软件)$"));
  1001. sprintf(szOrdePath, _T("%s\\%s"), szShare, strID);
  1002. if ( PathFileExists(szOrdePath) )
  1003. photoDirArr.Add(CString(szOrdePath));
  1004. nSize = g_aryOfSharePathInfo.GetSize();
  1005. for (i = 0; i < nSize; i++)
  1006. {
  1007. if ( 1 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) )
  1008. {
  1009. if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname) != 0 )
  1010. {
  1011. continue;
  1012. }
  1013. // 逐一加载其他共享目录;
  1014. sprintf(szShare,"%s",g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  1015. sprintf(szOrdePath,"%s\\%s",szShare, strID);
  1016. if ( PathFileExists(szOrdePath) )
  1017. photoDirArr.Add(CString(szOrdePath));
  1018. }
  1019. }
  1020. }
  1021. break;
  1022. }
  1023. }
  1024. /************************************************************************/
  1025. /*
  1026. 函数: GetPhotoFiles
  1027. 描述: 获取指定目录下的相片
  1028. 参数:
  1029. CStringArray* photoDirArr, 相片目录
  1030. CStringArray& filesArr 返回相片集
  1031. 返回:
  1032. */
  1033. /************************************************************************/
  1034. void ChoosePhotoForm::GetPhotoFiles(CStringArray* photoDirArr, CStringArray& filesArr)
  1035. {
  1036. if(photoDirArr == NULL)
  1037. return;
  1038. CString path = _T("");
  1039. CString filename = _T("");
  1040. for(int i=0; i<photoDirArr->GetSize(); i++)
  1041. {
  1042. ffsco o;
  1043. o.dirs(1);
  1044. o.find(LPCSTR(photoDirArr->ElementAt(i)), LPCSTR("*.*"));
  1045. ffsco::typeT coo;
  1046. ffsco::typeT::iterator it;
  1047. coo = o.co_file();
  1048. for (it = coo.begin(); coo.end() != it; it++)
  1049. {
  1050. path = (*it).c_str();
  1051. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  1052. {
  1053. path.MakeLower();
  1054. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1055. if (filename.Find(".") != -1)
  1056. filename = filename.Left(filename.Find("."));
  1057. if (!g_bOriginal && !myisdigit(filename))
  1058. continue;
  1059. filesArr.Add(path);
  1060. }
  1061. }
  1062. }
  1063. }
  1064. void ChoosePhotoForm::OnBnClickedClounxp() // 云选片;
  1065. {
  1066. // TODO: 在此添加控件通知处理程序代码
  1067. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  1068. if ( pos == NULL)
  1069. {
  1070. AfxMessageBox(_T("请选中要使用云选片的订单!"));
  1071. return ;
  1072. }
  1073. INT nItem = m_List1.GetNextSelectedItem(pos);
  1074. CString strOrderNum = _T("");
  1075. CString strScenery = _T("");
  1076. CString strCustomerName = _T("");
  1077. CString strCustomerTel = _T("");
  1078. CString strStudioName = _T("");
  1079. CString strStudioTel = _T("");
  1080. CString strUniqueId = _T("");
  1081. CString strClounSite = _T("");
  1082. CString strTemp;
  1083. strOrderNum = m_List1.GetItemText(nItem, 0);
  1084. strCustomerName.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 1), m_List1.GetItemText(nItem,2));
  1085. #ifdef CHILD_VERSION // 15列;
  1086. strCustomerTel.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 15), m_List1.GetItemText(nItem,16));
  1087. #else
  1088. strCustomerTel.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 15), m_List1.GetItemText(nItem,16));
  1089. #endif
  1090. strStudioName = g_cominfoarray.ElementAt(0).ElementAt(10);
  1091. strStudioTel = g_cominfoarray.ElementAt(0).ElementAt(11);
  1092. strClounSite = m_List1.m_arLabels.ElementAt(nItem).ElementAt(19);
  1093. INT nIndex = 0;
  1094. strTemp = g_branchname.IsEmpty() ? g_domain : g_branchname;
  1095. if ( ( nIndex = strTemp.Find(_T(".ly.com"))) == -1)
  1096. {
  1097. AfxMessageBox(_T("域名无效!"));
  1098. return;
  1099. }
  1100. strTemp = strTemp.Left(nIndex);
  1101. strTemp = strTemp.Right(6);
  1102. strUniqueId.Format(_T("%s_A_%s_0"), strTemp, strOrderNum);
  1103. if ( lyfzLibrary::LoadCloudSelectionLib() )
  1104. {
  1105. CDlgCloudSelection dlg;
  1106. 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);
  1107. dlg.DoModal();
  1108. lyfzLibrary::FreeCloudSelectionLib();
  1109. }
  1110. else
  1111. {
  1112. AfxMessageBox(_T("加载云选片失败,请检查模块文件是否在客户目录下!"));
  1113. }
  1114. }
  1115. void ChoosePhotoForm::OnBnClickedClounxpresult()
  1116. {
  1117. // TODO: 在此添加控件通知处理程序代码
  1118. #if 0
  1119. CArray<CStringArray,CStringArray> AryCloundOrder;
  1120. AryCloundOrder.SetSize(m_List1.m_arLabels.GetSize(),1);
  1121. int i = 0;
  1122. for ( i = 0; i < m_List1.m_arLabels.GetSize(); i++ )
  1123. {
  1124. // 取出生成云链接的订单;
  1125. AryCloundOrder.ElementAt(i).RemoveAll();
  1126. AryCloundOrder.ElementAt(i).Add(m_List1.m_arLabels.ElementAt(i).ElementAt(0)); // 订单号;
  1127. AryCloundOrder.ElementAt(i).Add(m_List1.m_arLabels.ElementAt(i).ElementAt(19)); // 云地址;
  1128. AryCloundOrder.ElementAt(i).Add(_T("")); // 用于存放选片结果,暂时置空;
  1129. }
  1130. INT nIndex = 0;
  1131. CString strTemp = g_branchname.IsEmpty() ? g_domain : g_branchname;
  1132. if ( ( nIndex = strTemp.Find(_T(".ly.com"))) == -1)
  1133. {
  1134. AfxMessageBox(_T("域名无效!"));
  1135. return;
  1136. }
  1137. strTemp = strTemp.Left(nIndex);
  1138. CString strBranchId = strTemp.Right(6);
  1139. // 获取云选片结果;
  1140. CString strUniqueId = _T("");
  1141. CArray<CStringArray,CStringArray> AryJson;
  1142. if ( lyfzLibrary::LoadCloudSelectionLib() )
  1143. {
  1144. nIndex = 0;
  1145. TCHAR szResultValue[8912] = {0};
  1146. for ( i = 0; i < AryCloundOrder.GetSize(); i++ )
  1147. {
  1148. strUniqueId.Format(_T("%s_A_%s_0"), strBranchId, AryCloundOrder.ElementAt(i).ElementAt(0));
  1149. if ( ( nIndex = AryCloundOrder.ElementAt(i).ElementAt(1).Find(lyfzLibrary::g_strCloundHost)) != -1)
  1150. {
  1151. strTemp = AryCloundOrder.ElementAt(i).ElementAt(1).Mid(lyfzLibrary::g_strCloundHost.GetLength() + nIndex);
  1152. lyfzLibrary::g_getcloundresult(0, strUniqueId, strTemp, szResultValue, 8912);
  1153. AryCloundOrder.ElementAt(i).SetAt(2, szResultValue);
  1154. // 解析Json;
  1155. //lyfzLibrary::getXPJsonresult(szResultValue,AryJson);
  1156. }
  1157. }
  1158. lyfzLibrary::FreeCloudSelectionLib();
  1159. }
  1160. // 获取数据库保存的云数据;
  1161. g_sendhead.bsql = 0;
  1162. g_sendhead.code[0] = 241;
  1163. g_sendhead.tabcount = 1;
  1164. CString strFilter = _T("CloundType = 0");
  1165. CArray<CStringArray, CStringArray> AryCloundInfo;
  1166. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1167. if ( !g_bSendOK )
  1168. return;
  1169. DataToArray(&AryCloundInfo);
  1170. // 显示并同步结果;
  1171. int j = 0;
  1172. BOOL bExist = FALSE;
  1173. CString strSQL = _T("");
  1174. for ( i = 0; i < AryCloundOrder.GetSize(); i++ )
  1175. {
  1176. if ( AryCloundOrder.ElementAt(i).ElementAt(2).IsEmpty() )
  1177. continue;
  1178. bExist = FALSE;
  1179. for ( j = 0; j < AryCloundInfo.GetSize(); j++ )
  1180. {
  1181. if ( AryCloundOrder.ElementAt(i).ElementAt(0) == AryCloundInfo.ElementAt(j).ElementAt(0) )
  1182. bExist = TRUE;
  1183. }
  1184. if ( bExist )
  1185. {
  1186. if ( AryCloundOrder.ElementAt(i).ElementAt(2) == AryCloundInfo.ElementAt(j-1).ElementAt(4) )
  1187. continue;
  1188. strSQL.Format(_T("update [CloundSelection] set [ResultJson] = '%s' where [order] = '%s'"), AryCloundOrder.ElementAt(i).ElementAt(0), AryCloundOrder.ElementAt(i).ElementAt(2));
  1189. }
  1190. else
  1191. strSQL.Format(_T("insert into [CloundSelection]( [order], [CloundType], [ResultJson]) values('%s', 0, '%s') "), AryCloundOrder.ElementAt(i).ElementAt(0), AryCloundOrder.ElementAt(i).ElementAt(2));
  1192. g_sendhead.bsql = true;
  1193. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  1194. }
  1195. #endif
  1196. CDlgCloundResult dlg;
  1197. dlg.m_pList = &m_List1;
  1198. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  1199. if ( pos != NULL )
  1200. {
  1201. INT nItem = m_List1.GetNextSelectedItem(pos);
  1202. dlg.m_nSelItem = nItem;
  1203. }
  1204. dlg.DoModal();
  1205. }