/*******************************************************************************
* Copyright(c) 2015 dongke All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PM_0105.cs
* 2.功能描述:能绑定条码的注浆登记选择画面
* 编辑履历:
* 作者 日期 版本 修改内容
* 欧阳涛 2015/03/27 1.00 新建
*******************************************************************************/
using System;
using System.Data;
using System.Reflection;
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_0105 : DKFormBase
{
#region 成员变量
#endregion
#region 构造函数
///
/// 构造函数
///
public F_PM_0105()
{
this.InitializeComponent();
// 为各个控件文本赋值
this.InitializeControls();
}
#endregion
#region 属性
///
/// 注浆日报ID
///
public int GroutingDailyID
{
get;
private set;
}
///
/// 注浆日期
///
public DateTime GroutingDate
{
get
{
return this.dtpGroutingDate.Value.Date;
}
set
{
this.dtpGroutingDate.Value = value;
}
}
///
/// 是否在开模报损中使用
///
public bool IsBarCodeScrapReasonUseFlag
{
get;
set;
}
#endregion
#region 控件事件
///
/// 页面Load事件
///
///
///
private void F_PM_0105_Load(object sender, EventArgs e)
{
}
///
/// 查询按钮按下事件
///
///
///
private void btnSearch_Click(object sender, System.EventArgs e)
{
try
{
FPM0104_SE se = new FPM0104_SE();
se.GroutingDate = this.dtpGroutingDate.Value.Date;
se.GroutingLineCode = this.txtGroutingLineCode.Text;
se.GroutingLineName = this.txtGroutingLineName.Text;
se.GroutingUserCode = this.txtUserCode.Text;
se.IsBarCodeScrapReasonUseFlag = IsBarCodeScrapReasonUseFlag;
if (this.txtGroutingBatchNo.DataValue.HasValue)
{
se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
}
// 根据注浆日期、成型线获取所有可注浆模具信息
ServiceResultEntity sre = this.DoAsync(() =>
{
return PMModuleProxyNew.Service.GetFPM0105SData(se);
}
);
this.dgvGroutingDaily.DataSource = null;
// 异常情况处理
if (sre.Status == Constant.ServiceResultStatus.Success)
{
this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
}
else if (sre.Status == Constant.ServiceResultStatus.Other)
{
if (sre.OtherStatus == -1)
{
MessageBox.Show(sre.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 确定按钮按下事件
///
///
///
private void btnOK_Click(object sender, System.EventArgs e)
{
try
{
if (this.dgvGroutingDaily.CurrentRow == null)
{
DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
return;
}
this.GroutingDailyID = Convert.ToInt32(this.dgvGroutingDaily.CurrentRow.Cells["colGroutingDailyID"].Value);
this.DialogResult = DialogResult.OK;
this.Close();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 双击单元格
///
///
///
private void dgvGroutingDaily_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (this.dgvGroutingDaily.CurrentRow == null)
{
DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
return;
}
this.GroutingDailyID = Convert.ToInt32(this.dgvGroutingDaily.CurrentRow.Cells["colGroutingDailyID"].Value);
this.DialogResult = DialogResult.OK;
this.Close();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 关闭按钮按下事件
///
///
///
private void btnClose_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
#endregion
#region 私有方法/函数
///
/// 初始化控件
///
private void InitializeControls()
{
this.Text = FormTitles.F_PM_0105;
this.btnSearch.Text = ButtonText.BTN_SEARCH;
this.btnOK.Text = ButtonText.BTN_OK;
this.btnCancel.Text = ButtonText.BTN_CANCEL;
// 取客户端当天日期
this.dtpGroutingDate.Value = DateTime.Now.Date;
this.dgvGroutingDaily.AutoGenerateColumns = false;
this.dgvGroutingDaily.ReadOnly = true;
}
#endregion
private void btnClearCondition_Click(object sender, EventArgs e)
{
this.txtGroutingBatchNo.Clear();
this.txtGroutingLineCode.Clear();
this.txtUserCode.Clear();
this.txtGroutingLineName.Clear();
this.dtpGroutingDate.Value = DateTime.Now.Date;
}
private void btnAdaptive_Click(object sender, EventArgs e)
{
this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
}
}
}