| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- /*******************************************************************************
- * 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
- {
- /// <summary>
- /// 审核成型报损信息
- /// </summary>
- public partial class F_PM_2703 : FormBase
- {
- #region 成员变量
- //审核产品条码
- private string _barCode = "";
- //成型报损ID
- private int _spId;
- //0为审批,1为查看
- private int _formModeType;
- #endregion
- #region 构造函数
- /// <summary>
- /// 窗体构造
- /// </summary>
- /// <param name="barCode">需审核的条码</param>
- /// <param name="formModeType">页面打开模式</param>
- 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 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 窗体关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 提交审核
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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 私有方法
- /// <summary>
- /// 获取需要审核的成型报损实体
- /// </summary>
- 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
- }
- }
|