/******************************************************************************* * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PC_1301.cs * 2.功能描述:作业指导书工序配置 * 编辑履历: * 作者 日期 版本 修改内容 * 秦祺 2023/06/13 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_1301 : DKDockPanelBase { #region 成员变量 // 单例模式 private static F_PC_1301 _instance; // 正在查询 private bool _isSearching = false; #endregion #region 构造函数 public F_PC_1301() { 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_1301 Instance { get { if (_instance == null) { _instance = new F_PC_1301(); } return _instance; } } #endregion #region 事件 /// /// 搜索按钮事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { this._isSearching = true; this.dgvSOPType.DataSource = null; this.dgvProcedureDetail.DataSource = null; ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PC_0801"; cre.Name = "GetLGORT"; cre.Properties["dictionaryvalue"] = this.txtSOPType.Text; cre.Properties["DICTIONARYTYPE"] = "TPC020"; //线边仓数据字典类别 ServiceResultEntity sre = DoAsync(() => { return PCModuleProxyNew.Service.HandleRequest(cre); }); if (sre.Status == Constant.ServiceResultStatus.Success) { this.Tag = false; if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0) { this._isSearching = false; this.dgvSOPType.DataSource = sre.Data.Tables[0]; dgvSOPType_SelectionChanged(null, null); } else { // 清空明细中的数据 this.dgvSOPType.DataSource = null; // 提示未查找到数据 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.txtSOPType.Clear(); } /// /// 选定项改变事件 /// /// /// private void dgvSOPType_SelectionChanged(object sender, EventArgs e) { try { if (this._isSearching) { return; } DataGridViewRow currentRow = this.dgvSOPType.CurrentRow; if (currentRow != null) { int id = Convert.ToInt32(currentRow.Cells["dictionaryID"].Value); // 调用服务器端获取数据集 ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PC_1301"; cre.Name = "GetProcedure"; cre.Properties["SOPTYPEID"] = id; cre.Properties["onlyflag"] = "0"; ServiceResultEntity sre = DoAsync(() => { return PCModuleProxyNew.Service.HandleRequest(cre); }); if (sre.Status == Constant.ServiceResultStatus.Success) { this.dgvProcedureDetail.DataSource = sre.Data.Tables[0]; } } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 单元格双击事件 /// /// /// private void dgvSOPType_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.dgvSOPType.SelectedRows.Count != 0) { string soptypeid = this.dgvSOPType.SelectedRows[0].Cells["dictionaryID"].Value + ""; string soptype = this.dgvSOPType.SelectedRows[0].Cells["dictionaryvalue"].Value + ""; F_PC_1302 frmFPC1302 = new F_PC_1302(Convert.ToInt32(soptypeid), soptype); DialogResult dialogresult = frmFPC1302.ShowDialog(); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体加载事件 /// /// /// private void F_PC_1301_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.dgvSOPType.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); this.dgvProcedureDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 关闭按钮事件 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 释放窗体 /// /// /// private void F_PC_1301_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 #endregion } }