using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using CoreFS.CA06;
using Core.Mes.Client.Common;
namespace Core.LgMes.Client.LgDeviceManager
{
public partial class FrmCLRepairDetail : Core.Mes.Client.Common.frmStyleBase
{
public FrmCLRepairDetail(OpeBase oba)
{
InitializeComponent();
ob = oba;
}
private void FrmCLRepairDetail_Load(object sender, EventArgs e)
{
udteQStartTime.DateTime = DateTime.Now;
udteQEndTime.DateTime = DateTime.Now;
GetDeviceID();
proc_Query();
}
///
/// 维修记录查询
///
private void proc_Query()
{
try
{
string strErr = "";
string str = "where t1.TOOLTYPEID = '2' and t1.REPAIRTOOLID = t2.ID(+) ";
string str1 = "";
if (chkCCM.Checked && ucmbCCM.Text.Trim().Length > 0)
{
str1 = "CCM_ID = '" + ucmbCCM.Text.Trim() + "'";
}
if (chkQLadleName.Checked && ucmbID.Text.Trim().Length > 0)
{
if (str1.Length == 0)
str1 = "CRYSTALLIZERID = '" + ucmbID.Text.Trim() + "'";
else
str1 += " and CRYSTALLIZERID = '" + ucmbID.Text.Trim() + "'";
}
if (str1.Length > 0)
{
str += "and t1.REPAIRTOOLID in (select ID from DEV_JJQ_BASE_INFO where " + str1 + ") ";
}
if (chkQStartTime.Checked)
str += "and to_char(t1.REPAIRTIME,'yyyy-MM-dd') >= '" + udteQStartTime.DateTime.ToString("yyyy-MM-dd") + "'";
if (chkQEndTime.Checked)
str += "and to_char(t1.REPAIREDTIME,'yyyy-MM-dd') <= '" + udteQEndTime.DateTime.ToString("yyyy-MM-dd") + "'";
string strSql = "select t2.CRYSTALLIZERID 结晶器编号, t2.CCM_ID 铸机号, t1.REPAIRTYPE 维修类别, t1.REASON 维修原因, t1.MEMO 备注, t1.RECORDER 记录人,"
+ "to_char(t1.REPAIRTIME,'yyyy-MM-dd HH24:mi:ss') 送修时间, to_char(t1.REPAIREDTIME,'yyyy-MM-dd HH24:mi:ss') 修复时间 "
+ "from DEV_TOOL_REPAIR t1, DEV_JJQ_BASE_INFO t2 " + str + " order by to_char(t1.REPAIREDTIME,'yyyy-MM-dd') desc, t1.REPAIRTIME desc";
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
ccp.MethodName = "QueryMethods";
ccp.ServerParams = new Object[] { strSql };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
try
{
((DataSet)ugrdBaseInfo.DataSource).Tables[0].Rows.Clear();
}
catch (Exception)
{
}
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
ugrdBaseInfo.DataSource = ds;
}
if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
{
MessageBox.Show("结晶器维修信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示");
}
}
///
/// 结晶器编号查询
///
private void GetDeviceID()
{
try
{
string strErr = "";
string strSql = "select distinct CRYSTALLIZERID from DEV_JJQ_BASE_INFO order by CRYSTALLIZERID";
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
ccp.MethodName = "QueryMethods";
ccp.ServerParams = new Object[] { strSql };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
{
MessageBox.Show("结晶器号加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (MessageBox.Show("是否重新加载结晶器号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
GetDeviceID();
return;
}
ucmbID.Items.Clear();
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
ucmbID.Items.Add(ds.Tables[0].Rows[i][0]);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void chkQLadleName_CheckedChanged(object sender, EventArgs e)
{
ucmbID.Enabled = chkQLadleName.Checked;
}
private void chkQStartTime_CheckedChanged(object sender, EventArgs e)
{
udteQStartTime.Enabled = chkQStartTime.Checked;
}
private void chkQEndTime_CheckedChanged(object sender, EventArgs e)
{
udteQEndTime.Enabled = chkQEndTime.Checked;
}
private void cbCCM_CheckedChanged(object sender, EventArgs e)
{
ucmbCCM.Enabled = chkCCM.Checked;
}
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "Query":
proc_Query();
break;
case "Close":
this.Close();
break;
default:
break;
}
}
}
}