| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- /*******************************************************************************
- * 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
- {
- /// <summary>
- /// 工艺配置一览
- /// </summary>
- public partial class F_MST_1102 : DockPanelBase
- {
- #region 成员变量
- //单例模式
- private static F_MST_1102 _instance;
- #endregion
- #region 构造函数
- /// <summary>
- /// 废弃一览构造
- /// </summary>
- 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 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_MST_1102 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_MST_1102();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 查询事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 清空条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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;
- }
- /// <summary>
- /// 关闭一览窗体
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 窗体关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_2201_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 自动列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvTransfer.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvTransferSetting.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 审批按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 选定项改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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 私有方法
- /// <summary>
- /// 根据界面查询条件获取数据集
- /// </summary>
- 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
- /// <summary>
- /// 撤销复检按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 新建
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 复制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- }
- }
|