UploadDes.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. // UploadDes.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "UploadDes.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // UploadDes dialog
  13. UploadDes::UploadDes(CWnd* pParent /*=NULL*/)
  14. : CDialog(UploadDes::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(UploadDes)
  17. // NOTE: the ClassWizard will add member initialization here
  18. m_mode=0;
  19. //}}AFX_DATA_INIT
  20. }
  21. void UploadDes::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(UploadDes)
  25. DDX_Control(pDX, IDC_LIST1, m_list1);
  26. DDX_Control(pDX, IDC_COMBO2, m_combodes);
  27. DDX_Control(pDX, IDC_COMBO1, m_combofrom);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(UploadDes, CDialog)
  31. //{{AFX_MSG_MAP(UploadDes)
  32. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  33. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // UploadDes message handlers
  38. BOOL UploadDes::OnInitDialog()
  39. {
  40. CDialog::OnInitDialog();
  41. // TODO: Add extra initialization here
  42. m_rule= g_cominfoarray.ElementAt(0).ElementAt(116);
  43. if(m_mode==0)
  44. {
  45. m_header="type0@:";
  46. SetWindowText("自动传片设置-原片");
  47. }
  48. else if(m_mode==1)
  49. {
  50. m_header="type1@:";
  51. SetWindowText("自动传片设置-初修片");
  52. }
  53. else if(m_mode==2)
  54. {
  55. m_header="type2@:";
  56. SetWindowText("自动传片设置-精修片");
  57. }
  58. else if(m_mode==3)
  59. {
  60. m_header="type3@:";
  61. SetWindowText("自动传片设置-设计片");
  62. }
  63. int pos=m_rule.Find (m_header);
  64. if(pos!=-1)
  65. {
  66. m_left=m_rule.Left (pos); //MessageBox(m_left);
  67. m_rule=m_rule.Right (m_rule.GetLength ()-pos);
  68. m_rule.Delete (0, m_header.GetLength ());
  69. pos=m_rule.Find ("@:");
  70. if(pos!=-1)
  71. {
  72. m_right=m_rule.Right (m_rule.GetLength ()-pos+5);//MessageBox(m_right);
  73. m_rule=m_rule.Left (pos-5);
  74. }
  75. m_currule=m_rule;m_rule.Empty ();
  76. m_currule.TrimLeft ("%$");
  77. m_currule.TrimRight ("%$");
  78. if(m_currule.Find ("%$")!=-1)
  79. {
  80. pos=m_currule.Find ("%$");
  81. while(pos!=-1)
  82. {
  83. if(m_currule.Left (pos)!="")
  84. m_list1.AddString(m_currule.Left (pos));
  85. m_currule=m_currule.Right (m_currule.GetLength ()-pos-2);
  86. pos=m_currule.Find ("%$");
  87. }
  88. }
  89. if(m_currule!="")m_list1.AddString(m_currule);
  90. }
  91. // m_currule
  92. for(int i=0; i<g_brancharray.GetSize (); i++)
  93. {
  94. m_combofrom.AddString (g_brancharray.ElementAt (i).ElementAt (0));
  95. m_combodes.AddString (g_brancharray.ElementAt (i).ElementAt (0));
  96. }
  97. return TRUE; // return TRUE unless you set the focus to a control
  98. // EXCEPTION: OCX Property Pages should return FALSE
  99. }
  100. void UploadDes::OnOK()
  101. {
  102. // TODO: Add extra validation here
  103. UpdateData();
  104. CString str,rule;
  105. for(int i=0; i<m_list1.GetCount (); i++)
  106. {
  107. m_list1.GetText (i, str);
  108. rule+=str;
  109. rule+="%$";
  110. }
  111. if(rule!="")
  112. m_rule+=m_header+rule;
  113. m_rule+=m_left;
  114. m_rule+=m_right;
  115. CString sql;
  116. sql.Format ("update version set [uploadrule]='%s'", m_rule);
  117. g_sendhead.bsql=1;
  118. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  119. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  120. g_cominfoarray.ElementAt(0).SetAt (116, m_rule);
  121. CDialog::OnOK();
  122. }
  123. void UploadDes::OnButton1()
  124. {
  125. // TODO: Add your control notification handler code here
  126. CString str,from,des;
  127. int pos=m_combofrom.GetCurSel ();
  128. if(pos==-1)
  129. {
  130. AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
  131. return;
  132. }
  133. m_combofrom.GetLBText (pos, from);
  134. pos=m_combodes.GetCurSel ();
  135. if(pos==-1)
  136. {
  137. AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
  138. return;
  139. }
  140. m_combodes.GetLBText (pos, des);
  141. int i = 0;
  142. for( i=0; i<m_list1.GetCount (); i++)
  143. {
  144. m_list1.GetText (i, str);
  145. if(str==(from+"->"+des) )
  146. {
  147. AfxMessageBox("已有此规则!", MB_ICONINFORMATION);
  148. return;
  149. }
  150. }
  151. for( i=0; i<m_list1.GetCount (); i++)
  152. {
  153. m_list1.GetText (i, str);
  154. if(str.Find (from+"->")!=-1)
  155. {
  156. if(AfxMessageBox("警告: 传向多个分店将影响速度, 是否继续?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  157. break;
  158. }
  159. }
  160. m_list1.AddString (from+"->"+des);
  161. }
  162. //
  163. void UploadDes::OnButton2()
  164. {
  165. // TODO: Add your control notification handler code here
  166. int pos=m_list1.GetCurSel ();
  167. if(pos==-1)
  168. {
  169. AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
  170. return;
  171. }
  172. m_list1.DeleteString (pos);
  173. }