outsourcing.cpp 26 KB

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