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.ZGMil.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.Windows.Forms; namespace Core.StlMes.Client.ZGMil.Signature { public partial class FrmQueryProcess : FrmBase { public FrmQueryProcess() { InitializeComponent(); } private void FrmQueryProcess_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); InitCloum(); } private void InitCloum() { this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("0", "合格"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("1", "热区剔除"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("2", "冷区剔除"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("3", "下线"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("4", "返线"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("5", "留样"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("6", "委外废"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("0", "合格"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("1", "热区剔除"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("2", "冷区剔除"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("3", "下线"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("4", "返线"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("5", "留样"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("6", "委外废"); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QueryJugeNoProcess(); break; case"updateStatus": updateStatus(); break; case"updateStatusBack": updateStatusBack(); break; case "updateLen": updateLen(); break; case "Close": this.Close(); break; } } /// /// 剔除回退 /// private void updateStatusBack() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要剔除回退的信息!"); return; } if (uRow.Cells["Status"].Value.ToString() != "2" && uRow.Cells["OpProcess"].Value.ToString() != "交库") { MessageUtil.ShowTips("请选择剔除管并且是在交库点剔除的管进行剔除回退!"); return; } PortMilBatchSampleResultEntity portMilBatchSlample = (PortMilBatchSampleResultEntity)uRow.ListObject; string portSlampleEntity = JSONFormat.Format(portMilBatchSlample); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.signature.FrmInOnlineStore"; ccp.MethodName = "updateStatusBack"; ccp.ServerParams = new object[] { portSlampleEntity}; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("回退成功!")) { QueryJugeNoProcess(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 剔除 /// private void updateStatus() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if(uRow == null) { MessageUtil.ShowTips("请选择需要剔除的信息!"); return; } if (uRow.Cells["Status"].Value.ToString() != "0") { MessageUtil.ShowTips("请选择合格管进行剔除!"); return; } PortMilBatchSampleResultEntity portMilBatchSlample = (PortMilBatchSampleResultEntity)uRow.ListObject; string portSlampleEntity = JSONFormat.Format(portMilBatchSlample); string plnId = this.ultraGrid2.ActiveRow.Cells["PlanId"].Value.ToString(); string jugeNo = this.ultraGrid2.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); string staus = this.ultraGrid2.ActiveRow.Cells["Status"].Value.ToString(); string colUser = this.UserInfo.GetUserName(); string colGrop = this.UserInfo.GetUserGroup(); string colOrder = this.UserInfo.GetUserOrder(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.signature.FrmInOnlineStore"; ccp.MethodName = "updateStatus"; ccp.ServerParams = new object[] { portSlampleEntity, colUser, colGrop, colOrder }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("剔除成功!")) { QueryJugeNoProcess(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 修改长度 /// private void updateLen() { this.ultraGrid1.UpdateData(); int m = 0; IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请勾选需要修改长度的信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { if (uRow.Cells["InstoreFlag"].Text == "已入库") { m = m + 1; } PortMilBatchSampleResultEntity portMilBatchSlample = (PortMilBatchSampleResultEntity)uRow.ListObject; string portSlampleEntity = JSONFormat.Format(portMilBatchSlample); parm.Add(portSlampleEntity); } //if (m > 0) //{ // MessageUtil.ShowTips("已入库的钢管不允许进行长度修改!"); // return; //} //portMilBatchSlample.ActCount = decimal.Parse(this.TxtActCount.Text.Trim()); //portMilBatchSlample.OrderLength = decimal.Parse(this.TxtActLen.Text.Trim()); string plnId = this.ultraGrid2.ActiveRow.Cells["PlanId"].Value.ToString(); string jugeNo = this.ultraGrid2.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); string staus = this.ultraGrid2.ActiveRow.Cells["Status"].Value.ToString(); string colUser = this.UserInfo.GetUserName(); string colGrop = this.UserInfo.GetUserGroup(); string colOrder = this.UserInfo.GetUserOrder(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.signature.FrmInOnlineStore"; ccp.MethodName = "updateLen"; ccp.ServerParams = new object[] { parm, colUser, colGrop, colOrder }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { QueryJugeNoProcess(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 查询炉信息 /// private void QueryJugeNoProcess() { string jugeNo = ""; string lotNo = ""; NativeMethodNew na = new NativeMethodNew(this.ob); string plinCode = na.GetPCode(this.UserInfo.GetDepartment()); if (this.txtJugeNo.Text.Trim() == "") { MessageUtil.ShowTips("请输入炉号查询!"); return; } else { jugeNo = this.txtJugeNo.Text.Trim(); } if (this.chkLotNo.Checked && this.txtLotNo.Text.Trim() != "") { lotNo = this.txtLotNo.Text.Trim(); } ArrayList list = new ArrayList(); list.Add(jugeNo); list.Add(lotNo); list.Add(plinCode); this.PortMilBatchSampleResultEntitybindingSource.Clear(); List listSource = EntityHelper.GetData( "com.steering.mes.signature.FrmInOnlineStore.doQueryJugeNoProcess", new object[] { list }, this.ob); PortMilBatchSampleResultEntity1bindingSource.DataSource = listSource; } /// /// 查询 /// private void QueryProcess(string planId,string jugeNo,string staus) { //NativeMethodNew na = new NativeMethodNew(this.ob); //string plinCode = na.GetPCode(this.UserInfo.GetDepartment()); //if (this.chkJugeHeatNo.Checked && this.txtJugeNo.Text.Trim() != "") //{ // jugeNo = this.txtJugeNo.Text.Trim(); //} //else //{ // MessageUtil.ShowTips("请输入炉号查询!"); // return; //} //if (this.chkLotNo.Checked && this.txtLotNo.Text.Trim() != "") //{ // lotNo = this.txtLotNo.Text.Trim(); //} ArrayList list = new ArrayList(); list.Add(planId); list.Add(jugeNo); list.Add(staus); this.PortMilBatchSampleResultEntitybindingSource.Clear(); List listSource = EntityHelper.GetData( "com.steering.mes.signature.FrmInOnlineStore.doQueryProcess", new object[] { list }, this.ob); PortMilBatchSampleResultEntitybindingSource.DataSource = listSource; } private void chkJugeHeatNo_CheckedChanged(object sender, EventArgs e) { this.txtJugeNo.Enabled = this.chkJugeHeatNo.Checked; } private void chkLotNo_CheckedChanged(object sender, EventArgs e) { this.txtLotNo.Enabled = this.chkLotNo.Checked; } private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { QueryProcess(this.ultraGrid2.ActiveRow.Cells["PlanId"].Value.ToString(), this.ultraGrid2.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(), this.ultraGrid2.ActiveRow.Cells["Status"].Value.ToString()); } private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHK"].Value = true; } } } public static void setGridCopyActColumn(UltraGrid ugrid, KeyEventArgs e, params string[] strs) { if (e.Control && e.KeyCode == Keys.A) { if (ugrid != null && ugrid.ActiveRow != null) { UltraGridRow ugr = ugrid.ActiveRow; foreach (string colName in strs) { if (ugrid.ActiveCell.Column.Key == null) { return; } if (ugrid.ActiveCell.Column.Key.Equals(colName)) { if (ugr.Cells[colName].Activation != Activation.AllowEdit) { return; } ugrid.UpdateData(); ArrayList list = new ArrayList(); IQueryable checkRows = ugrid.Rows.AsQueryable().Where("CHK = 'True' "); if (checkRows.Count() == 0) { return; } foreach (UltraGridRow uRow in checkRows) { if (uRow != ugr && uRow.Cells[colName].Activation == Activation.AllowEdit) { uRow.Cells[colName].Value = ugr.Cells[colName].Value; } } } } } } } private void ultraGrid1_KeyUp(object sender, KeyEventArgs e) { setGridCopyActColumn(ultraGrid1, e, "OrderLength"); } } }