using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;
using Infragistics.Win.UltraWinGrid;
using CoreFS.CA06;
namespace Core.LgMes.Client.LgDeviceManager
{
public partial class frmrepairehis : FrmLgDevFunctions
{
public frmrepairehis(OpeBase oba)
{
InitializeComponent();
ob = oba;
}
private DataSet _dsMain;
public string potno = "1";
private void frmrepairehis_Load(object sender, EventArgs e)
{
this.txtNoLadle.Text = potno;
this.udteStart.DateTime = DateTime.Today;
this.udteEnd.DateTime = DateTime.Today;
InitData1();
}
///
/// 维修记录查询
///
private void GetTableData()
{
string strWhere = " where TOOLTYPEID = '0'";
string strFrom = this.udteStart.DateTime.ToString("yyyyMMdd");
string strTo = this.udteEnd.DateTime.ToString("yyyyMMdd");
strWhere += " and to_char(REPAIRTIME,'yyyyMMdd') between '" + strFrom + "' and '" + strTo + "'";
if (potno != "")
{
strWhere += string.Format(" and REPAIRTOOLID = '{0}' ", potno);
}
try
{
_dsMain = QueryToFunions("Core.LgMes.Server.LgDeviceManager.potmanger", "GetRepairHis", strWhere,ob);
try
{
((DataSet)uGrdpairehis.DataSource).Tables[0].Rows.Clear();
}
catch (Exception)
{
}
if (_dsMain.Tables[0].Rows.Count > 0)
{
this.uGrdpairehis.DataSource = _dsMain;
}
}
catch { }
}
///
/// UltraGrid样式设置
///
private void InitData1()
{
try
{
UltraGridBand band = this.uGrdpairehis.DisplayLayout.Bands[0];
band.Columns["REPAIRTOOLID"].Header.Caption = "钢包号";
band.Columns["REPAIRTOOLID"].Width = 75;
band.Columns["REPAIRPART"].Header.Caption = "维修位置";
band.Columns["REPAIRPART"].Width = 85;
band.Columns["REPAIRPART"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns["REASON"].Header.Caption = "维修原因";
band.Columns["REASON"].Width = 75;
band.Columns["REASON"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns["REPAIRTYPE"].Header.Caption = "维修类别";
band.Columns["REPAIRTYPE"].Width = 75;
band.Columns["REPAIRTYPE"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns["REPAIRTIME"].Header.Caption = "维修开始时间";
band.Columns["REPAIRTIME"].Width = 150;
band.Columns["REPAIRTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns["REPAIRTIME"].Format = "yyyy-MM-dd HH:mm:ss";
band.Columns["REPAIREDTIME"].Header.Caption = "维修结束时间";
band.Columns["REPAIREDTIME"].Width = 150;
band.Columns["REPAIREDTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns["REPAIREDTIME"].Format = "yyyy-MM-dd HH:mm:ss";
band.Columns["REPTIME"].Header.Caption = "维修时间";
band.Columns["REPTIME"].Width = 80;
band.Columns["REPTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns["MATERIALREPLACING"].Header.Caption = "耐材厂家";
band.Columns["MATERIALREPLACING"].Width = 80;
band.Columns["MATERIALREPLACING"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
}
catch
{ }
}
///
/// 窗体菜单
///
///
///
private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
switch (e.ClickedItem.Name)
{
case "QUERY":
{
potno = this.txtNoLadle.Text.Trim();
GetTableData();
break;
}
case "ALL":
{
potno = "";
GetTableData();
break;
}
case "EXPORT":
{
try
{
Core.Mes.Client.Common.Globals.ulGridToExcel(uGrdpairehis, Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
break;
}
case "CLOSE":
{
this.Close();
break;
}
default:
break;
}
}
}
}