锐腾搅拌上料功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.8 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using DevExpress.XtraEditors;
  9. using ICSSoft.Frame.Data.Entity;
  10. using ICSSoft.Frame.Data.BLL;
  11. using ICSSoft.Base.Config.AppConfig;
  12. using ICSSoft.Base.Config.DBHelper;
  13. namespace ICSSoft.Frame.APP
  14. {
  15. public partial class FormICSOQCCKGROUPAdd : DevExpress.XtraEditors.XtraForm
  16. {
  17. String guid = "";
  18. ICSOQCCKGROUP entity = new ICSOQCCKGROUP();
  19. public FormICSOQCCKGROUPAdd()
  20. {
  21. InitializeComponent();
  22. txtMUSER.Text = AppConfig.UserCode;
  23. txtMTIME.Text = DateTime.Now.ToString();
  24. txtID.Text = AppConfig.GetGuid();
  25. }
  26. public FormICSOQCCKGROUPAdd(string id)
  27. {
  28. InitializeComponent();
  29. txtCKGROUP.Enabled = false;
  30. guid = id;
  31. labTOP.Text = "修改检验项目信息";
  32. txtID.Text = id;
  33. string sql = "select * from ICSOQCCKGROUP where ID='" + id + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
  34. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
  35. foreach (DataRow dr in dt.Rows)
  36. {
  37. txtCKGROUP.Text = dr["CKGROUP"].ToString();
  38. txtCKGROUPDNAME.Text = dr["CKGROUPDNAME"].ToString();
  39. tetCKGROUPDESC.Text = dr["CKGROUPDESC"].ToString();
  40. txtMUSER.Text = dr["MUSER"].ToString();
  41. txtMTIME.Text = dr["MTIME"].ToString();
  42. if (dr["ISREF"].ToString() == "是")
  43. {
  44. this.txtISREF.Checked = true;
  45. }
  46. }
  47. }
  48. #region 关闭 退出
  49. private void btnClose_Click(object sender, EventArgs e)
  50. {
  51. this.Close();
  52. }
  53. #endregion
  54. #region 移动窗体
  55. private const int WM_NCHITTEST = 0x84;
  56. private const int HTCLIENT = 0x1;
  57. private const int HTCAPTION = 0x2;
  58. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  59. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  60. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  61. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  62. //重写窗体,使窗体可以不通过自带标题栏实现移动
  63. protected override void WndProc(ref Message m)
  64. {
  65. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  66. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  67. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  68. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  69. switch (m.Msg)
  70. {
  71. case WM_NCHITTEST:
  72. base.WndProc(ref m);
  73. if ((int)m.Result == HTCLIENT)
  74. m.Result = (IntPtr)HTCAPTION;
  75. return;
  76. }
  77. //拦截双击标题栏、移动窗体的系统消息
  78. if (m.Msg != 0xA3)
  79. {
  80. base.WndProc(ref m);
  81. }
  82. }
  83. #endregion
  84. #region 新增 修改
  85. private void save_Click(object sender, EventArgs e)
  86. {
  87. entity.ID = txtID.Text;
  88. entity.CKGROUP = txtCKGROUP.Text;
  89. entity.CKGROUPDNAME = string.IsNullOrEmpty(txtCKGROUPDNAME.Text) ? entity.CKGROUP : txtCKGROUPDNAME.Text;
  90. entity.CKGROUPDESC = string.IsNullOrEmpty(tetCKGROUPDESC.Text) ? entity.CKGROUP : tetCKGROUPDESC.Text;
  91. if (txtISREF.Checked)
  92. entity.ISREF = "是";
  93. else
  94. entity.ISREF = "否";
  95. entity.MUSER = txtMUSER.Text;
  96. entity.MUSERName = AppConfig.UserName;
  97. entity.MTIME = Convert.ToDateTime(txtMTIME.Text);
  98. entity.WorkPoint = AppConfig.WorkPointCode;
  99. try
  100. {
  101. ICSOQCCKGROUPBLL.AddandEdit(entity, AppConfig.AppConnectString);
  102. this.Close();
  103. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  104. }
  105. catch (Exception ex)
  106. {
  107. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  108. }
  109. }
  110. #endregion
  111. #region 取消
  112. private void can_Click(object sender, EventArgs e)
  113. {
  114. this.Close();
  115. }
  116. #endregion
  117. }
  118. }