/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_3301.cs * 2.功能描述:废弃产品信息一览 * 编辑履历: * 作者 日期 版本 修改内容 * 付斌 2020/11/06 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 { /// /// 废弃产品信息一览 /// public partial class F_PM_3301 : DockPanelBase { #region 成员变量 private static F_PM_3301 _instance; //单例模式 #endregion #region 构造函数 /// /// 废弃一览构造 /// public F_PM_3301() { InitializeComponent(); Text = FormTitles.F_PM_3301; dtpScrapDateStart.Enabled = true; dtpScrapDateEnd.Enabled = true; tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE; tsbtnClose.Text = ButtonText.TSBTN_CLOSE; } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PM_3301 Instance { get { if (_instance == null) { _instance = new F_PM_3301(); } return _instance; } } #endregion #region 事件 /// /// 窗体加载 /// /// /// private void F_PM_3301_Load(object sender, EventArgs e) { try { // 加载权限 FormPermissionManager.FormPermissionControl(Name, this, DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); // 损坯原因 DataSet dsRreason = (DataSet)DoAsync( () => { return SystemModuleProxy.Service.GetDictionaryData(0, "TPC009"); }); DataRow row = dsRreason.Tables[0].NewRow(); row["DictionaryValue"] = ""; row["DictionaryID"] = 0; dsRreason.Tables[0].Rows.InsertAt(row, 0); cmbRreason.DisplayMember = "DictionaryValue"; cmbRreason.ValueMember = "DictionaryID"; cmbRreason.DataSource = dsRreason.Tables[0]; dgvScrapProduct.AutoGenerateColumns = false; dtpScrapDateStart.Value = DateTime.Now.Date; dtpScrapDateEnd.Value = DateTime.Now.Date; } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex); } } /// /// 查询事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { dgvScrapProduct.DataSource = null; // 异步处理 ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PM_3302"; cre.Name = "GetAllocateOut"; cre.Data = new DataSet(); cre.Properties["barcode"] = txtBarCode.Text.Trim(); cre.Properties["goodscode"] = txtGoodsCode.Text.Trim(); cre.Properties["goodsname"] = txtGoodsName.Text.Trim(); cre.Properties["scrapdatestart"] = dtpScrapDateStart.Value; cre.Properties["scrapdateend"] = dtpScrapDateEnd.Value.AddDays(1); cre.Properties["groutinglinecode"] = txtGroutingLineCode.Text.Trim(); cre.Properties["groutinglinename"] = txtGroutingLineName.Text.Trim(); cre.Properties["rreason"] = cmbRreason.Text.Trim(); cre.Properties["remarks"] = txtRemarks.Text.Trim(); ServiceResultEntity sre = (ServiceResultEntity)DoAsync( () => { return PMModuleProxyNew.Service.HandleRequest(cre); }); if (sre.Data != null && sre.Data.Tables[0].Rows.Count > 0) { dgvScrapProduct.DataSource = sre.Data.Tables[Constant.INT_IS_ZERO]; } else { // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex); } } /// /// 清空条件 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { txtBarCode.Text = ""; txtGoodsCode.Text = ""; txtGoodsName.Text = ""; txtGroutingLineCode.Text = ""; txtGroutingLineName.Text = ""; txtRemarks.Text = ""; cmbRreason.SelectedIndex = 0; dtpScrapDateStart.Value = DateTime.Now.Date; dtpScrapDateEnd.Value = DateTime.Now.Date; } /// /// 调出窗体打开事件 /// /// /// private void tsbtnAllocateOut_Click(object sender, EventArgs e) { try { F_PM_3302 frm = new F_PM_3302(); frm.FormType = Constant.FormMode.Add; DialogResult dialogresult = frm.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { btnSearch_Click(null, null); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex); } } /// /// 撤销窗体打开事件 /// /// /// private void tsbtnCancelAllocateOut_Click(object sender, EventArgs e) { try { F_PM_3302 frm = new F_PM_3302(); frm.FormType = Constant.FormMode.Edit; DialogResult dialogresult = frm.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { btnSearch_Click(null, null); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex); } } /// /// 自动列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 关闭一览窗体 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { Close(); } /// /// 窗体关闭事件 /// /// /// private void F_PM_3301_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion } }