/*******************************************************************************
* Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_RPT_080110.cs
* 2.功能描述:半成品检验判级明细表
* 编辑履历:
* 作者 日期 版本 修改内容
* 冯林勇 2022/09/12 1.00 新建
*******************************************************************************/
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;
using System;
using System.Data;
using System.Windows.Forms;
using System.Linq;
using System.Collections.Generic;
using Dongke.IBOSS.PRD.Client.Controls;
namespace Dongke.IBOSS.PRD.Client.ReportModule
{
///
/// 半检登记明细表
///
public partial class F_RPT_080110 : DKDockPanelBase
{
#region 成员变量
//单例模式
private static F_RPT_080110 _instance;
SemiCheckEntity _entity;
#endregion
#region 构造函数
///
/// 废弃一览构造
///
public F_RPT_080110()
{
InitializeComponent();
this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
this.btnSearch.Text = ButtonText.BTN_SEARCH;
this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
}
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_RPT_080110 Instance
{
get
{
if (_instance == null)
{
_instance = new F_RPT_080110();
}
return _instance;
}
}
#endregion
#region 事件
///
/// 窗体加载
///
///
///
private void F_PM_2201_Load(object sender, EventArgs e)
{
try
{
// 加载权限
FormPermissionManager.FormPermissionControl(this.Name, this,
Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
this.dgvSemiCheck.AutoGenerateColumns = false;
// 设置日期控件默认值
this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
//下拉框绑定判断等级
BindJudgmentLevel();
//下拉框绑定登记工序
BindRegisterTheOperation();
//下拉框绑定登记状态
BindRegistrationStatus();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 查询事件
///
///
///
private void btnSearch_Click(object sender, EventArgs e)
{
try
{
this.dgvSemiCheck.DataSource = null;
ClientRequestEntity cre = new ClientRequestEntity();
cre.Properties["GoodsCode"] = this.txtGoodsCode.Text; //产品编号
cre.Properties["GoodsTypeCode"] = this.scbGoodsType.Text; //产品类别
cre.Properties["PROCEDUREID"] = this.scbRegisterTheOperation.SelectedValue;//登记工序
cre.Properties["GROUTINGLINECODE"] = this.txtGroutingLineCode.Text; //成型线编码
cre.Properties["GOODSLEVELID"] = this.scbJudgmentLevel.SelectedValue; //判定等级
string state = this.scbRegistrationStatus.Text; //登记状态
if (state == "有效")
{
cre.Properties["VALUEFLAG"] = "1";
}
else if (state == "历史")
{
cre.Properties["VALUEFLAG"] = "0";
}
else
{
cre.Properties["VALUEFLAG"] = "2";
}
cre.Properties["SemiCheckDateTimeStart"] = this.txtSemiCheckDateTimeStart.Value; //半检时间
cre.Properties["SemiCheckDateTimeEnd"] = this.txtSemiCheckDateTimeEnd.Value; //半检时间
cre.NameSpace = "R04";
cre.Name = "F_RPT_080110_Seach";
ServiceResultEntity dsSemiCheck = ReportModuleProxy.Service.DoRequest(cre);
if (dsSemiCheck.Data != null && dsSemiCheck.Data.Tables.Count > 0 && dsSemiCheck.Data.Tables[0].Rows.Count > 0)
{
this.dgvSemiCheck.DataSource = (dsSemiCheck).Data.Tables[Constant.INT_IS_ZERO];
this.dgvSemiCheck.ReadOnly = true;
this.dgvSemiCheck.Rows[0].Selected = true;
}
else
{
// 提示未查找到数据
MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 清空条件
///
///
///
private void btnClearCondition_Click(object sender, EventArgs e)
{
this.scbJudgmentLevel.SelectedIndex = 3;
this.scbRegisterTheOperation.SelectedIndex = 3;
this.txtGroutingLineCode.Text = "";
this.scbRegistrationStatus.SelectedValue = 0;
this.scbGoodsType.ClearValue();
this.txtGoodsCode.Text = string.Empty;
this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
}
///
/// 绑定判定等级下拉框
///
///
///
private void BindJudgmentLevel()
{
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "R04";
cre.Name = "F_RPT_080110";
ServiceResultEntity sre = ReportModuleProxy.Service.DoRequest(cre);
if (sre == null || sre.Data == null ||
sre.Data.Tables.Count == 0 ||
sre.Data.Tables[0].Rows.Count == 0)
{
return;
}
else
{
DataTable dtKilnInfo = sre.Data.Tables[Constant.INT_IS_ZERO];
DataRow row = dtKilnInfo.NewRow();
row["GOODSLEVELTYPEID"] = 0;
row["GOODSLEVELTYPENAME"] = "全部";
dtKilnInfo.Rows.Add(row);
this.scbJudgmentLevel.DisplayMember = "GOODSLEVELTYPENAME";
this.scbJudgmentLevel.ValueMember = "GOODSLEVELTYPEID";
this.scbJudgmentLevel.DataSource = dtKilnInfo;
this.scbJudgmentLevel.SelectedIndex = 3;
}
}
///
/// 绑定登记状态下拉框
///
///
///
private void BindRegistrationStatus()
{
Dictionary dic = new Dictionary()
{
{0,"全部" },
{1,"有效" },
{2,"历史" },
};
this.scbRegistrationStatus.ValueMember = "Key";
this.scbRegistrationStatus.DisplayMember = "Value";
this.scbRegistrationStatus.DataSource = new BindingSource() { DataSource = dic };
this.scbRegistrationStatus.SelectedIndex = 0;
}
///
/// 绑定登记工序下拉框
///
///
///
private void BindRegisterTheOperation()
{
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "R04";
cre.Name = "F_RPT_080110_2";
ServiceResultEntity sre = ReportModuleProxy.Service.DoRequest(cre);
if (sre == null || sre.Data == null ||
sre.Data.Tables.Count == 0 ||
sre.Data.Tables[0].Rows.Count == 0)
{
return;
}
else
{
DataTable dtKilnInfo = sre.Data.Tables[Constant.INT_IS_ZERO];
DataRow row = dtKilnInfo.NewRow();
row["PROCEDUREID"] = 0;
row["PROCEDURENAME"] = "全部";
dtKilnInfo.Rows.Add(row);
this.scbRegisterTheOperation.DisplayMember = "PROCEDURENAME";
this.scbRegisterTheOperation.ValueMember = "PROCEDUREID";
this.scbRegisterTheOperation.DataSource = dtKilnInfo;
this.scbRegisterTheOperation.SelectedIndex = 3;
}
}
///
/// 关闭一览窗体
///
///
///
private void tsbtnClose_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 窗体关闭事件
///
///
///
private void F_PM_2201_FormClosed(object sender, FormClosedEventArgs e)
{
_instance = null;
}
///
/// 自动列宽
///
///
///
private void tsbtnAdaptive_Click(object sender, EventArgs e)
{
this.dgvSemiCheck.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
}
///
/// 半检时间复选框改变事件
///
///
///
private void cbSemiCheck_CheckedChanged(object sender, EventArgs e)
{
}
#endregion
#region 私有方法
///
/// 根据界面查询条件获取数据集
///
private DataSet GetSemiCheck(SemiCheckEntity _entity)
{
try
{
ServiceResultEntity resultEntity = ReportModuleProxy.Service.GetRPT080108IData(_entity);
return resultEntity.Data;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}