SnCollectionBox.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. if (sn == "")
  28. {
  29. MessageBox.Show("SN:" + base.Text + "未找到关联信息");
  30. return "";
  31. }
  32. else
  33. {
  34. if (SystemInf.UpperCollection)
  35. return sn.ToUpper();
  36. else
  37. return sn;
  38. }
  39. }
  40. else
  41. {
  42. if (SystemInf.UpperCollection)
  43. return base.Text.ToUpper();
  44. else
  45. return base.Text;
  46. }
  47. }
  48. set
  49. {
  50. base.Text = value;
  51. }
  52. }
  53. private void SnCollectionBox_KeyDown(object sender, KeyEventArgs e)
  54. {
  55. if (e.KeyCode == Keys.Enter)
  56. {
  57. this.SelectAll();
  58. }
  59. }
  60. }
  61. }