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.
1034 lines
43 KiB
1034 lines
43 KiB
3 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Drawing;
|
||
|
using System.Text;
|
||
|
using System.Windows.Forms;
|
||
|
using System.ServiceModel;
|
||
|
namespace wcfControlMonitorClient
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Creator:Richard.liu and Jack.Ma
|
||
|
/// �豸ʵʱ״̬��ʾ
|
||
|
/// </summary>
|
||
|
public partial class FrmDeviceStatus : Form
|
||
|
{
|
||
|
#region ��������
|
||
|
Model.MDevice _device = null;
|
||
|
int _deviceIndex;
|
||
|
DataView dv;
|
||
|
string sqlstr = string.Empty;
|
||
|
DBFactory.DBOperator dbo = CStaticClass.dbo;
|
||
|
|
||
|
DBFactory.DBOperator dboMan = CStaticClass.dboM;// 20220425 zb �����ֶ�����
|
||
|
|
||
|
/// <summary>
|
||
|
/// ����Ҫ��ʾ���豸����
|
||
|
/// </summary>
|
||
|
public int DeviceIndex
|
||
|
{
|
||
|
set { _deviceIndex = value; }
|
||
|
}
|
||
|
private static FrmDeviceStatus _formInstance;
|
||
|
|
||
|
public static FrmDeviceStatus FormInstance
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
if (_formInstance == null)
|
||
|
{
|
||
|
_formInstance = new FrmDeviceStatus();
|
||
|
}
|
||
|
return _formInstance;
|
||
|
}
|
||
|
set { _formInstance = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region ���캯��/��ʼ��
|
||
|
public FrmDeviceStatus()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
_formInstance = this;
|
||
|
}
|
||
|
|
||
|
private void FrmDeviceStatus_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
//StringBuilder sql=new StringBuilder();
|
||
|
//sql.Append("SELECT F_LaneGateDeviceIndex from T_Base_Lane_Gate where F_LaneGateDeviceIndex=").Append(_deviceIndex);
|
||
|
//DataView dvlane = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
//if (dvlane.Count > 0)
|
||
|
//{
|
||
|
// sql = new StringBuilder();
|
||
|
// sql.Append("SELECT F_DeviceIndex from T_Base_PLC_Ask where F_DeviceIndex=").Append(_deviceIndex);
|
||
|
// dvlane = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
// if (dvlane.Count > 0)
|
||
|
// {
|
||
|
// this.btCancelDoubleFork.Visible = true;
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// this.btCancelDoubleFork.Visible = false;
|
||
|
// }
|
||
|
// this.btLogicHaveGoods.Visible = true;
|
||
|
// this.btLogicNoneGoods.Visible = true;
|
||
|
// textBox1.Visible = true;
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// this.btCancelDoubleFork.Visible = false;
|
||
|
// this.btLogicHaveGoods.Visible = false;
|
||
|
// this.btLogicNoneGoods.Visible = false;
|
||
|
// textBox1.Visible = false;
|
||
|
//}
|
||
|
btnRefresh_Click(null, EventArgs.Empty);
|
||
|
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region �����豸״̬
|
||
|
private void btnRefresh_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
tabControl_Device.SelectedIndex = 0;//Ĭ��ѡ����ҳ
|
||
|
_device = Model.CGetInfo.GetDeviceInfo(_deviceIndex);
|
||
|
//20100108
|
||
|
if (_device == null)
|
||
|
{
|
||
|
MessageBox.Show("��ѡ�����豸�����ݿ�û�м�¼��", "������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
return;
|
||
|
|
||
|
}
|
||
|
if ((_device.DeviceIndex >= 11001 && _device.DeviceIndex <= 11003)
|
||
|
|| (_device.DeviceIndex >= 12001 && _device.DeviceIndex <= 12003)
|
||
|
|| (_device.DeviceIndex >= 13001 && _device.DeviceIndex <= 13007)
|
||
|
|| (_device.DeviceIndex >= 15001 && _device.DeviceIndex <= 15010)
|
||
|
|| (_device.DeviceIndex >= 17001 && _device.DeviceIndex <= 17002))//��λ����̽�˻���ʾ�����ź�ҳ��
|
||
|
{
|
||
|
//tabPage_signal.Parent = tabControl_Device;
|
||
|
tabPage_signal.Parent = null;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
tabPage_signal.Parent = null;
|
||
|
}
|
||
|
|
||
|
#region ��ʾ�����ް�ť
|
||
|
StringBuilder sql = new StringBuilder();
|
||
|
sql.Append("SELECT F_LaneGateDeviceIndex from T_Base_Lane_Gate where F_LaneGateDeviceIndex=").Append(_deviceIndex);
|
||
|
DataView dvlane = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
if (dvlane.Count > 0)
|
||
|
{
|
||
|
sql = new StringBuilder();
|
||
|
sql.Append("SELECT F_DeviceIndex from T_Base_PLC_Ask where F_DeviceIndex=").Append(_deviceIndex);
|
||
|
dvlane = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
if (dvlane.Count > 0)
|
||
|
{
|
||
|
this.btCancelDoubleFork.Visible = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.btCancelDoubleFork.Visible = false;
|
||
|
}
|
||
|
this.btLogicHaveGoods.Visible = true;
|
||
|
this.btLogicNoneGoods.Visible = true;
|
||
|
textBox1.Visible = true;
|
||
|
|
||
|
if (_device.DeviceKind == 2 || _device.DeviceKind == 9)
|
||
|
{
|
||
|
dv = dbo.ExceSQL("select F_DeviceIndex from T_Base_Device where F_HaveGoods >0 and F_DeviceIndex =" + this._deviceIndex).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
lblGoods.Text = "������";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
lblGoods.Text = "������";
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
lblGoods.Text = "-";
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.btCancelDoubleFork.Visible = false;
|
||
|
this.btLogicHaveGoods.Visible = false;
|
||
|
this.btLogicNoneGoods.Visible = false;
|
||
|
textBox1.Visible = false;
|
||
|
|
||
|
lblGoods.Text = "-";
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region ��¼���밴ť��ʾ
|
||
|
if (_device.DeviceKind == 7 || _device.DeviceKind == 35 || _device.DeviceKind == 34)
|
||
|
{
|
||
|
btHandAddCode.Visible = true;
|
||
|
tbAddBarcode.Visible = true;
|
||
|
tbAddCount.Visible = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
btHandAddCode.Visible = false;
|
||
|
tbAddBarcode.Visible = false;
|
||
|
tbAddCount.Visible = false;
|
||
|
}
|
||
|
#endregion
|
||
|
//�豸����
|
||
|
this.lblDeviceIndex.Value = _device.DeviceIndex;
|
||
|
//�豸����
|
||
|
this.lblDeviceName.Text = _device.DeviceName;
|
||
|
//�豸ָ������
|
||
|
this.lblTaskIndex.Text = _device.TaskNo.ToString();
|
||
|
|
||
|
#region ��ʾĿ��λ�ú���������
|
||
|
sqlstr = string.Format("SELECT F_MonitorIndex,F_DeviceCommandIndex,F_NumParam1,F_NumParam2,F_NumParam3,F_NumParam4,F_NumParam5,F_NumParam6, F_TxtParam FROM T_Monitor_Task WHERE (F_MonitorIndex ={0})", _device.TaskNo);
|
||
|
dv = dbo.ExceSQL(sqlstr).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
int order = Convert.ToInt32(dv[0]["F_DeviceCommandIndex"]);
|
||
|
string info = string.Empty;
|
||
|
|
||
|
int Z = Convert.ToInt32(dv[0]["F_NumParam1"]);
|
||
|
int X = Convert.ToInt32(dv[0]["F_NumParam2"]);
|
||
|
int Y = Convert.ToInt32(dv[0]["F_NumParam3"]);
|
||
|
int Z1 = Convert.ToInt32(dv[0]["F_NumParam4"]);
|
||
|
int X1 = Convert.ToInt32(dv[0]["F_NumParam5"]);
|
||
|
int Y1 = Convert.ToInt32(dv[0]["F_NumParam6"]);
|
||
|
|
||
|
if (_device.DeviceKind == 1)
|
||
|
{
|
||
|
switch (order)
|
||
|
{
|
||
|
case 1://��ԭ��
|
||
|
info = string.Format("��ԭ��:01��01��");
|
||
|
break;
|
||
|
case 2://��ȡ
|
||
|
info = string.Format("��ȡ:{0:D2}��-{1:D2}��-{2:D2}��", Z, X, Y);
|
||
|
break;
|
||
|
case 3://����
|
||
|
info = string.Format("����:{0:D2}��-{1:D2}��-{2:D2}��", Z1, X1, Y1);
|
||
|
break;
|
||
|
case 4://ȡ
|
||
|
info = string.Format("ȡ��:{0:D2}��-{1:D2}��-{2:D2}��", Z, X, Y);
|
||
|
|
||
|
break;
|
||
|
case 5://��
|
||
|
info = string.Format("�ͻ�:{0:D2}��-{1:D2}��-{2:D2}��", Z1, X1, Y1);
|
||
|
break;
|
||
|
case 6:
|
||
|
info = string.Format("ȡ�ͻ�:{0:D2}��-{1:D2}��-{2:D2}�� �� {3:D2}��-{4:D2}��-{5:D2}��", Z, X, Y, Z1, X1, Y1);
|
||
|
break;
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
else
|
||
|
if (_device.DeviceKind == 2)
|
||
|
{
|
||
|
switch (order)
|
||
|
{
|
||
|
case 1://��ת
|
||
|
info = string.Format("��ת");
|
||
|
break;
|
||
|
case 2://��ת
|
||
|
info = string.Format("��ת");
|
||
|
break;
|
||
|
case 6://�ͳ�
|
||
|
info = string.Format("{0}�ͳ���{1}", Z, Z1);
|
||
|
break;
|
||
|
case 8://����
|
||
|
info = string.Format("����");
|
||
|
break;
|
||
|
case 9://�½�
|
||
|
info = string.Format("�½�");
|
||
|
break;
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
if (_device.DeviceKind == 4)
|
||
|
{
|
||
|
switch (order)
|
||
|
{
|
||
|
case 7://�˶�
|
||
|
info = string.Format("�˶�:{0}", Z);
|
||
|
break;
|
||
|
case 8://ȡ
|
||
|
info = string.Format("ȡ��:{0}", Z);
|
||
|
break;
|
||
|
case 9://��
|
||
|
info = string.Format("�ͻ�:{0}", Z);
|
||
|
break;
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
this.lblArrowLocation.Text = info;
|
||
|
|
||
|
this.lblBarcode.Text = dv[0]["F_TxtParam"].ToString();
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//20140109
|
||
|
if (_device.DeviceKind == 2)
|
||
|
{
|
||
|
if (_device.RunState == 5 && _device.SplitByte_0 == 1)
|
||
|
{
|
||
|
//������
|
||
|
object bcode = dbo.GetSingle(string.Format("SELECT F_PALLETBARCODE FROM T_Base_Device WHERE (F_DeviceIndex = {0})", _device.DeviceIndex));
|
||
|
if (bcode != null)
|
||
|
{
|
||
|
this.lblBarcode.Text = bcode.ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblBarcode.Text = "";
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//������
|
||
|
this.lblBarcode.Text = "";
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//������
|
||
|
this.lblBarcode.Text = "";
|
||
|
}
|
||
|
//Ŀ��λ��
|
||
|
|
||
|
this.lblArrowLocation.Text = "";
|
||
|
}
|
||
|
#endregion
|
||
|
if (_device.DeviceKind == 31)
|
||
|
{
|
||
|
|
||
|
this.lblTaskIndex.Text = GetMonitorTaskIndexFromBarCode(new StringBuilder(_device.Barcode)).ToString();
|
||
|
this.lblBarcode.Text = _device.Barcode;
|
||
|
this.lblBarcode.Enabled = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblBarcode.Enabled = false;
|
||
|
}
|
||
|
|
||
|
//�豸״̬
|
||
|
switch (_device.RunState)
|
||
|
{
|
||
|
case 0:
|
||
|
lblDeviceStatus.Text = "����";
|
||
|
break;
|
||
|
case 1:
|
||
|
lblDeviceStatus.Text = "����";
|
||
|
break;
|
||
|
case 2:
|
||
|
lblDeviceStatus.Text = "����";
|
||
|
break;
|
||
|
case 3:
|
||
|
lblDeviceStatus.Text = "����";
|
||
|
break;
|
||
|
case 4:
|
||
|
lblDeviceStatus.Text = "ͣ��";
|
||
|
break;
|
||
|
case 5://20090920
|
||
|
lblDeviceStatus.Text = "��������";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
|
||
|
if (_device.ErrorCode >= 30)
|
||
|
{
|
||
|
Model.MError err = Model.CGetInfo.GetErrorInfo(Convert.ToInt32(_device.DeviceKind.ToString() + _device.ErrorCode.ToString()));
|
||
|
if (err != null)
|
||
|
{
|
||
|
this.lblErrorName.Text = err.ErrorName + "�����룺" + _device.ErrorCode.ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblErrorName.Text = _device.ErrorCode.ToString();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblErrorName.Text = "";
|
||
|
}
|
||
|
if (_device.DeviceKind == 1)
|
||
|
{
|
||
|
int xcoor = _device.XCoor;
|
||
|
if (_device.DeviceIndex == 23035)//20180609
|
||
|
{
|
||
|
xcoor -= 1488;
|
||
|
}
|
||
|
if (_device.DeviceIndex == 31006)//20181023
|
||
|
{
|
||
|
xcoor -= 3800;
|
||
|
}
|
||
|
this.lblNowX.Text = string.Format("{0:D2}��", xcoor);
|
||
|
this.lblNowY.Text = string.Format("{0:D2}��", _device.YCoor);
|
||
|
//this.lblNowY.Text = _device.YCoor.ToString();
|
||
|
}
|
||
|
else
|
||
|
if (_device.DeviceKind == 4)
|
||
|
{
|
||
|
this.lblNowX.Text = string.Format("{0}mm", _device.XCoor);
|
||
|
this.lblNowY.Text = "";
|
||
|
}
|
||
|
else
|
||
|
if (_device.DeviceKind == 2 || _device.DeviceKind == 9)
|
||
|
{
|
||
|
if (_device.XCoor > 0)
|
||
|
{
|
||
|
this.lblNowX.Text = string.Format("{0}��", _device.XCoor);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblNowX.Text = "";
|
||
|
}
|
||
|
this.lblNowY.Text = "";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblNowX.Text = "";
|
||
|
this.lblNowY.Text = "";
|
||
|
}
|
||
|
cB_Empty.Enabled = false;
|
||
|
label_staus.Text = "�豸״̬:";
|
||
|
|
||
|
label_X.Text = "��ǰX���꣺";
|
||
|
label_Y.Text = "��ǰY���꣺";
|
||
|
if (_device.DeviceKind == 7)
|
||
|
{
|
||
|
dv = dbo.ExceSQL(string.Format("SELECT F_BarCode ,F_Time,F_TempFirstProject,F_FirstProject FROM T_Base_PLC_Ask WHERE (F_DeviceIndex = {0})", _device.DeviceIndex)).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
this.lblBarcode.Text = dv[0]["F_BarCode"].ToString();
|
||
|
|
||
|
label_staus.Text = "ɨ��ʱ�䣺";
|
||
|
|
||
|
label_X.Text = "�߶ȣ�";
|
||
|
label_Y.Text = "������";
|
||
|
|
||
|
lblDeviceStatus.Text = dv[0]["F_Time"].ToString();
|
||
|
lblNowX.Text = dv[0]["F_FirstProject"].ToString();
|
||
|
|
||
|
|
||
|
lblNowY.Text = dv[0]["F_TempFirstProject"].ToString();
|
||
|
|
||
|
|
||
|
cB_Empty.Checked = (dv[0]["F_TempFirstProject"].ToString() == "0" ? false : true);//20170215
|
||
|
if (_device.DeviceIndex.ToString().Length <= 5)
|
||
|
{
|
||
|
//this.lblBarcode.Enabled = true;
|
||
|
cB_Empty.Enabled = true;
|
||
|
}
|
||
|
}
|
||
|
lblErrorName.Text = "";
|
||
|
//lblDeviceStatus.Text = "";
|
||
|
}
|
||
|
if (_device.DeviceKind == 35)//��������
|
||
|
{
|
||
|
dv = dbo.ExceSQL(string.Format("SELECT F_BarCode ,F_Time,F_TempFirstProject,F_FirstProject FROM T_Base_PLC_Ask WHERE (F_DeviceIndex = {0})", _device.DeviceIndex)).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
this.lblBarcode.Text = dv[0]["F_BarCode"].ToString();
|
||
|
lblDeviceStatus.Text = dv[0]["F_Time"].ToString();
|
||
|
label_X.Text = "��������������";
|
||
|
|
||
|
|
||
|
lblNowX.Text = dv[0]["F_FirstProject"].ToString();
|
||
|
//cB_Empty.Checked = (dv[0]["F_TempFirstProject"].ToString() == "0" ? false : true);//20170215
|
||
|
if (_device.DeviceIndex.ToString().Length <= 5)
|
||
|
{
|
||
|
//this.lblBarcode.Enabled = true;
|
||
|
cB_Empty.Enabled = true;
|
||
|
}
|
||
|
}
|
||
|
lblErrorName.Text = "";
|
||
|
//lblDeviceStatus.Text = "";
|
||
|
}
|
||
|
//�Ƿ�������
|
||
|
//if (_device.DeviceKind == 2 || _device.DeviceKind == 9)
|
||
|
//{
|
||
|
// dv = dbo.ExceSQL("select F_DeviceIndex from T_Base_Device where F_HaveGoods >0 and F_DeviceIndex =" + this._deviceIndex).Tables[0].DefaultView;
|
||
|
// if (dv.Count > 0)
|
||
|
// {
|
||
|
// lblGoods.Text = "������";
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// lblGoods.Text = "������";
|
||
|
// }
|
||
|
// }
|
||
|
//else
|
||
|
//{
|
||
|
// lblGoods.Text = "";
|
||
|
//}
|
||
|
//20120417��ԤԼ�ĵ�������
|
||
|
dv = dbo.ExceSQL(string.Format("SELECT F_MonitorIndex FROM T_Monitor_Task WHERE (F_ManageTaskKindIndex = 4 and F_MonitorIndex={0})", Convert.ToInt32(this.lblTaskIndex.Text))).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
lblManTask.Text = "�ֹ�����";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
dv = dbo.ExceSQL(string.Format("select F_ManTaskReserve from T_Base_Device where F_ManTaskReserve>0 and F_DeviceIndex ={0}", this._deviceIndex)).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
int mankind = Convert.ToInt32(dv[0][0].ToString().Substring(0, 1));
|
||
|
int fid = Convert.ToInt32(dv[0][0].ToString().Substring(1));
|
||
|
lblManTask.Text = fid.ToString();
|
||
|
dv = dbo.ExceSQL(string.Format("SELECT F_TxtParam FROM T_Monitor_Task WHERE (F_ManageTaskKindIndex = {0} and F_ManageTaskIndex={1})", mankind, fid)).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
lblBarcode.Text = dv[0][0].ToString(); ;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
lblManTask.Text = "";
|
||
|
}
|
||
|
}
|
||
|
dv = dbo.ExceSQL(string.Format("SELECT F_DeviceIndex,F_PalletBarcodeLength,F_BarCode FROM T_Base_PLC_Ask WHERE (F_Askkind = 4 OR F_Askkind = 13 OR F_Askkind = 14) AND (F_BindingDevice = {0})", this._deviceIndex)).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
|
||
|
//gbBarcode.Visible = true;
|
||
|
CStaticClass.WcfControl.BeginGetReadedAndReportedBarcode(this._deviceIndex, new AsyncCallback(CallbackGetReadedAndReportedBarcode), null);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
gbBarcode.Visible = false;
|
||
|
}
|
||
|
if (_device.Dbw1Address != -1)
|
||
|
{
|
||
|
btnReset.Visible = true;
|
||
|
btnAnswer.Visible = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
btnReset.Visible = false;
|
||
|
btnAnswer.Visible = false;
|
||
|
}
|
||
|
|
||
|
//��ȡ������Ϣ
|
||
|
#region ��ʾ������Ϣ
|
||
|
labelValue0.Text = _device.SplitByte_0.ToString();
|
||
|
labelValue1.Text = _device.SplitByte_1.ToString();
|
||
|
labelValue2.Text = _device.SplitByte_2.ToString();
|
||
|
labelValue3.Text = _device.SplitByte_3.ToString();
|
||
|
labelValue4.Text = _device.SplitByte_4.ToString();
|
||
|
labelValue5.Text = _device.SplitByte_5.ToString();
|
||
|
labelValue6.Text = _device.SplitByte_6.ToString();
|
||
|
labelValue7.Text = _device.SplitByte_7.ToString();
|
||
|
if (_device.DeviceIndex == 11001 || _device.DeviceIndex == 11003)//���˵ĶѶ���
|
||
|
{
|
||
|
labelsignal0.Text = "�л�(.0):";
|
||
|
labelsignal1.Text = "������̽���ź�(.1):";
|
||
|
labelsignal2.Text = "����Զ̽���ź�(.2):";
|
||
|
labelsignal3.Text = "�Զ�ͣ��(.3):";
|
||
|
labelsignal4.Text = "";
|
||
|
labelsignal5.Text = "";
|
||
|
labelsignal6.Text = "";
|
||
|
labelsignal7.Text = "";
|
||
|
|
||
|
labelValue4.Text = "";
|
||
|
labelValue5.Text = "";
|
||
|
labelValue6.Text = "";
|
||
|
labelValue7.Text = "";
|
||
|
|
||
|
}
|
||
|
if (_device.DeviceIndex == 11002)//�м��ĶѶ���
|
||
|
{
|
||
|
labelsignal0.Text = "�л�(.0):";
|
||
|
labelsignal1.Text = "������̽���ź�(1#�Ѷ���)(.1):";
|
||
|
labelsignal2.Text = "����Զ̽���ź�(1#�Ѷ���)(.2):";
|
||
|
labelsignal3.Text = "������̽���ź�(3#�Ѷ���)(.3):";
|
||
|
labelsignal4.Text = "����Զ̽���ź�(3#�Ѷ���)(.4):";
|
||
|
labelsignal5.Text = "�Զ�ͣ��(.5):";
|
||
|
labelsignal6.Text = "";
|
||
|
labelsignal7.Text = "";
|
||
|
|
||
|
labelValue6.Text = "";
|
||
|
labelValue7.Text = "";
|
||
|
|
||
|
}
|
||
|
if (_device.DeviceIndex >= 12001 && _device.DeviceIndex <= 12003)//���
|
||
|
{
|
||
|
if (_device.DeviceIndex == 12002)
|
||
|
{
|
||
|
labelsignal0.Text = "���ͻ���������(.0):";
|
||
|
labelsignal1.Text = "���ͻ���λ����(.1):";
|
||
|
labelsignal2.Text = "���ͻ���λ����(.2):";
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
labelsignal0.Text = "���ͻ���������(.0):";
|
||
|
labelsignal1.Text = "���ͻ�����������ȡ��(.1):";
|
||
|
labelsignal2.Text = "���ͻ������������ͻ�(.2):";
|
||
|
}
|
||
|
labelsignal3.Text = "";
|
||
|
labelsignal4.Text = "";
|
||
|
labelsignal5.Text = "";
|
||
|
labelsignal6.Text = "";
|
||
|
labelsignal7.Text = "";
|
||
|
|
||
|
labelValue3.Text = "";
|
||
|
labelValue4.Text = "";
|
||
|
labelValue5.Text = "";
|
||
|
labelValue6.Text = "";
|
||
|
labelValue7.Text = "";
|
||
|
}
|
||
|
if (_device.DeviceIndex >= 13001 && _device.DeviceIndex <= 13007)//̨��
|
||
|
{
|
||
|
|
||
|
labelsignal0.Text = "̨����������(.0):";
|
||
|
labelsignal1.Text = "̨����λ����(.1):";
|
||
|
labelsignal2.Text = "̨����λ����(.2):";
|
||
|
|
||
|
|
||
|
labelsignal3.Text = "";
|
||
|
labelsignal4.Text = "";
|
||
|
labelsignal5.Text = "";
|
||
|
labelsignal6.Text = "";
|
||
|
labelsignal7.Text = "";
|
||
|
|
||
|
labelValue3.Text = "";
|
||
|
labelValue4.Text = "";
|
||
|
labelValue5.Text = "";
|
||
|
labelValue6.Text = "";
|
||
|
labelValue7.Text = "";
|
||
|
}
|
||
|
if (_device.DeviceIndex >= 15001 && _device.DeviceIndex <= 15009)//���
|
||
|
{
|
||
|
labelsignal0.Text = "��λ�������Ѷ�������(.0):";
|
||
|
labelsignal1.Text = "�����������(.1):";
|
||
|
labelsignal2.Text = "��λ����ʼ����(.2):";
|
||
|
labelsignal3.Text = "�Ѷ���������λ������(.3):";
|
||
|
labelsignal4.Text = "�Ѷ����Ż�����(.4):";
|
||
|
labelsignal5.Text = "�Ѷ���ȡ������(.5):";
|
||
|
labelsignal6.Text = "";
|
||
|
labelsignal7.Text = "";
|
||
|
|
||
|
labelValue6.Text = "";
|
||
|
labelValue7.Text = "";
|
||
|
|
||
|
}
|
||
|
if (_device.DeviceIndex == 15010)//���
|
||
|
{
|
||
|
labelsignal0.Text = "��λ���������ͻ�����(.0):";
|
||
|
labelsignal1.Text = "��λ����ʼ����(.1):";
|
||
|
labelsignal2.Text = "��λ����λȡ������(.2):";
|
||
|
labelsignal3.Text = "��λ������ȡ��(.3):";
|
||
|
labelsignal4.Text = "��λ�������Ż�(.4):";
|
||
|
labelsignal5.Text = "���ͻ�������λ������(.5):";
|
||
|
labelsignal6.Text = "���ͻ��Ż�����(.6):";
|
||
|
labelsignal7.Text = "���ͻ�ȡ������(.7):";
|
||
|
}
|
||
|
if (_device.DeviceIndex >= 17001 && _device.DeviceIndex <= 17002)//̽�˻���ʾ�����ź�ҳ��
|
||
|
{
|
||
|
labelsignal0.Text = "̽�˻������Ѷ�������(.0):";
|
||
|
labelsignal1.Text = "̽�˻���λ����(.1):";
|
||
|
labelsignal2.Text = "̽�˻���λ����(.2):";
|
||
|
labelsignal3.Text = "̽�˻�����ȡ������(.3):";
|
||
|
labelsignal4.Text = "��λ������ȡʵ����(.4):";
|
||
|
labelsignal5.Text = "�Ѷ�������̽�˻�����(.5):";
|
||
|
labelsignal6.Text = "�Ѷ����Ż�����(.6):";
|
||
|
labelsignal7.Text = "�Ѷ���ȡ������(.7):";
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
MessageBox.Show(ex.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
}
|
||
|
void CallbackGetReadedAndReportedBarcode(IAsyncResult ar)
|
||
|
{
|
||
|
string errortext, ReadedBarcode, ReportedBarcode;
|
||
|
try
|
||
|
{
|
||
|
bool rt = CStaticClass.WcfControl.EndGetReadedAndReportedBarcode(out ReadedBarcode, out ReportedBarcode, out errortext, ar);
|
||
|
if (rt == true)
|
||
|
{
|
||
|
this.BeginInvoke(new MethodInvoker(delegate ()
|
||
|
{
|
||
|
lblReadedBarcode.Text = ReadedBarcode;
|
||
|
lblReportedBarcode.Text = ReportedBarcode;
|
||
|
}));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.BeginInvoke(new MethodInvoker(delegate ()
|
||
|
{
|
||
|
lblReadedBarcode.Text = "";
|
||
|
lblReportedBarcode.Text = "";
|
||
|
}));
|
||
|
if (errortext != "")
|
||
|
{
|
||
|
MessageBox.Show(errortext, "������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)//20170115
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region �رմ���
|
||
|
private void btnClose_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
this.Close();
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
private void button2_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (MessageBox.Show("��ȷ��Ҫ���豸��" + this._deviceIndex + "��������������", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
try
|
||
|
{
|
||
|
CStaticClass.WcfControl.BeginSetLogicHaveGoods(false, this._deviceIndex, new AsyncCallback(SetLogicHaveGoodsCallBack), null);
|
||
|
btnRefresh_Click(sender, e);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
MessageBox.Show(ex.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void button1_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
|
||
|
if (MessageBox.Show("��ȷ��Ҫ���豸��" + this._deviceIndex + "��������������", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
try
|
||
|
{
|
||
|
CStaticClass.WcfControl.BeginSetLogicHaveGoods(true, this._deviceIndex, new AsyncCallback(SetLogicHaveGoodsCallBack), null);
|
||
|
btnRefresh_Click(sender, e);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
MessageBox.Show(ex.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void button3_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (MessageBox.Show("��ȷ��Ҫ���豸��" + this._deviceIndex + "���͡�����Ӧ��������", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
string errtext = string.Empty;
|
||
|
try
|
||
|
{
|
||
|
CStaticClass.WcfControl.BeginSendDeviceReset(this._deviceIndex, 2, new AsyncCallback(SendDeviceResetCallBack), 2);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
MessageBox.Show(ex.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
void SetLogicHaveGoodsCallBack(IAsyncResult ar)
|
||
|
{
|
||
|
string errtext = string.Empty;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
if (CStaticClass.WcfControl.EndSetLogicHaveGoods(out errtext, ar) == false)
|
||
|
{
|
||
|
MessageBox.Show(errtext, "������ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
void SendDeviceResetCallBack(IAsyncResult ar)
|
||
|
{
|
||
|
string errtext = string.Empty;
|
||
|
|
||
|
|
||
|
try
|
||
|
{
|
||
|
if (CStaticClass.WcfControl.EndSendDeviceReset(out errtext, ar) == false)
|
||
|
{
|
||
|
MessageBox.Show(errtext, "������ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ar.AsyncState != null)
|
||
|
{
|
||
|
//if ((((int)ar.AsyncState) == 4)&&(_device.DeviceKind==4))
|
||
|
//{
|
||
|
// CStaticClass.WcfControl.BeginSendDeviceReset(_deviceIndex, 2, new AsyncCallback(SendDeviceResetCallBack), null);
|
||
|
//}
|
||
|
if (((int)ar.AsyncState) == 2 || ((int)ar.AsyncState) == 4)
|
||
|
{
|
||
|
CStaticClass.WcfControl.BeginSendDeviceReset(_deviceIndex, 0, new AsyncCallback(SendDeviceResetCallBack), null);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
private void lblDeviceIndex_ValueChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
_deviceIndex = int.Parse(lblDeviceIndex.Value.ToString());
|
||
|
}
|
||
|
|
||
|
private void FrmDeviceStatus_FormClosing(object sender, FormClosingEventArgs e)
|
||
|
{
|
||
|
_formInstance = null;
|
||
|
}
|
||
|
|
||
|
private void button4_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (MessageBox.Show("��ȷ��Ҫ���豸��" + this._deviceIndex + "���͡��豸��λ������", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
string errtext = string.Empty;
|
||
|
try
|
||
|
{
|
||
|
CStaticClass.WcfControl.BeginSendDeviceReset(this._deviceIndex, 4, new AsyncCallback(SendDeviceResetCallBack), 4);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
MessageBox.Show(ex.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
int GetMonitorTaskIndexFromBarCode(StringBuilder BarCode)
|
||
|
{//20110216
|
||
|
string bc = BarCode.ToString();
|
||
|
|
||
|
DataView dv = dbo.ExceSQL(string.Format("SELECT T_Monitor_Task.F_MonitorIndex FROM T_Base_Device,T_Monitor_Task WHERE T_Base_Device.F_DeviceIndex = T_Monitor_Task.F_DeviceIndex and ((T_Base_Device.F_DeviceKindIndex = 13) OR (T_Base_Device.F_DeviceKindIndex = 31)) and (F_TxtParam = '{0}') and F_Status>0 order by F_MonitorIndex asc", bc)).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
return Convert.ToInt32(dv[0]["F_MonitorIndex"]);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
void WriteDBDataCallback(IAsyncResult ar)
|
||
|
{
|
||
|
string errtext;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
if (CStaticClass.WcfControl.EndWriteDBData(out errtext, ar) == false)
|
||
|
{
|
||
|
MessageBox.Show("������ʾ", errtext, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
private void lblBarcode_KeyPress(object sender, KeyPressEventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if (e.KeyChar == '\r')
|
||
|
{
|
||
|
if (MessageBox.Show("��ȷ��Ҫ���豸��" + this._deviceIndex + "����¼�ġ����롿����", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
int type = 1;//1��asc��Ĭ��Ϊʵ�����̣��л�
|
||
|
if (cB_Empty.Checked == false)//������
|
||
|
{
|
||
|
type = 0;//0��asc��
|
||
|
}
|
||
|
string barcode = string.Format("{0}{1}", type, lblBarcode.Text);
|
||
|
CStaticClass.WcfControl.BeginWriteDBData(_deviceIndex, "DB2", barcode, new AsyncCallback(WriteDBDataCallback), null);
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
MessageBox.Show(ex.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void btCancelDoubleFork_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (MessageBox.Show("��ȷ��Ҫȡ����" + this._deviceIndex + "����˫����������", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
StringBuilder sql = new StringBuilder();
|
||
|
sql.Append("update T_Base_PLC_Ask set F_TaskIndex=0,F_Remark='' where F_DeviceIndex=").Append(_deviceIndex);
|
||
|
dbo.ExecuteSql(sql.ToString());
|
||
|
|
||
|
}
|
||
|
|
||
|
private void btnSolutions_Click(object sender, EventArgs e)
|
||
|
{//20151120
|
||
|
try
|
||
|
{
|
||
|
if (_device != null)
|
||
|
{
|
||
|
if (_device.ErrorCode >= 30)
|
||
|
{
|
||
|
FrmDeviceErrorSolutions.FormInstance.Show();
|
||
|
FrmDeviceErrorSolutions.FormInstance.comboBox1.SelectedValue = _device.DeviceKind;
|
||
|
FrmDeviceErrorSolutions.FormInstance.textBox1.Text = _device.ErrorCode.ToString();
|
||
|
FrmDeviceErrorSolutions.FormInstance.button1_Click(sender, e);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void btHandAddCode_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (MessageBox.Show("��ȷ��Ҫ�ֶ������뵽��" + this._deviceIndex + "���豸����", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
DataView dvsp = new DataView(); ;
|
||
|
try
|
||
|
{
|
||
|
dvsp = dbo.ExceSQL(string.Format("select * from T_Base_PLC_Ask WHERE (F_DeviceIndex = {0}) ", _deviceIndex)).Tables[0].DefaultView; //20130510F_ManageAskkind
|
||
|
if (dvsp.Count > 0)
|
||
|
{
|
||
|
StringBuilder warehouse = new StringBuilder(dvsp[0]["F_WareHouse"].ToString());
|
||
|
int dcode = Convert.ToInt32(dvsp[0]["F_BindingDevice"]);
|
||
|
int apptype = Convert.ToInt32(dvsp[0]["F_ManageAskkind"]);//20130510
|
||
|
int Weight = 1000;
|
||
|
bool ifSQLServer = true;
|
||
|
if (dboMan.GetValue("ManDBFactory") == "OracleDBFactory")
|
||
|
{
|
||
|
ifSQLServer = false;
|
||
|
}
|
||
|
//�����ֶβ���д int appid = dboMan.GetManageTableIndex("IO_CONTROL_APPLY", ifSQLServer);//CONTROL_APPLY_ID
|
||
|
int appid = 1;
|
||
|
_device = Model.CGetInfo.GetDeviceInfo(_deviceIndex);
|
||
|
|
||
|
StringBuilder dtime = new StringBuilder(DateTime.Now.ToString("u").Substring(0, 19));
|
||
|
|
||
|
if (_device.DeviceKind == 7)// ��������ɨ��ʧ�ܣ��ֶ���������/���Խӿ�
|
||
|
{
|
||
|
|
||
|
|
||
|
int count = int.TryParse(tbAddCount.Text, out count) == false ? 1 : Convert.ToInt32(tbAddCount.Text);
|
||
|
Weight = int.TryParse(tbAddCount.Text, out count) == false ? 1 : Convert.ToInt32(tbAddCount.Text);
|
||
|
int CheckHigh = 1;
|
||
|
|
||
|
int n = 0;
|
||
|
|
||
|
object[] ob = new object[10] { apptype, dcode, tbAddBarcode.Text, 0, dtime, Weight.ToString(), warehouse.ToString(), appid, CheckHigh.ToString(), tbAddCount.Text };
|
||
|
|
||
|
// ����appid
|
||
|
n = dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_PARAMETER,WAREHOUSE_CODE,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{8}','{9}')", ob));
|
||
|
|
||
|
//dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_ID,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}',{7},'{8}','{9}')", ob));
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "������������������:", _deviceIndex.ToString(), " վ̨��" + dcode + "**���룺" + tbAddBarcode.Text.ToUpper() + "���߶ȣ�" + CheckHigh + ",������" + Weight + ",����" + count);//20140218
|
||
|
|
||
|
dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_BarCode = '{1}',F_Time='{2}' WHERE (F_DeviceIndex = {0}) ", _deviceIndex, tbAddBarcode.Text, DateTime.Now.ToString("u").Substring(0, 19)));
|
||
|
|
||
|
|
||
|
if (n > 0)
|
||
|
{
|
||
|
MessageBox.Show("�������ͻ�" + dcode + "�豸�����ɹ����Ѿ��������룺" + tbAddBarcode.Text + "�����룬�뵽���������鿴��", "������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.None);
|
||
|
}
|
||
|
}
|
||
|
if (_device.DeviceKind == 35 || _device.DeviceKind == 34)// �ֶ����ӵ��̻�����/���Խӿ�;���ӿ����������г���
|
||
|
{
|
||
|
int count = int.TryParse(tbAddCount.Text, out count) == false ? 1 : Convert.ToInt32(tbAddCount.Text);
|
||
|
Weight = int.TryParse(tbAddCount.Text, out count) == false ? 1 : Convert.ToInt32(tbAddCount.Text);
|
||
|
int CheckHigh = 1;
|
||
|
|
||
|
int n = 0;
|
||
|
|
||
|
object[] ob = new object[10] { apptype, dcode, "", 0, dtime, Weight.ToString(), warehouse.ToString(), appid, CheckHigh.ToString(), count };
|
||
|
|
||
|
// ����appid
|
||
|
//n = dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_PARAMETER,WAREHOUSE_CODE,CONTROL_APPLY_ID,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}',{7},'{8}','{9}')", ob));
|
||
|
n = dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_PARAMETER,WAREHOUSE_CODE,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{8}','{9}')", ob));
|
||
|
|
||
|
|
||
|
//dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_ID,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}',{7},'{8}','{9}')", ob));
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "������������������:", _deviceIndex.ToString(), " վ̨��" + dcode + "**���룺" + tbAddBarcode.Text.ToUpper() + "���߶ȣ�" + CheckHigh + ",������" + Weight + ",����" + count);//20140218
|
||
|
|
||
|
dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_BarCode = '{1}',F_Time='{2}' WHERE (F_DeviceIndex = {0}) ", _deviceIndex, tbAddBarcode.Text, DateTime.Now.ToString("u").Substring(0, 19)));
|
||
|
|
||
|
if (n > 0)
|
||
|
{
|
||
|
MessageBox.Show("���ĵ��̻�" + this._deviceIndex + "�����ɹ����Ѿ�������������������" + count + "�����룬�뵽���������鿴��", "������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.None);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
//RefreshMonitorEventArgs rmea = new RefreshMonitorEventArgs("tsStatus", "������������������ʱ����������" + ex.StackTrace + ex.Message);
|
||
|
//OnRefreshMonitor(rmea);
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "������������������ʱ��������:", _deviceIndex.ToString(), ex.StackTrace + ex.Message);//20140218
|
||
|
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
dvsp.Dispose();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|