using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Treatment.Entity; using CoreFS.CA06; using Infragistics.Win; 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.Windows.Forms; namespace Core.StlMes.Client.Mcp.Treatment.HeatTreatment { public partial class HttReport : FrmBase { public HttReport() { InitializeComponent(); } private string[] plineCode = null; private void HttReport_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); plineCode = Core.StlMes.Client.Mcp.Treatment.HeatTreatment.comm.GetPlineCode(ValidDataPurviewIds, this.CustomInfo, ob); comm.InitDropPlinePower(CustomInfo, txtPline, this.ValidDataPurviewIds, this.ob); if (CustomInfo.ToString2() == "G") { ultraGrid1.DisplayLayout.Bands[0].Columns["ReportType"].EditorComponent = reportTypeG; } QuerySinglePlan(); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": QuerySinglePlan(); break; //case "DoQueryInList": // doQueryInList(); // break; case "DoSave": doSave(); break; case "DoUpdate": doUpdate(); break; case "DoDelete": cancelReport(); break; //case "CancelPipe": // cancelPipe(); // break; case "Close": this.Close(); break; } } private void QuerySinglePlan() { List listSource = EntityHelper.GetData( "com.steering.mes.mcp.heatTreatment.HttReport.doQuery", new object[] { plineCode }, this.ob); HttReportEntitybindingSource1.DataSource = listSource; foreach (UltraGridRow ugr in ultraGrid1.Rows) { ugr.Cells["PlineCode"].Appearance.BackColor = Color.Transparent; ugr.Cells["PlineCode"].Appearance.BackHatchStyle = BackHatchStyle.Default; ugr.Cells["PlineCode"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; //ugr.Cells["ColGroup"].Appearance.BackColor = Color.Transparent; //ugr.Cells["ColGroup"].Appearance.BackHatchStyle = BackHatchStyle.Default; //ugr.Cells["ColGroup"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; } } private void doSave() { this.ultraGrid1.UpdateData(); ArrayList List = new ArrayList(); IQueryable checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if(checkRows.Count() == 0) { MessageUtil.ShowTips("请勾选需要新增的信息"); return; } foreach (UltraGridRow row in checkRows) { HttReportEntity hrEntity = (HttReportEntity)row.ListObject; if(hrEntity.PlineCode.Equals("")) { MessageUtil.ShowTips("产线名称不能为空"); return; } if(hrEntity.ReportNo.Equals("")) { MessageUtil.ShowTips("报表编号不能为空"); return; } if (hrEntity.ReportNoNew.Equals("")) { MessageUtil.ShowTips("新报表编号不能为空"); return; } if(hrEntity.ReportNoTime.Equals("")) { MessageUtil.ShowTips("新报表编号生效时间不能为空"); return; } if (hrEntity.ReportName.Equals("")) { MessageUtil.ShowTips("报表名称不能为空"); return; } if (hrEntity.ReportType.Equals("")) { MessageUtil.ShowTips("报表类型不能为空"); return; } hrEntity.ColUser = this.UserInfo.GetUserID(); string vrpEntity = JSONFormat.Format(hrEntity); List.Add(vrpEntity); DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttReport.getSameData", new object[] { hrEntity.PlineCode, hrEntity.ReportName,hrEntity.ReportType,hrEntity.MachineNo }, ob); if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttReport"; ccp.MethodName = "doSave"; ccp.ServerParams = new object[] { List }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("新增成功!")) { QuerySinglePlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void doUpdate() { this.ultraGrid1.UpdateData(); ArrayList List = new ArrayList(); IQueryable checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkRows.Count() == 0) { MessageUtil.ShowTips("请勾选需要修改的信息"); return; } foreach (UltraGridRow row in checkRows) { HttReportEntity hrEntity = (HttReportEntity)row.ListObject; if (hrEntity.PlineCode.Equals("")) { MessageUtil.ShowTips("产线名称不能为空"); return; } if (hrEntity.ReportNo.Equals("")) { MessageUtil.ShowTips("报表编号不能为空"); return; } if (hrEntity.ReportNoNew.Equals("")) { MessageUtil.ShowTips("新报表编号不能为空"); return; } if (hrEntity.ReportNoTime.Equals("")) { MessageUtil.ShowTips("新报表编号生效时间不能为空"); return; } if (hrEntity.ReportName.Equals("")) { MessageUtil.ShowTips("报表名称不能为空"); return; } if (hrEntity.ReportType.Equals("")) { MessageUtil.ShowTips("报表类型不能为空"); return; } //else if (hrEntity.ReportType.Equals("管体机探")) //{ // hrEntity.ReportType = "0"; //} //else //{ // hrEntity.ReportType = "1"; //} hrEntity.ColUser = this.UserInfo.GetUserID(); string vrpEntity = JSONFormat.Format(hrEntity); List.Add(vrpEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttReport"; ccp.MethodName = "doUpdate"; ccp.ServerParams = new object[] { List }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { QuerySinglePlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void cancelReport() { this.ultraGrid1.UpdateData(); ArrayList List = new ArrayList(); IQueryable checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkRows.Count() == 0) { MessageUtil.ShowTips("请勾选需要修改的信息"); return; } foreach (UltraGridRow row in checkRows) { HttReportEntity hrEntity = (HttReportEntity)row.ListObject; if (hrEntity.PlineCode.Equals("")) { MessageUtil.ShowTips("产线名称不能为空"); return; } if (hrEntity.ReportName.Equals("")) { MessageUtil.ShowTips("报表名称不能为空"); return; } if (hrEntity.ReportType.Equals("")) { MessageUtil.ShowTips("报表类型不能为空"); return; } else if (hrEntity.ReportType.Equals("管体机探")) { hrEntity.ReportType = "0"; } else { hrEntity.ReportType = "1"; } string vrpEntity = JSONFormat.Format(hrEntity); List.Add(vrpEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttReport"; ccp.MethodName = "doCancel"; ccp.ServerParams = new object[] { List }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("删除成功!")) { QuerySinglePlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } }