山东时代原料后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.

855 lines
34 KiB

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;
/// <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
{
_device = Model.CGetInfo.GetDeviceInfo(_deviceIndex);
//20100108
if (_device == null)
{
MessageBox.Show("您选择的设备在数据库没有记录!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
#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;
}
else
{
this.btCancelDoubleFork.Visible = false;
this.btLogicHaveGoods.Visible = false;
this.btLogicNoneGoods.Visible = false;
textBox1.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;
}
if (_device.ManTaskReserve.ToString().Length > 0) {
string fid = _device.ManTaskReserve.ToString().Substring(1);
string sql1 = $"select FPALLETBARCODE from T_Manage_Task where FID={fid}";
DataView data = dbo.ExceSQL(sql1).Tables[0].DefaultView;
if (data.Count > 0)
{
this.lblBarcode.Text = data[0]["FPALLETBARCODE"].ToString();
}
}
}
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;
}
this.lblBarcode.Text = dv[0]["F_TxtParam"].ToString();
}
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.lblBarcode.Text = dv[0]["F_TxtParam"].ToString();
}
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;
}
if ((_device.DeviceKind == 1))
{
//this.lblTaskIndex.Text = GetMonitorTaskIndexFromBarCode(new StringBuilder(_device.Barcode)).ToString();
//this.lblBarcode.Text = _device.Barcode;
this.lblBarcode.Enabled = true;
//this.gb03.Visible = false;
//this.textBox2.Text = _device.Battery_Status.ToString();
//this.textBox3.Text = _device.Mile.ToString();
//this.textBox4.Text = _device.Time.ToString();//民航二所
}
else
{
//this.gb03.Visible = false;
}
if (_device.DeviceIndex >= 30002 && _device.DeviceIndex <= 30005)
{
lblBarcode.Enabled = true;
}
if ((_deviceIndex < 30002 || _deviceIndex > 30009) && (!_deviceIndex.ToString().StartsWith("1510")))
{
//设备状态
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;
}
}
else if (_deviceIndex.ToString().StartsWith("1510")) {
switch (_device.RunState)
{
case 0:
lblDeviceStatus.Text = "入库";
break;
case 1:
lblDeviceStatus.Text = "出库";
break;
default:
break;
}
}
else
{//AGV交互信号
switch (_device.RunState)
{
case 0:
lblDeviceStatus.Text = "无";
break;
case 3:
lblDeviceStatus.Text = "离线";
break;
case 1:
lblDeviceStatus.Text = "取货中(取货申请)";
break;
case 2:
lblDeviceStatus.Text = "取货完成";
break;
case 4:
lblDeviceStatus.Text = "放货中(放货申请)";
break;
case 5:
lblDeviceStatus.Text = "放货完成";
break;
case 6:
lblDeviceStatus.Text = "取货申请";
break;
case 7:
lblDeviceStatus.Text = "放货申请";
break;
case 9:
lblDeviceStatus.Text = "AGV已离开";
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))
{
label_X.Text = "当前X坐标:";
label_Y.Text = "当前Y坐标:";
this.lblNowX.Text = string.Format("{0:D2}列", _device.XCoor);
this.lblNowY.Text = string.Format("{0:D2}层", _device.YCoor);
//this.lblNowY.Text = _device.YCoor.ToString();
}
else if ((_device.DeviceKind == 4))
{
label_X.Text = "当前X坐标:";
label_Y.Text = "当前Y坐标:";
this.lblNowX.Text = string.Format("{0:D2}层", _device.XCoor);//民航二所
this.lblNowY.Text = string.Format("{0:D2}", _device.YCoor);
}
else if (_device.DeviceIndex.ToString().StartsWith("3000")) {
label_X.Text = "是否允许取货";
label_Y.Text = "是否允许放货";
this.lblNowX.Text = _device.SplitByte_0==1?"允许取货":"不允许取货";//民航二所
this.lblNowY.Text = _device.SplitByte_6 == 1 ? "允许放货" : "不允许放货";
DataView dv1 = dbo.ExceSQL("select F_AGVTaskBarCode from T_AGVIOStation where F_PLCOtherDevice =" + this._deviceIndex).Tables[0].DefaultView;
lblBarcode.Text = dv1[0]["F_AGVTaskBarCode"].ToString();
}
else
{
label_X.Text = "当前X坐标:";
label_Y.Text = "当前Y坐标:";
this.lblNowX.Text = "";
this.lblNowY.Text = "";
}
cB_Empty.Enabled = false;
if (_device.DeviceKind == 2)
{
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 = "";
}
// label_X.Text = "当前X坐标:";
if (_device.DeviceKind == 7)
{
lblErrorName.Text = "";
dv = dbo.ExceSQL(string.Format("SELECT F_BarCode ,F_Time,F_TempFirstProject,F_FirstProject,F_Hight,f_Size 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 = "物料条码";
lblNowY.Text = dv[0]["F_Hight"].ToString();
label_Y.Text = "高度";
if (Convert.ToInt32(dv[0]["F_Hight"])>30)
{
lblNowY.Text = dv[0]["F_Hight"].ToString() ;
var dv1 = dbo.ExceSQL(string.Format("SELECT F_ErrorName FROM T_Base_Device_State WHERE (F_DeviceKindIndex = {0} and F_DeviceErrorIndex={1})", _device.DeviceKind, Convert.ToInt32(dv[0]["F_Hight"]))).Tables[0].DefaultView;
if (dv1.Count > 0)
{
//label5.Text = "";
lblErrorName.Text = dv1[0]["F_ErrorName"].ToString();
}
else
{
lblErrorName.Text = dv1[0]["F_Hight"].ToString();
}
}
if (dv[0]["F_Size"].ToString() != null)
{
label13.Text = "重量";
lblGoods.Text = dv[0]["F_Size"].ToString();
}
else {
label13.Text = "是否逻辑有物:";
}
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 = "";
}
//是否逻辑有物
//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));
long fid = Convert.ToInt64(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;
}
if (_device.DeviceIndex.ToString().StartsWith("3000"))
{
AGVStatesUpdate.Visible = true;
btnReset.Visible = false;
btnAnswer.Visible = false;
}
else {
AGVStatesUpdate.Visible = false;
btnReset.Visible = true;
btnAnswer.Visible = true;
}
}
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;
}
if (_deviceIndex == 17001 || _deviceIndex == 17003 || _deviceIndex == 17004 || _deviceIndex == 17005) {//补码无法补上重量和高度,影响和安脉的对接
MessageBox.Show("入库站台扫码器不能补码,请重新扫码称重");
return;
}
int type = 1;//1的asc码默认为实物托盘,有货
if(cB_Empty.Checked==false)//空托盘
{
type = 0;//0的asc码
}
string barcode = 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 AGVStatesUpdate_Click(object sender, EventArgs e)
{
if (MessageBox.Show("您确认要置位【" + this._deviceIndex + "】的AGV交互的离开信号吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
{
return;
}
StringBuilder sql = new StringBuilder();
sql.Append("update T_AGVIOStation set F_AGVStatus=9 where F_PLCOtherDevice=").Append(_deviceIndex);
int count =dbo.ExecuteSql(sql.ToString());
if (count == 1)
{
MessageBox.Show("状态更新成功");
}
else {
MessageBox.Show("状态更新成功");
}
}
}
}