123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- // UploadDes.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "UploadDes.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // UploadDes dialog
- UploadDes::UploadDes(CWnd* pParent /*=NULL*/)
- : CDialog(UploadDes::IDD, pParent)
- {
- //{{AFX_DATA_INIT(UploadDes)
- // NOTE: the ClassWizard will add member initialization here
- m_mode=0;
- //}}AFX_DATA_INIT
- }
- void UploadDes::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(UploadDes)
- DDX_Control(pDX, IDC_LIST1, m_list1);
- DDX_Control(pDX, IDC_COMBO2, m_combodes);
- DDX_Control(pDX, IDC_COMBO1, m_combofrom);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(UploadDes, CDialog)
- //{{AFX_MSG_MAP(UploadDes)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // UploadDes message handlers
- BOOL UploadDes::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- m_rule= g_cominfoarray.ElementAt(0).ElementAt(116);
- if(m_mode==0)
- {
- m_header="type0@:";
- SetWindowText("自动传片设置-原片");
- }
- else if(m_mode==1)
- {
- m_header="type1@:";
- SetWindowText("自动传片设置-初修片");
- }
- else if(m_mode==2)
- {
- m_header="type2@:";
- SetWindowText("自动传片设置-精修片");
- }
- else if(m_mode==3)
- {
- m_header="type3@:";
- SetWindowText("自动传片设置-设计片");
- }
- int pos=m_rule.Find (m_header);
- if(pos!=-1)
- {
- m_left=m_rule.Left (pos); //MessageBox(m_left);
- m_rule=m_rule.Right (m_rule.GetLength ()-pos);
- m_rule.Delete (0, m_header.GetLength ());
- pos=m_rule.Find ("@:");
- if(pos!=-1)
- {
- m_right=m_rule.Right (m_rule.GetLength ()-pos+5);//MessageBox(m_right);
- m_rule=m_rule.Left (pos-5);
- }
- m_currule=m_rule;m_rule.Empty ();
- m_currule.TrimLeft ("%$");
- m_currule.TrimRight ("%$");
- if(m_currule.Find ("%$")!=-1)
- {
- pos=m_currule.Find ("%$");
- while(pos!=-1)
- {
- if(m_currule.Left (pos)!="")
- m_list1.AddString(m_currule.Left (pos));
- m_currule=m_currule.Right (m_currule.GetLength ()-pos-2);
- pos=m_currule.Find ("%$");
- }
- }
- if(m_currule!="")m_list1.AddString(m_currule);
- }
- // m_currule
- for(int i=0; i<g_brancharray.GetSize (); i++)
- {
- m_combofrom.AddString (g_brancharray.ElementAt (i).ElementAt (0));
- m_combodes.AddString (g_brancharray.ElementAt (i).ElementAt (0));
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void UploadDes::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- CString str,rule;
- for(int i=0; i<m_list1.GetCount (); i++)
- {
- m_list1.GetText (i, str);
- rule+=str;
- rule+="%$";
- }
- if(rule!="")
- m_rule+=m_header+rule;
- m_rule+=m_left;
- m_rule+=m_right;
- CString sql;
- sql.Format ("update version set [uploadrule]='%s'", m_rule);
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- g_cominfoarray.ElementAt(0).SetAt (116, m_rule);
- CDialog::OnOK();
- }
- void UploadDes::OnButton1()
- {
- // TODO: Add your control notification handler code here
- CString str,from,des;
- int pos=m_combofrom.GetCurSel ();
- if(pos==-1)
- {
- AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
- return;
- }
- m_combofrom.GetLBText (pos, from);
- pos=m_combodes.GetCurSel ();
- if(pos==-1)
- {
- AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
- return;
- }
- m_combodes.GetLBText (pos, des);
- int i = 0;
- for( i=0; i<m_list1.GetCount (); i++)
- {
- m_list1.GetText (i, str);
- if(str==(from+"->"+des) )
- {
- AfxMessageBox("已有此规则!", MB_ICONINFORMATION);
- return;
- }
- }
- for( i=0; i<m_list1.GetCount (); i++)
- {
- m_list1.GetText (i, str);
- if(str.Find (from+"->")!=-1)
- {
- if(AfxMessageBox("警告: 传向多个分店将影响速度, 是否继续?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
- break;
- }
- }
- m_list1.AddString (from+"->"+des);
- }
- //
- void UploadDes::OnButton2()
- {
- // TODO: Add your control notification handler code here
- int pos=m_list1.GetCurSel ();
- if(pos==-1)
- {
- AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
- return;
- }
- m_list1.DeleteString (pos);
- }
|