/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PM_2111.cs
* 2.功能描述:批量清除在产回收站数据
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2015/08/11 1.00 新建
*******************************************************************************/
using System;
using System.Data;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using Dongke.IBOSS.PRD.Basics.BaseControls;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Client.CommonModule;
using Dongke.IBOSS.PRD.Client.Controls;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.PMModule
{
public partial class F_PM_2111 : DKFormBase
{
#region 构造函数
public F_PM_2111()
{
InitializeComponent();
this.btnClose.Text = ButtonText.BTN_CLOSE;
this.btnSave.Text = ButtonText.BTN_SAVE;
}
#endregion
#region 事件
///
/// 关闭按钮事件
///
///
///
private void tsbtnClose_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 窗体加载事件
///
///
///
private void F_PM_2111_Load(object sender, EventArgs e)
{
this.dtpUpdateTimeStart.Value = DateTime.Now.Date;
this.dtpUpdateTimeEnd.Value = DateTime.Now.Date;
this.dtpScrapDateStart.Value = DateTime.Now.Date;
this.dtpScrapDateEnd.Value = DateTime.Now.Date;
//绑定产品分级
BindGoodsType();
}
///
/// 保存按钮事件
///
///
///
private void btnSave_Click(object sender, EventArgs e)
{
try
{
DialogResult dialogResult
= MessageBox.Show("确认是否清除符合条件的产品?",
this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dialogResult.Equals(DialogResult.No))
{
return;
}
FPM2110_SE se = new FPM2110_SE();
se.ProductionLineIDS = dkproductionLineSearchBox.ProductionLineIDS;
se.ProcedureIDS = dkProcedureSearchBox.ProcedureIDS;
se.UpdateTimeStart = DateTime.Parse(this.dtpUpdateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
se.UpdateTimeEnd = DateTime.Parse(this.dtpUpdateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
//报废日期
se.ScrapDataStart = DateTime.Parse(this.dtpScrapDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
se.ScrapDataEnd = DateTime.Parse(this.dtpScrapDateEnd.Value.ToString("yyyy-MM-dd") + " 0:0:0");
se.GooddLevelTypeID = Convert.ToInt32(comGoodsType.SelectedValue);
// 清除
int result = (int)DoAsync(() =>
{
return PMModuleProxy.Service.SaveClearAllInproductionTrash(se);
});
if (result > Constant.INT_IS_ZERO)
{
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "在产回收站产品", "批量清除数据"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
// 刷新窗口数据
this.DialogResult = DialogResult.OK;
}
else
{
MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "在产回收站产品", "批量清除数据"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 绑定产品分级
///
private void BindGoodsType()
{
DataTable dt = new DataTable();
dt.Columns.Add("GoodsLevelTypeID");
dt.Columns.Add("GoodsLevelTypeName");
DataRow dr = dt.NewRow();
dr["GoodsLevelTypeID"] = 8;
dr["GoodsLevelTypeName"] = "损坯";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["GoodsLevelTypeID"] = 7;
dr["GoodsLevelTypeName"] = "次品";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["GoodsLevelTypeID"] = 3;
dr["GoodsLevelTypeName"] = "废品";
dt.Rows.Add(dr);
this.comGoodsType.DataSource = dt;
this.comGoodsType.DisplayMember = "GoodsLevelTypeName";
this.comGoodsType.ValueMember = "GoodsLevelTypeID";
}
#endregion
}
}