/*******************************************************************************
* Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_MST_1102.cs
* 2.功能描述:工艺配置一览
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2016/07/20 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.SystemModule
{
///
/// 工艺配置一览
///
public partial class F_MST_1102 : DockPanelBase
{
#region 成员变量
//单例模式
private static F_MST_1102 _instance;
#endregion
#region 构造函数
///
/// 废弃一览构造
///
public F_MST_1102()
{
InitializeComponent();
this.Text = FormTitles.F_MST_1102;
this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
this.tsbtnCopy.Text = ButtonText.TSBTN_COPY;
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_MST_1102 Instance
{
get
{
if (_instance == null)
{
_instance = new F_MST_1102();
}
return _instance;
}
}
#endregion
#region 事件
///
/// 查询事件
///
///
///
private void btnSearch_Click(object sender, EventArgs e)
{
try
{
DataSet dsTransfer = (DataSet)DoAsync(new AsyncMethod(() =>
{
return this.GetTransfer();
}));
if (dsTransfer != null)
{
if (dsTransfer.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
{
this.dgvTransfer.DataSource = ((DataSet)dsTransfer).Tables[Constant.INT_IS_ZERO];
this.dgvTransfer.ReadOnly = true;
this.dgvTransfer.Rows[0].Selected = true;
this.tsbtnEdit.Enabled = true;
this.tsbtnCopy.Enabled = true;
}
else
{
this.dgvTransfer.DataSource = null;
this.dgvTransferSetting.DataSource = null;
this.tsbtnEdit.Enabled = false;
this.tsbtnCopy.Enabled = false;
// 提示未查找到数据
MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
this.dgvTransfer.DataSource = null;
this.dgvTransferSetting.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 btnClearCondition_Click(object sender, EventArgs e)
{
this.txtName.Text = string.Empty;
this.txtRemarks.Text = string.Empty;
this.dkproductionLineSearchBox1.ClearControl();
this.chkVYes.Checked = true;
this.chkVNo.Checked = false;
}
///
/// 关闭一览窗体
///
///
///
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.dgvTransfer.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
this.dgvTransferSetting.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
}
///
/// 审批按钮事件
///
///
///
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);
// string GoodsLevelTypeID = currentRow.Cells["GoodsLevelTypeID"].Value.ToString();
// if (GoodsLevelTypeID != _goodsLevelTypeID.ToString())
// {
// return;
// }
// F_PM_1103 frmFPM1103 = new F_PM_1103(barCode, 0, ScrapProductID);
// DialogResult dialogresult = frmFPM1103.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 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.dgvTransfer.AutoGenerateColumns = false;
this.dgvTransferSetting.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 dgvTransfer_SelectionChanged(object sender, EventArgs e)
{
try
{
if (this.dgvTransfer.CurrentCell != null)
{
if (!this.txtName.ReadOnly)
{
this.dgvTransferSetting.DataSource = null;
int ptid = Convert.ToInt32(this.dgvTransfer.Rows[this.dgvTransfer.CurrentCell.RowIndex].Cells["PTID"].Value.ToString());
DataSet dsDetail = (DataSet)DoAsync(new AsyncMethod(() =>
{
return SystemModuleProxy.Service.GetTransferInfo(ptid);
}));
if (dsDetail != null && dsDetail.Tables.Count > Constant.INT_IS_ZERO
&& dsDetail.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
{
this.dgvTransferSetting.DataSource = dsDetail.Tables[0];
}
this.dgvTransfer.Focus();
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
#endregion
#region 私有方法
///
/// 根据界面查询条件获取数据集
///
private DataSet GetTransfer()
{
try
{
TecDepEntity entity = new TecDepEntity();
entity.Name = this.txtName.Text.Trim();
entity.LineIDS = this.dkproductionLineSearchBox1.ProductionLineIDS;
entity.Remarks = this.txtRemarks.Text.Trim();
if(this.chkVNo.Checked && this.chkVYes.Checked)
{
entity.ValueFlag = 2;
}
else
{
if(this.chkVNo.Checked)
{
entity.ValueFlag = 0;
}
else
{
entity.ValueFlag = 1;
}
}
return SystemModuleProxy.Service.GetTransfer(entity);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
///
/// 撤销复检按钮事件
///
///
///
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);
}
}
///
/// 新建
///
///
///
private void tsbtnAdd_Click(object sender, EventArgs e)
{
try
{
F_MST_1103 frmMST1103 = new F_MST_1103(0);
DialogResult dialogresult = frmMST1103.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 tsbtnEdit_Click(object sender, EventArgs e)
{
try
{
DataGridViewRow currentRow = this.dgvTransfer.CurrentRow;
if (currentRow != null)
// 获取相应节点数据
{
F_MST_1103 frmMST1103 = new F_MST_1103(
Convert.ToInt32(currentRow.Cells["PTID"].Value));
DialogResult dialogresult = frmMST1103.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 tsbtnCopy_Click(object sender, EventArgs e)
{
try
{
DataGridViewRow currentRow = this.dgvTransfer.CurrentRow;
if (currentRow != null)
// 获取相应节点数据
{
F_MST_1103 frmMST1103 = new F_MST_1103(
0 - Convert.ToInt32(currentRow.Cells["PTID"].Value));
DialogResult dialogresult = frmMST1103.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);
}
}
}
}