1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138 |
- // outsourcing.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "outsourcing.h"
- #include "MyMdi.H"
- #include "ModifyDinDan.h"
- #include "outsourcingDlg.h"
- #include "outsourcingDlg2.h"
- #include "outsourcing2.h"
- #include "outsourcing3.h"
- #include "outsourcing4.h"
- #include "DlgScanBarCode.h"
- #include "SendMsgDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #pragma comment(lib, "Shlwapi.lib")
- IMPLEMENT_DYNCREATE(outsourcing, MyFormView)
- outsourcing::outsourcing() : MyFormView(outsourcing::IDD)
- {
- m_filter = _T(""); m_nAdd = 0;
- if (g_bAllBranch)
- {
- m_nAdd = 1;
- }
- }
- outsourcing::~outsourcing()
- {
- }
- void outsourcing::DoDataExchange(CDataExchange* pDX)
- {
- MyFormView::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_COMBO1, m_combo1);
- DDX_Control(pDX, IDC_LIST2, m_List1);
- DDX_Control(pDX, IDC_STATIC1, m_static1);
- DDX_CBString(pDX, IDC_COMBO1, m_filter);
- }
- BEGIN_MESSAGE_MAP(outsourcing, MyFormView)
- ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
- ON_WM_TIMER()
- ON_BN_CLICKED(IDC_BUTmodify, OnBUTmodify)
- ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
- ON_BN_CLICKED(IDC_BUTexport, OnBUTexport)
- ON_BN_CLICKED(IDC_BUTmodify2, OnBUTmodify2)
- ON_NOTIFY(NM_RDBLCLK, IDC_LIST2, OnRdblclkList2)
- ON_BN_CLICKED(IDC_BUTToPhotoPrint, OnBUTToPhotoPrint)
- ON_BN_CLICKED(IDC_BUTburncd, OnBUTburncd)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
- ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
- ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
- #ifdef VC60
- ON_BN_CLICKED(BTN_SENDSMS, OnBnClickedSendsms)
- ON_BN_CLICKED(BTN_PRINTBAR, OnBnClickedPrintbar)
- ON_BN_CLICKED(BTN_SCANBACKITEM, OnBnClickedScanbackitem)
- ON_BN_CLICKED(BTN_SCANPICKUP, OnBnClickedScanpickup)
- #else
- ON_BN_CLICKED(BTN_SENDSMS, &outsourcing::OnBnClickedSendsms)
- ON_BN_CLICKED(BTN_PRINTBAR, &outsourcing::OnBnClickedPrintbar)
- ON_BN_CLICKED(BTN_SCANBACKITEM, &outsourcing::OnBnClickedScanbackitem)
- ON_BN_CLICKED(BTN_SCANPICKUP, &outsourcing::OnBnClickedScanpickup)
- #endif
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- #ifdef _DEBUG
- void outsourcing::AssertValid() const
- {
- MyFormView::AssertValid();
- }
- void outsourcing::Dump(CDumpContext& dc) const
- {
- MyFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- void outsourcing::OnInitialUpdate()
- {
- MyFormView::OnInitialUpdate();
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
- EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
- #ifdef LKAY_VERSION
- GetDlgItem(IDC_BUTexport)->ShowWindow(SW_SHOW);
- GetDlgItem(IDC_BUTToPhotoPrint)->ShowWindow(SW_SHOW);
- #endif
- int btnwid;
- CRect prerc;
- int idcount = 5;
- {
- int idarray[] = { IDC_BUTmodify, IDC_BUTmodify2, IDC_BUTburncd, IDC_BUTburncd2, IDC_BUTclose };
- idcount = 5;
- for (int a = idcount - 2; a >= 0; a--)
- {
- GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
- ScreenToClient(prerc);
- GetDlgItem(idarray[a])->GetWindowRect(rc2);
- ScreenToClient(rc2);
- btnwid = rc2.Width();
- rc2.right = prerc.left;
- rc2.left = rc2.right - btnwid;
- GetDlgItem(idarray[a])->MoveWindow(rc2);
- }
- }
- int idarray2[] = { IDC_BUTTON1, IDC_BUTTON2, IDC_BUTTON3, IDC_BUTexport, IDC_BUTToPhotoPrint };
- idcount = 5;
- for (int a = 1; a < idcount; a++)
- {
- GetDlgItem(idarray2[a - 1])->GetWindowRect(prerc);
- ScreenToClient(prerc);
- GetDlgItem(idarray2[a])->GetWindowRect(rc2);
- ScreenToClient(rc2);
- btnwid = rc2.Width();
- rc2.left = prerc.right;
- rc2.right = rc2.left + btnwid;
- GetDlgItem(idarray2[a])->MoveWindow(rc2);
- }
- m_static1.SetFont(&g_titlefont);
- if (g_bAllBranch == 0)
- {
- #ifdef CHILD_VERSION // Jeff.设计后添加设计师;
- #ifdef LKAY_VERSION
- m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否组件,100;是否转走,100;是否取走,100;加急,100;取件日期,100;手机,100;固定电话,100" );
- #else // 17.column
- m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;手机,100;固定电话,100");
- #endif
- #else
- m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;男宾电话,100;女宾电话,100" );
- #endif
- m_List1.LoadColumnInfo(121);
- }
- else
- {
- #ifdef CHILD_VERSION
- m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;手机,100;固定电话,100");
- #else
- m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;男宾电话,100;女宾电话,100" );
- #endif
- m_List1.LoadColumnInfo(305);
- }
- #if JEFF_DELETE_OFF // 多产品时排序有问题;
- m_List1.m_bSortSupport = 0;
- #endif
- GetData();
- for (int i = 0; i < g_userarray.GetSize(); i++)
- {
- m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
- }
- FillGrid();
- m_combo1.GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.bottom += 200;
- m_combo1.MoveWindow(rc2);
- GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
- SetComboHei(&m_combo1, rc2.Height());
- GetDlgItem(IDC_BUTmodify)->EnableWindow(IsHasRights2new(13));
- GetDlgItem(IDC_BUTmodify2)->EnableWindow(IsHasRights2new(13));
- }
- void outsourcing::FillGrid(BOOL bStatus)
- {
- m_List1.DeleteAllItems2();
- int ii = 0;
- m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
- int count = 0;
- if (m_filter.IsEmpty() || bStatus)
- {
- if (bStatus == 2) // 近期取件;
- {
- CTime tm(atoi(g_date.Mid(0, 4)), atoi(g_date.Mid(5, 2)), atoi(g_date.Mid(8, 2)), 0, 0, 0);
- CString sdate1, sdate2;
- sdate1 = tm.Format("%Y-%m-%d");
- CTimeSpan sp(15, 0, 0, 0);
- tm += sp;
- sdate2 = tm.Format("%Y-%m-%d");
- BOOL bFinded = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
- // 订单号;
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- begin = ii;
- continue;
- }
- 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))
- {
- end = ii - 1;
- bFinded = 0;
- for (int a = begin; a <= end; a++)
- {
- // 查询条件== 整个订单取件日期 || 单个商品取件日期
- 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))
- {
- bFinded = 1;
- break;
- }
- }
- if (bFinded == 1)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- }
- }
- }
- else if (bStatus == 1) // 查询完成;
- {
- {BOOL bFinded = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- begin = ii;
- continue;
- }
- 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))
- {
- end = ii - 1;
- bFinded = 0;
- for (int a = begin; a <= end; a++)
- {
- // 查询条件==产品完成;
- if (m_List1array.ElementAt(a).ElementAt(11 + m_nAdd) != "OK")
- {
- bFinded = 1;
- break;
- }
- }
- if (bFinded == 0)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- }
- }
- }
- }
- else if (bStatus == 3)//已完成未取;
- {
- {BOOL bFinded = 0; BOOL bFinded2 = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- begin = ii;
- continue;
- }
- if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0) != "" && m_List1array.ElementAt(ii).ElementAt(0) != oldid))
- {
- end = ii - 1;
- bFinded = 0; bFinded2 = 0;
- for (int a = begin; a <= end; a++)
- {
- // 查询条件==产品未完成;
- if (m_List1array.ElementAt(a).ElementAt(11) != "OK")
- {
- bFinded = 1;
- break;
- }
- // 查询条件==未取走;
- if (m_List1array.ElementAt(a).ElementAt(12) != "OK")
- {
- bFinded2 = 1;
- }
- }
- if (bFinded == 0 && bFinded2)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- }
- }
- }
- }
- else if (bStatus == 4)//已取未转入历史订单;
- {
- BOOL bFinded = 0;
- BOOL bFinded2 = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- begin = ii;
- continue;
- }
- if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0) != "" && m_List1array.ElementAt(ii).ElementAt(0) != oldid))
- {
- end = ii - 1;
- bFinded = 0; bFinded2 = 0;
- for (int a = begin; a <= end; a++)
- {
- // 查询条件==未取走;
- if (m_List1array.ElementAt(a).ElementAt(12) != "OK")
- {
- bFinded = 1;
- break;
- }
- // 查询条件==未加急;
- if (m_List1array.ElementAt(a).ElementAt(13) != "OK")
- {
- bFinded2 = 1;
- }
- }
- if (bFinded == 0 && bFinded2)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- }
- }
- }
- else
- {
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else
- {
- int nAdd = 0;
- #ifdef LKAY_VERSION
- nAdd=2;
- #endif
- int type = GetType(m_filter);
- if (type == 1)//电话;
- {
- BOOL bFinded = 0;
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- continue;
- }
- // 查询条件==手机1||手机2;
- 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)
- {
- bFinded = 1;
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- else
- {
- bFinded = 0;
- }
- }
- }
- else if (type == 2)//拼音;
- {
- BOOL bFinded = 0;
- m_filter.MakeUpper();
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- continue;
- }
- // 查询条件==拼音1||拼音2;
- 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)
- {
- bFinded = 1;
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- else
- {
- bFinded = 0;
- }
- }
- }
- else
- {
- BOOL bFinded = 0;
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- continue;
- }
- // 查询条件==订单号、男名、女名、接单人、手机1、手机2、拼音1、拼音2 ;
- if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(1 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(2 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(15 + nAdd + m_nAdd).Find(m_filter) != -1
- || 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
- || m_List1array.ElementAt(ii).ElementAt(18 + nAdd + m_nAdd).Find(m_filter) != -1
- )
- {
- bFinded = 1;
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- else
- {
- bFinded = 0;
- }
- }
- }
- }
- m_List1.m_arLabels.SetSize(count, 1);
- ii = count;
- m_List1.m_LabelCount = ii;
- m_List1.SetItemCountEx(ii);
- CString str;
- str.Format("单数:%d", ii);
- SetDlgItemText(IDC_STATIC2, str);
- if (!g_id.IsEmpty())
- {
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- if (g_id == m_List1.GetItemText(i, 0 + m_nAdd))
- {
- m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
- m_List1.EnsureVisible(i, FALSE);
- break;
- }
- }
- }
- }
- void outsourcing::OnBUTclose()
- {
- GetParent()->SendMessage(WM_CLOSE);
- }
- void outsourcing::OnButton1() // 查询 按钮;
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid();
- }
- void outsourcing::OnSelchangeCombo1()
- {
- SetTimer(1, 100, NULL);
- }
- void outsourcing::OnTimer(UINT nIDEvent)
- {
- KillTimer(nIDEvent);
- OnButton1();
- }
- BOOL outsourcing::PreTranslateMessage(MSG* pMsg)
- {
- try
- {
- if (pMsg->message == WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_RETURN:
- OnButton1();
- return 1;
- case 0x43: // copy
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56: //Ctrl + V:
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58: // cut
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A: //undo
- case 0x59: //redo
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
- /* else if(pMsg->message==WM_LBUTTONDOWN)
- {
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List1.GetWindowRect (rc2);
- pt.x-=rc2.left ;
- pt.y-=rc2.top ;
- m_List1.GetHeaderCtrl()->GetItemRect (0, rc);
- rc.right =rc.left +rc2.Width ();
- if(rc.PtInRect (pt))
- return 1;
- }*/
- return MyFormView::PreTranslateMessage(pMsg);
- }
- catch (...)
- {
- }
- return TRUE;
- }
- //-----------------------------------------------------------------
- // remark by Jeff 2014-12-12
- // 函数:GetNo
- // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
- // 参数:
- // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
- // array:空的数组,用来存放解析后的相片名;
- // 返回:
- // 注意:更换分隔符造成的问题,在该函数已解决;
- //-----------------------------------------------------------------
- void outsourcing::GetNo(CString str, CStringArray &array)
- {
- if (!str.IsEmpty())
- {
- #ifdef USE_SEP_VEB
- int pos = str.Find(SEPS_VEB);
- #else
- int pos = str.Find(",");
- #endif
- while (pos != -1)
- {
- array.Add(str.Left(pos));
- str = str.Right(str.GetLength() - pos - 1);
- #ifdef USE_SEP_VEB
- pos = str.Find(SEPS_VEB);
- #else
- pos = str.Find(",");
- #endif
- }
- array.Add(str);
- }
- }
- extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
- /*{
- switch(msg)
- {
- case BFFM_INITIALIZED:
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
- break;
- case BFFM_SELCHANGED:
- {
- char szFileName[MAX_PATH];
- LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
- SHGetPathFromIDList(pidlCurrent, szFileName);
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
- }
- break;
- }
- return 0;
- }*/
- void outsourcing::GetSavePath(CString &path)
- {
- char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
- LPITEMIDLIST pidlDesktop, pidlCurrent;
- if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
- == NOERROR)
- {
- BROWSEINFO bi;
- bi.hwndOwner = this->m_hWnd;
- bi.pidlRoot = pidlDesktop;
- bi.pszDisplayName = lpszDisplayName;
- bi.lpszTitle = "\n文档保存的目录:";
- bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
- bi.lpfn = BrowseProc;
- bi.lParam = 0;
- bi.iImage = 0;
- pidlCurrent = SHBrowseForFolder(&bi);
- SHGetPathFromIDList(pidlCurrent, szFileName);
- path = szFileName;
- }
- }
- int outsourcing::FindArray(CStringArray *pArray, CString *pStr)
- {
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- if (pArray->ElementAt(i) == *pStr)
- return i;
- }
- return -1;
- }
- void outsourcing::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- OnBUTmodify();
- *pResult = 0;
- }
- void outsourcing::OnBUTmodify() // 发件取件资料按钮;
- {
- if (IsHasRights2new(13) == 0)return;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString branch;
- CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- if (g_bAllBranch)
- branch = m_List1.GetItemText(iItem, 0);
- while (id == "")
- {
- iItem--;
- id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- }
- outsourcingDlg dlg;
- dlg.m_branch = branch;
- dlg.m_id = id;
- dlg.m_name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
- dlg.m_name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
- if (dlg.DoModal() != IDOK)
- return;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (id == m_List1array.ElementAt(i).ElementAt(0 + m_nAdd))
- {
- iItem = i;
- break;
- }
- }
- int pos2;
- CString name;
- int sameproduct = 0;
- if (g_bAllBranch)
- {
- 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()))
- {
- //name=m_List1array.ElementAt (iItem).ElementAt (7+m_nAdd); // Jeff.
- name = m_List1array.ElementAt(iItem).ElementAt(8 + m_nAdd);
- for (int i = 0; i < dlg.m_sparray.GetSize(); i++)
- {
- if (name == dlg.m_sparray.ElementAt(i).ElementAt(0))
- {
- pos2 = i;
- sameproduct++;
- // break;
- }
- }
- if (sameproduct > 1)
- {
- GetData();
- FillGrid();
- return;
- }
- #if 0
- m_List1array.ElementAt (iItem).SetAt (8+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(2));
- m_List1array.ElementAt (iItem).SetAt (9+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(3));
- m_List1array.ElementAt (iItem).SetAt (10+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (11, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt (iItem).SetAt (11+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #endif
- #else //-----------------------------------------------------------------------------------------------------------
- m_List1array.ElementAt(iItem).SetAt(9 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(2));
- m_List1array.ElementAt(iItem).SetAt(10 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(3));
- m_List1array.ElementAt(iItem).SetAt(11 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (14, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt(iItem).SetAt(12 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(5));
- #endif
- #endif
- iItem++;
- if (iItem >= m_List1array.GetSize())break;
- }
- }
- else
- {
- while (id == m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd) || m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd).IsEmpty())
- {
- //name=m_List1array.ElementAt (iItem).ElementAt (7+m_nAdd);
- name = m_List1array.ElementAt(iItem).ElementAt(8 + m_nAdd);
- for (int i = 0; i < dlg.m_sparray.GetSize(); i++)
- {
- if (name == dlg.m_sparray.ElementAt(i).ElementAt(0))
- {
- pos2 = i;
- sameproduct++;
- // break;
- }
- }
- if (sameproduct > 1)
- {
- GetData();
- FillGrid();
- return;
- }
- #if 0
- m_List1array.ElementAt (iItem).SetAt (8+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(2));
- m_List1array.ElementAt (iItem).SetAt (9+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(3));
- m_List1array.ElementAt (iItem).SetAt (10+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (11, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt (iItem).SetAt (11+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #endif
- #else //---------------------------------------------------------------------------------------------
- m_List1array.ElementAt(iItem).SetAt(9 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(2));
- m_List1array.ElementAt(iItem).SetAt(10 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(3));
- m_List1array.ElementAt(iItem).SetAt(11 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (14, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt(iItem).SetAt(12 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(5));
- #endif
- #endif
- iItem++;
- if (iItem >= m_List1array.GetSize())break;
- }
- }
- FillGrid();
- }
- void outsourcing::OnRdblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- OnBUTmodify2();
- *pResult = 0;
- }
- void outsourcing::OnButton2() // 查询完成 按钮(查询齐件)
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(1);
- }
- void outsourcing::OnButton3() // 近期取件 按钮;
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(2);
- }
- void outsourcing::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
- *pResult = 0;
- if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
- {
- *pResult = CDRF_NOTIFYITEMDRAW;
- }
- else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
- {
- COLORREF crText;
- int pos = pLVCD->nmcd.dwItemSpec;
- if (pos % 2)
- pLVCD->clrTextBk = g_gridcol1;
- else
- pLVCD->clrTextBk = g_gridcol2;
- while (m_List1.m_arLabels.ElementAt(pos).ElementAt(0).IsEmpty())
- {
- pos--;
- if (pos < 1)break;
- }
- //if(atoi(m_List1.m_arLabels.ElementAt (pos).ElementAt (18)))
- if (atoi(m_List1.m_arLabels.ElementAt(pos).ElementAt(19)))
- crText = RGB(220, 0, 0);
- else
- crText = RGB(20, 133, 20);
- pLVCD->clrText = crText;
- *pResult = CDRF_DODEFAULT;
- }
- }
- void outsourcing::OnBUTmodify2() // 本月出件;
- {
- if (IsHasRights2new(13) == 0)return;
- outsourcing2 dlg;
- dlg.DoModal();
- }
- void outsourcing::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- g_id = m_List1.GetItemText(iItem, 0);
- while (g_id == "")
- {
- iItem--;
- g_id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- }
- *pResult = 0;
- }
- void outsourcing::OnBUTburncd()
- {
- outsourcing3 dlg;
- dlg.DoModal();
- }
- void outsourcing::HidePrice()
- {
- if (IsHasRights2new(31))return;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- #ifdef LKAY_VERSION
- if(!m_List1array.ElementAt (i).ElementAt (16).IsEmpty ())
- m_List1array.ElementAt (i).SetAt (16, "***");
- if(!m_List1array.ElementAt (i).ElementAt (17).IsEmpty ())
- m_List1array.ElementAt (i).SetAt (17, "***");
- #else
- if (!m_List1array.ElementAt(i).ElementAt(15 + m_nAdd).IsEmpty())
- m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
- if (!m_List1array.ElementAt(i).ElementAt(16 + m_nAdd).IsEmpty())
- m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
- #endif
- }
- }
- void outsourcing::OnBUTexport() // 已完成未组 按钮;
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(3);
- }
- void outsourcing::OnBUTToPhotoPrint() // 已组未转 按钮;
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(4);
- }
- void outsourcing::GetData()
- {
- if (g_bAllBranch == 0)
- {
- if (g_bShowOK == 0)
- {
- #ifdef LKAY_VERSION
- CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
- #else
- CString filter = "status3='未取'";
- #endif
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 33;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 33;
- g_sendhead.tabcount = 1;
- #ifdef LKAY_VERSION
- CString filter="dindantype<>'意向客户' or dindantype is null";
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- #else
- g_pMainWnd->ProcessChatMessageRequest2(1);
- #endif
- if (g_bSendOK == 0)return;
- }
- DataToArray(&m_List1array);
- }
- else
- {
- //////////////数据汇总;
- m_List1array.RemoveAll();
- CString branch;
- for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
- {
- if (i != -1)
- {
- branch = g_brancharray.ElementAt(i).ElementAt(0);
- g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- }
- else
- branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
- if (g_bShowOK == 0)
- {
- CString filter = "status3='未取'";
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 33;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)continue;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 33;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)continue;
- }
- CArray<CStringArray, CStringArray>List1array;
- DataToArray(&List1array);
- int size = m_List1array.GetSize();
- for (int j = 0; j < List1array.GetSize(); j++)
- {
- size++;
- m_List1array.SetSize(size, 1);
- size--;
- m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
- m_List1array.ElementAt(size).InsertAt(0, branch);
- size++;
- }
- }
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- HidePrice();
- }
- void outsourcing::OnBUTburncd2() // 本月返工;
- {
- outsourcing4 dlg;
- dlg.DoModal();
- }
- void outsourcing::OnBnClickedSendsms() // 发送短信;
- {
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox(_T("请先选中您要发送短信的会员!"), MB_ICONINFORMATION);
- return;
- }
- int iItem;
- CStringArray array;
- while (pos)
- {
- iItem = m_List1.GetNextSelectedItem(pos);
- if(!m_List1.GetItemText(iItem, 15 + m_nAdd).IsEmpty())
- array.Add (m_List1.GetItemText (iItem, 15 + m_nAdd));
- if(!m_List1.GetItemText(iItem, 16 + m_nAdd).IsEmpty())
- array.Add (m_List1.GetItemText (iItem, 16 + m_nAdd));
- }
- SendMsgDlg dlg;
- //dlg.m_mode=1;
- dlg.m_pArray=&array;
- dlg.DoModal();
- }
- void outsourcing::OnBnClickedPrintbar() // 打印条码;
- {
- // 1.获取选中行:订单号、顾客名1-2、商品名, 商品AutoId;
- POSITION pos = m_List1.GetFirstSelectedItemPosition();
- if ( pos == NULL )
- {
- AfxMessageBox(_T("未选中任何订单商品!"));
- return;
- }
- INT nGoodsCount = 0;
- INT nOrderItem = -1;
- INT nSelectedItem = 0;
- INT nItemCount = m_List1.GetItemCount();
-
- while( pos )
- {
- BarInfo tagBarInfo;
- nSelectedItem = m_List1.GetNextSelectedItem(pos);
- if ( m_List1.GetItemText(nSelectedItem, m_nAdd).IsEmpty() )
- {
- if ( nOrderItem == -1 )
- {// 第一个选中项无订单号;// 向上查找订单号;
- nOrderItem = nSelectedItem;
- while( nOrderItem-- )
- {
- if ( !m_List1.GetItemText(nOrderItem, m_nAdd).IsEmpty() )
- break;
- }
- }
- }
- else
- {
- nOrderItem = nSelectedItem;
- }
- tagBarInfo.strOrderNum = m_List1.GetItemText(nOrderItem, m_nAdd);
- tagBarInfo.strCustomer1 = m_List1.GetItemText(nOrderItem, 1 + m_nAdd);
- tagBarInfo.strCustomer2 = m_List1.GetItemText(nOrderItem, 2 + m_nAdd);
- tagBarInfo.strProduct = m_List1.GetItemText(nSelectedItem, 8 + m_nAdd);
- tagBarInfo.strAutoId = m_List1.m_arLabels.ElementAt(nSelectedItem).ElementAt(20);
-
- // 商品有多少个,就打印多少个; Q1:打印过的,是否不允再打印;
- nGoodsCount = atoi(m_List1.m_arLabels.ElementAt(nSelectedItem).ElementAt(21));
- for (int i = 0; i < nGoodsCount; i++)
- m_vtBarInfo.push_back(tagBarInfo);
- printf(_T("#####\n\t订单号:%s\n\t顾客1:%s\n\t顾客2:%s\n\t商品:%s\n\tAutoId:%s\n#####\n\n"),
- tagBarInfo.strOrderNum,
- tagBarInfo.strCustomer1,
- tagBarInfo.strCustomer2,
- tagBarInfo.strProduct,
- tagBarInfo.strAutoId);
- }
- // 开始打印;
- CPrintRX pter;
- pter.InitToPrint();
- pter.StartPrint();
- vector<BarInfo>::iterator it = m_vtBarInfo.begin();
- for ( ; it != m_vtBarInfo.end(); it++ )
- {
- pter.StartPage();
- pter.DrawBarCode(it->strOrderNum, it->strCustomer1, it->strCustomer2, it->strProduct, it->strAutoId);
- pter.EndPage();
- }
- pter.EndPrint();
- // 打印结束后,清空;
- m_vtBarInfo.clear();
- }
- void outsourcing::OnBnClickedScanbackitem() // 扫描回件;
- {
- CDlgScanBarCode dlg;
- dlg.m_nScanMode = 0;
- dlg.DoModal();
- }
- void outsourcing::OnBnClickedScanpickup() // 扫描取件;
- {
- CDlgScanBarCode dlg;
- dlg.m_nScanMode = 1;
- dlg.DoModal();
- }
|