using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.VRP.Entity; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; namespace Core.StlMes.Client.Mcp.VRP.Vrp { public partial class FrmStoveApplyDescion : FrmBase { public FrmStoveApplyDescion() { InitializeComponent(); } private string departCode = "";//所属权 private void FrmStoveApplyDescion_Load(object sender, EventArgs e) { dtBathYear.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")); txtProCode.Value = "E"; EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid3.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid4.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid6.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid5.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid7.DisplayLayout.Bands[0]); } /// /// 基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": queryData(); break; case "QueryScrap": queryScrapData(); break; case "insertScrapMata": insertScrapMata(); break; case "insertWhiteBank": insertWhiteBank(); break; case "cancelScrapMata": cancelScrapMata(); break; case "Export": ExportData(); break; case "Close": this.Close(); break; } } /// /// 查询整炉废 /// private void queryScrapData() { string jugeNo = ""; string bathYear = this.dtBathYear.Value.ToString("yyyyMM"); string plineCode = this.txtPline.Value.ToString(); if (this.txtPline.Text.ToString() == "") { MessageUtil.ShowTips("请选择产线!"); return; } //departCode = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob); if (this.chkLotNo.Checked) { if (this.txtJudgeNo.Text.Trim() == "") { MessageUtil.ShowTips("请输入炉号!"); } else { jugeNo = this.txtJudgeNo.Text.Trim(); } } ArrayList parmList = new ArrayList(); parmList.Add(jugeNo); parmList.Add(bathYear); parmList.Add(plineCode); if (txtProCode.Value == "E") { List listSource = EntityHelper.GetData( "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion.doQueryMataE", new object[] { parmList }, this.ob); PlnZyDbkMEntity1bindingSource.DataSource = listSource; queryQcm(); }else if(txtProCode.Value == "F") { List listSource = EntityHelper.GetData( "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion.doQueryMataF", new object[] { parmList }, this.ob); PlnZyRclMEntity1bindingSource.DataSource = listSource; queryQcm(); }else if(txtProCode.Value == "G") { List listSource = EntityHelper.GetData( "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion.doQueryMataG", new object[] { parmList }, this.ob); PlnZyJgxMEntity1bindingSource.DataSource = listSource; queryQcm(); } } /// /// 查询白条信息 /// private void queryData() { string jugeNo = ""; string bathYear = this.dtBathYear.Value.ToString("yyyyMM"); if (this.txtPline.Text.ToString() == "") { MessageUtil.ShowTips("请选择产线!"); return; } string plineCode = this.txtPline.Value.ToString(); //departCode = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob); if (this.chkLotNo.Checked) { if (this.txtJudgeNo.Text.Trim() == "") { MessageUtil.ShowTips("请输入炉号!"); } else { jugeNo = this.txtJudgeNo.Text.Trim(); } } ArrayList parmList = new ArrayList(); parmList.Add(jugeNo); parmList.Add(bathYear); parmList.Add(plineCode); if (txtProCode.Value == "E") { List listSourceS = EntityHelper.GetData( "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion.doQueryBTMataE", new object[] { parmList }, this.ob); PlnZyDbkMEntitybindingSource.DataSource = listSourceS; queryQcm(); }else if(txtProCode.Value == "F") { List listSourceS = EntityHelper.GetData( "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion.doQueryBTMataF", new object[] { parmList }, this.ob); PlnZyRclMEntitybindingSource.DataSource = listSourceS; queryQcm(); }else if(txtProCode.Value == "G") { List listSourceS = EntityHelper.GetData( "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion.doQueryBTMataG", new object[] { parmList }, this.ob); PlnZyJgxMEntitybindingSource.DataSource = listSourceS; queryQcm(); } } /// /// 查询当月所有白条\ 整炉废判定数据 /// public void queryQcm() { string jugeNo = ""; string bathYear = this.dtBathYear.Value.ToString("yyyyMM"); if (this.txtPline.Text.ToString() == "") { MessageUtil.ShowTips("请选择产线!"); return; } string plineCode = this.txtPline.Value.ToString(); //departCode = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob); if (this.chkLotNo.Checked) { if (this.txtJudgeNo.Text.Trim() == "") { MessageUtil.ShowTips("请输入炉号!"); } else { jugeNo = this.txtJudgeNo.Text.Trim(); } } ArrayList parmList = new ArrayList(); parmList.Add(jugeNo); parmList.Add(bathYear); parmList.Add(plineCode); if(txtProCode.Value =="E") { parmList.Add("E"); }else if(txtProCode.Value == "F") { parmList.Add("F"); }else if(txtProCode.Value =="G") { parmList.Add("G"); } List listSource = EntityHelper.GetData( "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion.doQueryQcmMata", new object[] { parmList }, this.ob); QcmZgApplybindingSource1.DataSource = listSource; } /// /// 增加整炉判废判定记录 /// private void insertScrapMata() { if (txtProCode.Value == "E") { this.ultraGrid3.UpdateData(); IQueryable checkMagRows = this.ultraGrid3.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要整炉废信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { PlnZyDbkMEntity milPlanEntity = (PlnZyDbkMEntity)uRow.ListObject; string mPlanTity = JSONFormat.Format(milPlanEntity); parmList.Add(mPlanTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion"; ccp.MethodName = "doDecisionScrapE"; ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("送判成功!")) { queryScrapData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } }else if(txtProCode.Value == "F") { this.ultraGrid6.UpdateData(); IQueryable checkMagRows = this.ultraGrid6.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要整炉废信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { PlnZyRclMEntity milPlanEntity = (PlnZyRclMEntity)uRow.ListObject; string mPlanTity = JSONFormat.Format(milPlanEntity); parmList.Add(mPlanTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion"; ccp.MethodName = "doDecisionScrapF"; ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("送判成功!")) { queryScrapData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } }else if(txtProCode.Value == "G") { this.ultraGrid7.UpdateData(); IQueryable checkMagRows = this.ultraGrid7.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要整炉废信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { PlnZyJgxMEntity milPlanEntity = (PlnZyJgxMEntity)uRow.ListObject; string mPlanTity = JSONFormat.Format(milPlanEntity); parmList.Add(mPlanTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion"; ccp.MethodName = "doDecisionScrapG"; ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("送判成功!")) { queryScrapData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } /// /// 增加白条判定记录 /// private void insertWhiteBank() { if (txtProCode.Value == "E") { this.ultraGrid2.UpdateData(); IQueryable checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要打白条的信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { PlnZyDbkMEntity milPlanEntity = (PlnZyDbkMEntity)uRow.ListObject; //if (!IsInt(milPlanEntity.ActCount.ToString())) //{ // MessageUtil.ShowTips("支数请输入整数!"); // return; //} //if (!IsNumber(milPlanEntity.ActWeight.ToString())) //{ // MessageUtil.ShowTips("重量请输入数字!"); // return; //} string mPlanTity = JSONFormat.Format(milPlanEntity); parmList.Add(mPlanTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion"; ccp.MethodName = "insertWhiteBankE"; ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("送判成功!")) { queryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } }else if(txtProCode.Value == "F") { this.ultraGrid4.UpdateData(); IQueryable checkMagRows = this.ultraGrid4.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要打白条的信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { PlnZyRclMEntity milPlanEntity = (PlnZyRclMEntity)uRow.ListObject; //if (!IsInt(milPlanEntity.ActCount.ToString())) //{ // MessageUtil.ShowTips("支数请输入整数!"); // return; //} //if (!IsNumber(milPlanEntity.ActWeight.ToString())) //{ // MessageUtil.ShowTips("重量请输入数字!"); // return; //} string mPlanTity = JSONFormat.Format(milPlanEntity); parmList.Add(mPlanTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion"; ccp.MethodName = "insertWhiteBankF"; ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("送判成功!")) { queryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } }else if(txtProCode.Value == "G") { this.ultraGrid5.UpdateData(); IQueryable checkMagRows = this.ultraGrid5.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要打白条的信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { PlnZyJgxMEntity milPlanEntity = (PlnZyJgxMEntity)uRow.ListObject; //if (!IsInt(milPlanEntity.ActCount.ToString())) //{ // MessageUtil.ShowTips("支数请输入整数!"); // return; //} //if (!IsNumber(milPlanEntity.ActWeight.ToString())) //{ // MessageUtil.ShowTips("重量请输入数字!"); // return; //} string mPlanTity = JSONFormat.Format(milPlanEntity); parmList.Add(mPlanTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion"; ccp.MethodName = "insertWhiteBankG"; ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("送判成功!")) { queryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } /// /// 检验是否为数字 /// /// 需要检验的字符串 /// 是否为数字:true代表是,false代表否 public static bool IsNumber(string str) { Regex rx = new Regex(@"^[+-]?[0123456789]*[.]?[0123456789]*$"); return rx.IsMatch(str); } /// /// 检验是否是整数 /// /// 需要检验的字符串 /// 是否为整数:true是整数,false非整数 public static bool IsInt(string str) { Regex rx = new Regex(@"^[0123456789]+$"); return rx.IsMatch(str); } /// /// 撤销整炉废 /// private void cancelScrapMata() { this.ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要撤销的信息"); return; } QcmZgJugdeApplyEntity qcmEntity = (QcmZgJugdeApplyEntity)uRow.ListObject; string qcmZcTity = JSONFormat.Format(qcmEntity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmScrapStoveApplyDescion"; ccp.MethodName = "cancelScrapMata"; ccp.ServerParams = new object[] { qcmZcTity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { queryData(); queryScrapData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 导出 /// private void ExportData() { GridHelper.ulGridToExcel(ultraGrid1, "整炉废送判(打白条信息)"); } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { this.ultraGrid1.UpdateData(); int strCountTex = 0; double strWgtTex = 0.000; if (e.Cell.Column.Key == "CHK") { IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); foreach (UltraGridRow uRow in checkMagRows) { strCountTex = strCountTex + int.Parse(uRow.Cells["ActCount"].Value.ToString3()); strWgtTex = strWgtTex + double.Parse(uRow.Cells["ActWeight"].Value.ToString3()); } //this.ultraGroupBox1.Text = "可打白条信息" + " " + "已选支:" + strCountTex.ToString() + " " + "已选产量: " + strWgtTex.ToString(); } } private void chkLotNo_CheckedChanged(object sender, EventArgs e) { txtJudgeNo.Enabled = this.chkLotNo.Checked; } private void txtProCode_ValueChanged(object sender, EventArgs e) { if(txtProCode.Value=="E") { ultraGrid2.Visible = true; ultraGrid3.Visible = true; ultraGrid4.Visible = false; ultraGrid5.Visible = false; ultraGrid6.Visible = false; ultraGrid7.Visible = false; comm.InitDropPlinePower("E", txtPline, this.ValidDataPurviewIds, this.ob); txtPline.SelectedIndex = 0; }else if(txtProCode.Value=="F") { ultraGrid4.Visible = true; ultraGrid6.Visible = true; ultraGrid2.Visible = false; ultraGrid3.Visible = false; ultraGrid5.Visible = false; ultraGrid7.Visible = false; comm.InitDropPlinePower("F", txtPline, this.ValidDataPurviewIds, this.ob); txtPline.SelectedIndex = 0; }else if(txtProCode.Value=="G") { ultraGrid5.Visible = true; ultraGrid7.Visible = true; ultraGrid2.Visible = false; ultraGrid3.Visible = false; ultraGrid4.Visible = false; ultraGrid6.Visible = false; comm.InitDropPlinePower("G", txtPline, this.ValidDataPurviewIds, this.ob); txtPline.SelectedIndex = 0; } } } }