/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_1103.cs * 2.功能描述:审核产品废弃信息 * 编辑履历: * 作者 日期 版本 修改内容 * 庄天威 2014/10/22 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; using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService; namespace Dongke.IBOSS.PRD.Client.PMModule { /// /// 审核产品废弃信息 /// public partial class F_PM_1103 : FormBase { #region 成员变量 //审核产品条码 private string _barCode = ""; //废弃产品ID private int _spId; //0为审批,1为查看 private int _formModeType; //审批用废弃产品实体 private ScrapProductEntity _auditEntity; #endregion #region 构造函数 /// /// 窗体构造 /// /// 需审核的条码 /// 页面打开模式 public F_PM_1103(string barCode, int formModeType, int SPId) { InitializeComponent(); this._barCode = barCode; this._formModeType = formModeType; this._spId = SPId; this.Text = FormTitles.F_PM_1103; this.btnSave.Text = ButtonText.BTN_SAVE; this.btnCancel.Text = ButtonText.BTN_CANCEL; } #endregion #region 事件 /// /// 窗体加载 /// /// /// private void F_PM_1103_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 { this._auditEntity.Auditor = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID; this._auditEntity.AuditlDate = CommonModuleProxy.Service.GetAccountDate(); this._auditEntity.AuditOpinion = this.txtAuditOpinion.Text; if (this.rbAuditStatusOK.Checked == true) { this._auditEntity.AuditStatus = 1; } else { this._auditEntity.AuditStatus = 2; } int MyReturn = (int)DoAsync(new BaseAsyncMethod(() => { return PMModuleProxy.Service.AuditScrapProduct(_auditEntity); })); if (MyReturn > Constant.INT_IS_ZERO) { //成功 MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "废弃产品", "审核"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } 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 { //获取报废产品实体 this._auditEntity = new ScrapProductEntity(); this._auditEntity.ScrapProductID = this._spId; this._auditEntity.BarCode = this._barCode; DataSet dsScrap = PMModuleProxy.Service.GetScrapProduct(this._auditEntity); if (dsScrap != null) { if (dsScrap.Tables.Count != Constant.INT_IS_ZERO) { DataRow drScrap = dsScrap.Tables[0].Rows[0]; this._auditEntity.ScrapProductID = Convert.ToInt32(drScrap["ScrapProductID"]); this._auditEntity.BarCode = drScrap["BarCode"].ToString(); //this._auditEntity.ProductionLineID = Convert.ToInt32(drScrap["ProductionLineID"]); if (drScrap["ProductionLineID"] != DBNull.Value) { this._auditEntity.ProductionLineID = Convert.ToInt32(drScrap["ProductionLineID"]); } this._auditEntity.ProductionLineCode = drScrap["ProductionLineCode"].ToString(); this._auditEntity.ProductionLineName = drScrap["ProductionLineName"].ToString(); this._auditEntity.GoodsID = Convert.ToInt32(drScrap["GoodsID"]); this._auditEntity.GoodsCode = drScrap["GoodsCode"].ToString(); this._auditEntity.GoodsName = drScrap["GoodsName"].ToString(); this._auditEntity.GroutingDailyID = Convert.ToInt32(drScrap["GroutingDailyID"]); this._auditEntity.GroutingDailyDetailID = Convert.ToInt32(drScrap["GroutingDailyDetailID"]); this._auditEntity.GroutingDate = Convert.ToDateTime(drScrap["GroutingDate"]); this._auditEntity.GroutingLineID = Convert.ToInt32(drScrap["GroutingLineID"]); this._auditEntity.GroutingLineCode = drScrap["GroutingLineCode"].ToString(); this._auditEntity.GroutingLineName = drScrap["GroutingLineName"].ToString(); this._auditEntity.GMouldTypeID = Convert.ToInt32(drScrap["GMouldTypeID"]); this._auditEntity.GroutingLineDetailID = Convert.ToInt32(drScrap["GroutingLineDetailID"]); this._auditEntity.GroutingMouldCode = drScrap["GroutingMouldCode"].ToString(); this._auditEntity.MouldCode = drScrap["MouldCode"].ToString(); this._auditEntity.GoodsLevelID = Convert.ToInt32(drScrap["GoodsLevelID"]); this._auditEntity.GoodsLevelTypeID = Convert.ToInt32(drScrap["GoodsLevelTypeID"]); this._auditEntity.ScrapDate = Convert.ToDateTime(drScrap["ScrapDate"]); this._auditEntity.Rreason = drScrap["Rreason"].ToString(); this._auditEntity.Remarks = drScrap["Remarks"].ToString(); this._auditEntity.AuditStatus = Convert.ToInt32(drScrap["AuditStatus"]); this._auditEntity.ResponType = Convert.ToInt32(drScrap["ResponType"]); if (drScrap["Auditor"] != DBNull.Value) { this._auditEntity.Auditor = Convert.ToInt32(drScrap["Auditor"]); } if (drScrap["AuditDate"] != DBNull.Value) { this._auditEntity.AuditlDate = Convert.ToDateTime(drScrap["AuditDate"]); } if (drScrap["AuditOpinion"] != DBNull.Value) { this._auditEntity.AuditOpinion = drScrap["AuditOpinion"].ToString(); this.txtAuditOpinion.Text = this._auditEntity.AuditOpinion.ToString(); } this._auditEntity.SettlementFlag = Convert.ToInt32(drScrap["SettlementFlag"]); if (drScrap["ProcedureID"] != DBNull.Value) { this._auditEntity.ResponProcedureID = Convert.ToInt32(drScrap["ProcedureID"]); } if (drScrap["UserID"] != DBNull.Value) { this._auditEntity.ResponUserID = Convert.ToInt32(drScrap["UserID"]); } if (drScrap["UserCode"] != DBNull.Value) { this._auditEntity.ResponUserCode = drScrap["UserCode"].ToString(); } if (drScrap["UserName"] != DBNull.Value) { this._auditEntity.ResponUserName = drScrap["UserName"].ToString(); } this._auditEntity.OPTimeStamp = Convert.ToDateTime(drScrap["OPTimeStamp"]); 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"].ToString(); this.lblTime.Text = Convert.ToDateTime(this._auditEntity.AuditlDate).ToString("yyyy-MM-dd"); } //已经通过审核或已经驳回审核的就不能再修改了 if (this._auditEntity.AuditStatus != Constant.INT_IS_ZERO) { this.txtAuditOpinion.Enabled = false; this.rbAuditStatusOK.Enabled = false; this.rbAuditStatusNo.Enabled = false; this.btnSave.Enabled = false; if (this._auditEntity.AuditStatus == Constant.INT_IS_ONE) { this.rbAuditStatusNo.Checked = false; this.rbAuditStatusOK.Checked = true; } else { this.rbAuditStatusNo.Checked = true; this.rbAuditStatusOK.Checked = false; } } } } else { this.Close(); return; } } catch (Exception ex) { throw ex; } } #endregion } }