/*******************************************************************************
* Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_RPT_020105.cs
* 2.功能描述:模具跟踪表
* 编辑履历:
* 作者 日期 版本 修改内容
* 陈晓野 2017/12/26 1.00 新建
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Windows.Forms;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Client.CommonModule;
using Dongke.IBOSS.PRD.Client.Controls;
using Dongke.IBOSS.PRD.Client.DataModels;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.ReportModule
{
///
/// 模具跟踪表
///
public partial class F_RPT_020105 : DKDockPanelBase
{
#region 成员变量
private static F_RPT_020105 _instance = null;
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_RPT_020105 Instance
{
get
{
if (_instance == null)
{
_instance = new F_RPT_020105();
}
return _instance;
}
}
#endregion
#region 构造函数
///
///
///
public F_RPT_020105()
{
InitializeComponent();
this.Text = "模具跟踪表";
this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
this.dgvMould.AutoGenerateColumns = false;
this.dgvTracking.AutoGenerateColumns = false;
}
#endregion
#region 控件事件
///
/// 关闭
///
///
///
private void F_PC_1001_FormClosed(object sender, FormClosedEventArgs e)
{
_instance = null;
}
///
/// 画面加载
///
///
///
private void F_PC_1001_Load(object sender, System.EventArgs e)
{
try
{
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 查询
///
///
///
private void tsbtnSearch_Click(object sender, EventArgs e)
{
try
{
this.QueryDataFromOther();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 查询
///
///
///
private void txtModelBarcode_KeyDown(object sender, KeyEventArgs e)
{
try
{
if (e.KeyCode == Keys.Enter)
{
this.QueryDataFromOther();
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 自适应列宽
///
///
///
private void tsbtnAdaptive_Click(object sender, EventArgs e)
{
this.dgvMould.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
this.dgvTracking.AutoResizeColumns();
}
///
/// 关闭画面
///
///
///
private void tsbtnClose_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 私有方法
///
/// 查询数据
///
private void QueryDataFromOther()
{
try
{
this.tsrToolStrip1.Focus();
if (string.IsNullOrWhiteSpace(this.txtModelBarcode.Text))
{
MessageBox.Show("没有输入模具条码", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.txtModelBarcode.Focus();
return;
}
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "R02";
cre.Name = "R020105";
cre.Properties["MouldBarcode"] = this.txtModelBarcode.Text.Trim();
this.dgvMould.DataSource = null;
this.dgvTracking.DataSource = null;
ServiceResultEntity sre = DoAsync(() =>
{
return ReportModuleProxy.Service.DoRequest(cre);
}
);
if (sre.Status == Constant.ServiceResultStatus.Success)
{
// 查询成功
this.dgvMould.DataSource = sre.Data.Tables[0];
this.dgvTracking.DataSource = sre.Data.Tables[1];
this.txtModelBarcode.Clear();
}
else
{
this.txtModelBarcode.SelectAll();
}
this.txtModelBarcode.Focus();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}