F_PM_3301.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_3301.cs
  5. * 2.功能描述:废弃产品信息一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 付斌 2020/11/06 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.PMModule
  19. {
  20. /// <summary>
  21. /// 废弃产品信息一览
  22. /// </summary>
  23. public partial class F_PM_3301 : DockPanelBase
  24. {
  25. #region 成员变量
  26. private static F_PM_3301 _instance; //单例模式
  27. #endregion
  28. #region 构造函数
  29. /// <summary>
  30. /// 废弃一览构造
  31. /// </summary>
  32. public F_PM_3301()
  33. {
  34. InitializeComponent();
  35. Text = FormTitles.F_PM_3301;
  36. dtpScrapDateStart.Enabled = true;
  37. dtpScrapDateEnd.Enabled = true;
  38. tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  39. tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  40. }
  41. #endregion
  42. #region 单例模式
  43. /// <summary>
  44. /// 单例模式,防止重复创建窗体
  45. /// </summary>
  46. public static F_PM_3301 Instance
  47. {
  48. get
  49. {
  50. if (_instance == null)
  51. {
  52. _instance = new F_PM_3301();
  53. }
  54. return _instance;
  55. }
  56. }
  57. #endregion
  58. #region 事件
  59. /// <summary>
  60. /// 窗体加载
  61. /// </summary>
  62. /// <param name="sender"></param>
  63. /// <param name="e"></param>
  64. private void F_PM_3301_Load(object sender, EventArgs e)
  65. {
  66. try
  67. {
  68. // 加载权限
  69. FormPermissionManager.FormPermissionControl(Name, this,
  70. DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  71. DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  72. // 损坯原因
  73. DataSet dsRreason = (DataSet)DoAsync(
  74. () => { return SystemModuleProxy.Service.GetDictionaryData(0, "TPC009"); });
  75. DataRow row = dsRreason.Tables[0].NewRow();
  76. row["DictionaryValue"] = "";
  77. row["DictionaryID"] = 0;
  78. dsRreason.Tables[0].Rows.InsertAt(row, 0);
  79. cmbRreason.DisplayMember = "DictionaryValue";
  80. cmbRreason.ValueMember = "DictionaryID";
  81. cmbRreason.DataSource = dsRreason.Tables[0];
  82. dgvScrapProduct.AutoGenerateColumns = false;
  83. dtpScrapDateStart.Value = DateTime.Now.Date;
  84. dtpScrapDateEnd.Value = DateTime.Now.Date;
  85. }
  86. catch (Exception ex)
  87. {
  88. // 对异常进行共通处理
  89. ExceptionManager.HandleEventException(ToString(),
  90. System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex);
  91. }
  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. dgvScrapProduct.DataSource = null;
  103. // 异步处理
  104. ClientRequestEntity cre = new ClientRequestEntity();
  105. cre.NameSpace = "F_PM_3302";
  106. cre.Name = "GetAllocateOut";
  107. cre.Data = new DataSet();
  108. cre.Properties["barcode"] = txtBarCode.Text.Trim();
  109. cre.Properties["goodscode"] = txtGoodsCode.Text.Trim();
  110. cre.Properties["goodsname"] = txtGoodsName.Text.Trim();
  111. cre.Properties["scrapdatestart"] = dtpScrapDateStart.Value;
  112. cre.Properties["scrapdateend"] = dtpScrapDateEnd.Value.AddDays(1);
  113. cre.Properties["groutinglinecode"] = txtGroutingLineCode.Text.Trim();
  114. cre.Properties["groutinglinename"] = txtGroutingLineName.Text.Trim();
  115. cre.Properties["rreason"] = cmbRreason.Text.Trim();
  116. cre.Properties["remarks"] = txtRemarks.Text.Trim();
  117. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(
  118. () => { return PMModuleProxyNew.Service.HandleRequest(cre); });
  119. if (sre.Data != null && sre.Data.Tables[0].Rows.Count > 0)
  120. {
  121. dgvScrapProduct.DataSource = sre.Data.Tables[Constant.INT_IS_ZERO];
  122. }
  123. else
  124. {
  125. // 提示未查找到数据
  126. MessageBox.Show(Messages.MSG_CMN_I002, Text,
  127. MessageBoxButtons.OK, MessageBoxIcon.Information);
  128. }
  129. }
  130. catch (Exception ex)
  131. {
  132. // 对异常进行共通处理
  133. ExceptionManager.HandleEventException(ToString(),
  134. System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex);
  135. }
  136. }
  137. /// <summary>
  138. /// 清空条件
  139. /// </summary>
  140. /// <param name="sender"></param>
  141. /// <param name="e"></param>
  142. private void btnClearCondition_Click(object sender, EventArgs e)
  143. {
  144. txtBarCode.Text = "";
  145. txtGoodsCode.Text = "";
  146. txtGoodsName.Text = "";
  147. txtGroutingLineCode.Text = "";
  148. txtGroutingLineName.Text = "";
  149. txtRemarks.Text = "";
  150. cmbRreason.SelectedIndex = 0;
  151. dtpScrapDateStart.Value = DateTime.Now.Date;
  152. dtpScrapDateEnd.Value = DateTime.Now.Date;
  153. }
  154. /// <summary>
  155. /// 调出窗体打开事件
  156. /// </summary>
  157. /// <param name="sender"></param>
  158. /// <param name="e"></param>
  159. private void tsbtnAllocateOut_Click(object sender, EventArgs e)
  160. {
  161. try
  162. {
  163. F_PM_3302 frm = new F_PM_3302();
  164. frm.FormType = Constant.FormMode.Add;
  165. DialogResult dialogresult = frm.ShowDialog();
  166. if (dialogresult.Equals(DialogResult.OK))
  167. {
  168. btnSearch_Click(null, null);
  169. }
  170. }
  171. catch (Exception ex)
  172. {
  173. // 对异常进行共通处理
  174. ExceptionManager.HandleEventException(ToString(),
  175. System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex);
  176. }
  177. }
  178. /// <summary>
  179. /// 撤销窗体打开事件
  180. /// </summary>
  181. /// <param name="sender"></param>
  182. /// <param name="e"></param>
  183. private void tsbtnCancelAllocateOut_Click(object sender, EventArgs e)
  184. {
  185. try
  186. {
  187. F_PM_3302 frm = new F_PM_3302();
  188. frm.FormType = Constant.FormMode.Edit;
  189. DialogResult dialogresult = frm.ShowDialog();
  190. if (dialogresult.Equals(DialogResult.OK))
  191. {
  192. btnSearch_Click(null, null);
  193. }
  194. }
  195. catch (Exception ex)
  196. {
  197. // 对异常进行共通处理
  198. ExceptionManager.HandleEventException(ToString(),
  199. System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex);
  200. }
  201. }
  202. /// <summary>
  203. /// 自动列宽
  204. /// </summary>
  205. /// <param name="sender"></param>
  206. /// <param name="e"></param>
  207. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  208. {
  209. dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  210. }
  211. /// <summary>
  212. /// 关闭一览窗体
  213. /// </summary>
  214. /// <param name="sender"></param>
  215. /// <param name="e"></param>
  216. private void tsbtnClose_Click(object sender, EventArgs e)
  217. {
  218. Close();
  219. }
  220. /// <summary>
  221. /// 窗体关闭事件
  222. /// </summary>
  223. /// <param name="sender"></param>
  224. /// <param name="e"></param>
  225. private void F_PM_3301_FormClosed(object sender, FormClosedEventArgs e)
  226. {
  227. _instance = null;
  228. }
  229. #endregion
  230. }
  231. }