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 CoreFS.CA06;
using Core.LZMes.Client.UIM.comm;
namespace Core.LZMes.Client.UIM.UIM05
{
public partial class UIM050010 : FrmBase
{
private PictureBox _PicBoxPLTCM;
private PictureBox _PicBoxCAL;
private PictureBox _PicBoxRCL;
public UIM050010()
{
InitializeComponent();
}
private void UIM050010_Load(object sender, EventArgs e)
{
_PicBoxPLTCM = new CustomPictureBox(Scenes.PLTCM, new EventHandler(pictureBoxDoubleClick));
panel1.Controls.Add(_PicBoxPLTCM);
_PicBoxCAL = new CustomPictureBox(Scenes.CAL, new EventHandler(pictureBoxDoubleClick));
panel1.Controls.Add(_PicBoxCAL);
_PicBoxRCL = new CustomPictureBox(Scenes.RCL, new EventHandler(pictureBoxDoubleClick));
panel1.Controls.Add(_PicBoxRCL);
panel1.Controls.Add(new CustomGridView(Scenes.PLTCM, dataSet1));
panel1.Controls.Add(new CustomGridView(Scenes.CAL,dataSet1));
panel1.Controls.Add(new CustomGridView(Scenes.RCL, dataSet1));
//刷新数据
RefreshData();
timer1.Start();
}
///
/// 定时器
///
///
///
private void timer1_Tick(object sender, EventArgs e)
{
RefreshData();
}
///
/// 实时刷新数据
///
private void RefreshData()
{
GetMillData(dataSet1.Tables["tmp"], dataSet1.Tables["pltcm"], Scenes.PLTCM);
GetMillData(dataSet1.Tables["tmp"], dataSet1.Tables["cal"], Scenes.CAL);
GetMillData(dataSet1.Tables["tmp"], dataSet1.Tables["rcl"], Scenes.RCL);
}
private void GetMillData(DataTable dtSource,DataTable dtTarget,Scenes sType)
{
try
{
dtSource.Clear();
dtTarget.Clear();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM05.UIM050010";
switch (sType.ToString())
{
case "PLTCM":
ccp.MethodName = "getPltcmData";
break;
case "CAL":
ccp.MethodName = "getCalData";
break;
case "RCL":
ccp.MethodName = "getRclData";
break;
default:
return;
break;
}
ccp.SourceDataTable = dtSource;
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
DataRow drSource = null, drTarget = null;
if (dtSource.Rows.Count > 0)
{
drSource = dtSource.Rows[0];
switch (sType.ToString())
{
case "PLTCM":
_PicBoxPLTCM.Enabled = true;
break;
case "CAL":
_PicBoxCAL.Enabled = true;
break;
case "RCL":
_PicBoxRCL.Enabled = true;
break;
}
}
else
{
drSource = dtSource.NewRow();
switch (sType.ToString())
{
case "PLTCM":
drSource["WKNAME"] = "酸轧机组";
_PicBoxPLTCM.Enabled = false;
break;
case "CAL":
drSource["WKNAME"] = "连退机组";
_PicBoxCAL.Enabled = false;
break;
case "RCL":
drSource["WKNAME"] = "重卷机组";
_PicBoxRCL.Enabled = false;
break;
}
drSource["WKGROUP"] = "班次,班组";
drSource["COIL_NO"] = "卷号";
drSource["SPEC_STL_GRD"] = "牌号";
drSource["COIL_SIZE"] = "规格";
drSource["COIL_WGT"] = "重量";
drSource["ORDNAME"] = "订单号";
drSource["BEGINTIME"] = "生产开始时间 ";
drSource["ORD_NO"] = " ";
drSource["MILLTIME"] = "已生产时间";
}
for (int i = 0; i < 5; i++)
{
drTarget = dtTarget.NewRow();
drTarget["COL1"] = drSource[i * 2];
drTarget["COL2"] = drSource[i * 2 + 1];
dtTarget.Rows.Add(drTarget);
}
}
catch (Exception ex)
{
}
}
private void pictureBoxDoubleClick(object sender, EventArgs e)
{
string stype = "";
if (sender is PictureBox && ((PictureBox)sender).Name.Length > 4)
{
PictureBox pBox = (PictureBox)sender;
stype = pBox.Name.Substring(4);
UIM050011 dlgInfo = new UIM050011(stype);
dlgInfo.StartPosition = FormStartPosition.CenterParent;
dlgInfo.ob = this.ob;
dlgInfo.ShowDialog(this);
}
}
}
}