锐腾搅拌上料功能
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.

142 lines
5.1 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.BLL;
  10. using ICSSoft.Base.Config.AppConfig;
  11. using ICSSoft.Frame.Data.Entity;
  12. using System.Data.Linq;
  13. using System.Linq;
  14. using ICSSoft.Base.Language.Tool;
  15. using System.Reflection;
  16. using ICSSoft.Base.Config.DBHelper;
  17. using ICSSoft.Base.ReferForm;
  18. using ICSSoft.Base.Report;
  19. using ICSSoft.Frame.Data.DAL;
  20. using ICSSoft.Base.ReferForm.AppReferForm;
  21. using ICSSoft.Frame.APP;
  22. namespace ICSSoft.Frame.APP
  23. {
  24. public partial class FormICSStorageAddEdit : DevExpress.XtraEditors.XtraForm
  25. {
  26. String guid = "";
  27. ICSStorage entity = new ICSStorage();
  28. #region 构造函数
  29. public FormICSStorageAddEdit()
  30. {
  31. InitializeComponent();
  32. }
  33. public FormICSStorageAddEdit(String id)
  34. {
  35. InitializeComponent();
  36. guid = id;
  37. }
  38. #endregion
  39. #region 容器页面加载
  40. private void FormContainerAddEdit_Load(object sender, EventArgs e)
  41. {
  42. if (guid != "")
  43. {
  44. lblTitle.Text = "修改库房";
  45. txtStorageCode.Properties.ReadOnly = true;
  46. entity = ICSStorageBLL.select(guid, AppConfig.AppConnectString);
  47. txtStorageCode.Text = entity.StorageCode;
  48. txtStorageName.Text = entity.StorageName;
  49. txtMUSER.Text = AppConfig.UserName;
  50. MTIME.Text = Convert.ToDateTime(entity.MTIME).ToString();
  51. }
  52. else
  53. {
  54. txtMUSER.Text = AppConfig.UserName;
  55. MTIME.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
  56. }
  57. }
  58. #endregion
  59. #region 列表
  60. private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  61. {
  62. if (e.Info.IsRowIndicator && e.RowHandle >= 0)
  63. e.Info.DisplayText = (e.RowHandle + 1).ToString();
  64. }
  65. #endregion
  66. #region 关闭 退出
  67. private void btnClose_Click(object sender, EventArgs e)
  68. {
  69. this.Close();
  70. }
  71. #region 移动窗体
  72. private const int WM_NCHITTEST = 0x84;
  73. private const int HTCLIENT = 0x1;
  74. private const int HTCAPTION = 0x2;
  75. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  76. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  77. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  78. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  79. //重写窗体,使窗体可以不通过自带标题栏实现移动
  80. protected override void WndProc(ref Message m)
  81. {
  82. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  83. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  84. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  85. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  86. switch (m.Msg)
  87. {
  88. case WM_NCHITTEST:
  89. base.WndProc(ref m);
  90. if ((int)m.Result == HTCLIENT)
  91. m.Result = (IntPtr)HTCAPTION;
  92. return;
  93. }
  94. //拦截双击标题栏、移动窗体的系统消息
  95. if (m.Msg != 0xA3)
  96. {
  97. base.WndProc(ref m);
  98. }
  99. }
  100. #endregion
  101. private void can_Click(object sender, EventArgs e)
  102. {
  103. this.Close();
  104. }
  105. #endregion
  106. #region 修改 新增
  107. private void save_Click(object sender, EventArgs e)
  108. {
  109. if (txtStorageCode.Text.Trim() == "" || txtStorageName.Text.Trim() == "")
  110. {
  111. ICSBaseSimpleCode.AppshowMessageBox("蓝色标识数值不能为空!");
  112. return;
  113. }
  114. entity.StorageCode = txtStorageCode.Text.Trim();
  115. entity.StorageName = txtStorageName.Text.Trim();
  116. entity.MUSER = AppConfig.UserId;
  117. entity.MUSERName = AppConfig.UserName;
  118. entity.MTIME = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
  119. try
  120. {
  121. ICSStorageBLL.AddAndEdit(entity, AppConfig.AppConnectString);
  122. this.Close();
  123. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  124. }catch(Exception ex){
  125. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  126. return;
  127. }
  128. }
  129. #endregion
  130. }
  131. }