/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_3101.cs * 2.功能描述:品保抽查 * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2019/05/10 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_3101 : DockPanelBase { #region 成员变量 private static F_PM_3101 _instance; //单例模式 #endregion #region 构造函数 /// /// 废弃一览构造 /// private F_PM_3101() { InitializeComponent(); this.Text = "品保抽查"; this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE; this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE; this.tsbtnSuspend.Text = "抽查(&S)"; this.cbSelectTime.Checked = true; this.txtDateStart.Value = DateTime.Now.Date; this.txtDateEnd.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1); } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PM_3101 Instance { get { if (_instance == null) { _instance = new F_PM_3101(); } return _instance; } } #endregion #region 事件 /// /// 窗体加载 /// /// /// private void F_PM_3101_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); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 查询事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { 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); } } /// /// 抽查按钮点击事件 /// /// /// private void tsbtnSuspend_Click(object sender, EventArgs e) { // 抽查 F_PM_3102 frm3102 = new F_PM_3102(); DialogResult dialogResult = frm3102.ShowDialog(); } /// /// 时间有效性切换 /// /// /// private void cbSelectTime_CheckedChanged(object sender, EventArgs e) { this.txtDateStart.Enabled = this.cbSelectTime.Checked; this.txtDateEnd.Enabled = this.cbSelectTime.Checked; } /// /// 清空条件 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.txtBarCode.Text = ""; this.cbSelectTime.Checked = true; this.txtDateStart.Value = DateTime.Now.Date; this.txtDateEnd.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1); this.txtRemarks.Text = ""; this.txtCheckUser.Text = ""; this.txtGoodscode.Text = ""; } /// /// 关闭一览窗体 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 窗体关闭事件 /// /// /// private void F_PM_3101_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } /// /// 自动列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } #endregion #region 私有方法 /// /// 根据界面查询条件获取数据集 /// private DataSet GetScrapProduct() { try { ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "QASpotCheck"; cre.Name = "GetAllQASpotCheck"; cre.Properties["barcode"] = this.txtBarCode.Text.Trim(); cre.Properties["goodscode"] = this.txtGoodscode.Text.Trim(); cre.Properties["usercode"] = this.txtCheckUser.Text.Trim(); cre.Properties["remarks"] = this.txtRemarks.Text.Trim(); if (this.cbSelectTime.Checked) { cre.Properties["checktimebegin"] = this.txtDateStart.Value; cre.Properties["checktimeend"] = this.txtDateEnd.Value.AddMinutes(1); } ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre); return result.Data; } catch (Exception ex) { throw ex; } } #endregion } }