using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control; 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.Mch.MchResult { public partial class FrmSetPlineOffice : FrmBase { public static ArrayList list = null; //产线离线去向 private string plinegx = ""; private string plineCode = ""; public string plinegxlist = ""; //public string offlineplace = ""; public string save = "0"; private string Nation = ""; public FrmSetPlineOffice() { InitializeComponent(); } public FrmSetPlineOffice(String pline_Code,String nation, OpeBase ob) { InitializeComponent(); this.ob = ob; plineCode = pline_Code; //offlineplace = offlinep; Nation = nation; } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "Save": Save(); break; case "Close": Clo(); break; } } private void Clo() { UltraGridRow urg = ultraGrid1.ActiveRow; if (urg != null) { if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true && urg.Cells["BASENAME"].Text != "") { if (save == "0") { MessageUtil.ShowTips("请点保存按钮!"); return; } } } this.Close(); } /// /// 新增 /// private void Save() { string gxn = ""; int addCount = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow urg in ultraGrid1.Rows) { if(urg.Cells["CHK"].Text=="") { continue; }else if(Convert.ToBoolean(urg.Cells["CHK"].Text) == true) { addCount += 1; if(gxn=="") { gxn = urg.Cells["BASENAME"].Text.ToString(); } else { gxn = gxn + ";" + urg.Cells["BASENAME"].Text.ToString(); } list1.Add(urg.Cells["BASENAME"].Text.ToString()); } } if(addCount==0) { MessageUtil.ShowTips("请选择要排序的工序点!"); return; } list = list1; if (list.Count != 0) { MessageUtil.ShowTips("添加成功,请点新增按钮!"); save = "1"; this.DialogResult = System.Windows.Forms.DialogResult.OK; } //CoreClientParam ccp = new CoreClientParam(); //try //{ // this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 // if (Constant.WaitingForm == null) // { // Constant.WaitingForm = new WaitingForm(); // } // Constant.WaitingForm.ShowToUser = true; // Constant.WaitingForm.Show(); // Constant.WaitingForm.Update(); // ccp.ServerName = "com.steering.mes.mcp.Mch.FrmSetPline"; // ccp.MethodName = "addPlineOffice"; // ccp.ServerParams = new Object[] { list, plineCode,Nation }; // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); // this.Cursor = Cursors.Default; // Constant.WaitingForm.ShowToUser = false; // Constant.WaitingForm.Close(); // Constant.WaitingForm = null; //} //catch (Exception ex) //{ // this.Cursor = Cursors.Default; // Constant.WaitingForm.ShowToUser = false; // Constant.WaitingForm.Close(); // Constant.WaitingForm = null; //} //if (ccp.ReturnCode != -1) //{ // MessageUtil.ShowTips(ccp.ReturnInfo); // if (ccp.ReturnInfo.Equals("新增成功!")) // { // save = "1"; // plinegxlist = gxn.ToString(); // //scrapNum = scarpTotalNum.ToString(); // this.DialogResult = System.Windows.Forms.DialogResult.OK; // } // else // { // MessageUtil.ShowTips(ccp.ReturnInfo); // } //} } public MchOfflineResultDentity getRowData(UltraGridRow checkrow) { MchOfflineResultDentity resultD = new MchOfflineResultDentity(); resultD.GowhereName = checkrow.Cells["GOWHERE_NAME"].Value.ToString().Trim(); resultD.OfflineNum = checkrow.Cells["OFFLINE_NUM"].Value.ToString().Trim(); return resultD; } //private void FrmSetPlineGx_Load(object sender, EventArgs e) //{ // DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpDownLineManage.doQuery", new object[] { "7013" }, ob); // kreason.DataSource = dt; // kreason.DisplayMember = "BASENAME"; // kreason.ValueMember = "BASECODE"; //} private void FrmSetPlineGx_FormClosing(object sender, FormClosingEventArgs e) { UltraGridRow urg = ultraGrid1.ActiveRow; if (urg != null) { if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true && urg.Cells["BASENAME"].Text != "") { if (save == "0") { MessageUtil.ShowTips("请点保存按钮!"); e.Cancel = true; } } } } /// /// /// ulltragrid控件受勾影响(打钩可编辑,不打勾不能编辑)** /// /// private void GridEdite(UltraGridRow row) { if (row.GetValue("CHK") == "True") { foreach (UltraGridCell cell in row.Cells) { if (cell.Column.CellActivation == Activation.AllowEdit) { cell.Activation = Activation.AllowEdit; } } } else { foreach (UltraGridCell cell in row.Cells) { if (cell.Column.Key.Contains("CHK")) continue; if (cell.Column.CellActivation == Activation.AllowEdit) { cell.Activation = Activation.ActivateOnly; } } } ultraGrid1.UpdateData(); } private void ultraGridDetailDes1_AfterRowInsert(object sender, RowEventArgs e) { this.ultraGrid1.UpdateData(); GridEdite(e.Row); } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { this.ultraGrid1.UpdateData(); GridEdite(e.Cell.Row); } } }