BeautifySkinFrom.cpp 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353
  1. // BeautifySkinFrom.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "BeautifySkinFrom.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "ShowPic.h"
  9. #include "SelProvider.h"
  10. #include "CompressOption.h"
  11. #include "DlgFirstRepairDivision.h"
  12. #include "NetShareInfo.h"
  13. #include "DlgChuXiuInfo.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. //#pragma comment(lib, "Shlwapi.lib")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // BeautifySkinFrom
  22. IMPLEMENT_DYNCREATE(BeautifySkinFrom, MyFormView)
  23. BeautifySkinFrom::BeautifySkinFrom()
  24. : MyFormView(BeautifySkinFrom::IDD)
  25. {
  26. //{{AFX_DATA_INIT(BeautifySkinFrom)
  27. m_filter = _T("");
  28. m_nAdd=0;
  29. //}}AFX_DATA_INIT
  30. if(g_bAllBranch)
  31. {
  32. m_nAdd=1;
  33. }
  34. }
  35. BeautifySkinFrom::~BeautifySkinFrom()
  36. {
  37. }
  38. void BeautifySkinFrom::DoDataExchange(CDataExchange* pDX)
  39. {
  40. MyFormView::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(BeautifySkinFrom)
  42. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  43. DDX_Control(pDX, IDC_LIST2, m_List1);
  44. DDX_Control(pDX, IDC_STATIC1, m_static1);
  45. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  46. //}}AFX_DATA_MAP
  47. }
  48. BEGIN_MESSAGE_MAP(BeautifySkinFrom, MyFormView)
  49. //{{AFX_MSG_MAP(BeautifySkinFrom)
  50. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  51. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  52. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  53. ON_WM_TIMER()
  54. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  55. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  56. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  57. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  58. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  59. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  60. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  61. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  62. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  63. //}}AFX_MSG_MAP
  64. END_MESSAGE_MAP()
  65. /////////////////////////////////////////////////////////////////////////////
  66. // BeautifySkinFrom diagnostics
  67. #ifdef _DEBUG
  68. void BeautifySkinFrom::AssertValid() const
  69. {
  70. MyFormView::AssertValid();
  71. }
  72. void BeautifySkinFrom::Dump(CDumpContext& dc) const
  73. {
  74. MyFormView::Dump(dc);
  75. }
  76. #endif //_DEBUG
  77. /////////////////////////////////////////////////////////////////////////////
  78. // BeautifySkinFrom message handlers
  79. void BeautifySkinFrom::OnInitialUpdate()
  80. {
  81. MyFormView::OnInitialUpdate();
  82. // TODO: Add your specialized code here and/or call the base class
  83. CMyMdi Mdi;
  84. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  85. // Here we create the outbar control using the splitter as its parent
  86. // and setting its id to the first pane.
  87. CRect rc2;
  88. GetWindowRect(rc2);
  89. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  90. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  91. int idarray[]={IDC_BUTprint3,IDC_BUTexportphoto,IDC_BUTimportphoto,IDC_BUTshowphoto,IDC_BUTexportphoto2,IDC_BUTclose};
  92. int idcount=6;
  93. int btnwid;
  94. CRect prerc;
  95. for(int a=idcount-2; a>=0; a--)
  96. {
  97. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  98. ScreenToClient(prerc);
  99. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  100. ScreenToClient(rc2);
  101. btnwid=rc2.Width ();
  102. rc2.right =prerc.left ;
  103. rc2.left =rc2.right -btnwid;
  104. GetDlgItem(idarray[a])->MoveWindow (rc2);
  105. }
  106. m_static1.SetFont (&g_titlefont);
  107. if(g_bAllBranch==0)
  108. {
  109. #ifdef CHILD_VERSION
  110. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;拍照,100;修片,100;修片日期,100;加急,100;选片日期,100;摄影师,100;修片人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  111. #else
  112. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;拍照,100;修片,100;修片日期,100;加急,100;选片日期,100;摄影师,100;修片人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  113. #endif
  114. m_List1.LoadColumnInfo (118);
  115. }
  116. else
  117. {
  118. #ifdef CHILD_VERSION
  119. m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;拍照,100;修片,100;修片日期,100;加急,100;选片日期,100;摄影师,100;修片人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  120. #else
  121. m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;拍照,100;修片,100;修片日期,100;加急,100;选片日期,100;摄影师,100;修片人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  122. #endif
  123. m_List1.LoadColumnInfo (197);GetDlgItem(IDC_BUTprint3)->ShowWindow (1);
  124. }
  125. GetData();
  126. m_combo1.AddString (g_user.name);
  127. m_combo1.GetWindowRect (rc2);
  128. ScreenToClient(rc2);
  129. rc2.bottom +=200;
  130. m_combo1.MoveWindow (rc2);
  131. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  132. SetComboHei(&m_combo1, rc2.Height ());
  133. GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(8));
  134. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(9));
  135. }
  136. void BeautifySkinFrom::FillGrid(BOOL bStatus)
  137. {
  138. if(g_bSearchFilter)
  139. {
  140. m_List1.DeleteAllItems2 ();
  141. int ii=0;
  142. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  143. int count=0;
  144. {
  145. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  146. {
  147. if(g_filterdate1!="")
  148. {
  149. if(m_List1array.ElementAt (ii).ElementAt (5+m_nAdd)<g_filterdate1 || m_List1array.ElementAt (ii).ElementAt (5+m_nAdd)>g_filterdate2)
  150. continue;
  151. }
  152. if(g_waiter1!="")
  153. {
  154. if(m_List1array.ElementAt (ii).ElementAt (9+m_nAdd)!=g_waiter1)
  155. continue;
  156. }
  157. if(g_bAllBranch && g_filterbranch!="")
  158. {
  159. if(m_List1array.ElementAt (ii).ElementAt (0)!= g_filterbranch)
  160. continue;
  161. }
  162. if(1)
  163. {
  164. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  165. }
  166. }
  167. }
  168. m_List1.m_arLabels.SetSize(count, 1);
  169. ii=count;
  170. m_List1.m_LabelCount=ii;
  171. m_List1.SetItemCountEx (ii);
  172. CString str;
  173. str.Format ("单数:%d", ii);
  174. SetDlgItemText(IDC_STATIC2, str);
  175. }
  176. else
  177. {
  178. m_List1.DeleteAllItems2 ();
  179. int ii=0;
  180. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  181. int count=0;
  182. if(m_filter.IsEmpty ())
  183. {
  184. if(bStatus)
  185. {
  186. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  187. {
  188. if( (m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"||m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="拍摄中") && m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK")
  189. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  190. }
  191. }
  192. else
  193. {
  194. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  195. {
  196. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  197. }
  198. }
  199. }
  200. else
  201. {
  202. if(bStatus)
  203. {
  204. int type=GetType(m_filter);
  205. if(type==1)//电话
  206. {
  207. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  208. {
  209. if((m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"||m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="拍摄中")&&m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK" && (m_List1array.ElementAt (ii).ElementAt (13+m_nAdd).Find (m_filter)!=-1 || \
  210. m_List1array.ElementAt (ii).ElementAt (14+m_nAdd).Find (m_filter)!=-1) )
  211. {
  212. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  213. }
  214. }
  215. }
  216. else if(type==2)//拼音
  217. {
  218. m_filter.MakeUpper ();
  219. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  220. {
  221. if((m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"||m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="拍摄中")&&m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK" &&(m_List1array.ElementAt (ii).ElementAt (15+m_nAdd).Find (m_filter)!=-1 || \
  222. m_List1array.ElementAt (ii).ElementAt (16+m_nAdd).Find (m_filter)!=-1))
  223. {
  224. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  225. }
  226. }
  227. }
  228. else
  229. {
  230. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  231. {
  232. if((m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"||m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="拍摄中")&&m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK" &&(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  233. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  234. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  235. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  236. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1 || \
  237. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1|| \
  238. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1|| \
  239. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  240. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  241. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1) )
  242. {
  243. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  244. }
  245. }
  246. }
  247. }
  248. else
  249. {
  250. int type=GetType(m_filter);
  251. if(type==1)//电话
  252. {
  253. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  254. {
  255. if(m_List1array.ElementAt (ii).ElementAt (13+m_nAdd).Find (m_filter)!=-1 || \
  256. m_List1array.ElementAt (ii).ElementAt (14+m_nAdd).Find (m_filter)!=-1)
  257. {
  258. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  259. }
  260. }
  261. }
  262. else if(type==2)//拼音
  263. {
  264. m_filter.MakeUpper ();
  265. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  266. {
  267. if(m_List1array.ElementAt (ii).ElementAt (15+m_nAdd).Find (m_filter)!=-1 || \
  268. m_List1array.ElementAt (ii).ElementAt (16+m_nAdd).Find (m_filter)!=-1)
  269. {
  270. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  271. }
  272. }
  273. }
  274. else
  275. {
  276. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  277. {
  278. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  279. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  280. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  281. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  282. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  283. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1 || \
  284. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1|| \
  285. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1|| \
  286. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  287. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  288. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1 )
  289. {
  290. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  291. }
  292. }
  293. }
  294. }
  295. }
  296. m_List1.m_arLabels.SetSize(count, 1);
  297. ii=count;
  298. m_List1.m_LabelCount=ii;
  299. m_List1.SetItemCountEx (ii);
  300. CString str;
  301. str.Format ("单数:%d", ii);
  302. SetDlgItemText(IDC_STATIC2, str);
  303. }
  304. if(!g_id.IsEmpty ())
  305. {
  306. for(int i=0; i<m_List1.GetItemCount (); i++)
  307. {
  308. if(g_id==m_List1.GetItemText (i, 0+m_nAdd))
  309. {
  310. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  311. m_List1.EnsureVisible(i,FALSE);
  312. break;
  313. }
  314. }
  315. }
  316. }
  317. void BeautifySkinFrom::OnBUTclose()
  318. {
  319. // TODO: Add your control notification handler code here
  320. GetParent()->SendMessage(WM_CLOSE);
  321. }
  322. void BeautifySkinFrom::OnSelchangeCombo1()
  323. {
  324. // TODO: Add your control notification handler code here
  325. SetTimer(1, 100, NULL);
  326. }
  327. void BeautifySkinFrom::OnTimer(UINT nIDEvent)
  328. {
  329. // TODO: Add your message handler code here and/or call default
  330. KillTimer(nIDEvent);
  331. OnButton1();
  332. }
  333. BOOL BeautifySkinFrom::PreTranslateMessage(MSG* pMsg)
  334. {
  335. // TODO: Add your specialized code here and/or call the base class
  336. try
  337. {
  338. if(pMsg->message==WM_KEYDOWN)
  339. {
  340. switch (pMsg->wParam)
  341. {
  342. case VK_RETURN:
  343. OnButton1();
  344. return 1;
  345. case 0x43: // copy
  346. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  347. {
  348. GetFocus()->SendMessage(WM_COPY);
  349. return TRUE;
  350. }
  351. break;
  352. case 0x56: //Ctrl + V:
  353. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  354. {
  355. GetFocus()->SendMessage(WM_PASTE);
  356. return TRUE;
  357. }
  358. break;
  359. case 0x58: // cut
  360. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  361. {
  362. GetFocus()->SendMessage(WM_CUT);
  363. return TRUE;
  364. }
  365. break;
  366. case 0x5A: //undo
  367. case 0x59: //redo
  368. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  369. {
  370. GetFocus()->SendMessage(WM_UNDO);
  371. return TRUE;
  372. }
  373. break;
  374. }
  375. }
  376. return MyFormView::PreTranslateMessage(pMsg);
  377. }
  378. catch(...)
  379. {
  380. }
  381. return true;
  382. }
  383. BOOL GetFileNo2(CString dir, CString no)
  384. {
  385. int pos=no.Find("-");
  386. if(pos!=-1)no=no.Left(pos);
  387. CString path;
  388. CString path2;
  389. CString path3;
  390. CString path4;
  391. CString temp;
  392. CStringArray array;
  393. using namespace helper_coffs;
  394. ffsco o;
  395. o.dirs(1);
  396. o.find(LPCSTR(dir), LPCSTR("*.*"));
  397. ffsco::typeT coo;
  398. ffsco::typeT::iterator it;
  399. coo = o.co_dir();
  400. for (it = coo.begin();
  401. coo.end() != it;
  402. it ++)
  403. {
  404. temp=(*it).c_str();
  405. if(::FindArray (&array, temp)==-1)
  406. array.Add (temp);
  407. }
  408. for(int i=0; i<array.GetSize (); i++)
  409. {
  410. dir=array.ElementAt (i);
  411. path.Format ("%s%s.jpg", dir, no);
  412. path2.Format ("%s%s.raw", dir, no);
  413. path3.Format ("%s%s.cr2", dir, no);
  414. path4.Format ("%s%s.NEF", dir, no);
  415. if(PathFileExists (path) || PathFileExists (path2) || PathFileExists (path3) || PathFileExists (path4))
  416. {
  417. return 1;
  418. }
  419. }
  420. return 0;
  421. }
  422. void BeautifySkinFrom::OnBUTimportphoto() // 导入修好的片;
  423. {
  424. // 2015.11.10
  425. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  426. if ( pos == NULL )
  427. {
  428. AfxMessageBox(_T("请选中您要导入初修片的订单!"),MB_ICONINFORMATION);
  429. return;
  430. }
  431. INT nItemCount = m_List1.GetItemCount();
  432. INT nSelectedItem = m_List1.GetNextSelectedItem(pos);
  433. // 获取列表订单信息:域名、订单号、景点名、顾客信息……
  434. CString strBranchName = _T("");
  435. CString strBranchId = _T("");
  436. CString strOrderNum = _T("");
  437. CString strScenery = _T("");
  438. CString strCustomerInfo = _T(""); // 顾客信息;
  439. CString strXiupianDate = _T(""); // 修片日期;
  440. CString strXiupianRen = _T(""); // 修片人;
  441. CString strPhone = _T(""); // 顾客手机;
  442. CString strXiupianStatus = _T(""); // 初修状态;
  443. // 获取域名;
  444. if ( g_bAllBranch )
  445. {// 多店汇总时;
  446. strBranchName = m_List1.GetItemText( nSelectedItem, 0);
  447. strBranchId = GetDomainFromBranch( strBranchName );
  448. }
  449. else
  450. {
  451. if ( g_branchname.IsEmpty() )
  452. {// 连接本店时;
  453. strBranchName = _T("");
  454. strBranchId = g_domain;
  455. }
  456. else
  457. {// 连接分店时;
  458. strBranchName = g_branchname;
  459. strBranchId = GetDomainFromBranch( g_branchname );
  460. }
  461. }
  462. // 获取订单号;
  463. strOrderNum = m_List1.GetItemText(nSelectedItem, 0 + m_nAdd);
  464. // 获取修片状态;
  465. strXiupianStatus = m_List1.GetItemText(nSelectedItem, 4 + m_nAdd);
  466. // 获取修片人;
  467. strXiupianRen = m_List1.GetItemText(nSelectedItem, 9 + m_nAdd);
  468. // 获取修片日期;
  469. strXiupianDate = m_List1.GetItemText(nSelectedItem, 5 + m_nAdd);
  470. // 获取顾客信息;
  471. strCustomerInfo = m_List1.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_List1.GetItemText(nSelectedItem, 2 + m_nAdd);
  472. CDlgChuXiuInfo xpdlg;
  473. xpdlg.m_strOrderNumber = strOrderNum;
  474. xpdlg.m_strXiupianRen = strXiupianRen;
  475. if ( strXiupianStatus == _T("OK") )
  476. xpdlg.m_nXiupianStatus = 0;
  477. else if ( strXiupianStatus == _T("修片中"))
  478. xpdlg.m_nXiupianStatus = 1;
  479. else if ( strXiupianStatus == _T("未修"))
  480. xpdlg.m_nXiupianStatus = 2;
  481. CString strSQL = _T("");
  482. if ( xpdlg.DoModal() == IDOK )
  483. {
  484. if ( xpdlg.m_bGrowthTx )
  485. strScenery = xpdlg.m_strScenery;
  486. if ( xpdlg.m_nXiupianStatus == 0 )
  487. strXiupianStatus = _T("OK");
  488. else if ( xpdlg.m_nXiupianStatus == 1)
  489. strXiupianStatus = _T("修片中");
  490. else if ( xpdlg.m_nXiupianStatus == 2 )
  491. strXiupianStatus = _T("未修");
  492. strXiupianRen = xpdlg.m_strXiupianRen;
  493. if (strXiupianDate.IsEmpty())
  494. strSQL.Format(_T("update dindan set waiter5 = '%s', status4 = '%s', time8 = '%s' where id = '%s'"), strXiupianRen, strXiupianStatus, g_date, strOrderNum);
  495. else
  496. strSQL.Format(_T("update dindan set waiter5 = '%s', status4 = '%s' where id = '%s'"), strXiupianRen, strXiupianStatus, strOrderNum);
  497. g_sendhead.bsql = TRUE;
  498. if( g_bAllBranch )
  499. {// 多店汇总时;
  500. g_branchip = GetBranchIPbyId(strBranchId);
  501. g_pMainWnd->OnDisconnect();
  502. g_branchname = strBranchName;
  503. g_bBranchModify = TRUE;
  504. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  505. g_bBranchModify = FALSE;
  506. g_branchip = g_branchname = _T("");
  507. }
  508. else
  509. {// 连接分店或本店时;
  510. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  511. }
  512. if( !g_bSendOK )
  513. {
  514. OutputDebugString(_T("连接服务器失败!\n"));
  515. return;
  516. }
  517. if( !g_bAllBranch )
  518. {
  519. GetData();
  520. }
  521. else
  522. {// 多店汇总时;
  523. for(int i = 0; i < m_List1array.GetSize(); i++ )
  524. {
  525. if( strOrderNum == m_List1array.ElementAt(i).ElementAt(1) && strBranchName == m_List1array.ElementAt(i).ElementAt(0) )
  526. {
  527. m_List1array.ElementAt(i).SetAt(4 + m_nAdd, strXiupianStatus);
  528. if(strXiupianDate.IsEmpty())
  529. m_List1array.ElementAt(i).SetAt(5 + m_nAdd, g_date);
  530. m_List1array.ElementAt(i).SetAt( 9 + m_nAdd, strXiupianRen);
  531. FillGrid();
  532. break;
  533. }
  534. }
  535. }
  536. }
  537. else
  538. {
  539. // 开始导入初修片;
  540. if ( MessageBox(_T("是否现在开始导入初修片!"), _T("导片提示:导入初修片"), MB_TOPMOST|MB_YESNO|MB_ICONWARNING ) != IDYES )
  541. {// 是否马上导入相片;
  542. return;
  543. }
  544. if ( xpdlg.m_bGrowthTx )
  545. strScenery = xpdlg.m_strScenery;
  546. if ( xpdlg.m_bGrowthTx && strScenery.IsEmpty() )
  547. {
  548. AfxMessageBox(_T("儿童成长套系导片必须选择套系名!"));
  549. return;
  550. }
  551. }
  552. /////////////////////////////////////////////////////////////////////////////////////////////////
  553. if ( g_pIMGProcess == NULL )
  554. {
  555. return ;
  556. }
  557. // 获取完信息,开始导入初修片;
  558. ImgImportInterface *pImport = NULL;
  559. g_pIMGProcess->QueryInterface(IID_ImgImportInterface, (void**)&pImport);
  560. if ( pImport )
  561. {
  562. pImport->ImportSecondaryImg(
  563. TRUE, // 相片源的类型:true = 选择文件夹形式; false = 选择文件形式;
  564. strBranchId, // 分店域名;
  565. strOrderNum, // 订单号;
  566. strCustomerInfo, // 顾客信息;
  567. !strScenery.IsEmpty(), // 导入时是否生成景点名;
  568. strScenery, // 要导入并生成的景点名;
  569. _T("*.jpg|*.jpeg"), // 要导入的扩展名;
  570. INVALID_COPY_PIX, // 要导入的相片的压缩像素大小;INVALID_COPY_PIX表示不压缩,原比例导入;
  571. _T("*.nef|*.cr2|*.raw|*.ra2"), // 导入相片时,附加要导入的扩展名;附加的相片不设置压缩像素;
  572. TRUE, // 导入操作时,是否生成缩略图;只生成lpImportExt的;
  573. SET_PIX(100,100), // 要生成的缩略图的像素大小;
  574. FALSE // 目标文件存在是否复制,只针对lpImportExt和lpImportWithExt对应的文件,缩略图直接覆盖;
  575. );
  576. g_pIMGProcess->Release();
  577. WriteOptLog(_T("导入初修,订单号:%s"),strOrderNum);
  578. }
  579. // 结束;
  580. }
  581. void BeautifySkinFrom::OnBUTshowphoto() // 查看修好的片;
  582. {
  583. // TODO: Add your control notification handler code here
  584. POSITION pos;
  585. pos=m_List1.GetFirstSelectedItemPosition();
  586. if(pos==NULL)
  587. {
  588. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  589. return;
  590. }
  591. int iItem=m_List1.GetNextSelectedItem(pos);
  592. CString branch;
  593. CString id=m_List1.GetItemText (iItem, 0+m_nAdd);
  594. if(g_bAllBranch)
  595. branch=m_List1.GetItemText (iItem, 0);
  596. CString name=m_List1.GetItemText (iItem, 1+m_nAdd)+","+m_List1.GetItemText (iItem, 2+m_nAdd);
  597. name.TrimLeft (",");
  598. name.TrimRight (",");
  599. name="客人:"+name;
  600. ShowPic dlg;
  601. dlg.m_id=id;
  602. dlg.m_name=name;
  603. dlg.m_mode=2;
  604. if(g_branchname == _T(""))
  605. dlg.m_path = g_path1 + "\\";
  606. else
  607. {
  608. dlg.m_branch = GetDomainFromBranch(g_branchname);
  609. CString branchpath = GetBranchPhotoPath(g_branchname);
  610. dlg.m_path = g_path1 + branchpath + "\\";
  611. }
  612. #ifndef USE_KERNEL_DLL
  613. #if USE_SHARE_FLORD
  614. // 根据域名,相片类型,订单号查找相片;
  615. dlg.m_aryOfShareDirectory.RemoveAll();
  616. CNetShareInfo::GetInstance()->LoadOrderImages(dlg.m_mode, dlg.m_id, g_domain, dlg.m_patharray1, &dlg.m_aryOfShareDirectory);
  617. #endif
  618. #endif
  619. dlg.m_path+=id;
  620. dlg.m_path +="\\";
  621. dlg.DoModal ();
  622. }
  623. void BeautifySkinFrom::OnBUTexportphoto() // 导出原片;
  624. {
  625. // 2015.11.10
  626. // 判断登陆用户是否有导出原片的权限;
  627. if ( !IsHasRights2new(8) )
  628. {
  629. AfxMessageBox(_T("您无权限导出原片!"),MB_ICONINFORMATION);
  630. return;
  631. }
  632. // 获取列表信息:域名、订单号、景点名、顾客信息;
  633. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  634. if ( pos == NULL )
  635. {
  636. AfxMessageBox(_T("请选中您要导出原片的订单!"), MB_ICONINFORMATION);
  637. return;
  638. }
  639. INT nItemCount = m_List1.GetItemCount();
  640. INT nSelectedItem = m_List1.GetNextSelectedItem(pos);
  641. CString strBranchId = _T("");
  642. CString strOrderNum = _T("");
  643. // 初修列表不支持景点名,需要从其他地方获取;
  644. CString strScenery = _T("");
  645. CString strCustomerInfo = _T("");
  646. // 获取域名;
  647. if ( g_bAllBranch )
  648. {// 多店汇总时;
  649. strBranchId = GetDomainFromBranch( m_List1.GetItemText(nSelectedItem, 0) );
  650. }
  651. else
  652. {
  653. if ( g_branchname.IsEmpty() )
  654. {// 连接本店时;
  655. strBranchId = g_domain;
  656. }
  657. else
  658. {// 连接分店时;
  659. strBranchId = GetDomainFromBranch( g_branchname );
  660. }
  661. }
  662. // 获取订单号;
  663. strOrderNum = m_List1.GetItemText(nSelectedItem, 0 + m_nAdd);
  664. // 获取顾客信息;
  665. strCustomerInfo = m_List1.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_List1.GetItemText(nSelectedItem, 2 + m_nAdd);
  666. // 获取景点名,需要读取dindanjd表获取,目前只支持儿童成长套系订单;
  667. IsGrowthTx IsGrowthtxdlg;
  668. IsGrowthtxdlg.m_mode = 1;
  669. IsGrowthtxdlg.m_strOrderNumber = strOrderNum;
  670. IsGrowthtxdlg.DoModal();
  671. if( IsGrowthtxdlg.m_bReturnOK == 0 || (IsGrowthtxdlg.m_bGrowthTx && IsGrowthtxdlg.m_seltxname.IsEmpty()) )
  672. {
  673. return;
  674. }
  675. if ( IsGrowthtxdlg.m_bGrowthTx )
  676. {
  677. // 读取dindanjd表里的成长套系名,并返回选中的成长套系名;
  678. strScenery = IsGrowthtxdlg.m_seltxname;
  679. if ( strScenery == _T("全部") )
  680. {
  681. strScenery.Empty();
  682. }
  683. }
  684. // 导出原片时,是否压缩导出;
  685. DWORD dwExportPix = INVALID_COPY_PIX; // 通过其他对话框,选择导出时压缩的像素;
  686. /////////////////////////////////////////////////////////////////////////////////////////////////
  687. if ( g_pIMGProcess == NULL )
  688. {
  689. return;
  690. }
  691. // 获取完信息,开始导出原片;
  692. ImgExportInterface *pExport = NULL;
  693. g_pIMGProcess->QueryInterface(IID_ImgExportInterface, (void**)&pExport);
  694. if ( pExport )
  695. {
  696. pExport->ExportOriginalImg(
  697. TRUE,
  698. strBranchId,
  699. strOrderNum,
  700. strCustomerInfo,
  701. !strScenery.IsEmpty(),
  702. strScenery,
  703. _T("*.jpg|*.jpeg"),
  704. dwExportPix,
  705. _T("*.nef|*.cr2|*.raw|*.ra2"),
  706. FALSE,
  707. FALSE
  708. );
  709. }
  710. g_pIMGProcess->Release();
  711. WriteOptLog(_T("导出原片,订单号:%s"),strOrderNum);
  712. // 结束;
  713. }
  714. void BeautifySkinFrom::OnBUTexportphoto2() // 导出修好的片;
  715. {
  716. // 2015.11.10
  717. // 判断登陆用户是否有导出原片的权限;
  718. if ( !IsHasRights2new(9) )
  719. {
  720. AfxMessageBox(_T("您无权限导出原片!"),MB_ICONINFORMATION);
  721. return;
  722. }
  723. // 获取列表信息:域名、订单号、景点名、顾客信息;
  724. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  725. if ( pos == NULL )
  726. {
  727. AfxMessageBox(_T("请选中您要导出原片的订单!"), MB_ICONINFORMATION);
  728. return;
  729. }
  730. INT nItemCount = m_List1.GetItemCount();
  731. INT nSelectedItem = m_List1.GetNextSelectedItem(pos);
  732. CString strBranchId = _T("");
  733. CString strOrderNum = _T("");
  734. // 初修列表不支持景点名,需要从其他地方获取;
  735. CString strScenery = _T("");
  736. CString strCustomerInfo = _T("");
  737. // 获取域名;
  738. if ( g_bAllBranch )
  739. {// 多店汇总时;
  740. strBranchId = GetDomainFromBranch( m_List1.GetItemText(nSelectedItem, 0) );
  741. }
  742. else
  743. {
  744. if ( g_branchname.IsEmpty() )
  745. {// 连接本店时;
  746. strBranchId = g_domain;
  747. }
  748. else
  749. {// 连接分店时;
  750. strBranchId = GetDomainFromBranch( g_branchname );
  751. }
  752. }
  753. // 获取订单号;
  754. strOrderNum = m_List1.GetItemText(nSelectedItem, 0 + m_nAdd);
  755. // 获取顾客信息;
  756. strCustomerInfo = m_List1.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_List1.GetItemText(nSelectedItem, 2 + m_nAdd);
  757. // 获取景点名,需要读取dindanjd表获取,目前只支持儿童成长套系订单;
  758. IsGrowthTx IsGrowthtxdlg;
  759. IsGrowthtxdlg.m_mode = 1;
  760. IsGrowthtxdlg.m_strOrderNumber = strOrderNum;
  761. IsGrowthtxdlg.DoModal();
  762. if( IsGrowthtxdlg.m_bReturnOK == 0 || (IsGrowthtxdlg.m_bGrowthTx && IsGrowthtxdlg.m_seltxname.IsEmpty()) )
  763. {
  764. return;
  765. }
  766. if ( IsGrowthtxdlg.m_bGrowthTx )
  767. {
  768. // 读取dindanjd表里的成长套系名,并返回选中的成长套系名;
  769. strScenery = IsGrowthtxdlg.m_seltxname;
  770. if ( strScenery == _T("全部") )
  771. {
  772. strScenery.Empty();
  773. }
  774. }
  775. // 导出原片时,是否压缩导出;
  776. DWORD dwExportPix = INVALID_COPY_PIX; // 通过其他对话框,选择导出时压缩的像素;
  777. /////////////////////////////////////////////////////////////////////////////////////////////////
  778. if ( g_pIMGProcess == NULL )
  779. {
  780. return ;
  781. }
  782. // 获取完信息,开始导出原片;
  783. ImgExportInterface *pExport = NULL;
  784. g_pIMGProcess->QueryInterface(IID_ImgExportInterface, (void**)&pExport);
  785. if ( pExport )
  786. {
  787. pExport->ExportSecondaryImg(
  788. TRUE,
  789. strBranchId,
  790. strOrderNum,
  791. strCustomerInfo,
  792. !strScenery.IsEmpty(),
  793. strScenery,
  794. _T("*.jpg|*.jpeg"),
  795. dwExportPix,
  796. _T("*.nef|*.cr2|*.raw|*.ra2"),
  797. FALSE,
  798. FALSE
  799. );
  800. }
  801. g_pIMGProcess->Release();
  802. WriteOptLog(_T("导出初修,订单号:%s"),strOrderNum);
  803. // 结束;
  804. }
  805. void BeautifySkinFrom::OnButton1()
  806. {
  807. // TODO: Add your control notification handler code here
  808. UpdateData();
  809. m_filter.TrimLeft ();
  810. m_filter.TrimRight ();
  811. FillGrid();
  812. }
  813. void BeautifySkinFrom::OnButton2()
  814. {
  815. // TODO: Add your control notification handler code here
  816. UpdateData();
  817. m_filter.TrimLeft ();
  818. m_filter.TrimRight ();
  819. FillGrid(1);
  820. }
  821. void BeautifySkinFrom::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  822. {
  823. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  824. // TODO: Add your control notification handler code here
  825. POSITION pos;
  826. pos=m_List1.GetFirstSelectedItemPosition();
  827. if(pos==NULL)
  828. {
  829. return;
  830. }
  831. int iItem=m_List1.GetNextSelectedItem(pos);
  832. if(IsHasRights2new(5) || IsHasRights2new(49))
  833. {
  834. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  835. }
  836. else
  837. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  838. *pResult = 0;
  839. }
  840. BOOL BeautifySkinFrom::CheckOK(CString name)
  841. {
  842. int pos=name.Find("-");
  843. if(pos!=-1)name=name.Left(pos);
  844. if(name.GetLength ()>4)return 0;
  845. for(int i=0; i<name.GetLength (); i++)
  846. {
  847. if(name.GetAt (i)<'0'||name.GetAt (i)>'9')return 0;
  848. }
  849. return 1;
  850. }
  851. void BeautifySkinFrom::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  852. {
  853. // TODO: Add your control notification handler code here
  854. POSITION pos;
  855. pos=m_List1.GetFirstSelectedItemPosition();
  856. if(pos==NULL)return;
  857. int iItem=m_List1.GetNextSelectedItem(pos);
  858. g_id = m_List1.GetItemText (iItem, 0+m_nAdd);
  859. *pResult = 0;
  860. }
  861. void BeautifySkinFrom::HidePrice()
  862. {
  863. }
  864. void BeautifySkinFrom::OnBtnsearchfilter()
  865. {
  866. // TODO: Add your control notification handler code here
  867. SearchFilter dlg;
  868. dlg.m_mode = 2;
  869. if(dlg.DoModal ()==IDOK)FillGrid();
  870. g_bSearchFilter=0;
  871. }
  872. void BeautifySkinFrom::GetData()
  873. {
  874. if(g_bAllBranch==0)
  875. {
  876. if(g_bShowOK==0)
  877. {
  878. #ifdef LKAY_VERSION
  879. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  880. #else
  881. CString filter="status3='未取'";
  882. #endif
  883. g_sendhead.bsql=0;
  884. g_sendhead.code[0]=184;
  885. g_sendhead.tabcount=1;
  886. g_pMainWnd->ProcessChatMessageRequest2(filter);
  887. if(g_bSendOK==0)
  888. {
  889. return;
  890. }
  891. }
  892. else
  893. {
  894. g_sendhead.bsql=0;
  895. g_sendhead.code[0]=184;
  896. g_sendhead.tabcount=1;
  897. #ifdef LKAY_VERSION
  898. CString filter="dindantype<>'意向客户' or dindantype is null";
  899. g_pMainWnd->ProcessChatMessageRequest2(filter);
  900. #else
  901. g_pMainWnd->ProcessChatMessageRequest2(1);
  902. #endif
  903. if(g_bSendOK==0)return;
  904. }
  905. DataToArray(&m_List1array);
  906. }
  907. else
  908. {
  909. //////////////数据汇总
  910. m_List1array.RemoveAll ();
  911. CString branch;
  912. for(int i=-1; i < g_brancharray.GetSize ()-1; i++)
  913. {
  914. if(i!=-1)
  915. {
  916. branch=g_brancharray.ElementAt (i).ElementAt (0);
  917. g_branchip=g_brancharray.ElementAt (i).ElementAt (1);
  918. g_pMainWnd->OnDisconnect();
  919. g_branchname=branch;
  920. g_bBranchModify=1;
  921. }
  922. else
  923. branch=g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (0);
  924. if(g_bShowOK==0)
  925. {
  926. CString filter="status3='未取'";
  927. g_sendhead.bsql=0;
  928. g_sendhead.code[0]=184;
  929. g_sendhead.tabcount=1;
  930. g_pMainWnd->ProcessChatMessageRequest2(filter);
  931. if(g_bSendOK==0)
  932. {
  933. continue;
  934. }
  935. }
  936. else
  937. {
  938. g_sendhead.bsql=0;
  939. g_sendhead.code[0]=184;
  940. g_sendhead.tabcount=1;
  941. g_pMainWnd->ProcessChatMessageRequest2(1);
  942. if(g_bSendOK==0)
  943. {
  944. continue;
  945. }
  946. }
  947. CArray<CStringArray, CStringArray>List1array;
  948. DataToArray(&List1array);
  949. int size=m_List1array.GetSize ();
  950. for(int j=0; j<List1array.GetSize (); j++)
  951. {
  952. size++;
  953. m_List1array.SetSize(size , 1 );
  954. size--;
  955. m_List1array.ElementAt (size).Copy (List1array.ElementAt (j));
  956. m_List1array.ElementAt (size).InsertAt (0, branch);
  957. size++;
  958. }
  959. }
  960. g_pMainWnd->OnDisconnect();
  961. g_bBranchModify=0;g_branchip=g_branchname="";
  962. }
  963. HidePrice();
  964. FillGrid();
  965. }
  966. void BeautifySkinFrom::OnBUTprint3()
  967. {
  968. // TODO: Add your control notification handler code here
  969. GetData();
  970. }
  971. #if USE_SHARE_FLORD
  972. /************************************************************************/
  973. /*
  974. 函数:LoadAllImageSource
  975. 描述:加载所有原片相片,若景点名不为空或全部,则导出的只是该订单下的某个景点的相片(若是儿童版的成长套系,则只导出某个成长套系下的相片);
  976. 参数:
  977. IN:lpOrderNum 所选订单号;
  978. IN:lpDomain 订单所在域名,空则为本店;
  979. IN:bGrowTh 订单是否为成长套系;
  980. IN:strSelectName 若是成长套系,则为所选的套系名称;
  981. OUT:strArray 返回所有符合要求的相片路径;
  982. 返回:
  983. 调用约定:
  984. 注意:
  985. */
  986. /************************************************************************/
  987. void BeautifySkinFrom::LoadAllImageSource(IN LPCTSTR lpOrderNum, IN LPCTSTR lpDomain, IN BOOL bGrowTh, IN CString &strSelectName, OUT CStringArray &strArray)
  988. {
  989. // 1.需要判断域名有效性;
  990. if (lpDomain && strcmp(lpDomain, "") != 0)
  991. {
  992. CONST TCHAR *szResult = strstr(lpDomain,".ly.com");
  993. if(szResult == NULL)
  994. {
  995. // 传入的域名有误;
  996. return;
  997. }
  998. }
  999. // 2.先遍历原始的共享目录;
  1000. int i , n ;
  1001. TCHAR szShare[MAX_PATH] = {0};
  1002. CNetShareInfo::GetInstance()->GetLoaclShareDirectory(1,szShare);
  1003. // 存放所有存在订单文件夹的共享目录数组;
  1004. CStringArray strArrayOfShareDirectory;
  1005. // 3.如果订单号存在原始共享目录中;
  1006. TCHAR szOrdePath[MAX_PATH] = {0};
  1007. if ( lpDomain == NULL || strcmp(lpDomain,"") == 0)
  1008. {
  1009. // 分店域名为空,则为本店;
  1010. #if defined(VC80) || defined(VC70) || defined(VC60)
  1011. sprintf(szOrdePath,"%s\\%s", szShare, lpOrderNum);
  1012. #else
  1013. _stprintf_s(szOrdePath, MAX_PATH, _T("%s\\%s"), szShare, lpOrderNum);
  1014. #endif
  1015. }
  1016. else
  1017. {// 分店域名不为空;
  1018. if ( strcmp(lpDomain, g_domain) == 0)
  1019. {
  1020. // 本店域名;
  1021. #if defined(VC80) || defined(VC70) || defined(VC60)
  1022. sprintf(szOrdePath,"%s\\%s", szShare, lpOrderNum);
  1023. #else
  1024. _stprintf_s(szOrdePath, MAX_PATH, "%s\\%s", szShare, lpOrderNum);
  1025. #endif
  1026. }
  1027. else
  1028. {
  1029. sprintf(szOrdePath,"%s\\%s\\%s", szShare, lpDomain, lpOrderNum);
  1030. }
  1031. }
  1032. if ( PathFileExists(szOrdePath) )
  1033. {
  1034. strArrayOfShareDirectory.Add(CString(szOrdePath));
  1035. }
  1036. // 4.遍历其他共享目录;
  1037. int nSize = g_aryOfSharePathInfo.GetSize();
  1038. for ( /*int*/ i = 0; i < nSize; i++)
  1039. {
  1040. if ( 1 != atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)))
  1041. continue;
  1042. // 逐一加载其他共享目录;
  1043. sprintf(szShare,"%s",g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  1044. if (lpDomain && strcmp(lpDomain,"") != 0)
  1045. {
  1046. sprintf(szOrdePath,"%s\\%s\\%s",szShare,lpDomain, lpOrderNum);
  1047. }
  1048. else
  1049. {
  1050. sprintf(szOrdePath,"%s\\%s",szShare, lpOrderNum);
  1051. }
  1052. if ( PathFileExists(szOrdePath) )
  1053. {
  1054. strArrayOfShareDirectory.Add(CString(szOrdePath));
  1055. }
  1056. }
  1057. // 若是成长套系,可按一个套系来导出;
  1058. if ( bGrowTh )
  1059. {
  1060. if ( strSelectName == "全部")
  1061. strSelectName.Empty();
  1062. nSize = strArrayOfShareDirectory.GetSize();
  1063. for ( /*int*/ i = 0; i < nSize; i++)
  1064. {
  1065. // 逐一加载其他共享目录;
  1066. sprintf(szOrdePath,"%s\\%s",strArrayOfShareDirectory.ElementAt(i), strSelectName);
  1067. StoreImage(szOrdePath,strArray);
  1068. }
  1069. }
  1070. else // 非成长套系,则按指定的景点名导出指定的相片,而不是全部订单下的相片都导出;
  1071. {
  1072. // 查找原片中已导片的景点目录,注:会否浪费太多性能,最好从数据库里读取?;
  1073. CArray<STImageDirectory*,STImageDirectory*> vtImageDirectory;
  1074. nSize = strArrayOfShareDirectory.GetSize();
  1075. for ( /*int*/ i = 0; i < nSize; i++)
  1076. {
  1077. // 逐一加载其他共享目录;
  1078. sprintf(szOrdePath,"%s",strArrayOfShareDirectory.ElementAt(i));
  1079. // 只需要目录,不需要相片文件名;
  1080. using namespace helper_coffs;
  1081. ffsco o;
  1082. o.dirs(1);
  1083. o.find(LPCSTR(szOrdePath), LPCSTR("*.*"));
  1084. ffsco::typeT cdir;
  1085. ffsco::typeT::iterator it;
  1086. cdir = o.co_dir();
  1087. CString strTemp;
  1088. for ( it = cdir.begin(); it != cdir.end(); it++)
  1089. {
  1090. // strTemp 结果如: "\\it-pc\客户原片(管理软件)$\20150522-001\内景大西街店B棚\";
  1091. strTemp = it->c_str();
  1092. strTemp.TrimRight('\\');
  1093. if ( strTemp.CompareNoCase(szOrdePath) == 0)
  1094. {
  1095. continue;
  1096. }
  1097. // 子文件夹名称,如:"内景大西街店B棚";
  1098. strTemp = strTemp.Mid(strTemp.ReverseFind('\\') + 1);
  1099. // 把"景点名"和"景点名完整路径" 存入数组中;
  1100. BOOL bExists = FALSE;
  1101. for ( /*int*/ n = 0; n < vtImageDirectory.GetSize(); n++)
  1102. {
  1103. STImageDirectory *pImageDirectory = vtImageDirectory.ElementAt(n);
  1104. if ( strTemp == pImageDirectory->strSelName )
  1105. {
  1106. bExists = TRUE;
  1107. strTemp = it->c_str();
  1108. pImageDirectory->strAryImagePath.Add(strTemp);
  1109. break;
  1110. }
  1111. }
  1112. if ( !bExists )
  1113. {
  1114. STImageDirectory *pImageDirectory = new STImageDirectory;
  1115. pImageDirectory->strSelName = strTemp;
  1116. pImageDirectory->strAryImagePath.Add(CString(it->c_str()));
  1117. vtImageDirectory.Add(pImageDirectory);
  1118. }
  1119. }
  1120. }
  1121. // 提供选择景点名;
  1122. SelProvider dlg;
  1123. dlg.m_mode = 1;
  1124. dlg.m_aryImageDirectory = &vtImageDirectory;
  1125. if( dlg.DoModal() != IDOK )
  1126. return;
  1127. if( dlg.m_provider != _T("全部") )
  1128. {
  1129. nSize = vtImageDirectory.GetSize();
  1130. for ( i = 0; i < nSize; i++)
  1131. {
  1132. if ( dlg.m_provider == vtImageDirectory.ElementAt(i)->strSelName )
  1133. {
  1134. int nSum = vtImageDirectory.ElementAt(i)->strAryImagePath.GetSize();
  1135. for ( n = 0; n < nSum; n++)
  1136. {
  1137. // 逐一加载其他共享目录;
  1138. sprintf(szOrdePath,"%s",vtImageDirectory.ElementAt(i)->strAryImagePath.ElementAt(n));
  1139. StoreImage(szOrdePath,strArray);
  1140. }
  1141. break;
  1142. }
  1143. }
  1144. }
  1145. else
  1146. {
  1147. // 加载订单文件夹;
  1148. nSize = strArrayOfShareDirectory.GetSize();
  1149. for ( /*int*/ n = 0; n < nSize; n++)
  1150. {
  1151. // 逐一加载其他共享目录;
  1152. sprintf(szOrdePath,"%s",strArrayOfShareDirectory.ElementAt(n));
  1153. StoreImage(szOrdePath,strArray);
  1154. }
  1155. }
  1156. // 释放内存;
  1157. for ( i = 0; i < vtImageDirectory.GetSize(); i++)
  1158. {
  1159. STImageDirectory *pImageDirectory = vtImageDirectory.ElementAt(i);
  1160. delete pImageDirectory;
  1161. vtImageDirectory.RemoveAt(i);
  1162. }
  1163. }
  1164. }
  1165. /************************************************************************/
  1166. /*
  1167. 函数:StoreImage
  1168. 描述:存储指定目录的相片到CStringArray数组中;
  1169. 参数:
  1170. IN: lpImagePath 遍历的目录;
  1171. OUT: strStoreArray 存储相片的数组;
  1172. 返回:
  1173. 调用约定:LoadAllImageSource主调;
  1174. 注意:
  1175. */
  1176. /************************************************************************/
  1177. void BeautifySkinFrom::StoreImage(IN LPCTSTR lpImagePath, OUT CStringArray &strStoreArray)
  1178. {
  1179. using namespace helper_coffs;
  1180. ffsco o;
  1181. o.dirs(1);
  1182. o.find(LPCSTR(lpImagePath), LPCSTR("*.*"));
  1183. ffsco::typeT cfs;
  1184. ffsco::typeT::iterator it;
  1185. cfs = o.co_file();
  1186. CString strTemp;
  1187. for ( it = cfs.begin(); it != cfs.end(); it++)
  1188. {
  1189. strTemp = it->c_str();
  1190. if ( strTemp.Find('.') == -1)
  1191. continue;
  1192. else
  1193. {
  1194. CString str = strTemp.Mid( strTemp.ReverseFind('\\') + 1 );
  1195. if ( str.Find('.') == -1)
  1196. continue;
  1197. }
  1198. if ( strTemp.GetAt( strTemp.ReverseFind('\\') + 1 ) == 's' )continue;
  1199. if ( strTemp.GetAt( strTemp.ReverseFind('\\') + 1 ) == 'm' )continue;
  1200. #if 0
  1201. strTemp.MakeLower();
  1202. if ( strTemp.Find(".jpg") == -1 && strTemp.Find(".jpeg") == -1)
  1203. continue;
  1204. #else
  1205. // 只要是图片格式的,都保留下来;
  1206. CONST CString strImgExt = _T("*.jpg|*.jpeg|*.cr2|*.nef|*.png|*.bmp|*.raw");
  1207. CString strImg = strTemp.Mid(strTemp.ReverseFind(_T('.')));
  1208. strImg.MakeLower();
  1209. if ( strImgExt.Find(strImg) == -1)
  1210. continue;
  1211. #endif
  1212. BOOL bExist = FALSE;
  1213. for (int i = 0; i < strStoreArray.GetSize(); i++)
  1214. {
  1215. if (strStoreArray.ElementAt(i).CompareNoCase(strTemp) == 0)
  1216. {
  1217. bExist = TRUE;
  1218. break;
  1219. }
  1220. }
  1221. if( !bExist && strcmp(strTemp,lpImagePath) != 0 )
  1222. strStoreArray.Add(strTemp);
  1223. }
  1224. }
  1225. #endif