SnCollectionBox.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using UAS_MES.Entity;
  10. using UAS_MES.DataOperate;
  11. namespace UAS_MES.CustomControl.TextBoxWithIcon
  12. {
  13. public partial class SnCollectionBox : EnterTextBox
  14. {
  15. public SnCollectionBox()
  16. {
  17. InitializeComponent();
  18. }
  19. DataHelper dh = SystemInf.dh;
  20. public override string Text
  21. {
  22. get
  23. {
  24. if (SystemInf.GetRelation&&base.Text!="")
  25. {
  26. string sn = dh.getFieldDataByCondition("SNRELATION_VIEW", "sr_sn", "content like '%"+base.Text+"%'").ToString();
  27. int count = int.Parse(dh.getFieldDataByCondition("SNRELATION_VIEW", "count(1) cn", "content like '%" + base.Text + "%'").ToString());
  28. if (sn == ""||count>1)
  29. {
  30. MessageBox.Show("SN:" + base.Text + "未找到关联信息");
  31. return "";
  32. }
  33. else
  34. {
  35. if (SystemInf.UpperCollection)
  36. return sn.ToUpper();
  37. else
  38. return sn;
  39. }
  40. }
  41. else
  42. {
  43. if (SystemInf.UpperCollection)
  44. return base.Text.ToUpper();
  45. else
  46. return base.Text;
  47. }
  48. }
  49. set
  50. {
  51. base.Text = value;
  52. }
  53. }
  54. private void SnCollectionBox_KeyDown(object sender, KeyEventArgs e)
  55. {
  56. if (e.KeyCode == Keys.Enter)
  57. {
  58. this.SelectAll();
  59. }
  60. }
  61. }
  62. }