/*******************************************************************************
* Copyright(c) 2015 dongke All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PM_0106.cs
* 2.功能描述:取消最后一次注浆登记
* 编辑履历:
* 作者 日期 版本 修改内容
* 陈晓野 2020/02/18 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_0106 : DKFormBase
{
#region 成员变量
private DataSet _data = null;
#endregion
#region 构造函数
///
/// 构造函数
///
public F_PM_0106()
{
this.InitializeComponent();
// 为各个控件文本赋值
this.InitializeControls();
}
#endregion
#region 属性
///
/// 注浆日报ID
///
public string GroutingLineCode
{
get;
private set;
}
///
/// 是否在开模报损中使用
///
public bool IsBarCodeScrapReasonUseFlag
{
get;
set;
}
#endregion
#region 控件事件
///
/// 页面Load事件
///
///
///
private void F_PM_0106_Load(object sender, EventArgs e)
{
}
///
/// 查询按钮按下事件
///
///
///
private void btnSearch_Click(object sender, System.EventArgs e)
{
string glcode = this.txtGroutingLineCode.Text.Trim();
if (string.IsNullOrWhiteSpace(glcode))
{
MessageBox.Show("请输入成型线编码",this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.txtGroutingLineCode.Focus();
return;
}
try
{
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "F_PM_0106";
cre.Name = "CheckFPM0106GLCode";
cre.Properties["glcode"] = glcode;
// 根据注浆日期、成型线获取所有可注浆模具信息
ServiceResultEntity sre = this.DoAsync(() =>
{
return PMModuleProxyNew.Service.HandleRequest(cre);
}
);
// 异常情况处理
if (sre.Status == Constant.ServiceResultStatus.Success)
{
_data = sre.Data;
DataRow dataRow = _data.Tables[0].Rows[0];
this.txtTextBox1.Text =
$"成型线编码 :{dataRow["GroutingLineCode"]} " + Environment.NewLine + Environment.NewLine +
$"最后注浆日期:{(dataRow["LastGroutingDate"] as DateTime?)?.ToString("yyyy-MM-dd")?? dataRow["LastGroutingDate"]+""} " + Environment.NewLine + Environment.NewLine +
$"最后注浆批次:{dataRow["LastGroutingBatchNo"]} " + Environment.NewLine + Environment.NewLine +
$"成型工号 :{dataRow["usercode"]} "
;
this.btnOK.Enabled = true;
return;
}
_data = null;
this.btnOK.Enabled = false;
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)
{
if (_data == null)
{
return;
}
try
{
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "F_PM_0106";
cre.Name = "SetFPM0106GLCode";
cre.Data = _data;
// 根据注浆日期、成型线获取所有可注浆模具信息
ServiceResultEntity sre = this.DoAsync(() =>
{
return PMModuleProxyNew.Service.HandleRequest(cre);
}
);
// 异常情况处理
if (sre.Status == Constant.ServiceResultStatus.Success)
{
DialogResult dr = MessageBox.Show("撤销成功,是否关闭画面", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dr == DialogResult.Yes)
{
this.Close();
}
_data = null;
this.txtGroutingLineCode.Clear();
this.txtTextBox1.Clear();
this.btnOK.Enabled = false;
return;
}
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 btnClose_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
#endregion
#region 私有方法/函数
///
/// 初始化控件
///
private void InitializeControls()
{
this.btnSearch.Text = ButtonText.BTN_SEARCH;
this.btnOK.Text = ButtonText.BTN_OK;
this.btnCancel.Text = ButtonText.BTN_CANCEL;
}
#endregion
private void txtGroutingLineCode_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE)
{
btnSearch_Click(null, null);
}
}
}
}