/******************************************************************************* * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PC_0701.cs * 2.功能描述:装配工序组件配置 * 编辑履历: * 作者 日期 版本 修改内容 * 袁新成 2015/04/17 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Reflection; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.Client.Controls; using Dongke.IBOSS.PRD.Client.DataModels; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; namespace Dongke.IBOSS.PRD.Client.PCModule { /// /// 员工关联 /// public partial class F_PC_0701 : DKDockPanelBase { #region 成员变量 // 单例模式 private static F_PC_0701 _instance; // 正在查询 private bool _isSearching = false; #endregion #region 构造函数 public F_PC_0701() { InitializeComponent(); this.Text = "装配工序组件配置"; this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT; this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE; this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE; this.btnSearch.Text = ButtonText.BTN_SEARCH; this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION; } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PC_0701 Instance { get { if (_instance == null) { _instance = new F_PC_0701(); } return _instance; } } #endregion #region 事件 /// /// 搜索按钮事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { this._isSearching = true; this.dgvUser.DataSource = null; this.dgvPackingBOMDetail.DataSource = null; ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PC_0701"; cre.Name = "GetFinishedCheckProcedure"; cre.Properties["PROCEDURENAME"] = this.txtPROCEDURENAME.Text; ServiceResultEntity sre = DoAsync(() => { return PCModuleProxyNew.Service.HandleRequest(cre); }); if (sre.Status == Constant.ServiceResultStatus.Success) { this._isSearching = false; this.dgvUser.DataSource = sre.Data.Tables[0]; if (sre.Data.Tables[0].Rows.Count == 0) { // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空按钮事件 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.txtPROCEDURENAME.Clear(); } /// /// 选定项改变事件 /// /// /// private void dgvUser_SelectionChanged(object sender, EventArgs e) { try { if (this._isSearching) { return; } DataGridViewRow currentRow = this.dgvUser.CurrentRow; if (currentRow != null) { int id = Convert.ToInt32(currentRow.Cells["PROCEDUREID"].Value); // 调用服务器端获取数据集 ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PC_0701"; cre.Name = "GetIdnrktype"; cre.Properties["PROCEDUREID"] = id; ServiceResultEntity sre = DoAsync(() => { return PCModuleProxyNew.Service.HandleRequest(cre); }); if (sre.Status == Constant.ServiceResultStatus.Success) { this.dgvPackingBOMDetail.DataSource = sre.Data.Tables[0]; } } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } ///// ///// 选定项改变事件 ///// ///// ///// //private void dgvPackingBOM_SelectionChanged(object sender, EventArgs e) //{ // try // { // if (this._isSearching) // { // return; // } // DataGridViewRow currentRow = this.dgvPackingBOM.CurrentRow; // if (currentRow != null) // { // this.dgvPackingBOMDetail.DataSource = null; // // 调用服务器端获取数据集 // ClientRequestEntity cre = new ClientRequestEntity(); // cre.NameSpace = "F_PC_0701"; // cre.Name = "GetPackingBOMDetailData"; // cre.Properties["MATNR"] = currentRow.Cells["MATNR"].Value.ToString(); // cre.Properties["VERID"] = currentRow.Cells["VERID"].Value.ToString(); // ServiceResultEntity sre = DoAsync(() => // { // return PCModuleProxyNew.Service.HandleRequest(cre); // }); // if (sre.Status == Constant.ServiceResultStatus.Success) // { // this.dgvPackingBOMDetail.DataSource = sre.Data.Tables[0]; // } // } // } // catch (Exception ex) // { // // 对异常进行共通处理 // ExceptionManager.HandleEventException(this.ToString(), // MethodBase.GetCurrentMethod().Name, this.Text, ex); // } //} /// /// 新增按钮事件 /// /// /// private void tsbtnAddUser_Click(object sender, EventArgs e) { try { F_PC_0602 frmFPC0602 = new F_PC_0602(null, null); DialogResult dialogresult = frmFPC0602.ShowDialog(); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 单元格双击事件 /// /// /// private void dgvUser_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } this.tsbtnEditUser_Click(sender, e); } /// /// 编辑按钮事件 /// /// /// private void tsbtnEditUser_Click(object sender, EventArgs e) { try { if (this.dgvUser.SelectedRows.Count != 0) { string procedureId = this.dgvUser.SelectedRows[0].Cells["PROCEDUREID"].Value + ""; string procedureName = this.dgvUser.SelectedRows[0].Cells["PROCEDURENAME"].Value + ""; F_PC_0702 frmFPC0702 = new F_PC_0702(Convert.ToInt32(procedureId), procedureName); DialogResult dialogresult = frmFPC0702.ShowDialog(); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体加载事件 /// /// /// private void F_PC_0701_Load(object sender, EventArgs e) { // 按钮权限控制 FormPermissionManager.FormPermissionControl(this.Name, this, LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); } /// /// 自适应列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvUser.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); this.dgvPackingBOMDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 关闭按钮事件 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 释放窗体 /// /// /// private void F_PC_0701_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 /// /// 根据界面查询条件获取数据集 /// private DataSet GetSearchData() { try { FPC0601_SE se = new FPC0601_SE(); se.UserCode = this.txtPROCEDURENAME.Text; // 调用服务器端获取数据集 ServiceResultEntity sre = DoAsync(() => { return PCModuleProxyNew.Service.GetFPC0601SData(se); } ); if (sre.Status == Constant.ServiceResultStatus.Success) { return sre.Data; } return null; } catch (Exception ex) { throw ex; } } #endregion } }