LockCheckBox.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_NEW.PublicMethod;
  10. using UAS_MES_NEW.CustomControl.TextBoxWithIcon;
  11. namespace UAS_MES_NEW.CustomControl.CustomCheckBox
  12. {
  13. public partial class LockCheckBox : CheckBox
  14. {
  15. /// <summary>
  16. /// 存放工单的控件
  17. /// </summary>
  18. MaCodeSearchTextBox MaCtl;
  19. bool LeaveEvent1;
  20. public bool LeaveEvent
  21. {
  22. get
  23. {
  24. return LeaveEvent1;
  25. }
  26. set
  27. {
  28. LeaveEvent1 = value;
  29. }
  30. }
  31. public LockCheckBox()
  32. {
  33. InitializeComponent();
  34. }
  35. public void GetMakeCodeCtl(MaCodeSearchTextBox ctl)
  36. {
  37. MaCtl = ctl;
  38. }
  39. private void LockCheckBox_CheckStateChanged(object sender, EventArgs e)
  40. {
  41. if (Checked)
  42. {
  43. if (MaCtl.Text != "")
  44. {
  45. string ErrorMessage;
  46. if (LogicHandler.CheckMakeStatus(MaCtl.Text, out ErrorMessage))
  47. MaCtl.Enabled = false;
  48. else
  49. {
  50. Checked = false;
  51. MaCtl.Text = "";
  52. BaseUtil.ShowError(ErrorMessage);
  53. }
  54. }
  55. else
  56. {
  57. Checked = false;
  58. MaCtl.Text = "";
  59. BaseUtil.ShowError("工单号不能为空");
  60. }
  61. }
  62. else
  63. {
  64. MaCtl.Enabled = true;
  65. MaCtl.Focus();
  66. }
  67. }
  68. }
  69. }