/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PC_0101_1_1.cs * 2.功能描述:成型线信息一览,以及对成型线模具的相关操作 * 编辑履历: * 作者 日期 版本 修改内容 * 王鑫 2015/09/18 1.00 新建 *******************************************************************************/ using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseControls; 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; namespace Dongke.IBOSS.PRD.Client.PCModule { public partial class F_PC_0101_1_1 : DockPanelBase { #region 成员变量 //单例模式 private static F_PC_0101_1_1 _instance; //选择的成型线实体 private GroutingLineEntity _groutingLineEntity = new GroutingLineEntity(); //成型线明细(模具)实体集合 private List _detailList = new List(); //范围权限 private string _purview; //操作时间 private DateTime? _startTime; //换产产品ID private int? _newGoodsId; //操作说明/备注 private string _remarksOrRreason = ""; //成型线ID private int? _groutingLineID = null; //是否整线变产 private bool isAllLine = false; // private int? _gMouldStatus = null; private DateTime? _lineOPTimeStamp = null; #endregion #region 构造函数 /// /// 成型线一览窗体构造 /// public F_PC_0101_1_1() { //((DataTable)dgvGroutingLineDetail.DataSource).AcceptChanges(); InitializeComponent(); this.Text = FormTitles.F_PC_0101_1_1; 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; this.dgvGroutingLineDetail.Tag = null; if (this._groutingLineID != null) { btnSearch_Click(null, null); } } public void SetGroutingLineIDAndGroutingLineCode(int? groutingLineID, string groutingLineCode) { if (groutingLineID != null) { this._groutingLineID = groutingLineID; this.scbGroutingLine.SearchedPKMember = Convert.ToInt32(groutingLineID); this.scbGroutingLine.Text = groutingLineCode; this.scbGroutingLine.CheckedData = null; btnSearch_Click(null, null); } } /// /// 成型线一览窗体构造 /// public F_PC_0101_1_1(int groutingLineID, string groutingLineCode) { InitializeComponent(); this._groutingLineID = groutingLineID; this.scbGroutingLine.SearchedPKMember = groutingLineID; this.scbGroutingLine.Text = groutingLineCode; this.Text = FormTitles.F_PC_0101_1_1; 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; this.dgvGroutingLineDetail.Tag = null; btnSearch_Click(null, null); } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PC_0101_1_1 Instance { get { if (_instance == null) { _instance = new F_PC_0101_1_1(); } 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.scbGroutingLine.SearchedPKMember == 0 || string.IsNullOrEmpty(this.scbGroutingLine.Text)) { this.dgvGroutingLineDetail.DataSource = null; MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.scbGroutingLine.Focus(); return; } DataSet dsGroutingLineDetail = (DataSet)DoAsync(new AsyncMethod(() => { return GetGroutingLineDetail(); })); if (dsGroutingLineDetail != null) { DataView dv = dsGroutingLineDetail.Tables[0].DefaultView; DataView dv2 = dsGroutingLineDetail.Tables[1].DefaultView; dv.RowFilter = "valueflag=1"; dsGroutingLineDetail = new DataSet(); dsGroutingLineDetail.Tables.Add(dv.ToTable()); dsGroutingLineDetail.Tables.Add(dv2.ToTable()); this.DataTableToListByLineDetail(dsGroutingLineDetail); if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingLineDetail.AutoGenerateColumns = false; this.dgvGroutingLineDetail.DataSource = dsGroutingLineDetail.Tables[0]; //this._gMouldStatus = Convert.ToInt32(dsGroutingLineDetail.Tables[1].Rows[0]["GMouldStatus"].ToString()); //if (dsGroutingLineDetail.Tables[0].Rows.Count > 0) //{ // this.txtLineGMouldStatus.Text = dsGroutingLineDetail.Tables[0].Rows[0]["LineGMouldStatus"].ToString(); //} //else //{ // this.txtLineGMouldStatus.Text = ""; //} } if (dsGroutingLineDetail.Tables[1].Rows.Count > 0) { this._gMouldStatus = Convert.ToInt32(dsGroutingLineDetail.Tables[1].Rows[0]["GMouldStatus"].ToString()); this.txtLineGMouldStatus.Text = dsGroutingLineDetail.Tables[1].Rows[0]["GMouldStatusName"].ToString(); this._lineOPTimeStamp = Convert.ToDateTime(dsGroutingLineDetail.Tables[1].Rows[0]["OPTimeStamp"]); if (this._gMouldStatus == 4) { this.isAllLine = true; } else { this.isAllLine = false; } } else { this.txtLineGMouldStatus.Text = ""; this._gMouldStatus = null; this._lineOPTimeStamp = null; } this.chkUserChoose.Checked = false; } } 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.scbGroutingLine.ClearValue(); this.dgvGroutingLineDetail.DataSource = null; this.tsbtnChangeMouldAll.Enabled = false; this.tsbtnChangeMouldAllEnd.Enabled = false; this.chkUserChoose.Checked = 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 tsbtnUpdateLine_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); if (dtGMouldStatus.Rows.Count > 1) { MessageBox.Show("多种模具状态不能同时操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "1") { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行变产操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } for (int i = 0; i < dtNew.Rows.Count; i++) { //dtNew.Rows[i]["RecordRemarks"] = "[变产" + dtNew.Rows[i]["MouldBarcode"] + "][" + dtNew.Rows[i]["GOODSCODE"] + "]"; dtNew.Rows[i]["RecordRemarks"] = "[变产][" + dtNew.Rows[i]["GOODSCODE"] + "]"; } dtNew.AcceptChanges(); F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dtNew, this.Text + "-变产", 5); DialogResult dialogresult = frmFPC0101.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 GroutingLineInfo_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } /// /// 修模操作 /// /// /// private void tsbtnRepairMould_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); if (dtGMouldStatus.Rows.Count > 1) { MessageBox.Show("多种模具状态不能同时操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "1") { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行维修操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } for (int i = 0; i < dtNew.Rows.Count; i++) { //dtNew.Rows[i]["RecordRemarks"] = "[维修" + dtNew.Rows[i]["MouldBarcode"] + "]"; dtNew.Rows[i]["RecordRemarks"] = "[维修]"; } dtNew.AcceptChanges(); F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dtNew, this.Text + "-维修", 2); DialogResult dialogresult = frmFPC0101.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 tsbtnRepairMouldEnd_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); if (dtGMouldStatus.Rows.Count > 1) { MessageBox.Show("多种模具状态不能同时操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "2") { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行结束维修操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } for (int i = 0; i < dtNew.Rows.Count; i++) { //dtNew.Rows[i]["RecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[结束维修" + dtNew.Rows[i]["MouldBarcode"] + "]"; dtNew.Rows[i]["RecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[结束维修]"; } dtNew.AcceptChanges(); F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dtNew, this.Text + "-结束维修", 3); DialogResult dialogresult = frmFPC0101.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 tsbtnChangeMould_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); if (dtGMouldStatus.Rows.Count > 1) { MessageBox.Show("多种模具状态不能同时操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "1") { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行换模操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } for (int i = 0; i < dtNew.Rows.Count; i++) { //dtNew.Rows[i]["RecordRemarks"] = "[换模" + dtNew.Rows[i]["MouldBarcode"] + "]"; dtNew.Rows[i]["RecordRemarks"] = "[换模]"; } dtNew.AcceptChanges(); F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dtNew, this.Text + "-换模", 4); DialogResult dialogresult = frmFPC0101.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 tsbtnChangeMouldEnd_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); if (dtGMouldStatus.Rows.Count > 1) { MessageBox.Show("多种模具状态不能同时操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "3") { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行结束换模操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } dtNew.Columns.Add("NewMouldBarcode"); dtNew.Columns.Add("OldRecordRemarks"); for (int i = 0; i < dtNew.Rows.Count; i++) { dtNew.Rows[i]["MouldCode"] = DBNull.Value; dtNew.Rows[i]["MouldID"] = DBNull.Value; dtNew.Rows[i]["MouldSource"] = "0"; dtNew.Rows[i]["OldRecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[结束换模"; dtNew.Rows[i]["RecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[结束换模]"; dtNew.Rows[i]["GroutingCount"] = 0; } dtNew.AcceptChanges(); F_PC_0101_1_3 frmFPC0101 = new F_PC_0101_1_3(dtNew, this.Text + "-结束换模"); DialogResult dialogresult = frmFPC0101.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 tsbtnDisable_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1 and GMouldStatus = 1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何【正常】状态的数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); //DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); //if (dtGMouldStatus.Rows.Count > 1) //{ // MessageBox.Show("多种模具状态不能同时操作", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} //else //{ // if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "1") // { // MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行停用操作。", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } //} for (int i = 0; i < dtNew.Rows.Count; i++) { //dtNew.Rows[i]["RecordRemarks"] = "[停用" + dtNew.Rows[i]["MouldBarcode"] + "]"; dtNew.Rows[i]["RecordRemarks"] = "[停用]"; } dtNew.AcceptChanges(); F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dtNew, this.Text + "-停用", 0); DialogResult dialogresult = frmFPC0101.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 tsbtnChangeMouldAll_Click(object sender, EventArgs e) { try { if (this.scbGroutingLine.SearchedPKMember == 0) { MessageBox.Show("没有选择成型线", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.scbGroutingLine.Focus(); return; } if (this._gMouldStatus == 0) { MessageBox.Show("停用的成型线不允许整线变产", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //if (this.dgvGroutingLineDetail.CurrentCell != null) //{ // DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; // dt.AcceptChanges(); // if (dt == null || dt.Rows.Count == 0) // { // MessageBox.Show("没有选择任何数据", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } // else // { // DataRow[] drSelRow = dt.Select("GMouldStatus<>0 and GMouldStatus<>1"); // if (drSelRow.Length > 0) // { // MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行整线变产操作。", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } // // chenxy 停用的成型线可以整线变产 // //if (this._gMouldStatus == 0) // //{ // // MessageBox.Show("成型线停用状态不能整线变产", this.Text, // // MessageBoxButtons.OK, MessageBoxIcon.Warning); // // return; // //} // //DataTable dtNew = drSelRow.CopyToDataTable(); // for (int i = 0; i < dt.Rows.Count; i++) // { // dt.Rows[i]["RecordRemarks"] = "[整线变产]"; // } // dt.AcceptChanges(); // F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dt, this.Text + "-整线变产", 6); // DialogResult dialogresult = frmFPC0101.ShowDialog(); // if (dialogresult.Equals(DialogResult.OK)) // { // btnSearch_Click(sender, e); // } // } //} DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; if (dt != null && dt.Rows.Count > 0) { DataRow[] drSelRow = dt.Select("GMouldStatus<>0 and GMouldStatus<>1"); if (drSelRow.Length > 0) { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行整线变产操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["RecordRemarks"] = "[整线变产]"; } dt.AcceptChanges(); } F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dt, this.Text + "-整线变产", 6); frmFPC0101.GroutingLineCode = this.scbGroutingLine.Text; frmFPC0101.GroutingLineID = this.scbGroutingLine.SearchedPKMember; frmFPC0101.LineOPTimeStamp = _lineOPTimeStamp.Value; DialogResult dialogresult = frmFPC0101.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 tsbtnChangeMouldAllEnd_Click(object sender, EventArgs e) { try { if (this.scbGroutingLine.SearchedPKMember == 0) { MessageBox.Show("没有选择成型线", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.scbGroutingLine.Focus(); return; } if (!this.isAllLine) { MessageBox.Show("此成型线不是整线变产状态", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //if (this.dgvGroutingLineDetail.CurrentCell != null) //{ // DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; // dt.AcceptChanges(); // DataRow[] drSelRow = dt.Select("Sel=1 or Sel=0"); // if (drSelRow.Length == 0) // { // MessageBox.Show("没有选择任何数据", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } // else // { // DataTable dtNew = drSelRow.CopyToDataTable(); // DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); // if (dtGMouldStatus.Rows.Count > 1) // { // MessageBox.Show("多种模具状态不能同时操作", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } // else // { // if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "4") // { // MessageBox.Show("成型线状态为" + txtLineGMouldStatus.Text + ",不能进行结束整线变产操作。", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } // if (this._gMouldStatus != 4) // { // MessageBox.Show("成型线状态为" + txtLineGMouldStatus.Text + ",不能进行结束整线变产操作。", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } // } // //dtNew.Rows.Clear(); // //F_PC_0101_1_6 frmFPC0101 = new F_PC_0101_1_6(dtNew, this.Text + "-整线结束变产"); // //DialogResult dialogresult = frmFPC0101.ShowDialog(); // F_PC_0103_1 frmFPC0101 = new F_PC_0103_1(this.dkGrouting.GroutingLineID.Value, 4); // DialogResult dialogresult = frmFPC0101.ShowDialog(); // if (dialogresult.Equals(DialogResult.OK)) // { // btnSearch_Click(sender, e); // } // } //} F_PC_0103_1 frmFPC0101 = new F_PC_0103_1(this.scbGroutingLine.SearchedPKMember, 4); DialogResult dialogresult = frmFPC0101.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 dkGrouting_MouldTypeValueChanged(object sender, Controls.SearchTextBox.dkGroutingLineSearchBox.TextChangeEventArgs e) //{ // this.dgvGroutingLineDetail.DataSource = null; // btnSearch_Click(null, null); // /* // this._groutingLineEntity.GROUTINGLINEID = this.dkGrouting.GroutingLineID; // this._groutingLineEntity.OPTIMESTAMP = this.dkGrouting.OPTimeStamp; // this.txtLineGMouldStatus.Text = ""; // DataSet dsGroutingLineDetail = (DataSet)DoAsync(new 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; // //} //} /// /// 成型线改变事件 /// /// /// private void scbGroutingLine_SearchedItemChanged(object sender, EventArgs e) { this.dgvGroutingLineDetail.DataSource = null; btnSearch_Click(null, null); } /// /// 变产结束按钮事件 /// /// /// private void tsbtnUpdateLineEnd_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); if (dtGMouldStatus.Rows.Count > 1) { MessageBox.Show("多种模具状态不能同时操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "4") { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行结束变产操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } dtNew.Columns.Add("NewMouldBarcode"); dtNew.Columns.Add("OldRecordRemarks"); dtNew.Columns.Add("OldGoodsCode"); for (int i = 0; i < dtNew.Rows.Count; i++) { dtNew.Rows[i]["OldGoodsCode"] = dtNew.Rows[i]["GoodsCode"]; dtNew.Rows[i]["GoodsName"] = DBNull.Value; dtNew.Rows[i]["GoodsCode"] = DBNull.Value; dtNew.Rows[i]["GoodsID"] = DBNull.Value; dtNew.Rows[i]["MouldCode"] = DBNull.Value; dtNew.Rows[i]["MouldID"] = DBNull.Value; dtNew.Rows[i]["MouldSource"] = "0"; dtNew.Rows[i]["OldRecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[结束变产"; dtNew.Rows[i]["RecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[结束变产]"; dtNew.Rows[i]["GroutingCount"] = 0; } dtNew.AcceptChanges(); F_PC_0101_1_4 frmFPC0101 = new F_PC_0101_1_4(dtNew, this.Text + "-结束变产"); DialogResult dialogresult = frmFPC0101.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 tsbtnStart_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1 and GMouldStatus =0"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何【停用】状态的数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); //DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); //if (dtGMouldStatus.Rows.Count > 1) //{ // MessageBox.Show("多种模具状态不能同时操作", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} //else //{ // if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "0") // { // MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行启用操作。", this.Text, // MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } //} for (int i = 0; i < dtNew.Rows.Count; i++) { //dtNew.Rows[i]["RecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[启用" + dtNew.Rows[i]["MouldBarcode"] + "]"; dtNew.Rows[i]["RecordRemarks"] = dtNew.Rows[i]["RecordRemarks"] + "-[启用]"; } dtNew.AcceptChanges(); F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dtNew, this.Text + "-启用", 1); DialogResult dialogresult = frmFPC0101.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 chkUserChoose_CheckedChanged(object sender, EventArgs e) { try { DataTable returnData = (DataTable)this.dgvGroutingLineDetail.DataSource; if (returnData != null) { int rightFlag = Convert.ToInt32(chkUserChoose.Checked); for (int i = 0; i < returnData.Rows.Count; i++) { returnData.Rows[i]["Sel"] = rightFlag; } } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 设置单元格颜色 /// /// /// private void dgvGroutingLineDetail_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { DataGridView dgv = sender as DataGridView; if (dgv == null || dgv.ReadOnly || e.RowIndex < 0) { return; } try { foreach (DataGridViewColumn item in dgv.Columns) { if (!item.Visible) { continue; } if (item.ReadOnly || dgv.Rows[e.RowIndex].Cells[item.Index].ReadOnly) { dgv.Rows[e.RowIndex].Cells[item.Index].Style.BackColor = Color.White; } else { dgv.Rows[e.RowIndex].Cells[item.Index].Style.BackColor = ColorTranslator.FromHtml(ControlsConst.ALLOW_MODIFY_AREA_BACKGROUND_COLOR); } } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 卸模 /// /// /// private void tsbtnUnload_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.dgvGroutingLineDetail.CurrentCell != null) { DataTable dt = this.dgvGroutingLineDetail.DataSource as DataTable; dt.AcceptChanges(); DataRow[] drSelRow = dt.Select("Sel=1"); if (drSelRow.Length == 0) { MessageBox.Show("没有选择任何数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dtNew = drSelRow.CopyToDataTable(); DataTable dtGMouldStatus = dtNew.DefaultView.ToTable(true, "GMouldStatus"); if (dtGMouldStatus.Rows.Count > 1) { MessageBox.Show("多种模具状态不能同时操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dtGMouldStatus.Rows[0]["GMouldStatus"].ToString() != "1") { MessageBox.Show("模具状态为" + drSelRow[0]["GMOULDSTATUSNAME"].ToString() + ",不能进行卸模操作。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } for (int i = 0; i < dtNew.Rows.Count; i++) { //dtNew.Rows[i]["RecordRemarks"] = "[卸模" + dtNew.Rows[i]["MouldBarcode"] + "]"; dtNew.Rows[i]["RecordRemarks"] = "[卸模]"; } dtNew.AcceptChanges(); F_PC_0101_1_2 frmFPC0101 = new F_PC_0101_1_2(dtNew, this.Text + "-卸模", 7); DialogResult dialogresult = frmFPC0101.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 tsbtnOnLine_Click(object sender, EventArgs e) { try { if (this.isAllLine) { MessageBox.Show("整线变产后不允许其他操作", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } F_PC_0103_1 frmFPC0103 = new F_PC_0103_1(this.scbGroutingLine.SearchedPKMember, 0); DialogResult dialogresult = frmFPC0103.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 dgvGroutingLineDetail_CurrentCellDirtyStateChanged(object sender, EventArgs e) { //try //{ // //if (this.dgvGroutingLineDetail.CurrentRow != null && this.dgvGroutingLineDetail.IsCurrentCellDirty) // //{ // // if ("Sel".Equals(this.dgvGroutingLineDetail.Columns // // [this.dgvGroutingLineDetail.CurrentCell.ColumnIndex].Name)) // // { // // this.dgvGroutingLineDetail.CommitEdit(DataGridViewDataErrorContexts.Commit); // // } // //} //} //catch (Exception ex) //{ // // 对异常进行共通处理 // ExceptionManager.HandleEventException(this.ToString(), // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); //} if (this.dgvGroutingLineDetail.Tag != null) { return; } try { DataGridViewCell eCell = this.dgvGroutingLineDetail.CurrentCell; // 一模多产时,同模具条码的成型模具同时选中或不选中。 add by chenxy 2018-10-29 string colName = this.dgvGroutingLineDetail.Columns[eCell.ColumnIndex].Name; if ("Sel" != colName) { return; } int rightFlag = Convert.ToInt32(eCell.EditedFormattedValue); DataRowView drv = this.dgvGroutingLineDetail.CurrentRow.DataBoundItem as DataRowView; if (drv != null) { drv["Sel"] = rightFlag; drv.EndEdit(); } //this.dgvGroutingLineDetail.CommitEdit(DataGridViewDataErrorContexts.Commit); //this.dgvGroutingLineDetail.EndEdit(); object mouldID = this.dgvGroutingLineDetail.Rows[eCell.RowIndex].Cells["MouldID"].Value; if (mouldID == null || mouldID == DBNull.Value) { return; } int mID = Convert.ToInt32(mouldID); DataTable returnData = (DataTable)this.dgvGroutingLineDetail.DataSource; if (returnData != null) { //int gdID = Convert.ToInt32(this.dgvGroutingLineDetail.Rows[eCell.RowIndex].Cells["GroutingLineDetailID"].Value); //DataRow[] rows = returnData.Select("MouldID = " + mID + " and GroutingLineDetailID <> " + gdID); DataRow[] rows = returnData.Select("MouldID = " + mID); if (rows == null || rows.Length == 0) { return; } this.dgvGroutingLineDetail.Tag = 1; for (int i = 0; i < rows.Length; i++) { rows[i]["Sel"] = rightFlag; rows[i].EndEdit(); } //returnData.AcceptChanges(); this.dgvGroutingLineDetail.Tag = null; } } catch (Exception ex) { this.dgvGroutingLineDetail.Tag = null; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 一模多产时,同模具条码的成型模具同时选中或不选中. /// /// /// private void dgvGroutingLineDetail_CellContentClick(object sender, DataGridViewCellEventArgs e) { //try //{ // // 一模多产时,同模具条码的成型模具同时选中或不选中。 add by chenxy 2018-10-29 // string colName = this.dgvGroutingLineDetail.Columns[e.ColumnIndex].Name; // if ("Sel" != colName) // { // return; // } // //this.dgvGroutingLineDetail.CommitEdit(DataGridViewDataErrorContexts.Commit); // //this.dgvGroutingLineDetail.EndEdit(); // object mouldID = this.dgvGroutingLineDetail.Rows[e.RowIndex].Cells["MouldID"].Value; // if (mouldID == null || mouldID == DBNull.Value) // { // return; // } // int mID = Convert.ToInt32(mouldID); // DataTable returnData = (DataTable)this.dgvGroutingLineDetail.DataSource; // if (returnData != null) // { // //int gdID = Convert.ToInt32(this.dgvGroutingLineDetail.Rows[e.RowIndex].Cells["GroutingLineDetailID"].Value); // //DataRow[] rows = returnData.Select("MouldID = " + mID + " and GroutingLineDetailID <> " + gdID); // DataRow[] rows = returnData.Select("MouldID = " + mID); // if (rows == null || rows.Length == 0) // { // return; // } // //DataRowView drv = this.dgvGroutingLineDetail.Rows[e.RowIndex].DataBoundItem as DataRowView; // //int rightFlag = Convert.ToInt32(drv["Sel"]); // int rightFlag = Convert.ToInt32(this.dgvGroutingLineDetail.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue); // for (int i = 0; i < rows.Length; i++) // { // rows[i]["Sel"] = rightFlag; // rows[i].EndEdit(); // } // returnData.AcceptChanges(); // } //} //catch (Exception ex) //{ // // 对异常进行共通处理 // ExceptionManager.HandleEventException(this.ToString(), // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); //} } private void dgvGroutingLineDetail_CellValueChanged(object sender, DataGridViewCellEventArgs e) { } #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(this.scbGroutingLine.SearchedPKMember, null, 0);//6-0 } /// /// 获取成型线权限 /// 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 } }