BeautifySkinFrom2.cpp 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587
  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_List1);
  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_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
  95. #else
  96. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  97. #endif
  98. m_List1.LoadColumnInfo(122);
  99. }
  100. else
  101. {
  102. #ifdef CHILD_VERSION
  103. m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
  104. #else
  105. m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  106. #endif
  107. m_List1.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_List1.DeleteAllItems2();
  126. int ii = 0;
  127. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  128. int count = 0;
  129. {
  130. for (ii = 0; ii < m_List1.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_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  152. }
  153. }
  154. }
  155. m_List1.m_arLabels.SetSize(count, 1);
  156. ii = count;
  157. m_List1.m_LabelCount = ii;
  158. m_List1.SetItemCountEx(ii);
  159. CString str;
  160. str.Format("单数:%d", ii);
  161. SetDlgItemText(IDC_STATIC2, str);
  162. }
  163. else
  164. {
  165. m_List1.DeleteAllItems2();
  166. int ii = 0;
  167. m_List1.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_List1.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_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  178. }
  179. }
  180. else
  181. {
  182. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  183. {
  184. m_List1.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_List1.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_List1.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_List1.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_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  217. }
  218. }
  219. }
  220. else
  221. {
  222. for (ii = 0; ii < m_List1.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_List1.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_List1.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_List1.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_List1.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_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  270. }
  271. }
  272. }
  273. else
  274. {
  275. for (ii = 0; ii < m_List1.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_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 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_List1.GetFirstSelectedItemPosition();
  382. if (pos == NULL)
  383. {
  384. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  385. return;
  386. }
  387. int iItem = m_List1.GetNextSelectedItem(pos);
  388. CString branch;
  389. CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  390. if (g_bAllBranch)
  391. branch = m_List1.GetItemText(iItem, 0);
  392. CString oldstatus = m_List1.GetItemText(iItem, 6 + m_nAdd);
  393. CString time9 = m_List1.GetItemText(iItem, 7 + m_nAdd);
  394. CString name = m_List1.GetItemText(iItem, 1 + m_nAdd) + "," + m_List1.GetItemText(iItem, 2 + m_nAdd);
  395. name.TrimLeft(",");
  396. name.TrimRight(",");
  397. name = "客人:" + name;
  398. CString phone = m_List1.GetItemText(iItem, 15 + m_nAdd) + "," + m_List1.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);
  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_List1.GetFirstSelectedItemPosition();
  629. if (pos == NULL)
  630. {
  631. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  632. return;
  633. }
  634. int iItem = m_List1.GetNextSelectedItem(pos);
  635. CString branch;
  636. CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  637. if (g_bAllBranch)
  638. branch = m_List1.GetItemText(iItem, 0);
  639. CString name = m_List1.GetItemText(iItem, 1 + m_nAdd) + "," + m_List1.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_List1.GetFirstSelectedItemPosition();
  790. if (pos == NULL)
  791. {
  792. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  793. return;
  794. }
  795. // 2.1.获取订单的选片状态;
  796. int iItem = m_List1.GetNextSelectedItem(pos);
  797. CString status2 = m_List1.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_List1.GetItemText(iItem, 0 + m_nAdd); // 订单号;
  806. CString branch;
  807. if (g_bAllBranch)
  808. branch = m_List1.GetItemText(iItem, 0);
  809. CString name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
  810. CString name2 = m_List1.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. int i = 0;
  872. for ( i = 0; i < sparray.GetSize(); i++)
  873. {
  874. str = sparray.ElementAt(i).ElementAt(6); // 选好的片的相片名串;
  875. spname = sparray.ElementAt(i).ElementAt(5); // 选好的片对应的商品名;
  876. GetNo(str, noarray);
  877. }
  878. if (noarray.GetSize() == 0)
  879. {
  880. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  881. return;
  882. }
  883. spnamearray.SetSize(noarray.GetSize());
  884. for (i = 0; i < noarray.GetSize(); i++)
  885. {
  886. str = noarray.ElementAt(i);
  887. spnamearray.SetAt(i, GetSelName(str, sparray));//+"-"+str );
  888. }
  889. CString strSaveDiretory; // 导出选好片的目录;
  890. GetSavePath(strSaveDiretory);
  891. if (strSaveDiretory.IsEmpty())return;
  892. strSaveDiretory.TrimRight('\\');
  893. strSaveDiretory += "\\";
  894. strSaveDiretory += strOrderNumber;
  895. strSaveDiretory += g_branchname;
  896. if (g_bAllBranch)
  897. {
  898. if (GetBranchPhotoPath(branch) != "")
  899. strSaveDiretory += branch;
  900. }
  901. strSaveDiretory += name1;
  902. strSaveDiretory += name2;
  903. strSaveDiretory += "选片";
  904. strSaveDiretory += "\\";
  905. CStringArray array;
  906. CStringArray spnamearray2;
  907. CString src, des;
  908. if (selectdlg.m_mode == 0)
  909. {
  910. for (i = 0; i < noarray.GetSize(); i++)
  911. {
  912. if ((m_seltxname != "" && m_seltxname != "全部") || m_bGrowthTX == 0)
  913. src.Format("%s%s.jpg", strSrcDiretory, noarray.ElementAt(i));
  914. else
  915. src = GetPathFromNo3(strSrcDiretory, noarray.ElementAt(i));
  916. if (PathFileExists(src))
  917. {
  918. array.Add(src);
  919. if (1)//selectdlg.m_check1)
  920. spnamearray2.Add(spnamearray.ElementAt(i));
  921. else
  922. spnamearray2.Add(noarray.ElementAt(i));
  923. }
  924. else
  925. AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  926. }
  927. }
  928. if (array.GetSize() == 0)
  929. {
  930. if (selectdlg.m_mode == 0)
  931. AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
  932. if (g_bAllBranch)
  933. {
  934. CString branchpath = GetBranchPhotoPath(branch);
  935. strSrcDiretory = g_path1 + branchpath + "\\";
  936. }
  937. else
  938. strSrcDiretory = g_path1 + "\\";
  939. strSrcDiretory += strOrderNumber;
  940. strSrcDiretory += "\\";
  941. strSaveDiretory.Delete(strSaveDiretory.GetLength() - 1, 1);
  942. strSaveDiretory += "(未修)\\";
  943. bOfmat = 1;
  944. for (i = 0; i < noarray.GetSize(); i++)
  945. {
  946. // src.Format ("%s%s.jpg", strSrcDiretory, noarray.ElementAt (i));
  947. src = GetPathFromNo2(strSrcDiretory, noarray.ElementAt(i));
  948. if (PathFileExists(src))
  949. {
  950. array.Add(src);
  951. if (1)//selectdlg.m_check1)
  952. spnamearray2.Add(spnamearray.ElementAt(i));
  953. else
  954. spnamearray2.Add(noarray.ElementAt(i));
  955. }
  956. else
  957. AfxMessageBox("未找到原片文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  958. }
  959. }
  960. if (array.GetSize() == 0)
  961. {
  962. AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
  963. return;
  964. }
  965. ::CreateDirectory(strSaveDiretory, NULL);
  966. // 3.导出相片处理对象;
  967. ImportPhoto dlg;
  968. dlg.m_name = name1 + name2;
  969. dlg.m_bAddname = selectdlg.m_check1;
  970. dlg.m_bOfmat = bOfmat;
  971. dlg.m_mode = 1;
  972. dlg.m_bOrigin = 1;
  973. dlg.m_pArray = &array;
  974. dlg.m_pArray2 = &spnamearray2;
  975. dlg.m_savepath = strSaveDiretory;
  976. dlg.DoModal();
  977. //////////////
  978. if (g_List1array.GetSize())
  979. {
  980. CStdioFile fp;
  981. fp.Open(strSaveDiretory + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
  982. fp.WriteString("选片要求:\n");
  983. fp.WriteString(g_List1array.ElementAt(0).ElementAt(39) + " " + g_List1array.ElementAt(0).ElementAt(75));
  984. fp.WriteString("\n");
  985. fp.WriteString("\n");
  986. fp.WriteString("订单要求:\n");
  987. fp.WriteString(g_List1array.ElementAt(0).ElementAt(38));
  988. fp.WriteString("\n");
  989. fp.WriteString("\n");
  990. fp.WriteString("客人产品:\n");
  991. CString str;
  992. str = "产品名称";
  993. FillLength(str, 30);
  994. str += "数量";
  995. FillLength(str, 40);
  996. #ifdef LKAY_VERSION
  997. str += "P数";
  998. FillLength(str, 50);
  999. str += "加急";
  1000. FillLength(str, 60);
  1001. str += "取件日期";
  1002. FillLength(str, 70);
  1003. #else
  1004. str += "加急";
  1005. FillLength(str, 50);
  1006. str += "取件日期";
  1007. FillLength(str, 60);
  1008. #endif
  1009. fp.WriteString(str);
  1010. fp.WriteString("\n");
  1011. for ( i = 0; i < sparray2.GetSize(); i++)
  1012. {
  1013. str.Empty();
  1014. str = sparray2.ElementAt(i).ElementAt(0);
  1015. FillLength(str, 30);
  1016. str += sparray2.ElementAt(i).ElementAt(1);
  1017. FillLength(str, 40);
  1018. #ifdef LKAY_VERSION
  1019. str += sparray2.ElementAt(i).ElementAt(29);//p数
  1020. FillLength(str, 50);
  1021. str += sparray2.ElementAt(i).ElementAt(18);
  1022. FillLength(str, 60);
  1023. str += sparray2.ElementAt(i).ElementAt(19);
  1024. FillLength(str, 70);
  1025. #else
  1026. str += sparray2.ElementAt(i).ElementAt(18);
  1027. FillLength(str, 50);
  1028. str += sparray2.ElementAt(i).ElementAt(19);
  1029. FillLength(str, 60);
  1030. #endif
  1031. fp.WriteString(str);
  1032. fp.WriteString("\n");
  1033. }
  1034. fp.Close();
  1035. }
  1036. //////////////
  1037. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1038. #if JEFF_TEST_ON // 导出裁剪效果图;
  1039. //strSrcDiretory; // 源相片目录;
  1040. //strSaveDiretory;// 导出选好片的目录;
  1041. if (FALSE == g_List1array.ElementAt(0).ElementAt(60).IsEmpty())
  1042. ExportCutImageToFile(g_List1array.ElementAt(0).ElementAt(60), strSrcDiretory, strSaveDiretory+_T("裁剪效果\\"));
  1043. #else
  1044. {
  1045. ShowCut dlg;
  1046. dlg.m_branch = branch;
  1047. dlg.m_mode = 1;
  1048. dlg.m_id = strOrderNumber;
  1049. dlg.DoModal();
  1050. }
  1051. #endif
  1052. // CString str;
  1053. str = " 导出选片 ";
  1054. str += "客人:";
  1055. str += name1 + name2 + strOrderNumber;
  1056. WriteLog(_T("普通日志"), _T("导出选片"), g_user.name, str);
  1057. }
  1058. void BeautifySkinFrom2::OnBUTexportphoto2() // 导出精修的片 按钮;
  1059. {
  1060. if (IsHasRights2new(11) == 0)return;
  1061. POSITION pos;
  1062. pos = m_List1.GetFirstSelectedItemPosition();
  1063. if (pos == NULL)
  1064. {
  1065. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  1066. return;
  1067. }
  1068. int iItem = m_List1.GetNextSelectedItem(pos);
  1069. CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1070. CString branch;
  1071. if (g_bAllBranch)
  1072. branch = m_List1.GetItemText(iItem, 0);
  1073. CString path;
  1074. if (g_bAllBranch)
  1075. {
  1076. CString branchpath = GetBranchPhotoPath(branch);
  1077. path = g_path4 + branchpath + "\\";
  1078. }
  1079. else
  1080. path = g_path4 + "\\";
  1081. path += id;
  1082. path += "\\";
  1083. CStringArray array;
  1084. CString dir;
  1085. GetSavePath(dir);
  1086. if (dir.IsEmpty())
  1087. {
  1088. return;
  1089. }
  1090. CString name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
  1091. CString name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
  1092. dir.TrimRight('\\');
  1093. dir += "\\";
  1094. dir += id;
  1095. dir += g_branchname;
  1096. if (g_bAllBranch)
  1097. {
  1098. if (GetBranchPhotoPath(branch) != "")
  1099. dir += branch;
  1100. }
  1101. dir += name1;
  1102. dir += name2;
  1103. dir += "精修好的片";
  1104. dir += "\\";
  1105. ::CreateDirectory(dir, NULL);
  1106. CStringArray desarray;
  1107. CStringArray dirarray;
  1108. CString savepath = dir;
  1109. CString str;
  1110. if (1)
  1111. {
  1112. using namespace helper_coffs;
  1113. ffsco o;
  1114. o.dirs(1);
  1115. o.find(LPCSTR(path), LPCSTR("*.*"));
  1116. ffsco::typeT coo;
  1117. ffsco::typeT::iterator it;
  1118. coo = o.co_dir();
  1119. for (it = coo.begin();coo.end() != it;it++)
  1120. {
  1121. str = (*it).c_str();
  1122. if (FindArray(&dirarray, str) == -1)
  1123. {
  1124. dirarray.Add(str);
  1125. if (str != dirarray.ElementAt(0))
  1126. {
  1127. str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
  1128. if (::CheckFolderFileExist(str) == 0)
  1129. ::CreateDirectory(str, NULL);
  1130. }
  1131. }
  1132. }
  1133. }
  1134. if (1)
  1135. {
  1136. for (int i = 0; i < dirarray.GetSize(); i++)
  1137. {
  1138. using namespace helper_coffs;
  1139. ffsco o;
  1140. o.dirs(0);
  1141. o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
  1142. ffsco::typeT coo;
  1143. ffsco::typeT::iterator it;
  1144. coo = o.co_file();
  1145. for (it = coo.begin();coo.end() != it;it++)
  1146. {
  1147. str = (*it).c_str();
  1148. if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
  1149. if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
  1150. array.Add(str);
  1151. desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
  1152. }
  1153. }
  1154. }
  1155. if (array.GetSize() == 0)
  1156. {
  1157. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  1158. return;
  1159. }
  1160. CCompressOption comoptdlg;
  1161. comoptdlg.DoModal();
  1162. ImportPhoto dlg;
  1163. dlg.m_nOutputSize = comoptdlg.m_nsize;
  1164. dlg.m_mode = 1;
  1165. dlg.m_pArray = &array;
  1166. dlg.m_pDesArray = &desarray;
  1167. dlg.m_savepath = dir;
  1168. dlg.DoModal(); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1169. // CString str;
  1170. str = " 导出精修片 ";
  1171. str += "客人:";
  1172. str += name1 + name2 + id;
  1173. WriteLog(_T("普通日志"), _T("导出精修片"), g_user.name, str);
  1174. }
  1175. void BeautifySkinFrom2::OnButton1()
  1176. {
  1177. UpdateData();
  1178. m_filter.TrimLeft();
  1179. m_filter.TrimRight();
  1180. FillGrid();
  1181. }
  1182. void BeautifySkinFrom2::OnButton2() // 已选未修 按钮;
  1183. {
  1184. UpdateData();
  1185. m_filter.TrimLeft();
  1186. m_filter.TrimRight();
  1187. FillGrid(1);
  1188. }
  1189. void BeautifySkinFrom2::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  1190. {
  1191. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  1192. POSITION pos;
  1193. pos = m_List1.GetFirstSelectedItemPosition();
  1194. if (pos == NULL)
  1195. {
  1196. return;
  1197. }
  1198. int iItem = m_List1.GetNextSelectedItem(pos);
  1199. if (IsHasRights2new(6) || IsHasRights2new(49))
  1200. {
  1201. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1202. }
  1203. else
  1204. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  1205. /* if(waiter7.IsEmpty () && IsHasRights2new(6) || IsHasRights2new(49))
  1206. {
  1207. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1208. }
  1209. else if(waiter7==g_user.name && IsHasRights2new(6) )
  1210. {
  1211. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1212. }
  1213. else
  1214. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);*/
  1215. *pResult = 0;
  1216. }
  1217. void BeautifySkinFrom2::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  1218. {
  1219. POSITION pos;
  1220. pos = m_List1.GetFirstSelectedItemPosition();
  1221. if (pos == NULL)return;
  1222. int iItem = m_List1.GetNextSelectedItem(pos);
  1223. g_id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1224. *pResult = 0;
  1225. }
  1226. void BeautifySkinFrom2::HidePrice()
  1227. {
  1228. #ifdef LKAY_VERSION
  1229. if (IsHasRights2new(31))return;
  1230. for (int i = 0; i < m_List1array.GetSize(); i++)
  1231. {
  1232. m_List1array.ElementAt(i).SetAt(14 + m_nAdd, "***");
  1233. m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
  1234. m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
  1235. m_List1array.ElementAt(i).SetAt(13 + m_nAdd, "***");
  1236. }
  1237. #else
  1238. if (IsHasRights2new(31))return;
  1239. for (int i = 0; i < m_List1array.GetSize(); i++)
  1240. {
  1241. m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
  1242. m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
  1243. }
  1244. #endif
  1245. }
  1246. void BeautifySkinFrom2::OnBtnsearchfilter()
  1247. {
  1248. SearchFilter dlg;
  1249. dlg.m_mode = 2;
  1250. if (dlg.DoModal() == IDOK)FillGrid();
  1251. g_bSearchFilter = 0;
  1252. }
  1253. void BeautifySkinFrom2::GetData()
  1254. {
  1255. if (g_bAllBranch == 0)
  1256. {
  1257. if (g_bShowOK == 0)
  1258. {
  1259. #ifdef LKAY_VERSION
  1260. CString filter = "status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  1261. #else
  1262. CString filter = "status3='未取'";
  1263. #endif
  1264. g_sendhead.bsql = 0;
  1265. g_sendhead.code[0] = 35;
  1266. g_sendhead.tabcount = 1;
  1267. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1268. if (g_bSendOK == 0)return;
  1269. }
  1270. else
  1271. {
  1272. g_sendhead.bsql = 0;
  1273. g_sendhead.code[0] = 35;
  1274. g_sendhead.tabcount = 1;
  1275. #ifdef LKAY_VERSION
  1276. CString filter = "dindantype<>'意向客户' or dindantype is null";
  1277. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1278. #else
  1279. g_pMainWnd->ProcessChatMessageRequest2(1);
  1280. #endif
  1281. if (g_bSendOK == 0)return;
  1282. }
  1283. DataToArray(&m_List1array);
  1284. }
  1285. else
  1286. {
  1287. //////////////数据汇总
  1288. m_List1array.RemoveAll();
  1289. CString branch;
  1290. for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
  1291. {
  1292. if (i != -1)
  1293. {
  1294. branch = g_brancharray.ElementAt(i).ElementAt(0);
  1295. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  1296. g_pMainWnd->OnDisconnect();
  1297. g_branchname = branch;
  1298. g_bBranchModify = 1;
  1299. }
  1300. else
  1301. branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
  1302. if (g_bShowOK == 0)
  1303. {
  1304. CString filter = "status3='未取'";
  1305. g_sendhead.bsql = 0;
  1306. g_sendhead.code[0] = 35;
  1307. g_sendhead.tabcount = 1;
  1308. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1309. if (g_bSendOK == 0)continue;
  1310. }
  1311. else
  1312. {
  1313. g_sendhead.bsql = 0;
  1314. g_sendhead.code[0] = 35;
  1315. g_sendhead.tabcount = 1;
  1316. g_pMainWnd->ProcessChatMessageRequest2(1);
  1317. if (g_bSendOK == 0)continue;
  1318. }
  1319. CArray<CStringArray, CStringArray>List1array;
  1320. DataToArray(&List1array);
  1321. int size = m_List1array.GetSize();
  1322. for (int j = 0; j < List1array.GetSize(); j++)
  1323. {
  1324. size++;
  1325. m_List1array.SetSize(size, 1);
  1326. size--;
  1327. m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
  1328. m_List1array.ElementAt(size).InsertAt(0, branch);
  1329. size++;
  1330. }
  1331. }
  1332. g_pMainWnd->OnDisconnect();
  1333. g_bBranchModify = 0; g_branchip = g_branchname = "";
  1334. }
  1335. HidePrice();
  1336. FillGrid();
  1337. }
  1338. void BeautifySkinFrom2::OnBUTprint3()
  1339. {
  1340. GetData();
  1341. }
  1342. // Jeff.没看到调用的地方,也没有关联任何按钮控件.
  1343. // 应该是废弃的函数;
  1344. void BeautifySkinFrom2::OnBUTexportphotoAddName()
  1345. {
  1346. if (IsHasRights2new(10) == 0)return;
  1347. UpdateData();
  1348. POSITION pos;
  1349. pos = m_List1.GetFirstSelectedItemPosition();
  1350. if (pos == NULL)
  1351. {
  1352. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  1353. return;
  1354. }
  1355. int iItem = m_List1.GetNextSelectedItem(pos);
  1356. CString status2 = m_List1.GetItemText(iItem, 4);
  1357. if (status2 != "OK")
  1358. {
  1359. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  1360. return;
  1361. }
  1362. CString id = m_List1.GetItemText(iItem, 0);
  1363. CString name1 = m_List1.GetItemText(iItem, 1);
  1364. CString name2 = m_List1.GetItemText(iItem, 2);
  1365. CString filter = "id='" + id + "';id='" + id + "'";
  1366. g_sendhead.bsql = 0;
  1367. g_sendhead.code[0] = 50;
  1368. g_sendhead.code[1] = 11;
  1369. g_sendhead.tabcount = 2;
  1370. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1371. if (g_bSendOK == 0)return;
  1372. CArray<CStringArray, CStringArray>sparray;
  1373. DataToArray(&sparray, &g_List1array);
  1374. CString path = g_path2 + "\\";
  1375. SelectPhotoDlg selectdlg;
  1376. selectdlg.DoModal();
  1377. path += id;
  1378. path += "\\";
  1379. ////////////////////////////////////////
  1380. CString str, spname;
  1381. CStringArray noarray;
  1382. CStringArray spnamearray;
  1383. int i = 0;
  1384. for ( i = 0; i < sparray.GetSize(); i++)
  1385. {
  1386. str = sparray.ElementAt(i).ElementAt(6);
  1387. spname = sparray.ElementAt(i).ElementAt(5);
  1388. GetNo(str, noarray);
  1389. }
  1390. if (noarray.GetSize() == 0)
  1391. {
  1392. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  1393. return;
  1394. }
  1395. spnamearray.SetSize(noarray.GetSize());
  1396. for (i = 0; i < noarray.GetSize(); i++)
  1397. {
  1398. str = noarray.ElementAt(i);
  1399. spnamearray.SetAt(i, GetSelName(str, sparray) + "-" + str);
  1400. }
  1401. CString dir;
  1402. GetSavePath(dir);
  1403. if (dir.IsEmpty())return;
  1404. dir.TrimRight('\\');
  1405. dir += "\\";
  1406. dir += id;
  1407. dir += name1;
  1408. dir += name2;
  1409. dir += "选片";
  1410. dir += "\\";
  1411. CStringArray array;
  1412. CStringArray spnamearray2;
  1413. CString src, des;
  1414. if (selectdlg.m_mode == 0)
  1415. {
  1416. for (i = 0; i < noarray.GetSize(); i++)
  1417. {
  1418. src.Format("%s%s.jpg", path, noarray.ElementAt(i));
  1419. if (::CheckFolderFileExist(src))
  1420. {
  1421. array.Add(src);
  1422. if (selectdlg.m_check1)
  1423. spnamearray2.Add(spnamearray.ElementAt(i));
  1424. else
  1425. spnamearray2.Add(noarray.ElementAt(i));
  1426. }
  1427. else
  1428. AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  1429. }
  1430. }
  1431. if (array.GetSize() == 0)
  1432. {
  1433. if (selectdlg.m_mode == 0)
  1434. AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
  1435. path = g_path1 + "\\";
  1436. path += id;
  1437. path += "\\";
  1438. dir.Delete(dir.GetLength() - 1, 1);
  1439. dir += "(未修)\\";
  1440. for (i = 0; i < noarray.GetSize(); i++)
  1441. {
  1442. src = GetPathFromNo2(path, noarray.ElementAt(i));
  1443. if (PathFileExists(src))
  1444. {
  1445. array.Add(src);
  1446. if (selectdlg.m_check1)
  1447. spnamearray2.Add(spnamearray.ElementAt(i));
  1448. else
  1449. spnamearray2.Add(noarray.ElementAt(i));
  1450. }
  1451. }
  1452. }
  1453. if (array.GetSize() == 0)
  1454. {
  1455. AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
  1456. return;
  1457. }
  1458. ::CreateDirectory(dir, NULL);
  1459. ImportPhoto dlg;
  1460. dlg.m_mode = 1;
  1461. dlg.m_pArray = &array;
  1462. dlg.m_pArray2 = &spnamearray2;
  1463. dlg.m_savepath = dir;
  1464. dlg.DoModal();
  1465. //////////////
  1466. if (g_List1array.GetSize())
  1467. {
  1468. CStdioFile fp;
  1469. fp.Open(dir + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
  1470. fp.WriteString(g_List1array.ElementAt(0).ElementAt(39));
  1471. fp.Close();
  1472. }
  1473. //////////////
  1474. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1475. }