outsourcing.cpp 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138
  1. // outsourcing.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "outsourcing.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "outsourcingDlg.h"
  9. #include "outsourcingDlg2.h"
  10. #include "outsourcing2.h"
  11. #include "outsourcing3.h"
  12. #include "outsourcing4.h"
  13. #include "DlgScanBarCode.h"
  14. #include "SendMsgDlg.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. #pragma comment(lib, "Shlwapi.lib")
  21. IMPLEMENT_DYNCREATE(outsourcing, MyFormView)
  22. outsourcing::outsourcing() : MyFormView(outsourcing::IDD)
  23. {
  24. m_filter = _T(""); m_nAdd = 0;
  25. if (g_bAllBranch)
  26. {
  27. m_nAdd = 1;
  28. }
  29. }
  30. outsourcing::~outsourcing()
  31. {
  32. }
  33. void outsourcing::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(outsourcing, 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_BUTmodify, OnBUTmodify)
  47. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  48. ON_BN_CLICKED(IDC_BUTexport, OnBUTexport)
  49. ON_BN_CLICKED(IDC_BUTmodify2, OnBUTmodify2)
  50. ON_NOTIFY(NM_RDBLCLK, IDC_LIST2, OnRdblclkList2)
  51. ON_BN_CLICKED(IDC_BUTToPhotoPrint, OnBUTToPhotoPrint)
  52. ON_BN_CLICKED(IDC_BUTburncd, OnBUTburncd)
  53. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  54. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  55. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  56. ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
  57. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  58. #ifdef VC60
  59. ON_BN_CLICKED(BTN_SENDSMS, OnBnClickedSendsms)
  60. ON_BN_CLICKED(BTN_PRINTBAR, OnBnClickedPrintbar)
  61. ON_BN_CLICKED(BTN_SCANBACKITEM, OnBnClickedScanbackitem)
  62. ON_BN_CLICKED(BTN_SCANPICKUP, OnBnClickedScanpickup)
  63. #else
  64. ON_BN_CLICKED(BTN_SENDSMS, &outsourcing::OnBnClickedSendsms)
  65. ON_BN_CLICKED(BTN_PRINTBAR, &outsourcing::OnBnClickedPrintbar)
  66. ON_BN_CLICKED(BTN_SCANBACKITEM, &outsourcing::OnBnClickedScanbackitem)
  67. ON_BN_CLICKED(BTN_SCANPICKUP, &outsourcing::OnBnClickedScanpickup)
  68. #endif
  69. END_MESSAGE_MAP()
  70. /////////////////////////////////////////////////////////////////////////////
  71. #ifdef _DEBUG
  72. void outsourcing::AssertValid() const
  73. {
  74. MyFormView::AssertValid();
  75. }
  76. void outsourcing::Dump(CDumpContext& dc) const
  77. {
  78. MyFormView::Dump(dc);
  79. }
  80. #endif //_DEBUG
  81. /////////////////////////////////////////////////////////////////////////////
  82. void outsourcing::OnInitialUpdate()
  83. {
  84. MyFormView::OnInitialUpdate();
  85. CMyMdi Mdi;
  86. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  87. CRect rc2;
  88. GetWindowRect(rc2);
  89. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  90. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  91. #ifdef LKAY_VERSION
  92. GetDlgItem(IDC_BUTexport)->ShowWindow(SW_SHOW);
  93. GetDlgItem(IDC_BUTToPhotoPrint)->ShowWindow(SW_SHOW);
  94. #endif
  95. int btnwid;
  96. CRect prerc;
  97. int idcount = 5;
  98. {
  99. int idarray[] = { IDC_BUTmodify, IDC_BUTmodify2, IDC_BUTburncd, IDC_BUTburncd2, IDC_BUTclose };
  100. idcount = 5;
  101. for (int a = idcount - 2; a >= 0; a--)
  102. {
  103. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  104. ScreenToClient(prerc);
  105. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  106. ScreenToClient(rc2);
  107. btnwid = rc2.Width();
  108. rc2.right = prerc.left;
  109. rc2.left = rc2.right - btnwid;
  110. GetDlgItem(idarray[a])->MoveWindow(rc2);
  111. }
  112. }
  113. int idarray2[] = { IDC_BUTTON1, IDC_BUTTON2, IDC_BUTTON3, IDC_BUTexport, IDC_BUTToPhotoPrint };
  114. idcount = 5;
  115. for (int a = 1; a < idcount; a++)
  116. {
  117. GetDlgItem(idarray2[a - 1])->GetWindowRect(prerc);
  118. ScreenToClient(prerc);
  119. GetDlgItem(idarray2[a])->GetWindowRect(rc2);
  120. ScreenToClient(rc2);
  121. btnwid = rc2.Width();
  122. rc2.left = prerc.right;
  123. rc2.right = rc2.left + btnwid;
  124. GetDlgItem(idarray2[a])->MoveWindow(rc2);
  125. }
  126. m_static1.SetFont(&g_titlefont);
  127. if (g_bAllBranch == 0)
  128. {
  129. #ifdef CHILD_VERSION // Jeff.设计后添加设计师;
  130. #ifdef LKAY_VERSION
  131. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否组件,100;是否转走,100;是否取走,100;加急,100;取件日期,100;手机,100;固定电话,100" );
  132. #else // 17.column
  133. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;手机,100;固定电话,100");
  134. #endif
  135. #else
  136. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;男宾电话,100;女宾电话,100" );
  137. #endif
  138. m_List1.LoadColumnInfo(121);
  139. }
  140. else
  141. {
  142. #ifdef CHILD_VERSION
  143. m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;手机,100;固定电话,100");
  144. #else
  145. m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;男宾电话,100;女宾电话,100" );
  146. #endif
  147. m_List1.LoadColumnInfo(305);
  148. }
  149. #if JEFF_DELETE_OFF // 多产品时排序有问题;
  150. m_List1.m_bSortSupport = 0;
  151. #endif
  152. GetData();
  153. for (int i = 0; i < g_userarray.GetSize(); i++)
  154. {
  155. m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
  156. }
  157. FillGrid();
  158. m_combo1.GetWindowRect(rc2);
  159. ScreenToClient(rc2);
  160. rc2.bottom += 200;
  161. m_combo1.MoveWindow(rc2);
  162. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  163. SetComboHei(&m_combo1, rc2.Height());
  164. GetDlgItem(IDC_BUTmodify)->EnableWindow(IsHasRights2new(13));
  165. GetDlgItem(IDC_BUTmodify2)->EnableWindow(IsHasRights2new(13));
  166. }
  167. void outsourcing::FillGrid(BOOL bStatus)
  168. {
  169. m_List1.DeleteAllItems2();
  170. int ii = 0;
  171. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  172. int count = 0;
  173. if (m_filter.IsEmpty() || bStatus)
  174. {
  175. if (bStatus == 2) // 近期取件;
  176. {
  177. CTime tm(atoi(g_date.Mid(0, 4)), atoi(g_date.Mid(5, 2)), atoi(g_date.Mid(8, 2)), 0, 0, 0);
  178. CString sdate1, sdate2;
  179. sdate1 = tm.Format("%Y-%m-%d");
  180. CTimeSpan sp(15, 0, 0, 0);
  181. tm += sp;
  182. sdate2 = tm.Format("%Y-%m-%d");
  183. BOOL bFinded = 0;
  184. int begin, end;
  185. CString oldid = "";
  186. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  187. {
  188. if (oldid.IsEmpty())
  189. {
  190. // 订单号;
  191. oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
  192. begin = ii;
  193. continue;
  194. }
  195. if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != "" && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != oldid))
  196. {
  197. end = ii - 1;
  198. bFinded = 0;
  199. for (int a = begin; a <= end; a++)
  200. {
  201. // 查询条件== 整个订单取件日期 || 单个商品取件日期
  202. if ((m_List1array.ElementAt(a).ElementAt(6 + m_nAdd) >= sdate1 && m_List1array.ElementAt(a).ElementAt(6 + m_nAdd) <= sdate2) || (m_List1array.ElementAt(a).ElementAt(14 + m_nAdd) >= sdate1 && m_List1array.ElementAt(a).ElementAt(14 + m_nAdd) <= sdate2))
  203. {
  204. bFinded = 1;
  205. break;
  206. }
  207. }
  208. if (bFinded == 1)
  209. {
  210. for (int a = begin; a <= end; a++)
  211. {
  212. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
  213. }
  214. }
  215. begin = ii;
  216. oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
  217. }
  218. }
  219. }
  220. else if (bStatus == 1) // 查询完成;
  221. {
  222. {BOOL bFinded = 0;
  223. int begin, end;
  224. CString oldid = "";
  225. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  226. {
  227. if (oldid.IsEmpty())
  228. {
  229. oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
  230. begin = ii;
  231. continue;
  232. }
  233. if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != "" && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != oldid))
  234. {
  235. end = ii - 1;
  236. bFinded = 0;
  237. for (int a = begin; a <= end; a++)
  238. {
  239. // 查询条件==产品完成;
  240. if (m_List1array.ElementAt(a).ElementAt(11 + m_nAdd) != "OK")
  241. {
  242. bFinded = 1;
  243. break;
  244. }
  245. }
  246. if (bFinded == 0)
  247. {
  248. for (int a = begin; a <= end; a++)
  249. {
  250. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
  251. }
  252. }
  253. begin = ii;
  254. oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
  255. }
  256. }
  257. }
  258. }
  259. else if (bStatus == 3)//已完成未取;
  260. {
  261. {BOOL bFinded = 0; BOOL bFinded2 = 0;
  262. int begin, end;
  263. CString oldid = "";
  264. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  265. {
  266. if (oldid.IsEmpty())
  267. {
  268. oldid = m_List1array.ElementAt(ii).ElementAt(0);
  269. begin = ii;
  270. continue;
  271. }
  272. if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0) != "" && m_List1array.ElementAt(ii).ElementAt(0) != oldid))
  273. {
  274. end = ii - 1;
  275. bFinded = 0; bFinded2 = 0;
  276. for (int a = begin; a <= end; a++)
  277. {
  278. // 查询条件==产品未完成;
  279. if (m_List1array.ElementAt(a).ElementAt(11) != "OK")
  280. {
  281. bFinded = 1;
  282. break;
  283. }
  284. // 查询条件==未取走;
  285. if (m_List1array.ElementAt(a).ElementAt(12) != "OK")
  286. {
  287. bFinded2 = 1;
  288. }
  289. }
  290. if (bFinded == 0 && bFinded2)
  291. {
  292. for (int a = begin; a <= end; a++)
  293. {
  294. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
  295. }
  296. }
  297. begin = ii;
  298. oldid = m_List1array.ElementAt(ii).ElementAt(0);
  299. }
  300. }
  301. }
  302. }
  303. else if (bStatus == 4)//已取未转入历史订单;
  304. {
  305. BOOL bFinded = 0;
  306. BOOL bFinded2 = 0;
  307. int begin, end;
  308. CString oldid = "";
  309. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  310. {
  311. if (oldid.IsEmpty())
  312. {
  313. oldid = m_List1array.ElementAt(ii).ElementAt(0);
  314. begin = ii;
  315. continue;
  316. }
  317. if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0) != "" && m_List1array.ElementAt(ii).ElementAt(0) != oldid))
  318. {
  319. end = ii - 1;
  320. bFinded = 0; bFinded2 = 0;
  321. for (int a = begin; a <= end; a++)
  322. {
  323. // 查询条件==未取走;
  324. if (m_List1array.ElementAt(a).ElementAt(12) != "OK")
  325. {
  326. bFinded = 1;
  327. break;
  328. }
  329. // 查询条件==未加急;
  330. if (m_List1array.ElementAt(a).ElementAt(13) != "OK")
  331. {
  332. bFinded2 = 1;
  333. }
  334. }
  335. if (bFinded == 0 && bFinded2)
  336. {
  337. for (int a = begin; a <= end; a++)
  338. {
  339. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
  340. }
  341. }
  342. begin = ii;
  343. oldid = m_List1array.ElementAt(ii).ElementAt(0);
  344. }
  345. }
  346. }
  347. else
  348. {
  349. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  350. {
  351. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  352. }
  353. }
  354. }
  355. else
  356. {
  357. int nAdd = 0;
  358. #ifdef LKAY_VERSION
  359. nAdd=2;
  360. #endif
  361. int type = GetType(m_filter);
  362. if (type == 1)//电话;
  363. {
  364. BOOL bFinded = 0;
  365. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  366. {
  367. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  368. {
  369. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  370. continue;
  371. }
  372. // 查询条件==手机1||手机2;
  373. if (m_List1array.ElementAt(ii).ElementAt(16 + nAdd + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(17 + nAdd + m_nAdd).Find(m_filter) != -1)
  374. {
  375. bFinded = 1;
  376. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  377. }
  378. else
  379. {
  380. bFinded = 0;
  381. }
  382. }
  383. }
  384. else if (type == 2)//拼音;
  385. {
  386. BOOL bFinded = 0;
  387. m_filter.MakeUpper();
  388. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  389. {
  390. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  391. {
  392. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  393. continue;
  394. }
  395. // 查询条件==拼音1||拼音2;
  396. if (m_List1array.ElementAt(ii).ElementAt(18 + nAdd + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(19 + nAdd + m_nAdd).Find(m_filter) != -1)
  397. {
  398. bFinded = 1;
  399. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  400. }
  401. else
  402. {
  403. bFinded = 0;
  404. }
  405. }
  406. }
  407. else
  408. {
  409. BOOL bFinded = 0;
  410. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  411. {
  412. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  413. {
  414. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  415. continue;
  416. }
  417. // 查询条件==订单号、男名、女名、接单人、手机1、手机2、拼音1、拼音2 ;
  418. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1
  419. || m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).Find(m_filter) != -1
  420. || m_List1array.ElementAt(ii).ElementAt(1 + m_nAdd).Find(m_filter) != -1
  421. || m_List1array.ElementAt(ii).ElementAt(2 + m_nAdd).Find(m_filter) != -1
  422. || m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd).Find(m_filter) != -1
  423. || m_List1array.ElementAt(ii).ElementAt(15 + nAdd + m_nAdd).Find(m_filter) != -1
  424. || m_List1array.ElementAt(ii).ElementAt(16 + nAdd + m_nAdd).Find(m_filter) != -1
  425. || m_List1array.ElementAt(ii).ElementAt(17 + nAdd + m_nAdd).Find(m_filter) != -1
  426. || m_List1array.ElementAt(ii).ElementAt(18 + nAdd + m_nAdd).Find(m_filter) != -1
  427. )
  428. {
  429. bFinded = 1;
  430. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  431. }
  432. else
  433. {
  434. bFinded = 0;
  435. }
  436. }
  437. }
  438. }
  439. m_List1.m_arLabels.SetSize(count, 1);
  440. ii = count;
  441. m_List1.m_LabelCount = ii;
  442. m_List1.SetItemCountEx(ii);
  443. CString str;
  444. str.Format("单数:%d", ii);
  445. SetDlgItemText(IDC_STATIC2, str);
  446. if (!g_id.IsEmpty())
  447. {
  448. for (int i = 0; i < m_List1.GetItemCount(); i++)
  449. {
  450. if (g_id == m_List1.GetItemText(i, 0 + m_nAdd))
  451. {
  452. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  453. m_List1.EnsureVisible(i, FALSE);
  454. break;
  455. }
  456. }
  457. }
  458. }
  459. void outsourcing::OnBUTclose()
  460. {
  461. GetParent()->SendMessage(WM_CLOSE);
  462. }
  463. void outsourcing::OnButton1() // 查询 按钮;
  464. {
  465. UpdateData();
  466. m_filter.TrimLeft();
  467. m_filter.TrimRight();
  468. FillGrid();
  469. }
  470. void outsourcing::OnSelchangeCombo1()
  471. {
  472. SetTimer(1, 100, NULL);
  473. }
  474. void outsourcing::OnTimer(UINT nIDEvent)
  475. {
  476. KillTimer(nIDEvent);
  477. OnButton1();
  478. }
  479. BOOL outsourcing::PreTranslateMessage(MSG* pMsg)
  480. {
  481. try
  482. {
  483. if (pMsg->message == WM_KEYDOWN)
  484. {
  485. switch (pMsg->wParam)
  486. {
  487. case VK_RETURN:
  488. OnButton1();
  489. return 1;
  490. case 0x43: // copy
  491. if ((GetKeyState(VK_CONTROL) & 0x80))
  492. {
  493. GetFocus()->SendMessage(WM_COPY);
  494. return TRUE;
  495. }
  496. break;
  497. case 0x56: //Ctrl + V:
  498. if ((GetKeyState(VK_CONTROL) & 0x80))
  499. {
  500. GetFocus()->SendMessage(WM_PASTE);
  501. return TRUE;
  502. }
  503. break;
  504. case 0x58: // cut
  505. if ((GetKeyState(VK_CONTROL) & 0x80))
  506. {
  507. GetFocus()->SendMessage(WM_CUT);
  508. return TRUE;
  509. }
  510. break;
  511. case 0x5A: //undo
  512. case 0x59: //redo
  513. if ((GetKeyState(VK_CONTROL) & 0x80))
  514. {
  515. GetFocus()->SendMessage(WM_UNDO);
  516. return TRUE;
  517. }
  518. break;
  519. }
  520. }
  521. /* else if(pMsg->message==WM_LBUTTONDOWN)
  522. {
  523. CPoint pt;
  524. CRect rc,rc2;
  525. ::GetCursorPos (&pt);
  526. m_List1.GetWindowRect (rc2);
  527. pt.x-=rc2.left ;
  528. pt.y-=rc2.top ;
  529. m_List1.GetHeaderCtrl()->GetItemRect (0, rc);
  530. rc.right =rc.left +rc2.Width ();
  531. if(rc.PtInRect (pt))
  532. return 1;
  533. }*/
  534. return MyFormView::PreTranslateMessage(pMsg);
  535. }
  536. catch (...)
  537. {
  538. }
  539. return TRUE;
  540. }
  541. //-----------------------------------------------------------------
  542. // remark by Jeff 2014-12-12
  543. // 函数:GetNo
  544. // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
  545. // 参数:
  546. // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
  547. // array:空的数组,用来存放解析后的相片名;
  548. // 返回:
  549. // 注意:更换分隔符造成的问题,在该函数已解决;
  550. //-----------------------------------------------------------------
  551. void outsourcing::GetNo(CString str, CStringArray &array)
  552. {
  553. if (!str.IsEmpty())
  554. {
  555. #ifdef USE_SEP_VEB
  556. int pos = str.Find(SEPS_VEB);
  557. #else
  558. int pos = str.Find(",");
  559. #endif
  560. while (pos != -1)
  561. {
  562. array.Add(str.Left(pos));
  563. str = str.Right(str.GetLength() - pos - 1);
  564. #ifdef USE_SEP_VEB
  565. pos = str.Find(SEPS_VEB);
  566. #else
  567. pos = str.Find(",");
  568. #endif
  569. }
  570. array.Add(str);
  571. }
  572. }
  573. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  574. /*{
  575. switch(msg)
  576. {
  577. case BFFM_INITIALIZED:
  578. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  579. break;
  580. case BFFM_SELCHANGED:
  581. {
  582. char szFileName[MAX_PATH];
  583. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  584. SHGetPathFromIDList(pidlCurrent, szFileName);
  585. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  586. }
  587. break;
  588. }
  589. return 0;
  590. }*/
  591. void outsourcing::GetSavePath(CString &path)
  592. {
  593. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  594. LPITEMIDLIST pidlDesktop, pidlCurrent;
  595. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
  596. == NOERROR)
  597. {
  598. BROWSEINFO bi;
  599. bi.hwndOwner = this->m_hWnd;
  600. bi.pidlRoot = pidlDesktop;
  601. bi.pszDisplayName = lpszDisplayName;
  602. bi.lpszTitle = "\n文档保存的目录:";
  603. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  604. bi.lpfn = BrowseProc;
  605. bi.lParam = 0;
  606. bi.iImage = 0;
  607. pidlCurrent = SHBrowseForFolder(&bi);
  608. SHGetPathFromIDList(pidlCurrent, szFileName);
  609. path = szFileName;
  610. }
  611. }
  612. int outsourcing::FindArray(CStringArray *pArray, CString *pStr)
  613. {
  614. for (int i = 0; i < pArray->GetSize(); i++)
  615. {
  616. if (pArray->ElementAt(i) == *pStr)
  617. return i;
  618. }
  619. return -1;
  620. }
  621. void outsourcing::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  622. {
  623. OnBUTmodify();
  624. *pResult = 0;
  625. }
  626. void outsourcing::OnBUTmodify() // 发件取件资料按钮;
  627. {
  628. if (IsHasRights2new(13) == 0)return;
  629. POSITION pos;
  630. pos = m_List1.GetFirstSelectedItemPosition();
  631. if (pos == NULL)
  632. {
  633. return;
  634. }
  635. int iItem = m_List1.GetNextSelectedItem(pos);
  636. CString branch;
  637. CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  638. if (g_bAllBranch)
  639. branch = m_List1.GetItemText(iItem, 0);
  640. while (id == "")
  641. {
  642. iItem--;
  643. id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  644. }
  645. outsourcingDlg dlg;
  646. dlg.m_branch = branch;
  647. dlg.m_id = id;
  648. dlg.m_name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
  649. dlg.m_name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
  650. if (dlg.DoModal() != IDOK)
  651. return;
  652. for (int i = 0; i < m_List1array.GetSize(); i++)
  653. {
  654. if (id == m_List1array.ElementAt(i).ElementAt(0 + m_nAdd))
  655. {
  656. iItem = i;
  657. break;
  658. }
  659. }
  660. int pos2;
  661. CString name;
  662. int sameproduct = 0;
  663. if (g_bAllBranch)
  664. {
  665. while (branch == m_List1array.ElementAt(iItem).ElementAt(0) && (id == m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd) || m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd).IsEmpty()))
  666. {
  667. //name=m_List1array.ElementAt (iItem).ElementAt (7+m_nAdd); // Jeff.
  668. name = m_List1array.ElementAt(iItem).ElementAt(8 + m_nAdd);
  669. for (int i = 0; i < dlg.m_sparray.GetSize(); i++)
  670. {
  671. if (name == dlg.m_sparray.ElementAt(i).ElementAt(0))
  672. {
  673. pos2 = i;
  674. sameproduct++;
  675. // break;
  676. }
  677. }
  678. if (sameproduct > 1)
  679. {
  680. GetData();
  681. FillGrid();
  682. return;
  683. }
  684. #if 0
  685. m_List1array.ElementAt (iItem).SetAt (8+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(2));
  686. m_List1array.ElementAt (iItem).SetAt (9+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(3));
  687. m_List1array.ElementAt (iItem).SetAt (10+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(4));
  688. #ifdef LKAY_VERSION
  689. m_List1array.ElementAt (iItem).SetAt (11, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
  690. m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
  691. m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
  692. #else
  693. m_List1array.ElementAt (iItem).SetAt (11+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
  694. #endif
  695. #else //-----------------------------------------------------------------------------------------------------------
  696. m_List1array.ElementAt(iItem).SetAt(9 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(2));
  697. m_List1array.ElementAt(iItem).SetAt(10 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(3));
  698. m_List1array.ElementAt(iItem).SetAt(11 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(4));
  699. #ifdef LKAY_VERSION
  700. m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
  701. m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
  702. m_List1array.ElementAt (iItem).SetAt (14, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
  703. #else
  704. m_List1array.ElementAt(iItem).SetAt(12 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(5));
  705. #endif
  706. #endif
  707. iItem++;
  708. if (iItem >= m_List1array.GetSize())break;
  709. }
  710. }
  711. else
  712. {
  713. while (id == m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd) || m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd).IsEmpty())
  714. {
  715. //name=m_List1array.ElementAt (iItem).ElementAt (7+m_nAdd);
  716. name = m_List1array.ElementAt(iItem).ElementAt(8 + m_nAdd);
  717. for (int i = 0; i < dlg.m_sparray.GetSize(); i++)
  718. {
  719. if (name == dlg.m_sparray.ElementAt(i).ElementAt(0))
  720. {
  721. pos2 = i;
  722. sameproduct++;
  723. // break;
  724. }
  725. }
  726. if (sameproduct > 1)
  727. {
  728. GetData();
  729. FillGrid();
  730. return;
  731. }
  732. #if 0
  733. m_List1array.ElementAt (iItem).SetAt (8+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(2));
  734. m_List1array.ElementAt (iItem).SetAt (9+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(3));
  735. m_List1array.ElementAt (iItem).SetAt (10+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(4));
  736. #ifdef LKAY_VERSION
  737. m_List1array.ElementAt (iItem).SetAt (11, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
  738. m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
  739. m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
  740. #else
  741. m_List1array.ElementAt (iItem).SetAt (11+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
  742. #endif
  743. #else //---------------------------------------------------------------------------------------------
  744. m_List1array.ElementAt(iItem).SetAt(9 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(2));
  745. m_List1array.ElementAt(iItem).SetAt(10 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(3));
  746. m_List1array.ElementAt(iItem).SetAt(11 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(4));
  747. #ifdef LKAY_VERSION
  748. m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
  749. m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
  750. m_List1array.ElementAt (iItem).SetAt (14, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
  751. #else
  752. m_List1array.ElementAt(iItem).SetAt(12 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(5));
  753. #endif
  754. #endif
  755. iItem++;
  756. if (iItem >= m_List1array.GetSize())break;
  757. }
  758. }
  759. FillGrid();
  760. }
  761. void outsourcing::OnRdblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  762. {
  763. OnBUTmodify2();
  764. *pResult = 0;
  765. }
  766. void outsourcing::OnButton2() // 查询完成 按钮(查询齐件)
  767. {
  768. UpdateData();
  769. m_filter.TrimLeft();
  770. m_filter.TrimRight();
  771. FillGrid(1);
  772. }
  773. void outsourcing::OnButton3() // 近期取件 按钮;
  774. {
  775. UpdateData();
  776. m_filter.TrimLeft();
  777. m_filter.TrimRight();
  778. FillGrid(2);
  779. }
  780. void outsourcing::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
  781. {
  782. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
  783. *pResult = 0;
  784. if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
  785. {
  786. *pResult = CDRF_NOTIFYITEMDRAW;
  787. }
  788. else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
  789. {
  790. COLORREF crText;
  791. int pos = pLVCD->nmcd.dwItemSpec;
  792. if (pos % 2)
  793. pLVCD->clrTextBk = g_gridcol1;
  794. else
  795. pLVCD->clrTextBk = g_gridcol2;
  796. while (m_List1.m_arLabels.ElementAt(pos).ElementAt(0).IsEmpty())
  797. {
  798. pos--;
  799. if (pos < 1)break;
  800. }
  801. //if(atoi(m_List1.m_arLabels.ElementAt (pos).ElementAt (18)))
  802. if (atoi(m_List1.m_arLabels.ElementAt(pos).ElementAt(19)))
  803. crText = RGB(220, 0, 0);
  804. else
  805. crText = RGB(20, 133, 20);
  806. pLVCD->clrText = crText;
  807. *pResult = CDRF_DODEFAULT;
  808. }
  809. }
  810. void outsourcing::OnBUTmodify2() // 本月出件;
  811. {
  812. if (IsHasRights2new(13) == 0)return;
  813. outsourcing2 dlg;
  814. dlg.DoModal();
  815. }
  816. void outsourcing::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  817. {
  818. POSITION pos;
  819. pos = m_List1.GetFirstSelectedItemPosition();
  820. if (pos == NULL)
  821. {
  822. return;
  823. }
  824. int iItem = m_List1.GetNextSelectedItem(pos);
  825. g_id = m_List1.GetItemText(iItem, 0);
  826. while (g_id == "")
  827. {
  828. iItem--;
  829. g_id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  830. }
  831. *pResult = 0;
  832. }
  833. void outsourcing::OnBUTburncd()
  834. {
  835. outsourcing3 dlg;
  836. dlg.DoModal();
  837. }
  838. void outsourcing::HidePrice()
  839. {
  840. if (IsHasRights2new(31))return;
  841. for (int i = 0; i < m_List1array.GetSize(); i++)
  842. {
  843. #ifdef LKAY_VERSION
  844. if(!m_List1array.ElementAt (i).ElementAt (16).IsEmpty ())
  845. m_List1array.ElementAt (i).SetAt (16, "***");
  846. if(!m_List1array.ElementAt (i).ElementAt (17).IsEmpty ())
  847. m_List1array.ElementAt (i).SetAt (17, "***");
  848. #else
  849. if (!m_List1array.ElementAt(i).ElementAt(15 + m_nAdd).IsEmpty())
  850. m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
  851. if (!m_List1array.ElementAt(i).ElementAt(16 + m_nAdd).IsEmpty())
  852. m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
  853. #endif
  854. }
  855. }
  856. void outsourcing::OnBUTexport() // 已完成未组 按钮;
  857. {
  858. UpdateData();
  859. m_filter.TrimLeft();
  860. m_filter.TrimRight();
  861. FillGrid(3);
  862. }
  863. void outsourcing::OnBUTToPhotoPrint() // 已组未转 按钮;
  864. {
  865. UpdateData();
  866. m_filter.TrimLeft();
  867. m_filter.TrimRight();
  868. FillGrid(4);
  869. }
  870. void outsourcing::GetData()
  871. {
  872. if (g_bAllBranch == 0)
  873. {
  874. if (g_bShowOK == 0)
  875. {
  876. #ifdef LKAY_VERSION
  877. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  878. #else
  879. CString filter = "status3='未取'";
  880. #endif
  881. g_sendhead.bsql = 0;
  882. g_sendhead.code[0] = 33;
  883. g_sendhead.tabcount = 1;
  884. g_pMainWnd->ProcessChatMessageRequest2(filter);
  885. if (g_bSendOK == 0)return;
  886. }
  887. else
  888. {
  889. g_sendhead.bsql = 0;
  890. g_sendhead.code[0] = 33;
  891. g_sendhead.tabcount = 1;
  892. #ifdef LKAY_VERSION
  893. CString filter="dindantype<>'意向客户' or dindantype is null";
  894. g_pMainWnd->ProcessChatMessageRequest2(filter);
  895. #else
  896. g_pMainWnd->ProcessChatMessageRequest2(1);
  897. #endif
  898. if (g_bSendOK == 0)return;
  899. }
  900. DataToArray(&m_List1array);
  901. }
  902. else
  903. {
  904. //////////////数据汇总;
  905. m_List1array.RemoveAll();
  906. CString branch;
  907. for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
  908. {
  909. if (i != -1)
  910. {
  911. branch = g_brancharray.ElementAt(i).ElementAt(0);
  912. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  913. g_pMainWnd->OnDisconnect();
  914. g_branchname = branch;
  915. g_bBranchModify = 1;
  916. }
  917. else
  918. branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
  919. if (g_bShowOK == 0)
  920. {
  921. CString filter = "status3='未取'";
  922. g_sendhead.bsql = 0;
  923. g_sendhead.code[0] = 33;
  924. g_sendhead.tabcount = 1;
  925. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)continue;
  926. }
  927. else
  928. {
  929. g_sendhead.bsql = 0;
  930. g_sendhead.code[0] = 33;
  931. g_sendhead.tabcount = 1;
  932. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)continue;
  933. }
  934. CArray<CStringArray, CStringArray>List1array;
  935. DataToArray(&List1array);
  936. int size = m_List1array.GetSize();
  937. for (int j = 0; j < List1array.GetSize(); j++)
  938. {
  939. size++;
  940. m_List1array.SetSize(size, 1);
  941. size--;
  942. m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
  943. m_List1array.ElementAt(size).InsertAt(0, branch);
  944. size++;
  945. }
  946. }
  947. g_pMainWnd->OnDisconnect();
  948. g_bBranchModify = 0;
  949. g_branchip = g_branchname = "";
  950. }
  951. HidePrice();
  952. }
  953. void outsourcing::OnBUTburncd2() // 本月返工;
  954. {
  955. outsourcing4 dlg;
  956. dlg.DoModal();
  957. }
  958. void outsourcing::OnBnClickedSendsms() // 发送短信;
  959. {
  960. POSITION pos;
  961. pos = m_List1.GetFirstSelectedItemPosition();
  962. if(pos==NULL)
  963. {
  964. AfxMessageBox(_T("请先选中您要发送短信的会员!"), MB_ICONINFORMATION);
  965. return;
  966. }
  967. int iItem;
  968. CStringArray array;
  969. while (pos)
  970. {
  971. iItem = m_List1.GetNextSelectedItem(pos);
  972. if(!m_List1.GetItemText(iItem, 15 + m_nAdd).IsEmpty())
  973. array.Add (m_List1.GetItemText (iItem, 15 + m_nAdd));
  974. if(!m_List1.GetItemText(iItem, 16 + m_nAdd).IsEmpty())
  975. array.Add (m_List1.GetItemText (iItem, 16 + m_nAdd));
  976. }
  977. SendMsgDlg dlg;
  978. //dlg.m_mode=1;
  979. dlg.m_pArray=&array;
  980. dlg.DoModal();
  981. }
  982. void outsourcing::OnBnClickedPrintbar() // 打印条码;
  983. {
  984. // 1.获取选中行:订单号、顾客名1-2、商品名, 商品AutoId;
  985. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  986. if ( pos == NULL )
  987. {
  988. AfxMessageBox(_T("未选中任何订单商品!"));
  989. return;
  990. }
  991. INT nGoodsCount = 0;
  992. INT nOrderItem = -1;
  993. INT nSelectedItem = 0;
  994. INT nItemCount = m_List1.GetItemCount();
  995. while( pos )
  996. {
  997. BarInfo tagBarInfo;
  998. nSelectedItem = m_List1.GetNextSelectedItem(pos);
  999. if ( m_List1.GetItemText(nSelectedItem, m_nAdd).IsEmpty() )
  1000. {
  1001. if ( nOrderItem == -1 )
  1002. {// 第一个选中项无订单号;// 向上查找订单号;
  1003. nOrderItem = nSelectedItem;
  1004. while( nOrderItem-- )
  1005. {
  1006. if ( !m_List1.GetItemText(nOrderItem, m_nAdd).IsEmpty() )
  1007. break;
  1008. }
  1009. }
  1010. }
  1011. else
  1012. {
  1013. nOrderItem = nSelectedItem;
  1014. }
  1015. tagBarInfo.strOrderNum = m_List1.GetItemText(nOrderItem, m_nAdd);
  1016. tagBarInfo.strCustomer1 = m_List1.GetItemText(nOrderItem, 1 + m_nAdd);
  1017. tagBarInfo.strCustomer2 = m_List1.GetItemText(nOrderItem, 2 + m_nAdd);
  1018. tagBarInfo.strProduct = m_List1.GetItemText(nSelectedItem, 8 + m_nAdd);
  1019. tagBarInfo.strAutoId = m_List1.m_arLabels.ElementAt(nSelectedItem).ElementAt(20);
  1020. // 商品有多少个,就打印多少个; Q1:打印过的,是否不允再打印;
  1021. nGoodsCount = atoi(m_List1.m_arLabels.ElementAt(nSelectedItem).ElementAt(21));
  1022. for (int i = 0; i < nGoodsCount; i++)
  1023. m_vtBarInfo.push_back(tagBarInfo);
  1024. printf(_T("#####\n\t订单号:%s\n\t顾客1:%s\n\t顾客2:%s\n\t商品:%s\n\tAutoId:%s\n#####\n\n"),
  1025. tagBarInfo.strOrderNum,
  1026. tagBarInfo.strCustomer1,
  1027. tagBarInfo.strCustomer2,
  1028. tagBarInfo.strProduct,
  1029. tagBarInfo.strAutoId);
  1030. }
  1031. // 开始打印;
  1032. CPrintRX pter;
  1033. pter.InitToPrint();
  1034. pter.StartPrint();
  1035. vector<BarInfo>::iterator it = m_vtBarInfo.begin();
  1036. for ( ; it != m_vtBarInfo.end(); it++ )
  1037. {
  1038. pter.StartPage();
  1039. pter.DrawBarCode(it->strOrderNum, it->strCustomer1, it->strCustomer2, it->strProduct, it->strAutoId);
  1040. pter.EndPage();
  1041. }
  1042. pter.EndPrint();
  1043. // 打印结束后,清空;
  1044. m_vtBarInfo.clear();
  1045. }
  1046. void outsourcing::OnBnClickedScanbackitem() // 扫描回件;
  1047. {
  1048. CDlgScanBarCode dlg;
  1049. dlg.m_nScanMode = 0;
  1050. dlg.DoModal();
  1051. }
  1052. void outsourcing::OnBnClickedScanpickup() // 扫描取件;
  1053. {
  1054. CDlgScanBarCode dlg;
  1055. dlg.m_nScanMode = 1;
  1056. dlg.DoModal();
  1057. }