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

152 lines
5.2 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 FormICSPJXPrintEdit : DevExpress.XtraEditors.XtraForm
  25. {
  26. String guid = "";
  27. String srow = "";
  28. String Batch = "";
  29. String ICode = "";
  30. String Sup = "";
  31. String cQty = "";
  32. ICSPJXPrint entity = new ICSPJXPrint();
  33. #region 构造函数
  34. public FormICSPJXPrintEdit()
  35. {
  36. InitializeComponent();
  37. }
  38. public FormICSPJXPrintEdit(String id, string row, String cBatch, String cInvCode, String Supplier, String QTY)
  39. {
  40. InitializeComponent();
  41. guid = id;
  42. srow = row;
  43. Batch = cBatch;
  44. ICode = cInvCode;
  45. Sup = Supplier;
  46. cQty = QTY;
  47. }
  48. #endregion
  49. #region 容器页面加载
  50. private void FormContainerAddEdit_Load(object sender, EventArgs e)
  51. {
  52. if (cQty != null && cQty !="")
  53. {
  54. lblTitle.Text = "数量维护";
  55. entity = ICSPJXPrintBLL.select(guid,Batch, AppConfig.AppConnectString);
  56. txtquantity.Text = entity.quantity;
  57. txtMuserCode.Text = entity.MuserCode;
  58. TxtMtime.Text = Convert.ToString(entity.Mtime);
  59. }
  60. else
  61. {
  62. txtquantity.Text = "";
  63. txtMuserCode.Text =AppConfig.UserCode;
  64. TxtMtime.Text = Convert.ToString(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss"));
  65. }
  66. }
  67. #endregion
  68. #region 列表
  69. private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  70. {
  71. if (e.Info.IsRowIndicator && e.RowHandle >= 0)
  72. e.Info.DisplayText = (e.RowHandle + 1).ToString();
  73. }
  74. #endregion
  75. #region 关闭 退出
  76. private void btnClose_Click(object sender, EventArgs e)
  77. {
  78. this.Close();
  79. }
  80. #region 移动窗体
  81. private const int WM_NCHITTEST = 0x84;
  82. private const int HTCLIENT = 0x1;
  83. private const int HTCAPTION = 0x2;
  84. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  85. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  86. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  87. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  88. //重写窗体,使窗体可以不通过自带标题栏实现移动
  89. protected override void WndProc(ref Message m)
  90. {
  91. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  92. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  93. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  94. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  95. switch (m.Msg)
  96. {
  97. case WM_NCHITTEST:
  98. base.WndProc(ref m);
  99. if ((int)m.Result == HTCLIENT)
  100. m.Result = (IntPtr)HTCAPTION;
  101. return;
  102. }
  103. //拦截双击标题栏、移动窗体的系统消息
  104. if (m.Msg != 0xA3)
  105. {
  106. base.WndProc(ref m);
  107. }
  108. }
  109. #endregion
  110. private void can_Click(object sender, EventArgs e)
  111. {
  112. this.Close();
  113. }
  114. #endregion
  115. #region 修改 新增
  116. private void save_Click(object sender, EventArgs e)
  117. {
  118. if (txtquantity.Text.Trim() == "")
  119. {
  120. ICSBaseSimpleCode.AppshowMessageBox("请填写数量!");
  121. return;
  122. }
  123. entity.DispatchListID = guid;
  124. entity.Free2 = srow;
  125. entity.quantity = txtquantity.Text.Trim();
  126. entity.Component = ICode + Batch;
  127. entity.Free1 = Batch;
  128. entity.Supplier = "";
  129. try
  130. {
  131. ICSPJXPrintBLL.AddAndEdit(entity, AppConfig.AppConnectString);
  132. this.Close();
  133. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  134. }catch(Exception ex){
  135. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  136. return;
  137. }
  138. }
  139. #endregion
  140. }
  141. }