F_PC_0701.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0701.cs
  5. * 2.功能描述:装配工序组件配置
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 袁新成 2015/04/17 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.Client.Controls;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. namespace Dongke.IBOSS.PRD.Client.PCModule
  21. {
  22. /// <summary>
  23. /// 员工关联
  24. /// </summary>
  25. public partial class F_PC_0701 : DKDockPanelBase
  26. {
  27. #region 成员变量
  28. // 单例模式
  29. private static F_PC_0701 _instance;
  30. // 正在查询
  31. private bool _isSearching = false;
  32. #endregion
  33. #region 构造函数
  34. public F_PC_0701()
  35. {
  36. InitializeComponent();
  37. this.Text = "装配工序组件配置";
  38. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  39. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  40. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  41. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  42. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  43. }
  44. #endregion
  45. #region 单例模式
  46. /// <summary>
  47. /// 单例模式,防止重复创建窗体
  48. /// </summary>
  49. public static F_PC_0701 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null)
  54. {
  55. _instance = new F_PC_0701();
  56. }
  57. return _instance;
  58. }
  59. }
  60. #endregion
  61. #region 事件
  62. /// <summary>
  63. /// 搜索按钮事件
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void btnSearch_Click(object sender, EventArgs e)
  68. {
  69. try
  70. {
  71. this._isSearching = true;
  72. this.dgvUser.DataSource = null;
  73. this.dgvPackingBOMDetail.DataSource = null;
  74. ClientRequestEntity cre = new ClientRequestEntity();
  75. cre.NameSpace = "F_PC_0701";
  76. cre.Name = "GetFinishedCheckProcedure";
  77. cre.Properties["PROCEDURENAME"] = this.txtPROCEDURENAME.Text;
  78. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  79. {
  80. return PCModuleProxyNew.Service.HandleRequest(cre);
  81. });
  82. if (sre.Status == Constant.ServiceResultStatus.Success)
  83. {
  84. this._isSearching = false;
  85. this.dgvUser.DataSource = sre.Data.Tables[0];
  86. if (sre.Data.Tables[0].Rows.Count == 0)
  87. {
  88. // 提示未查找到数据
  89. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  90. MessageBoxButtons.OK, MessageBoxIcon.Information);
  91. }
  92. }
  93. }
  94. catch (Exception ex)
  95. {
  96. this.btnSearch.Enabled = true;
  97. this.btnClearCondition.Enabled = true;
  98. // 对异常进行共通处理
  99. ExceptionManager.HandleEventException(this.ToString(),
  100. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  101. }
  102. }
  103. /// <summary>
  104. /// 清空按钮事件
  105. /// </summary>
  106. /// <param name="sender"></param>
  107. /// <param name="e"></param>
  108. private void btnClearCondition_Click(object sender, EventArgs e)
  109. {
  110. this.txtPROCEDURENAME.Clear();
  111. }
  112. /// <summary>
  113. /// 选定项改变事件
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117. private void dgvUser_SelectionChanged(object sender, EventArgs e)
  118. {
  119. try
  120. {
  121. if (this._isSearching)
  122. {
  123. return;
  124. }
  125. DataGridViewRow currentRow = this.dgvUser.CurrentRow;
  126. if (currentRow != null)
  127. {
  128. int id = Convert.ToInt32(currentRow.Cells["PROCEDUREID"].Value);
  129. // 调用服务器端获取数据集
  130. ClientRequestEntity cre = new ClientRequestEntity();
  131. cre.NameSpace = "F_PC_0701";
  132. cre.Name = "GetIdnrktype";
  133. cre.Properties["PROCEDUREID"] = id;
  134. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  135. {
  136. return PCModuleProxyNew.Service.HandleRequest(cre);
  137. });
  138. if (sre.Status == Constant.ServiceResultStatus.Success)
  139. {
  140. this.dgvPackingBOMDetail.DataSource = sre.Data.Tables[0];
  141. }
  142. }
  143. }
  144. catch (Exception ex)
  145. {
  146. // 对异常进行共通处理
  147. ExceptionManager.HandleEventException(this.ToString(),
  148. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  149. }
  150. }
  151. ///// <summary>
  152. ///// 选定项改变事件
  153. ///// </summary>
  154. ///// <param name="sender"></param>
  155. ///// <param name="e"></param>
  156. //private void dgvPackingBOM_SelectionChanged(object sender, EventArgs e)
  157. //{
  158. // try
  159. // {
  160. // if (this._isSearching)
  161. // {
  162. // return;
  163. // }
  164. // DataGridViewRow currentRow = this.dgvPackingBOM.CurrentRow;
  165. // if (currentRow != null)
  166. // {
  167. // this.dgvPackingBOMDetail.DataSource = null;
  168. // // 调用服务器端获取数据集
  169. // ClientRequestEntity cre = new ClientRequestEntity();
  170. // cre.NameSpace = "F_PC_0701";
  171. // cre.Name = "GetPackingBOMDetailData";
  172. // cre.Properties["MATNR"] = currentRow.Cells["MATNR"].Value.ToString();
  173. // cre.Properties["VERID"] = currentRow.Cells["VERID"].Value.ToString();
  174. // ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  175. // {
  176. // return PCModuleProxyNew.Service.HandleRequest(cre);
  177. // });
  178. // if (sre.Status == Constant.ServiceResultStatus.Success)
  179. // {
  180. // this.dgvPackingBOMDetail.DataSource = sre.Data.Tables[0];
  181. // }
  182. // }
  183. // }
  184. // catch (Exception ex)
  185. // {
  186. // // 对异常进行共通处理
  187. // ExceptionManager.HandleEventException(this.ToString(),
  188. // MethodBase.GetCurrentMethod().Name, this.Text, ex);
  189. // }
  190. //}
  191. /// <summary>
  192. /// 新增按钮事件
  193. /// </summary>
  194. /// <param name="sender"></param>
  195. /// <param name="e"></param>
  196. private void tsbtnAddUser_Click(object sender, EventArgs e)
  197. {
  198. try
  199. {
  200. F_PC_0602 frmFPC0602 = new F_PC_0602(null, null);
  201. DialogResult dialogresult = frmFPC0602.ShowDialog();
  202. }
  203. catch (Exception ex)
  204. {
  205. // 对异常进行共通处理
  206. ExceptionManager.HandleEventException(this.ToString(),
  207. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  208. }
  209. }
  210. /// <summary>
  211. /// 单元格双击事件
  212. /// </summary>
  213. /// <param name="sender"></param>
  214. /// <param name="e"></param>
  215. private void dgvUser_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  216. {
  217. if (e.RowIndex < 0 || e.ColumnIndex < 0)
  218. {
  219. return;
  220. }
  221. this.tsbtnEditUser_Click(sender, e);
  222. }
  223. /// <summary>
  224. /// 编辑按钮事件
  225. /// </summary>
  226. /// <param name="sender"></param>
  227. /// <param name="e"></param>
  228. private void tsbtnEditUser_Click(object sender, EventArgs e)
  229. {
  230. try
  231. {
  232. if (this.dgvUser.SelectedRows.Count != 0)
  233. {
  234. string procedureId = this.dgvUser.SelectedRows[0].Cells["PROCEDUREID"].Value + "";
  235. string procedureName = this.dgvUser.SelectedRows[0].Cells["PROCEDURENAME"].Value + "";
  236. F_PC_0702 frmFPC0702 = new F_PC_0702(Convert.ToInt32(procedureId), procedureName);
  237. DialogResult dialogresult = frmFPC0702.ShowDialog();
  238. }
  239. }
  240. catch (Exception ex)
  241. {
  242. // 对异常进行共通处理
  243. ExceptionManager.HandleEventException(this.ToString(),
  244. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  245. }
  246. }
  247. /// <summary>
  248. /// 窗体加载事件
  249. /// </summary>
  250. /// <param name="sender"></param>
  251. /// <param name="e"></param>
  252. private void F_PC_0701_Load(object sender, EventArgs e)
  253. { // 按钮权限控制
  254. FormPermissionManager.FormPermissionControl(this.Name, this,
  255. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  256. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  257. }
  258. /// <summary>
  259. /// 自适应列宽
  260. /// </summary>
  261. /// <param name="sender"></param>
  262. /// <param name="e"></param>
  263. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  264. {
  265. this.dgvUser.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  266. this.dgvPackingBOMDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  267. }
  268. /// <summary>
  269. /// 关闭按钮事件
  270. /// </summary>
  271. /// <param name="sender"></param>
  272. /// <param name="e"></param>
  273. private void tsbtnClose_Click(object sender, EventArgs e)
  274. {
  275. this.Close();
  276. }
  277. /// <summary>
  278. /// 释放窗体
  279. /// </summary>
  280. /// <param name="sender"></param>
  281. /// <param name="e"></param>
  282. private void F_PC_0701_FormClosed(object sender, FormClosedEventArgs e)
  283. {
  284. _instance = null;
  285. }
  286. #endregion
  287. #region 私有方法
  288. /// <summary>
  289. /// 根据界面查询条件获取数据集
  290. /// </summary>
  291. private DataSet GetSearchData()
  292. {
  293. try
  294. {
  295. FPC0601_SE se = new FPC0601_SE();
  296. se.UserCode = this.txtPROCEDURENAME.Text;
  297. // 调用服务器端获取数据集
  298. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  299. {
  300. return PCModuleProxyNew.Service.GetFPC0601SData(se);
  301. }
  302. );
  303. if (sre.Status == Constant.ServiceResultStatus.Success)
  304. {
  305. return sre.Data;
  306. }
  307. return null;
  308. }
  309. catch (Exception ex)
  310. {
  311. throw ex;
  312. }
  313. }
  314. #endregion
  315. }
  316. }