/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_MST_1401.cs * 2.功能描述:产品档案 * 编辑履历: * 作者 日期 版本 修改内容 * 庄天威 2014/09/13 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseControls; using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Basics.DockPanel; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; namespace Dongke.IBOSS.PRD.Client.SystemModule { /// /// 产品档案 /// public partial class F_MST_1401 : DockPanelBase { #region 成员变量 private static F_MST_1401 _instance; //单例模式 #endregion #region 构造函数 public F_MST_1401() { InitializeComponent(); this.Text = "模具代码对应"; // 按钮 this.tsbtnAdd.Text = ButtonText.TSBTN_ADD; 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_MST_1401 Instance { get { if (_instance == null) { _instance = new F_MST_1401(); } return _instance; } } #endregion #region 事件 /// /// 窗体加载 /// private void F_MST_1401_Load(object sender, EventArgs e) { try { this.dgvGoosKingdeecode.AutoGenerateColumns = false; this.loadDataSource(); FormPermissionManager.FormPermissionControl(this.Name, this, Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空事件 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.goodscodetxt.Clear(); this.txtMOULDGOODSCODE.Clear(); this.mouldName.Clear(); } /// /// 查询事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { this.DataSource = this.GetSearchData(); if (this.DataSource != null) { this.dgvGoosKingdeecode.DataSource = this.DataSource.Tables[0]; } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 新建事件 /// /// /// private void tsbtnAdd_Click(object sender, EventArgs e) { try { F_MST_1402 frmMST1402 = new F_MST_1402(Constant.FormMode.Add,"","",""); DialogResult dialogResult = frmMST1402.ShowDialog(); // 重新加载GridView btnSearch_Click(sender, null); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 编辑事件 /// /// /// private void tsbtnEdit_Click(object sender, EventArgs e) { try { if (this.dgvGoosKingdeecode.SelectedRows.Count != 0) { string MOULDGOODSCODE = this.dgvGoosKingdeecode.SelectedRows[0].Cells["MOULDGOODSCODE"].Value.ToString(); string MOULDNAME = this.dgvGoosKingdeecode.SelectedRows[0].Cells["MOULDNAMES"].Value.ToString(); string GoodsCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["GOODSCODE"].Value.ToString(); F_MST_1402 frmFPC1402 = new F_MST_1402(Constant.FormMode.Edit, MOULDGOODSCODE, MOULDNAME, GoodsCode); DialogResult dialogresult = frmFPC1402.ShowDialog(); btnSearch_Click(sender, null); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 自适应列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvGoosKingdeecode.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 关闭事件 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 窗体关闭事件 /// /// /// private void F_MST_1401_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 private DataSet GetSearchData() { try { ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1401"; cre.Name = "GetMouldGoodsCode"; cre.Properties["GoodsCode"] = this.goodscodetxt.Text; cre.Properties["MOULDNAME"] = this.mouldName.Text; cre.Properties["MOULDGOODSCODE"] = this.txtMOULDGOODSCODE.Text; ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success) { return sre.Data; } return null; } catch (Exception ex) { throw ex; } } /// /// 下拉框获取数据 /// private void loadDataSource() { } #endregion private void delBtn_Click(object sender, EventArgs e) { try { if (this.dgvGoosKingdeecode.SelectedRows.Count != 0) { ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1401"; cre.Name = "AddMouldCode"; cre.Properties["FromStatus"] ="Delete"; cre.Properties["GUID"] = this.dgvGoosKingdeecode.SelectedRows[0].Cells["GUID"].Value.ToString(); ; ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.OtherStatus > 0) { DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002); } btnSearch_Click(sender, null);//删除后重新查询数据 } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } } }