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

239 lines
8.6 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.WorkPoint.Entity;
  10. using ICSSoft.Frame.WorkPoint.BLL;
  11. using ICSSoft.Base.Config.AppConfig;
  12. using ICSSoft.Base.Config.DBHelper;
  13. using System.Text.RegularExpressions;
  14. using ICSSoft.Frame.Data.Entity;
  15. using ICSSoft.Base.ReferForm.AppReferForm;
  16. using ICSSoft.Frame.Data.BLL;
  17. using ICSSoft.Frame.Helper;
  18. namespace ICSSoft.Frame.APP
  19. {
  20. public partial class FormICSEqpWorkTimeAdd : DevExpress.XtraEditors.XtraForm
  21. {
  22. FormICSEquipmentUIModel equipmentUIModel;
  23. int Flag;
  24. string eqpid;
  25. /// <summary>
  26. /// add new
  27. /// </summary>
  28. public FormICSEqpWorkTimeAdd()
  29. {
  30. InitializeComponent();
  31. chargeFormState("Add");
  32. Flag = 0;
  33. }
  34. /// <summary>
  35. /// edit
  36. /// </summary>
  37. /// <param name="cPersonCode"></param>
  38. public FormICSEqpWorkTimeAdd(string id)
  39. {
  40. InitializeComponent();
  41. chargeFormState("Edit");
  42. SearchShiftInfo(id);
  43. Flag = 1;
  44. }
  45. private void chargeFormState(string state)
  46. {
  47. switch (state)
  48. {
  49. case "Add":
  50. //txtModel.Properties.ReadOnly = false;
  51. //txtEQPStatus.Properties.ReadOnly = false;
  52. txtMUSERName.Text = AppConfig.UserName;
  53. txtMTIME.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString();
  54. txtMUSERName.Properties.ReadOnly = true;
  55. txtMTIME.Properties.ReadOnly = true;
  56. break;
  57. case "Edit":
  58. //txtModel.Properties.ReadOnly = true;
  59. //txtEQPStatus.Properties.ReadOnly = false;
  60. txtMUSERName.Properties.ReadOnly = true;
  61. txtMTIME.Properties.ReadOnly = true;
  62. break;
  63. }
  64. }
  65. #region 移动窗体
  66. private const int WM_NCHITTEST = 0x84;
  67. private const int HTCLIENT = 0x1;
  68. private const int HTCAPTION = 0x2;
  69. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  70. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  71. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  72. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  73. //重写窗体,使窗体可以不通过自带标题栏实现移动
  74. protected override void WndProc(ref Message m)
  75. {
  76. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  77. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  78. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  79. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  80. switch (m.Msg)
  81. {
  82. case WM_NCHITTEST:
  83. base.WndProc(ref m);
  84. if ((int)m.Result == HTCLIENT)
  85. m.Result = (IntPtr)HTCAPTION;
  86. return;
  87. }
  88. //拦截双击标题栏、移动窗体的系统消息
  89. if (m.Msg != 0xA3)
  90. {
  91. base.WndProc(ref m);
  92. }
  93. }
  94. #endregion
  95. private void SearchShiftInfo(string id)
  96. {
  97. //equipmentUIModel = ICSEquipmentBLL.SearchEquipmentInfoByCode(id, AppConfig.AppConnectString);
  98. //txtModel.Text = equipmentUIModel.Model;
  99. //txtType.Text = equipmentUIModel.Type;
  100. //txtEQPStatus.Text = equipmentUIModel.EQPStatus;
  101. //txtEQPDESC.Text = equipmentUIModel.EQPDESC;
  102. //txtEType.Text = equipmentUIModel.EType;
  103. //txtCompany.Text = equipmentUIModel.Company;
  104. //txtAddress.Text = equipmentUIModel.Address;
  105. //txtTelPhone.Text = equipmentUIModel.TelPhone;
  106. //txtSSCode.Text = equipmentUIModel.SS.SSCODE;
  107. //txtMUSERName.Text = AppConfig.UserName;
  108. //txtMTIME.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString();
  109. //eqpid = equipmentUIModel.EQPID;
  110. }
  111. #region 关闭
  112. private void btnCancle_Click(object sender, EventArgs e)
  113. {
  114. this.Close();
  115. this.DialogResult = DialogResult.Cancel;
  116. }
  117. private void btnClose_Click(object sender, EventArgs e)
  118. {
  119. this.Close();
  120. this.DialogResult = DialogResult.Cancel;
  121. }
  122. #endregion
  123. //#region 产线代码按钮
  124. //private void txtSSCode_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
  125. //{
  126. // ButtonEdit btn = (ButtonEdit)sender;
  127. // string sql = "select distinct SSCODE as [产线代码],SSDESC as [产线描述] from dbo.ICSSS with(nolock) WHERE 1=1";
  128. // //object obj = AppConfig.InvokeWebservice(AppConfig.BaseServiceUri, "WebBaseService", "BaseService", "GetHuaRongErpConnectString", new object[] { });
  129. // //if (obj == null)
  130. // //{
  131. // // ICSBaseSimpleCode.AppshowMessageBox(1, "ERP数据库连接取得失败!");
  132. // //}
  133. // DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  134. // FormDataRefer reForm = new FormDataRefer();
  135. // reForm.FormTitle = "产线信息";
  136. // DataTable menuData = data;
  137. // reForm.DataSource = menuData;
  138. // reForm.MSelectFlag = false;
  139. // reForm.RowIndexWidth = 35;
  140. // reForm.HideCols.Add("ID");
  141. // reForm.FormWidth = 500;
  142. // reForm.FormHeight = 500;
  143. // //reForm.FilterKey = btn.Text;
  144. // //grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
  145. // if (reForm.ShowDialog() == DialogResult.OK)
  146. // {
  147. // DataTable retData = reForm.ReturnData;
  148. // foreach (DataRow dr in retData.Rows)
  149. // {
  150. // txtSSCode.Text = dr["产线代码"].ToString();
  151. // //txtItemName.Text = dr["存货名称"].ToString();
  152. // }
  153. // }
  154. //}
  155. //#endregion
  156. #region 新增 修改
  157. private void btnOK_Click(object sender, EventArgs e)
  158. {
  159. FormICSEqpWorkTimeUIModel eqpWorkTimeInfo = new FormICSEqpWorkTimeUIModel();
  160. //equipmentInfo.EQPID = eqpid;
  161. //equipmentInfo.Model = txtModel.Text.Trim();
  162. //equipmentInfo.Type = txtType.Text.Trim();
  163. //equipmentInfo.EQPStatus = txtEQPStatus.Text.Trim();
  164. //equipmentInfo.EQPDESC = txtEQPDESC.Text.Trim();
  165. //equipmentInfo.EType = txtEType.Text.Trim();
  166. //equipmentInfo.Company = txtCompany.Text.Trim();
  167. //equipmentInfo.Address = txtAddress.Text.Trim();
  168. //equipmentInfo.TelPhone = txtTelPhone.Text.Trim();
  169. //equipmentInfo.SSCode = txtSSCode.Text.Trim();
  170. //equipmentInfo.MUSER = AppConfig.UserId;
  171. //equipmentInfo.MUSERName = AppConfig.UserName;
  172. //equipmentInfo.MTIME = System.DateTime.Parse(txtMTIME.Text);
  173. //equipmentInfo.WorkPoint = AppConfig.WorkPointCode;
  174. //equipmentInfo.EATTRIBUTE1 = null;
  175. try
  176. {
  177. //ICSEquipmentBLL.Add(equipmentInfo, AppConfig.AppConnectString);
  178. this.Close();
  179. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  180. }
  181. catch (Exception ex)
  182. {
  183. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  184. }
  185. }
  186. #endregion
  187. private void FormICSShiftAdd_Load()
  188. {
  189. DataTable dt = new DataTable();
  190. dt = ICSShiftBLL.GetShiftCode();
  191. string str = dt.Rows[0]["SHIFTCODE"].ToString();
  192. if (str == "1101000001")
  193. {
  194. txtModel.Text = (int.Parse(str) + 1).ToString();
  195. }
  196. else
  197. {
  198. str = "1101000001";
  199. }
  200. }
  201. }
  202. }