Browse Source

勾选绑定箱单不出标签和箱单,点击开始打印不返回自动打印状态,装箱单零件号不变

master
ruoxing.wang 4 weeks ago
parent
commit
bb1cde7b79
  1. 80
      InjectionPC/FrmMain2408.Designer.cs
  2. 141
      InjectionPC/FrmMain2408.cs

80
InjectionPC/FrmMain2408.Designer.cs

@ -29,10 +29,10 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
GlacialComponents.Controls.GLColumn glColumn5 = new GlacialComponents.Controls.GLColumn();
GlacialComponents.Controls.GLColumn glColumn6 = new GlacialComponents.Controls.GLColumn();
GlacialComponents.Controls.GLColumn glColumn7 = new GlacialComponents.Controls.GLColumn();
GlacialComponents.Controls.GLColumn glColumn8 = new GlacialComponents.Controls.GLColumn();
GlacialComponents.Controls.GLColumn glColumn1 = new GlacialComponents.Controls.GLColumn();
GlacialComponents.Controls.GLColumn glColumn2 = new GlacialComponents.Controls.GLColumn();
GlacialComponents.Controls.GLColumn glColumn3 = new GlacialComponents.Controls.GLColumn();
GlacialComponents.Controls.GLColumn glColumn4 = new GlacialComponents.Controls.GLColumn();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain2408));
this.panel1 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
@ -732,43 +732,43 @@
this.glacialList1.AutoHeight = true;
this.glacialList1.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.glacialList1.BackgroundStretchToFit = true;
glColumn5.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn5.CheckBoxes = false;
glColumn5.ImageIndex = -1;
glColumn5.Name = "条码";
glColumn5.NumericSort = false;
glColumn5.Text = "条码";
glColumn5.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn5.Width = 350;
glColumn6.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn6.CheckBoxes = false;
glColumn6.ImageIndex = -1;
glColumn6.Name = "产品名称";
glColumn6.NumericSort = false;
glColumn6.Text = "产品名称";
glColumn6.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn6.Width = 320;
glColumn7.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn7.CheckBoxes = false;
glColumn7.ImageIndex = -1;
glColumn7.Name = "打印方式";
glColumn7.NumericSort = false;
glColumn7.Text = "打印方式";
glColumn7.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn7.Width = 150;
glColumn8.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn8.CheckBoxes = false;
glColumn8.ImageIndex = -1;
glColumn8.Name = "打印时间";
glColumn8.NumericSort = false;
glColumn8.Text = "打印时间";
glColumn8.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn8.Width = 270;
glColumn1.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn1.CheckBoxes = false;
glColumn1.ImageIndex = -1;
glColumn1.Name = "条码";
glColumn1.NumericSort = false;
glColumn1.Text = "条码";
glColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn1.Width = 350;
glColumn2.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn2.CheckBoxes = false;
glColumn2.ImageIndex = -1;
glColumn2.Name = "产品名称";
glColumn2.NumericSort = false;
glColumn2.Text = "产品名称";
glColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn2.Width = 320;
glColumn3.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn3.CheckBoxes = false;
glColumn3.ImageIndex = -1;
glColumn3.Name = "打印方式";
glColumn3.NumericSort = false;
glColumn3.Text = "打印方式";
glColumn3.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn3.Width = 150;
glColumn4.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
glColumn4.CheckBoxes = false;
glColumn4.ImageIndex = -1;
glColumn4.Name = "打印时间";
glColumn4.NumericSort = false;
glColumn4.Text = "打印时间";
glColumn4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
glColumn4.Width = 270;
this.glacialList1.Columns.AddRange(new GlacialComponents.Controls.GLColumn[] {
glColumn5,
glColumn6,
glColumn7,
glColumn8});
glColumn1,
glColumn2,
glColumn3,
glColumn4});
this.glacialList1.ControlStyle = GlacialComponents.Controls.GLControlStyles.Normal;
this.glacialList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.glacialList1.Font = new System.Drawing.Font("宋体", 15.75F);

141
InjectionPC/FrmMain2408.cs

@ -182,61 +182,73 @@ namespace InjectionPC
#region 连接PLC
if (CreateServer())
try
{
if (ConnectServer(strHostIP, "Kepware.KEPServerEX.V6"))
if (CreateServer())
{
Connected = true;
if (ConnectServer(strHostIP, "Kepware.KEPServerEX.V6"))
{
Connected = true;
#region 创建组
#region 创建组
opcGroups = opcServer.OPCGroups;
opcGroup1 = opcGroups.Add("Mould");
SetGroupProperty(opcGroup1, 500);
opcGroup2 = opcGroups.Add("Break");
SetGroupProperty(opcGroup2, 500);
opcGroups = opcServer.OPCGroups;
opcGroup1 = opcGroups.Add("Mould");
SetGroupProperty(opcGroup1, 500);
opcGroup2 = opcGroups.Add("Break");
SetGroupProperty(opcGroup2, 500);
#endregion
#endregion
#region 创建项
#region 创建项
opcItems1 = opcGroup1.OPCItems;
opcItems1.DefaultIsActive = true;
opcItems1 = opcGroup1.OPCItems;
opcItems1.DefaultIsActive = true;
PLCMouldBLL PLCbll = new PLCMouldBLL();
PLCBreakBLL bbll = new PLCBreakBLL();
PLCMouldBLL PLCbll = new PLCMouldBLL();
PLCBreakBLL bbll = new PLCBreakBLL();
DataTable PLCdt = PLCbll.SearchMould(Program.station);
if (PLCdt != null && PLCdt.Rows.Count > 0)
{
opcItemm1 = new OPCItem[PLCdt.Rows.Count];
for (int i = 0; i < PLCdt.Rows.Count; i++)
DataTable PLCdt = PLCbll.SearchMould(Program.station);
if (PLCdt != null && PLCdt.Rows.Count > 0)
{
opcItemm1[i] = opcItems1.AddItem(PLCdt.Rows[i]["Address"].ToString(), i);
opcItemm1 = new OPCItem[PLCdt.Rows.Count];
for (int i = 0; i < PLCdt.Rows.Count; i++)
{
opcItemm1[i] = opcItems1.AddItem(PLCdt.Rows[i]["Address"].ToString(), i);
}
}
}
Thread.Sleep(200);
Thread.Sleep(200);
opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange);
opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange);
#endregion
#endregion
}
else
{
MessageBox.Show("连接到OPC服务器失败!", "提示", MessageBoxButtons.OK);
Connected = false;
LogHelper.WriteLog("连接到OPC服务器失败!");
return;
}
}
else
{
MessageBox.Show("连接到OPC服务器失败!", "提示", MessageBoxButtons.OK);
MessageBox.Show("创建OPC服务失败!", "提示", MessageBoxButtons.OK);
Connected = false;
LogHelper.WriteLog("连接到OPC服务器失败!");
LogHelper.WriteLog("创建OPC服务失败!");
return;
}
}
else
catch(Exception ex)
{
MessageBox.Show("创建OPC服务失败!", "提示", MessageBoxButtons.OK);
Connected = false;
LogHelper.WriteLog("创建OPC服务失败!");
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return;
}
#endregion
@ -2437,8 +2449,8 @@ namespace InjectionPC
}
//if (bll.Add_Info_New(md, Program.tableName) == false)
if (SaveBarCode(md, Program.tableName,false, "1") == false)
{
if (SaveBarCode(md, Program.tableName, false, "0") == false)
{
return;
}
@ -3454,11 +3466,12 @@ namespace InjectionPC
if (result == DialogResult.OK)
{
if (UnCompletePrintBox("切换手动打印","all") == false) return;
opcGroup1.DataChange -= new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange);
cboxHandBox.Enabled = true;
opcServer.OPCGroups.RemoveAll();
opcServer.Disconnect();
serialPort1.Close();
label23.Enabled = true;
label23.BackColor = System.Drawing.Color.DeepSkyBlue;
//if (ConfigurationManager.AppSettings["StationMode"].ToString() == "1")
@ -3488,61 +3501,72 @@ namespace InjectionPC
cboxHandBox.Enabled = false;
#region 连接PLC
if (CreateServer())
try
{
if (ConnectServer(strHostIP, "Kepware.KEPServerEX.V6"))
if (CreateServer())
{
Connected = true;
if (ConnectServer(strHostIP, "Kepware.KEPServerEX.V6"))
{
Connected = true;
#region 创建组
#region 创建组
opcGroups = opcServer.OPCGroups;
opcGroup1 = opcGroups.Add("Mould");
SetGroupProperty(opcGroup1, 500);
opcGroups = opcServer.OPCGroups;
opcGroup1 = opcGroups.Add("Mould");
SetGroupProperty(opcGroup1, 500);
#endregion
#endregion
#region 创建项
#region 创建项
opcItems1 = opcGroup1.OPCItems;
opcItems1.DefaultIsActive = true;
opcItems1 = opcGroup1.OPCItems;
opcItems1.DefaultIsActive = true;
PLCMouldBLL PLCbll = new PLCMouldBLL();
PLCBreakBLL bbll = new PLCBreakBLL();
PLCMouldBLL PLCbll = new PLCMouldBLL();
PLCBreakBLL bbll = new PLCBreakBLL();
DataTable PLCdt = PLCbll.SearchMould(Program.station);
if (PLCdt != null && PLCdt.Rows.Count > 0)
{
opcItemm1 = new OPCItem[PLCdt.Rows.Count];
for (int i = 0; i < PLCdt.Rows.Count; i++)
DataTable PLCdt = PLCbll.SearchMould(Program.station);
if (PLCdt != null && PLCdt.Rows.Count > 0)
{
opcItemm1[i] = opcItems1.AddItem(PLCdt.Rows[i]["Address"].ToString(), i);
opcItemm1 = new OPCItem[PLCdt.Rows.Count];
for (int i = 0; i < PLCdt.Rows.Count; i++)
{
opcItemm1[i] = opcItems1.AddItem(PLCdt.Rows[i]["Address"].ToString(), i);
}
}
}
Thread.Sleep(200);
Thread.Sleep(200);
opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange);
opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange);
#endregion
#endregion
}
else
{
MessageBox.Show("连接到OPC服务器失败!", "提示", MessageBoxButtons.OK);
Connected = false;
LogHelper.WriteLog("连接到OPC服务器失败!");
return;
}
}
else
{
MessageBox.Show("连接到OPC服务器失败!", "提示", MessageBoxButtons.OK);
MessageBox.Show("创建OPC服务失败!", "提示", MessageBoxButtons.OK);
Connected = false;
LogHelper.WriteLog("连接到OPC服务器失败!");
LogHelper.WriteLog("创建OPC服务失败!");
return;
}
}
else
catch(Exception ex)
{
MessageBox.Show("创建OPC服务失败!", "提示", MessageBoxButtons.OK);
Connected = false;
LogHelper.WriteLog("创建OPC服务失败!");
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return;
}
#endregion
@ -3568,6 +3592,7 @@ namespace InjectionPC
label13.BackColor = System.Drawing.Color.DeepSkyBlue;
label23.Enabled = false;
label23.BackColor = System.Drawing.Color.Gray;
textBox2.Text = "";
}
else
{

Loading…
Cancel
Save