/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_SAPCode.cs * 2.功能描述:产品类别Search查询页面 * 编辑履历: * 作者 日期 版本 修改内容 * 付斌 2014/09/12 1.00 新建 *******************************************************************************/ using System; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseControls; using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; namespace Dongke.IBOSS.PRD.Client.Controls.SearchBox { /// /// 物料品牌 /// public partial class F_SAPCode : SearchBoxForm { #region 成员变量 private bool _isOnlyDisplayEnd; #endregion #region 构造函数 /// /// 查询窗体 /// public F_SAPCode() { InitializeComponent(); } #endregion #region 公有方法 /// /// 设置查询条件 /// public override void SetConditions(params object[] values) { if (values.Length > 1) { base.dgvChecked.AutoGenerateColumns = false; base.dgvChecked.DataSource = values[1]; //_isOnlyDisplayEnd = Convert.ToBoolean(values[1] + ""); } } /// /// 清除查询条件 /// public override void ClearConditions() { this.txtGoodsCode.Clear(); this.txtMatnr.Clear(); } #endregion #region 保护方法 /// /// 初始化Form /// protected override void InitForm() { DataGridViewTextBoxColumn MaterialCode = new DataGridViewTextBoxColumn(); MaterialCode.Name = "MaterialCode"; MaterialCode.HeaderText = "物料编码"; MaterialCode.ReadOnly = true; MaterialCode.SortMode = DataGridViewColumnSortMode.Automatic; MaterialCode.DataPropertyName = "MaterialCode"; DataGridViewTextBoxColumn MaterialName = new DataGridViewTextBoxColumn(); MaterialName.Name = "MaterialName"; MaterialName.HeaderText = "物料名称"; MaterialName.ReadOnly = true; MaterialName.SortMode = DataGridViewColumnSortMode.Automatic; MaterialName.DataPropertyName = "MaterialName"; DataGridViewTextBoxColumn GoodsCode = new DataGridViewTextBoxColumn(); GoodsCode.Name = "GoodsCode"; GoodsCode.HeaderText = "产品编码"; GoodsCode.ReadOnly = true; GoodsCode.SortMode = DataGridViewColumnSortMode.Automatic; GoodsCode.DataPropertyName = "GoodsCode"; GoodsCode.DefaultCellStyle = new DataGridViewCellStyle(); DataGridViewTextBoxColumn LogoName = new DataGridViewTextBoxColumn(); LogoName.Name = "LogoName"; LogoName.HeaderText = "商标"; LogoName.ReadOnly = true; LogoName.SortMode = DataGridViewColumnSortMode.Automatic; LogoName.DataPropertyName = "LogoName"; this.dgvSelected.Columns.AddRange(MaterialCode, MaterialName, GoodsCode, LogoName); base.InitForm(); } /// /// 查询数据。 /// /// 验证通过true,其他false protected override bool QueryDataFromOther() { ServiceResultEntity sre = this.GetDataTable(); if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0) { this.dgvSelected.DataSource = sre.Data.Tables[0]; this.dgvSelected.Rows[0].Selected = true; return true; } else { return false; } } #endregion #region 私有方法 private ServiceResultEntity GetDataTable() { try { // 异步处理,获取系统参数信息 ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_SAPCode"; cre.Name = "GetSAPCode"; cre.Properties["goodscode"] = this.txtGoodsCode.Text.Trim(); cre.Properties["matnr"] = this.txtMatnr.Text.Trim(); // 调用服务器端获取数据集(DataSet)DoAsync(new BaseAsyncMethod(GetSystemData)); ServiceResultEntity sre = null; DoAsync(() => { return CommonModuleProxy.Service.DoRequest(cre); }, out sre); if (!(sre.Status == Constant.ServiceResultStatus.Success)) { //StateMessageClass.GetErrorMessageByStatus(this, sre.Status); // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } return sre; } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); return null; } } #endregion private void F_SAPCode_Load(object sender, EventArgs e) { GetDataTable(); } } }