F_MST_1401.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_1401.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.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.WCF.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. namespace Dongke.IBOSS.PRD.Client.SystemModule
  20. {
  21. /// <summary>
  22. /// 产品档案
  23. /// </summary>
  24. public partial class F_MST_1401 : DockPanelBase
  25. {
  26. #region 成员变量
  27. private static F_MST_1401 _instance; //单例模式
  28. #endregion
  29. #region 构造函数
  30. public F_MST_1401()
  31. {
  32. InitializeComponent();
  33. this.Text = "模具代码对应";
  34. // 按钮
  35. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  36. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  37. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  38. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  39. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  40. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  41. }
  42. #endregion
  43. #region 单例模式
  44. /// <summary>
  45. /// 单例模式,防止重复创建窗体
  46. /// </summary>
  47. public static F_MST_1401 Instance
  48. {
  49. get
  50. {
  51. if (_instance == null)
  52. {
  53. _instance = new F_MST_1401();
  54. }
  55. return _instance;
  56. }
  57. }
  58. #endregion
  59. #region 事件
  60. /// <summary>
  61. /// 窗体加载
  62. /// </summary>
  63. private void F_MST_1401_Load(object sender, EventArgs e)
  64. {
  65. try
  66. {
  67. this.dgvGoosKingdeecode.AutoGenerateColumns = false;
  68. this.loadDataSource();
  69. FormPermissionManager.FormPermissionControl(this.Name, this,
  70. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  71. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  72. }
  73. catch (Exception ex)
  74. {
  75. // 对异常进行共通处理
  76. ExceptionManager.HandleEventException(this.ToString(),
  77. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  78. }
  79. }
  80. /// <summary>
  81. /// 清空事件
  82. /// </summary>
  83. /// <param name="sender"></param>
  84. /// <param name="e"></param>
  85. private void btnClearCondition_Click(object sender, EventArgs e)
  86. {
  87. this.goodscodetxt.Clear();
  88. this.txtMOULDGOODSCODE.Clear();
  89. this.mouldName.Clear();
  90. }
  91. /// <summary>
  92. /// 查询事件
  93. /// </summary>
  94. /// <param name="sender"></param>
  95. /// <param name="e"></param>
  96. private void btnSearch_Click(object sender, EventArgs e)
  97. {
  98. try
  99. {
  100. this.DataSource = this.GetSearchData();
  101. if (this.DataSource != null)
  102. {
  103. this.dgvGoosKingdeecode.DataSource = this.DataSource.Tables[0];
  104. }
  105. }
  106. catch (Exception ex)
  107. {
  108. // 对异常进行共通处理
  109. ExceptionManager.HandleEventException(this.ToString(),
  110. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  111. }
  112. }
  113. /// <summary>
  114. /// 新建事件
  115. /// </summary>
  116. /// <param name="sender"></param>
  117. /// <param name="e"></param>
  118. private void tsbtnAdd_Click(object sender, EventArgs e)
  119. {
  120. try
  121. {
  122. F_MST_1402 frmMST1402 = new F_MST_1402(Constant.FormMode.Add,"","","");
  123. DialogResult dialogResult = frmMST1402.ShowDialog();
  124. // 重新加载GridView
  125. btnSearch_Click(sender, null);
  126. }
  127. catch (Exception ex)
  128. {
  129. // 对异常进行共通处理
  130. ExceptionManager.HandleEventException(this.ToString(),
  131. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  132. }
  133. }
  134. /// <summary>
  135. /// 编辑事件
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void tsbtnEdit_Click(object sender, EventArgs e)
  140. {
  141. try
  142. {
  143. if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
  144. {
  145. string MOULDGOODSCODE = this.dgvGoosKingdeecode.SelectedRows[0].Cells["MOULDGOODSCODE"].Value.ToString();
  146. string MOULDNAME = this.dgvGoosKingdeecode.SelectedRows[0].Cells["MOULDNAMES"].Value.ToString();
  147. string GoodsCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["GOODSCODE"].Value.ToString();
  148. F_MST_1402 frmFPC1402 = new F_MST_1402(Constant.FormMode.Edit, MOULDGOODSCODE, MOULDNAME, GoodsCode);
  149. DialogResult dialogresult = frmFPC1402.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_1401_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_1401";
  195. cre.Name = "GetMouldGoodsCode";
  196. cre.Properties["GoodsCode"] = this.goodscodetxt.Text;
  197. cre.Properties["MOULDNAME"] = this.mouldName.Text;
  198. cre.Properties["MOULDGOODSCODE"] = this.txtMOULDGOODSCODE.Text;
  199. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  200. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  201. {
  202. return sre.Data;
  203. }
  204. return null;
  205. }
  206. catch (Exception ex)
  207. {
  208. throw ex;
  209. }
  210. }
  211. /// <summary>
  212. /// 下拉框获取数据
  213. /// </summary>
  214. private void loadDataSource()
  215. {
  216. }
  217. #endregion
  218. private void delBtn_Click(object sender, EventArgs e)
  219. {
  220. try
  221. {
  222. if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
  223. {
  224. ClientRequestEntity cre = new ClientRequestEntity();
  225. cre.NameSpace = "F_MST_1401";
  226. cre.Name = "AddMouldCode";
  227. cre.Properties["FromStatus"] ="Delete";
  228. cre.Properties["GUID"] = this.dgvGoosKingdeecode.SelectedRows[0].Cells["GUID"].Value.ToString(); ;
  229. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  230. if (sre.OtherStatus > 0)
  231. {
  232. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  233. }
  234. btnSearch_Click(sender, null);//删除后重新查询数据
  235. }
  236. }
  237. catch (Exception ex)
  238. {
  239. // 对异常进行共通处理
  240. ExceptionManager.HandleEventException(this.ToString(),
  241. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  242. }
  243. }
  244. }
  245. }