F_SAPCode.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_SAPCode.cs
  5. * 2.功能描述:产品类别Search查询页面
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 付斌 2014/09/12 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Windows.Forms;
  12. using Dongke.IBOSS.PRD.Basics.BaseControls;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.WCF.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. namespace Dongke.IBOSS.PRD.Client.Controls.SearchBox
  18. {
  19. /// <summary>
  20. /// 物料品牌
  21. /// </summary>
  22. public partial class F_SAPCode : SearchBoxForm
  23. {
  24. #region 成员变量
  25. private bool _isOnlyDisplayEnd;
  26. #endregion
  27. #region 构造函数
  28. /// <summary>
  29. /// 查询窗体
  30. /// </summary>
  31. public F_SAPCode()
  32. {
  33. InitializeComponent();
  34. }
  35. #endregion
  36. #region 公有方法
  37. /// <summary>
  38. /// 设置查询条件
  39. /// </summary>
  40. public override void SetConditions(params object[] values)
  41. {
  42. if (values.Length > 1)
  43. {
  44. base.dgvChecked.AutoGenerateColumns = false;
  45. base.dgvChecked.DataSource = values[1];
  46. //_isOnlyDisplayEnd = Convert.ToBoolean(values[1] + "");
  47. }
  48. }
  49. /// <summary>
  50. /// 清除查询条件
  51. /// </summary>
  52. public override void ClearConditions()
  53. {
  54. this.txtGoodsCode.Clear();
  55. this.txtMatnr.Clear();
  56. }
  57. #endregion
  58. #region 保护方法
  59. /// <summary>
  60. /// 初始化Form
  61. /// </summary>
  62. protected override void InitForm()
  63. {
  64. DataGridViewTextBoxColumn MaterialCode = new DataGridViewTextBoxColumn();
  65. MaterialCode.Name = "MaterialCode";
  66. MaterialCode.HeaderText = "物料编码";
  67. MaterialCode.ReadOnly = true;
  68. MaterialCode.SortMode = DataGridViewColumnSortMode.Automatic;
  69. MaterialCode.DataPropertyName = "MaterialCode";
  70. DataGridViewTextBoxColumn GoodsCode = new DataGridViewTextBoxColumn();
  71. GoodsCode.Name = "GoodsCode";
  72. GoodsCode.HeaderText = "产品编码";
  73. GoodsCode.ReadOnly = true;
  74. GoodsCode.SortMode = DataGridViewColumnSortMode.Automatic;
  75. GoodsCode.DataPropertyName = "GoodsCode";
  76. GoodsCode.DefaultCellStyle = new DataGridViewCellStyle();
  77. DataGridViewTextBoxColumn LogoName = new DataGridViewTextBoxColumn();
  78. LogoName.Name = "LogoName";
  79. LogoName.HeaderText = "商标";
  80. LogoName.ReadOnly = true;
  81. LogoName.SortMode = DataGridViewColumnSortMode.Automatic;
  82. LogoName.DataPropertyName = "LogoName";
  83. this.dgvSelected.Columns.AddRange(MaterialCode, GoodsCode, LogoName);
  84. base.InitForm();
  85. }
  86. /// <summary>
  87. /// 查询数据。
  88. /// </summary>
  89. /// <returns>验证通过true,其他false</returns>
  90. protected override bool QueryDataFromOther()
  91. {
  92. ServiceResultEntity sre = this.GetDataTable();
  93. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  94. {
  95. this.dgvSelected.DataSource = sre.Data.Tables[0];
  96. this.dgvSelected.Rows[0].Selected = true;
  97. return true;
  98. }
  99. else
  100. {
  101. return false;
  102. }
  103. }
  104. #endregion
  105. #region 私有方法
  106. private ServiceResultEntity GetDataTable()
  107. {
  108. try
  109. {
  110. // 异步处理,获取系统参数信息
  111. ClientRequestEntity cre = new ClientRequestEntity();
  112. cre.NameSpace = "F_SAPCode";
  113. cre.Name = "GetSAPCode";
  114. cre.Properties["goodscode"] = this.txtGoodsCode.Text.Trim();
  115. cre.Properties["matnr"] = this.txtMatnr.Text.Trim();
  116. // 调用服务器端获取数据集(DataSet)DoAsync(new BaseAsyncMethod(GetSystemData));
  117. ServiceResultEntity sre = null;
  118. DoAsync(() => { return CommonModuleProxy.Service.DoRequest(cre); }, out sre);
  119. if (!(sre.Status == Constant.ServiceResultStatus.Success))
  120. {
  121. //StateMessageClass.GetErrorMessageByStatus(this, sre.Status);
  122. // 提示未查找到数据
  123. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  124. MessageBoxButtons.OK, MessageBoxIcon.Information);
  125. }
  126. return sre;
  127. }
  128. catch (Exception ex)
  129. {
  130. // 对异常进行共通处理
  131. ExceptionManager.HandleEventException(this.ToString(),
  132. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  133. return null;
  134. }
  135. }
  136. #endregion
  137. private void F_SAPCode_Load(object sender, EventArgs e)
  138. {
  139. GetDataTable();
  140. }
  141. }
  142. }