F_PM_3001.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_3001.cs
  5. * 2.功能描述:产品挂起
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2018/05/17 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_3001 : DockPanelBase
  24. {
  25. #region 成员变量
  26. private static F_PM_3001 _instance; //单例模式
  27. #endregion
  28. #region 构造函数
  29. /// <summary>
  30. /// 废弃一览构造
  31. /// </summary>
  32. private F_PM_3001()
  33. {
  34. InitializeComponent();
  35. this.Text = "产品挂起";
  36. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  37. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  38. this.tsbtnSuspend.Text = ButtonText.TSBTN_SUSPEND;
  39. this.tsbtnRevokeSuspend.Text = ButtonText.TSBTN_FINISHEDCANCELHANDOVER;
  40. this.cbSelectTime.Checked = true;
  41. this.txtDateStart.Value = DateTime.Now.Date;
  42. this.txtDateEnd.Value = DateTime.Now.Date;
  43. }
  44. #endregion
  45. #region 单例模式
  46. /// <summary>
  47. /// 单例模式,防止重复创建窗体
  48. /// </summary>
  49. public static F_PM_3001 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null)
  54. {
  55. _instance = new F_PM_3001();
  56. }
  57. return _instance;
  58. }
  59. }
  60. #endregion
  61. #region 事件
  62. /// <summary>
  63. /// 窗体加载
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void F_PM_3001_Load(object sender, EventArgs e)
  68. {
  69. try
  70. {
  71. this.dgvScrapProduct.AutoGenerateColumns = false;
  72. // 加载权限
  73. //FormPermissionManager.FormPermissionControl(this.Name, this,
  74. // Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  75. // Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  76. }
  77. catch (Exception ex)
  78. {
  79. // 对异常进行共通处理
  80. ExceptionManager.HandleEventException(this.ToString(),
  81. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  82. }
  83. }
  84. /// <summary>
  85. /// 查询事件
  86. /// </summary>
  87. /// <param name="sender"></param>
  88. /// <param name="e"></param>
  89. private void btnSearch_Click(object sender, EventArgs e)
  90. {
  91. try
  92. {
  93. DataSet dsScrapProduct = (DataSet)DoAsync(new AsyncMethod(() =>
  94. {
  95. return this.GetScrapProduct();
  96. }));
  97. if (dsScrapProduct != null)
  98. {
  99. if (dsScrapProduct.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  100. {
  101. this.dgvScrapProduct.DataSource = ((DataSet)dsScrapProduct).Tables[Constant.INT_IS_ZERO];
  102. this.dgvScrapProduct.ReadOnly = true;
  103. }
  104. else
  105. {
  106. this.dgvScrapProduct.DataSource = null;
  107. // 提示未查找到数据
  108. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  109. MessageBoxButtons.OK, MessageBoxIcon.Information);
  110. }
  111. }
  112. else
  113. {
  114. this.dgvScrapProduct.DataSource = null;
  115. // 提示未查找到数据
  116. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  117. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  118. }
  119. }
  120. catch (Exception ex)
  121. {
  122. // 对异常进行共通处理
  123. ExceptionManager.HandleEventException(this.ToString(),
  124. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  125. }
  126. }
  127. /// <summary>
  128. /// 挂起按钮点击事件
  129. /// </summary>
  130. /// <param name="sender"></param>
  131. /// <param name="e"></param>
  132. private void tsbtnSuspend_Click(object sender, EventArgs e)
  133. {
  134. // 产品挂起
  135. F_PM_3002 frm3002 = new F_PM_3002("挂起");
  136. DialogResult dialogResult = frm3002.ShowDialog();
  137. }
  138. /// <summary>
  139. /// 撤销按钮点击事件
  140. /// </summary>
  141. /// <param name="sender"></param>
  142. /// <param name="e"></param>
  143. private void tsbtnRevokeSuspend_Click(object sender, EventArgs e)
  144. {
  145. // 产品撤销
  146. F_PM_3002 frm3002 = new F_PM_3002("撤销");
  147. DialogResult dialogResult = frm3002.ShowDialog();
  148. }
  149. /// <summary>
  150. /// 时间有效性切换
  151. /// </summary>
  152. /// <param name="sender"></param>
  153. /// <param name="e"></param>
  154. private void cbSelectTime_CheckedChanged(object sender, EventArgs e)
  155. {
  156. this.txtDateStart.Enabled = this.cbSelectTime.Checked;
  157. this.txtDateEnd.Enabled = this.cbSelectTime.Checked;
  158. }
  159. /// <summary>
  160. /// 清空条件
  161. /// </summary>
  162. /// <param name="sender"></param>
  163. /// <param name="e"></param>
  164. private void btnClearCondition_Click(object sender, EventArgs e)
  165. {
  166. this.txtBarCode.Text = "";
  167. this.cbSelectTime.Checked = true;
  168. this.txtDateStart.Value = DateTime.Now.Date;
  169. this.txtDateEnd.Value = DateTime.Now.Date;
  170. this.txtRemarks.Text = "";
  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_PM_3001_FormClosed(object sender, FormClosedEventArgs e)
  187. {
  188. _instance = null;
  189. }
  190. /// <summary>
  191. /// 自动列宽
  192. /// </summary>
  193. /// <param name="sender"></param>
  194. /// <param name="e"></param>
  195. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  196. {
  197. this.dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  198. }
  199. #endregion
  200. #region 私有方法
  201. /// <summary>
  202. /// 根据界面查询条件获取数据集
  203. /// </summary>
  204. private DataSet GetScrapProduct()
  205. {
  206. try
  207. {
  208. ClientRequestEntity cre = new ClientRequestEntity();
  209. cre.NameSpace = "ProductSuspend";
  210. cre.Name = "GetAllSuspendProduct";
  211. cre.Properties["barcode"] = this.txtBarCode.Text.Trim();
  212. cre.Properties["remarks"] = this.txtRemarks.Text.Trim();
  213. if (this.cbSelectTime.Checked)
  214. {
  215. cre.Properties["datefrom"] = this.txtDateStart.Value;
  216. cre.Properties["dateend"] = this.txtDateEnd.Value.AddDays(1).AddSeconds(-1);
  217. }
  218. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  219. return result.Data;
  220. }
  221. catch (Exception ex)
  222. {
  223. throw ex;
  224. }
  225. }
  226. #endregion
  227. }
  228. }