| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.LgCommon;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.LgResMgt
- {
- public partial class frmPlanQuery : FrmBase
- {
- public frmPlanQuery()
- {
- InitializeComponent();
- }
- private DataTable dtData;
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- var vlistGradeCode = ClsBusinessPack.GetValuelistSteel(ob);
- uceGrade.ValueList = vlistGradeCode;
- ClsBusinessPack.InitDropPlinePower("A", uceEafLine, this.ob);
- dateBegintime.Value = DateTime.Now;
- dateEndtime.Value = DateTime.Now;
- if (uceEafLine.Items.Count > 0) uceEafLine.SelectedIndex = 0;
- }
- public override void ToolBar_Click(object sender, string toolbarKey)
- {
- switch (toolbarKey)
- {
- case "Query": //查询
- RefreshData();
- break;
- case "Export":
- DoExport();
- break;
- case "Print":
- DoPrint();
- break;
- case "Close": //关闭
- Close();
- break;
- }
- }
- private void DoExport()
- {
- GridHelper.ulGridToExcel(ugPlan, "炼钢生产计划");
- }
- private void DoPrint()
- {
- try
- {
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLgPlan.cpt&op=view&EF_PLINE_CODE={2}&GRADECODE={4}&JUDGE_STOVE_NO={3}&ORDER_NO={5}&PRO_MONTH1={0}&PRO_MONTH2={1}";
- strurl = string.Format(strurl,
- ((DateTime) dateBegintime.Value).ToString("yyyyMMdd"),
- ((DateTime) dateEndtime.Value).ToString("yyyyMMdd"),
- ucEafLine.Checked && uceEafLine.SelectedIndex >= 0
- ? uceEafLine.SelectedItem.DataValue.ToString()
- : "",
- ucJudgeStove.Checked ? txtStoveNo.Text : "",
- chcGrade.Checked && uceGrade.SelectedIndex >= 0 ? uceGrade.SelectedItem.DataValue.ToString() : "",
- uceOrder.Checked ? txtOrder.Text : ""
- );
- FrmRepExcel fBug = new FrmRepExcel(ob, strurl)
- {
- AutoSize = true,
- MaximumSize =
- new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height),
- Text = "炼钢生产计划打印"
- };
- fBug.ShowDialog();
- }
- catch (Exception ex)
- {
- MessageBox.Show("打印出错:" + ex.Message);
- }
- }
- private void RefreshData()
- {
- dtData = ServerHelper.GetData("Core.LgMes.Server.LgDeviceManager.PlanQuery.GetPlan",
- new object[]
- {
- ((DateTime)dateBegintime.Value).ToString("yyyyMMdd"),
- ((DateTime)dateEndtime.Value).ToString("yyyyMMdd"),
- ucEafLine.Checked && uceEafLine.SelectedIndex>=0 ? uceEafLine.SelectedItem.DataValue.ToString():"",
- ucJudgeStove.Checked ? txtStoveNo.Text :"",
- chcGrade.Checked && uceGrade.SelectedIndex>=0 ? uceGrade.SelectedItem.DataValue.ToString():"",
- uceOrder.Checked ? txtOrder.Text :""
- }, ob);
- bindingSource1.DataSource = dtData;
- ugPlan.UpdateData();
- ugPlan.Refresh();
- foreach (UltraGridColumn ugc in ugPlan.DisplayLayout.Bands[0].Columns)
- {
- ugc.SortIndicator = SortIndicator.Disabled;
- ugc.CellActivation = Activation.ActivateOnly;
- ugc.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);
- }
- //GridHelper.CopyDataToDatatable(dt, dtData, true);
- //ugPlan.DataSource = dt;
- }
- private void ugPlan_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- if (dtData.Rows[e.Row.Index]["分切"].ToString() != "1")
- {
- e.Row.Appearance.BackColor = Color.LightBlue;
- }
- }
- }
- }
|