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

199 lines
7.0 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.Linq;
  6. using System.Linq;
  7. using System.Drawing;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using DevExpress.XtraEditors;
  11. using DevExpress.XtraGrid.Views.BandedGrid;
  12. using DevExpress.XtraGrid.Columns;
  13. using DevExpress.XtraGrid;
  14. using System.IO;
  15. using System.Threading;
  16. using ICSSoft.Base.Language.Tool;
  17. using ICSSoft.Base.Config.AppConfig;
  18. using ICSSoft.Base.UserControl.MessageControl;
  19. using ICSSoft.Base.Config.DBHelper;
  20. using ICSSoft.Base.Report.Filter;
  21. using ICSSoft.Base.UserControl.FormControl;
  22. using ICSSoft.Base.Report.GridReport;
  23. using ICSSoft.Base.ReferForm.AppReferForm;
  24. using ICSSoft.Frame.Data.BLL;
  25. using ICSSoft.Frame.Data.Entity;
  26. namespace ICSSoft.Frame.APP
  27. {
  28. public partial class FormPhysicalInventoryAdd : DevExpress.XtraEditors.XtraForm
  29. {
  30. String guid = "";
  31. ICSToCheck entity = new ICSToCheck();
  32. #region 构造函数
  33. public FormPhysicalInventoryAdd()
  34. {
  35. InitializeComponent();
  36. txtUser.Text = AppConfig.UserName;
  37. txtMtime.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
  38. txtPlanDate.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
  39. }
  40. public FormPhysicalInventoryAdd(String id)
  41. {
  42. InitializeComponent();
  43. guid = id;
  44. txtUser.Text = AppConfig.UserName;
  45. txtMtime.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
  46. txtPlanDate.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
  47. }
  48. #endregion
  49. #region 用户输入限制
  50. private bool Msg(object sender, EventArgs e)
  51. {
  52. return false;
  53. }
  54. #endregion
  55. #region 关闭 退出
  56. private void btnClose_Click(object sender, EventArgs e)
  57. {
  58. this.Close();
  59. }
  60. #endregion
  61. #region 移动窗体
  62. private const int WM_NCHITTEST = 0x84;
  63. private const int HTCLIENT = 0x1;
  64. private const int HTCAPTION = 0x2;
  65. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  66. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  67. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  68. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  69. //重写窗体,使窗体可以不通过自带标题栏实现移动
  70. protected override void WndProc(ref Message m)
  71. {
  72. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  73. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  74. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  75. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  76. switch (m.Msg)
  77. {
  78. case WM_NCHITTEST:
  79. base.WndProc(ref m);
  80. if ((int)m.Result == HTCLIENT)
  81. m.Result = (IntPtr)HTCAPTION;
  82. return;
  83. }
  84. //拦截双击标题栏、移动窗体的系统消息
  85. if (m.Msg != 0xA3)
  86. {
  87. base.WndProc(ref m);
  88. }
  89. }
  90. #endregion
  91. #region 新增 修改
  92. private void save_Click(object sender, EventArgs e)
  93. {
  94. if (txtCheckNo.Text.Trim() == "" || txtPlanDate.Text.Trim() == "")
  95. {
  96. ICSBaseSimpleCode.AppshowMessageBox("蓝色标识数值不能为空!");
  97. return;
  98. }
  99. entity.ToCheckNO = txtCheckNo.Text + txtWHCode.Text;
  100. entity.ToCheckDate = DateTime.Parse(txtPlanDate.Text);
  101. entity.StorageCode = txtWHCode.Text;
  102. entity.MuserName = txtUser.Text;
  103. entity.Muser = AppConfig.UserId;
  104. entity.Mtime = DateTime.Parse(txtMtime.Text);
  105. entity.WorkPoint = AppConfig.WorkPointCode;
  106. try
  107. {
  108. FormPhysicalInventoryBLL.AddandEdit(entity, AppConfig.AppConnectString);
  109. this.Close();
  110. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  111. }
  112. catch (Exception ex)
  113. {
  114. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  115. }
  116. }
  117. #endregion
  118. #region 取消
  119. private void can_Click(object sender, EventArgs e)
  120. {
  121. this.Close();
  122. }
  123. #endregion
  124. #region 页面加载
  125. private void FormICSItenLotAdd_Load(object sender, EventArgs e)
  126. {
  127. if (guid != "")
  128. {
  129. lblTitle.Text = "修改盘点计划";
  130. entity = FormPhysicalInventoryBLL.select(guid, AppConfig.AppConnectString);
  131. txtCheckNo.Text = entity.ToCheckNO;
  132. txtPlanDate.Text = entity.ToCheckDate.ToString();
  133. txtUser.Text = entity.MuserName;
  134. txtMtime.Text = entity.Mtime.ToString();
  135. }
  136. else
  137. {
  138. txtCheckNo.Text = DateTime.Now.ToString("yyyyMMdd");
  139. }
  140. }
  141. #endregion
  142. private void txtWHCode_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
  143. {
  144. ButtonEdit btn = (ButtonEdit)sender;
  145. string sql = "select StorageCode,StorageName from ICSStorage with(nolock) WHERE 1=1";
  146. //object obj = AppConfig.InvokeWebservice(AppConfig.BaseServiceUri, "WebBaseService", "BaseService", "GetHuaRongErpConnectString", new object[] { });
  147. //if (obj == null)
  148. //{
  149. // ICSBaseSimpleCode.AppshowMessageBox(1, "ERP数据库连接取得失败!");
  150. //}
  151. DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  152. FormDataRefer reForm = new FormDataRefer();
  153. reForm.FormTitle = "仓库信息";
  154. DataTable menuData = data;
  155. reForm.DataSource = menuData;
  156. reForm.MSelectFlag = false;
  157. reForm.RowIndexWidth = 35;
  158. reForm.FormWidth = 500;
  159. reForm.FormHeight = 500;
  160. //reForm.FilterKey = btn.Text;
  161. //grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
  162. if (reForm.ShowDialog() == DialogResult.OK)
  163. {
  164. DataTable retData = reForm.ReturnData;
  165. foreach (DataRow dr in retData.Rows)
  166. {
  167. txtWHCode.Text = dr["StorageCode"].ToString();
  168. //itemid = dr["产品ID"].ToString();
  169. }
  170. }
  171. }
  172. }
  173. }