山东时代原料后WCS代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1039 lines
41 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DBFactory;
using System.Net.Sockets;
using System.Threading;
using System.Linq;
using Microsoft.VisualBasic;
using System.IO.Ports;
using System.Resources;
using System.Drawing.Drawing2D;
namespace wcfControlMonitorClient
{
/// <summary>
/// Creator:Richard.liu
/// ���ȳ���������
/// </summary>
public partial class FrmControlMonitor : WeifenLuo.WinFormsUI.Docking.DockContent
{
StringBuilder sql = new StringBuilder();
Model.MDevice devinfo;
FrmDeviceStatus _deviceStatus = new FrmDeviceStatus();
DBFactory.DBOperator dbo = CStaticClass.dbo;
DBFactory.DBOperator dbo1 = CStaticClass.dboM;
private static FrmControlMonitor _formInstance;
public static FrmControlMonitor FormInstance
{
get
{
if (_formInstance == null)
{
_formInstance = new FrmControlMonitor();
}
return _formInstance;
}
set { _formInstance = value; }
}
public FrmControlMonitor()
{
InitializeComponent();
_formInstance = this;
}
#region ����
public void FlashPanit(string obj, bool visible)
{
this.Controls[obj].Visible = visible;
}
public void FlashPanit(string obj, Image backgroundImage)
{
this.Controls[obj].BackgroundImage = backgroundImage;
}
public void FlashPanit(string obj, ImageLayout backgroundImageLayout)
{
this.Controls[obj].BackgroundImageLayout = backgroundImageLayout;
}
public void FlashPanit(string obj, int top, int left)
{
this.Controls[obj].Top = top;
this.Controls[obj].Left = left;
}
public void FlashPanit(string obj, string text, bool append)
{
if (append == true)
{
this.Controls[obj].Text += text;
}
else
{
this.Controls[obj].Text = text;
}
}
public string GetObjectText(string obj)
{
return this.Controls[obj].Text;
}
public void MonitorRefresh(object dataSource)
{
#region Added by DingXiaoxu for Dock TaskList on 20101219
FrmTaskList.FormInstance.MonitorRefresh(dataSource);
#endregion
//this.dgvMonitor.DataSource = dataSource;
////20100108
//dataSource = null;
}
public void ManagerRefresh(object dataSource)
{
#region Added by DingXiaoxu for Dock TaskList on 20101219
FrmTaskList.FormInstance.ManagerRefresh(dataSource);
#endregion
//this.dgvManager.DataSource = dataSource;
////20100108
//dataSource = null;
}
#endregion
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000;//WS_CLIPCHILDREN ������������ʱ���ص����ֲ��ػ�
return cp;
}
}
private void timerFlash_Tick(object sender, EventArgs e)
{
string[] DS; char[] dd = new char[1] { '.' };
Model.MDevice device;
Model.MDevice devicedaocha;//add by lyj 20171205
TimeSpan ts = DateTime.Now.TimeOfDay;
DataView dv; DataView dvJY;DataView dvlt;
this.SuspendLayout(); //richard.liu20140806
try
{
if (CStaticClass.WCFOK == true)
{
#region add by lyj20190311ˢ����ʾģʽ��ǩָʾ
//sql.Remove(0, sql.Length);
//sql.Append("select * from T_WareHouse_DemoSet");
//dvlt = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
//if (dvlt.Count > 0)
//{
// for (int i = 0; i < dvlt.Count; i++)
// {
// try
// {
// string warehouseType = dvlt[i]["FWarehouseType"].ToString();
// switch (warehouseType)
// {
// case "B":
// if (Convert.ToInt32(dvlt[i]["FDemoFlag"]) == 1)
// {
// liaoxianglb.Visible = true;
// }
// else
// {
// liaoxianglb.Visible = false;
// }
// break;
// case "T":
// if (Convert.ToInt32(dvlt[i]["FDemoFlag"]) == 1)
// {
// tuopanlv.Visible = true;
// }
// else
// {
// tuopanlv.Visible = false;
// }
// break;
// }
// }
// catch (Exception ee) { }
// }
//}
#endregion
sql.Remove(0, sql.Length);//richard.liu20140806
sql.Append("SELECT F_DeviceIndex FROM T_Base_Device WHERE (F_LockedState = - 1) ");
dvJY = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;//richard.liu20140806
dvJY.Sort = "F_DeviceIndex";
//Button ShuttleBorad1 = bt1_10001;
//Button ShuttleBorad2 = bt1_10002;
//Button ShuttleBorad3 = bt1_10003;
Button stack1 = bt_11001;
Button stack2 = bt_11002;
Button stack3 = bt_11003;
TextBox tw1 = tb_11001;
TextBox tw2 = tb_11002;
TextBox tw3 = tb_11003;
//TextBox boradtw1 = tb1_10001;
//TextBox boradtw2 = tb1_10002;
//TextBox boradtw3 = tb1_10003;
Panel pp = plAccessorial1;
if (this.tabControl1.SelectedIndex == 0)
{
pp = plAccessorial1;
}
#region ÿ��¥���ӻ���
foreach (Button ctrl in pp.Controls.OfType<Button>())
{
if (ctrl.Enabled == false) continue;
device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Tag));
//if (device.DeviceIndex.ToString().IndexOf("13") == 0) continue;
//if (device.DeviceIndex.ToString().IndexOf("11") == 0) continue;
if (device == null)
{//20100108
if (tsStatus.Text.IndexOf(ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!") < 0)
{
tsStatus.ForeColor = Color.Red;
this.tsStatus.Text += ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!";
}
continue;
}
#region ����
if (device.DeviceKind == 1)
{//�Ѷ���
//double a = 2.9423;//3.9423=(49-41.1153)/2(58:�Ѷ���ͼ�Ͽ��ȣ�44.1152�����л���ͼ�Ͽ��ȣ�a:����ƫ��)
//ctrl.BringToFront();//add by lyj 20171122
//double startadd = 136;//������ʼ����
//double width = 22.025;//881/40=22.025 �����л��ܿ��ȣ�
//int locationX = 1;
//int locationY = 75;//��һ�����Ѷ�����������
//int differY = 115;//�������IJ�ֵ
//int boxHeight = 9;//̽��box�ĸ߶�
//int daochaLocationX = 94;
//int daochaLocationY = 151;
//int daochaLocationDifferY = 115;
//if (device.XCoor == 0)
//{
// locationX = 1010;
//}
//else
//{
// locationX = (int)(startadd + 881 - 13.5 - 25 - width * (device.XCoor - 1));
//}
#region ������ʵʱ��ʾ
if (device.DeviceKind == 1 )
{
//ctrl.BringToFront();//add by lyj 20171122
//double boardwidth = 12.0921;//919/76=22.025 �����л��ܿ��ȣ�
//int boardlocationX = 1;
//int boardlocationY1=1;
//int boardlocationY2 = 1;
//int boardlocationY3 = 1;
//int boardlocationY4 = 1;
//int boardlocationY5 = 1;
//int boarddifferY = 42;//�������IJ�ֵ
//int boardboxHeight = 11;//̽��box�ĸ߶�
//int boardboxWidth = 14;//̽��box�Ŀ��ȶ�
int iStartColum = 1;
int iEndColum = 38;
#region ���ԶѶ����˶�
//device.XCoor = DateTime.Now.Second % 37 + 1;
//device.YCoor = 1;
#endregion
if ((device.XCoor == 0) || device.YCoor == 0)
{
switch (device.DeviceIndex)
{
case 11001:
stack1.Location =
new Point(
848, 102);
tw1.Location = new Point(stack1.Location.X + 19, stack1.Location.Y + 10);
break;
case 11002:
stack2.Location =
new Point(
848, 256);
tw2.Location = new Point(stack2.Location.X + 19, stack2.Location.Y + 10);
break;
case 11003:
stack3.Location =
new Point(
848,531);
tw3.Location = new Point(stack3.Location.X + 19, stack3.Location.Y + 10);
break;
}
}
else //����Ϊ0
{
//�����ж�X=1ʱ��
if (device.XCoor == 1)
{
switch (device.DeviceIndex)
{
case 11001:
stack1.Location =
new Point(
848, 102);
tw1.Location = new Point(stack1.Location.X + 13, stack1.Location.Y + 8);
break;
case 11002:
stack2.Location =
new Point(
848, 256);
tw2.Location = new Point(stack2.Location.X + 13, stack2.Location.Y + 8);
break;
case 11003:
stack3.Location =
new Point(
848, 531);
tw3.Location = new Point(stack3.Location.X + 13, stack3.Location.Y + 8);
break;
}
}
else if (device.XCoor == 38)
{
switch (device.DeviceIndex)
{
case 11001:
stack1.Location =
new Point(
546, 122);
tw1.Location = new Point(stack1.Location.X + 13, stack1.Location.Y + 8);
break;
case 11002:
stack2.Location =
new Point(
546, 316);
tw2.Location = new Point(stack2.Location.X + 13, stack2.Location.Y + 8);
break;
case 11003:
stack3.Location =
new Point(
546, 666);
tw3.Location = new Point(stack3.Location.X + 13, stack3.Location.Y + 8);
break;
}
}
else
{
switch (device.DeviceIndex)
{
case 11001:
stack1.Location =
new Point(
848 - (437 - 6) * (device.XCoor - iStartColum) /
(iEndColum - iStartColum),102);
tw1.Location = new Point(stack1.Location.X + 13, stack1.Location.Y + 8);
break;
case 11002:
stack2.Location =
new Point(
848 - (437 - 6) * (device.XCoor - iStartColum) /
(iEndColum - iStartColum), 256);
tw2.Location = new Point(stack2.Location.X + 13, stack2.Location.Y + 8);
break;
case 11003:
stack3.Location =
new Point(
848 - (437 - 6) * (device.XCoor - iStartColum) /
(iEndColum - iStartColum), 531);
tw3.Location = new Point(stack3.Location.X + 13, stack3.Location.Y + 8);
break;
}
}
}
}
#endregion
}
#endregion
#region 20210402_�Ϻ��ɵ�������������״̬
int iRunState = device.RunState;
//if (device.DeviceKind == 1)
//{
// StringBuilder sql1 = new StringBuilder();
// sql1.Remove(0, sql1.Length);
// sql1.Append("SELECT F_SwitchLock FROM T_Base_Device WHERE F_DeviceIndex = ")
// .Append(device.DeviceIndex);
// int iCharge =
// Convert.ToInt32(dbo.ExceSQL(sql1.ToString()).Tables[0].DefaultView[0]["F_SwitchLock"]
// .ToString());
// if (iCharge > 0)
// {
// iRunState = 6;
// }
//}
#endregion
#region �����豸״̬
switch (iRunState)
{
//����
case 0:
if (device.DeviceKind == 1 )
{
//if (device.ControlMode > 0)
//{
// //ctrl.BackColor = Color.DarkViolet;
//}
//else
//{
//}
ctrl.BackColor = Color.Orange;
}
else
{
ctrl.BackColor = Color.LightSkyBlue; ;
}
break;
//����
case 1:
ctrl.BackColor = Color.Lime;
break;
//����
case 2:
ctrl.BackColor = Color.Red;
break;
//����
case 3:
ctrl.BackColor = Color.LightYellow;
break;
//ͣ��
case 4:
ctrl.BackColor = Color.Maroon;
break;
//20090920��������
case 5:
ctrl.BackColor = Color.SeaGreen;//MediumOrchid;
break;
case 6:
ctrl.BackColor = Color.Aqua;
break;
}
#endregion
#region �豸������
//richar.liu20140806
if (dvJY.Find(device.DeviceIndex) >= 0)
{
ctrl.BackColor = Color.Maroon;
}
#endregion
}
#region ����̽��
foreach (TextBox ctrl in pp.Controls.OfType<TextBox>())
{
DS = ctrl.Tag.ToString().Split(dd);
int devicebyte = 0; int devbit = 0;
int.TryParse(DS[0], out devicebyte);
int.TryParse(DS[1], out devbit);
device = Model.CGetInfo.GetDeviceInfo(devicebyte);
if (device == null)
{//20100108
if (tsStatus.Text.IndexOf(ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!") < 0)
{
tsStatus.ForeColor = Color.Red;
this.tsStatus.Text += ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!";
}
continue;
}
switch (devbit)
{
case 0:
ctrl.Visible = device.SplitByte_0 == 1 ? true : false;
break;
case 1:
ctrl.Visible = device.SplitByte_1 == 1 ? true : false;
break;
case 2:
ctrl.Visible = device.SplitByte_2 == 1 ? true : false;
break;
case 3:
ctrl.Visible = device.SplitByte_3 == 1 ? true : false;
break;
case 4:
ctrl.Visible = device.SplitByte_4 == 1 ? true : false;
break;
case 5:
ctrl.Visible = device.SplitByte_5 == 1 ? true : false;
break;
case 6:
ctrl.Visible = device.SplitByte_6 == 1 ? true : false;
ctrl.BackColor = Color.Goldenrod;
break;
case 7:
ctrl.Visible = device.SplitByte_7 == 1 ? true : false;
break;
}
ctrl.BringToFront();
}
#endregion
#region ��λ����̽��
//foreach (Label ctrl in pp.Controls.OfType<Label>())
//{
// if (ctrl.Tag != null && ctrl.ForeColor != Color.Red)
// {
// DS = ctrl.Tag.ToString().Split(dd);
// int devicebyte = 0; int devbit = 0;
// int.TryParse(DS[0], out devicebyte);
// int.TryParse(DS[1], out devbit);
// device = Model.CGetInfo.GetDeviceInfo(devicebyte);
// if (device == null)
// {//20100108
// if (tsStatus.Text.IndexOf(ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!") < 0)
// {
// tsStatus.ForeColor = Color.Red;
// this.tsStatus.Text += ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!";
// }
// continue;
// }
// switch (devbit)
// {
// case 0:
// ctrl.Visible = device.SplitByte_0 == 1 ? true : false;
// break;
// case 1:
// ctrl.Visible = device.SplitByte_1 == 1 ? true : false;
// break;
// case 2:
// ctrl.Visible = device.SplitByte_2 == 1 ? true : false;
// break;
// case 3:
// ctrl.Visible = device.SplitByte_3 == 1 ? true : false;
// break;
// case 4:
// ctrl.Visible = device.SplitByte_4 == 1 ? true : false;
// break;
// case 5:
// ctrl.Visible = device.SplitByte_5 == 1 ? true : false;
// break;
// case 6:
// ctrl.Visible = device.SplitByte_6 == 1 ? true : false;
// ctrl.BackColor = Color.Goldenrod;
// break;
// case 7:
// ctrl.Visible = device.SplitByte_7 == 1 ? true : false;
// break;
// }
// }
//}
#endregion
#region �߼�������ʾ
foreach (RadioButton ctrl in pp.Controls.OfType<RadioButton>())
{
//20100108DataView dvh;
dv = dbo.ExceSQL("SELECT F_DeviceIndex FROM T_Base_Device WHERE (F_DeviceIndex = " + ctrl.Tag + ") AND (F_HaveGoods >0)").Tables[0].DefaultView;
if (dv.Count > 0)
{
ctrl.Visible = true;
ctrl.BackColor = Color.Blue;
}
else
{
ctrl.Visible = false;
}
}
#endregion
#region ���ϵ�
//foreach (PictureBox ctrl in pp.Controls.OfType<PictureBox>())
//{
// if (ctrl.Tag != null)
// {
// DS = ctrl.Tag.ToString().Split(dd);
// int devicebyte = 0; int devbit = 0;
// int.TryParse(DS[0], out devicebyte);
// int.TryParse(DS[1], out devbit);
// device = Model.CGetInfo.GetDeviceInfo(devicebyte);
// if (device == null)
// {//20100108
// if (tsStatus.Text.IndexOf(ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!") < 0)
// {
// tsStatus.ForeColor = Color.Red;
// this.tsStatus.Text += ctrl.Name + "�ؼ���Ӧ���豸������" + ctrl.Tag + "�����ݿ�û�м�¼!";
// }
// continue;
// }
// switch (devbit)
// {
// case 0:
// ctrl.Visible = device.SplitByte_0 == 1 ? true : false;
// break;
// }
// }
//}
#endregion
#region 20210326_�Ϻ��ɵ����ּ���������ɫ
//foreach (PictureBox ctrl in pp.Controls.OfType<PictureBox>())
//{
// if (ctrl.Tag != null)
// {
// sql.Remove(0, sql.Length);
// sql.Append("SELECT * FROM IO_Station_Status WHERE F_StationID = ").Append(ctrl.Tag);
// dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
// if (dv.Count > 0)
// {
// int iStatus = Convert.ToInt16(dv[0]["F_Status"]);
// switch (iStatus)
// {
// case 0:
// ctrl.BackColor = Color.White;
// break;
// case 1:
// ctrl.BackColor = Color.Red;
// break;
// case 2:
// ctrl.BackColor = Color.Green;
// break;
// case 3:
// ctrl.BackColor = Color.Blue;
// break;
// case 4:
// ctrl.BackColor = Color.Aqua;
// break;
// default:
// break;
// }
// }
// }
//}
#endregion
#region ��ͣ��ť��ʾ
foreach (PictureBox ctrl in pp.Controls.OfType<PictureBox>())
{
//20100108DataView dvh;
// string aa = ctrl.Name;
// int a = 0;
//string aaa= ctrl.Tag.ToString();
// //if(ctrl.Enabled ==true)
if (ctrl.Tag != null)
{
if (!string.IsNullOrEmpty(ctrl.Tag.ToString()))
{
//if (int.TryParse(ctrl.Tag.ToString(), out a) == true)
//{
dv = dbo.ExceSQL("SELECT F_DeviceIndex FROM T_Base_Device WHERE (F_DeviceIndex = " + ctrl.Tag + ")").Tables[0].DefaultView;
if (dv.Count > 0)
{
device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Tag));
if (device.SplitByte_6 == 1) // ���°�ť
{
ctrl.Image = wcfControlMonitorClient.Properties.Resources.stop_1;
}
else //û����
{
ctrl.Image = wcfControlMonitorClient.Properties.Resources.stop_0;
}
}
//}
}
}
}
#endregion
#endregion
}
}
catch (Exception ex)
{//20100108
if (tsStatus.Text.IndexOf("ˢ�½��涯��ʱ��" + ex.Message) < 0)
{
tsStatus.ForeColor = Color.Red;
this.tsStatus.Text += "ˢ�½��涯��ʱ��" + ex.Message;
}
}
finally
{//20100108
TimeSpan ts1 = DateTime.Now.TimeOfDay;
device = null;
this.ResumeLayout();//richard.liu20140806
}
}
private void ctrl_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
_deviceStatus.DeviceIndex = Convert.ToInt32(btn.Tag);
_deviceStatus.ShowDialog();
}
private void Btn_MouseEnter(object sender, EventArgs e)
{
int deviceindex;
string[] DS; char[] dd = new char[1] { '.' };
string msg = (sender as Control).Tag.ToString();
DS = msg.Split(dd);
if (DS.Length > 0)
{
if (int.TryParse(DS[0], out deviceindex))
{
devinfo = Model.CGetInfo.GetDeviceInfo(deviceindex);
if (devinfo != null)
{
msg = devinfo.DeviceName;
}
}
}
toolTip_DeviceIndex.SetToolTip(sender as Control, msg);
}
private void ctrl_ClickLabel(object sender, EventArgs e)
{
Label label = (Label)sender;
_deviceStatus.DeviceIndex = Convert.ToInt32(label.Tag);
_deviceStatus.ShowDialog();
}
private void FrmControlMonitor_Load(object sender, EventArgs e)
{
try
{
#region �������ͻ������󳵺ͶѶ����ĵ����¼�
//foreach (Control ctrl in this.plAccessorial2.Controls)
//{
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.Button") && (ctrl.Tag != null))
// {
// ctrl.Click += new EventHandler(ctrl_Click);
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
// }
// //if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Red))
// //{
// // ctrl.Click += new EventHandler(ctrl_ClickLabel);
// // ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
// //}
// //if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
// //{
// // ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
// //}
//}
foreach (Control ctrl in this.plAccessorial1.Controls)
{
if ((ctrl.GetType().ToString() == "System.Windows.Forms.Button") && (ctrl.Tag != null))
{
ctrl.Click += new EventHandler(ctrl_Click);
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
}
if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Red))
{
ctrl.Click += new EventHandler(ctrl_ClickLabel);
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
}
//if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.BackColor == Color.LightSteelBlue))
//{
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
//}
if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
{
ctrl.Click += new EventHandler(ctrl_ClickPic);//�񺽶���
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
}
}
#endregion
}
catch (Exception ex)
{
throw (ex);
}
}
private void ctrl_ClickPic(object sender, EventArgs e)//���� picturebox ����Ҫ������д�ֽ�
{
try
{
if (MessageBox.Show("��ȷ��Ҫ�޸��豸����״̬����", "ȷ��", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
PictureBox btn = (PictureBox)sender;
int DeviceIndex = Convert.ToInt32(btn.Tag);
Model.MDevice device;
device = Model.CGetInfo.GetDeviceInfo(DeviceIndex);
string bost = "";
if (device.SplitByte_6 == 1)
{
bost = "0"; //
}
else
{
bost = "1";//
}
string errtxt = string.Empty;
var isOK=CStaticClass.WcfControl.WriteDBData(out errtxt, DeviceIndex, "DB1", bost);
if (!isOK)
{
MessageBox.Show("����ʧ�ܣ�������Ϣ:"+errtxt);
}
}
else
{
}
}
catch (Exception ex)
{
}
}
private void tsStatus_ForeColorChanged(object sender, EventArgs e)
{
FrmErrorMessage.FormInstance.NewForeColor((sender as TextBox).ForeColor);
}
private void tsStatus_TextChanged(object sender, EventArgs e)
{
//throw new System.Exception("The method or operation is not implemented.");
string msg = (sender as TextBox).Text;
if (msg != "")
{
//msg = string.Format("{0}\r\n", msg);
//msg=msg+"\r\n";
CommonClassLib.CCarryConvert.WriteDarkCasket("Error", msg, "", "", "");
FrmErrorMessage.FormInstance.NewMessage(msg);
}
}
private void tabPage1_Click(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
string enddevices, startsdevices, strinfo = string.Empty;//���������յ�
string sqlstr = string.Empty;
DataView dvdv = new DataView();
int EndDevice = 12018;
sqlstr = string.Format("select * from T_Base_TaskCount where F_DeviceIndex={0}", EndDevice);//�����յ��豸��Ӧ�ij���������ȡ������ִ������
dvdv = dbo.ExceSQL(sqlstr).Tables[0].DefaultView;
if (dvdv.Count > 0)
{
int getcount, execount;
getcount = Convert.ToInt32(dvdv[0]["F_MAXCOUNT"]);
execount = Convert.ToInt32(dvdv[0]["F_EXECOUNT"]);
//checkdevice = Convert.ToInt32(dvdv[0]["F_CHECKDEVICE"]);//
enddevices = Convert.ToString(dvdv[0]["F_CHECKENDDEVICE"]);//Ҫ�ж��Ƿ����ڸ��յ����豸
startsdevices = Convert.ToString(dvdv[0]["F_CHECKSTARTDEVICE"]);//Ҫ�ж��Ƿ����ڸ��������豸
if (startsdevices != "0" || enddevices != "0")//��ʾͬʱִ��ʱ
{
sqlstr = string.Format("SELECT FID,F_ManageTaskKindIndex FROM T_Manage_Task WHERE (FSTARTDEVICE in({0})) OR (FENDDEVICE in({1}))", startsdevices, enddevices);
dvdv = dbo.ExceSQL(sqlstr).Tables[0].DefaultView;
if (dvdv.Count > 0)//�����໥���ŵij���������ʱ����������������
{
// outcount = execount;
}
else//ֻ���ڵ�ǰ�յ�������ʱ������ȡ�������ƣ�һ������ ��ȡ����Ҫ����ִ������
{
//outcount = getcount;
}
}
}
}
private void button6_Click_1(object sender, EventArgs e)
{
//bool a = GetTransDeviceIfFull("11003;11004;11005");
}
public bool GetTransDeviceIfFull(string Devices)
{
try
{
char[] cc = new char[1] { ';' };
string[] sp;
sp = Devices.Split(cc);
int count = sp.Length;//�豸����
int goodscount = 0;//��������
for (int i = 0; i < count; i++)
{
int deviceindex = Convert.ToInt32(sp[i]);
devinfo = Model.CGetInfo.GetDeviceInfo(deviceindex);
if (devinfo != null)
{
goodscount += devinfo.SplitByte_0;
goodscount += devinfo.SplitByte_1;
}
}
if (goodscount >= count)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
return false;
}
}
private void PlAccessorial2_Paint(object sender, PaintEventArgs e)
{
}
private void PlAccessorial1_Paint(object sender, PaintEventArgs e)
{
}
private void button61_Click(object sender, EventArgs e)
{
}
}
}