BeautifySkinFrom2.cpp 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585
  1. // BeautifySkinFrom2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "BeautifySkinFrom2.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "ImportPhoto.h"
  10. #include "ShowPic.h"
  11. #include "SelectPhotoDlg.h"
  12. #include "./helper/ffsco.h"
  13. #include "ShowCut.h"
  14. #include "CompressOption.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. IMPLEMENT_DYNCREATE(BeautifySkinFrom2, MyFormView)
  21. BeautifySkinFrom2::BeautifySkinFrom2(): MyFormView(BeautifySkinFrom2::IDD)
  22. {
  23. m_filter = _T("");
  24. m_nAdd = 0;
  25. if (g_bAllBranch)
  26. {
  27. m_nAdd = 1;
  28. }
  29. }
  30. BeautifySkinFrom2::~BeautifySkinFrom2()
  31. {
  32. }
  33. void BeautifySkinFrom2::DoDataExchange(CDataExchange* pDX)
  34. {
  35. MyFormView::DoDataExchange(pDX);
  36. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  37. DDX_Control(pDX, IDC_LIST2, m_FurtherList);
  38. DDX_Control(pDX, IDC_STATIC1, m_static1);
  39. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  40. }
  41. BEGIN_MESSAGE_MAP(BeautifySkinFrom2, 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_BUTimportphoto, OnBUTimportphoto)
  47. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  48. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  49. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  50. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  51. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  52. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  53. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  54. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  55. END_MESSAGE_MAP()
  56. #ifdef _DEBUG
  57. void BeautifySkinFrom2::AssertValid() const
  58. {
  59. MyFormView::AssertValid();
  60. }
  61. void BeautifySkinFrom2::Dump(CDumpContext& dc) const
  62. {
  63. MyFormView::Dump(dc);
  64. }
  65. #endif
  66. void BeautifySkinFrom2::OnInitialUpdate()
  67. {
  68. MyFormView::OnInitialUpdate();
  69. CMyMdi Mdi;
  70. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  71. CRect rc2;
  72. GetWindowRect(rc2);
  73. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  74. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  75. int idarray[] = { IDC_BUTprint3, IDC_BUTexportphoto, IDC_BUTimportphoto, IDC_BUTshowphoto, IDC_BUTexportphoto2, IDC_BUTclose };
  76. int idcount = 6;
  77. int btnwid;
  78. CRect prerc;
  79. for (int a = idcount - 2; a >= 0; a--)
  80. {
  81. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  82. ScreenToClient(prerc);
  83. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  84. ScreenToClient(rc2);
  85. btnwid = rc2.Width();
  86. rc2.right = prerc.left;
  87. rc2.left = rc2.right - btnwid;
  88. GetDlgItem(idarray[a])->MoveWindow(rc2);
  89. }
  90. m_static1.SetFont(&g_titlefont);
  91. if (g_bAllBranch == 0)
  92. {
  93. #ifdef CHILD_VERSION
  94. m_FurtherList.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
  95. #else
  96. m_FurtherList.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  97. #endif
  98. m_FurtherList.LoadColumnInfo(122);
  99. }
  100. else
  101. {
  102. #ifdef CHILD_VERSION
  103. m_FurtherList.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
  104. #else
  105. m_FurtherList.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  106. #endif
  107. m_FurtherList.LoadColumnInfo(198);
  108. GetDlgItem(IDC_BUTprint3)->ShowWindow(1);
  109. }
  110. GetData();
  111. m_combo1.AddString(g_user.name);
  112. m_combo1.GetWindowRect(rc2);
  113. ScreenToClient(rc2);
  114. rc2.bottom += 200;
  115. m_combo1.MoveWindow(rc2);
  116. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  117. SetComboHei(&m_combo1, rc2.Height());
  118. GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(10));
  119. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(11));
  120. }
  121. void BeautifySkinFrom2::FillGrid(BOOL bStatus)
  122. {
  123. if (g_bSearchFilter)
  124. {
  125. m_FurtherList.DeleteAllItems2();
  126. int ii = 0;
  127. m_FurtherList.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  128. int count = 0;
  129. {
  130. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  131. {
  132. // 条件查询==精修日期
  133. if (g_filterdate1 != "")
  134. {
  135. if (m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd) > g_filterdate2)
  136. continue;
  137. }
  138. if (g_waiter1 != "")
  139. {
  140. // 条件查询==精修人;
  141. if (m_List1array.ElementAt(ii).ElementAt(11 + m_nAdd) != g_waiter1)
  142. continue;
  143. }
  144. if (g_bAllBranch && g_filterbranch != "")
  145. {
  146. if (m_List1array.ElementAt(ii).ElementAt(0) != g_filterbranch)
  147. continue;
  148. }
  149. if (1)
  150. {
  151. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  152. }
  153. }
  154. }
  155. m_FurtherList.m_arLabels.SetSize(count, 1);
  156. ii = count;
  157. m_FurtherList.m_LabelCount = ii;
  158. m_FurtherList.SetItemCountEx(ii);
  159. CString str;
  160. str.Format("单数:%d", ii);
  161. SetDlgItemText(IDC_STATIC2, str);
  162. }
  163. else
  164. {
  165. m_FurtherList.DeleteAllItems2();
  166. int ii = 0;
  167. m_FurtherList.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  168. int count = 0;
  169. if (m_filter.IsEmpty())
  170. {
  171. if (bStatus)
  172. {
  173. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  174. {
  175. // 条件查询==选片状态&&精修状态;
  176. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" && m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK")
  177. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  178. }
  179. }
  180. else
  181. {
  182. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  183. {
  184. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  185. }
  186. }
  187. }
  188. else
  189. {
  190. if (bStatus)
  191. {
  192. int type = GetType(m_filter);
  193. if (type == 1)//电话
  194. {
  195. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  196. {
  197. // 查询条件==选片状态&&精修状态&&(手机1||手机2)
  198. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
  199. m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
  200. (m_List1array.ElementAt(ii).ElementAt(15 + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(16 + m_nAdd).Find(m_filter) != -1))
  201. {
  202. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  203. }
  204. }
  205. }
  206. else if (type == 2)//拼音
  207. {
  208. m_filter.MakeUpper();
  209. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  210. {
  211. // 查询条件==选片状态&&精修状态&&(拼音1||拼音2)
  212. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
  213. m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
  214. (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 ||m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).Find(m_filter) != -1))
  215. {
  216. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  217. }
  218. }
  219. }
  220. else
  221. {
  222. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  223. {
  224. // 查询条件==选片状态&&精修状态&&(……)
  225. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
  226. m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
  227. (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  228. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  229. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  230. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  231. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || \
  232. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || \
  233. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || \
  234. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || \
  235. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  236. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
  237. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
  238. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1))
  239. {
  240. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  241. }
  242. }
  243. }
  244. }
  245. else
  246. {
  247. int type = GetType(m_filter);
  248. if (type == 1)//电话
  249. {
  250. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  251. {
  252. // 查询条件==手机1||手机2
  253. if (m_List1array.ElementAt(ii).ElementAt(15 + m_nAdd).Find(m_filter) != -1 ||
  254. m_List1array.ElementAt(ii).ElementAt(16 + m_nAdd).Find(m_filter) != -1)
  255. {
  256. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  257. }
  258. }
  259. }
  260. else if (type == 2)//拼音
  261. {
  262. m_filter.MakeUpper();
  263. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  264. {
  265. // 查询条件==拼音1||拼音2
  266. if (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 ||
  267. m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).Find(m_filter) != -1)
  268. {
  269. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  270. }
  271. }
  272. }
  273. else
  274. {
  275. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  276. {
  277. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  278. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  279. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  280. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  281. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || \
  282. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || \
  283. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || \
  284. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || \
  285. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  286. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
  287. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
  288. m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1)
  289. {
  290. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  291. }
  292. }
  293. }
  294. }
  295. }
  296. m_FurtherList.m_arLabels.SetSize(count, 1);
  297. ii = count;
  298. m_FurtherList.m_LabelCount = ii;
  299. m_FurtherList.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_FurtherList.GetItemCount(); i++)
  307. {
  308. if (g_id == m_FurtherList.GetItemText(i, 0 + m_nAdd))
  309. {
  310. m_FurtherList.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  311. m_FurtherList.EnsureVisible(i, FALSE);
  312. break;
  313. }
  314. }
  315. }
  316. }
  317. void BeautifySkinFrom2::OnBUTclose()
  318. {
  319. GetParent()->SendMessage(WM_CLOSE);
  320. }
  321. void BeautifySkinFrom2::OnSelchangeCombo1()
  322. {
  323. SetTimer(1, 100, NULL);
  324. }
  325. void BeautifySkinFrom2::OnTimer(UINT nIDEvent)
  326. {
  327. KillTimer(nIDEvent);
  328. OnButton1();
  329. }
  330. BOOL BeautifySkinFrom2::PreTranslateMessage(MSG* pMsg)
  331. {
  332. try
  333. {
  334. if (pMsg->message == WM_KEYDOWN)
  335. {
  336. switch (pMsg->wParam)
  337. {
  338. case VK_RETURN:
  339. OnButton1();
  340. return 1;
  341. case 0x43: // copy
  342. if ((GetKeyState(VK_CONTROL) & 0x80))
  343. {
  344. GetFocus()->SendMessage(WM_COPY);
  345. return TRUE;
  346. }
  347. break;
  348. case 0x56: //Ctrl + V:
  349. if ((GetKeyState(VK_CONTROL) & 0x80))
  350. {
  351. GetFocus()->SendMessage(WM_PASTE);
  352. return TRUE;
  353. }
  354. break;
  355. case 0x58: // cut
  356. if ((GetKeyState(VK_CONTROL) & 0x80))
  357. {
  358. GetFocus()->SendMessage(WM_CUT);
  359. return TRUE;
  360. }
  361. break;
  362. case 0x5A: //undo
  363. case 0x59: //redo
  364. if ((GetKeyState(VK_CONTROL) & 0x80))
  365. {
  366. GetFocus()->SendMessage(WM_UNDO);
  367. return TRUE;
  368. }
  369. break;
  370. }
  371. }
  372. return MyFormView::PreTranslateMessage(pMsg);
  373. }
  374. catch (...)
  375. {
  376. }
  377. }
  378. void BeautifySkinFrom2::OnBUTimportphoto() // 导入精修片 按钮;
  379. {
  380. POSITION pos;
  381. pos = m_FurtherList.GetFirstSelectedItemPosition();
  382. if (pos == NULL)
  383. {
  384. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  385. return;
  386. }
  387. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  388. CString branch;
  389. CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  390. if (g_bAllBranch)
  391. branch = m_FurtherList.GetItemText(iItem, 0);
  392. CString oldstatus = m_FurtherList.GetItemText(iItem, 6 + m_nAdd);
  393. CString time9 = m_FurtherList.GetItemText(iItem, 7 + m_nAdd);
  394. CString name = m_FurtherList.GetItemText(iItem, 1 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  395. name.TrimLeft(",");
  396. name.TrimRight(",");
  397. name = "客人:" + name;
  398. CString phone = m_FurtherList.GetItemText(iItem, 15 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 16 + m_nAdd);
  399. phone.TrimLeft(",");
  400. phone.TrimRight(",");
  401. phone = "电话:" + phone;
  402. #ifdef ENTERPRISE_VERSION
  403. if (::CheckFolderFileExist(g_path4) == 0)
  404. ::CreateDirectory(g_path4, NULL);
  405. #endif
  406. if (!::CheckFolderFileExist(g_path4))
  407. {
  408. AfxMessageBox("精修片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  409. return;
  410. }
  411. CString savepath;
  412. if (g_bAllBranch)
  413. {
  414. CString branchpath = GetBranchPhotoPath(branch);
  415. savepath = g_path4 + branchpath + "\\";
  416. if (::CheckFolderFileExist(savepath) == 0)
  417. ::CreateDirectory(savepath, NULL);
  418. }
  419. else
  420. savepath = g_path4 + "\\";
  421. savepath += id + "\\";
  422. if (::CheckFolderFileExist(savepath) == 0)
  423. ::CreateDirectory(savepath, NULL);
  424. /* IsGrowthTx growthtxdlg;
  425. growthtxdlg.m_id=id;
  426. growthtxdlg.DoModal ();
  427. if(growthtxdlg.m_bReturnOK==0)
  428. return;
  429. if(growthtxdlg.m_bGrowthTx && growthtxdlg.m_seltxname.IsEmpty ())
  430. return;
  431. if(!growthtxdlg.m_seltxname.IsEmpty ())
  432. {
  433. savepath+=growthtxdlg.m_seltxname+"\\";
  434. if(::CheckFolderFileExist (savepath)==0)
  435. ::CreateDirectory (savepath, NULL);
  436. }*/
  437. CString srcdir; CString str;
  438. GetSavePath(srcdir);
  439. if (srcdir.IsEmpty())
  440. {
  441. CString status6;
  442. if (AfxMessageBox("客照是否全部精修完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  443. status6 = "OK";
  444. else
  445. status6 = "修片中";
  446. CString sql;
  447. if (time9.IsEmpty())
  448. sql = "update dindan set status6='" + status6 + "',time9='" + g_date + "' where id='" + id + "'";
  449. else
  450. sql = "update dindan set status6='" + status6 + "' where id='" + id + "'";
  451. g_sendhead.bsql = 1;
  452. if (g_bAllBranch)
  453. {
  454. g_branchip = GetIP(branch);
  455. g_pMainWnd->OnDisconnect();
  456. g_branchname = branch;
  457. g_bBranchModify = 1;
  458. g_pMainWnd->ProcessChatMessageRequest2(sql);
  459. g_pMainWnd->OnDisconnect();
  460. g_bBranchModify = 0;
  461. g_branchip = g_branchname = "";
  462. }
  463. else
  464. g_pMainWnd->ProcessChatMessageRequest2(sql);
  465. if (g_bSendOK == 0)return;
  466. if (g_bAllBranch == 0)
  467. {
  468. GetData();
  469. }
  470. else
  471. {
  472. for (int i = 0; i < m_List1array.GetSize(); i++)
  473. {
  474. if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
  475. {
  476. m_List1array.ElementAt(i).SetAt(6 + m_nAdd, status6);
  477. if (time9.IsEmpty())
  478. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
  479. FillGrid();
  480. break;
  481. }
  482. }
  483. }
  484. return;
  485. }
  486. if (srcdir.GetLength() < 4)
  487. {
  488. AfxMessageBox("请选择正确的您文件所在的目录!", MB_ICONSTOP);
  489. return;
  490. }
  491. if (oldstatus != "未修")
  492. {
  493. str.Format("%s\r\n%s\r\n此单已导入过修片,确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone);
  494. if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)
  495. return;
  496. }
  497. else
  498. {
  499. str.Format("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone);
  500. if (AfxMessageBox(str, MB_YESNO | MB_ICONINFORMATION) != IDYES)
  501. return;
  502. }
  503. CStringArray array;
  504. CStringArray desarray;
  505. CStringArray dirarray;
  506. if (1)
  507. {
  508. // 1.获取源目录下的所有文件,包含子目录;
  509. using namespace helper_coffs;
  510. ffsco o;
  511. o.dirs(1);
  512. o.find(LPCSTR(srcdir), LPCSTR("*.*"));
  513. ffsco::typeT coo;
  514. ffsco::typeT::iterator it;
  515. coo = o.co_dir();
  516. for (it = coo.begin(); coo.end() != it; it++)
  517. {
  518. str = (*it).c_str();
  519. if (FindArray(&dirarray, str) == -1)
  520. {
  521. dirarray.Add(str);
  522. if (str != dirarray.ElementAt(0))
  523. {
  524. str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
  525. if (::CheckFolderFileExist(str) == 0)
  526. ::CreateDirectory(str, NULL);
  527. }
  528. }
  529. }
  530. }
  531. if (1)
  532. {
  533. // 2.从每个子目录下查找所有的相片;
  534. for (int i = 0; i < dirarray.GetSize(); i++)
  535. {
  536. using namespace helper_coffs;
  537. ffsco o;
  538. o.dirs(0);
  539. o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
  540. ffsco::typeT coo;
  541. ffsco::typeT::iterator it;
  542. coo = o.co_file();
  543. for (it = coo.begin();coo.end() != it;it++)
  544. {
  545. str = (*it).c_str();
  546. array.Add(str);
  547. desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
  548. }
  549. }
  550. }
  551. if (array.GetSize() == 0)return;
  552. ImportPhoto dlg;
  553. dlg.m_branch = branch;
  554. dlg.m_nphototype = 2;
  555. dlg.m_bOverWrite = 1;
  556. dlg.m_pArray = &array;
  557. dlg.m_pDesArray = &desarray;
  558. dlg.m_savepath = savepath;
  559. #ifdef ENTERPRISE_VERSION
  560. // if(!g_branchname.IsEmpty ())
  561. {
  562. dlg.m_bSaveUploadTask = g_bSaveUploadTask3;
  563. dlg.m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(80);
  564. dlg.m_uploadtaskarray.Add(id + ";" + name);
  565. dlg.m_uploadtaskarray.Add("");
  566. dlg.m_uploadtaskarray.Add("");
  567. dlg.m_uploadtaskarray.Add("");
  568. dlg.m_uploadtaskarray.Add("");
  569. dlg.m_uploadtaskarray.Add("");
  570. dlg.m_uploadtaskarray.Add("");
  571. dlg.m_uploadtaskarray.Add("");
  572. dlg.m_uploadtaskarray.Add("");
  573. dlg.m_uploadtaskarray.Add("");
  574. }
  575. #endif
  576. dlg.DoModal();
  577. CString status6;
  578. if (AfxMessageBox("客照是否全部精修完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  579. status6 = "OK";
  580. else
  581. status6 = "修片中";
  582. CString sql;
  583. if (time9.IsEmpty())
  584. sql = "update dindan set status6='" + status6 + "',waiter7='" + g_user.name + "',time9='" + g_date + "' where id='" + id + "'";
  585. else
  586. sql = "update dindan set status6='" + status6 + "',waiter7='" + g_user.name + "' where id='" + id + "'";
  587. g_sendhead.bsql = 1;
  588. if (g_bAllBranch)
  589. {
  590. g_branchip = GetIP(branch);
  591. g_pMainWnd->OnDisconnect();
  592. g_branchname = branch;
  593. g_bBranchModify = 1;
  594. g_pMainWnd->ProcessChatMessageRequest2(sql);
  595. g_pMainWnd->OnDisconnect();
  596. g_bBranchModify = 0;
  597. g_branchip = g_branchname = "";
  598. }
  599. else
  600. g_pMainWnd->ProcessChatMessageRequest2(sql);
  601. if (g_bSendOK == 0)return;
  602. savepath += "ok";
  603. ::DeleteFile(savepath); // 删除ok文件;
  604. AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
  605. if (g_bAllBranch == 0)
  606. {
  607. GetData();
  608. }
  609. else
  610. {
  611. for (int i = 0; i < m_List1array.GetSize(); i++)
  612. {
  613. if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
  614. {
  615. m_List1array.ElementAt(i).SetAt(6 + m_nAdd, status6);
  616. if (time9.IsEmpty())
  617. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
  618. m_List1array.ElementAt(i).SetAt(11 + m_nAdd, g_user.name);
  619. FillGrid();
  620. break;
  621. }
  622. }
  623. }
  624. }
  625. void BeautifySkinFrom2::OnBUTshowphoto()
  626. {
  627. POSITION pos;
  628. pos = m_FurtherList.GetFirstSelectedItemPosition();
  629. if (pos == NULL)
  630. {
  631. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  632. return;
  633. }
  634. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  635. CString branch;
  636. CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  637. if (g_bAllBranch)
  638. branch = m_FurtherList.GetItemText(iItem, 0);
  639. CString name = m_FurtherList.GetItemText(iItem, 1 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  640. name.TrimLeft(",");
  641. name.TrimRight(",");
  642. name = "客人:" + name;
  643. ShowPic dlg;
  644. dlg.m_id = id;
  645. dlg.m_name = name;
  646. dlg.m_mode = 3;
  647. if (g_bAllBranch)
  648. {
  649. dlg.m_branch = branch;
  650. CString branchpath = GetBranchPhotoPath(branch);
  651. dlg.m_path = g_path4 + branchpath + "\\";
  652. }
  653. else
  654. dlg.m_path = g_path4 + "\\";
  655. dlg.m_path += id;
  656. dlg.m_path += "\\";
  657. dlg.DoModal();
  658. }
  659. //-----------------------------------------------------------------
  660. // remark by Jeff 2014-12-12
  661. // 函数:GetNo
  662. // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
  663. // 参数:
  664. // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
  665. // array:空的数组,用来存放解析后的相片名;
  666. // 返回:
  667. // 注意:更换分隔符造成的问题,在该函数已解决;
  668. //-----------------------------------------------------------------
  669. void BeautifySkinFrom2::GetNo(CString str, CStringArray &array)
  670. {
  671. if (!str.IsEmpty())
  672. {
  673. int pos = str.Find(",");
  674. while (pos != -1)
  675. {
  676. if (FindArray(&array, str.Left(pos)) == -1)
  677. array.Add(str.Left(pos));
  678. str = str.Right(str.GetLength() - pos - 1);
  679. pos = str.Find(",");
  680. }
  681. if (FindArray(&array, str) == -1)
  682. array.Add(str);
  683. }
  684. }
  685. //-----------------------------------------------------------------
  686. // remark by Jeff 2014-12-12
  687. // 函数:GetSelName
  688. // 描述:
  689. // 参数:
  690. // name:由GetNo解析出来后的单个相片名,如:"001"
  691. // spnamearray:订单下的商品数组,case 50所得;
  692. // 返回:
  693. // 注意:更换分隔符造成的问题,在该函数已解决;
  694. //-----------------------------------------------------------------
  695. CString BeautifySkinFrom2::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  696. {
  697. CString ret;
  698. name = "," + name + ",";
  699. CString str;
  700. for (int i = 0; i < spnamearray.GetSize(); i++)
  701. {
  702. str = "," + spnamearray.ElementAt(i).ElementAt(6) + ",";
  703. if (str.Find(name) != -1)
  704. {
  705. ret += spnamearray.ElementAt(i).ElementAt(5);
  706. ret += ";";
  707. }
  708. }
  709. ret.TrimRight(";");
  710. ret.Replace("*", "x");
  711. return ret;
  712. }
  713. CString GetPathFromNo2(CString dir, CString no)
  714. {
  715. CString sRet;
  716. dir.TrimRight('\\');
  717. dir += "\\";
  718. CStringArray dirarray;
  719. CString temp;
  720. using namespace helper_coffs;
  721. ffsco o;
  722. o.dirs(1);
  723. o.find(LPCSTR(dir), LPCSTR("*.*"));
  724. ffsco::typeT coo;
  725. ffsco::typeT::iterator it;
  726. coo = o.co_dir();
  727. for (it = coo.begin();coo.end() != it;it++)
  728. {
  729. temp = (*it).c_str();
  730. if (::FindArray(&dirarray, temp) == -1 && temp != dir)
  731. {
  732. dirarray.Add(temp);
  733. }
  734. }
  735. for (int i = 0; i < dirarray.GetSize(); i++)
  736. {
  737. temp = dirarray.ElementAt(i);
  738. sRet.Format("%s%s.jpg", temp, no);
  739. if (::PathFileExists(sRet))return sRet;
  740. sRet.Replace(".jpg", ".raw");
  741. if (::PathFileExists(sRet))return sRet;
  742. sRet.Replace(".raw", ".nef");
  743. if (::PathFileExists(sRet))return sRet;
  744. sRet.Replace(".nef", ".cr2");
  745. if (::PathFileExists(sRet))return sRet;
  746. sRet.Replace(".cr2", ".jpg");
  747. if (::PathFileExists(sRet))return sRet;
  748. }
  749. return dir + no + ".jpg";
  750. }
  751. CString GetPathFromNo3(CString dir, CString no)
  752. {
  753. CString sRet;
  754. dir.TrimRight('\\');
  755. dir += "\\";
  756. CStringArray dirarray;
  757. CString temp;
  758. using namespace helper_coffs;
  759. ffsco o;
  760. o.dirs(1);
  761. o.find(LPCSTR(dir), LPCSTR("*.*"));
  762. ffsco::typeT coo;
  763. ffsco::typeT::iterator it;
  764. coo = o.co_dir();
  765. for (it = coo.begin();coo.end() != it;it++)
  766. {
  767. temp = (*it).c_str();
  768. if (::FindArray(&dirarray, temp) == -1 && temp != dir)
  769. {
  770. dirarray.Add(temp);
  771. }
  772. }
  773. for (int i = 0; i < dirarray.GetSize(); i++)
  774. {
  775. temp = dirarray.ElementAt(i);
  776. sRet.Format("%s%s.jpg", temp, no);
  777. if (::PathFileExists(sRet))return sRet;
  778. }
  779. return dir + no + ".jpg";
  780. }
  781. // 导出裁剪后的效果图;
  782. void BeautifySkinFrom2::OnBUTexportphoto() // 导出选好的片 按钮;
  783. {
  784. // 1.判断权限;
  785. if (IsHasRights2new(10) == 0)return;
  786. // 2.获取选中列的信息,如订单号;
  787. UpdateData();
  788. POSITION pos;
  789. pos = m_FurtherList.GetFirstSelectedItemPosition();
  790. if (pos == NULL)
  791. {
  792. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  793. return;
  794. }
  795. // 2.1.获取订单的选片状态;
  796. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  797. CString status2 = m_FurtherList.GetItemText(iItem, 4 + m_nAdd);
  798. if (status2 != "OK")
  799. {
  800. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  801. return;
  802. }
  803. // 2.2.获取订单号;
  804. BOOL bOfmat = 0;
  805. CString strOrderNumber = m_FurtherList.GetItemText(iItem, 0 + m_nAdd); // 订单号;
  806. CString branch;
  807. if (g_bAllBranch)
  808. branch = m_FurtherList.GetItemText(iItem, 0);
  809. CString name1 = m_FurtherList.GetItemText(iItem, 1 + m_nAdd);
  810. CString name2 = m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  811. // 3.1.选片成长套系对话框;
  812. IsGrowthTx growthtxdlg;
  813. growthtxdlg.m_mode = 1;
  814. growthtxdlg.m_strOrderNumber = strOrderNumber;
  815. growthtxdlg.DoModal(); // 非成长套系的,直接退出;
  816. BOOL m_bGrowthTX = growthtxdlg.m_bGrowthTx;
  817. CString m_seltxname = growthtxdlg.m_seltxname;
  818. #ifdef CHILD_VERSION
  819. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底'";
  820. if (m_seltxname != "" && m_seltxname != "全部")
  821. {
  822. filter = "id='" + strOrderNumber + "' and growthtxname='" + m_seltxname + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底'";
  823. }
  824. #else
  825. CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"' and kind<>'2' and name<>'入册' and name<>'入底'";
  826. #endif
  827. g_sendhead.bsql = 0;
  828. g_sendhead.code[0] = 50; // dindansp
  829. g_sendhead.code[1] = 11; // dindan
  830. g_sendhead.code[2] = 56; // dindansp
  831. g_sendhead.tabcount = 3;
  832. if (g_bAllBranch)
  833. {
  834. g_branchip = GetIP(branch);
  835. g_pMainWnd->OnDisconnect();
  836. g_branchname = branch;
  837. g_bBranchModify = 1;
  838. g_pMainWnd->ProcessChatMessageRequest2(filter);
  839. g_pMainWnd->OnDisconnect();
  840. g_bBranchModify = 0;
  841. g_branchip = g_branchname = "";
  842. }
  843. else
  844. g_pMainWnd->ProcessChatMessageRequest2(filter);
  845. if (g_bSendOK == 0)return;
  846. CArray<CStringArray, CStringArray>sparray;
  847. CArray<CStringArray, CStringArray>sparray2;
  848. DataToArray(&sparray, &g_List1array, &sparray2);
  849. CString strSrcDiretory; // 相片源目录;
  850. if (g_bAllBranch)
  851. {
  852. CString branchpath = GetBranchPhotoPath(branch);
  853. strSrcDiretory = g_path2 + branchpath + "\\";
  854. }
  855. else
  856. strSrcDiretory = g_path2 + "\\";
  857. // 4.照片类型选择对话框;(客户原片、初修片)
  858. SelectPhotoDlg selectdlg;
  859. selectdlg.DoModal();
  860. strSrcDiretory += strOrderNumber;
  861. strSrcDiretory += "\\";
  862. if (m_seltxname != "" && m_seltxname != "全部")
  863. {
  864. strSrcDiretory += m_seltxname;
  865. strSrcDiretory += "\\";
  866. }
  867. ////////////////////////////////////////
  868. CString str, spname;
  869. CStringArray noarray;
  870. CStringArray spnamearray;
  871. for (int i = 0; i < sparray.GetSize(); i++)
  872. {
  873. str = sparray.ElementAt(i).ElementAt(6); // 选好的片的相片名串;
  874. spname = sparray.ElementAt(i).ElementAt(5); // 选好的片对应的商品名;
  875. GetNo(str, noarray);
  876. }
  877. if (noarray.GetSize() == 0)
  878. {
  879. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  880. return;
  881. }
  882. spnamearray.SetSize(noarray.GetSize());
  883. for (i = 0; i < noarray.GetSize(); i++)
  884. {
  885. str = noarray.ElementAt(i);
  886. spnamearray.SetAt(i, GetSelName(str, sparray));//+"-"+str );
  887. }
  888. CString strSaveDiretory; // 导出选好片的目录;
  889. GetSavePath(strSaveDiretory);
  890. if (strSaveDiretory.IsEmpty())return;
  891. strSaveDiretory.TrimRight('\\');
  892. strSaveDiretory += "\\";
  893. strSaveDiretory += strOrderNumber;
  894. strSaveDiretory += g_branchname;
  895. if (g_bAllBranch)
  896. {
  897. if (GetBranchPhotoPath(branch) != "")
  898. strSaveDiretory += branch;
  899. }
  900. strSaveDiretory += name1;
  901. strSaveDiretory += name2;
  902. strSaveDiretory += "选片";
  903. strSaveDiretory += "\\";
  904. CStringArray array;
  905. CStringArray spnamearray2;
  906. CString src, des;
  907. if (selectdlg.m_mode == 0)
  908. {
  909. for (i = 0; i < noarray.GetSize(); i++)
  910. {
  911. if ((m_seltxname != "" && m_seltxname != "全部") || m_bGrowthTX == 0)
  912. src.Format("%s%s.jpg", strSrcDiretory, noarray.ElementAt(i));
  913. else
  914. src = GetPathFromNo3(strSrcDiretory, noarray.ElementAt(i));
  915. if (PathFileExists(src))
  916. {
  917. array.Add(src);
  918. if (1)//selectdlg.m_check1)
  919. spnamearray2.Add(spnamearray.ElementAt(i));
  920. else
  921. spnamearray2.Add(noarray.ElementAt(i));
  922. }
  923. else
  924. AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  925. }
  926. }
  927. if (array.GetSize() == 0)
  928. {
  929. if (selectdlg.m_mode == 0)
  930. AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
  931. if (g_bAllBranch)
  932. {
  933. CString branchpath = GetBranchPhotoPath(branch);
  934. strSrcDiretory = g_path1 + branchpath + "\\";
  935. }
  936. else
  937. strSrcDiretory = g_path1 + "\\";
  938. strSrcDiretory += strOrderNumber;
  939. strSrcDiretory += "\\";
  940. strSaveDiretory.Delete(strSaveDiretory.GetLength() - 1, 1);
  941. strSaveDiretory += "(未修)\\";
  942. bOfmat = 1;
  943. for (i = 0; i < noarray.GetSize(); i++)
  944. {
  945. // src.Format ("%s%s.jpg", strSrcDiretory, noarray.ElementAt (i));
  946. src = GetPathFromNo2(strSrcDiretory, noarray.ElementAt(i));
  947. if (PathFileExists(src))
  948. {
  949. array.Add(src);
  950. if (1)//selectdlg.m_check1)
  951. spnamearray2.Add(spnamearray.ElementAt(i));
  952. else
  953. spnamearray2.Add(noarray.ElementAt(i));
  954. }
  955. else
  956. AfxMessageBox("未找到原片文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  957. }
  958. }
  959. if (array.GetSize() == 0)
  960. {
  961. AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
  962. return;
  963. }
  964. ::CreateDirectory(strSaveDiretory, NULL);
  965. // 3.导出相片处理对象;
  966. ImportPhoto dlg;
  967. dlg.m_name = name1 + name2;
  968. dlg.m_bAddname = selectdlg.m_check1;
  969. dlg.m_bOfmat = bOfmat;
  970. dlg.m_mode = 1;
  971. dlg.m_bOrigin = 1;
  972. dlg.m_pArray = &array;
  973. dlg.m_pArray2 = &spnamearray2;
  974. dlg.m_savepath = strSaveDiretory;
  975. dlg.DoModal();
  976. //////////////
  977. if (g_List1array.GetSize())
  978. {
  979. CStdioFile fp;
  980. fp.Open(strSaveDiretory + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
  981. fp.WriteString("选片要求:\n");
  982. fp.WriteString(g_List1array.ElementAt(0).ElementAt(39) + " " + g_List1array.ElementAt(0).ElementAt(75));
  983. fp.WriteString("\n");
  984. fp.WriteString("\n");
  985. fp.WriteString("订单要求:\n");
  986. fp.WriteString(g_List1array.ElementAt(0).ElementAt(38));
  987. fp.WriteString("\n");
  988. fp.WriteString("\n");
  989. fp.WriteString("客人产品:\n");
  990. CString str;
  991. str = "产品名称";
  992. FillLength(str, 30);
  993. str += "数量";
  994. FillLength(str, 40);
  995. #ifdef LKAY_VERSION
  996. str += "P数";
  997. FillLength(str, 50);
  998. str += "加急";
  999. FillLength(str, 60);
  1000. str += "取件日期";
  1001. FillLength(str, 70);
  1002. #else
  1003. str += "加急";
  1004. FillLength(str, 50);
  1005. str += "取件日期";
  1006. FillLength(str, 60);
  1007. #endif
  1008. fp.WriteString(str);
  1009. fp.WriteString("\n");
  1010. for (int i = 0; i < sparray2.GetSize(); i++)
  1011. {
  1012. str.Empty();
  1013. str = sparray2.ElementAt(i).ElementAt(0);
  1014. FillLength(str, 30);
  1015. str += sparray2.ElementAt(i).ElementAt(1);
  1016. FillLength(str, 40);
  1017. #ifdef LKAY_VERSION
  1018. str += sparray2.ElementAt(i).ElementAt(29);//p数
  1019. FillLength(str, 50);
  1020. str += sparray2.ElementAt(i).ElementAt(18);
  1021. FillLength(str, 60);
  1022. str += sparray2.ElementAt(i).ElementAt(19);
  1023. FillLength(str, 70);
  1024. #else
  1025. str += sparray2.ElementAt(i).ElementAt(18);
  1026. FillLength(str, 50);
  1027. str += sparray2.ElementAt(i).ElementAt(19);
  1028. FillLength(str, 60);
  1029. #endif
  1030. fp.WriteString(str);
  1031. fp.WriteString("\n");
  1032. }
  1033. fp.Close();
  1034. }
  1035. //////////////
  1036. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1037. #if JEFF_TEST_ON // 导出裁剪效果图;
  1038. //strSrcDiretory; // 源相片目录;
  1039. //strSaveDiretory;// 导出选好片的目录;
  1040. if (FALSE == g_List1array.ElementAt(0).ElementAt(60).IsEmpty())
  1041. ExportCutImageToFile(g_List1array.ElementAt(0).ElementAt(60), strSrcDiretory, strSaveDiretory+_T("裁剪效果\\"));
  1042. #else
  1043. {
  1044. ShowCut dlg;
  1045. dlg.m_branch = branch;
  1046. dlg.m_mode = 1;
  1047. dlg.m_id = strOrderNumber;
  1048. dlg.DoModal();
  1049. }
  1050. #endif
  1051. // CString str;
  1052. str = " 导出选片 ";
  1053. str += "客人:";
  1054. str += name1 + name2 + strOrderNumber;
  1055. WriteLog(str);
  1056. }
  1057. void BeautifySkinFrom2::OnBUTexportphoto2() // 导出精修的片 按钮;
  1058. {
  1059. if (IsHasRights2new(11) == 0)return;
  1060. POSITION pos;
  1061. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1062. if (pos == NULL)
  1063. {
  1064. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  1065. return;
  1066. }
  1067. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1068. CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  1069. CString branch;
  1070. if (g_bAllBranch)
  1071. branch = m_FurtherList.GetItemText(iItem, 0);
  1072. CString path;
  1073. if (g_bAllBranch)
  1074. {
  1075. CString branchpath = GetBranchPhotoPath(branch);
  1076. path = g_path4 + branchpath + "\\";
  1077. }
  1078. else
  1079. path = g_path4 + "\\";
  1080. path += id;
  1081. path += "\\";
  1082. CStringArray array;
  1083. CString dir;
  1084. GetSavePath(dir);
  1085. if (dir.IsEmpty())
  1086. {
  1087. return;
  1088. }
  1089. CString name1 = m_FurtherList.GetItemText(iItem, 1 + m_nAdd);
  1090. CString name2 = m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  1091. dir.TrimRight('\\');
  1092. dir += "\\";
  1093. dir += id;
  1094. dir += g_branchname;
  1095. if (g_bAllBranch)
  1096. {
  1097. if (GetBranchPhotoPath(branch) != "")
  1098. dir += branch;
  1099. }
  1100. dir += name1;
  1101. dir += name2;
  1102. dir += "精修好的片";
  1103. dir += "\\";
  1104. ::CreateDirectory(dir, NULL);
  1105. CStringArray desarray;
  1106. CStringArray dirarray;
  1107. CString savepath = dir;
  1108. CString str;
  1109. if (1)
  1110. {
  1111. using namespace helper_coffs;
  1112. ffsco o;
  1113. o.dirs(1);
  1114. o.find(LPCSTR(path), LPCSTR("*.*"));
  1115. ffsco::typeT coo;
  1116. ffsco::typeT::iterator it;
  1117. coo = o.co_dir();
  1118. for (it = coo.begin();coo.end() != it;it++)
  1119. {
  1120. str = (*it).c_str();
  1121. if (FindArray(&dirarray, str) == -1)
  1122. {
  1123. dirarray.Add(str);
  1124. if (str != dirarray.ElementAt(0))
  1125. {
  1126. str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
  1127. if (::CheckFolderFileExist(str) == 0)
  1128. ::CreateDirectory(str, NULL);
  1129. }
  1130. }
  1131. }
  1132. }
  1133. if (1)
  1134. {
  1135. for (int i = 0; i < dirarray.GetSize(); i++)
  1136. {
  1137. using namespace helper_coffs;
  1138. ffsco o;
  1139. o.dirs(0);
  1140. o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
  1141. ffsco::typeT coo;
  1142. ffsco::typeT::iterator it;
  1143. coo = o.co_file();
  1144. for (it = coo.begin();coo.end() != it;it++)
  1145. {
  1146. str = (*it).c_str();
  1147. if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
  1148. if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
  1149. array.Add(str);
  1150. desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
  1151. }
  1152. }
  1153. }
  1154. if (array.GetSize() == 0)
  1155. {
  1156. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  1157. return;
  1158. }
  1159. CCompressOption comoptdlg;
  1160. comoptdlg.DoModal();
  1161. ImportPhoto dlg;
  1162. dlg.m_nOutputSize = comoptdlg.m_nsize;
  1163. dlg.m_mode = 1;
  1164. dlg.m_pArray = &array;
  1165. dlg.m_pDesArray = &desarray;
  1166. dlg.m_savepath = dir;
  1167. dlg.DoModal(); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1168. // CString str;
  1169. str = " 导出精修片 ";
  1170. str += "客人:";
  1171. str += name1 + name2 + id;
  1172. WriteLog(str);
  1173. }
  1174. void BeautifySkinFrom2::OnButton1()
  1175. {
  1176. UpdateData();
  1177. m_filter.TrimLeft();
  1178. m_filter.TrimRight();
  1179. FillGrid();
  1180. }
  1181. void BeautifySkinFrom2::OnButton2() // 已选未修 按钮;
  1182. {
  1183. UpdateData();
  1184. m_filter.TrimLeft();
  1185. m_filter.TrimRight();
  1186. FillGrid(1);
  1187. }
  1188. void BeautifySkinFrom2::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  1189. {
  1190. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  1191. POSITION pos;
  1192. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1193. if (pos == NULL)
  1194. {
  1195. return;
  1196. }
  1197. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1198. if (IsHasRights2new(6) || IsHasRights2new(49))
  1199. {
  1200. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1201. }
  1202. else
  1203. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  1204. /* if(waiter7.IsEmpty () && IsHasRights2new(6) || IsHasRights2new(49))
  1205. {
  1206. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1207. }
  1208. else if(waiter7==g_user.name && IsHasRights2new(6) )
  1209. {
  1210. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1211. }
  1212. else
  1213. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);*/
  1214. *pResult = 0;
  1215. }
  1216. void BeautifySkinFrom2::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  1217. {
  1218. POSITION pos;
  1219. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1220. if (pos == NULL)return;
  1221. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1222. g_id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  1223. *pResult = 0;
  1224. }
  1225. void BeautifySkinFrom2::HidePrice()
  1226. {
  1227. #ifdef LKAY_VERSION
  1228. if (IsHasRights2new(31))return;
  1229. for (int i = 0; i < m_List1array.GetSize(); i++)
  1230. {
  1231. m_List1array.ElementAt(i).SetAt(14 + m_nAdd, "***");
  1232. m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
  1233. m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
  1234. m_List1array.ElementAt(i).SetAt(13 + m_nAdd, "***");
  1235. }
  1236. #else
  1237. if (IsHasRights2new(31))return;
  1238. for (int i = 0; i < m_List1array.GetSize(); i++)
  1239. {
  1240. m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
  1241. m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
  1242. }
  1243. #endif
  1244. }
  1245. void BeautifySkinFrom2::OnBtnsearchfilter()
  1246. {
  1247. SearchFilter dlg;
  1248. dlg.m_mode = 2;
  1249. if (dlg.DoModal() == IDOK)FillGrid();
  1250. g_bSearchFilter = 0;
  1251. }
  1252. void BeautifySkinFrom2::GetData()
  1253. {
  1254. if (g_bAllBranch == 0)
  1255. {
  1256. if (g_bShowOK == 0)
  1257. {
  1258. #ifdef LKAY_VERSION
  1259. CString filter = "status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  1260. #else
  1261. CString filter = "status3='未取'";
  1262. #endif
  1263. g_sendhead.bsql = 0;
  1264. g_sendhead.code[0] = 35;
  1265. g_sendhead.tabcount = 1;
  1266. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1267. if (g_bSendOK == 0)return;
  1268. }
  1269. else
  1270. {
  1271. g_sendhead.bsql = 0;
  1272. g_sendhead.code[0] = 35;
  1273. g_sendhead.tabcount = 1;
  1274. #ifdef LKAY_VERSION
  1275. CString filter = "dindantype<>'意向客户' or dindantype is null";
  1276. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1277. #else
  1278. g_pMainWnd->ProcessChatMessageRequest2(1);
  1279. #endif
  1280. if (g_bSendOK == 0)return;
  1281. }
  1282. DataToArray(&m_List1array);
  1283. }
  1284. else
  1285. {
  1286. //////////////数据汇总
  1287. m_List1array.RemoveAll();
  1288. CString branch;
  1289. for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
  1290. {
  1291. if (i != -1)
  1292. {
  1293. branch = g_brancharray.ElementAt(i).ElementAt(0);
  1294. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  1295. g_pMainWnd->OnDisconnect();
  1296. g_branchname = branch;
  1297. g_bBranchModify = 1;
  1298. }
  1299. else
  1300. branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
  1301. if (g_bShowOK == 0)
  1302. {
  1303. CString filter = "status3='未取'";
  1304. g_sendhead.bsql = 0;
  1305. g_sendhead.code[0] = 35;
  1306. g_sendhead.tabcount = 1;
  1307. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1308. if (g_bSendOK == 0)continue;
  1309. }
  1310. else
  1311. {
  1312. g_sendhead.bsql = 0;
  1313. g_sendhead.code[0] = 35;
  1314. g_sendhead.tabcount = 1;
  1315. g_pMainWnd->ProcessChatMessageRequest2(1);
  1316. if (g_bSendOK == 0)continue;
  1317. }
  1318. CArray<CStringArray, CStringArray>List1array;
  1319. DataToArray(&List1array);
  1320. int size = m_List1array.GetSize();
  1321. for (int j = 0; j < List1array.GetSize(); j++)
  1322. {
  1323. size++;
  1324. m_List1array.SetSize(size, 1);
  1325. size--;
  1326. m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
  1327. m_List1array.ElementAt(size).InsertAt(0, branch);
  1328. size++;
  1329. }
  1330. }
  1331. g_pMainWnd->OnDisconnect();
  1332. g_bBranchModify = 0; g_branchip = g_branchname = "";
  1333. }
  1334. HidePrice();
  1335. FillGrid();
  1336. }
  1337. void BeautifySkinFrom2::OnBUTprint3()
  1338. {
  1339. GetData();
  1340. }
  1341. // Jeff.没看到调用的地方,也没有关联任何按钮控件.
  1342. // 应该是废弃的函数;
  1343. void BeautifySkinFrom2::OnBUTexportphotoAddName()
  1344. {
  1345. if (IsHasRights2new(10) == 0)return;
  1346. UpdateData();
  1347. POSITION pos;
  1348. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1349. if (pos == NULL)
  1350. {
  1351. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  1352. return;
  1353. }
  1354. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1355. CString status2 = m_FurtherList.GetItemText(iItem, 4);
  1356. if (status2 != "OK")
  1357. {
  1358. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  1359. return;
  1360. }
  1361. CString id = m_FurtherList.GetItemText(iItem, 0);
  1362. CString name1 = m_FurtherList.GetItemText(iItem, 1);
  1363. CString name2 = m_FurtherList.GetItemText(iItem, 2);
  1364. CString filter = "id='" + id + "';id='" + id + "'";
  1365. g_sendhead.bsql = 0;
  1366. g_sendhead.code[0] = 50;
  1367. g_sendhead.code[1] = 11;
  1368. g_sendhead.tabcount = 2;
  1369. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1370. if (g_bSendOK == 0)return;
  1371. CArray<CStringArray, CStringArray>sparray;
  1372. DataToArray(&sparray, &g_List1array);
  1373. CString path = g_path2 + "\\";
  1374. SelectPhotoDlg selectdlg;
  1375. selectdlg.DoModal();
  1376. path += id;
  1377. path += "\\";
  1378. ////////////////////////////////////////
  1379. CString str, spname;
  1380. CStringArray noarray;
  1381. CStringArray spnamearray;
  1382. for (int i = 0; i < sparray.GetSize(); i++)
  1383. {
  1384. str = sparray.ElementAt(i).ElementAt(6);
  1385. spname = sparray.ElementAt(i).ElementAt(5);
  1386. GetNo(str, noarray);
  1387. }
  1388. if (noarray.GetSize() == 0)
  1389. {
  1390. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  1391. return;
  1392. }
  1393. spnamearray.SetSize(noarray.GetSize());
  1394. for (i = 0; i < noarray.GetSize(); i++)
  1395. {
  1396. str = noarray.ElementAt(i);
  1397. spnamearray.SetAt(i, GetSelName(str, sparray) + "-" + str);
  1398. }
  1399. CString dir;
  1400. GetSavePath(dir);
  1401. if (dir.IsEmpty())return;
  1402. dir.TrimRight('\\');
  1403. dir += "\\";
  1404. dir += id;
  1405. dir += name1;
  1406. dir += name2;
  1407. dir += "选片";
  1408. dir += "\\";
  1409. CStringArray array;
  1410. CStringArray spnamearray2;
  1411. CString src, des;
  1412. if (selectdlg.m_mode == 0)
  1413. {
  1414. for (i = 0; i < noarray.GetSize(); i++)
  1415. {
  1416. src.Format("%s%s.jpg", path, noarray.ElementAt(i));
  1417. if (::CheckFolderFileExist(src))
  1418. {
  1419. array.Add(src);
  1420. if (selectdlg.m_check1)
  1421. spnamearray2.Add(spnamearray.ElementAt(i));
  1422. else
  1423. spnamearray2.Add(noarray.ElementAt(i));
  1424. }
  1425. else
  1426. AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  1427. }
  1428. }
  1429. if (array.GetSize() == 0)
  1430. {
  1431. if (selectdlg.m_mode == 0)
  1432. AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
  1433. path = g_path1 + "\\";
  1434. path += id;
  1435. path += "\\";
  1436. dir.Delete(dir.GetLength() - 1, 1);
  1437. dir += "(未修)\\";
  1438. for (i = 0; i < noarray.GetSize(); i++)
  1439. {
  1440. src = GetPathFromNo2(path, noarray.ElementAt(i));
  1441. if (PathFileExists(src))
  1442. {
  1443. array.Add(src);
  1444. if (selectdlg.m_check1)
  1445. spnamearray2.Add(spnamearray.ElementAt(i));
  1446. else
  1447. spnamearray2.Add(noarray.ElementAt(i));
  1448. }
  1449. }
  1450. }
  1451. if (array.GetSize() == 0)
  1452. {
  1453. AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
  1454. return;
  1455. }
  1456. ::CreateDirectory(dir, NULL);
  1457. ImportPhoto dlg;
  1458. dlg.m_mode = 1;
  1459. dlg.m_pArray = &array;
  1460. dlg.m_pArray2 = &spnamearray2;
  1461. dlg.m_savepath = dir;
  1462. dlg.DoModal();
  1463. //////////////
  1464. if (g_List1array.GetSize())
  1465. {
  1466. CStdioFile fp;
  1467. fp.Open(dir + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
  1468. fp.WriteString(g_List1array.ElementAt(0).ElementAt(39));
  1469. fp.Close();
  1470. }
  1471. //////////////
  1472. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1473. }