/*******************************************************************************
* Copyright(c) 2018 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PM_2703.cs
* 2.功能描述:审核成型报损信息
* 编辑履历:
* 作者 日期 版本 修改内容
* 周兴 2018/3/20 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.DataModels;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.PMModule
{
///
/// 审核成型报损信息
///
public partial class F_PM_2703 : FormBase
{
#region 成员变量
//审核产品条码
private string _barCode = "";
//成型报损ID
private int _spId;
//0为审批,1为查看
private int _formModeType;
#endregion
#region 构造函数
///
/// 窗体构造
///
/// 需审核的条码
/// 页面打开模式
public F_PM_2703(string barCode, int formModeType, int SPId)
{
InitializeComponent();
this._barCode = barCode;
this._formModeType = formModeType;
this._spId = SPId;
this.Text = FormTitles.F_PM_2703;
this.btnSave.Text = ButtonText.BTN_SAVE;
this.btnCancel.Text = ButtonText.BTN_CANCEL;
}
#endregion
#region 事件
///
/// 窗体加载
///
///
///
private void F_PM_2703_Load(object sender, EventArgs e)
{
try
{
if (this._formModeType == Constant.INT_IS_ZERO)
{
this.lblAuditorName.Enabled = true;
this.lblTime.Enabled = true;
this.txtAuditOpinion.Enabled = true;
this.rbAuditStatusOK.Enabled = true;
this.rbAuditStatusNo.Enabled = true;
this.btnSave.Enabled = true;
this.btnSave.Visible = true;
}
else
{
this.txtAuditOpinion.Enabled = false;
this.rbAuditStatusOK.Enabled = false;
this.rbAuditStatusNo.Enabled = false;
this.btnSave.Enabled = false;
this.btnSave.Visible = false;
this.lblAuditorName.Enabled = false;
this.lblTime.Enabled = false;
}
GetEntity();
}
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();
}
///
/// 提交审核
///
///
///
private void btnSave_Click(object sender, EventArgs e)
{
try
{
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "GroutingScrapProduct";
cre.Name = "AuditGroutingScrapProduct";
cre.Properties["ScrapProductID"] = this._spId;
cre.Properties["AuditOpinion"] = this.txtAuditOpinion.Text.Trim();
cre.Properties["Auditor"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
if (this.rbAuditStatusOK.Checked)
{
cre.Properties["AuditStatus"] = Constant.INT_IS_ONE;
}
else
{
cre.Properties["AuditStatus"] = Constant.INT_IS_TWO;
}
ServiceResultEntity result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
{
return PMModuleProxyNew.Service.HandleRequest(cre);
}));
int returnRow = (int)result.Result;
if (returnRow > Constant.INT_IS_ZERO)
{
//成功
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型报损", "审核"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.DialogResult = DialogResult.OK;
}
else if (returnRow == -99)
{
MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该报损不是待审状态"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
//失败
MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型报损", "审核"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
#endregion
#region 私有方法
///
/// 获取需要审核的成型报损实体
///
private void GetEntity()
{
try
{
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "GroutingScrapProduct";
cre.Name = "GetGroutingScrapProduct";
cre.Properties["ScrapProductID"] = this._spId;
ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
int auditStatus = -1;
// 给控件赋值
if (result != null && result.Data != null && result.Data.Tables.Count > 0
&& result.Data.Tables[0].Rows.Count > 0)
{
DataRow drScrap = result.Data.Tables[0].Rows[0];
if (this._formModeType == Constant.INT_IS_ZERO) //审批看到的是当前
{
this.lblAuditorName.Text = LogInUserInfo.CurrentUser.CurrentUserEntity.UserName;
this.lblTime.Text = CommonModuleProxy.Service.GetAccountDate().ToString("yyyy-MM-dd");
}
else //查看看到的是记录
{
this.lblAuditorName.Text = drScrap["UName"] + "";
this.lblTime.Text = Convert.ToDateTime(drScrap["AuditDate"]).ToString("yyyy-MM-dd");
this.txtAuditOpinion.Text = drScrap["AuditOpinion"] + "";
}
auditStatus = Convert.ToInt32(drScrap["AuditStatus"]);
}
else
{
this.Close();
return;
}
//已经通过审核或已经驳回审核的就不能再修改了
if (auditStatus != Constant.INT_IS_ZERO)
{
this.txtAuditOpinion.Enabled = false;
this.rbAuditStatusOK.Enabled = false;
this.rbAuditStatusNo.Enabled = false;
this.btnSave.Enabled = false;
if (auditStatus == Constant.INT_IS_ONE)
{
this.rbAuditStatusNo.Checked = false;
this.rbAuditStatusOK.Checked = true;
}
else
{
this.rbAuditStatusNo.Checked = true;
this.rbAuditStatusOK.Checked = false;
}
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}