/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PC_0101.cs * 2.功能描述:成型线信息一览,以及对成型线模具的相关操作 * 编辑履历: * 作者 日期 版本 修改内容 * 庄天威 2014/09/13 1.00 新建 *******************************************************************************/ using System; using System.Collections.Generic; using System.Data; using System.Text; 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.Client.DataModels; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; using Dongke.IBOSS.PRD.WCF.Proxys.PCModuleService; namespace Dongke.IBOSS.PRD.Client.PCModule { /// /// 成型线信息一览,以及对成型线模具的相关操作 /// public partial class F_PC_0101 : DockPanelBase { #region 成员变量 //单例模式 private static F_PC_0101 _instance; //选择的成型线实体 private GroutingLineEntity _groutingLineEntity = new GroutingLineEntity(); //成型线明细(模具)实体集合 private List _detailList = new List(); //范围权限 private string _purview; //操作时间 private DateTime? _startTime; //换产产品ID private int? _newGoodsId; //操作说明/备注 private string _remarksOrRreason = ""; #endregion #region 构造函数 /// /// 成型线一览窗体构造 /// public F_PC_0101() { InitializeComponent(); this.Text = FormTitles.F_PC_0101; this.tsbtnRepairMould.Text = ButtonText.TSBTN_REPAIRMOULD; this.tsbtnRepairMouldEnd.Text = ButtonText.TSBTN_REPAIRMOULDEND; this.tsbtnChangeMould.Text = ButtonText.TSBTN_CHANGEMOULD; this.tsbtnChangeMouldEnd.Text = ButtonText.TSBTN_CHANGEMOULDEND; this.tsbtnDisable.Text = ButtonText.TSBTN_DISABLE; this.tsbtnChangeMouldAll.Text = ButtonText.TSBTN_CHANGEMOULDENDALL; this.tsbtnChangeMouldAllEnd.Text = ButtonText.TSBTN_CHANGEMOULDENDALLEND; 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_PC_0101 Instance { get { if (_instance == null) { _instance = new F_PC_0101(); } return _instance; } } #endregion #region 事件 /// /// 窗体加载 /// private void F_PC_0101_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); getPurview(); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 自动适应列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvGroutingLineDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 关闭按钮事件 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 获取数据 /// private void btnSearch_Click(object sender, EventArgs e) { try { if (this.dkGrouting.GroutingLineID == null) { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.dkGrouting.Focus(); return; } DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体关闭 /// private void F_PC_0101_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } /// /// 清空条件 /// private void btnClearCondition_Click(object sender, EventArgs e) { this.dkGrouting.GroutingLineID = null; this.dkGrouting.Text = null; this.dgvGroutingLineDetail.DataSource = null; this.tsbtnChangeMouldAll.Enabled = false; this.tsbtnChangeMouldAllEnd.Enabled = false; } /// /// 选择明细 /// private void dgvGroutingLineDetail_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (e.RowIndex == -Constant.INT_IS_ONE || e.ColumnIndex == -Constant.INT_IS_ONE) { return; } int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString()); if (this.dkGrouting.GMouldStatus == Constant.INT_IS_THREE) { this.tsbtnRepairMould.Enabled = false; this.tsbtnRepairMouldEnd.Enabled = false; this.tsbtnChangeMould.Enabled = false; this.tsbtnChangeMouldEnd.Enabled = false; this.tsbtnDisable.Enabled = false; this.tsbtnChangeMouldAll.Enabled = false; this.tsbtnChangeMouldAllEnd.Enabled = true; return; } GroutingLineDetailEntity detailEntity = _detailList[Index]; if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal)) { this.tsbtnRepairMould.Enabled = true; this.tsbtnChangeMould.Enabled = true; this.tsbtnChangeMouldEnd.Enabled = false; this.tsbtnRepairMouldEnd.Enabled = false; this.tsbtnDisable.Enabled = true; } if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Repair)) { this.tsbtnChangeMould.Enabled = true; this.tsbtnRepairMould.Enabled = false; this.tsbtnRepairMouldEnd.Enabled = true; this.tsbtnChangeMouldEnd.Enabled = false; this.tsbtnDisable.Enabled = true; } if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Replac)) { this.tsbtnRepairMould.Enabled = false; this.tsbtnRepairMouldEnd.Enabled = false; this.tsbtnChangeMould.Enabled = false; this.tsbtnChangeMouldEnd.Enabled = true; this.tsbtnDisable.Enabled = true; } if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Disable)) { this.tsbtnRepairMould.Enabled = false; this.tsbtnRepairMouldEnd.Enabled = false; this.tsbtnChangeMould.Enabled = false; this.tsbtnChangeMouldEnd.Enabled = false; this.tsbtnDisable.Enabled = false; } if(detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Update)) { this.tsbtnRepairMould.Enabled = false; this.tsbtnRepairMouldEnd.Enabled = false; this.tsbtnChangeMould.Enabled = false; this.tsbtnChangeMouldEnd.Enabled = false; this.tsbtnDisable.Enabled = false; } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体关闭 /// private void GroutingLineInfo_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } /// /// 修模操作 /// /// /// private void tsbtnRepairMould_Click(object sender, EventArgs e) { try { if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO) { F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "修模"); DialogResult dialogresult = frmFPC0106.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString(); int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString()); //修模处理 GroutingLineDetailEntity detailEntity = _detailList[Index]; detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Repair); GMouldRecordEntity recordEntity = new GMouldRecordEntity(); recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID; recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID; recordEntity.GOODSID = detailEntity.GOODSID; recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE; recordEntity.MouldCode = detailEntity.MOULDCODE; recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT; recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Repair); if (_remarksOrRreason == string.Empty) { recordEntity.RREASON = "修模"; } else { recordEntity.RREASON = _remarksOrRreason; } recordEntity.BEGINDATE = Convert.ToDateTime(_startTime); recordEntity.REMARKS = ""; //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.RepAirDetail(detailEntity, recordEntity); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "修模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "修模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } 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 tsbtnRepairMouldEnd_Click(object sender, EventArgs e) { try { if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO) { F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "修模结束"); DialogResult dialogresult = frmFPC0106.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString(); int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString()); //修模完成处理 GroutingLineDetailEntity detailEntity = _detailList[Index]; detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal); //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.RepAirDetailEnd(detailEntity, _startTime, _remarksOrRreason); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "修模结束"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "修模结束"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } 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 tsbtnChangeMould_Click(object sender, EventArgs e) { try { if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO) { F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "换模"); DialogResult dialogresult = frmFPC0106.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString(); int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString()); //插入换修履历以及模具履历,并更新成型线明细的新编号,重置注浆次数,开始使用时间。以及换模中的状态 if (Constant.NowUpdateMode == Constant.GroutingLineDetailUpdateMode.Preposition) { GroutingLineDetailEntity detailEntity = _detailList[Index]; GMouldRecordEntity recordEntity = new GMouldRecordEntity(); recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID; recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID; recordEntity.GOODSID = detailEntity.GOODSID; recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE; recordEntity.MouldCode = detailEntity.MOULDCODE; recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT; if (this._remarksOrRreason != string.Empty) { recordEntity.RREASON = _remarksOrRreason; } else { recordEntity.RREASON = Constant.BUTTON_TEXT_CHANGE; } recordEntity.REMARKS = recordEntity.RREASON; if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal)) { recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Replac); } else { recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.RepairToReplac); } recordEntity.BEGINDATE = Convert.ToDateTime(_startTime); GMouldHistoryEntity historyEntity = new GMouldHistoryEntity(); historyEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID; historyEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID; historyEntity.GOODSID = detailEntity.GOODSID; historyEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE; historyEntity.MouldCode = detailEntity.MOULDCODE; historyEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT; historyEntity.BEGINUSEDDATE = detailEntity.BEGINUSEDDATE; historyEntity.ENDUSEDDATE = Convert.ToDateTime(_startTime); historyEntity.REMARKS = recordEntity.RREASON;//""; //模具编号要更新 detailEntity.MOULDCODE = Guid.NewGuid().ToString(); detailEntity.GROUTINGCOUNT = 0; detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Replac); detailEntity.BEGINUSEDDATE = Convert.ToDateTime(_startTime); detailEntity.REMARKS = this._remarksOrRreason; //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.ChangeDetailPreposition(detailEntity, recordEntity, historyEntity); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else //只插入换修履历,并只更新成型线明细的状态(换模中) { GroutingLineDetailEntity detailEntity = _detailList[Index]; GMouldRecordEntity recordEntity = new GMouldRecordEntity(); recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID; recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID; recordEntity.GOODSID = detailEntity.GOODSID; recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE; recordEntity.MouldCode = detailEntity.MOULDCODE; recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT; recordEntity.BEGINDATE = Convert.ToDateTime(_startTime); recordEntity.RREASON = Constant.BUTTON_TEXT_CHANGE; recordEntity.REMARKS = ""; if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal)) { recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Replac); } else { recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.RepairToReplac); } detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Replac); //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.ChangeDetailPostposition(detailEntity, recordEntity); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } 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 tsbtnChangeMouldEnd_Click(object sender, EventArgs e) { try { if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO) { F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "换模结束"); DialogResult dialogresult = frmFPC0106.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString(); int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString()); if (Constant.NowUpdateMode == Constant.GroutingLineDetailUpdateMode.Preposition) //把明细修改回来即可 { //换模结束处理 GroutingLineDetailEntity detailEntity = _detailList[Index]; detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal); detailEntity.REMARKS = this._remarksOrRreason; //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.ChangeDetailEndPreposition(detailEntity, _startTime, _remarksOrRreason); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模结束"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模结束"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else //插入模具履历,并更新成型线明细的模具编号,重置开始使用时间,注浆次数,以及把模具状态修改为正常 { //换模结束处理 GroutingLineDetailEntity detailEntity = this._detailList[Index]; GMouldHistoryEntity historyEntity = new GMouldHistoryEntity(); historyEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID; historyEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID; historyEntity.GOODSID = detailEntity.GOODSID; historyEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE; historyEntity.MouldCode = detailEntity.MOULDCODE; historyEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT; historyEntity.BEGINUSEDDATE = detailEntity.BEGINUSEDDATE; historyEntity.ENDUSEDDATE = Convert.ToDateTime(_startTime); historyEntity.REMARKS = ""; detailEntity.MOULDCODE = Guid.NewGuid().ToString(); detailEntity.GROUTINGCOUNT = 0; detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal); detailEntity.BEGINUSEDDATE = Convert.ToDateTime(_startTime); //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.ChangeDetailEndPostposition(detailEntity, historyEntity); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模结束"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模结束"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } 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 tsbtnDisable_Click(object sender, EventArgs e) { try { if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO) { string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString(); int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString()); GroutingLineDetailEntity detailEntity = _detailList[Index]; GMouldRecordEntity recordEntity = new GMouldRecordEntity(); recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID; recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID; recordEntity.GOODSID = detailEntity.GOODSID; recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE; recordEntity.MouldCode = detailEntity.MOULDCODE; recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT; recordEntity.BEGINDATE = Convert.ToDateTime(_startTime); recordEntity.RESUMETYPE = 0; recordEntity.RREASON = Constant.BUTTON_TEXT_STOP; recordEntity.REMARKS = ""; if (detailEntity.MOULDSTATUS != Convert.ToInt32(Constant.GMouldStatus.Normal)) { PCModuleProxy.Service.UpdateMouldRecordEndTime(recordEntity); } detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Disable); //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.StopDetail(detailEntity, recordEntity); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "停用"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MyReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "停用"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } 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 tsbtnChangeMouldAll_Click(object sender, EventArgs e) { try { if (this.dkGrouting.GroutingLineID != null) { F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "整线换模"); DialogResult dialogresult = frmFPC0106.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { int AllReturn = Constant.INT_IS_ZERO; AllReturn = PCModuleProxy.Service.ChangeAllLine(_groutingLineEntity, _detailList, _startTime, _remarksOrRreason); if (AllReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } //控件数据源重新绑定 this.dkGrouting.DataSourseBind(); //按钮可用性调整 this.tsbtnChangeMouldAll.Enabled = false; this.tsbtnChangeMouldAllEnd.Enabled = true; //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为3 this.dkGrouting.GMouldStatus = 3; MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "整线换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (AllReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "整线换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 全线换模结束操作 /// /// /// private void tsbtnChangeMouldAllEnd_Click(object sender, EventArgs e) { try { if (this.dkGrouting.GroutingLineID != null) { F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "整线换模结束"); DialogResult dialogresult = frmFPC0106.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { int AllReturn = Constant.INT_IS_ZERO; AllReturn = PCModuleProxy.Service.ChangeAllLineEnd(_groutingLineEntity, _detailList, _startTime, _remarksOrRreason); if (AllReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } //控件数据源重新绑定 this.dkGrouting.DataSourseBind(); //按钮可用性调整 this.tsbtnChangeMouldAll.Enabled = true; this.tsbtnChangeMouldAllEnd.Enabled = false; //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为1 this.dkGrouting.GMouldStatus = 1; MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "整线换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (AllReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "整线换模"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 成型线改变 /// /// /// private void dkGrouting_MouldTypeValueChanged(object sender, Controls.SearchTextBox.dkGroutingLineSearchBox.TextChangeEventArgs e) { this.dgvGroutingLineDetail.DataSource = null; this._groutingLineEntity.GROUTINGLINEID = this.dkGrouting.GroutingLineID; this._groutingLineEntity.OPTIMESTAMP = this.dkGrouting.OPTimeStamp; DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); } if (this.dkGrouting.GMouldStatus == Convert.ToInt32(Constant.GMouldStatus.Normal)) { this.tsbtnChangeMouldAll.Enabled = true; this.tsbtnChangeMouldAllEnd.Enabled = false; this.tsbtnUpdateLine.Enabled = true; this.tsbtnUpdateLineEnd.Enabled = false; } else if(this.dkGrouting.GMouldStatus == Convert.ToInt32(Constant.GMouldStatus.Update)) { this.tsbtnChangeMouldAll.Enabled = false; this.tsbtnChangeMouldAllEnd.Enabled = false; this.tsbtnUpdateLine.Enabled = false; this.tsbtnUpdateLineEnd.Enabled = true; } else { this.tsbtnChangeMouldAll.Enabled = false; this.tsbtnChangeMouldAllEnd.Enabled = true; this.tsbtnUpdateLine.Enabled = false; this.tsbtnUpdateLineEnd.Enabled = false; } } #endregion #region 私有方法 /// /// 将明细DataSet数据集转入集合中 /// private void DataTableToListByDetail(DataSet dsDetail) { try { this._detailList.Clear(); foreach (DataRow dr in dsDetail.Tables[0].Rows) { GroutingLineDetailEntity detailEntity = new GroutingLineDetailEntity(); detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(dr[0]); detailEntity.GROUTINGLINEID = Convert.ToInt32(dr[1]); detailEntity.GROUTINGMOULDCODE = dr[2].ToString(); detailEntity.MOULDCODE = dr[3].ToString(); detailEntity.GOODSID = Convert.ToInt32(dr[4]); detailEntity.GROUTINGCOUNT = Convert.ToDecimal(dr[5]); detailEntity.MOULDSTATUS = Convert.ToInt32(dr[6]); detailEntity.BEGINUSEDDATE = Convert.ToDateTime(dr[7]); detailEntity.REMARKS = dr[8].ToString(); detailEntity.ACCOUNTID = Convert.ToInt32(dr[9]); detailEntity.VALUEFLAG = Convert.ToInt32(dr[10]); detailEntity.CREATETIME = Convert.ToDateTime(dr[11]); detailEntity.CREATEUSERID = Convert.ToInt32(dr[12]); detailEntity.UPDATETIME = Convert.ToDateTime(dr[13]); detailEntity.UPDATEUSERID = Convert.ToInt32(dr[14]); detailEntity.OPTIMESTAMP = Convert.ToDateTime(dr[15]); this._detailList.Add(detailEntity); } } catch (Exception ex) { throw ex; } } /// /// 根据选择成型线显示模具 /// /// private DataSet GetGroutingLineDetail() { return PCModuleProxy.Service.GetGroutingLineDetailByMainId(Convert.ToInt32(this.dkGrouting.GroutingLineID), null, 6); } /// /// 获取成型线权限 /// protected void getPurview() { try { StringBuilder sbPurview = new StringBuilder(); DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(6, LogInUserInfo.CurrentUser.UserID); if (dsPurview != null) { foreach (DataRow dr in dsPurview.Tables[0].Rows) { sbPurview.Append(dr[0].ToString() + ","); } if (sbPurview.Length != Constant.INT_IS_ZERO) { this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1); } } this.dkGrouting.Purview = _purview; this.dkGrouting.IsEnablePurview = true; } catch (Exception ex) { throw ex; } } /// /// 将成型线明细DataSet数据集转入集合中 /// private void DataTableToListByLineDetail(DataSet dsLineDetail) { try { this._detailList.Clear(); foreach (DataRow drFor in dsLineDetail.Tables[0].Rows) { GroutingLineDetailEntity detailEntity = new GroutingLineDetailEntity(); detailEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]); detailEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]); detailEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]); detailEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]); detailEntity.GOODSCODE = drFor["GOODSCODE"].ToString(); detailEntity.GOODSID = Convert.ToInt32(drFor["GOODSID"]); detailEntity.GOODSNAME = drFor["GOODSNAME"].ToString(); detailEntity.GROUTINGCOUNT = Convert.ToDecimal(drFor["GROUTINGCOUNT"]); detailEntity.GROUTINGLINECODE = drFor["GROUTINGLINECODE"].ToString(); detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(drFor["GROUTINGLINEDETAILID"]); detailEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]); detailEntity.GROUTINGLINENAME = drFor["GROUTINGLINENAME"].ToString(); detailEntity.GROUTINGMOULDCODE = drFor["GROUTINGMOULDCODE"].ToString(); detailEntity.MOULDCODE = drFor["GroutingMouldCode"].ToString(); detailEntity.MOULDSTATUS = Convert.ToInt32(drFor["GMouldStatus"]); detailEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]); detailEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]); detailEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]); detailEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]); this._detailList.Add(detailEntity); } } catch (Exception ex) { throw ex; } } /// /// 设置起始时间与备注 /// /// /// public void SetTimeOrRemarks(DateTime? startTime, string remarkStr) { this._startTime = startTime; this._remarksOrRreason = remarkStr; } /// /// 成型线换产设置 /// /// /// /// public void SetTimeOrRemarksGoodsId(DateTime? startTime,string remarkStr,int? GoodsId) { this._startTime = startTime; this._remarksOrRreason = remarkStr; this._newGoodsId = GoodsId; } #endregion private void tsbtnUpdateLine_Click(object sender, EventArgs e) { try { if (this.dkGrouting.GroutingLineID != null) { F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "成型线换产"); DialogResult dialogresult = frmFPC0106.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { int AllReturn = Constant.INT_IS_ZERO; _groutingLineEntity.REMARKS = _remarksOrRreason; _groutingLineEntity.GROUTINGLINEID = this.dkGrouting.GroutingLineID;//加这个为了变产结束在重复变产,造成成型线ID不对 AllReturn = PCModuleProxy.Service.UpdateLine(_groutingLineEntity, _detailList); if (AllReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } //控件数据源重新绑定 this.dkGrouting.DataSourseBind(); //按钮可用性调整 this.tsbtnUpdateLine.Enabled = false; this.tsbtnUpdateLineEnd.Enabled = true; this.tsbtnChangeMouldAll.Enabled = false; this.tsbtnChangeMouldAllEnd.Enabled = false; //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为3 this.dkGrouting.GMouldStatus = 4; MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "成型线换产"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (AllReturn == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "成型线换产"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } private void tsbtnUpdateLineEnd_Click(object sender, EventArgs e) { try { if (this.dkGrouting.GroutingLineID != null) { F_PC_0107 frmFPC0107 = new F_PC_0107(_instance, "成型线换产"); DialogResult dialogresult = frmFPC0107.ShowDialog(); if (dialogresult.Equals(DialogResult.OK)) { int NewLineId = Constant.INT_IS_ZERO; _groutingLineEntity.REMARKS = _remarksOrRreason; NewLineId = PCModuleProxy.Service.UpdateLineEnd(_groutingLineEntity, _detailList, Convert.ToInt32(_newGoodsId)); // modify wangx 2015/07/15 this.dkGrouting.GroutingLineID = NewLineId; this.dkGrouting.DataSource = null; // modify wangx 2015/07/15 end if (NewLineId > Constant.INT_IS_ZERO) { this.dkGrouting.GroutingLineID = NewLineId; DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } //控件数据源重新绑定 this.dkGrouting.DataSourseBind(); //按钮可用性调整 this.tsbtnUpdateLine.Enabled = true; this.tsbtnUpdateLineEnd.Enabled = false; //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为1 this.dkGrouting.GMouldStatus = 1; MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "成型线换产"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (NewLineId == -500) { MessageBox.Show(Messages.MSG_CMN_W012, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "成型线换产"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 启用按钮事件 /// /// /// private void tsbtnStart_Click(object sender, EventArgs e) { try { if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO) { string GMouldStatus = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GMouldStatus"].Value.ToString(); if(GMouldStatus!="0") { return; } string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString(); //准备提交 int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return PCModuleProxy.Service.StartDetail(Convert.ToInt32(detailId)); })); if (MyReturn > Constant.INT_IS_ZERO) { DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0]; this.dgvGroutingLineDetail.ReadOnly = true; } } MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "启用"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "启用"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } 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); } } } }