F_PC_0701.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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. this.dgvipport.DataSource = null;
  75. ClientRequestEntity cre = new ClientRequestEntity();
  76. cre.NameSpace = "F_PC_0701";
  77. cre.Name = "GetFinishedCheckProcedure";
  78. cre.Properties["PROCEDURENAME"] = this.txtPROCEDURENAME.Text;
  79. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  80. {
  81. return PCModuleProxyNew.Service.HandleRequest(cre);
  82. });
  83. if (sre.Status == Constant.ServiceResultStatus.Success)
  84. {
  85. this._isSearching = false;
  86. this.dgvUser.DataSource = sre.Data.Tables[0];
  87. if (sre.Data.Tables[0].Rows.Count == 0)
  88. {
  89. // 提示未查找到数据
  90. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  91. MessageBoxButtons.OK, MessageBoxIcon.Information);
  92. }
  93. }
  94. }
  95. catch (Exception ex)
  96. {
  97. this.btnSearch.Enabled = true;
  98. this.btnClearCondition.Enabled = true;
  99. // 对异常进行共通处理
  100. ExceptionManager.HandleEventException(this.ToString(),
  101. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  102. }
  103. }
  104. /// <summary>
  105. /// 清空按钮事件
  106. /// </summary>
  107. /// <param name="sender"></param>
  108. /// <param name="e"></param>
  109. private void btnClearCondition_Click(object sender, EventArgs e)
  110. {
  111. this.txtPROCEDURENAME.Clear();
  112. }
  113. /// <summary>
  114. /// 选定项改变事件
  115. /// </summary>
  116. /// <param name="sender"></param>
  117. /// <param name="e"></param>
  118. private void dgvUser_SelectionChanged(object sender, EventArgs e)
  119. {
  120. try
  121. {
  122. if (this._isSearching)
  123. {
  124. return;
  125. }
  126. DataGridViewRow currentRow = this.dgvUser.CurrentRow;
  127. if (currentRow != null)
  128. {
  129. int id = Convert.ToInt32(currentRow.Cells["PROCEDUREID"].Value);
  130. // 调用服务器端获取数据集
  131. ClientRequestEntity cre = new ClientRequestEntity();
  132. cre.NameSpace = "F_PC_0701";
  133. cre.Name = "GetIdnrktype";
  134. cre.Properties["PROCEDUREID"] = id;
  135. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  136. {
  137. return PCModuleProxyNew.Service.HandleRequest(cre);
  138. });
  139. if (sre.Status == Constant.ServiceResultStatus.Success)
  140. {
  141. this.dgvPackingBOMDetail.DataSource = sre.Data.Tables[0];
  142. this.dgvipport.DataSource = sre.Data.Tables[1];
  143. }
  144. }
  145. }
  146. catch (Exception ex)
  147. {
  148. // 对异常进行共通处理
  149. ExceptionManager.HandleEventException(this.ToString(),
  150. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  151. }
  152. }
  153. ///// <summary>
  154. ///// 选定项改变事件
  155. ///// </summary>
  156. ///// <param name="sender"></param>
  157. ///// <param name="e"></param>
  158. //private void dgvPackingBOM_SelectionChanged(object sender, EventArgs e)
  159. //{
  160. // try
  161. // {
  162. // if (this._isSearching)
  163. // {
  164. // return;
  165. // }
  166. // DataGridViewRow currentRow = this.dgvPackingBOM.CurrentRow;
  167. // if (currentRow != null)
  168. // {
  169. // this.dgvPackingBOMDetail.DataSource = null;
  170. // // 调用服务器端获取数据集
  171. // ClientRequestEntity cre = new ClientRequestEntity();
  172. // cre.NameSpace = "F_PC_0701";
  173. // cre.Name = "GetPackingBOMDetailData";
  174. // cre.Properties["MATNR"] = currentRow.Cells["MATNR"].Value.ToString();
  175. // cre.Properties["VERID"] = currentRow.Cells["VERID"].Value.ToString();
  176. // ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  177. // {
  178. // return PCModuleProxyNew.Service.HandleRequest(cre);
  179. // });
  180. // if (sre.Status == Constant.ServiceResultStatus.Success)
  181. // {
  182. // this.dgvPackingBOMDetail.DataSource = sre.Data.Tables[0];
  183. // }
  184. // }
  185. // }
  186. // catch (Exception ex)
  187. // {
  188. // // 对异常进行共通处理
  189. // ExceptionManager.HandleEventException(this.ToString(),
  190. // MethodBase.GetCurrentMethod().Name, this.Text, ex);
  191. // }
  192. //}
  193. /// <summary>
  194. /// 单元格双击事件
  195. /// </summary>
  196. /// <param name="sender"></param>
  197. /// <param name="e"></param>
  198. private void dgvUser_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  199. {
  200. if (e.RowIndex < 0 || e.ColumnIndex < 0)
  201. {
  202. return;
  203. }
  204. this.tsbtnEditUser_Click(sender, e);
  205. }
  206. /// <summary>
  207. /// 编辑按钮事件
  208. /// </summary>
  209. /// <param name="sender"></param>
  210. /// <param name="e"></param>
  211. private void tsbtnEditUser_Click(object sender, EventArgs e)
  212. {
  213. try
  214. {
  215. if (this.dgvUser.SelectedRows.Count != 0)
  216. {
  217. string procedureId = this.dgvUser.SelectedRows[0].Cells["PROCEDUREID"].Value + "";
  218. string procedureName = this.dgvUser.SelectedRows[0].Cells["PROCEDURENAME"].Value + "";
  219. F_PC_0702 frmFPC0702 = new F_PC_0702(Convert.ToInt32(procedureId), procedureName);
  220. DialogResult dialogresult = frmFPC0702.ShowDialog();
  221. }
  222. }
  223. catch (Exception ex)
  224. {
  225. // 对异常进行共通处理
  226. ExceptionManager.HandleEventException(this.ToString(),
  227. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  228. }
  229. }
  230. /// <summary>
  231. /// 窗体加载事件
  232. /// </summary>
  233. /// <param name="sender"></param>
  234. /// <param name="e"></param>
  235. private void F_PC_0701_Load(object sender, EventArgs e)
  236. { // 按钮权限控制
  237. FormPermissionManager.FormPermissionControl(this.Name, this,
  238. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  239. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  240. }
  241. /// <summary>
  242. /// 自适应列宽
  243. /// </summary>
  244. /// <param name="sender"></param>
  245. /// <param name="e"></param>
  246. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  247. {
  248. this.dgvUser.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  249. this.dgvPackingBOMDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  250. this.dgvipport.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  251. }
  252. /// <summary>
  253. /// 关闭按钮事件
  254. /// </summary>
  255. /// <param name="sender"></param>
  256. /// <param name="e"></param>
  257. private void tsbtnClose_Click(object sender, EventArgs e)
  258. {
  259. this.Close();
  260. }
  261. /// <summary>
  262. /// 释放窗体
  263. /// </summary>
  264. /// <param name="sender"></param>
  265. /// <param name="e"></param>
  266. private void F_PC_0701_FormClosed(object sender, FormClosedEventArgs e)
  267. {
  268. _instance = null;
  269. }
  270. /// <summary>
  271. /// 配置保存
  272. /// </summary>
  273. /// <param name="sender"></param>
  274. /// <param name="e"></param>
  275. private void tbnSave_Click(object sender, EventArgs e)
  276. {
  277. try
  278. {
  279. DataGridViewRow currentRow = this.dgvUser.CurrentRow;
  280. ((DataTable)this.dgvipport.DataSource).AcceptChanges();
  281. DataTable datatipTable = (DataTable)this.dgvipport.DataSource;
  282. int id = Convert.ToInt32(currentRow.Cells["PROCEDUREID"].Value);
  283. // 调用服务器端获取数据集
  284. ClientRequestEntity cre = new ClientRequestEntity();
  285. cre.NameSpace = "F_PC_0701";
  286. cre.Name = "SaveWorkIP";
  287. cre.Properties["ProcedureId"] = id;
  288. datatipTable.TableName = "datatipTable";
  289. DataSet ds = new DataSet();
  290. ds.Tables.Add(datatipTable.Copy());
  291. cre.Data = ds;
  292. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  293. {
  294. return PCModuleProxyNew.Service.HandleRequest(cre);
  295. });
  296. if (sre.Status == Constant.ServiceResultStatus.Success)
  297. {
  298. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "水件ip配置", "保存"),
  299. this.Text,
  300. MessageBoxButtons.OK,
  301. MessageBoxIcon.Information,
  302. MessageBoxDefaultButton.Button1);
  303. this.DialogResult = DialogResult.OK;
  304. }
  305. }
  306. catch (Exception ex)
  307. {
  308. throw ex;
  309. }
  310. }
  311. #endregion
  312. #region 私有方法
  313. /// <summary>
  314. /// 根据界面查询条件获取数据集
  315. /// </summary>
  316. private DataSet GetSearchData()
  317. {
  318. try
  319. {
  320. FPC0601_SE se = new FPC0601_SE();
  321. se.UserCode = this.txtPROCEDURENAME.Text;
  322. // 调用服务器端获取数据集
  323. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  324. {
  325. return PCModuleProxyNew.Service.GetFPC0601SData(se);
  326. }
  327. );
  328. if (sre.Status == Constant.ServiceResultStatus.Success)
  329. {
  330. return sre.Data;
  331. }
  332. return null;
  333. }
  334. catch (Exception ex)
  335. {
  336. throw ex;
  337. }
  338. }
  339. #endregion
  340. }
  341. }