outsourcing.cpp 26 KB

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