F_MST_1301.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_1301.cs
  5. * 2.功能描述:装具管理
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 冯林勇 2022/07/25 1.00 新建
  9. *******************************************************************************/
  10. using Dongke.IBOSS.PRD.Basics.BaseResources;
  11. using Dongke.IBOSS.PRD.Basics.DockPanel;
  12. using Dongke.IBOSS.PRD.Client.CommonModule;
  13. using Dongke.IBOSS.PRD.Client.Controls;
  14. using Dongke.IBOSS.PRD.Client.DataModels;
  15. using Dongke.IBOSS.PRD.WCF.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. using Dongke.WinForm.Controls;
  18. using System;
  19. using System.Data;
  20. using System.Windows.Forms;
  21. namespace Dongke.IBOSS.PRD.Client.PCModule
  22. {
  23. /// <summary>
  24. /// 装具管理
  25. /// </summary>
  26. public partial class F_MST_1301 : DockPanelBase
  27. {
  28. #region 成员变量
  29. // 单例模式
  30. private static F_MST_1301 _instance;
  31. // 正在查询
  32. private bool _isSearching = false;
  33. private DataSet DataSource;
  34. #endregion
  35. #region 构造函数
  36. public F_MST_1301()
  37. {
  38. InitializeComponent();
  39. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  40. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  41. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  42. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  43. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  44. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  45. }
  46. #endregion
  47. #region 单例模式
  48. /// <summary>
  49. /// 单例模式,防止重复创建窗体
  50. /// </summary>
  51. public static F_MST_1301 Instance
  52. {
  53. get
  54. {
  55. if (_instance == null)
  56. {
  57. _instance = new F_MST_1301();
  58. }
  59. return _instance;
  60. }
  61. }
  62. #endregion
  63. #region 事件
  64. /// <summary>
  65. /// 搜索按钮事件
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void btnSearch_Click(object sender, EventArgs e)
  70. {
  71. try
  72. {
  73. this._isSearching = true;
  74. this.dgvEntrucKing.DataSource = null;
  75. this.DataSource = this.GetSearchData();
  76. if (this.DataSource != null)
  77. {
  78. this.dgvEntrucKing.DataSource = this.DataSource.Tables[0];
  79. }
  80. else
  81. {
  82. // 提示未查找到数据
  83. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  84. MessageBoxButtons.OK, MessageBoxIcon.Information);
  85. }
  86. this._isSearching = false;
  87. }
  88. catch (Exception ex)
  89. {
  90. this.btnSearch.Enabled = true;
  91. this.btnClearCondition.Enabled = true;
  92. // 对异常进行共通处理
  93. ExceptionManager.HandleEventException(this.ToString(),
  94. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  95. }
  96. }
  97. /// <summary>
  98. /// 清空按钮事件
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. private void btnClearCondition_Click(object sender, EventArgs e)
  103. {
  104. this.txtEntruckingCode.Clear();
  105. }
  106. /// <summary>
  107. /// 新增按钮事件
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void tsbtnAddUser_Click(object sender, EventArgs e)
  112. {
  113. try
  114. {
  115. F_MST_1302 frmFPC1302 = new F_MST_1302(null);
  116. DialogResult dialogresult = frmFPC1302.ShowDialog();
  117. btnSearch_Click(sender, null);
  118. }
  119. catch (Exception ex)
  120. {
  121. // 对异常进行共通处理
  122. ExceptionManager.HandleEventException(this.ToString(),
  123. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  124. }
  125. }
  126. /// <summary>
  127. /// 编辑按钮事件
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. private void tsbtnEditUser_Click(object sender, EventArgs e)
  132. {
  133. try
  134. {
  135. if (this.dgvEntrucKing.SelectedRows.Count != 0)
  136. {
  137. string entruckingCode = this.dgvEntrucKing.SelectedRows[0].Cells["EntruckingCode"].Value.ToString();
  138. F_MST_1302 frmFPC1302 = new F_MST_1302(entruckingCode);
  139. DialogResult dialogresult = frmFPC1302.ShowDialog();
  140. btnSearch_Click(sender, null);
  141. }
  142. }
  143. catch (Exception ex)
  144. {
  145. // 对异常进行共通处理
  146. ExceptionManager.HandleEventException(this.ToString(),
  147. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  148. }
  149. }
  150. /// <summary>
  151. /// 窗体加载事件
  152. /// </summary>
  153. /// <param name="sender"></param>
  154. /// <param name="e"></param>
  155. private void F_MST_1301_Load(object sender, EventArgs e)
  156. {
  157. // 按钮权限控制
  158. FormPermissionManager.FormPermissionControl(this.Name, this,
  159. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  160. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  161. }
  162. /// <summary>
  163. /// 自适应列宽
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  168. {
  169. this.dgvEntrucKing.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  170. }
  171. /// <summary>
  172. /// 关闭按钮事件
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. private void tsbtnClose_Click(object sender, EventArgs e)
  177. {
  178. this.Close();
  179. }
  180. /// <summary>
  181. /// 释放窗体
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. private void F_MST_1301_FormClosed(object sender, FormClosedEventArgs e)
  186. {
  187. _instance = null;
  188. }
  189. #endregion
  190. #region 私有方法
  191. /// <summary>
  192. /// 根据界面查询条件获取数据集
  193. /// </summary>
  194. private DataSet GetSearchData()
  195. {
  196. try
  197. {
  198. ClientRequestEntity cre = new ClientRequestEntity();
  199. cre.NameSpace = "F_MST_1301";
  200. cre.Name = "GetEntruckingInfo";
  201. cre.Properties["EntruckingCode"] = txtEntruckingCode.Text;
  202. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  203. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  204. {
  205. return sre.Data;
  206. }
  207. return null;
  208. }
  209. catch (Exception ex)
  210. {
  211. throw ex;
  212. }
  213. }
  214. #endregion
  215. }
  216. }