using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Core.Mes.Client.Comm.Control; using com.steering.mes.mcp.entity; using Infragistics.Win.UltraWinGrid; using CoreFS.CA06; namespace Core.StlMes.Client.Mcp.Control { /// /// 计划编辑控件 /// public partial class PlanExpanControl : UserControl { private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null; public OpeBase ob; public OpeBase Ob { get { return ob; } set { ob = value; } } private PlnZyDbkMEntity _plan = new PlnZyDbkMEntity(); /// /// 计划实体对象 /// public PlnZyDbkMEntity Value { get { return _plan; } set { if (value != null) { _plan = value; UpdateData(); } } } /// /// Grid编辑区 /// public Infragistics.Win.UltraWinGrid.UltraGrid Grid { get { return _grid; } } //private bool enabled = true; ///// ///// 设置或获取一个值,该值指示控件是否可编辑 ///// //public new bool Enabled //{ // get { return enabled; } // set // { // enabled = value; // GridHelper.SetGridActivation(this.ultraGrid1, value ? Infragistics.Win.UltraWinGrid.Activation.AllowEdit : Infragistics.Win.UltraWinGrid.Activation.ActivateOnly); // } //} public PlanExpanControl() { InitializeComponent(); GridHelper.InitCardGrid(this.ultraDataSource1, this.ultraGrid1); //GridHelper.SetGridActivationExceptCol(this.ultraGrid1, Infragistics.Win.UltraWinGrid.Activation.NoEdit,null); _grid = this.ultraGrid1; } /// /// 刷新控件数据显示 /// public void UpdateData() { if (_plan != null) { ultraDataSource1.Rows[0]["PLineCode"] = _plan.PlineCode; ultraDataSource1.Rows[0]["PLineName"] = _plan.PlineName; //ultraDataSource1.Rows[0]["ProductDate"] = _plan.ProduceTime; //ultraDataSource1.Rows[0]["UsedTime"] = _plan.UseTime; ultraDataSource1.Rows[0]["RollBatchId"] = _plan.ZyBatchId; ultraDataSource1.Rows[0]["IsProduce"] = Convert.ToString(_plan.IfMonitorDbk == null ? "" : _plan.IfMonitorDbk == "1" ? "是" : "否"); ultraDataSource1.Rows[0]["CRAFT_SEQ"] = _plan.CraftSeq; ultraDataSource1.Rows[0]["OrderPieces"] = _plan.InNum; ultraDataSource1.Rows[0]["OrderWeight"] = _plan.InWt; ultraDataSource1.Rows[0]["OrderNo"] = _plan.ProPlanId; //ultraDataSource1.Rows[0]["Remark"] = _plan.Remark; ultraDataSource1.Rows[0]["HeatNo"] = _plan.JudgeStoveNo; ultraDataSource1.Rows[0]["BatchNo"] = _plan.ZgBatchNo; } else { GridHelper.InitCardGrid(ultraDataSource1, ultraGrid1); } } /// /// 控件编辑后更新已修改数据 /// public new void Update() { ultraGrid1.UpdateData(); } /// /// 设置全部只读 /// public void SetAllColumnsActiveOnly() { GridHelper.SetAllColumnsActive(ultraGrid1); } private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { UltraGridRow row = ultraGrid1.ActiveRow; string craftPath = YdmBaseClass.getQueryCraftNo(_plan.CraftSeq,null, ob); if (e.Button.Key.ToLower().Equals("select")) { FormFileDown down = new FormFileDown(ob, craftPath); down.CtrlFileDown1.Button3.Visible = false; down.ShowDialog(); } } } }