F_PM_2111.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2111.cs
  5. * 2.功能描述:批量清除在产回收站数据
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/08/11 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseControls;
  16. using Dongke.IBOSS.PRD.Basics.BaseResources;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.PMModule
  22. {
  23. public partial class F_PM_2111 : DKFormBase
  24. {
  25. #region 构造函数
  26. public F_PM_2111()
  27. {
  28. InitializeComponent();
  29. this.btnClose.Text = ButtonText.BTN_CLOSE;
  30. this.btnSave.Text = ButtonText.BTN_SAVE;
  31. }
  32. #endregion
  33. #region 事件
  34. /// <summary>
  35. /// 关闭按钮事件
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. private void tsbtnClose_Click(object sender, EventArgs e)
  40. {
  41. this.Close();
  42. }
  43. /// <summary>
  44. /// 窗体加载事件
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="e"></param>
  48. private void F_PM_2111_Load(object sender, EventArgs e)
  49. {
  50. this.dtpUpdateTimeStart.Value = DateTime.Now.Date;
  51. this.dtpUpdateTimeEnd.Value = DateTime.Now.Date;
  52. this.dtpScrapDateStart.Value = DateTime.Now.Date;
  53. this.dtpScrapDateEnd.Value = DateTime.Now.Date;
  54. //绑定产品分级
  55. BindGoodsType();
  56. }
  57. /// <summary>
  58. /// 保存按钮事件
  59. /// </summary>
  60. /// <param name="sender"></param>
  61. /// <param name="e"></param>
  62. private void btnSave_Click(object sender, EventArgs e)
  63. {
  64. try
  65. {
  66. DialogResult dialogResult
  67. = MessageBox.Show("确认是否清除符合条件的产品?",
  68. this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  69. if (dialogResult.Equals(DialogResult.No))
  70. {
  71. return;
  72. }
  73. FPM2110_SE se = new FPM2110_SE();
  74. se.ProductionLineIDS = dkproductionLineSearchBox.ProductionLineIDS;
  75. se.ProcedureIDS = dkProcedureSearchBox.ProcedureIDS;
  76. se.UpdateTimeStart = DateTime.Parse(this.dtpUpdateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  77. se.UpdateTimeEnd = DateTime.Parse(this.dtpUpdateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  78. //报废日期
  79. se.ScrapDataStart = DateTime.Parse(this.dtpScrapDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  80. se.ScrapDataEnd = DateTime.Parse(this.dtpScrapDateEnd.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  81. se.GooddLevelTypeID = Convert.ToInt32(comGoodsType.SelectedValue);
  82. // 清除
  83. int result = (int)DoAsync(() =>
  84. {
  85. return PMModuleProxy.Service.SaveClearAllInproductionTrash(se);
  86. });
  87. if (result > Constant.INT_IS_ZERO)
  88. {
  89. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "在产回收站产品", "批量清除数据"),
  90. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  91. // 刷新窗口数据
  92. this.DialogResult = DialogResult.OK;
  93. }
  94. else
  95. {
  96. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "在产回收站产品", "批量清除数据"),
  97. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  98. return;
  99. }
  100. }
  101. catch (Exception ex)
  102. {
  103. // 对异常进行共通处理
  104. ExceptionManager.HandleEventException(this.ToString(),
  105. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  106. }
  107. }
  108. /// <summary>
  109. /// 绑定产品分级
  110. /// </summary>
  111. private void BindGoodsType()
  112. {
  113. DataTable dt = new DataTable();
  114. dt.Columns.Add("GoodsLevelTypeID");
  115. dt.Columns.Add("GoodsLevelTypeName");
  116. DataRow dr = dt.NewRow();
  117. dr["GoodsLevelTypeID"] = 8;
  118. dr["GoodsLevelTypeName"] = "损坯";
  119. dt.Rows.Add(dr);
  120. dr = dt.NewRow();
  121. dr["GoodsLevelTypeID"] = 7;
  122. dr["GoodsLevelTypeName"] = "次品";
  123. dt.Rows.Add(dr);
  124. dr = dt.NewRow();
  125. dr["GoodsLevelTypeID"] = 3;
  126. dr["GoodsLevelTypeName"] = "废品";
  127. dt.Rows.Add(dr);
  128. this.comGoodsType.DataSource = dt;
  129. this.comGoodsType.DisplayMember = "GoodsLevelTypeName";
  130. this.comGoodsType.ValueMember = "GoodsLevelTypeID";
  131. }
  132. #endregion
  133. }
  134. }