天津康师傅调度系统
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.
 
 

1610 lines
76 KiB

using System;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace wcfControlMonitorClient
{
/// <summary>
/// Creator:Richard.liu
/// 调度程序主窗口
/// </summary>
public partial class FrmControlMonitor : WeifenLuo.WinFormsUI.Docking.DockContent
{
StringBuilder sql = new StringBuilder();
Model.MDevice devinfo;
Model.MDevice devinfostop;
FrmDeviceStatus _deviceStatus = new FrmDeviceStatus();
DBFactory.DBOperator dbo = CStaticClass.dbo;
DBFactory.DBOperator dboM = CStaticClass.dboM;
DBFactory.DBOperator dbo1 = new DBFactory.DBOperator();
private static FrmControlMonitor _formInstance;
public static FrmControlMonitor FormInstance
{
get
{
if (_formInstance == null)
{
_formInstance = new FrmControlMonitor();
}
return _formInstance;
}
set { _formInstance = value; }
}
public FrmControlMonitor()
{
InitializeComponent();
//this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
////设定字体大小为12px
//this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134)));
_formInstance = this;
DataView ds = dbo.ExceSQL("SELECT F_DeviceIndex,F_BindingDevice,F_DeviceName FROM T_Base_PLC_Ask where F_Askkind = 4 ").Tables[0].DefaultView;
if (ds.Count > 0)
{
cbBarCodeReader.ValueMember = "F_BindingDevice";
cbBarCodeReader.DisplayMember = "F_DeviceName";
cbBarCodeReader.DataSource = ds;
}
}
#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;
TimeSpan ts = DateTime.Now.TimeOfDay;
DataView dv; DataView dvJY;
this.SuspendLayout(); //richard.liu20140806
try
{
//if (CStaticClass.WCFOK == true)
{
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";
#region 堆垛机绑定
Button stack1 = bStack1;
Button stack2 = bStack1;
Button stack3 = bStack1;
Button stack4 = bStack1;
Button stack5 = bStack1;
Button stack6 = bStack1;
Button stack7 = bStack1;
Button stack8 = bStack1;
Button stack9 = bStack1;
Button stack10 = bStack1;
Button stack11 = bStack1;
Button stack12 = bStack1;
Button stack13 = bStack1;
Button stack14 = bStack1;
Button stack15 = bStack1;
Button stack16 = bStack1;
Button stack17 = bStack1;
Button stack18 = bStack1;
Button stack19 = bStack1;
Button stack20 = bStack1;
Button stack21 = bStack1;
Button stack22 = bStack1;
Button stack23 = bStack1;
Button stack24 = bStack1;
TextBox tw1n = tb1;
TextBox tw2n = tb1;
TextBox tw3n = tb1;
TextBox tw4n = tb1;
TextBox tw5n = tb1;
TextBox tw6n = tb1;
TextBox tw7n = tb1;
TextBox tw8n = tb1;
TextBox tw9n = tb1;
TextBox tw10n = tb1;
TextBox tw11n = tb1;
TextBox tw12n = tb1;
TextBox tw13n = tb1;
TextBox tw14n = tb1;
TextBox tw15n = tb1;
TextBox tw16n = tb1;
TextBox tw17n = tb1;
TextBox tw18n = tb1;
TextBox tw19n = tb1;
TextBox tw20n = tb1;
TextBox tw21n = tb1;
TextBox tw22n = tb1;
TextBox tw23n = tb1;
TextBox tw24n = tb1;
//step 堆垛机之间的距离长度,areastep立库区域之间的额外长度
int step = 105; int areastep = 65;
double startadd = 241;//第1个图上坐标 列起点
Panel pp = plAccessorial1;
if (this.tabControl1.SelectedTab.Name == "tabPage2")
{
pp = plAccessorial2;
stack1 = bStack1;
stack2 = bStack2;
stack3 = bStack3;
stack4 = bStack4;
stack5 = bStack5;
stack6 = bStack6;
stack7 = bStack7;
stack8 = bStack8;
stack9 = bStack9;
stack10 = bStack10;
stack11 = bStack11;
stack12 = bStack12;
tw1n = tb1;
tw2n = tb2;
tw3n = tb3;
tw4n = tb4;
tw5n = tb5;
tw6n = tb6;
tw7n = tb7;
tw8n = tb8;
tw9n = tb9;
tw10n = tb10;
tw11n = tb11;
tw12n = tb12;
//areastep = 25;
//startadd = 154;
startadd = 423;
}
else if(this.tabControl1.SelectedTab.Name == "tabPage3")
{
pp = plAccessorial3;
stack1 = bStack13;
stack2 = bStack14;
stack3 = bStack15;
stack4 = bStack16;
stack5 = bStack17;
stack6 = bStack18;
stack7 = bStack19;
stack8 = bStack20;
stack9 = bStack21;
stack10 = bStack22;
stack11 = bStack23;
stack12 = bStack24;
tw1n = tb13;
tw2n = tb14;
tw3n = tb15;
tw4n = tb16;
tw5n = tb17;
tw6n = tb18;
tw7n = tb19;
tw8n = tb20;
tw9n = tb21;
tw10n = tb22;
tw11n = tb23;
tw12n = tb24;
//areastep = 80;
//startadd = 300;
startadd = 570;
}
#endregion 堆垛机绑定
#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;
}
//不显示禁用的互斥堆垛机 20181008
if (device.DeviceIndex == 12003)
{
int a = 2 + 1;
}
#region 动画
if (device.DeviceKind == 1)
{
#region 托盘
//if (device.DeviceIndex >= 11001 && device.DeviceIndex <= 11008)
{
double k = (double)(300) / (double)95;//图上货架长度/货架列数,
////double k = (double)(1070) / (double)13100;//图上货架长度/货架实际长度
////double k = (double)(panel_Length.Size.Height - 40) / (double)11947;//1067/40560
////double k = 0.0263067;//1067/40560
////double startcode = 901;//第一列对应的实际坐标
double a = 0;
int xcoor = device.XCoor;
int zcoor = device.ZCoor;
if (device.DeviceIndex == 11001 )
{
if (textBox_code.Text != "")
{
xcoor = Convert.ToInt32(textBox_code.Text);
}
if (textBox_stackZ.Text != "")
{
zcoor = Convert.ToInt32(textBox_stackZ.Text);
}
}
int locationY = (int)startadd; //堆垛机在站台位置的X坐标
if (xcoor == 1)
{
//locationX += stack1.Size.Width; //原点在货架右侧
//locationX -= stack1.Size.Width; //原点在货架左侧
//CCDG2 原点与货架对齐
}
else
{
//locationX = (int)(startadd + a - k * (xcoor - 2)); //原点在货架右侧
//locationX = (int)(startadd + a + k * (xcoor - 2)); //原点在货架左侧
//locationY = (int)(startadd + a + k * (xcoor - 1)); //原点在货架上侧
locationY = (int)(startadd + a - k * (xcoor - 1)); //原点在货架下侧
}
//int locationX = (int)(startadd + a + k * (xcoor - 2)); //堆垛机在站台位置的X坐标
int locationX = 40;
int twx = 8, twy = 7;
switch (device.DeviceIndex)
{
case 11001:
case 11013:
if (stack1.Location.X != locationX || stack1.Location.Y != locationY)
{
stack1.Location = new Point(locationX, locationY);
tw1n.Location = new Point(locationX + twx, locationY + twy);
//tw1n.Location = new Point(tw1n.Location.X, locationY + 10);
//label_barcode1.Location = new Point(locationX + 4, label_barcode1.Location.Y);
}
break;
case 11002:
case 11014:
locationX += step;
if (stack2.Location.X != locationX || stack2.Location.Y != locationY)
{
stack2.Location = new Point(locationX, locationY);
tw2n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11003:
case 11015:
locationX += step*2;
if (stack3.Location.X != locationX || stack3.Location.Y != locationY)
{
stack3.Location = new Point(locationX, locationY);
tw3n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11004:
case 11016:
locationX += step * 3;
if (stack4.Location.X != locationX || stack4.Location.Y != locationY)
{
stack4.Location = new Point(locationX, locationY);
tw4n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11005:
case 11017:
locationX += step * 4;
if (stack5.Location.X != locationX || stack5.Location.Y != locationY)
{
stack5.Location = new Point(locationX, locationY);
tw5n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11006:
case 11018:
locationX += step * 5;
if (stack6.Location.X != locationX || stack6.Location.Y != locationY)
{
stack6.Location = new Point(locationX, locationY);
tw6n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11007:
case 11019:
locationX += step * 6+ areastep;
if (stack7.Location.X != locationX || stack7.Location.Y != locationY)
{
stack7.Location = new Point(locationX, locationY);
tw7n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11008:
case 11020:
locationX += step * 7+ areastep;
if (stack8.Location.X != locationX || stack8.Location.Y != locationY)
{
stack8.Location = new Point(locationX, locationY);
tw8n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11009:
case 11021:
locationX += step * 8 + areastep;
if (stack9.Location.X != locationX || stack9.Location.Y != locationY)
{
stack9.Location = new Point(locationX, locationY);
tw9n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11010:
case 11022:
locationX += step * 9 + areastep;
if (stack10.Location.X != locationX || stack10.Location.Y != locationY)
{
stack10.Location = new Point(locationX, locationY);
tw10n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11011:
case 11023:
locationX += step * 10 + areastep;
if (stack11.Location.X != locationX || stack11.Location.Y != locationY)
{
stack11.Location = new Point(locationX, locationY);
tw11n.Location = new Point(locationX + twx, locationY + twy);
}
break;
case 11012:
case 11024:
locationX += step * 11 + areastep;
if (stack12.Location.X != locationX || stack12.Location.Y != locationY)
{
stack12.Location = new Point(locationX, locationY);
tw12n.Location = new Point(locationX + twx, locationY + twy);
}
break;
}
}
#endregion
#region 大托盘
//if (device.DeviceIndex >= 11002 && device.DeviceIndex <= 11002)
//{
// double startadd = 235;//第一列图上坐标//590
// double k = (double)(1048) / (double)32.5;//图上货架长度/货架实际长度850 58堆垛机图上大小
// ////double k = (double)(760) / (double)32330;//图上货架长度/货架实际长度
// ////double k = (double)(panel_Length.Size.Height - 40) / (double)11947;//1067/40560
// ////double k = 0.0263067;//1067/40560
// ////double startcode = 901;//第一列对应的实际坐标
// double a = 0;
// int xcoor = device.XCoor;
// int zcoor = device.ZCoor;
// if (device.DeviceIndex == 11002)
// {
// if (textBox_code1.Text != "")
// {
// xcoor = Convert.ToInt32(textBox_code1.Text);
// }
// if (textBox_stackZ1.Text != "")
// {
// zcoor = Convert.ToInt32(textBox_stackZ1.Text);
// }
// }
// int locationX = (int)(startadd + a + k * (xcoor - 2));
// if (xcoor == 1)
// {
// locationX = 184;
// }
// int locationY = 454;
// if (zcoor == 2)
// {
// locationY = 642;
// }
// if (zcoor == 3)
// {
// locationX = 1332;
// locationY = 551;
// }
// switch (device.DeviceIndex)
// {
// case 11002:
// if (stack2.Location.X != locationX || stack1.Location.Y != locationY)
// {
// stack2.Location = new Point(locationX, locationY);
// tw2n.Location = new Point(locationX + 16, locationY+9);
// //tw1n.Location = new Point(tw1n.Location.X, locationY + 10);
// //label_barcode1.Location = new Point(locationX + 4, label_barcode1.Location.Y);
// }
// break;
// }
//}
#endregion
}
else if (device.DeviceKind == 4)
{//RGV
//double startadd = 700;//第一列图上坐标//730
//double k = (double)(700-382) / (double)27765;//图上货架长度/货架实际长度
//double startcode = 790;//第一列对应的实际坐标
//int xcoor = device.XCoor;
//if (device.DeviceIndex == 33003)
//{
// if (textBox_code1.Text != "")
// {
// xcoor = Convert.ToInt32(textBox_code1.Text);
// }
//}
//int locationX = (int)(startadd - k * (xcoor - startcode));
//switch (device.DeviceIndex)
//{
// case 33003:
// if (bt_33003.Location.X != locationX)
// {
// bt_33003.Location = new Point(locationX, bt_33003.Location.Y);
// tb_33003.Location = new Point(locationX + 13, tb_33003.Location.Y);
// }
// break;
//}
}
else if (device.DeviceKind == 2)//台车
{//RGV
#region 台车
if (device.DeviceIndex >= 13001 && device.DeviceIndex <= 13007)
{
int nearY = 314;
int farY = 337;
if (device.SplitByte_1 == 1)//停靠在近位置
{
if (ctrl.Location.Y != nearY)
{
ctrl.Location = new Point(ctrl.Location.X, nearY);
}
}
else
if (device.SplitByte_2 == 1)//停靠在远位置
{
if (ctrl.Location.Y != farY)
{
ctrl.Location = new Point(ctrl.Location.X, farY);
}
}
switch (device.DeviceIndex)
{
//case 13001:
// tb13001.Location = new Point(tb13001.Location.X, ctrl.Location.Y+7);
// break;
//case 13002:
// tb13002.Location = new Point(tb13002.Location.X, ctrl.Location.Y + 7);
// break;
//case 13003:
// tb13003.Location = new Point(tb13003.Location.X, ctrl.Location.Y + 7);
// break;
//case 13004:
// tb13004.Location = new Point(tb13004.Location.X, ctrl.Location.Y + 7);
// break;
//case 13005:
// tb13005.Location = new Point(tb13005.Location.X, ctrl.Location.Y + 7);
// break;
//case 13006:
// tb13006.Location = new Point(tb13006.Location.X, ctrl.Location.Y + 7);
// break;
//case 13007:
// tb13007.Location = new Point(tb13007.Location.X, ctrl.Location.Y + 7);
// break;
}
}
#endregion
}
#endregion
#region 设置设备状态
switch (device.RunState)
{
//空闲
case 0:
if (device.DeviceKind == 1 || device.DeviceKind == 4 || device.DeviceKind == 17)
{
if (device.ControlMode > 0)
{
ctrl.BackColor = Color.DarkViolet;
}
else
{
ctrl.BackColor = Color.Orange;
}
}
else
{
if (device.DeviceIndex >= 13014 && device.DeviceIndex <= 13015)
{
ctrl.BackColor = Color.LightPink;
}
//else if (device.DeviceIndex == 12014 || device.DeviceIndex == 12018 || device.DeviceIndex == 12022)
//{
// ctrl.BackColor = Color.LightPink;
//}
else if (device.DeviceIndex >= 19001 && device.DeviceIndex <= 19003)
{
ctrl.BackColor = Color.Khaki;
}
else if (device.DeviceIndex >= 13007 && device.DeviceIndex <= 13008)
{
ctrl.BackColor = Color.Khaki;
}
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;
}
#endregion
#region 设备被禁用
//richar.liu20140806
int index = dvJY.Find(device.DeviceIndex);
if (index >= 0)
{
ctrl.BackColor = Color.Maroon;
}
if (device.VirtualStack > 0 && index >= 0)//互斥堆垛机被禁用
{
ctrl.Visible = false;
}
else
{
ctrl.Visible = true;
}
#endregion
}
//foreach (TextBox ctrl in pp.Controls.OfType<TextBox>())
//{
// if (ctrl.Tag.ToString() == "11001.0" || ctrl.Tag.ToString() == "11002.0" || ctrl.Tag.ToString() == "11003.0")
// {
// int bbb = 3;
// bbb = bbb + 1;
// }else
// {
// continue;
// }
//}
#region 货物探测
foreach (TextBox ctrl in pp.Controls.OfType<TextBox>())
{
if (ctrl.Tag == null || ctrl.Tag.ToString() == "") continue; //2019.10.28 zcy
DS = ctrl.Tag.ToString().Split(dd);
if (DS.Length != 2) continue;
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;
}
//if (ctrl.Tag.ToString() == "11003.0")
//{
// string s = ctrl.Name;
//}
//if (ctrl.Tag.ToString() == "11003.1")
//{
// string s = ctrl.Name;
//}
//if (device.DeviceIndex == 19002)
//{
// string s = ctrl.Name;
//}
int index = dvJY.Find(device.DeviceIndex);
switch (devbit)
{
case 0:
if (device.VirtualStack > 0 && index >= 0)//互斥堆垛机被禁用
{
ctrl.Visible = false;
}
else
{
ctrl.Visible = device.SplitByte_0 == 1 ? true : false;
}
break;
case 1:
if (device.VirtualStack > 0 && index >= 0)//互斥堆垛机被禁用
{
ctrl.Visible = false;
}
else
{
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 (Label ctrl in pp.Controls.OfType<Label>())
{
if (ctrl.Tag != null && ctrl.Tag.ToString() != "" && ctrl.ForeColor != Color.Red)
{
DS = ctrl.Tag.ToString().Split(dd);
if (DS.Length <= 1) continue; //WXSS
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;
}
if (devbit < 8)
{
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;
}
}
else
{
devbit = devbit % 8;
switch (devbit)
{
case 0:
ctrl.Visible = (device.SplitByte_5 & 1) == 1 ? true : false;
break;
case 1:
ctrl.Visible = (device.SplitByte_5 & 2) == 2 ? true : false;
break;
case 2:
ctrl.Visible = (device.SplitByte_5 & 4) == 4 ? true : false;
break;
case 3:
ctrl.Visible = (device.SplitByte_5 & 8) == 8 ? true : false;
break;
case 4:
ctrl.Visible = (device.SplitByte_5 & 16) == 16 ? true : false;
break;
case 5:
ctrl.Visible = (device.SplitByte_5 & 32) == 32 ? true : false;
break;
case 6:
ctrl.Visible = (device.SplitByte_5 & 64) == 64 ? true : false;
break;
case 7:
ctrl.Visible = (device.SplitByte_5 & 128) == 128 ? 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.ToString()!="")
// {
// DS = ctrl.Tag.ToString().Split(dd);
// if(DS.Length>1)
// {
// 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;
// break;
// case 7:
// ctrl.Visible = device.SplitByte_7 == 1 ? true : false;
// break;
// }
// }
// }
//}
#endregion
//20200303
#region WCS急停、入库灯、安全门
foreach (PictureBox ctrl in pp.Controls.OfType<PictureBox>())
{
if (ctrl.Enabled == false) continue;
if (ctrl.Tag == null || ctrl.Tag.ToString() == "") continue;
if (ctrl.Tag.ToString().IndexOf(".") <= 0)
{
#region 急停按钮
string devicestops = Convert.ToString(ctrl.Tag);
if (devicestops.Length == 7 )
{
int devicestop = Convert.ToInt32(devicestops.Substring(0, 4));//取道堆垛机的设备编号
device = Model.CGetInfo.GetDeviceInfo(devicestop);
if (device != null)
{
Label labelname = new Label();
foreach (Label ll in pp.Controls.OfType<Label>())
{
if (ll.Tag == ctrl.Tag)
{
labelname = ll;
break;
}
}
if (device.SplitByte_6 == 0)//0为急停
{
ctrl.Image = wcfControlMonitorClient.Properties.Resources.stop000;
//labelname.Text = "取消联机停车";
}
else
{
ctrl.Image = wcfControlMonitorClient.Properties.Resources.stop111;
//labelname.Text = " 联机停车";
}
}
//ctrl.Visible = true;
ctrl.Visible = false;
}
#endregion
#region 入库灯
string light = Convert.ToString(ctrl.Tag);
if (light.Length == 5 && (light.IndexOf('.') <= 0))
{
int devicelight = Convert.ToInt32(ctrl.Tag);//入库灯设备编号
device = Model.CGetInfo.GetDeviceInfo(devicelight);
ctrl.Visible = device.RunState == 1 ? true : false;
}
#endregion
continue;
}
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;
break;
case 7:
ctrl.Visible = device.SplitByte_7 == 1 ? true : false;
break;
}
}
#endregion
#region 非管理员不能修改条码
if (CStaticClass.UserID.ToUpper() == "SA" || CStaticClass.UserID.ToUpper() == "ADMIN")
{
cbBarCodeReader.Visible = true;
textBoxApplyCode.Visible = true;
buttonApplyCode.Visible = true;
}
else
{
cbBarCodeReader.Visible = false;
textBoxApplyCode.Visible = false;
buttonApplyCode.Visible = false;
}
#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();
string name = (sender as Control).Name.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 = string.Format("{0},位置X,Y:({1},{2})", devinfo.DeviceName, (sender as Control).Location.X,(sender as Control).Location.Y+83);
msg = string.Format("{0}", devinfo.DeviceName);
if (DS.Length > 1)
{
if (DS[1] == "5")
{
msg = "托盘缓存申请";
}
}
if (name.IndexOf("monitor") > 0)
{
msg = "托盘已在路上";
}
//msg = string.Format("{0}", devinfo.DeviceName);
}
}
}
if(name.IndexOf("lift")>0)
{
msg = "请立即搬离托盘!";
}
toolTip_DeviceIndex.SetToolTip(sender as Control, msg);
}
private void ctrl_ClickPicStop(object sender, EventArgs e)
{
PictureBox btn = (PictureBox)sender;
int devicestop = Convert.ToInt32(btn.Tag);
//int device = Convert.ToInt32(devicestop.ToString().Substring(0, 5));
int device = Convert.ToInt32(devicestop.ToString().Substring(0, 4)); //WXSS
devinfostop = Model.CGetInfo.GetDeviceInfo(device);
if (devinfostop != null)
{
//int iValue = 0;
//iValue = devinfostop.SplitByte_6 == 1 ? 0 : 1;
//CStaticClass.WcfControl.BeginSendDeviceReset(devicestop, iValue, new AsyncCallback(SendDeviceResetCallBack), iValue);
int iValue = 1;
iValue = devinfostop.SplitByte_6 == 0 ? 1 : 0;
//if (iValue == 1)
//{
CStaticClass.WcfControl.BeginSendDeviceReset(devicestop, iValue, new AsyncCallback(SendDeviceResetCallBack), iValue);
//}
}
}
void SendDeviceResetCallBack(IAsyncResult ar)
{
string errtext = string.Empty;
if (CStaticClass.WcfControl.EndSendDeviceReset(out errtext, ar) == false)
{
MessageBox.Show(errtext, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (ar.AsyncState != null)
{
}
}
}
private void ctrl_ClickLabel(object sender, EventArgs e)
{
Label label = (Label)sender;
_deviceStatus.DeviceIndex = Convert.ToInt32(label.Tag);
_deviceStatus.ShowDialog();
}
/// <summary>
/// 滚动方法
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void FormSample_MouseWheel(object sender, MouseEventArgs e)
{
////获取光标位置
//Point mousePoint = new Point(e.X, e.Y);
////换算成相对本窗体的位置
//mousePoint.Offset(this.Location.X, this.Location.Y);
////判断是否在panel内
//if (panelWareHouse.RectangleToScreen(panelWareHouse.DisplayRectangle).Contains(mousePoint))
//{
// //滚动
// panelWareHouse.AutoScrollPosition = new Point(0, panelWareHouse.VerticalScroll.Value - e.Delta);
//}
}
private void FrmControlMonitor_Load(object sender, EventArgs e)
{
try
{
//this.panelWareHouse.MouseWheel += new MouseEventHandler(FormSample_MouseWheel);
//this.panelWareHouse.Focus();
#region 添加输送机、穿梭车和堆垛机的单击事件 (注册事件)
//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);
// }
//}
//foreach (Control ctrl in this.panelWareHouse.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.ForeColor == Color.Blue))
// //{
// // ctrl.Visible = true;
// // ctrl.Visible = false;
// //}
// //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);
// }
//}
//foreach (Control ctrl in this.InOutAreaPanel.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.ForeColor == Color.Blue))
// //{
// // ctrl.Visible = true;
// // ctrl.Visible = false;
// //}
// //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
foreach (TabPage tabPage in tabControl1.TabPages)
{
if (tabPage.Tag.ToString() == CStaticClass.UserArea || CStaticClass.UserArea == "")
{
foreach (Control ctrls in tabPage.Controls)
{
if (ctrls.GetType().ToString() == "System.Windows.Forms.Panel")
{
foreach (Control ctrl in ctrls.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.ForeColor == Color.Fuchsia))
{
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
}
if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
{
//if (Convert.ToString(ctrl.Tag).Length == 7)
if ((Convert.ToString(ctrl.Tag).Length == 6) && (ctrl.Tag.ToString().IndexOf(".")<=0)) //WXSS
{
ctrl.Click += new EventHandler(ctrl_ClickPicStop);
}
else
{
//ctrl.Click += new EventHandler(ctrl_ClickPic);
ctrl.Click += new EventHandler(Btn_MouseEnter);
}
}
}
}
}
}
else
{
tabPage.Parent = null;
}
}
}
catch (Exception ex)
{
throw (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 tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
int index = ((TabControl)sender).SelectedIndex;
if (index == 1)
{
//button242.Focus();
}
}
private void button1_Click(object sender, EventArgs e)
{
StringBuilder endcode = new StringBuilder();
StringBuilder startcode = new StringBuilder();
//if (textBox_in.Text != null && textBox_in.Text != "")
{
for (int i=1; i<9; i++)
{
string index = "1100" + i.ToString();
sql.Clear();
sql.Append("select * from T_Manage_Task where FControlTASKType = 4 and FSTARTDEVICE = ").Append(index);
DataView dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
if (dv.Count == 0 )
{
//int devindex = Convert.ToInt32(dv[i]["FSTARTDEVICE"].ToString());
Model.MDevice device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(index));
if (device.YCoor > 50 && device.RunState == 0)
{
endcode.Clear();
startcode.Clear();
endcode.Append(i.ToString().PadLeft(2,'0')).Append("-01-09");
startcode.Append(i.ToString().PadLeft(2, '0')).Append("-54-17");
}
if (device.YCoor < 10 && device.RunState == 0)
{
endcode.Clear();
startcode.Clear();
endcode.Append(i.ToString().PadLeft(2, '0')).Append("-54-17");
startcode.Append(i.ToString().PadLeft(2, '0')).Append("-01-09");
}
string arrloc = "1800" + i.ToString();
Model.HandTask ht = new Model.HandTask(device.DeviceIndex, 4, 0, arrloc, startcode.ToString(), "", 0, "");
CStaticClass.WcfControl.BeginBuildHandTask(ht, new AsyncCallback(BuildHandTaskCallBack), ht);
ht = new Model.HandTask(device.DeviceIndex, 5, 0, arrloc, "", endcode.ToString(), 0, "");
CStaticClass.WcfControl.BeginBuildHandTask(ht, new AsyncCallback(BuildHandTaskCallBack), ht);
}
}
}
}
void BuildHandTaskCallBack(IAsyncResult ar)
{
string errtext = string.Empty;
if (CStaticClass.WcfControl.EndBuildHandTask(out errtext, ar) == false)
{
MessageBox.Show(errtext, "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
void BuildAutoTaskCallBack(IAsyncResult ar)
{
string errtext = string.Empty;
if (CStaticClass.WcfControl.EndBuildAutoTask(out errtext, ar) == false)
{
MessageBox.Show(errtext, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button4_Click(object sender, EventArgs e)
{
if (textBox_out.Text != null && textBox_out.Text != "")
{
sql.Clear();
sql.Append("select top 1 * from ST_CELL where FCELLSTATUS = 1 order by newid()");
//sql.Append(textBox_in.Text);
DataView dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
if (dv.Count > 0)
{
string startcell = dv[0]["FCELLCode"].ToString();
string startdevice = dv[0]["FLaneWay"].ToString();
string barcode = dv[0]["FPALLETBARCODE"].ToString();
//sql.Clear();
//sql.Append("select top 1 * from ST_CELL where FCELLSTATUS = 0 order by newid()");
//dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
//if (dv.Count > 0)
//{
Model.AutoTask at = new Model.AutoTask(2, barcode, startdevice, startcell, textBox_out.Text.ToString(), "", true, false, 1);//借用this.cbInWorkBench.Text传递pallettype
CStaticClass.WcfControl.BeginBuildAutoTask(at, new AsyncCallback(BuildAutoTaskCallBack), at);
sql.Clear();
sql.Append("update ST_CELL set FCELLSTATUS = 0 where FCELLCode = '");
sql.Append(startcell);
sql.Append("' ");
dbo.ExceSQL(sql.ToString());
//}
}
}
else
{
MessageBox.Show("请输入终点设备!", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
private void cb_SelectedIndexChanged(object sender, EventArgs e)
{
//DataSet ds = dbo.ExceSQL("select FLaneWay from ST_CELL where FLaneWay=" + Convert.ToInt32(cbstartposition.SelectedValue) + "");
////DataSet ds = dbo.ExceSQL("select F_DeviceIndex,F_DeviceKindIndex from T_Base_Device where F_DeviceKindIndex=10 and F_DeviceIndex=" + Convert.ToInt32(cbstartposition.SelectedValue) + "");
//if (ds.Tables[0].DefaultView.Count > 0)
//{
//}
}
private void buttonApplyCode_Click(object sender, EventArgs e)
{
if (textBoxApplyCode.Text != null && textBoxApplyCode.Text != "")
{
int dcode = Convert.ToInt32(cbBarCodeReader.SelectedValue);
//dcode = Convert.ToInt32(cbBarCodeReader.SelectedIndex);
string barcode = textBoxApplyCode.Text;
sql.Clear();
sql.Append("select * from IO_CONTROL_APPLY_WCS where DEVICE_CODE = ").Append(dcode)
.Append(" and STOCK_BARCODE='").Append(barcode).Append("' order by CREATE_TIME desc");
DataView dvv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
if (dvv.Count > 0 )
{
DataView dv = dboM.ExceSQL(
string.Format("SELECT DEVICE_CODE,STOCK_BARCODE FROM IO_CONTROL_APPLY WHERE APPLY_TASK_STATUS<2 and DEVICE_CODE='{0}' and (STOCK_BARCODE = '{1}')",
dcode, barcode)).Tables[0].DefaultView;
if (dv.Count > 0)
{
MessageBox.Show("条码已在管理系统申请表中!", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
dv = dboM.ExceSQL(
string.Format(
"select CONTROL_ID from IO_CONTROL where CONTROL_STATUS<>999 and STOCK_BARCODE like '%{0}%'",
barcode)).Tables[0].DefaultView;//管理系统有可能还没处理已经报告完成的任务
if (dv.Count > 0)
{
MessageBox.Show("条码已在管理系统任务表中!", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
dv = dbo.ExceSQL(
string.Format(
"select fid from T_Manage_Task where FPALLETBARCODE <> '1111111' and FPALLETBARCODE like '%{0}%'",
barcode)).Tables[0].DefaultView;
if (dv.Count > 0)
{
MessageBox.Show("条码已存在调度任务!", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
StringBuilder dtime = new StringBuilder(DateTime.Now.ToString("u"));
dtime.Remove(dtime.Length - 1, 1);
object[] ob = new object[13]
{
dvv[0]["CONTROL_APPLY_TYPE"], dvv[0]["DEVICE_CODE"], dvv[0]["STOCK_BARCODE"], 0, dtime, "",
dvv[0]["WAREHOUSE_CODE"] ,"手动插入",0,
dvv[0]["CONTROL_APPLY_PARA_PRODUCT_TYPE"] ,dvv[0]["CONTROL_APPLY_PARA_ERROR_DEVICE"],dvv[0]["CONTROL_APPLY_PARA_PALLET_COUNT"], dvv[0]["CONTROL_APPLY_PARA_NO_CONTROL"]
};
try
{
//[CONTROL_APPLY_PARAMETER]daxiaodaxiao
dboM.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_PARA01,CONTROL_APPLY_PARAMETER," +
"CONTROL_APPLY_PARA_PRODUCT_TYPE,CONTROL_APPLY_PARA_ERROR_DEVICE,CONTROL_APPLY_PARA_PALLET_COUNT,CONTROL_APPLY_PARA_NO_CONTROL" +
")VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')",
ob));
dbo.ExecuteSql(
string.Format(
"INSERT INTO IO_CONTROL_APPLY_WCS (CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARAMETER," +
"CONTROL_APPLY_PARA_PRODUCT_TYPE, CONTROL_APPLY_PARA_ERROR_DEVICE, CONTROL_APPLY_PARA_PALLET_COUNT, CONTROL_APPLY_PARA_NO_CONTROL" +
")VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')",
ob));
sql.Clear();
sql.Append("update T_Base_PLC_Ask set F_BarCode = '").Append(barcode).Append("' where F_Askkind = 4 and F_BindingDevice = ").Append(dcode);
dbo.ExceSQL(sql.ToString());
sql.Clear();
sql.Append("update T_Base_Device set F_PALLETBARCODE = '").Append(barcode).Append("' where F_DeviceKindIndex = 2 and F_DeviceIndex = ").Append(dcode);
dbo.ExceSQL(sql.ToString());
CommonClassLib.CCarryConvert.WriteDarkCasket(
"OPCClient", "手动向管理条码申请任务:", cbBarCodeReader.DisplayMember.ToString(),
",站台:" + dcode + ",条码:" +
barcode.ToString().ToUpper() + ",高度:" + dvv[0]["CONTROL_APPLY_PARA01"].ToString() + ",重量:" + dvv[0]["CONTROL_APPLY_PARAMETER"].ToString()); //20140218
}
catch (Exception ex)
{
CommonClassLib.CCarryConvert.WriteDarkCasket(
"错误", "向管理条码申请任务:", cbBarCodeReader.DisplayMember.ToString(),
",站台:" + dcode + ",条码:" +
barcode.ToString().ToUpper() + ",高度:" + dvv[0]["CONTROL_APPLY_PARA01"].ToString() + ",重量:" + dvv[0]["CONTROL_APPLY_PARAMETER"].ToString()); //20140218
}
}
else
{
MessageBox.Show("条码错误,无历史申请记录!", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}