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 Core.StlMes.Client.ZGMil.ResultConrtrol; using Core.StlMes.Client.ZGMil.Signature; 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.Result { public partial class FrmMeasureResultZG : FrmBase { private string departm = ""; private string plineCode = ""; private string userName = ""; private string proPlanId = null;//轧管订单编号 private string gxPlanNo = null;//工序排产序号 private string[] arrId;//数据权限 string HeatPlanNo = ""; string JudgeStoveNo = ""; string PlineCode = ""; public FrmMeasureResultZG() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmMeasureResultZG_Load(object sender, EventArgs e) { cmbDate.Value = DateTime.Parse(DateTime.Today.ToString()); NativeMethodNew na = new NativeMethodNew(this.ob); userName = UserInfo.GetUserName(); departm = UserInfo.GetDepartment(); arrId = this.ValidDataPurviewIds;//获取数据权限 EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid3.DisplayLayout.Bands[0]); DateTime now = DateTime.Now; DateTime date = new DateTime(now.Year, now.Month, 1); cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd")); cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "DoAdd": DoAdd(); break; case "DoDelete": DoDelete(); break; case "SetGroup": SetGroup(); break; case "SetMesureData": SetMesureData(); break; //case "insertProssWt": // insertProssWt(); // break; //case "Print": // PrintData(); // break; case "Close": this.Close(); break; } } /// /// 查询 /// private void doQuery() { string date = ""; string endDate = ""; string JudgeStoveNo = ""; if (chkDate.Checked) { if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0) { MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!"); return; } else { date = cmbDate.Value.ToString(); endDate = cmbEndDate.Value.ToString(); } } if (chkJudgeStoveNo.Checked) { if (uteJudgeStoveNo.Text.Trim() == "") { JudgeStoveNo = ""; } else { JudgeStoveNo = uteJudgeStoveNo.Value.ToString(); } } List listSource = EntityHelper.GetData( "com.steering.mes.zgmil.coup.FrmMeasureResultZG.doQuery", new object[] { date, endDate, JudgeStoveNo ,arrId}, this.ob); bindingSource1.DataSource = listSource; GridHelper.RefreshAndAutoSize(this.ultraGrid1); } /// /// 打印 /// private void PrintData() { string HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["HeatPlanNo"].Value.ToString(); string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMchMeasurePrint.cpt&op=view" + "&HEAT_PLAN_NO=" + HeatPlanNo; FrmRepExcel fre = new FrmRepExcel(this.ob, strurl); fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.WindowState = FormWindowState.Maximized; fre.Show(); } /// /// 查询条件 /// /// /// private void chkDate_CheckedChanged(object sender, EventArgs e) { if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; } if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; } if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { this.measureControl2.Value.BatchNo = ""; this.measureControl2.Value.ProUser = this.UserInfo.GetUserName(); this.measureControl2.Value.ProShift = this.UserInfo.GetUserOrderText(); this.measureControl2.Value.ProGroup = this.UserInfo.GetUserGroupText(); this.measureControl2.Value.ProTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.measureControl2.Value.ProEndTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.measureControl2.UpdateDate(); string HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); string JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); string PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); doQueryMilMeasureResult(); doQueryPortMilBatchSampleResult(); } /// /// 查询测量实绩 /// private void doQueryMilMeasureResult() { HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); List listSource2 = EntityHelper.GetData( "com.steering.mes.zgmil.coup.FrmMeasureResultZG.doQueryMilMeasureResult", new object[] { HeatPlanNo, JudgeStoveNo, PlineCode }, this.ob); MilMeasureResultEntitybindingSource2.DataSource = listSource2; GridHelper.RefreshAndAutoSize(this.ultraGrid2); } /// /// 查询进程表 /// private void doQueryPortMilBatchSampleResult() { HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); List listSource = EntityHelper.GetData( "com.steering.mes.zgmil.coup.FrmMeasureResultZG.doQueryPortMilBatchSampleResult", new object[] { HeatPlanNo, JudgeStoveNo, PlineCode }, this.ob); PortMilBatchSampleResultEntity2bindingSource3.DataSource = listSource; GridHelper.RefreshAndAutoSize(this.ultraGrid3); } /// /// 新增 /// protected virtual void DoAdd() { this.ultraGrid1.UpdateData(); measureControl2.UltraGrid3.UpdateData(); MilMeasureResultEntity milMeasureResult = new MilMeasureResultEntity(); milMeasureResult.HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); milMeasureResult.JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); milMeasureResult.PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); milMeasureResult.BatchNo = this.measureControl2.FurResultDateSource1.Rows[0]["BatchNo"].ToString(); milMeasureResult.ProNum = int.Parse(this.measureControl2.FurResultDateSource1.Rows[0]["ProNum"].ToString3()); milMeasureResult.ProUser = this.UserInfo.GetUserName(); milMeasureResult.ProShift = this.UserInfo.GetUserOrder(); milMeasureResult.ProGroup = this.UserInfo.GetUserGroup(); milMeasureResult.ProTime = this.measureControl2.FurResultDateSource1.Rows[0]["ProTime"].ToString(); milMeasureResult.ProEndTime = this.measureControl2.FurResultDateSource1.Rows[0]["ProEndTime"].ToString(); string milMeasureResultStr = JSONFormat.Format(milMeasureResult); if (milMeasureResult.ProNum == 0) { MessageUtil.ShowWarning("请输入正确的支数!"); return; } HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG"; ccp.MethodName = "DoAdd"; ccp.ServerParams = new object[] { milMeasureResultStr,HeatPlanNo, JudgeStoveNo, PlineCode }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("新增成功!")) { this.ultraGrid1.UpdateData(); doQueryMilMeasureResult(); doQueryPortMilBatchSampleResult(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 删除 /// protected virtual void DoDelete() { this.ultraGrid2.UpdateData(); string resultNo = this.ultraGrid2.ActiveRow.Cells["ResultNo"].Value.ToString(); HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG"; ccp.MethodName = "DoDelete"; ccp.ServerParams = new object[] { resultNo, HeatPlanNo, JudgeStoveNo, PlineCode }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("删除成功!")) { this.ultraGrid1.UpdateData(); doQueryMilMeasureResult(); doQueryPortMilBatchSampleResult(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 组号长度范围规则 /// private void SetGroup() { //if (ActiveRow == null) //{ // MessageUtil.ShowTips("请选择需要炉计划!"); // return; //} //FrmGroupSetting fgs = new FrmGroupSetting(ActiveRow.OrderNoSeq, ActiveRow.HeatPlanNo, ob); //fgs.ShowDialog(); } /// /// 维护测量点数据 /// private void SetMesureData() { PlnZyJgxCEntity JgxPlan = new PlnZyJgxCEntity(); JgxPlan.HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JgxPlan.JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); JgxPlan.BatchNo = this.ultraGrid1.ActiveRow.Cells["BatchNo"].Value.ToString(); JgxPlan.PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); MesureData MesureData = new MesureData(JgxPlan, ob, this.UserInfo.GetUserName(), true); MesureData.ShowDialog(); } /// /// 保存喷印管号 /// /// /// private void ultraButton1_Click(object sender, EventArgs e) { ArrayList parm = new ArrayList(); HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); parm.Add(HeatPlanNo); parm.Add(JudgeStoveNo); parm.Add(PlineCode); parm.Add(this.ultraMeasuringSeqStart.Text.ToString()); parm.Add(this.ultraMeasuringSeqLen.Text.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG"; ccp.MethodName = "doSaveMeasuringSeq"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("保存喷印管号成功!")) { //doQueryOffLine(); doQueryPortMilBatchSampleResult(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 发送喷印信息 /// /// /// private void ultraButton2_Click(object sender, EventArgs e) { ArrayList parm = new ArrayList(); HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); parm.Add(HeatPlanNo); parm.Add(JudgeStoveNo); parm.Add(PlineCode); parm.Add(this.ultraMatInfoStart.Text.ToString()); parm.Add(this.ultraMatInfoEnd.Text.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG"; ccp.MethodName = "doSaveMatInfo"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("发送喷印信息成功!")) { doQueryPortMilBatchSampleResult(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 回填过磅重量 /// //private void insertProssWt() //{ // this.ultraGrid2.UpdateData(); // UltraGridRow uRow = this.ultraGrid2.ActiveRow; // if (uRow == null) // { // MessageUtil.ShowTips("请选择需要回报过磅重量的炉信息!"); // return; // } // if (Double.Parse(uRow.Cells["ProWt"].Value.ToString3()) <= 0) // { // MessageUtil.ShowTips("请输入正确的重量!"); // return; // } // MilMeasureResultEntity milMeasureResult = (MilMeasureResultEntity)this.ultraGrid2.ActiveRow.ListObject; // string milMeasureStr = JSONFormat.Format(milMeasureResult); // CoreClientParam ccp = new CoreClientParam(); // ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG"; // ccp.MethodName = "insertProssWt"; // ccp.ServerParams = new object[] { milMeasureStr }; // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); // if (ccp.ReturnCode != -1) // { // if (ccp.ReturnInfo.Equals("回报成功!")) // { // doQueryMilMeasureResult(); // doQueryPortMilBatchSampleResult(); // MessageUtil.ShowTips(ccp.ReturnInfo); // } // else // { // MessageUtil.ShowTips(ccp.ReturnInfo); // } // } //} private void uteMeasureData_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { PlnZyJgxCEntity JgxPlan = new PlnZyJgxCEntity(); JgxPlan.HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); JgxPlan.JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(); JgxPlan.BatchNo = this.ultraGrid1.ActiveRow.Cells["BatchNo"].Value.ToString(); JgxPlan.PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString(); MesureData MesureData = new MesureData(JgxPlan, ob, this.UserInfo.GetUserName(), false); MesureData.ShowDialog(); } } }