F_PC_1301.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_1301.cs
  5. * 2.功能描述:作业指导书工序配置
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 秦祺 2023/06/13 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_1301 : DKDockPanelBase
  26. {
  27. #region 成员变量
  28. // 单例模式
  29. private static F_PC_1301 _instance;
  30. // 正在查询
  31. private bool _isSearching = false;
  32. #endregion
  33. #region 构造函数
  34. public F_PC_1301()
  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_1301 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null)
  54. {
  55. _instance = new F_PC_1301();
  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.dgvSOPType.DataSource = null;
  73. this.dgvProcedureDetail.DataSource = null;
  74. ClientRequestEntity cre = new ClientRequestEntity();
  75. cre.NameSpace = "F_PC_0801";
  76. cre.Name = "GetLGORT";
  77. cre.Properties["dictionaryvalue"] = this.txtSOPType.Text;
  78. cre.Properties["DICTIONARYTYPE"] = "TPC020"; //线边仓数据字典类别
  79. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  80. {
  81. return PCModuleProxyNew.Service.HandleRequest(cre);
  82. });
  83. if (sre.Status == Constant.ServiceResultStatus.Success)
  84. {
  85. this.Tag = false;
  86. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  87. {
  88. this._isSearching = false;
  89. this.dgvSOPType.DataSource = sre.Data.Tables[0];
  90. dgvSOPType_SelectionChanged(null, null);
  91. }
  92. else
  93. {
  94. // 清空明细中的数据
  95. this.dgvSOPType.DataSource = null;
  96. // 提示未查找到数据
  97. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  98. MessageBoxButtons.OK, MessageBoxIcon.Information);
  99. }
  100. }
  101. }
  102. catch (Exception ex)
  103. {
  104. this.btnSearch.Enabled = true;
  105. this.btnClearCondition.Enabled = true;
  106. // 对异常进行共通处理
  107. ExceptionManager.HandleEventException(this.ToString(),
  108. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  109. }
  110. }
  111. /// <summary>
  112. /// 清空按钮事件
  113. /// </summary>
  114. /// <param name="sender"></param>
  115. /// <param name="e"></param>
  116. private void btnClearCondition_Click(object sender, EventArgs e)
  117. {
  118. this.txtSOPType.Clear();
  119. }
  120. /// <summary>
  121. /// 选定项改变事件
  122. /// </summary>
  123. /// <param name="sender"></param>
  124. /// <param name="e"></param>
  125. private void dgvSOPType_SelectionChanged(object sender, EventArgs e)
  126. {
  127. try
  128. {
  129. if (this._isSearching)
  130. {
  131. return;
  132. }
  133. DataGridViewRow currentRow = this.dgvSOPType.CurrentRow;
  134. if (currentRow != null)
  135. {
  136. int id = Convert.ToInt32(currentRow.Cells["dictionaryID"].Value);
  137. // 调用服务器端获取数据集
  138. ClientRequestEntity cre = new ClientRequestEntity();
  139. cre.NameSpace = "F_PC_1301";
  140. cre.Name = "GetProcedure";
  141. cre.Properties["SOPTYPEID"] = id;
  142. cre.Properties["onlyflag"] = "0";
  143. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  144. {
  145. return PCModuleProxyNew.Service.HandleRequest(cre);
  146. });
  147. if (sre.Status == Constant.ServiceResultStatus.Success)
  148. {
  149. this.dgvProcedureDetail.DataSource = sre.Data.Tables[0];
  150. }
  151. }
  152. }
  153. catch (Exception ex)
  154. {
  155. // 对异常进行共通处理
  156. ExceptionManager.HandleEventException(this.ToString(),
  157. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  158. }
  159. }
  160. /// <summary>
  161. /// 单元格双击事件
  162. /// </summary>
  163. /// <param name="sender"></param>
  164. /// <param name="e"></param>
  165. private void dgvSOPType_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  166. {
  167. if (e.RowIndex < 0 || e.ColumnIndex < 0)
  168. {
  169. return;
  170. }
  171. this.tsbtnEditUser_Click(sender, e);
  172. }
  173. /// <summary>
  174. /// 编辑按钮事件
  175. /// </summary>
  176. /// <param name="sender"></param>
  177. /// <param name="e"></param>
  178. private void tsbtnEditUser_Click(object sender, EventArgs e)
  179. {
  180. try
  181. {
  182. if (this.dgvSOPType.SelectedRows.Count != 0)
  183. {
  184. string soptypeid = this.dgvSOPType.SelectedRows[0].Cells["dictionaryID"].Value + "";
  185. string soptype = this.dgvSOPType.SelectedRows[0].Cells["dictionaryvalue"].Value + "";
  186. F_PC_1302 frmFPC1302 = new F_PC_1302(Convert.ToInt32(soptypeid), soptype);
  187. DialogResult dialogresult = frmFPC1302.ShowDialog();
  188. }
  189. }
  190. catch (Exception ex)
  191. {
  192. // 对异常进行共通处理
  193. ExceptionManager.HandleEventException(this.ToString(),
  194. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  195. }
  196. }
  197. /// <summary>
  198. /// 窗体加载事件
  199. /// </summary>
  200. /// <param name="sender"></param>
  201. /// <param name="e"></param>
  202. private void F_PC_1301_Load(object sender, EventArgs e)
  203. { // 按钮权限控制
  204. FormPermissionManager.FormPermissionControl(this.Name, this,
  205. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  206. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  207. }
  208. /// <summary>
  209. /// 自适应列宽
  210. /// </summary>
  211. /// <param name="sender"></param>
  212. /// <param name="e"></param>
  213. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  214. {
  215. this.dgvSOPType.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  216. this.dgvProcedureDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  217. }
  218. /// <summary>
  219. /// 关闭按钮事件
  220. /// </summary>
  221. /// <param name="sender"></param>
  222. /// <param name="e"></param>
  223. private void tsbtnClose_Click(object sender, EventArgs e)
  224. {
  225. this.Close();
  226. }
  227. /// <summary>
  228. /// 释放窗体
  229. /// </summary>
  230. /// <param name="sender"></param>
  231. /// <param name="e"></param>
  232. private void F_PC_1301_FormClosed(object sender, FormClosedEventArgs e)
  233. {
  234. _instance = null;
  235. }
  236. #endregion
  237. #region 私有方法
  238. #endregion
  239. }
  240. }