// outsourcingDlg2.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "outsourcingDlg2.h" #include "SelProvider.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // outsourcingDlg2 outsourcingDlg2::outsourcingDlg2(CWnd* pParent /*=NULL*/) : CDialog(outsourcingDlg2::IDD) { //{{AFX_DATA_INIT(outsourcingDlg2)IDC_COMBOid m_name1 = _T(""); m_name2 = _T(""); m_id = _T(""); m_money1 = _T(""); m_money2 = _T(""); m_money3 = _T(""); //}}AFX_DATA_INIT } void outsourcingDlg2::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(outsourcingDlg2) DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Text(pDX, IDC_EDITname1, m_name1); DDX_Text(pDX, IDC_EDITname2, m_name2); DDX_Text(pDX, IDC_EDITid2, m_id); DDX_Text(pDX, IDC_EDITmoney1, m_money1); DDX_Text(pDX, IDC_EDITmoney2, m_money2); DDX_Text(pDX, IDC_EDITmoney3, m_money3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(outsourcingDlg2, CDialog) //{{AFX_MSG_MAP(outsourcingDlg2) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTget, OnBUTget) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BUTTON4, OnButton4) ON_BN_CLICKED(IDC_BTNdel, OnBTNdel) ON_BN_CLICKED(IDC_BTNdel2, OnBTNdel2) ON_WM_TIMER() ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // outsourcingDlg2 diagnostics ///////////////////////////////////////////////////////////////////////////// // outsourcingDlg2 message handlers BOOL outsourcingDlg2::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_LBUTTONDBLCLK) {//list1 CPoint pt; CRect rc,rc2; ::GetCursorPos (&pt); m_List1.GetWindowRect (rc2); if(rc2.PtInRect (pt)==0) return CDialog::PreTranslateMessage(pMsg); pt.x-=rc2.left ; pt.y-=rc2.top ; int iItem=m_List1.GetItemCount ()-1; if(iItem<0) { m_List1.GetHeaderCtrl()->GetItemRect (0, rc); int hei=rc.Height (); rc.top +=hei; rc.bottom +=hei; if(rc.PtInRect (pt)) { m_List1.InsertItem(m_List1.GetItemCount (), ""); } m_List1.GetHeaderCtrl()->GetItemRect (1, rc); rc.top +=hei; rc.bottom +=hei; if(rc.PtInRect (pt)) { m_List1.InsertItem(m_List1.GetItemCount (), ""); } UpdateZ(); } else { m_List1.GetSubItemRect( iItem, 0, LVIR_BOUNDS, rc); int hei=rc.Height (); rc.top +=hei; rc.bottom +=hei; if(rc.PtInRect (pt)) { if(m_List1.GetItemText (iItem, 0).IsEmpty ()) return CDialog::PreTranslateMessage(pMsg); m_List1.InsertItem(m_List1.GetItemCount (), ""); UpdateZ(); } } } return CDialog::PreTranslateMessage(pMsg); } void outsourcingDlg2::OnBUTclose() // 关闭按钮; { // TODO: Add your control notification handler code here CDialog::OnCancel (); } void outsourcingDlg2::GetData() { // TODO: Add your control notification handler code here if(g_bAllBranch==0) { CString filter="id='"+m_id+"';"; g_sendhead.code[0]=36; g_sendhead.code[1]=9; g_sendhead.tabcount=2; g_sendhead.bsql=0; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; DataToArray(&m_sparray,&g_List1array); } else { g_pMainWnd->OnDisconnect(); g_branchip=GetIP(m_branch); g_pMainWnd->OnDisconnect(); g_branchname=m_branch; g_bBranchModify=1; CString filter="id='"+m_id+"';"; g_sendhead.code[0]=36; g_sendhead.code[1]=9; g_sendhead.tabcount=2; g_sendhead.bsql=0; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; DataToArray(&m_sparray,&g_List1array); } m_List1.DeleteAllItems (); for(int i=0; iSetWindowText("家长姓名:"); GetDlgItem(IDC_STATIC4)->SetWindowText("宝宝姓名:"); #endif // TODO: Add extra initialization here // Here we create the outbar control using the splitter as its parent // and setting its id to the first pane. m_List1.InitStyle(); m_List1.InsertColumn(0,_T("相片名称"),LVCFMT_LEFT,300); m_List1.InsertColumn(1,_T("数量"),LVCFMT_LEFT,60); m_List1.InsertColumn(2,_T("面积"),LVCFMT_LEFT,80); m_List1.InsertColumn(3,_T("是否发出"),LVCFMT_LEFT,115); m_List1.InsertColumn(4,_T("发出日期"),LVCFMT_LEFT,90); #if 1// Jeff。添加 返工,返工日期;(与发件取片一样); m_List1.InsertColumn(5,_T("返工"),LVCFMT_LEFT,90); m_List1.InsertColumn(6,_T("返工日期"),LVCFMT_LEFT,90); m_List1.InsertColumn(7,_T("是否回来"),LVCFMT_LEFT,90); m_List1.InsertColumn(8,_T("回来日期"),LVCFMT_LEFT,90); #else m_List1.InsertColumn(5,_T("是否回来"),LVCFMT_LEFT,90); m_List1.InsertColumn(6,_T("回来日期"),LVCFMT_LEFT,90); #endif GetData(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void outsourcingDlg2::OnOK() // 保存按钮; { // TODO: Add extra validation here m_sparray.RemoveAll (); m_sparray.SetSize(m_List1.GetItemCount ()); int realcount=0; CString str; for(int i=0; iProcessChatMessageRequest2(pData2, length); g_nSendCode=0; delete []pData2; if(g_bSendOK==0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION); CDialog::OnOK(); } void outsourcingDlg2::OnButton1() // 全部发出按钮; { // TODO: Add your control notification handler code here SelProvider dlg; if(dlg.DoModal ()!=IDOK)return; for(int i=0; iGetWidth()) { float area=(img->GetWidth()*img->GetHeight()*0.0254*0.0254)/(img->GetHorizontalResolution()*img->GetHorizontalResolution()); str.Format ("%0.5f", area); m_List1.SetItemText(i, 2, str); delete img; } } if(m_patharray1.GetSize ()==0) AfxMessageBox("此单未导入设计片!", MB_ICONINFORMATION); UpdateZ(); } void outsourcingDlg2::OnBTNdel() // 删除按钮; { // TODO: Add your control notification handler code here POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION); return; } int iItem=m_List1.GetNextSelectedItem(pos); m_List1.DeleteItem (iItem); int count=m_List1.GetItemCount (); if(count==0) { UpdateZ(); return; } if(iItem==count) iItem=0; m_List1.SetItemState (iItem, LVIS_SELECTED, LVIS_SELECTED); UpdateZ(); } void outsourcingDlg2::UpdateZ() { CString str; str.Format ("全部相片名细:%d", m_List1.GetItemCount()); GetDlgItem(IDC_STATIC1)->SetWindowText( str); } void outsourcingDlg2::OnBTNdel2() // 从产品中获取; { // TODO: Add your control notification handler code here if(m_List1.GetItemCount ()) { if(AfxMessageBox("此单已有相片记录, 是否再次获取?", MB_YESNO|MB_ICONSTOP)!=IDYES) return; } int count = m_List1.GetItemCount(); #ifdef CHILD_VERSION CString filter="id='"+m_id+"' and name<>'入册' and name<>'入底'"; #else CString filter="id='"+m_id+"' and kind<>'2' and name<>'入册' and name<>'入底'"; #endif g_sendhead.code[0]=56; // Table is dindansp; g_sendhead.tabcount=1; g_sendhead.bsql=0; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; CArrayList1array; DataToArray(&List1array); for(int i=0; iOnDisconnect(); g_bBranchModify=0;g_branchip=g_branchname=""; } }