using com.steering.mes.zgmil.entity; 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.Common; using Core.StlMes.Client.ZGMil.Entity; using Core.StlMes.Client.ZGMil.NodeResultQuery; 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.Report { public partial class FrmRepInspection : FrmBase { private string departm = ""; private string plineCode = ""; private string[] plineCodes = { }; public FrmRepInspection() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmRepInspection_Load(object sender, EventArgs e) { cmbDate.Value = DateTime.Parse(DateTime.Today.ToString()); NativeMethodNew na = new NativeMethodNew(this.ob); departm = UserInfo.GetDepartment(); plineCode = na.GetPCode(departm);//获取 用户 对应的产线 plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob); cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 20:59:59")); cmbDate.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 21:00:00")); TubeRoll.SetComboItemHeight(cmbBc); TubeRoll.SetComboItemHeight(cmbBz); if (plineCode == "C010") { ultraTabControl1.Tabs[0].Visible = false; ultraTabControl1.Tabs[1].Visible = true; } else if (plineCode == "C008" || plineCode == "C009" || plineCode == "C017") { ultraTabControl1.Tabs[0].Visible = true; ultraTabControl1.Tabs[1].Visible = false; } else { ultraTabControl1.Tabs[0].Visible = true; ultraTabControl1.Tabs[1].Visible = true; } } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "Save": doSave(); break; case "Export": doExport(); break; case "DoExport": doExport2(); break; case "Print": doPrint(); break; case "Close": this.Close(); break; } } /// /// 导出 /// private void doExport2() { if (plineCode == "C010") { GridHelper.ulGridToExcel(ultraGrid2, "探伤台账"); } else { GridHelper.ulGridToExcel(ultraGrid1, "探伤台账"); } } private void chkDate_CheckedChanged(object sender, EventArgs e) { if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; } if (chkBc.Checked) { cmbBc.Enabled = true; } else { cmbBc.Enabled = false; } if (chkBz.Checked) { cmbBz.Enabled = true; } else { cmbBz.Enabled = false; } if (chkJudge.Checked) { textJudge.Enabled = true; } else { textJudge.Enabled = false; } } /// /// 查询 /// private void doQuery() { ArrayList list = new ArrayList(); string date = ""; string endDate = ""; string bc = ""; string bz = ""; string judge_stove_no = ""; 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 (chkBz.Checked) { if (cmbBz.Text.Trim() == "") { //MessageUtil.ShowTips("班组不能为空!"); //return; bz = ""; } else { bz = cmbBz.Value.ToString(); } } if (chkBc.Checked) { if (cmbBc.Text.Trim() == "") { bc = ""; } else { bc = cmbBc.Value.ToString(); } } if (chkJudge.Checked) { if (textJudge.Text.Trim() == "") { judge_stove_no = ""; } else { judge_stove_no = textJudge.Value.ToString(); } } WaitingForm2 wf = new WaitingForm2("正在加载,请稍候...."); DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmRepInspection.queryMinResult", new Object[] { date, endDate, bc, bz, plineCode, plineCodes, judge_stove_no }, this.ob); if (plineCode == "C010") { GridHelper.CopyDataToDatatable(dt, this.dataTable2, true); GridHelper.RefreshAndAutoSize(this.ultraGrid2); } else { GridHelper.CopyDataToDatatable(dt, this.dataTable1, true); GridHelper.RefreshAndAutoSize(this.ultraGrid1); } wf.Close(); } /// /// 修改 /// private void doSave() { UltraGrid ultraGrid = new UltraGrid(); if (this.ultraTabControl1.Tabs[0].Active) { ultraGrid = ultraGrid1; } if (this.ultraTabControl1.Tabs[1].Active) { ultraGrid = ultraGrid2; } ultraGrid.UpdateData(); IQueryable checkMagRows = ultraGrid.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要修改的信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { FeedSawResultEntity matZcTity = new FeedSawResultEntity(); matZcTity.JudgeStoveNo = uRow.Cells["JUDGE_STOVE_NO"].Text.ToString(); matZcTity.PlineCode = uRow.Cells["PLINE_CODE"].Text.ToString(); if (uRow.Cells["COL_SHIFT1"].Value.ToString().Equals("早班")) { matZcTity.ColShift = "1"; } else if (uRow.Cells["COL_SHIFT1"].Value.ToString().Equals("中班")) { matZcTity.ColShift = "2"; } else if (uRow.Cells["COL_SHIFT1"].Value.ToString().Equals("夜班")) { matZcTity.ColShift = "3"; } else if (uRow.Cells["COL_SHIFT1"].Value.ToString().Equals("常白班")) { matZcTity.ColShift = "0"; } else { matZcTity.ColShift = uRow.Cells["COL_SHIFT1"].Value.ToString(); } if (uRow.Cells["COL_GROUP1"].Value.ToString().Equals("甲")) { matZcTity.ColGroup = "1"; } else if (uRow.Cells["COL_GROUP1"].Value.ToString().Equals("乙")) { matZcTity.ColGroup = "2"; } else if (uRow.Cells["COL_GROUP1"].Value.ToString().Equals("丙")) { matZcTity.ColGroup = "3"; } else if (uRow.Cells["COL_GROUP1"].Value.ToString().Equals("丁")) { matZcTity.ColGroup = "4"; } else { matZcTity.ColGroup = uRow.Cells["COL_GROUP1"].Value.ToString(); } matZcTity.StartTime = uRow.Cells["END_INSPECTION_TIME"].Text.ToString(); matZcTity.Remark = "探伤"; string matTity = JSONFormat.Format(matZcTity); parm.Add(matTity); } if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.report.FrmFeedSaw"; ccp.MethodName = "doSave"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { doQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 打印 /// private void doExport() { string date = ""; string endDate = ""; string bc = ""; string bz = ""; string judgeStoveNo = ""; //if (!chkDate.Checked) //{ // MessageUtil.ShowTips("请选择生产日期!"); // return; //} if (!chkBz.Checked) { MessageUtil.ShowTips("请选择班组!"); return; } if (!chkBc.Checked) { MessageUtil.ShowTips("请选择班次!"); return; } 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 (chkBz.Checked) { if (cmbBz.Text.Trim() == "") { //MessageUtil.ShowTips("班组不能为空!"); //return; bz = ""; } else { bz = cmbBz.Value.ToString(); } } if (chkBc.Checked) { if (cmbBc.Text.Trim() == "") { //MessageUtil.ShowTips("班次不能为空!"); //return; bc = ""; } else { bc = cmbBc.Value.ToString(); } } if (chkJudge.Checked ) { if (textJudge.Text.Trim() == "") { judgeStoveNo = ""; } else { judgeStoveNo = textJudge.ToString(); } } doQuery(); ColUserName colU = new ColUserName(); colU.Ob = this.ob; colU.PlineCode = plineCode; colU.ColGroup = bz; colU.ColOrder = bc; colU.JudgeStoveNo = textJudge.ToString(); colU.StationId = "8"; if (plineCode.Equals("C017"))//460 { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMTResult460.cpt&format=pdf&__bypagesize__=false"; } else if (plineCode.Equals("C010"))//168 { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMTResult168.cpt&format=pdf&__bypagesize__=false"; } else if (plineCode.Equals("C009"))//258 { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMTResult258.cpt&format=pdf&__bypagesize__=false"; } else if (plineCode.Equals("C008"))//250 { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMTResult250.cpt&format=pdf&__bypagesize__=false"; } else if (plineCode.Equals("C072"))//508 { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMTResult508.cpt&__bypagesize__=false"; } else { colU.Url = ""; } colU.StartTim = date; colU.EndTim = endDate; colU.StrText = "探伤"; colU.Flag = "0"; colU.ShowDialog(); } /// /// 打印探伤报告 /// private void doPrint() { string bc = ""; string bz = ""; string judge = ""; string PlineCode = ""; string url = ""; if (plineCode == "C010") { if (this.ultraGrid2.ActiveRow == null) { MessageBox.Show("您未选择任何炉号,不允许进行报表打印", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UltraGridRow ugr = ultraGrid2.ActiveRow; bc = ugr.Cells["COL_SHIFT"].Value.ToString(); bz = ugr.Cells["COL_GROUP"].Value.ToString(); judge = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() + "-01"; PlineCode = ugr.Cells["PLINE_CODE"].Value.ToString(); url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilInspectionTestReport168.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + bz + "&COL_SHIFT=" + bc; FrmExcel fre = new FrmExcel(this.ob, url); fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.WindowState = FormWindowState.Maximized; fre.Show(); }else { if (this.ultraGrid1.ActiveRow == null) { MessageBox.Show("您未选择任何炉号,不允许进行报表打印", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UltraGridRow ugr = ultraGrid1.ActiveRow; bc = ugr.Cells["COL_SHIFT"].Value.ToString(); bz = ugr.Cells["COL_GROUP"].Value.ToString(); judge = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() + "-01" ; PlineCode = ugr.Cells["PLINE_CODE"].Value.ToString(); switch (PlineCode) { case "C008": //250 url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilInspectionTestReport250.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + bz + "&COL_SHIFT=" + bc; break; case "C009": //258 url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilInspectionTestReport258.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + bz + "&COL_SHIFT=" + bc; break; //case "C010": //168 // url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilInspectionTestReport168.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + bz + "&COL_SHIFT=" + bc; // break; case "C012": //Arssel break; case "C017": //460 url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilInspectionTestReport460.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + bz + "&COL_SHIFT=" + bc; break; case "C072": //508 url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilInspectionTestReport508.cpt&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + bz + "&COL_SHIFT=" + bc; break; } FrmExcel fre = new FrmExcel(this.ob, url); fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.WindowState = FormWindowState.Maximized; fre.Show(); } } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (this.ultraTabControl1.Tabs[1].Active) { plineCode = "C010"; } if (this.ultraTabControl1.Tabs[0].Active) { plineCode = ""; } } } }