CustomerRule.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Data;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using UAS_LabelMachine.Entity;
  6. using UAS_LabelMachine.PublicMethod;
  7. namespace UAS_LabelMachine
  8. {
  9. public partial class CustomerRule : Form
  10. {
  11. AutoSizeFormClass asc = new AutoSizeFormClass();
  12. DataHelper dh;
  13. StringBuilder sql = new StringBuilder();
  14. DataTable dt;
  15. string CUCODE = "";
  16. public CustomerRule()
  17. {
  18. InitializeComponent();
  19. }
  20. private void CustomerRule_Load(object sender, EventArgs e)
  21. {
  22. asc.controllInitializeSize(this);
  23. dh = SystemInf.dh;
  24. dt = (DataTable)dh.ExecuteSql("select cu_name,cu_code from customer where rownum<500 and cu_auditstatuscode<>'DISABLE'", "select");
  25. for (int i = 0; i < dt.Rows.Count; i++)
  26. {
  27. TreeNode node = new TreeNode(dt.Rows[i]["cu_name"].ToString());
  28. node.Tag = dt.Rows[i]["cu_code"].ToString();
  29. CustomerTreeView.Nodes.Add(node);
  30. }
  31. }
  32. private void CustomerRule_SizeChanged(object sender, EventArgs e)
  33. {
  34. asc.controlAutoSize(this);
  35. }
  36. private void CustomerTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  37. {
  38. //点中根节点的时候查询品牌下的采集方案
  39. if (e.Node.Level == 0)
  40. {
  41. CUCODE = e.Node.Tag.ToString();
  42. sql.Clear();
  43. sql.Append("select cu_print_midlotno,cu_print_midspec,cu_print_dateformat,nvl(cu_print_limiteddate,0)cu_print_limiteddate,cu_print_checkdatecode,cu_print_recheck,cu_print_midpo,cu_print_midprod,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
  44. sql.Append(",cu_print_outprod,cu_print_checkonly,nvl(cu_print_papercount,0)cu_print_papercount,cu_print_regexpression from customer where cu_code='" + e.Node.Tag + "'");
  45. dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
  46. if (dt.Rows.Count > 0)
  47. {
  48. BaseUtil.SetFormValue(this.Controls, dt);
  49. }
  50. }
  51. }
  52. private void ButtonSaveScanGroup_Click(object sender, EventArgs e)
  53. {
  54. sql.Clear();
  55. sql.Append("update customer set cu_print_midspec='" + (cu_print_midspec.Checked ? -1 : 0) + "',");
  56. sql.Append("cu_print_midpo='" + (cu_print_midpo.Checked ? -1 : 0) + "',");
  57. sql.Append("cu_print_midprod='" + (cu_print_midprod.Checked ? -1 : 0) + "' ");
  58. sql.Append("where cu_code='" + CUCODE + "'");
  59. dh.ExecuteSql(sql.ToString(), "update");
  60. MessageBox.Show("保存成功!", "提示");
  61. }
  62. /// <summary>
  63. /// 模糊搜索功能
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void Brand_KeyDown(object sender, KeyEventArgs e)
  68. {
  69. if (e.KeyCode == Keys.Enter)
  70. {
  71. if (Customer.Text != "")
  72. dt = (DataTable)dh.ExecuteSql("select cu_name,cu_code from customer where (cu_name like '%" + Customer.Text + "%' or cu_code like '%" + Customer.Text + "%') and cu_auditstatuscode<>'DISABLE'", "select");
  73. else
  74. dt = (DataTable)dh.ExecuteSql("select cu_name,cu_code from customer where rownum<500 and cu_auditstatuscode<>'DISABLE'", "select");
  75. CustomerTreeView.Nodes.Clear();
  76. for (int i = 0; i < dt.Rows.Count; i++)
  77. {
  78. TreeNode node = new TreeNode(dt.Rows[i]["cu_name"].ToString());
  79. node.Tag = dt.Rows[i]["cu_code"].ToString();
  80. CustomerTreeView.Nodes.Add(node);
  81. }
  82. }
  83. }
  84. private void Equal_CheckedChanged(object sender, EventArgs e)
  85. {
  86. }
  87. private void DateFormat_CheckedChanged(object sender, EventArgs e)
  88. {
  89. Control ctl = sender as Control;
  90. }
  91. }
  92. }