/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_MST_1301.cs * 2.功能描述:产品档案 * 编辑履历: * 作者 日期 版本 修改内容 * 庄天威 2014/09/13 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Windows.Forms; 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_1301 : DockPanelBase { #region 成员变量 private static F_MST_1301 _instance; //单例模式 #endregion #region 构造函数 public F_MST_1301() { 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_1301 Instance { get { if (_instance == null) { _instance = new F_MST_1301(); } return _instance; } } #endregion #region 事件 /// /// 窗体加载 /// private void F_MST_1301_Load(object sender, EventArgs e) { try { this.dgvGoosKingdeecode.AutoGenerateColumns = false; this.loadDataSource(); this.ddlGlazeTypeID.ClearValue(); this.ddlLogoName.ClearValue(); 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.scbGoodsCode.ClearValue(); this.ddlGlazeTypeID.ClearValue(); this.ddlLogoName.ClearValue(); this.txtKingdeeCode.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_1302 frmMST1302 = new F_MST_1302(Constant.FormMode.Add,""); DialogResult dialogResult = frmMST1302.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 KingdeeCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["KINGDEECODE"].Value.ToString(); F_MST_1302 frmFPC1302 = new F_MST_1302(Constant.FormMode.Edit, KingdeeCode); DialogResult dialogresult = frmFPC1302.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_1301_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 private DataSet GetSearchData() { try { ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1301"; cre.Name = "GetKingdeeCode"; cre.Properties["GoodsCode"] = this.scbGoodsCode.SearchedValue+ ""; cre.Properties["GlazeType"] = this.ddlGlazeTypeID.Text; cre.Properties["LogoName"] = this.ddlLogoName.Text; cre.Properties["KingdeeCode"] = this.txtKingdeeCode.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() { try { DataTable dtGlazeType = SystemModuleProxy.Service.GetDataDictionaryByType(Constant.DictionaryType.TPC002, Constant.INT_IS_ONE); if (dtGlazeType != null) { ddlGlazeTypeID.DisplayMember = "DictionaryValue"; ddlGlazeTypeID.ValueMember = "DictionarylD"; ddlGlazeTypeID.DataSource = dtGlazeType; } ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1301"; cre.Name = "GetLogoName"; ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success) { DataTable dtLogoName = sre.Data.Tables[0]; if (dtLogoName != null) { ddlLogoName.DisplayMember = "LogoNameCode"; ddlLogoName.ValueMember = "LogoID"; ddlLogoName.DataSource = dtLogoName; } } } catch (Exception ex) { throw ex; } } #endregion } }