F_MST_1301.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. this.Text = "金蝶代码对应";
  33. // 按钮
  34. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  35. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  36. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  37. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  38. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  39. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  40. }
  41. #endregion
  42. #region 单例模式
  43. /// <summary>
  44. /// 单例模式,防止重复创建窗体
  45. /// </summary>
  46. public static F_MST_1301 Instance
  47. {
  48. get
  49. {
  50. if (_instance == null)
  51. {
  52. _instance = new F_MST_1301();
  53. }
  54. return _instance;
  55. }
  56. }
  57. #endregion
  58. #region 事件
  59. /// <summary>
  60. /// 窗体加载
  61. /// </summary>
  62. private void F_MST_1301_Load(object sender, EventArgs e)
  63. {
  64. try
  65. {
  66. this.dgvGoosKingdeecode.AutoGenerateColumns = false;
  67. this.loadDataSource();
  68. this.ddlGlazeTypeID.ClearValue();
  69. this.ddlLogoName.ClearValue();
  70. FormPermissionManager.FormPermissionControl(this.Name, this,
  71. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  72. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  73. }
  74. catch (Exception ex)
  75. {
  76. // 对异常进行共通处理
  77. ExceptionManager.HandleEventException(this.ToString(),
  78. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  79. }
  80. }
  81. /// <summary>
  82. /// 清空事件
  83. /// </summary>
  84. /// <param name="sender"></param>
  85. /// <param name="e"></param>
  86. private void btnClearCondition_Click(object sender, EventArgs e)
  87. {
  88. this.scbGoodsCode.ClearValue();
  89. this.ddlGlazeTypeID.ClearValue();
  90. this.ddlLogoName.ClearValue();
  91. this.txtKingdeeCode.Clear();
  92. }
  93. /// <summary>
  94. /// 查询事件
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. private void btnSearch_Click(object sender, EventArgs e)
  99. {
  100. try
  101. {
  102. this.DataSource = this.GetSearchData();
  103. if (this.DataSource != null)
  104. {
  105. this.dgvGoosKingdeecode.DataSource = this.DataSource.Tables[0];
  106. }
  107. }
  108. catch (Exception ex)
  109. {
  110. // 对异常进行共通处理
  111. ExceptionManager.HandleEventException(this.ToString(),
  112. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  113. }
  114. }
  115. /// <summary>
  116. /// 新建事件
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void tsbtnAdd_Click(object sender, EventArgs e)
  121. {
  122. try
  123. {
  124. F_MST_1302 frmMST1302 = new F_MST_1302(Constant.FormMode.Add,"");
  125. DialogResult dialogResult = frmMST1302.ShowDialog();
  126. // 重新加载GridView
  127. btnSearch_Click(sender, null);
  128. }
  129. catch (Exception ex)
  130. {
  131. // 对异常进行共通处理
  132. ExceptionManager.HandleEventException(this.ToString(),
  133. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  134. }
  135. }
  136. /// <summary>
  137. /// 编辑事件
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void tsbtnEdit_Click(object sender, EventArgs e)
  142. {
  143. try
  144. {
  145. if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
  146. {
  147. string KingdeeCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["KINGDEECODE"].Value.ToString();
  148. F_MST_1302 frmFPC1302 = new F_MST_1302(Constant.FormMode.Edit, KingdeeCode);
  149. DialogResult dialogresult = frmFPC1302.ShowDialog();
  150. btnSearch_Click(sender, null);
  151. }
  152. }
  153. catch (Exception ex)
  154. {
  155. // 对异常进行共通处理
  156. ExceptionManager.HandleEventException(this.ToString(),
  157. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  158. }
  159. }
  160. /// <summary>
  161. /// 自适应列宽
  162. /// </summary>
  163. /// <param name="sender"></param>
  164. /// <param name="e"></param>
  165. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  166. {
  167. this.dgvGoosKingdeecode.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  168. }
  169. /// <summary>
  170. /// 关闭事件
  171. /// </summary>
  172. /// <param name="sender"></param>
  173. /// <param name="e"></param>
  174. private void tsbtnClose_Click(object sender, EventArgs e)
  175. {
  176. this.Close();
  177. }
  178. /// <summary>
  179. /// 窗体关闭事件
  180. /// </summary>
  181. /// <param name="sender"></param>
  182. /// <param name="e"></param>
  183. private void F_MST_1301_FormClosed(object sender, FormClosedEventArgs e)
  184. {
  185. _instance = null;
  186. }
  187. #endregion
  188. #region 私有方法
  189. private DataSet GetSearchData()
  190. {
  191. try
  192. {
  193. ClientRequestEntity cre = new ClientRequestEntity();
  194. cre.NameSpace = "F_MST_1301";
  195. cre.Name = "GetKingdeeCode";
  196. cre.Properties["GoodsCode"] = this.scbGoodsCode.SearchedValue+ "";
  197. cre.Properties["GlazeType"] = this.ddlGlazeTypeID.Text;
  198. cre.Properties["LogoName"] = this.ddlLogoName.Text;
  199. cre.Properties["KingdeeCode"] = this.txtKingdeeCode.Text;
  200. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  201. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  202. {
  203. return sre.Data;
  204. }
  205. return null;
  206. }
  207. catch (Exception ex)
  208. {
  209. throw ex;
  210. }
  211. }
  212. /// <summary>
  213. /// 下拉框获取数据
  214. /// </summary>
  215. private void loadDataSource()
  216. {
  217. try
  218. {
  219. DataTable dtGlazeType = SystemModuleProxy.Service.GetDataDictionaryByType(Constant.DictionaryType.TPC002, Constant.INT_IS_ONE);
  220. if (dtGlazeType != null)
  221. {
  222. ddlGlazeTypeID.DisplayMember = "DictionaryValue";
  223. ddlGlazeTypeID.ValueMember = "DictionarylD";
  224. ddlGlazeTypeID.DataSource = dtGlazeType;
  225. }
  226. ClientRequestEntity cre = new ClientRequestEntity();
  227. cre.NameSpace = "F_MST_1301";
  228. cre.Name = "GetLogoName";
  229. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  230. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  231. {
  232. DataTable dtLogoName = sre.Data.Tables[0];
  233. if (dtLogoName != null)
  234. {
  235. ddlLogoName.DisplayMember = "LogoNameCode";
  236. ddlLogoName.ValueMember = "LogoID";
  237. ddlLogoName.DataSource = dtLogoName;
  238. }
  239. }
  240. }
  241. catch (Exception ex)
  242. {
  243. throw ex;
  244. }
  245. }
  246. #endregion
  247. }
  248. }