LockCheckBox.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. using UAS_MES.CustomControl.TextBoxWithIcon;
  11. namespace UAS_MES.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. BaseUtil.ShowError(ErrorMessage);
  52. }
  53. }
  54. else
  55. {
  56. Checked = false;
  57. BaseUtil.ShowError("工单号不能为空");
  58. }
  59. }
  60. else
  61. {
  62. MaCtl.Enabled = true;
  63. MaCtl.Focus();
  64. }
  65. }
  66. }
  67. }