F_MST_1301.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_1301.cs
  5. * 2.功能描述:产品档案
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/09/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Basics.DockPanel;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.SystemModule
  19. {
  20. /// <summary>
  21. /// 产品档案
  22. /// </summary>
  23. public partial class F_MST_1301 : DockPanelBase
  24. {
  25. #region 成员变量
  26. private static F_MST_1301 _instance; //单例模式
  27. #endregion
  28. #region 构造函数
  29. public F_MST_1301()
  30. {
  31. InitializeComponent();
  32. }
  33. #endregion
  34. #region 单例模式
  35. /// <summary>
  36. /// 单例模式,防止重复创建窗体
  37. /// </summary>
  38. public static F_MST_1301 Instance
  39. {
  40. get
  41. {
  42. if (_instance == null)
  43. {
  44. _instance = new F_MST_1301();
  45. }
  46. return _instance;
  47. }
  48. }
  49. #endregion
  50. #region 事件
  51. /// <summary>
  52. /// 窗体加载
  53. /// </summary>
  54. private void F_MST_1301_Load(object sender, EventArgs e)
  55. {
  56. try
  57. {
  58. this.loadDataSource();
  59. }
  60. catch (Exception ex)
  61. {
  62. // 对异常进行共通处理
  63. ExceptionManager.HandleEventException(this.ToString(),
  64. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  65. }
  66. }
  67. /// <summary>
  68. /// 清空事件
  69. /// </summary>
  70. /// <param name="sender"></param>
  71. /// <param name="e"></param>
  72. private void btnClearCondition_Click(object sender, EventArgs e)
  73. {
  74. this.txtGoodsCode.Clear();
  75. this.txtKingdeeCode.Clear();
  76. }
  77. /// <summary>
  78. /// 查询事件
  79. /// </summary>
  80. /// <param name="sender"></param>
  81. /// <param name="e"></param>
  82. private void btnSearch_Click(object sender, EventArgs e)
  83. {
  84. try
  85. {
  86. this.DataSource = this.GetSearchData();
  87. if (this.DataSource != null)
  88. {
  89. this.dgvGoosKingdeecode.DataSource = this.DataSource.Tables[0];
  90. }
  91. }
  92. catch (Exception ex)
  93. {
  94. // 对异常进行共通处理
  95. ExceptionManager.HandleEventException(this.ToString(),
  96. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  97. }
  98. }
  99. /// <summary>
  100. /// 新建事件
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. private void tsbtnAdd_Click(object sender, EventArgs e)
  105. {
  106. try
  107. {
  108. F_MST_1302 frmMST1302 = new F_MST_1302(Constant.FormMode.Add,"");
  109. DialogResult dialogResult = frmMST1302.ShowDialog();
  110. // 重新加载GridView
  111. btnSearch_Click(sender, null);
  112. }
  113. catch (Exception ex)
  114. {
  115. // 对异常进行共通处理
  116. ExceptionManager.HandleEventException(this.ToString(),
  117. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  118. }
  119. }
  120. /// <summary>
  121. /// 编辑事件
  122. /// </summary>
  123. /// <param name="sender"></param>
  124. /// <param name="e"></param>
  125. private void tsbtnEdit_Click(object sender, EventArgs e)
  126. {
  127. try
  128. {
  129. if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
  130. {
  131. string KingdeeCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["KINGDEECODE"].Value.ToString();
  132. F_MST_1302 frmFPC1302 = new F_MST_1302(Constant.FormMode.Edit, KingdeeCode);
  133. DialogResult dialogresult = frmFPC1302.ShowDialog();
  134. btnSearch_Click(sender, null);
  135. }
  136. }
  137. catch (Exception ex)
  138. {
  139. // 对异常进行共通处理
  140. ExceptionManager.HandleEventException(this.ToString(),
  141. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  142. }
  143. }
  144. /// <summary>
  145. /// 自适应列宽
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  150. {
  151. this.dgvGoosKingdeecode.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  152. }
  153. /// <summary>
  154. /// 关闭事件
  155. /// </summary>
  156. /// <param name="sender"></param>
  157. /// <param name="e"></param>
  158. private void tsbtnClose_Click(object sender, EventArgs e)
  159. {
  160. this.Close();
  161. }
  162. #endregion
  163. #region 私有方法
  164. private DataSet GetSearchData()
  165. {
  166. try
  167. {
  168. ClientRequestEntity cre = new ClientRequestEntity();
  169. cre.NameSpace = "F_MST_1301";
  170. cre.Name = "GetKingdeeCode";
  171. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text;
  172. cre.Properties["GlazeType"] = this.ddlGlazeTypeID.Text;
  173. cre.Properties["LogoName"] = this.ddlLogoName.Text;
  174. cre.Properties["KingdeeCode"] = this.txtKingdeeCode.Text;
  175. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  176. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  177. {
  178. return sre.Data;
  179. }
  180. return null;
  181. }
  182. catch (Exception ex)
  183. {
  184. throw ex;
  185. }
  186. }
  187. /// <summary>
  188. /// 下拉框获取数据
  189. /// </summary>
  190. private void loadDataSource()
  191. {
  192. try
  193. {
  194. ClientRequestEntity cre = new ClientRequestEntity();
  195. cre.NameSpace = "F_MST_1301";
  196. cre.Name = "GetGlazeType";
  197. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  198. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  199. {
  200. DataTable dtGlazeType = sre.Data.Tables[0];
  201. if (dtGlazeType != null)
  202. {
  203. ddlGlazeTypeID.DisplayMember = "GLAZETYPE";
  204. ddlGlazeTypeID.ValueMember = "ROWNUM";
  205. ddlGlazeTypeID.DataSource = dtGlazeType;
  206. }
  207. }
  208. cre = new ClientRequestEntity();
  209. cre.NameSpace = "F_MST_1301";
  210. cre.Name = "GetLogoName";
  211. sre = SystemModuleProxy.Service.DoRequest(cre);
  212. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  213. {
  214. DataTable dtLogoName = sre.Data.Tables[0];
  215. if (dtLogoName != null)
  216. {
  217. ddlLogoName.DisplayMember = "LOGONAME";
  218. ddlLogoName.ValueMember = "ROWNUM";
  219. ddlLogoName.DataSource = dtLogoName;
  220. }
  221. }
  222. }
  223. catch (Exception ex)
  224. {
  225. throw ex;
  226. }
  227. }
  228. #endregion
  229. }
  230. }