F_MST_1301.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. string logname= this.dgvGoosKingdeecode.SelectedRows[0].Cells["LOGONAME"].Value.ToString();
  149. string GLAZETYPE= this.dgvGoosKingdeecode.SelectedRows[0].Cells["GLAZETYPE"].Value.ToString();
  150. F_MST_1302 frmFPC1302 = new F_MST_1302(Constant.FormMode.Edit, KingdeeCode, logname, GLAZETYPE);
  151. DialogResult dialogresult = frmFPC1302.ShowDialog();
  152. btnSearch_Click(sender, null);
  153. }
  154. }
  155. catch (Exception ex)
  156. {
  157. // 对异常进行共通处理
  158. ExceptionManager.HandleEventException(this.ToString(),
  159. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  160. }
  161. }
  162. /// <summary>
  163. /// 自适应列宽
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  168. {
  169. this.dgvGoosKingdeecode.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  170. }
  171. /// <summary>
  172. /// 关闭事件
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. private void tsbtnClose_Click(object sender, EventArgs e)
  177. {
  178. this.Close();
  179. }
  180. /// <summary>
  181. /// 窗体关闭事件
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. private void F_MST_1301_FormClosed(object sender, FormClosedEventArgs e)
  186. {
  187. _instance = null;
  188. }
  189. #endregion
  190. #region 私有方法
  191. private DataSet GetSearchData()
  192. {
  193. try
  194. {
  195. ClientRequestEntity cre = new ClientRequestEntity();
  196. cre.NameSpace = "F_MST_1301";
  197. cre.Name = "GetKingdeeCode";
  198. cre.Properties["GoodsCode"] = this.scbGoodsCode.SearchedValue+ "";
  199. cre.Properties["GlazeType"] = this.ddlGlazeTypeID.Text;
  200. cre.Properties["LogoName"] = this.ddlLogoName.Text;
  201. cre.Properties["KingdeeCode"] = this.txtKingdeeCode.Text;
  202. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  203. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  204. {
  205. return sre.Data;
  206. }
  207. return null;
  208. }
  209. catch (Exception ex)
  210. {
  211. throw ex;
  212. }
  213. }
  214. /// <summary>
  215. /// 下拉框获取数据
  216. /// </summary>
  217. private void loadDataSource()
  218. {
  219. try
  220. {
  221. DataTable dtGlazeType = SystemModuleProxy.Service.GetDataDictionaryByType(Constant.DictionaryType.TPC002, Constant.INT_IS_ONE);
  222. if (dtGlazeType != null)
  223. {
  224. ddlGlazeTypeID.DisplayMember = "DictionaryValue";
  225. ddlGlazeTypeID.ValueMember = "DictionarylD";
  226. ddlGlazeTypeID.DataSource = dtGlazeType;
  227. }
  228. ClientRequestEntity cre = new ClientRequestEntity();
  229. cre.NameSpace = "F_MST_1301";
  230. cre.Name = "GetLogoName";
  231. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  232. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  233. {
  234. DataTable dtLogoName = sre.Data.Tables[0];
  235. if (dtLogoName != null)
  236. {
  237. ddlLogoName.DisplayMember = "LogoNameCode";
  238. ddlLogoName.ValueMember = "LogoID";
  239. ddlLogoName.DataSource = dtLogoName;
  240. }
  241. }
  242. }
  243. catch (Exception ex)
  244. {
  245. throw ex;
  246. }
  247. }
  248. #endregion
  249. }
  250. }