| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_2701.cs
- * 2.功能描述:成型报损信息一览
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 周兴 2018/03/27 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- 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_2701 : DockPanelBase
- {
- #region 成员变量
- //单例模式
- private static F_PM_2701 _instance;
- //产品分级类别ID
- private int _goodsLevelTypeID = Convert.ToInt32(Constant.GoodsLevelType.Damage);
- //页面审核状态值
- private int? _AuditStatus;
- #endregion
- #region 构造函数
- /// <summary>
- /// 废弃一览构造
- /// </summary>
- public F_PM_2701()
- {
- InitializeComponent();
- this.Text = FormTitles.F_PM_2701;
- this.cbSelectTime.Checked = true;
- this.txtScrapDateStart.Enabled = true;
- this.txtScrapDateEnd.Enabled = true;
- this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
- this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
- this.tsbtnApprover.Text = ButtonText.TSBTN_AUDIT;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.tsbtnReverse.Text = ButtonText.TSBTN_FINISHEDCANCELHANDOVER;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PM_2701 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PM_2701();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_2701_Load(object sender, EventArgs e)
- {
- try
- {
- this.dgvScrapProduct.AutoGenerateColumns = false;
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- DataSet dsStatus = SystemModuleProxy.Service.GetAuditStatus();
- this.cbAuditStatus.DataSource = dsStatus.Tables[0];
- this.cbAuditStatus.ValueMember = "AuditStatusID";
- this.cbAuditStatus.DisplayMember = "AuditStatusName";
- this.cbAuditStatus.Text = "";
- }
- 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 tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- F_PM_2702 f_PM_2702 = new F_PM_2702(Constant.FormMode.Add, "", 0,this.tsbtnApprover.Visible);
- DialogResult dialogresult = f_PM_2702.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- this.dgvScrapProduct.DataSource = null;
- DataSet dsScrap = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return this.GetScrapProduct();
- }));
- if (dsScrap != null)
- {
- if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvScrapProduct.DataSource = ((DataSet)dsScrap).Tables[Constant.INT_IS_ZERO];
- this.dgvScrapProduct.ReadOnly = true;
- }
- }
- }
- }
- 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 btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.cbAuditStatus.Text != string.Empty)
- {
- this._AuditStatus = Convert.ToInt32(this.cbAuditStatus.SelectedValue);
- }
- else
- {
- this._AuditStatus = null;
- }
- DataSet dsScrapProduct = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return this.GetScrapProduct();
- }));
- if (dsScrapProduct != null)
- {
- if (dsScrapProduct.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
- {
- this.dgvScrapProduct.DataSource = ((DataSet)dsScrapProduct).Tables[Constant.INT_IS_ZERO];
- this.dgvScrapProduct.ReadOnly = true;
- }
- else
- {
- this.dgvScrapProduct.DataSource = null;
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- this.dgvScrapProduct.DataSource = null;
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 cbSelectTime_CheckedChanged(object sender, EventArgs e)
- {
- this.txtScrapDateStart.Enabled = this.cbSelectTime.Checked;
- this.txtScrapDateEnd.Enabled = this.cbSelectTime.Checked;
- }
- /// <summary>
- /// 清空条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtBarCode.Text = "";
- this.txtUserCode.Text = "";
- this.cbSelectTime.Checked = true;
- this.txtGoodsCode.Text = "";
- this.txtGoodsName.Text = "";
- this.txtRemarks.Text = "";
- this.txtRreason.Text = "";
- this.txtGroutingUserCode.Text = "";
- }
- /// <summary>
- /// 编辑窗体打开
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
- if (currentRow != null)
- {
- string barCode = currentRow.Cells["BarCode"].Value.ToString();
- int sPId = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value.ToString());
- F_PM_2702 frmFPM2702 = new F_PM_2702(Constant.FormMode.Edit, barCode, sPId, this.tsbtnApprover.Visible);
- DialogResult dialogresult = frmFPM2702.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- this.dgvScrapProduct.DataSource = null;
- object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
- if (obScrapResult != null)
- {
- DataSet dsScrap = (DataSet)obScrapResult;
- if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
- this.dgvScrapProduct.ReadOnly = true;
- }
- }
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 dgvScrapProduct_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
- if (currentRow != null)
- {
- string barCode = currentRow.Cells["BarCode"].Value.ToString();
- int SPId = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value.ToString());
- F_PM_2702 frmFPM2702 = new F_PM_2702(Constant.FormMode.Edit, barCode, SPId,this.tsbtnApprover.Visible);
- DialogResult dialogresult = frmFPM2702.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- this.dgvScrapProduct.DataSource = null;
- object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
- if (obScrapResult != null)
- {
- DataSet dsScrap = (DataSet)obScrapResult;
- if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
- this.dgvScrapProduct.ReadOnly = true;
- }
- }
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 窗体关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_2701_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 自动列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 审批按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnApprover_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
- if (currentRow != null)
- {
- string barCode = currentRow.Cells["BarCode"].Value.ToString();
- int ScrapProductID = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value);
- F_PM_2703 frmFPM2703 = new F_PM_2703(barCode, 0, ScrapProductID);
- DialogResult dialogresult = frmFPM2703.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- this.dgvScrapProduct.DataSource = null;
- object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
- if (obScrapResult != null)
- {
- DataSet dsScrap = (DataSet)obScrapResult;
- if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
- this.dgvScrapProduct.ReadOnly = true;
- }
- }
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnReverse_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvScrapProduct.CurrentRow != null)
- {
- F_PM_2801 frmFPM2801 = new F_PM_2801();
- frmFPM2801.CurrentBarCode = this.dgvScrapProduct.CurrentRow.Cells["BarCode"].Value + "";
- frmFPM2801.ShowDialog();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 根据界面查询条件获取数据集
- /// </summary>
- private DataSet GetScrapProduct()
- {
- try
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "GroutingScrapProduct";
- cre.Name = "GetGroutingScrapProduct";
- cre.Properties["GroutingUserCode"] = this.txtGroutingUserCode.Text.Trim();
- cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
- cre.Properties["ResponUserCode"] = this.txtUserCode.Text.Trim();
- cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
- cre.Properties["GoodsName"] = this.txtGoodsName.Text.Trim();
- cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
- cre.Properties["Rreason"] = this.txtRreason.Text.Trim();
- if (this.cbSelectTime.Checked)
- {
- cre.Properties["ScrapDateStart"] = this.txtScrapDateStart.Text.Trim();
- cre.Properties["ScrapDateEnd"] = this.txtScrapDateEnd.Text.Trim();
- }
- if (this._AuditStatus != null)
- {
- cre.Properties["AuditStatus"] = this._AuditStatus;
- }
- ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
- return result.Data;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- }
- }
|