F_MST_1301.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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.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_1301 : DockPanelBase
  25. {
  26. #region 成员变量
  27. private static F_MST_1301 _instance; //单例模式
  28. #endregion
  29. #region 构造函数
  30. public F_MST_1301()
  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_1301 Instance
  48. {
  49. get
  50. {
  51. if (_instance == null)
  52. {
  53. _instance = new F_MST_1301();
  54. }
  55. return _instance;
  56. }
  57. }
  58. #endregion
  59. #region 事件
  60. /// <summary>
  61. /// 窗体加载
  62. /// </summary>
  63. private void F_MST_1301_Load(object sender, EventArgs e)
  64. {
  65. try
  66. {
  67. this.dgvGoosKingdeecode.AutoGenerateColumns = false;
  68. this.loadDataSource();
  69. this.ddlGlazeTypeID.ClearValue();
  70. this.ddlLogoName.ClearValue();
  71. FormPermissionManager.FormPermissionControl(this.Name, this,
  72. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  73. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  74. }
  75. catch (Exception ex)
  76. {
  77. // 对异常进行共通处理
  78. ExceptionManager.HandleEventException(this.ToString(),
  79. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  80. }
  81. }
  82. /// <summary>
  83. /// 清空事件
  84. /// </summary>
  85. /// <param name="sender"></param>
  86. /// <param name="e"></param>
  87. private void btnClearCondition_Click(object sender, EventArgs e)
  88. {
  89. this.scbGoodsCode.ClearValue();
  90. this.ddlGlazeTypeID.ClearValue();
  91. this.ddlLogoName.ClearValue();
  92. this.txtKingdeeCode.Clear();
  93. }
  94. /// <summary>
  95. /// 查询事件
  96. /// </summary>
  97. /// <param name="sender"></param>
  98. /// <param name="e"></param>
  99. private void btnSearch_Click(object sender, EventArgs e)
  100. {
  101. try
  102. {
  103. this.DataSource = this.GetSearchData();
  104. if (this.DataSource != null)
  105. {
  106. this.dgvGoosKingdeecode.DataSource = this.DataSource.Tables[0];
  107. }
  108. }
  109. catch (Exception ex)
  110. {
  111. // 对异常进行共通处理
  112. ExceptionManager.HandleEventException(this.ToString(),
  113. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  114. }
  115. }
  116. /// <summary>
  117. /// 新建事件
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void tsbtnAdd_Click(object sender, EventArgs e)
  122. {
  123. try
  124. {
  125. F_MST_1302 frmMST1302 = new F_MST_1302(Constant.FormMode.Add,"","","");
  126. DialogResult dialogResult = frmMST1302.ShowDialog();
  127. // 重新加载GridView
  128. btnSearch_Click(sender, null);
  129. }
  130. catch (Exception ex)
  131. {
  132. // 对异常进行共通处理
  133. ExceptionManager.HandleEventException(this.ToString(),
  134. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  135. }
  136. }
  137. /// <summary>
  138. /// 编辑事件
  139. /// </summary>
  140. /// <param name="sender"></param>
  141. /// <param name="e"></param>
  142. private void tsbtnEdit_Click(object sender, EventArgs e)
  143. {
  144. try
  145. {
  146. if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
  147. {
  148. string KingdeeCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["KINGDEECODE"].Value.ToString();
  149. string logname= this.dgvGoosKingdeecode.SelectedRows[0].Cells["LOGONAME"].Value.ToString();
  150. string GLAZETYPE= this.dgvGoosKingdeecode.SelectedRows[0].Cells["GLAZETYPE"].Value.ToString();
  151. F_MST_1302 frmFPC1302 = new F_MST_1302(Constant.FormMode.Edit, KingdeeCode, logname, GLAZETYPE);
  152. DialogResult dialogresult = frmFPC1302.ShowDialog();
  153. btnSearch_Click(sender, null);
  154. }
  155. }
  156. catch (Exception ex)
  157. {
  158. // 对异常进行共通处理
  159. ExceptionManager.HandleEventException(this.ToString(),
  160. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  161. }
  162. }
  163. /// <summary>
  164. /// 自适应列宽
  165. /// </summary>
  166. /// <param name="sender"></param>
  167. /// <param name="e"></param>
  168. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  169. {
  170. this.dgvGoosKingdeecode.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  171. }
  172. /// <summary>
  173. /// 关闭事件
  174. /// </summary>
  175. /// <param name="sender"></param>
  176. /// <param name="e"></param>
  177. private void tsbtnClose_Click(object sender, EventArgs e)
  178. {
  179. this.Close();
  180. }
  181. /// <summary>
  182. /// 窗体关闭事件
  183. /// </summary>
  184. /// <param name="sender"></param>
  185. /// <param name="e"></param>
  186. private void F_MST_1301_FormClosed(object sender, FormClosedEventArgs e)
  187. {
  188. _instance = null;
  189. }
  190. #endregion
  191. #region 私有方法
  192. private DataSet GetSearchData()
  193. {
  194. try
  195. {
  196. ClientRequestEntity cre = new ClientRequestEntity();
  197. cre.NameSpace = "F_MST_1301";
  198. cre.Name = "GetKingdeeCode";
  199. cre.Properties["GoodsCode"] = this.scbGoodsCode.SearchedValue+ "";
  200. cre.Properties["GlazeType"] = this.ddlGlazeTypeID.Text;
  201. cre.Properties["LogoName"] = this.ddlLogoName.Text;
  202. cre.Properties["KingdeeCode"] = this.txtKingdeeCode.Text;
  203. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  204. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  205. {
  206. return sre.Data;
  207. }
  208. return null;
  209. }
  210. catch (Exception ex)
  211. {
  212. throw ex;
  213. }
  214. }
  215. /// <summary>
  216. /// 下拉框获取数据
  217. /// </summary>
  218. private void loadDataSource()
  219. {
  220. try
  221. {
  222. DataTable dtGlazeType = SystemModuleProxy.Service.GetDataDictionaryByType(Constant.DictionaryType.TPC002, Constant.INT_IS_ONE);
  223. if (dtGlazeType != null)
  224. {
  225. ddlGlazeTypeID.DisplayMember = "DictionaryValue";
  226. ddlGlazeTypeID.ValueMember = "DictionarylD";
  227. ddlGlazeTypeID.DataSource = dtGlazeType;
  228. }
  229. ClientRequestEntity cre = new ClientRequestEntity();
  230. cre.NameSpace = "F_MST_1301";
  231. cre.Name = "GetLogoName";
  232. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  233. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  234. {
  235. DataTable dtLogoName = sre.Data.Tables[0];
  236. if (dtLogoName != null)
  237. {
  238. ddlLogoName.DisplayMember = "LogoNameCode";
  239. ddlLogoName.ValueMember = "LogoID";
  240. ddlLogoName.DataSource = dtLogoName;
  241. }
  242. }
  243. }
  244. catch (Exception ex)
  245. {
  246. throw ex;
  247. }
  248. }
  249. #endregion
  250. private void delBtn_Click(object sender, EventArgs e)
  251. {
  252. try
  253. {
  254. if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
  255. {
  256. ClientRequestEntity cre = new ClientRequestEntity();
  257. cre.NameSpace = "F_MST_1301";
  258. cre.Name = "AddKingdeeCode";
  259. cre.Properties["FromStatus"] ="Delete";
  260. cre.Properties["KINGDEECODEONE"] = this.dgvGoosKingdeecode.SelectedRows[0].Cells["KINGDEECODE"].Value.ToString(); ;
  261. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  262. if (sre.OtherStatus > 0)
  263. {
  264. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  265. }
  266. btnSearch_Click(sender, null);//删除后重新查询数据
  267. }
  268. }
  269. catch (Exception ex)
  270. {
  271. // 对异常进行共通处理
  272. ExceptionManager.HandleEventException(this.ToString(),
  273. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  274. }
  275. }
  276. }
  277. }