/*******************************************************************************
* Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_RPT_080107.cs
* 2.功能描述:半检登记明细表
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2016/07/12 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;
using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
namespace Dongke.IBOSS.PRD.Client.ReportModule
{
///
/// 半检登记明细表
///
public partial class F_RPT_080107 : DockPanelBase
{
#region 成员变量
//单例模式
private static F_RPT_080107 _instance;
#endregion
#region 构造函数
///
/// 废弃一览构造
///
public F_RPT_080107()
{
InitializeComponent();
this.Text = FormTitles.F_RPT_080107;
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_080107 Instance
{
get
{
if (_instance == null)
{
_instance = new F_RPT_080107();
}
return _instance;
}
}
#endregion
#region 事件
///
/// 打开新建窗体事件
///
///
///
private void tsbtnSemiCheck_Click(object sender, EventArgs e)
{
try
{
//F_PM_2202 frmFPM2202 = new F_PM_2202(0,"半检登记");
//DialogResult dialogresult = frmFPM2202.ShowDialog();
//if (dialogresult.Equals(DialogResult.OK))
//{
// btnSearch_Click(sender, e);
//}
}
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 dsSemiCheck = (DataSet)DoAsync(new AsyncMethod(() =>
{
return this.GetSemiCheck();
}));
if (dsSemiCheck != null)
{
if (dsSemiCheck.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
{
this.dgvSemiCheck.DataSource = ((DataSet)dsSemiCheck).Tables[Constant.INT_IS_ZERO];
this.dgvSemiCheck.ReadOnly = true;
this.dgvSemiCheck.Rows[0].Selected = true;
}
else
{
this.dgvSemiCheck.DataSource = null;
// 提示未查找到数据
MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
this.dgvSemiCheck.DataSource = null;
// 提示未查找到数据
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 cbCDateTime_CheckedChanged(object sender, EventArgs e)
{
this.txtCDateTimeStart.Enabled = this.cbCDateTime.Checked;
this.txtCDateTimeEnd.Enabled = this.cbCDateTime.Checked;
}
///
/// 清空条件
///
///
///
private void btnClearCondition_Click(object sender, EventArgs e)
{
this.dkCProcedureSearchBox.ClearControl();
this.cbCDateTime.Checked = false;
// this.txtCDateTimeStart.Value = DateTime.Now;
//this.txtCDateTimeEnd.Value = DateTime.Now;
this.txtCUserCode.Text = string.Empty;
this.scbGoodsType.ClearValue();
this.txtGoodsCode.Text = string.Empty;
this.txtGroutingUserCode.Text = string.Empty;
this.cbGroutingDate.Checked = false;
this.txtCDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtCDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtGroutingDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtGroutingDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtReSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtBackOutTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtBackOutTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
//this.txtGroutingDateTimeStart.Value = DateTime.Now;
//this.txtGroutingDateTimeEnd.Value = DateTime.Now;
this.cbDeliveryDate.Checked = false;
this.txtDeliveryDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtDeliveryDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.chkSemiCheckType.SelectedValues = new object[] { -1 };
this.cbSemiCheck.Checked = true;
// this.txtSemiCheckDateTimeStart.Value = DateTime.Now;
// this.txtSemiCheckDateTimeEnd.Value = DateTime.Now;
this.txtSemiCheckUserCode.Text = string.Empty;
this.dkRProcedureSearchBox.ClearControl();
this.txtReworkUserCode.Text = string.Empty;
this.chkReSemiCheckType.SelectedValues = new object[] { -1 };
this.cbReSemiCheck.Checked = false;
//this.txtReSemiCheckDateTimeStart.Value = DateTime.Now;
//this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now;
this.txtReSemiCheckUserCode.Text = string.Empty;
this.chkVYes.Checked = false;
this.chkVNo.Checked = true;
this.cbBackOutTime.Checked = false;
//this.txtBackOutTimeStart.Value = DateTime.Now;
// this.txtBackOutTimeEnd.Value = DateTime.Now;
this.txtBackOutUserCode.Text = string.Empty;
this.txtBarCode.Text = string.Empty;
this.txtDefectCode.Text = string.Empty;
this.dkSemiCheckDefectPositionSearchBox1.ClearControl();
this.dkProcedureSearchBox1.ClearControl();
this.txtDefectUser.Text = string.Empty;
}
///
/// 编辑窗体打开
///
///
///
private void tsbtnReSemiCheck_Click(object sender, EventArgs e)
{
try
{
//F_PM_2204 frmFPM2204 = new F_PM_2204(0, "复检登记");
//DialogResult dialogresult = frmFPM2204.ShowDialog();
//if (dialogresult.Equals(DialogResult.OK))
//{
// btnSearch_Click(sender, e);
//}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 编辑窗体打开
///
///
///
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_1102 frmFPM1102 = new F_PM_1102(Constant.FormMode.Edit, barCode, SPId, this.tsbtnApprover.Visible);
// DialogResult dialogresult = frmFPM1102.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);
}
}
///
/// 关闭一览窗体
///
///
///
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 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.txtCDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtCDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtGroutingDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtGroutingDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtReSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtBackOutTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtBackOutTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
this.txtDeliveryDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
this.txtDeliveryDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
// 加载半检,复检状态数据源
DataSet dsGetSemiCheckType = SystemModuleProxy.Service.GetSemiCheckType();
if (dsGetSemiCheckType != null && dsGetSemiCheckType.Tables[0].Rows.Count > 0)
{
DataRow[] drSemiCheckType = dsGetSemiCheckType.Tables[0].Select("Semichecktype=1");
if (drSemiCheckType.Length > 0)
{
this.chkSemiCheckType.ValueMember = "Semichecktypeid";
this.chkSemiCheckType.DisplayMember = "Semichecktypename";
this.chkSemiCheckType.DataSource = drSemiCheckType.CopyToDataTable();
}
DataRow[] drReSemiCheckType = dsGetSemiCheckType.Tables[0].Select("Semichecktype=2");
if (drReSemiCheckType.Length > 0)
{
this.chkReSemiCheckType.ValueMember = "Semichecktypeid";
this.chkReSemiCheckType.DisplayMember = "Semichecktypename";
this.chkReSemiCheckType.DataSource = drReSemiCheckType.CopyToDataTable();
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 注浆时间复选框改变事件
///
///
///
private void cbGroutingDate_CheckedChanged(object sender, EventArgs e)
{
this.txtGroutingDateTimeStart.Enabled = this.cbGroutingDate.Checked;
this.txtGroutingDateTimeEnd.Enabled = this.cbGroutingDate.Checked;
}
///
/// 半检时间复选框改变事件
///
///
///
private void cbSemiCheck_CheckedChanged(object sender, EventArgs e)
{
this.txtSemiCheckDateTimeStart.Enabled = this.cbSemiCheck.Checked;
this.txtSemiCheckDateTimeEnd.Enabled = this.cbSemiCheck.Checked;
}
///
/// 复检时间复选框改变事件
///
///
///
private void cbReSemiCheck_CheckedChanged(object sender, EventArgs e)
{
this.txtReSemiCheckDateTimeStart.Enabled = this.cbReSemiCheck.Checked;
this.txtReSemiCheckDateTimeEnd.Enabled = this.cbReSemiCheck.Checked;
}
///
/// 撤销时间复选框改变事件
///
///
///
private void cbBackOutTime_CheckedChanged(object sender, EventArgs e)
{
this.txtBackOutTimeStart.Enabled = this.cbBackOutTime.Checked;
this.txtBackOutTimeEnd.Enabled = this.cbBackOutTime.Checked;
}
private void cbDeliveryDate_CheckedChanged(object sender, EventArgs e)
{
this.txtDeliveryDateTimeStart.Enabled = this.cbDeliveryDate.Checked;
this.txtDeliveryDateTimeEnd.Enabled = this.cbDeliveryDate.Checked;
}
///
/// 撤销复检按钮事件
///
///
///
private void tsbtnBackReSemiCheck_Click(object sender, EventArgs e)
{
try
{
//F_PM_2205 frmFPM2205 = new F_PM_2205(0, "撤销复检");
//DialogResult dialogresult = frmFPM2205.ShowDialog();
//if (dialogresult.Equals(DialogResult.OK))
//{
// btnSearch_Click(sender, e);
//}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
#endregion
#region 私有方法
///
/// 根据界面查询条件获取数据集
///
private DataSet GetSemiCheck()
{
try
{
SemiCheckEntity entity = new SemiCheckEntity();
entity.CProcedureIDS = this.dkCProcedureSearchBox.ProcedureIDS;
if (cbCDateTime.Checked)
{
entity.CDateTimeStart = this.txtCDateTimeStart.Value;// DateTime.Parse(this.txtCDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
entity.CDateTimeEnd = this.txtCDateTimeEnd.Value;// DateTime.Parse(this.txtCDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
}
entity.CUserCode = this.txtCUserCode.Text.Trim();
entity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
entity.GoodsCode = this.txtGoodsCode.Text.Trim();
entity.GroutingUserCode = this.txtGroutingUserCode.Text.Trim();
if (cbGroutingDate.Checked)
{
entity.GroutingDateTimeStart = this.txtGroutingDateTimeStart.Value;// DateTime.Parse(this.txtGroutingDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
entity.GroutingDateTimeEnd = this.txtGroutingDateTimeEnd.Value;// DateTime.Parse(this.txtGroutingDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
}
if (cbDeliveryDate.Checked)
{
entity.DeliveryDateTimeStart = this.txtDeliveryDateTimeStart.Value;// DateTime.Parse(this.txtDeliveryDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
entity.DeliveryDateTimeEnd = this.txtDeliveryDateTimeEnd.Value;// DateTime.Parse(this.txtDeliveryDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
}
object[] objSemiCheckType = this.chkSemiCheckType.SelectedValues;
string strSemiCheckType = "";
if (objSemiCheckType.Length > 0)
{
for (int i = 0; i < objSemiCheckType.Length; i++)
{
strSemiCheckType += objSemiCheckType[i].ToString() + ",";
}
strSemiCheckType = strSemiCheckType.TrimEnd(',');
}
entity.SemiCheckType = strSemiCheckType;
if (cbSemiCheck.Checked)
{
entity.SemiCheckDateTimeStart = this.txtSemiCheckDateTimeStart.Value;// DateTime.Parse(this.txtSemiCheckDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
entity.SemiCheckDateTimeEnd = this.txtSemiCheckDateTimeEnd.Value;// DateTime.Parse(this.txtSemiCheckDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
}
entity.SemiCheckUserCode = this.txtSemiCheckUserCode.Text.Trim();
entity.RProcedureIDS = this.dkRProcedureSearchBox.ProcedureIDS;
entity.ReworkUserCode = this.txtReworkUserCode.Text.Trim();
object[] objReSemiCheckType = this.chkReSemiCheckType.SelectedValues;
string strReSemiCheckType = "";
if (objReSemiCheckType.Length > 0)
{
for (int i = 0; i < objReSemiCheckType.Length; i++)
{
strReSemiCheckType += objReSemiCheckType[i].ToString() + ",";
}
strReSemiCheckType = strReSemiCheckType.TrimEnd(',');
}
entity.ReSemiCheckType = strReSemiCheckType;
if (cbReSemiCheck.Checked)
{
entity.ReSemiCheckDateTimeStart = this.txtReSemiCheckDateTimeStart.Value;// DateTime.Parse(this.txtReSemiCheckDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
entity.ReSemiCheckDateTimeEnd = this.txtReSemiCheckDateTimeEnd.Value;// DateTime.Parse(this.txtReSemiCheckDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
}
entity.ReSemiCheckUserCode = this.txtReSemiCheckUserCode.Text.Trim();
string strBackOutFlag = "";
if (chkVYes.Checked)
{
strBackOutFlag = "1,";
}
if (chkVNo.Checked)
{
strBackOutFlag += "0";
}
entity.BackOutFlag = strBackOutFlag.TrimEnd(',');
if (cbBackOutTime.Checked)
{
entity.BackOutTimeStart = this.txtBackOutTimeStart.Value;// DateTime.Parse(this.txtBackOutTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
entity.BackOutTimeEnd = this.txtBackOutTimeEnd.Value;// DateTime.Parse(this.txtBackOutTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
}
entity.BackOutUserCode = this.txtBackOutUserCode.Text.Trim();
entity.BarCode = this.txtBarCode.Text.Trim();
entity.DefectCode = this.txtDefectCode.Text.Trim();
entity.DefectPositionIDS = this.dkSemiCheckDefectPositionSearchBox1.DefectPositionIDS;
entity.DefectProcedureIDS = this.dkProcedureSearchBox1.ProcedureIDS;
entity.DefectUser = this.txtDefectUser.Text.Trim();
ServiceResultEntity resultEntity = ReportModuleProxy.Service.GetRPT080107IData(entity);
return resultEntity.Data;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}