LockCheckBox.cs 1.7 KB

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