/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PM_3102.cs
* 2.功能描述:品保抽查操作页面
* 编辑履历:
* 作者 日期 版本 修改内容
* 陈晓野 2019/05/10 1.00 新建
*******************************************************************************/
using System;
using System.Data;
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_3102 : DKFormBase
{
#region 成员变量
private const string F_INFO = "产品编码:{0}\r\n\r\n注浆日期:{1:yyyy-MM-dd}\r\n\r\n模具编号:{2}\r\n\r\n成型工号:{3}\r\n\r\n当前工序:{4}";
#endregion
#region 构造函数
///
/// 品保抽查操作页面
///
public F_PM_3102()
{
InitializeComponent();
// 控件赋值
this.Text = "品保抽查";
this.btnSave.Text = ButtonText.BTN_SAVE;
this.btnCancel.Text = ButtonText.BTN_CANCEL;
}
#endregion
#region 事件
///
/// 窗体加载
///
///
///
private void F_PM_3102_Load(object sender, EventArgs e)
{
try
{
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 条码按键事件
///
///
///
private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
if ((int)e.KeyChar == 13) // 按了回车键
{
//this.btnSave.Visible = false;
string barCode = this.txtBarCode.Text.Trim();
if (string.IsNullOrEmpty(barCode))
{
MessageBox.Show("产品条码不能为空", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.txtBarCode.Focus();
return;
}
// 异步处理,验证挂起条码
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "QASpotCheck";
cre.Name = "CheckQASpotCheck";
cre.Request = barCode;
// 调用服务器端获取数据集
ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
{
return PMModuleProxyNew.Service.HandleRequest(cre);
}));
if (sre.Data != null && sre.Data.Tables[0].Rows.Count > 0)
{
DataRow dataRow = sre.Data.Tables[0].Rows[0];
this.txtInfo.Text = string.Format(F_INFO,
dataRow["goodscode"],
dataRow["groutingdate"],
dataRow["groutingmouldcode"],
dataRow["usercode"],
dataRow["procedurename"]);
this.txtInfo.Tag = dataRow;
this.btnSave.Visible = true;
this.txtRemarks.Focus();
}
else
{
this.txtInfo.Text = null;
this.txtInfo.Tag = null;
MessageBox.Show(sre.Message, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.txtBarCode.SelectAll();
return;
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 保存按钮点击事件
///
///
///
private void btnSave_Click(object sender, EventArgs e)
{
try
{
DataRow dataRow = this.txtInfo.Tag as DataRow;
if (dataRow == null)
{
return;
}
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "QASpotCheck";
cre.Name = "SaveQASpotCheck";
cre.Properties["GroutingDailyDetailID"] = dataRow["GroutingDailyDetailID"];
cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
cre.Properties["ProcedureID"] = dataRow["ProcedureID"];
cre.Properties["ProcedureName"] = dataRow["ProcedureName"];
cre.Properties["CheckTime"] = dataRow["CheckTime"];
// 异步处理
ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
{
return PMModuleProxyNew.Service.HandleRequest(cre);
}));
if (Convert.ToInt32(sre.Result) < 0)
{
MessageBox.Show(sre.Message,
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
// 提示信息
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.btnSave.Visible = false;
this.Close();
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 关闭按钮点击事件
///
///
///
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
}
}