init: 北航大学BH-DAS项目首次入库

This commit is contained in:
XingCheng3
2026-06-08 17:06:10 +08:00
commit 10f06d99cd
207 changed files with 40597 additions and 0 deletions

256
CCYQ_JieFang/OP/AgvTest.Designer.cs generated Normal file
View File

@@ -0,0 +1,256 @@
namespace CCYQ_JieFang
{
partial class AgvTest
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.checkBox4_position4 = new System.Windows.Forms.CheckBox();
this.checkBox1_position1 = new System.Windows.Forms.CheckBox();
this.checkBox3_position3 = new System.Windows.Forms.CheckBox();
this.checkBox2_position2 = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// button5
//
this.button5.Font = new System.Drawing.Font("宋体", 11F);
this.button5.Location = new System.Drawing.Point(364, 334);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(317, 57);
this.button5.TabIndex = 12;
this.button5.Text = "4.AGV已经离开工位(下料)";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button4
//
this.button4.Font = new System.Drawing.Font("宋体", 11F);
this.button4.Location = new System.Drawing.Point(29, 334);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(309, 57);
this.button4.TabIndex = 13;
this.button4.Text = "4.AGV已经离开工位(上料)";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Font = new System.Drawing.Font("宋体", 11F);
this.button3.Location = new System.Drawing.Point(364, 193);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(317, 57);
this.button3.TabIndex = 14;
this.button3.Text = "3.AGV请求离开工位";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.Font = new System.Drawing.Font("宋体", 11F);
this.button2.Location = new System.Drawing.Point(29, 193);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(317, 57);
this.button2.TabIndex = 15;
this.button2.Text = "2.AGV请求进入工位";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 11F);
this.button1.Location = new System.Drawing.Point(29, 50);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(317, 57);
this.button1.TabIndex = 16;
this.button1.Text = "1.AGV进行送料(允许工作)";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.checkBox4_position4);
this.panel1.Controls.Add(this.checkBox1_position1);
this.panel1.Controls.Add(this.checkBox3_position3);
this.panel1.Controls.Add(this.checkBox2_position2);
this.panel1.Location = new System.Drawing.Point(364, 31);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(259, 90);
this.panel1.TabIndex = 18;
//
// checkBox4_position4
//
this.checkBox4_position4.AutoSize = true;
this.checkBox4_position4.Checked = true;
this.checkBox4_position4.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox4_position4.Location = new System.Drawing.Point(133, 56);
this.checkBox4_position4.Name = "checkBox4_position4";
this.checkBox4_position4.Size = new System.Drawing.Size(115, 22);
this.checkBox4_position4.TabIndex = 19;
this.checkBox4_position4.Text = "位置4有料";
this.checkBox4_position4.UseVisualStyleBackColor = true;
this.checkBox4_position4.CheckedChanged += new System.EventHandler(this.checkBox4_position4_CheckedChanged);
//
// checkBox1_position1
//
this.checkBox1_position1.AutoSize = true;
this.checkBox1_position1.Checked = true;
this.checkBox1_position1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1_position1.Location = new System.Drawing.Point(12, 15);
this.checkBox1_position1.Name = "checkBox1_position1";
this.checkBox1_position1.Size = new System.Drawing.Size(115, 22);
this.checkBox1_position1.TabIndex = 19;
this.checkBox1_position1.Text = "位置1有料";
this.checkBox1_position1.UseVisualStyleBackColor = true;
this.checkBox1_position1.CheckedChanged += new System.EventHandler(this.checkBox1_position1_CheckedChanged);
//
// checkBox3_position3
//
this.checkBox3_position3.AutoSize = true;
this.checkBox3_position3.Checked = true;
this.checkBox3_position3.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox3_position3.Location = new System.Drawing.Point(12, 56);
this.checkBox3_position3.Name = "checkBox3_position3";
this.checkBox3_position3.Size = new System.Drawing.Size(115, 22);
this.checkBox3_position3.TabIndex = 19;
this.checkBox3_position3.Text = "位置3有料";
this.checkBox3_position3.UseVisualStyleBackColor = true;
this.checkBox3_position3.CheckedChanged += new System.EventHandler(this.checkBox3_position3_CheckedChanged);
//
// checkBox2_position2
//
this.checkBox2_position2.AutoSize = true;
this.checkBox2_position2.Checked = true;
this.checkBox2_position2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2_position2.Location = new System.Drawing.Point(133, 15);
this.checkBox2_position2.Name = "checkBox2_position2";
this.checkBox2_position2.Size = new System.Drawing.Size(115, 22);
this.checkBox2_position2.TabIndex = 19;
this.checkBox2_position2.Text = "位置2有料";
this.checkBox2_position2.UseVisualStyleBackColor = true;
this.checkBox2_position2.CheckedChanged += new System.EventHandler(this.checkBox2_position2_CheckedChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(57, 114);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(17, 18);
this.label1.TabIndex = 19;
this.label1.Text = ".";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(57, 253);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(17, 18);
this.label2.TabIndex = 19;
this.label2.Text = ".";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(361, 253);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(17, 18);
this.label3.TabIndex = 19;
this.label3.Text = ".";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 394);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(17, 18);
this.label4.TabIndex = 19;
this.label4.Text = ".";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(361, 394);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(17, 18);
this.label5.TabIndex = 19;
this.label5.Text = ".";
//
// AgvTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(718, 465);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "AgvTest";
this.Text = "AGV调试";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.CheckBox checkBox1_position1;
private System.Windows.Forms.CheckBox checkBox2_position2;
private System.Windows.Forms.CheckBox checkBox3_position3;
private System.Windows.Forms.CheckBox checkBox4_position4;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
}
}

688
CCYQ_JieFang/OP/AgvTest.cs Normal file
View File

@@ -0,0 +1,688 @@
using MesWork;
using Newtonsoft.Json;
using Opc.Ua;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CCYQ_JieFang
{
public partial class AgvTest : Form
{
string currentOpName;
public AgvTest(string opName)
{
currentOpName = opName;
InitializeComponent();
InitPartInfo();
}
private void InitPartInfo()
{
if(publicCore.partCount == 1)
{
checkBox1_position1.Visible = true;
checkBox2_position2.Visible = false;
checkBox3_position3.Visible = false;
checkBox4_position4.Visible = false;
}
else if(publicCore.partCount == 2)
{
checkBox1_position1.Visible = true;
checkBox2_position2.Visible = true;
checkBox3_position3.Visible = false;
checkBox4_position4.Visible = false;
}
else if(publicCore.partCount == 3)
{
checkBox1_position1.Visible = true;
checkBox2_position2.Visible = true;
checkBox3_position3.Visible = true;
checkBox4_position4.Visible = false;
}
else if(publicCore.partCount == 4)
{
checkBox1_position1.Visible = true;
checkBox2_position2.Visible = true;
checkBox3_position3.Visible = true;
checkBox4_position4.Visible = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_product", "Info", "正在发送请求,请稍后...");
try
{
IPC_product iPC_product = new IPC_product();
iPC_product.MsgId = AnalysisMsg.UuidUtil();
iPC_product.Location = currentOpName;
iPC_product.MsgSource = 2;
iPC_product.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
iPC_product.AssemblyInformation = SolveProductCount();
//准备上传的数据 反序列化
string bodydata = JsonConvert.SerializeObject(iPC_product);
publicCore.LogInsert(currentOpName, "Info", bodydata);
string urlstr = MesWorkForm.IPC_product;
string retString;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr);
request.Method = "post";
byte[] bytes = Encoding.UTF8.GetBytes(bodydata);
request.Accept = "*/*";
request.ContentType = "application/json;charset=utf-8";
// 反序列化后先把JSON做接口记录
//存储日志
int AID = -1;
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var reqParam = new SqlParameter[] {
new SqlParameter("@接口地址",urlstr),
new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",bodydata),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage);
if (reqDt.Rows.Count > 0)
{
AID = Convert.ToInt32(reqDt.Rows[0]["AID"]);
}
request.ContentLength = bytes.Length;
// 准备请求体
Stream myResponseStream = request.GetRequestStream();
myResponseStream.Write(bytes, 0, bytes.Length);
//发送webapi请求 等待相应
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
retString = myStreamReader.ReadToEnd();
//响应结果
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var resParam = new SqlParameter[] {
new SqlParameter("@AID",AID),
new SqlParameter("@响应时间",CreateTime),
new SqlParameter("@响应内容",retString)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage);
// 序列化响应内容
msgResHeader mrh = JsonConvert.DeserializeObject<msgResHeader>(retString);
int statusCode = (int)response.StatusCode;
// 对响应内容进行处理 更新数据库标志
if (statusCode == 200)
{
myStreamReader.Close();
myResponseStream.Close();
label1.Text = "请求发送成功!详细信息查看日志";
publicCore.LogInsert("IPC_product", "Info", "请求发送成功!详细信息查看日志");
if (response != null)
{
// 失败
if (mrh.Code != "200")
{
publicCore.LogInsert(currentOpName, "Error", "接口【IPC-接收装配信息】失败!" + mrh.Message);
}
response.Close();
}
if (request != null)
{
request.Abort();
}
publicCore.LogInsert(currentOpName, "Info", retString);
}
else
{
label1.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_product", "Error", "接口【IPC-接收装配信息】失败!" + statusCode);
}
}
catch (Exception err)
{
publicCore.LogInsert("IPC_product", "Error", "接口【IPC-接收装配信息】失败!" + err.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
label2.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", "正在发送请求,请稍后...");
try
{
IPC_RequestEnterOrLeave iPC_RequestEnterOrLeave = new IPC_RequestEnterOrLeave();
iPC_RequestEnterOrLeave.MsgId = AnalysisMsg.UuidUtil();
iPC_RequestEnterOrLeave.Location = currentOpName;
iPC_RequestEnterOrLeave.MsgSource = 2;
iPC_RequestEnterOrLeave.RequestType = 1;
iPC_RequestEnterOrLeave.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//准备上传的数据 反序列化
string bodydata = JsonConvert.SerializeObject(iPC_RequestEnterOrLeave);
publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", bodydata);
string urlstr = MesWorkForm.IPC_RequestEnterOrLeave;
string retString;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr);
request.Method = "post";
byte[] bytes = Encoding.UTF8.GetBytes(bodydata);
request.Accept = "*/*";
request.ContentType = "application/json;charset=utf-8";
// 反序列化后先把JSON做接口记录
//存储日志
int AID = -1;
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var reqParam = new SqlParameter[] {
new SqlParameter("@接口地址",urlstr),
new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",bodydata),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage);
if (reqDt.Rows.Count > 0)
{
AID = Convert.ToInt32(reqDt.Rows[0]["AID"]);
}
request.ContentLength = bytes.Length;
// 准备请求体
Stream myResponseStream = request.GetRequestStream();
myResponseStream.Write(bytes, 0, bytes.Length);
//发送webapi请求 等待相应
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
retString = myStreamReader.ReadToEnd();
//响应结果
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var resParam = new SqlParameter[] {
new SqlParameter("@AID",AID),
new SqlParameter("@响应时间",CreateTime),
new SqlParameter("@响应内容",retString)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage);
// 序列化响应内容
msgResHeader mrh = JsonConvert.DeserializeObject<msgResHeader>(retString);
int statusCode = (int)response.StatusCode;
// 对响应内容进行处理 更新数据库标志
if (statusCode == 200)
{
myStreamReader.Close();
myResponseStream.Close();
label2.Text = "请求发送成功!详细信息查看日志";
publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", "请求发送成功!详细信息查看日志");
if (response != null)
{
// 失败
if (mrh.Code != "200")
{
publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Error", "接口【IPC-AGV请求进入/离开】失败!" + mrh.Message);
}
response.Close();
}
if (request != null)
{
request.Abort();
}
publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", retString);
}
else
{
label2.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Error", "接口【IPC-AGV请求进入/离开】失败!" + statusCode);
}
}
catch (Exception err)
{
publicCore.LogInsert(currentOpName, "Error", "接口【IPC-接收装配信息】失败!" + err.Message);
}
}
private void button3_Click(object sender, EventArgs e)
{
label3.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", "正在发送请求,请稍后...");
try
{
IPC_RequestEnterOrLeave iPC_RequestEnterOrLeave = new IPC_RequestEnterOrLeave();
iPC_RequestEnterOrLeave.MsgId = AnalysisMsg.UuidUtil();
iPC_RequestEnterOrLeave.Location = currentOpName;
iPC_RequestEnterOrLeave.MsgSource = 2;
iPC_RequestEnterOrLeave.RequestType = 2;
iPC_RequestEnterOrLeave.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//准备上传的数据 反序列化
string bodydata = JsonConvert.SerializeObject(iPC_RequestEnterOrLeave);
publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", bodydata);
string urlstr = MesWorkForm.IPC_RequestEnterOrLeave;
string retString;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr);
request.Method = "post";
byte[] bytes = Encoding.UTF8.GetBytes(bodydata);
request.Accept = "*/*";
request.ContentType = "application/json;charset=utf-8";
// 反序列化后先把JSON做接口记录
//存储日志
int AID = -1;
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var reqParam = new SqlParameter[] {
new SqlParameter("@接口地址",urlstr),
new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",bodydata),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage);
if (reqDt.Rows.Count > 0)
{
AID = Convert.ToInt32(reqDt.Rows[0]["AID"]);
}
request.ContentLength = bytes.Length;
// 准备请求体
Stream myResponseStream = request.GetRequestStream();
myResponseStream.Write(bytes, 0, bytes.Length);
//发送webapi请求 等待相应
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
retString = myStreamReader.ReadToEnd();
//响应结果
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var resParam = new SqlParameter[] {
new SqlParameter("@AID",AID),
new SqlParameter("@响应时间",CreateTime),
new SqlParameter("@响应内容",retString)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage);
// 序列化响应内容
msgResHeader mrh = JsonConvert.DeserializeObject<msgResHeader>(retString);
int statusCode = (int)response.StatusCode;
// 对响应内容进行处理 更新数据库标志
if (statusCode == 200)
{
myStreamReader.Close();
myResponseStream.Close();
label3.Text = "请求发送成功!详细信息查看日志";
publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", "请求发送成功!详细信息查看日志");
if (response != null)
{
// 失败
if (mrh.Code != "200")
{
publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Error", "接口【IPC-AGV请求进入/离开】失败!" + mrh.Message);
}
response.Close();
}
if (request != null)
{
request.Abort();
}
publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", retString);
}
else
{
label3.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Error", "接口【IPC-AGV请求进入/离开】失败!" + statusCode);
}
}
catch (Exception err)
{
publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Error", "接口【IPC-AGV请求进入/离开】失败!" + err.Message);
}
}
private void button4_Click(object sender, EventArgs e)
{
label4.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", "正在发送请求,请稍后...");
try
{
IPC_WorkFinsih iPC_WorkFinsih = new IPC_WorkFinsih();
iPC_WorkFinsih.MsgId = AnalysisMsg.UuidUtil();
iPC_WorkFinsih.Location = currentOpName;
iPC_WorkFinsih.MsgSource = 2;
iPC_WorkFinsih.FinishType = 1;
iPC_WorkFinsih.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//准备上传的数据 反序列化
string bodydata = JsonConvert.SerializeObject(iPC_WorkFinsih);
publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", bodydata);
string urlstr = MesWorkForm.IPC_WorkFinsih;
string retString;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr);
request.Method = "post";
byte[] bytes = Encoding.UTF8.GetBytes(bodydata);
request.Accept = "*/*";
request.ContentType = "application/json;charset=utf-8";
// 反序列化后先把JSON做接口记录
//存储日志
int AID = -1;
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var reqParam = new SqlParameter[] {
new SqlParameter("@接口地址",urlstr),
new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",bodydata),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage);
if (reqDt.Rows.Count > 0)
{
AID = Convert.ToInt32(reqDt.Rows[0]["AID"]);
}
request.ContentLength = bytes.Length;
// 准备请求体
Stream myResponseStream = request.GetRequestStream();
myResponseStream.Write(bytes, 0, bytes.Length);
//发送webapi请求 等待相应
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
retString = myStreamReader.ReadToEnd();
//响应结果
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var resParam = new SqlParameter[] {
new SqlParameter("@AID",AID),
new SqlParameter("@响应时间",CreateTime),
new SqlParameter("@响应内容",retString)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage);
// 序列化响应内容
msgResHeader mrh = JsonConvert.DeserializeObject<msgResHeader>(retString);
int statusCode = (int)response.StatusCode;
// 对响应内容进行处理 更新数据库标志
if (statusCode == 200)
{
myStreamReader.Close();
myResponseStream.Close();
label4.Text = "请求发送成功!详细信息查看日志";
publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", "请求发送成功!详细信息查看日志");
if (response != null)
{
// 失败
if (mrh.Code != "200")
{
publicCore.LogInsert("IPC_WorkFinsih_Up", "Error", "接口【IPC-AGV上料完成离开】失败" + mrh.Message);
}
response.Close();
}
if (request != null)
{
request.Abort();
}
publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", retString);
}
else
{
label4.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_WorkFinsih_Up", "Error", "接口【IPC-AGV上料完成离开】失败" + statusCode);
}
}
catch (Exception err)
{
publicCore.LogInsert("IPC_WorkFinsih_Up", "Error", "接口【IPC-AGV上料完成离开】失败" + err.Message);
}
}
private void button5_Click(object sender, EventArgs e)
{
label5.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", "正在发送请求,请稍后...");
try
{
IPC_WorkFinsih iPC_WorkFinsih = new IPC_WorkFinsih();
iPC_WorkFinsih.MsgId = AnalysisMsg.UuidUtil();
iPC_WorkFinsih.Location = currentOpName;
iPC_WorkFinsih.MsgSource = 2;
iPC_WorkFinsih.FinishType = 2;
iPC_WorkFinsih.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//准备上传的数据 反序列化
string bodydata = JsonConvert.SerializeObject(iPC_WorkFinsih);
publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", bodydata);
string urlstr = MesWorkForm.IPC_WorkFinsih;
string retString;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr);
request.Method = "post";
byte[] bytes = Encoding.UTF8.GetBytes(bodydata);
request.Accept = "*/*";
request.ContentType = "application/json;charset=utf-8";
// 反序列化后先把JSON做接口记录
//存储日志
int AID = -1;
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
//Event_MOM_Log_Insert,@创建时间,@内容
var reqParam = new SqlParameter[] {
new SqlParameter("@接口地址",urlstr),
new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口
new SqlParameter("@请求内容",bodydata),
new SqlParameter("@请求时间",CreateTime)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage);
if (reqDt.Rows.Count > 0)
{
AID = Convert.ToInt32(reqDt.Rows[0]["AID"]);
}
request.ContentLength = bytes.Length;
// 准备请求体
Stream myResponseStream = request.GetRequestStream();
myResponseStream.Write(bytes, 0, bytes.Length);
//发送webapi请求 等待相应
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
retString = myStreamReader.ReadToEnd();
//响应结果
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var resParam = new SqlParameter[] {
new SqlParameter("@AID",AID),
new SqlParameter("@响应时间",CreateTime),
new SqlParameter("@响应内容",retString)
};
DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage);
// 序列化响应内容
msgResHeader mrh = JsonConvert.DeserializeObject<msgResHeader>(retString);
int statusCode = (int)response.StatusCode;
// 对响应内容进行处理 更新数据库标志
if (statusCode == 200)
{
myStreamReader.Close();
myResponseStream.Close();
label5.Text = "请求发送成功!详细信息查看日志";
publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", "请求发送成功!详细信息查看日志");
if (response != null)
{
// 失败
if (mrh.Code != "200")
{
publicCore.LogInsert("IPC_WorkFinsih_Down", "Error", "接口【IPC-AGV上料完成离开】失败" + mrh.Message);
}
response.Close();
}
if (request != null)
{
request.Abort();
}
publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", retString);
}
else
{
label4.Text = "正在发送请求,请稍后...";
publicCore.LogInsert("IPC_WorkFinsih_Down", "Error", "接口【IPC-AGV上料完成离开】失败" + statusCode);
}
}
catch (Exception err)
{
publicCore.LogInsert("IPC_WorkFinsih_Down", "Error", "接口【IPC-AGV上料完成离开】失败" + err.Message);
}
}
private List<IPC_product_AssemblyInformation> SolveProductCount()
{
List<IPC_product_AssemblyInformation> AssemblyInformation = new List<IPC_product_AssemblyInformation>();
string currentTime = DateTime.Now.ToString("yyyyMMddHHmmss");
if (publicCore.partCount == 1)
{
if(checkBox1_position1.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation();
product_AssemblyInformation1.productPosition = 1;
product_AssemblyInformation1.productNo = currentTime + "_part1";
product_AssemblyInformation1.productName = "装配件01";
AssemblyInformation.Add(product_AssemblyInformation1);
}
}
else if (publicCore.partCount == 2)
{
if (checkBox1_position1.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation();
product_AssemblyInformation1.productPosition = 1;
product_AssemblyInformation1.productNo = currentTime + "_part1";
product_AssemblyInformation1.productName = "装配件01";
AssemblyInformation.Add(product_AssemblyInformation1);
}
if (checkBox2_position2.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation2 = new IPC_product_AssemblyInformation();
product_AssemblyInformation2.productPosition = 2;
product_AssemblyInformation2.productNo = currentTime + "_part2";
product_AssemblyInformation2.productName = "装配件02";
AssemblyInformation.Add(product_AssemblyInformation2);
}
}
else if (publicCore.partCount == 3)
{
if (checkBox1_position1.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation();
product_AssemblyInformation1.productPosition = 1;
product_AssemblyInformation1.productNo = currentTime + "_part1";
product_AssemblyInformation1.productName = "装配件01";
AssemblyInformation.Add(product_AssemblyInformation1);
}
if (checkBox2_position2.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation2 = new IPC_product_AssemblyInformation();
product_AssemblyInformation2.productPosition = 2;
product_AssemblyInformation2.productNo = currentTime + "_part2";
product_AssemblyInformation2.productName = "装配件02";
AssemblyInformation.Add(product_AssemblyInformation2);
}
if (checkBox3_position3.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation3 = new IPC_product_AssemblyInformation();
product_AssemblyInformation3.productPosition = 3;
product_AssemblyInformation3.productNo = currentTime + "_part3";
product_AssemblyInformation3.productName = "装配件03";
AssemblyInformation.Add(product_AssemblyInformation3);
}
}
else if (publicCore.partCount == 4)
{
if (checkBox1_position1.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation();
product_AssemblyInformation1.productPosition = 1;
product_AssemblyInformation1.productNo = currentTime + "_part1";
product_AssemblyInformation1.productName = "装配件01";
AssemblyInformation.Add(product_AssemblyInformation1);
}
if (checkBox2_position2.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation2 = new IPC_product_AssemblyInformation();
product_AssemblyInformation2.productPosition = 2;
product_AssemblyInformation2.productNo = currentTime + "_part2";
product_AssemblyInformation2.productName = "装配件02";
AssemblyInformation.Add(product_AssemblyInformation2);
}
if (checkBox3_position3.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation3 = new IPC_product_AssemblyInformation();
product_AssemblyInformation3.productPosition = 3;
product_AssemblyInformation3.productNo = currentTime + "_part3";
product_AssemblyInformation3.productName = "装配件03";
AssemblyInformation.Add(product_AssemblyInformation3);
}
if (checkBox4_position4.Checked)
{
IPC_product_AssemblyInformation product_AssemblyInformation4 = new IPC_product_AssemblyInformation();
product_AssemblyInformation4.productPosition = 4;
product_AssemblyInformation4.productNo = currentTime + "_part4";
product_AssemblyInformation4.productName = "装配件04";
AssemblyInformation.Add(product_AssemblyInformation4);
}
}
return AssemblyInformation;
}
private void checkBox1_position1_CheckedChanged(object sender, EventArgs e)
{
SolveProductCount();
}
private void checkBox2_position2_CheckedChanged(object sender, EventArgs e)
{
SolveProductCount();
}
private void checkBox3_position3_CheckedChanged(object sender, EventArgs e)
{
SolveProductCount();
}
private void checkBox4_position4_CheckedChanged(object sender, EventArgs e)
{
SolveProductCount();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,181 @@
namespace CCYQ_JieFang
{
partial class MeasureRangeSet
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1_search = new System.Windows.Forms.Button();
this.dataGridView1_part = new System.Windows.Forms.DataGridView();
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).BeginInit();
this.SuspendLayout();
//
// button1_search
//
this.button1_search.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button1_search.Location = new System.Drawing.Point(12, 10);
this.button1_search.Name = "button1_search";
this.button1_search.Size = new System.Drawing.Size(75, 32);
this.button1_search.TabIndex = 6;
this.button1_search.Text = "查询";
this.button1_search.UseVisualStyleBackColor = true;
this.button1_search.Click += new System.EventHandler(this.button1_search_Click);
//
// dataGridView1_part
//
this.dataGridView1_part.AllowUserToAddRows = false;
this.dataGridView1_part.AllowUserToDeleteRows = false;
this.dataGridView1_part.AllowUserToResizeRows = false;
this.dataGridView1_part.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1_part.ColumnHeadersHeight = 29;
this.dataGridView1_part.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.dataGridView1_part.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ID,
this.,
this.,
this.,
this.,
this.,
this.});
this.dataGridView1_part.Location = new System.Drawing.Point(12, 49);
this.dataGridView1_part.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.dataGridView1_part.Name = "dataGridView1_part";
this.dataGridView1_part.RowHeadersVisible = false;
this.dataGridView1_part.RowHeadersWidth = 51;
this.dataGridView1_part.RowTemplate.Height = 27;
this.dataGridView1_part.Size = new System.Drawing.Size(1364, 604);
this.dataGridView1_part.TabIndex = 5;
this.dataGridView1_part.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dataGridView1_part_CellBeginEdit);
this.dataGridView1_part.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_part_CellEndEdit);
this.dataGridView1_part.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.dataGridView1_part_DataError);
//
// ID
//
this.ID.DataPropertyName = "Id";
this.ID.HeaderText = "ID";
this.ID.MinimumWidth = 6;
this.ID.Name = "ID";
this.ID.ReadOnly = true;
this.ID.Width = 80;
//
// 工位号
//
this..DataPropertyName = "工位号";
this..HeaderText = "工位号";
this..MinimumWidth = 6;
this..Name = "工位号";
this..ReadOnly = true;
//
// 测量项目
//
this..DataPropertyName = "测量项目";
this..HeaderText = "测量项目";
this..MinimumWidth = 6;
this..Name = "测量项目";
this..ReadOnly = true;
this..Width = 150;
//
// 测量位置
//
this..DataPropertyName = "测量位置";
this..HeaderText = "测量位置";
this..MinimumWidth = 6;
this..Name = "测量位置";
this..ReadOnly = true;
//
// 单位
//
this..DataPropertyName = "测量单位";
this..HeaderText = "单位";
this..MinimumWidth = 8;
this..Name = "单位";
this..Width = 150;
//
// 上限值
//
this..DataPropertyName = "上限值";
this..HeaderText = "上限值";
this..MinimumWidth = 8;
this..Name = "上限值";
this..Width = 150;
//
// 下限值
//
this..DataPropertyName = "下限值";
this..HeaderText = "下限值";
this..MinimumWidth = 8;
this..Name = "下限值";
this..Width = 150;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(132, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(242, 18);
this.label1.TabIndex = 7;
this.label1.Text = "可调整单位、上限值、下限值";
//
// MeasureRangeSet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1388, 659);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1_search);
this.Controls.Add(this.dataGridView1_part);
this.Name = "MeasureRangeSet";
this.Text = "测量数据设定";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1_search;
private System.Windows.Forms.DataGridView dataGridView1_part;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -0,0 +1,121 @@
using MesWork;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CCYQ_JieFang
{
public partial class MeasureRangeSet : Form
{
string currentOpName;
object oldValue = null;
public MeasureRangeSet(string opName)
{
currentOpName = opName;
InitializeComponent();
dataGridView1_part.AutoGenerateColumns = false;
SearchPartInit(currentOpName);
}
private void button1_search_Click(object sender, EventArgs e)
{
SearchPartInit(Name);
}
private void SearchPartInit(string opName)
{
try
{
SearchMeasureInfo(opName, out DataTable dt, out string errorMsg);
if (dt.Rows.Count > 0)
{
dataGridView1_part.DataSource = dt;
}
}
catch (Exception err)
{
}
}
private bool UpdateMeasureInfo(string ID, string upVlaue, string downVlaue, string unit, out string errorMsg)
{
string procedureName;
procedureName = "基础数据_质量数据_编辑";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@ID", ID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@上限值", upVlaue);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@下限值", downVlaue);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@测量单位", unit);
return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg);
}
private bool SearchMeasureInfo(string opName, out DataTable dt, out string errorMsg)
{
string procedureName;
procedureName = "基础数据_质量数据_查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg);
}
private void dataGridView1_part_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
object newValue = dataGridView1_part.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
if(oldValue != newValue)
{
try
{
string ID = GetDgvSVal(e, "ID");
string upVlaue = GetDgvSVal(e, "上限值");
string downVlaue = GetDgvSVal(e, "下限值");
if (Convert.ToDouble(upVlaue) < Convert.ToDouble(downVlaue))
{
MessageBox.Show("上限值应大于下限值!");
return;
}
string unit = GetDgvSVal(e, "测量单位");
if (UpdateMeasureInfo(ID, upVlaue, downVlaue, unit, out string errMsg))
{
MessageBox.Show("设置成功!");
}
else
{
MessageBox.Show("设置失败!");
}
}
catch (Exception err)
{
MessageBox.Show("设置错误!");
}
SearchPartInit(currentOpName);
}
}
private string GetDgvSVal(DataGridViewCellEventArgs e, string cellName)
{
return ((DataTable)dataGridView1_part.DataSource).Rows[e.RowIndex][cellName].ToString();
}
private void dataGridView1_part_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
MessageBox.Show(e.Exception.Message.ToString());
}
private void dataGridView1_part_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
oldValue = dataGridView1_part.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
}
}
}

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="工位号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量项目.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量位置.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="单位.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="上限值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="下限值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="工位号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量项目.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量位置.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="单位.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="上限值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="下限值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

1179
CCYQ_JieFang/OP/OP10/DAS_OP10.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,654 @@
using DK_DC_Tool;
using HslCommunication.Core;
using Newtonsoft.Json;
using NPOI.SS.UserModel;
using OpcBasic;
using Robot.Common;
using Serilog.Events;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using SystemFramework;
namespace MesWork
{
public partial class DAS_OP10
{
InitServer initServer = null;
/// <summary>
///
/// </summary>
private static string OpNameCurrent = "";
/// <summary>
/// 字典 存储12个开始测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicStartMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicEndMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量文本框控件key为测量位置value文本框的值
/// </summary>
Dictionary<int, TextBox> dicMeasureTextBox = new Dictionary<int, TextBox>();
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<DeviceDriver_BasicData.CustomeEvetnArgs> MIS_Funtion_PLC_OP = null;
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<string> AGV_Task_change = null;
/// <summary>
/// PLC事件变化委托--处理托盘信息
/// </summary>
public static Action<string> AGV_Task_Info = null;
// 每个工位的满工件数量
// 工位OP10 2个
public static int partCount = 2;
public static bool isConnect = false;
public DAS_OP10(string opName)
{
InitializeComponent();
publicCore.partCount = partCount;
OpNameCurrent = opName;
Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang;
Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking;
MIS_Funtion_PLC_OP -= MIS_Funtion_PLC;
MIS_Funtion_PLC_OP += MIS_Funtion_PLC;
AGV_Task_change -= SolveAgvDeviceStatus;
AGV_Task_change += SolveAgvDeviceStatus;
if (MesWorkForm.IsDemoMesServer == 1)
{
MoNiHeartBeat();
}
SolvePicAndMeasureValueInit();
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
//var aa =
//new Thread(new ThreadStart(delegate () {
// while (true)
// {
// try
// {
// if (!isConnect)
// {
// if (publicCore.Get_PartPosition(OpNameCurrent) != -1)
// {
// isConnect = true;
// ProductInfo_search();
// }
// }
// }
// catch (Exception err) { }
// Thread.Sleep(1000);
// }
//}));
//aa.IsBackground = true;
//aa.Start();
}
public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent)
{
try
{
var tagID = msgEvent.TagID.ToString();
// var opName = msgEvent.OpName.ToString();
var tagTypeCodeID = (int)msgEvent.TagTypeCodeID;
var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID;
string tagValue;
switch (tagTypeID)
{
case EnumTagTypeID.BOOL:
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
switch (tagTypeCodeID)
{
case 14:
DeviceHeartBeat(tagValue);
break;
// AGV任务
case 50:
publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue);
break;
// 51 空闲(请求上料)
// 52 完成(请求下料)
// 53 故障
case 51:
case 52:
case 53:
publicCore.SolveDeviceStatus(OpNameCurrent);
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
break;
// 54 第几个件
case 54:
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case 55:
publicCore.MeasurePositionChange(OpNameCurrent, 2);
SolvePicAndMeasureValueWorking();
break;
//读电批
case 56:
if (tagValue == "1")
{
publicCore.LogInsert("OP10", "Info", "【PLC_读电批置位】");
// 不在这个地方写true,写在接收数据的地方写
}
else
{
publicCore.LogInsert("OP10", "Info", "【PLC_读电批复位】");
MesWorkForm.WritePLC(83, OpNameCurrent, false);
publicCore.LogInsert("OP10", "Info", "【IPC_读电批完成复位】");
}
break;
//读泄漏量1 2或者压力
case 59:
if (tagValue == "1")
{
//publicCore.ReadQualityData_LeakageRate(OpNameCurrent);
//publicCore.ReadQualityData_Pressure(OpNameCurrent);
MesWorkForm.WritePLC(84, OpNameCurrent, true);
}
else
{
MesWorkForm.WritePLC(84, OpNameCurrent, false);
}
break;
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// 初始化界面显示
/// </summary>
private void SolvePicAndMeasureValueInit()
{
try
{
dicStartMasurePictureBox.Add(1, pictureBox2_start_1);
dicStartMasurePictureBox.Add(2, pictureBox2_start_2);
dicStartMasurePictureBox.Add(3, pictureBox2_start_3);
dicStartMasurePictureBox.Add(4, pictureBox2_start_4);
dicStartMasurePictureBox.Add(5, pictureBox2_start_5);
dicStartMasurePictureBox.Add(6, pictureBox2_start_6);
dicStartMasurePictureBox.Add(7, pictureBox2_start_7);
dicStartMasurePictureBox.Add(8, pictureBox2_start_8);
dicStartMasurePictureBox.Add(9, pictureBox2_start_9);
dicStartMasurePictureBox.Add(10, pictureBox2_start_10);
dicStartMasurePictureBox.Add(11, pictureBox2_start_11);
dicStartMasurePictureBox.Add(12, pictureBox2_start_12);
dicEndMasurePictureBox.Add(1, pictureBox12_end_1);
dicEndMasurePictureBox.Add(2, pictureBox12_end_2);
dicEndMasurePictureBox.Add(3, pictureBox12_end_3);
dicEndMasurePictureBox.Add(4, pictureBox12_end_4);
dicEndMasurePictureBox.Add(5, pictureBox12_end_5);
dicEndMasurePictureBox.Add(6, pictureBox12_end_6);
dicEndMasurePictureBox.Add(7, pictureBox12_end_7);
dicEndMasurePictureBox.Add(8, pictureBox12_end_8);
dicEndMasurePictureBox.Add(9, pictureBox12_end_9);
dicEndMasurePictureBox.Add(10, pictureBox12_end_10);
dicEndMasurePictureBox.Add(11, pictureBox12_end_11);
dicEndMasurePictureBox.Add(12, pictureBox12_end_12);
dicMeasureTextBox.Add(1, textBox_MeasureValue_1);
dicMeasureTextBox.Add(2, textBox_MeasureValue_2);
dicMeasureTextBox.Add(3, textBox_MeasureValue_3);
dicMeasureTextBox.Add(4, textBox_MeasureValue_4);
dicMeasureTextBox.Add(5, textBox_MeasureValue_5);
dicMeasureTextBox.Add(6, textBox_MeasureValue_6);
dicMeasureTextBox.Add(7, textBox_MeasureValue_7);
dicMeasureTextBox.Add(8, textBox_MeasureValue_8);
dicMeasureTextBox.Add(9, textBox_MeasureValue_9);
dicMeasureTextBox.Add(10, textBox_MeasureValue_10);
dicMeasureTextBox.Add(11, textBox_MeasureValue_11);
dicMeasureTextBox.Add(12, textBox_MeasureValue_12);
foreach (var item in dicStartMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicEndMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicMeasureTextBox)
{
item.Value.Text = "";
}
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "1")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 工作时界面显示
/// </summary>
private void SolvePicAndMeasureValueWorking()
{
try
{
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "2")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 界面产品编码和装配位置的显示
/// </summary>
public void ProductInfo_search()
{
try
{
//textBox1_EngineID.Text = "";
//textBox1_PartPosition.Text = "";
ShowTextBoxControl(textBox1_EngineID, "", Color.White);
ShowTextBoxControl(textBox1_PartPosition, "", Color.White);
int PartPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White);
ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White);
//textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString();
//textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString();
}
}
catch (Exception err)
{
}
}
private void ShowPicBoxControl(Control c, bool ststus)
{
c.BeginInvoke(new Action(delegate () {
c.Visible = ststus;
}));
}
private void ShowTextBoxControl(Control c, string value, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.Text = value;
c.BackColor = color;
}));
}
private void ShowLabelControl(Control c, Color color)
{
//if (c.InvokeRequired)
//{
//}
//else
//{
// c.ForeColor = color;
//}
c.BeginInvoke(new Action(delegate () {
c.ForeColor = color;
}));
}
private void ShowButtonControl(Control c, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.BackColor = color;
}));
}
/// <summary>
/// 初始化设备状态
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// </summary>
private void SolveDeviceStatusInit(string currentStatus)
{
try
{
ShowButtonControl(button_running, Color.Gray);
ShowButtonControl(button_finished, Color.Gray);
ShowButtonControl(button_empty, Color.Gray);
ShowButtonControl(button_alarm, Color.Gray);
//button_running.BackColor = Color.Gray;
//button_finished.BackColor = Color.Gray;
//button_empty.BackColor = Color.Gray;
//button_alarm.BackColor = Color.Gray;
if (currentStatus == "1")
{
ShowButtonControl(button_running, Color.Green);
//button_running.BackColor = Color.Green;
}
else if (currentStatus == "2")
{
ShowButtonControl(button_empty, Color.SkyBlue);
//button_empty.BackColor = Color.SkyBlue;
}
else if (currentStatus == "3")
{
ShowButtonControl(button_finished, Color.DarkOrange);
//button_finished.BackColor = Color.DarkOrange;
}
else if (currentStatus == "4")
{
ShowButtonControl(button_alarm, Color.Red);
//button_alarm.BackColor = Color.Red;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// AGV设备状态显示
/// </summary>
/// <param name="PLC_AgvTaskNum"></param>
private void SolveAgvDeviceStatus(string PLC_AgvTaskNum)
{
try
{
// 77 反馈AGV任务
switch (PLC_AgvTaskNum)
{
case "10":
// AGV触发装配任务 正在送料
//label_AgvSongliao.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Black;
ShowLabelControl(label_AgvSongliao, Color.Green);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Black);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case "11":
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
break;
// 允许AGV进行上料 --允许进入
// 允许AGV进行下料 --允许进入
case "2":
case "4":
ShowLabelControl(label_AgvCanEnter, Color.Green);
ShowLabelControl(label_AgvCanLeave, Color.Black);
//label_AgvCanEnter.ForeColor = Color.Green;
//label_AgvCanLeave.ForeColor = Color.Black;
break;
case "21":
// AGV 上料完成
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Green;
break;
case "3":
// 1.调用FSS-接收IPC下料请求的接口
// 2.反馈任务号30 AGV已呼叫成功正在去往下料区
break;
case "31":
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Green;
// AGV已到达下料区
break;
case "41":
// AGV下料完成
break;
// 允许AGV离开
case "5":
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Green);
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Green;
break;
case "51":
//label_AgvSongliao.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Green;
ShowLabelControl(label_AgvSongliao, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Green);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 设备PLC心跳button5_heartBeat_Ning
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat(string tagValue)
{
WritePLC(15, OpNameCurrent, tagValue);
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat, Color.Green);
//button5_heartBeat.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat, Color.Gray);
//button5_heartBeat.BackColor = Color.Gray;
}
}
/// <summary>
/// 设备PLC心跳
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat_NingJinQiang(string tagValue)
{
if (tagValue != "0")
{
ShowButtonControl(button5_heartBeat_Ning, Color.Green);
//button5_heartBeat_Ning.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat_Ning, Color.Red);
//button5_heartBeat_Ning.BackColor = Color.Red;
}
}
private void MoNiHeartBeat()
{
bool tv = false;
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
WritePLC(14, OpNameCurrent, tv);
tv = !tv;
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
}
private void label5_Click(object sender, EventArgs e)
{
}
private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timHSCZ.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 221</value>
</metadata>
<metadata name="timUI.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 221</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>33</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz
UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC
QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm
Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX
dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT
PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0
F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd
0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI
Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg
gg==
</value>
</data>
</root>

1064
CCYQ_JieFang/OP/OP20/DAS_OP20.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,648 @@
using DK_DC_Tool;
using HslCommunication.Core;
using Newtonsoft.Json;
using NPOI.SS.UserModel;
using OpcBasic;
using Robot.Common;
using Serilog.Events;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using SystemFramework;
namespace MesWork
{
public partial class DAS_OP20
{
InitServer initServer = null;
/// <summary>
///
/// </summary>
private static string OpNameCurrent = "";
/// <summary>
/// 字典 存储12个开始测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicStartMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicEndMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量文本框控件key为测量位置value文本框的值
/// </summary>
Dictionary<int, TextBox> dicMeasureTextBox = new Dictionary<int, TextBox>();
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<DeviceDriver_BasicData.CustomeEvetnArgs> MIS_Funtion_PLC_OP = null;
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<string> AGV_Task_change = null;
/// <summary>
/// PLC事件变化委托--处理托盘信息
/// </summary>
public static Action<string> AGV_Task_Info = null;
// 每个工位的满工件数量
// 工位OP20 3个
public static int partCount = 3;
public static bool isConnect = false;
public DAS_OP20(string opName)
{
InitializeComponent();
publicCore.partCount = partCount;
OpNameCurrent = opName;
Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang;
Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking;
MIS_Funtion_PLC_OP -= MIS_Funtion_PLC;
MIS_Funtion_PLC_OP += MIS_Funtion_PLC;
AGV_Task_change -= SolveAgvDeviceStatus;
AGV_Task_change += SolveAgvDeviceStatus;
if (MesWorkForm.IsDemoMesServer == 1)
{
MoNiHeartBeat();
}
SolvePicAndMeasureValueInit();
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
//var aa =
//new Thread(new ThreadStart(delegate () {
// while (true)
// {
// try
// {
// if (!isConnect)
// {
// if (publicCore.Get_PartPosition(OpNameCurrent) != -1)
// {
// isConnect = true;
// ProductInfo_search();
// }
// }
// }
// catch (Exception err) { }
// Thread.Sleep(1000);
// }
//}));
//aa.IsBackground = true;
//aa.Start();
}
public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent)
{
try
{
var tagID = msgEvent.TagID.ToString();
// var opName = msgEvent.OpName.ToString();
var tagTypeCodeID = (int)msgEvent.TagTypeCodeID;
var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID;
string tagValue;
switch (tagTypeID)
{
case EnumTagTypeID.BOOL:
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
switch (tagTypeCodeID)
{
case 14:
DeviceHeartBeat(tagValue);
break;
// AGV任务
case 50:
publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue);
break;
// 51 空闲(请求上料)
// 52 完成(请求下料)
// 53 故障
case 51:
case 52:
case 53:
publicCore.SolveDeviceStatus(OpNameCurrent);
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
break;
// 54 第几个件
case 54:
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case 55:
publicCore.MeasurePositionChange(OpNameCurrent, 2);
SolvePicAndMeasureValueWorking();
break;
//读电批
case 56:
if (tagValue == "1")
{
publicCore.LogInsert("OP20", "Info", "【PLC_读电批置位】");
// 不在这个地方写true,写在接收数据的地方写
}
else
{
publicCore.LogInsert("OP20", "Info", "【PLC_读电批复位】");
MesWorkForm.WritePLC(83, OpNameCurrent, false);
publicCore.LogInsert("OP20", "Info", "【IPC_读电批完成复位】");
}
break;
//读泄漏量1 2或者压力
case 59:
if(tagValue == "1")
{
//publicCore.ReadQualityData_LeakageRate(OpNameCurrent);
//publicCore.ReadQualityData_Pressure(OpNameCurrent);
MesWorkForm.WritePLC(84, OpNameCurrent, true);
}
else
{
MesWorkForm.WritePLC(84, OpNameCurrent, false);
}
break;
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// 初始化界面显示
/// </summary>
private void SolvePicAndMeasureValueInit()
{
try
{
dicStartMasurePictureBox.Add(1, pictureBox2_start_1);
dicStartMasurePictureBox.Add(2, pictureBox2_start_2);
dicStartMasurePictureBox.Add(3, pictureBox2_start_3);
dicStartMasurePictureBox.Add(4, pictureBox2_start_4);
dicStartMasurePictureBox.Add(5, pictureBox2_start_5);
dicStartMasurePictureBox.Add(6, pictureBox2_start_6);
dicStartMasurePictureBox.Add(7, pictureBox2_start_7);
dicStartMasurePictureBox.Add(8, pictureBox2_start_8);
dicStartMasurePictureBox.Add(9, pictureBox2_start_9);
dicStartMasurePictureBox.Add(10, pictureBox2_start_10);
dicEndMasurePictureBox.Add(1, pictureBox12_end_1);
dicEndMasurePictureBox.Add(2, pictureBox12_end_2);
dicEndMasurePictureBox.Add(3, pictureBox12_end_3);
dicEndMasurePictureBox.Add(4, pictureBox12_end_4);
dicEndMasurePictureBox.Add(5, pictureBox12_end_5);
dicEndMasurePictureBox.Add(6, pictureBox12_end_6);
dicEndMasurePictureBox.Add(7, pictureBox12_end_7);
dicEndMasurePictureBox.Add(8, pictureBox12_end_8);
dicEndMasurePictureBox.Add(9, pictureBox12_end_9);
dicEndMasurePictureBox.Add(10, pictureBox12_end_10);
dicMeasureTextBox.Add(1, textBox_MeasureValue_1);
dicMeasureTextBox.Add(2, textBox_MeasureValue_2);
dicMeasureTextBox.Add(3, textBox_MeasureValue_3);
dicMeasureTextBox.Add(4, textBox_MeasureValue_4);
dicMeasureTextBox.Add(5, textBox_MeasureValue_5);
dicMeasureTextBox.Add(6, textBox_MeasureValue_6);
dicMeasureTextBox.Add(7, textBox_MeasureValue_7);
dicMeasureTextBox.Add(8, textBox_MeasureValue_8);
dicMeasureTextBox.Add(9, textBox_MeasureValue_9);
dicMeasureTextBox.Add(10, textBox_MeasureValue_10);
foreach (var item in dicStartMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicEndMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicMeasureTextBox)
{
item.Value.Text = "";
}
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "1")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 工作时界面显示
/// </summary>
private void SolvePicAndMeasureValueWorking()
{
try
{
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "2")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 界面产品编码和装配位置的显示
/// </summary>
public void ProductInfo_search()
{
try
{
//textBox1_EngineID.Text = "";
//textBox1_PartPosition.Text = "";
ShowTextBoxControl(textBox1_EngineID, "", Color.White);
ShowTextBoxControl(textBox1_PartPosition, "", Color.White);
int PartPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White);
ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White);
//textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString();
//textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString();
}
}
catch (Exception err)
{
}
}
private void ShowPicBoxControl(Control c,bool ststus)
{
c.BeginInvoke(new Action(delegate () {
c.Visible = ststus;
}));
}
private void ShowTextBoxControl(Control c, string value, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.Text = value;
c.BackColor = color;
}));
}
private void ShowLabelControl(Control c, Color color)
{
//if (c.InvokeRequired)
//{
//}
//else
//{
// c.ForeColor = color;
//}
c.BeginInvoke(new Action(delegate () {
c.ForeColor = color;
}));
}
private void ShowButtonControl(Control c, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.BackColor = color;
}));
}
/// <summary>
/// 初始化设备状态
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// </summary>
private void SolveDeviceStatusInit(string currentStatus)
{
try
{
ShowButtonControl(button_running, Color.Gray);
ShowButtonControl(button_finished, Color.Gray);
ShowButtonControl(button_empty, Color.Gray);
ShowButtonControl(button_alarm, Color.Gray);
//button_running.BackColor = Color.Gray;
//button_finished.BackColor = Color.Gray;
//button_empty.BackColor = Color.Gray;
//button_alarm.BackColor = Color.Gray;
if (currentStatus == "1")
{
ShowButtonControl(button_running, Color.Green);
//button_running.BackColor = Color.Green;
}
else if (currentStatus == "2")
{
ShowButtonControl(button_empty, Color.SkyBlue);
//button_empty.BackColor = Color.SkyBlue;
}
else if (currentStatus == "3")
{
ShowButtonControl(button_finished, Color.DarkOrange);
//button_finished.BackColor = Color.DarkOrange;
}
else if (currentStatus == "4")
{
ShowButtonControl(button_alarm, Color.Red);
//button_alarm.BackColor = Color.Red;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// AGV设备状态显示
/// </summary>
/// <param name="PLC_AgvTaskNum"></param>
private void SolveAgvDeviceStatus(string PLC_AgvTaskNum)
{
try
{
// 77 反馈AGV任务
switch (PLC_AgvTaskNum)
{
case "10":
// AGV触发装配任务 正在送料
//label_AgvSongliao.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Black;
ShowLabelControl(label_AgvSongliao, Color.Green);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Black);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case "11":
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
break;
// 允许AGV进行上料 --允许进入
// 允许AGV进行下料 --允许进入
case "2":
case "4":
ShowLabelControl(label_AgvCanEnter, Color.Green);
ShowLabelControl(label_AgvCanLeave, Color.Black);
//label_AgvCanEnter.ForeColor = Color.Green;
//label_AgvCanLeave.ForeColor = Color.Black;
break;
case "21":
// AGV 上料完成
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Green;
break;
case "3":
// 1.调用FSS-接收IPC下料请求的接口
// 2.反馈任务号30 AGV已呼叫成功正在去往下料区
break;
case "31":
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Green;
// AGV已到达下料区
break;
case "41":
// AGV下料完成
break;
// 允许AGV离开
case "5":
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Green);
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Green;
break;
case "51":
//label_AgvSongliao.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Green;
ShowLabelControl(label_AgvSongliao, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Green);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 设备PLC心跳button5_heartBeat_Ning
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat(string tagValue)
{
WritePLC(15, OpNameCurrent, tagValue);
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat, Color.Green);
//button5_heartBeat.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat, Color.Gray);
//button5_heartBeat.BackColor = Color.Gray;
}
}
/// <summary>
/// 设备PLC心跳
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat_NingJinQiang(string tagValue)
{
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat_Ning, Color.Green);
//button5_heartBeat_Ning.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat_Ning, Color.Red);
//button5_heartBeat_Ning.BackColor = Color.Red;
}
}
private void MoNiHeartBeat()
{
bool tv = false;
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
WritePLC(14, OpNameCurrent, tv);
tv = !tv;
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
}
private void label5_Click(object sender, EventArgs e)
{
}
private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timHSCZ.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 221</value>
</metadata>
<metadata name="timUI.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 221</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>33</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz
UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC
QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm
Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX
dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT
PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0
F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd
0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI
Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg
gg==
</value>
</data>
</root>

610
CCYQ_JieFang/OP/OP30/DAS_OP30.Designer.cs generated Normal file
View File

@@ -0,0 +1,610 @@
namespace MesWork
{
partial class DAS_OP30: PlcLinkForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DAS_OP30));
this.timHSCZ = new System.Windows.Forms.Timer(this.components);
this.label9 = new System.Windows.Forms.Label();
this.timUI = new System.Windows.Forms.Timer(this.components);
this.labelTime = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.panel7 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.pictureBox12_end_2 = new System.Windows.Forms.PictureBox();
this.pictureBox2_start_2 = new System.Windows.Forms.PictureBox();
this.pictureBox12_end_1 = new System.Windows.Forms.PictureBox();
this.pictureBox2_start_1 = new System.Windows.Forms.PictureBox();
this.textBox_MeasureValue_2 = new System.Windows.Forms.TextBox();
this.textBox_MeasureValue_1 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label16 = new System.Windows.Forms.Label();
this.button_running = new System.Windows.Forms.Button();
this.button_alarm = new System.Windows.Forms.Button();
this.button_finished = new System.Windows.Forms.Button();
this.button_empty = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.label_AgvLeaved = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label_AgvCanLeave = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.label_AgvRequestLeave = new System.Windows.Forms.Label();
this.button5_heartBeat_Ning = new System.Windows.Forms.Button();
this.button5_heartBeat = new System.Windows.Forms.Button();
this.label_AgvCanEnter = new System.Windows.Forms.Label();
this.textBox1_PartPosition = new System.Windows.Forms.TextBox();
this.label_AgvSongliao = new System.Windows.Forms.Label();
this.label_AgvRequestEnter = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.textBox1_EngineID = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel7.SuspendLayout();
this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// timHSCZ
//
this.timHSCZ.Enabled = true;
//
// label9
//
this.label9.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold);
this.label9.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label9.Location = new System.Drawing.Point(-136, -165);
this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(685, 50);
this.label9.TabIndex = 22;
this.label9.Text = "微型减速机";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// timUI
//
this.timUI.Enabled = true;
//
// labelTime
//
this.labelTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F);
this.labelTime.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.labelTime.Location = new System.Drawing.Point(898, -165);
this.labelTime.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.labelTime.Name = "labelTime";
this.labelTime.Size = new System.Drawing.Size(647, 58);
this.labelTime.TabIndex = 23;
this.labelTime.Text = "2021-03-09 12:30:30";
this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label18
//
this.label18.BackColor = System.Drawing.Color.Transparent;
this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label18.Cursor = System.Windows.Forms.Cursors.Hand;
this.label18.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.label18.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label18.Location = new System.Drawing.Point(188, 177);
this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(93, 54);
this.label18.TabIndex = 1;
this.label18.Text = "查询";
this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label18.Visible = false;
//
// panel7
//
this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.panel7.Controls.Add(this.label18);
this.panel7.Location = new System.Drawing.Point(-144, -112);
this.panel7.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(1688, 68);
this.panel7.TabIndex = 24;
//
// panel3
//
this.panel3.Controls.Add(this.pictureBox12_end_2);
this.panel3.Controls.Add(this.pictureBox2_start_2);
this.panel3.Controls.Add(this.pictureBox12_end_1);
this.panel3.Controls.Add(this.pictureBox2_start_1);
this.panel3.Controls.Add(this.textBox_MeasureValue_2);
this.panel3.Controls.Add(this.textBox_MeasureValue_1);
this.panel3.Controls.Add(this.label6);
this.panel3.Controls.Add(this.label5);
this.panel3.Controls.Add(this.pictureBox1);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(3, 77);
this.panel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(1767, 684);
this.panel3.TabIndex = 4;
//
// pictureBox12_end_2
//
this.pictureBox12_end_2.Image = global::CCYQ_JieFang.Properties.Resources.OK;
this.pictureBox12_end_2.Location = new System.Drawing.Point(678, 238);
this.pictureBox12_end_2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox12_end_2.Name = "pictureBox12_end_2";
this.pictureBox12_end_2.Size = new System.Drawing.Size(57, 53);
this.pictureBox12_end_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox12_end_2.TabIndex = 9;
this.pictureBox12_end_2.TabStop = false;
//
// pictureBox2_start_2
//
this.pictureBox2_start_2.Image = global::CCYQ_JieFang.Properties.Resources.;
this.pictureBox2_start_2.Location = new System.Drawing.Point(678, 238);
this.pictureBox2_start_2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox2_start_2.Name = "pictureBox2_start_2";
this.pictureBox2_start_2.Size = new System.Drawing.Size(57, 53);
this.pictureBox2_start_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox2_start_2.TabIndex = 10;
this.pictureBox2_start_2.TabStop = false;
//
// pictureBox12_end_1
//
this.pictureBox12_end_1.Image = global::CCYQ_JieFang.Properties.Resources.OK;
this.pictureBox12_end_1.Location = new System.Drawing.Point(678, 161);
this.pictureBox12_end_1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox12_end_1.Name = "pictureBox12_end_1";
this.pictureBox12_end_1.Size = new System.Drawing.Size(57, 53);
this.pictureBox12_end_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox12_end_1.TabIndex = 9;
this.pictureBox12_end_1.TabStop = false;
//
// pictureBox2_start_1
//
this.pictureBox2_start_1.Image = global::CCYQ_JieFang.Properties.Resources.;
this.pictureBox2_start_1.Location = new System.Drawing.Point(678, 161);
this.pictureBox2_start_1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox2_start_1.Name = "pictureBox2_start_1";
this.pictureBox2_start_1.Size = new System.Drawing.Size(57, 53);
this.pictureBox2_start_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox2_start_1.TabIndex = 10;
this.pictureBox2_start_1.TabStop = false;
//
// textBox_MeasureValue_2
//
this.textBox_MeasureValue_2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_MeasureValue_2.Font = new System.Drawing.Font("宋体", 17F);
this.textBox_MeasureValue_2.ForeColor = System.Drawing.SystemColors.ControlText;
this.textBox_MeasureValue_2.Location = new System.Drawing.Point(505, 246);
this.textBox_MeasureValue_2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox_MeasureValue_2.Name = "textBox_MeasureValue_2";
this.textBox_MeasureValue_2.ReadOnly = true;
this.textBox_MeasureValue_2.Size = new System.Drawing.Size(158, 40);
this.textBox_MeasureValue_2.TabIndex = 4;
this.textBox_MeasureValue_2.Text = "0";
//
// textBox_MeasureValue_1
//
this.textBox_MeasureValue_1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_MeasureValue_1.Font = new System.Drawing.Font("宋体", 17F);
this.textBox_MeasureValue_1.ForeColor = System.Drawing.SystemColors.ControlText;
this.textBox_MeasureValue_1.Location = new System.Drawing.Point(505, 169);
this.textBox_MeasureValue_1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox_MeasureValue_1.Name = "textBox_MeasureValue_1";
this.textBox_MeasureValue_1.ReadOnly = true;
this.textBox_MeasureValue_1.Size = new System.Drawing.Size(158, 40);
this.textBox_MeasureValue_1.TabIndex = 4;
this.textBox_MeasureValue_1.Text = "0";
//
// label6
//
this.label6.AutoSize = true;
this.label6.BackColor = System.Drawing.Color.White;
this.label6.Font = new System.Drawing.Font("宋体", 17F);
this.label6.Location = new System.Drawing.Point(411, 250);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(86, 29);
this.label6.TabIndex = 6;
this.label6.Text = "压力2";
//
// label5
//
this.label5.AutoSize = true;
this.label5.BackColor = System.Drawing.Color.White;
this.label5.Font = new System.Drawing.Font("宋体", 17F);
this.label5.Location = new System.Drawing.Point(411, 173);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(86, 29);
this.label5.TabIndex = 6;
this.label5.Text = "压力1";
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.White;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.pictureBox1.Image = global::CCYQ_JieFang.Properties.Resources._03_卫星模型;
this.pictureBox1.Location = new System.Drawing.Point(116, 13);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(1501, 668);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// panel1
//
this.panel1.Controls.Add(this.label16);
this.panel1.Controls.Add(this.button_running);
this.panel1.Controls.Add(this.button_alarm);
this.panel1.Controls.Add(this.button_finished);
this.panel1.Controls.Add(this.button_empty);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 765);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1767, 71);
this.panel1.TabIndex = 3;
//
// label16
//
this.label16.BackColor = System.Drawing.Color.Black;
this.label16.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label16.Location = new System.Drawing.Point(0, 3);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(1760, 3);
this.label16.TabIndex = 10;
//
// button_running
//
this.button_running.BackColor = System.Drawing.Color.Gray;
this.button_running.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button_running.Font = new System.Drawing.Font("宋体", 12F);
this.button_running.ForeColor = System.Drawing.Color.White;
this.button_running.Location = new System.Drawing.Point(34, 12);
this.button_running.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button_running.Name = "button_running";
this.button_running.Size = new System.Drawing.Size(296, 55);
this.button_running.TabIndex = 4;
this.button_running.Text = "设备运行(禁止上下料)";
this.button_running.UseVisualStyleBackColor = false;
//
// button_alarm
//
this.button_alarm.BackColor = System.Drawing.Color.Gray;
this.button_alarm.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button_alarm.Font = new System.Drawing.Font("宋体", 12F);
this.button_alarm.ForeColor = System.Drawing.Color.White;
this.button_alarm.Location = new System.Drawing.Point(1113, 13);
this.button_alarm.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button_alarm.Name = "button_alarm";
this.button_alarm.Size = new System.Drawing.Size(296, 55);
this.button_alarm.TabIndex = 5;
this.button_alarm.Text = "设备故障";
this.button_alarm.UseVisualStyleBackColor = false;
//
// button_finished
//
this.button_finished.BackColor = System.Drawing.Color.Gray;
this.button_finished.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button_finished.Font = new System.Drawing.Font("宋体", 12F);
this.button_finished.ForeColor = System.Drawing.Color.White;
this.button_finished.Location = new System.Drawing.Point(393, 12);
this.button_finished.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button_finished.Name = "button_finished";
this.button_finished.Size = new System.Drawing.Size(296, 55);
this.button_finished.TabIndex = 6;
this.button_finished.Text = "完成装配(请求下料)";
this.button_finished.UseVisualStyleBackColor = false;
//
// button_empty
//
this.button_empty.BackColor = System.Drawing.Color.Gray;
this.button_empty.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button_empty.Font = new System.Drawing.Font("宋体", 12F);
this.button_empty.ForeColor = System.Drawing.Color.White;
this.button_empty.Location = new System.Drawing.Point(754, 13);
this.button_empty.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button_empty.Name = "button_empty";
this.button_empty.Size = new System.Drawing.Size(296, 55);
this.button_empty.TabIndex = 7;
this.button_empty.Text = "设备空闲(请求上料)";
this.button_empty.UseVisualStyleBackColor = false;
//
// panel2
//
this.panel2.Controls.Add(this.label_AgvLeaved);
this.panel2.Controls.Add(this.label19);
this.panel2.Controls.Add(this.label_AgvCanLeave);
this.panel2.Controls.Add(this.label15);
this.panel2.Controls.Add(this.label_AgvRequestLeave);
this.panel2.Controls.Add(this.button5_heartBeat_Ning);
this.panel2.Controls.Add(this.button5_heartBeat);
this.panel2.Controls.Add(this.label_AgvCanEnter);
this.panel2.Controls.Add(this.textBox1_PartPosition);
this.panel2.Controls.Add(this.label_AgvSongliao);
this.panel2.Controls.Add(this.label_AgvRequestEnter);
this.panel2.Controls.Add(this.label17);
this.panel2.Controls.Add(this.textBox1_EngineID);
this.panel2.Controls.Add(this.label1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(3, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1767, 71);
this.panel2.TabIndex = 2;
//
// label_AgvLeaved
//
this.label_AgvLeaved.AutoSize = true;
this.label_AgvLeaved.Font = new System.Drawing.Font("宋体", 11F);
this.label_AgvLeaved.Location = new System.Drawing.Point(1238, 10);
this.label_AgvLeaved.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label_AgvLeaved.Name = "label_AgvLeaved";
this.label_AgvLeaved.Size = new System.Drawing.Size(134, 19);
this.label_AgvLeaved.TabIndex = 9;
this.label_AgvLeaved.Text = "●AGV已经离开";
//
// label19
//
this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label19.Location = new System.Drawing.Point(1561, 13);
this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(2, 37);
this.label19.TabIndex = 9;
//
// label_AgvCanLeave
//
this.label_AgvCanLeave.AutoSize = true;
this.label_AgvCanLeave.Font = new System.Drawing.Font("宋体", 11F);
this.label_AgvCanLeave.Location = new System.Drawing.Point(1089, 38);
this.label_AgvCanLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label_AgvCanLeave.Name = "label_AgvCanLeave";
this.label_AgvCanLeave.Size = new System.Drawing.Size(134, 19);
this.label_AgvCanLeave.TabIndex = 9;
this.label_AgvCanLeave.Text = "●AGV可以离开";
//
// label15
//
this.label15.BackColor = System.Drawing.Color.Black;
this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label15.Location = new System.Drawing.Point(0, 62);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(1760, 3);
this.label15.TabIndex = 9;
//
// label_AgvRequestLeave
//
this.label_AgvRequestLeave.AutoSize = true;
this.label_AgvRequestLeave.Font = new System.Drawing.Font("宋体", 11F);
this.label_AgvRequestLeave.Location = new System.Drawing.Point(1089, 10);
this.label_AgvRequestLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label_AgvRequestLeave.Name = "label_AgvRequestLeave";
this.label_AgvRequestLeave.Size = new System.Drawing.Size(134, 19);
this.label_AgvRequestLeave.TabIndex = 9;
this.label_AgvRequestLeave.Text = "●AGV请求离开";
//
// button5_heartBeat_Ning
//
this.button5_heartBeat_Ning.BackColor = System.Drawing.Color.Gray;
this.button5_heartBeat_Ning.Font = new System.Drawing.Font("宋体", 12F);
this.button5_heartBeat_Ning.ForeColor = System.Drawing.Color.White;
this.button5_heartBeat_Ning.Location = new System.Drawing.Point(1569, 10);
this.button5_heartBeat_Ning.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button5_heartBeat_Ning.Name = "button5_heartBeat_Ning";
this.button5_heartBeat_Ning.Size = new System.Drawing.Size(89, 43);
this.button5_heartBeat_Ning.TabIndex = 5;
this.button5_heartBeat_Ning.Text = "拧紧枪";
this.button5_heartBeat_Ning.UseVisualStyleBackColor = false;
this.button5_heartBeat_Ning.Visible = false;
//
// button5_heartBeat
//
this.button5_heartBeat.BackColor = System.Drawing.Color.Gray;
this.button5_heartBeat.Font = new System.Drawing.Font("宋体", 12F);
this.button5_heartBeat.ForeColor = System.Drawing.Color.White;
this.button5_heartBeat.Location = new System.Drawing.Point(1674, 10);
this.button5_heartBeat.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button5_heartBeat.Name = "button5_heartBeat";
this.button5_heartBeat.Size = new System.Drawing.Size(89, 43);
this.button5_heartBeat.TabIndex = 5;
this.button5_heartBeat.Text = "PLC";
this.button5_heartBeat.UseVisualStyleBackColor = false;
//
// label_AgvCanEnter
//
this.label_AgvCanEnter.AutoSize = true;
this.label_AgvCanEnter.Font = new System.Drawing.Font("宋体", 11F);
this.label_AgvCanEnter.Location = new System.Drawing.Point(927, 38);
this.label_AgvCanEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label_AgvCanEnter.Name = "label_AgvCanEnter";
this.label_AgvCanEnter.Size = new System.Drawing.Size(134, 19);
this.label_AgvCanEnter.TabIndex = 9;
this.label_AgvCanEnter.Text = "●AGV可以进入";
//
// textBox1_PartPosition
//
this.textBox1_PartPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1_PartPosition.Font = new System.Drawing.Font("宋体", 20F);
this.textBox1_PartPosition.Location = new System.Drawing.Point(615, 8);
this.textBox1_PartPosition.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox1_PartPosition.Name = "textBox1_PartPosition";
this.textBox1_PartPosition.ReadOnly = true;
this.textBox1_PartPosition.Size = new System.Drawing.Size(105, 46);
this.textBox1_PartPosition.TabIndex = 1;
//
// label_AgvSongliao
//
this.label_AgvSongliao.AutoSize = true;
this.label_AgvSongliao.Font = new System.Drawing.Font("宋体", 11F);
this.label_AgvSongliao.Location = new System.Drawing.Point(785, 12);
this.label_AgvSongliao.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label_AgvSongliao.Name = "label_AgvSongliao";
this.label_AgvSongliao.Size = new System.Drawing.Size(134, 19);
this.label_AgvSongliao.TabIndex = 9;
this.label_AgvSongliao.Text = "●AGV准备送料";
//
// label_AgvRequestEnter
//
this.label_AgvRequestEnter.AutoSize = true;
this.label_AgvRequestEnter.Font = new System.Drawing.Font("宋体", 11F);
this.label_AgvRequestEnter.Location = new System.Drawing.Point(927, 10);
this.label_AgvRequestEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label_AgvRequestEnter.Name = "label_AgvRequestEnter";
this.label_AgvRequestEnter.Size = new System.Drawing.Size(134, 19);
this.label_AgvRequestEnter.TabIndex = 9;
this.label_AgvRequestEnter.Text = "●AGV请求进入";
//
// label17
//
this.label17.AutoSize = true;
this.label17.Font = new System.Drawing.Font("宋体", 16F);
this.label17.Location = new System.Drawing.Point(467, 15);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(147, 27);
this.label17.TabIndex = 0;
this.label17.Text = "装配位置:";
//
// textBox1_EngineID
//
this.textBox1_EngineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1_EngineID.Font = new System.Drawing.Font("宋体", 20F);
this.textBox1_EngineID.Location = new System.Drawing.Point(151, 8);
this.textBox1_EngineID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox1_EngineID.Name = "textBox1_EngineID";
this.textBox1_EngineID.ReadOnly = true;
this.textBox1_EngineID.Size = new System.Drawing.Size(310, 46);
this.textBox1_EngineID.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 16F);
this.label1.Location = new System.Drawing.Point(3, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(147, 27);
this.label1.TabIndex = 0;
this.label1.Text = "产品编码:";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1773, 838);
this.tableLayoutPanel1.TabIndex = 25;
//
// DAS_OP30
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1773, 838);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.label9);
this.Controls.Add(this.labelTime);
this.Controls.Add(this.panel7);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DAS_OP30";
this.Text = "OP30工位-卫星模型";
this.panel7.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Timer timHSCZ;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Timer timUI;
private System.Windows.Forms.Label labelTime;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.TextBox textBox_MeasureValue_2;
private System.Windows.Forms.TextBox textBox_MeasureValue_1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Button button_running;
private System.Windows.Forms.Button button_alarm;
private System.Windows.Forms.Button button_finished;
private System.Windows.Forms.Button button_empty;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label_AgvLeaved;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label_AgvCanLeave;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label_AgvRequestLeave;
private System.Windows.Forms.Button button5_heartBeat;
private System.Windows.Forms.Label label_AgvCanEnter;
private System.Windows.Forms.TextBox textBox1_PartPosition;
private System.Windows.Forms.Label label_AgvRequestEnter;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox textBox1_EngineID;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label_AgvSongliao;
private System.Windows.Forms.Button button5_heartBeat_Ning;
private System.Windows.Forms.PictureBox pictureBox12_end_1;
private System.Windows.Forms.PictureBox pictureBox2_start_1;
private System.Windows.Forms.PictureBox pictureBox12_end_2;
private System.Windows.Forms.PictureBox pictureBox2_start_2;
}
}

View File

@@ -0,0 +1,626 @@
using DK_DC_Tool;
using HslCommunication.Core;
using Newtonsoft.Json;
using NPOI.SS.UserModel;
using OpcBasic;
using Robot.Common;
using Serilog.Events;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using SystemFramework;
namespace MesWork
{
public partial class DAS_OP30
{
InitServer initServer = null;
/// <summary>
///
/// </summary>
private static string OpNameCurrent = "";
/// <summary>
/// 字典 存储12个开始测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicStartMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicEndMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量文本框控件key为测量位置value文本框的值
/// </summary>
Dictionary<int, TextBox> dicMeasureTextBox = new Dictionary<int, TextBox>();
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<DeviceDriver_BasicData.CustomeEvetnArgs> MIS_Funtion_PLC_OP = null;
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<string> AGV_Task_change = null;
/// <summary>
/// PLC事件变化委托--处理托盘信息
/// </summary>
public static Action<string> AGV_Task_Info = null;
// 每个工位的满工件数量
// 工位OP30 4个
public static int partCount = 4;
public static bool isConnect = false;
public DAS_OP30(string opName)
{
InitializeComponent();
publicCore.partCount = partCount;
OpNameCurrent = opName;
Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang;
Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking;
MIS_Funtion_PLC_OP -= MIS_Funtion_PLC;
MIS_Funtion_PLC_OP += MIS_Funtion_PLC;
AGV_Task_change -= SolveAgvDeviceStatus;
AGV_Task_change += SolveAgvDeviceStatus;
if (MesWorkForm.IsDemoMesServer == 1)
{
MoNiHeartBeat();
}
SolvePicAndMeasureValueInit();
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
//var aa =
//new Thread(new ThreadStart(delegate () {
// while (true)
// {
// try
// {
// if (!isConnect)
// {
// if (publicCore.Get_PartPosition(OpNameCurrent) != -1)
// {
// isConnect = true;
// ProductInfo_search();
// }
// }
// }
// catch (Exception err) { }
// Thread.Sleep(1000);
// }
//}));
//aa.IsBackground = true;
//aa.Start();
}
public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent)
{
try
{
var tagID = msgEvent.TagID.ToString();
// var opName = msgEvent.OpName.ToString();
var tagTypeCodeID = (int)msgEvent.TagTypeCodeID;
var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID;
string tagValue;
switch (tagTypeID)
{
case EnumTagTypeID.BOOL:
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
switch (tagTypeCodeID)
{
case 14:
DeviceHeartBeat(tagValue);
break;
// AGV任务
case 50:
publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue);
break;
// 51 空闲(请求上料)
// 52 完成(请求下料)
// 53 故障
case 51:
case 52:
case 53:
publicCore.SolveDeviceStatus(OpNameCurrent);
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
break;
// 54 第几个件
case 54:
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case 55:
publicCore.MeasurePositionChange(OpNameCurrent, 2);
SolvePicAndMeasureValueWorking();
break;
//读电批
case 56:
if (tagValue == "1")
{
publicCore.LogInsert("OP30", "Info", "【PLC_读电批置位】");
// 不在这个地方写true,写在接收数据的地方写
}
else
{
publicCore.LogInsert("OP30", "Info", "【PLC_读电批复位】");
MesWorkForm.WritePLC(83, OpNameCurrent, false);
publicCore.LogInsert("OP30", "Info", "【IPC_读电批完成复位】");
}
break;
//读泄漏量1 2或者压力
case 59:
if (tagValue == "1")
{
//publicCore.ReadQualityData_LeakageRate(OpNameCurrent);
publicCore.ReadQualityData_Pressure(OpNameCurrent);
MesWorkForm.WritePLC(84, OpNameCurrent, true);
}
else
{
MesWorkForm.WritePLC(84, OpNameCurrent, false);
}
break;
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// 初始化界面显示
/// </summary>
private void SolvePicAndMeasureValueInit()
{
try
{
dicStartMasurePictureBox.Add(1, pictureBox2_start_1);
dicStartMasurePictureBox.Add(2, pictureBox2_start_2);
dicEndMasurePictureBox.Add(1, pictureBox12_end_1);
dicEndMasurePictureBox.Add(2, pictureBox12_end_2);
dicMeasureTextBox.Add(1, textBox_MeasureValue_1);
dicMeasureTextBox.Add(2, textBox_MeasureValue_2);
foreach (var item in dicStartMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicEndMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicMeasureTextBox)
{
item.Value.Text = "";
}
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "1")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 工作时界面显示
/// </summary>
private void SolvePicAndMeasureValueWorking()
{
try
{
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "2")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 界面产品编码和装配位置的显示
/// </summary>
public void ProductInfo_search()
{
try
{
//textBox1_EngineID.Text = "";
//textBox1_PartPosition.Text = "";
ShowTextBoxControl(textBox1_EngineID, "", Color.White);
ShowTextBoxControl(textBox1_PartPosition, "", Color.White);
int PartPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White);
ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White);
//textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString();
//textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString();
}
}
catch (Exception err)
{
}
}
private void ShowPicBoxControl(Control c, bool ststus)
{
c.BeginInvoke(new Action(delegate () {
c.Visible = ststus;
}));
}
private void ShowTextBoxControl(Control c, string value, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.Text = value;
c.BackColor = color;
}));
}
private void ShowLabelControl(Control c, Color color)
{
//if (c.InvokeRequired)
//{
//}
//else
//{
// c.ForeColor = color;
//}
c.BeginInvoke(new Action(delegate () {
c.ForeColor = color;
}));
}
private void ShowButtonControl(Control c, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.BackColor = color;
}));
}
/// <summary>
/// 初始化设备状态
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// </summary>
private void SolveDeviceStatusInit(string currentStatus)
{
try
{
ShowButtonControl(button_running, Color.Gray);
ShowButtonControl(button_finished, Color.Gray);
ShowButtonControl(button_empty, Color.Gray);
ShowButtonControl(button_alarm, Color.Gray);
//button_running.BackColor = Color.Gray;
//button_finished.BackColor = Color.Gray;
//button_empty.BackColor = Color.Gray;
//button_alarm.BackColor = Color.Gray;
if (currentStatus == "1")
{
ShowButtonControl(button_running, Color.Green);
//button_running.BackColor = Color.Green;
}
else if (currentStatus == "2")
{
ShowButtonControl(button_empty, Color.SkyBlue);
//button_empty.BackColor = Color.SkyBlue;
}
else if (currentStatus == "3")
{
ShowButtonControl(button_finished, Color.DarkOrange);
//button_finished.BackColor = Color.DarkOrange;
}
else if (currentStatus == "4")
{
ShowButtonControl(button_alarm, Color.Red);
//button_alarm.BackColor = Color.Red;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// AGV设备状态显示
/// </summary>
/// <param name="PLC_AgvTaskNum"></param>
private void SolveAgvDeviceStatus(string PLC_AgvTaskNum)
{
try
{
// 77 反馈AGV任务
switch (PLC_AgvTaskNum)
{
case "10":
// AGV触发装配任务 正在送料
//label_AgvSongliao.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Black;
ShowLabelControl(label_AgvSongliao, Color.Green);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Black);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case "11":
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
break;
// 允许AGV进行上料 --允许进入
// 允许AGV进行下料 --允许进入
case "2":
case "4":
ShowLabelControl(label_AgvCanEnter, Color.Green);
ShowLabelControl(label_AgvCanLeave, Color.Black);
//label_AgvCanEnter.ForeColor = Color.Green;
//label_AgvCanLeave.ForeColor = Color.Black;
break;
case "21":
// AGV 上料完成
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Green;
break;
case "3":
// 1.调用FSS-接收IPC下料请求的接口
// 2.反馈任务号30 AGV已呼叫成功正在去往下料区
break;
case "31":
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Green;
// AGV已到达下料区
break;
case "41":
// AGV下料完成
break;
// 允许AGV离开
case "5":
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Green);
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Green;
break;
case "51":
//label_AgvSongliao.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Green;
ShowLabelControl(label_AgvSongliao, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Green);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 设备PLC心跳button5_heartBeat_Ning
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat(string tagValue)
{
WritePLC(15, OpNameCurrent, tagValue);
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat, Color.Green);
//button5_heartBeat.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat, Color.Gray);
//button5_heartBeat.BackColor = Color.Gray;
}
}
/// <summary>
/// 设备PLC心跳
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat_NingJinQiang(string tagValue)
{
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat_Ning, Color.Green);
//button5_heartBeat_Ning.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat_Ning, Color.Red);
//button5_heartBeat_Ning.BackColor = Color.Red;
}
}
private void MoNiHeartBeat()
{
bool tv = false;
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
WritePLC(14, OpNameCurrent, tv);
tv = !tv;
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
}
private void label5_Click(object sender, EventArgs e)
{
}
private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timHSCZ.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 221</value>
</metadata>
<metadata name="timUI.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 221</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>33</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz
UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC
QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm
Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX
dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT
PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0
F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd
0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI
Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg
gg==
</value>
</data>
</root>

1002
CCYQ_JieFang/OP/OP40/DAS_OP40.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,648 @@
using DK_DC_Tool;
using HslCommunication.Core;
using Newtonsoft.Json;
using NPOI.SS.UserModel;
using OpcBasic;
using Robot.Common;
using Serilog.Events;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using SystemFramework;
namespace MesWork
{
public partial class DAS_OP40
{
InitServer initServer = null;
/// <summary>
///
/// </summary>
private static string OpNameCurrent = "";
/// <summary>
/// 字典 存储12个开始测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicStartMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicEndMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量文本框控件key为测量位置value文本框的值
/// </summary>
Dictionary<int, TextBox> dicMeasureTextBox = new Dictionary<int, TextBox>();
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<DeviceDriver_BasicData.CustomeEvetnArgs> MIS_Funtion_PLC_OP = null;
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<string> AGV_Task_change = null;
/// <summary>
/// PLC事件变化委托--处理托盘信息
/// </summary>
public static Action<string> AGV_Task_Info = null;
// 每个工位的满工件数量
// 工位OP40 2个
public static int partCount = 2;
public static bool isConnect = false;
public DAS_OP40(string opName)
{
InitializeComponent();
publicCore.partCount = partCount;
OpNameCurrent = opName;
Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang;
Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking;
MIS_Funtion_PLC_OP -= MIS_Funtion_PLC;
MIS_Funtion_PLC_OP += MIS_Funtion_PLC;
AGV_Task_change -= SolveAgvDeviceStatus;
AGV_Task_change += SolveAgvDeviceStatus;
if (MesWorkForm.IsDemoMesServer == 1)
{
MoNiHeartBeat();
}
SolvePicAndMeasureValueInit();
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
}
catch (Exception err) {
}
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
//var aa =
//new Thread(new ThreadStart(delegate () {
// while (true)
// {
// try
// {
// if (!isConnect)
// {
// if (publicCore.Get_PartPosition(OpNameCurrent) != -1)
// {
// isConnect = true;
// ProductInfo_search();
// }
// }
// }
// catch (Exception err) { }
// Thread.Sleep(1000);
// }
//}));
//aa.IsBackground = true;
//aa.Start();
}
public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent)
{
try
{
var tagID = msgEvent.TagID.ToString();
// var opName = msgEvent.OpName.ToString();
var tagTypeCodeID = (int)msgEvent.TagTypeCodeID;
var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID;
string tagValue;
switch (tagTypeID)
{
case EnumTagTypeID.BOOL:
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
switch (tagTypeCodeID)
{
case 14:
DeviceHeartBeat(tagValue);
break;
// AGV任务
case 50:
publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue);
break;
// 51 空闲(请求上料)
// 52 完成(请求下料)
// 53 故障
case 51:
case 52:
case 53:
publicCore.SolveDeviceStatus(OpNameCurrent);
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
break;
// 54 第几个件
case 54:
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
// 55 第几个孔
case 55:
publicCore.MeasurePositionChange(OpNameCurrent, 2);
SolvePicAndMeasureValueWorking();
break;
//读电批
case 56:
if (tagValue == "1")
{
publicCore.LogInsert("OP40", "Info", "【PLC_读电批置位】");
// 不在这个地方写true,写在接收数据的地方写
}
else
{
publicCore.LogInsert("OP40", "Info", "【PLC_读电批复位】");
MesWorkForm.WritePLC(83, OpNameCurrent, false);
publicCore.LogInsert("OP40", "Info", "【IPC_读电批完成复位】");
}
break;
//读泄漏量1 2或者压力
case 59:
if (tagValue == "1")
{
publicCore.ReadQualityData_LeakageRate(OpNameCurrent);
//publicCore.ReadQualityData_Pressure(OpNameCurrent);
MesWorkForm.WritePLC(84, OpNameCurrent, true);
}
else
{
MesWorkForm.WritePLC(84, OpNameCurrent, false);
}
break;
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// 初始化界面显示
/// </summary>
private void SolvePicAndMeasureValueInit()
{
try
{
dicStartMasurePictureBox.Add(1, pictureBox2_start_1);
dicStartMasurePictureBox.Add(2, pictureBox2_start_2);
dicStartMasurePictureBox.Add(3, pictureBox2_start_3);
dicStartMasurePictureBox.Add(4, pictureBox2_start_4);
dicStartMasurePictureBox.Add(5, pictureBox2_start_5);
dicStartMasurePictureBox.Add(6, pictureBox2_start_6);
dicStartMasurePictureBox.Add(7, pictureBox2_start_7);
dicStartMasurePictureBox.Add(8, pictureBox2_start_8);
dicStartMasurePictureBox.Add(9, pictureBox2_start_9);
dicEndMasurePictureBox.Add(1, pictureBox12_end_1);
dicEndMasurePictureBox.Add(2, pictureBox12_end_2);
dicEndMasurePictureBox.Add(3, pictureBox12_end_3);
dicEndMasurePictureBox.Add(4, pictureBox12_end_4);
dicEndMasurePictureBox.Add(5, pictureBox12_end_5);
dicEndMasurePictureBox.Add(6, pictureBox12_end_6);
dicEndMasurePictureBox.Add(7, pictureBox12_end_7);
dicEndMasurePictureBox.Add(8, pictureBox12_end_8);
dicEndMasurePictureBox.Add(9, pictureBox12_end_9);
dicMeasureTextBox.Add(1, textBox_MeasureValue_1);
dicMeasureTextBox.Add(2, textBox_MeasureValue_2);
dicMeasureTextBox.Add(3, textBox_MeasureValue_3);
dicMeasureTextBox.Add(4, textBox_MeasureValue_4);
dicMeasureTextBox.Add(5, textBox_MeasureValue_5);
dicMeasureTextBox.Add(6, textBox_MeasureValue_6);
dicMeasureTextBox.Add(7, textBox_MeasureValue_7);
dicMeasureTextBox.Add(8, textBox_MeasureValue_8);
dicMeasureTextBox.Add(9, textBox_MeasureValue_9);
foreach (var item in dicStartMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicEndMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicMeasureTextBox)
{
item.Value.Text = "";
}
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "1")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 工作时界面显示
/// </summary>
private void SolvePicAndMeasureValueWorking()
{
try
{
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "2")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 界面产品编码和装配位置的显示
/// </summary>
public void ProductInfo_search()
{
try
{
//textBox1_EngineID.Text = "";
//textBox1_PartPosition.Text = "";
ShowTextBoxControl(textBox1_EngineID, "", Color.White);
ShowTextBoxControl(textBox1_PartPosition, "", Color.White);
int PartPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White);
ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White);
//textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString();
//textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString();
}
}
catch (Exception err)
{
}
}
private void ShowPicBoxControl(Control c, bool ststus)
{
c.BeginInvoke(new Action(delegate () {
c.Visible = ststus;
}));
}
private void ShowTextBoxControl(Control c, string value, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.Text = value;
c.BackColor = color;
}));
}
private void ShowLabelControl(Control c, Color color)
{
//if (c.InvokeRequired)
//{
//}
//else
//{
// c.ForeColor = color;
//}
c.BeginInvoke(new Action(delegate () {
c.ForeColor = color;
}));
}
private void ShowButtonControl(Control c, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.BackColor = color;
}));
}
/// <summary>
/// 初始化设备状态
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// </summary>
private void SolveDeviceStatusInit(string currentStatus)
{
try
{
ShowButtonControl(button_running, Color.Gray);
ShowButtonControl(button_finished, Color.Gray);
ShowButtonControl(button_empty, Color.Gray);
ShowButtonControl(button_alarm, Color.Gray);
//button_running.BackColor = Color.Gray;
//button_finished.BackColor = Color.Gray;
//button_empty.BackColor = Color.Gray;
//button_alarm.BackColor = Color.Gray;
if (currentStatus == "1")
{
ShowButtonControl(button_running, Color.Green);
//button_running.BackColor = Color.Green;
}
else if (currentStatus == "2")
{
ShowButtonControl(button_empty, Color.SkyBlue);
//button_empty.BackColor = Color.SkyBlue;
}
else if (currentStatus == "3")
{
ShowButtonControl(button_finished, Color.DarkOrange);
//button_finished.BackColor = Color.DarkOrange;
}
else if (currentStatus == "4")
{
ShowButtonControl(button_alarm, Color.Red);
//button_alarm.BackColor = Color.Red;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// AGV设备状态显示
/// </summary>
/// <param name="PLC_AgvTaskNum"></param>
private void SolveAgvDeviceStatus(string PLC_AgvTaskNum)
{
try
{
// 77 反馈AGV任务
switch (PLC_AgvTaskNum)
{
case "10":
// AGV触发装配任务 正在送料
//label_AgvSongliao.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Black;
ShowLabelControl(label_AgvSongliao, Color.Green);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Black);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case "11":
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
break;
// 允许AGV进行上料 --允许进入
// 允许AGV进行下料 --允许进入
case "2":
case "4":
ShowLabelControl(label_AgvCanEnter, Color.Green);
ShowLabelControl(label_AgvCanLeave, Color.Black);
//label_AgvCanEnter.ForeColor = Color.Green;
//label_AgvCanLeave.ForeColor = Color.Black;
break;
case "21":
// AGV 上料完成
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Green;
break;
case "3":
// 1.调用FSS-接收IPC下料请求的接口
// 2.反馈任务号30 AGV已呼叫成功正在去往下料区
break;
case "31":
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Green;
// AGV已到达下料区
break;
case "41":
// AGV下料完成
break;
// 允许AGV离开
case "5":
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Green);
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Green;
break;
case "51":
//label_AgvSongliao.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Green;
ShowLabelControl(label_AgvSongliao, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Green);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 设备PLC心跳button5_heartBeat_Ning
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat(string tagValue)
{
WritePLC(15, OpNameCurrent, tagValue);
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat, Color.Green);
//button5_heartBeat.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat, Color.Gray);
//button5_heartBeat.BackColor = Color.Gray;
}
}
/// <summary>
/// 设备PLC心跳
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat_NingJinQiang(string tagValue)
{
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat_Ning, Color.Green);
//button5_heartBeat_Ning.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat_Ning, Color.Red);
//button5_heartBeat_Ning.BackColor = Color.Red;
}
}
private void MoNiHeartBeat()
{
bool tv = false;
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
WritePLC(14, OpNameCurrent, tv);
tv = !tv;
}
catch (Exception err) {
}
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
}
private void label5_Click(object sender, EventArgs e)
{
}
private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timHSCZ.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 221</value>
</metadata>
<metadata name="timUI.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 221</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>33</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz
UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC
QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm
Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX
dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT
PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0
F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd
0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI
Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg
gg==
</value>
</data>
</root>

1179
CCYQ_JieFang/OP/OP50/DAS_OP50.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,654 @@
using DK_DC_Tool;
using HslCommunication.Core;
using Newtonsoft.Json;
using NPOI.SS.UserModel;
using OpcBasic;
using Robot.Common;
using Serilog.Events;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using SystemFramework;
namespace MesWork
{
public partial class DAS_OP50
{
InitServer initServer = null;
/// <summary>
///
/// </summary>
private static string OpNameCurrent = "";
/// <summary>
/// 字典 存储12个开始测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicStartMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量图片控件key为测量位置value为图片控件
/// </summary>
Dictionary<int, PictureBox> dicEndMasurePictureBox = new Dictionary<int, PictureBox>();
/// <summary>
/// 字典 存储12个结束测量文本框控件key为测量位置value文本框的值
/// </summary>
Dictionary<int, TextBox> dicMeasureTextBox = new Dictionary<int, TextBox>();
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<DeviceDriver_BasicData.CustomeEvetnArgs> MIS_Funtion_PLC_OP = null;
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<string> AGV_Task_change = null;
/// <summary>
/// PLC事件变化委托--处理托盘信息
/// </summary>
public static Action<string> AGV_Task_Info = null;
// 每个工位的满工件数量
// 工位OP50 3个
public static int partCount = 3;
public static bool isConnect = false;
public DAS_OP50(string opName)
{
InitializeComponent();
publicCore.partCount = partCount;
OpNameCurrent = opName;
Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang;
Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking;
MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking;
MIS_Funtion_PLC_OP -= MIS_Funtion_PLC;
MIS_Funtion_PLC_OP += MIS_Funtion_PLC;
AGV_Task_change -= SolveAgvDeviceStatus;
AGV_Task_change += SolveAgvDeviceStatus;
if (MesWorkForm.IsDemoMesServer == 1)
{
MoNiHeartBeat();
}
SolvePicAndMeasureValueInit();
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
//var aa =
//new Thread(new ThreadStart(delegate () {
// while (true)
// {
// try
// {
// if (!isConnect)
// {
// if (publicCore.Get_PartPosition(OpNameCurrent) != -1)
// {
// isConnect = true;
// ProductInfo_search();
// }
// }
// }
// catch (Exception err) { }
// Thread.Sleep(1000);
// }
//}));
//aa.IsBackground = true;
//aa.Start();
}
public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent)
{
try
{
var tagID = msgEvent.TagID.ToString();
// var opName = msgEvent.OpName.ToString();
var tagTypeCodeID = (int)msgEvent.TagTypeCodeID;
var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID;
string tagValue;
switch (tagTypeID)
{
case EnumTagTypeID.BOOL:
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
switch (tagTypeCodeID)
{
case 14:
DeviceHeartBeat(tagValue);
break;
// AGV任务
case 50:
publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue);
break;
// 51 空闲(请求上料)
// 52 完成(请求下料)
// 53 故障
case 51:
case 52:
case 53:
publicCore.SolveDeviceStatus(OpNameCurrent);
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
break;
// 54 第几个件
case 54:
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case 55:
publicCore.MeasurePositionChange(OpNameCurrent, 2);
SolvePicAndMeasureValueWorking();
break;
//读电批
case 56:
if (tagValue == "1")
{
publicCore.LogInsert("OP50", "Info", "【PLC_读电批置位】");
// 不在这个地方写true,写在接收数据的地方写
}
else
{
publicCore.LogInsert("OP50", "Info", "【PLC_读电批复位】");
MesWorkForm.WritePLC(83, OpNameCurrent, false);
publicCore.LogInsert("OP50", "Info", "【IPC_读电批完成复位】");
}
break;
//读泄漏量1 2或者压力
case 59:
if (tagValue == "1")
{
//publicCore.ReadQualityData_LeakageRate(OpNameCurrent);
//publicCore.ReadQualityData_Pressure(OpNameCurrent);
MesWorkForm.WritePLC(84, OpNameCurrent, true);
}
else
{
MesWorkForm.WritePLC(84, OpNameCurrent, false);
}
break;
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// 初始化界面显示
/// </summary>
private void SolvePicAndMeasureValueInit()
{
try
{
dicStartMasurePictureBox.Add(1, pictureBox2_start_1);
dicStartMasurePictureBox.Add(2, pictureBox2_start_2);
dicStartMasurePictureBox.Add(3, pictureBox2_start_3);
dicStartMasurePictureBox.Add(4, pictureBox2_start_4);
dicStartMasurePictureBox.Add(5, pictureBox2_start_5);
dicStartMasurePictureBox.Add(6, pictureBox2_start_6);
dicStartMasurePictureBox.Add(7, pictureBox2_start_7);
dicStartMasurePictureBox.Add(8, pictureBox2_start_8);
dicStartMasurePictureBox.Add(9, pictureBox2_start_9);
dicStartMasurePictureBox.Add(10, pictureBox2_start_10);
dicStartMasurePictureBox.Add(11, pictureBox2_start_11);
dicStartMasurePictureBox.Add(12, pictureBox2_start_12);
dicEndMasurePictureBox.Add(1, pictureBox12_end_1);
dicEndMasurePictureBox.Add(2, pictureBox12_end_2);
dicEndMasurePictureBox.Add(3, pictureBox12_end_3);
dicEndMasurePictureBox.Add(4, pictureBox12_end_4);
dicEndMasurePictureBox.Add(5, pictureBox12_end_5);
dicEndMasurePictureBox.Add(6, pictureBox12_end_6);
dicEndMasurePictureBox.Add(7, pictureBox12_end_7);
dicEndMasurePictureBox.Add(8, pictureBox12_end_8);
dicEndMasurePictureBox.Add(9, pictureBox12_end_9);
dicEndMasurePictureBox.Add(10, pictureBox12_end_10);
dicEndMasurePictureBox.Add(11, pictureBox12_end_11);
dicEndMasurePictureBox.Add(12, pictureBox12_end_12);
dicMeasureTextBox.Add(1, textBox_MeasureValue_1);
dicMeasureTextBox.Add(2, textBox_MeasureValue_2);
dicMeasureTextBox.Add(3, textBox_MeasureValue_3);
dicMeasureTextBox.Add(4, textBox_MeasureValue_4);
dicMeasureTextBox.Add(5, textBox_MeasureValue_5);
dicMeasureTextBox.Add(6, textBox_MeasureValue_6);
dicMeasureTextBox.Add(7, textBox_MeasureValue_7);
dicMeasureTextBox.Add(8, textBox_MeasureValue_8);
dicMeasureTextBox.Add(9, textBox_MeasureValue_9);
dicMeasureTextBox.Add(10, textBox_MeasureValue_10);
dicMeasureTextBox.Add(11, textBox_MeasureValue_11);
dicMeasureTextBox.Add(12, textBox_MeasureValue_12);
foreach (var item in dicStartMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicEndMasurePictureBox)
{
item.Value.Visible = false;
}
foreach (var item in dicMeasureTextBox)
{
item.Value.Text = "";
}
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "1")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 工作时界面显示
/// </summary>
private void SolvePicAndMeasureValueWorking()
{
try
{
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
string tagValue = dt.Rows[i]["测量值"].ToString();
string isOk = dt.Rows[i]["是否合格"].ToString();
// 测量状态为1 表示初始状态,两张图片都不显示
// 测量状态为2 表示正在测量,显示第二张图片
// 测量状态为3 表示测量完成,显示第一张图片
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
if (measureStatus == 1)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 2)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
}
else if (measureStatus == 3)
{
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
}
if (isOk == "2")
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
}
else
{
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
}
}
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 界面产品编码和装配位置的显示
/// </summary>
public void ProductInfo_search()
{
try
{
//textBox1_EngineID.Text = "";
//textBox1_PartPosition.Text = "";
ShowTextBoxControl(textBox1_EngineID, "", Color.White);
ShowTextBoxControl(textBox1_PartPosition, "", Color.White);
int PartPosition = publicCore.Get_PartPosition(OpNameCurrent);
publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg);
if (dt.Rows.Count > 0)
{
ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White);
ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White);
//textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString();
//textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString();
}
}
catch (Exception err)
{
}
}
private void ShowPicBoxControl(Control c, bool ststus)
{
c.BeginInvoke(new Action(delegate () {
c.Visible = ststus;
}));
}
private void ShowTextBoxControl(Control c, string value, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.Text = value;
c.BackColor = color;
}));
}
private void ShowLabelControl(Control c, Color color)
{
//if (c.InvokeRequired)
//{
//}
//else
//{
// c.ForeColor = color;
//}
c.BeginInvoke(new Action(delegate () {
c.ForeColor = color;
}));
}
private void ShowButtonControl(Control c, Color color)
{
c.BeginInvoke(new Action(delegate () {
c.BackColor = color;
}));
}
/// <summary>
/// 初始化设备状态
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// </summary>
private void SolveDeviceStatusInit(string currentStatus)
{
try
{
ShowButtonControl(button_running, Color.Gray);
ShowButtonControl(button_finished, Color.Gray);
ShowButtonControl(button_empty, Color.Gray);
ShowButtonControl(button_alarm, Color.Gray);
//button_running.BackColor = Color.Gray;
//button_finished.BackColor = Color.Gray;
//button_empty.BackColor = Color.Gray;
//button_alarm.BackColor = Color.Gray;
if (currentStatus == "1")
{
ShowButtonControl(button_running, Color.Green);
//button_running.BackColor = Color.Green;
}
else if (currentStatus == "2")
{
ShowButtonControl(button_empty, Color.SkyBlue);
//button_empty.BackColor = Color.SkyBlue;
}
else if (currentStatus == "3")
{
ShowButtonControl(button_finished, Color.DarkOrange);
//button_finished.BackColor = Color.DarkOrange;
}
else if (currentStatus == "4")
{
ShowButtonControl(button_alarm, Color.Red);
//button_alarm.BackColor = Color.Red;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// AGV设备状态显示
/// </summary>
/// <param name="PLC_AgvTaskNum"></param>
private void SolveAgvDeviceStatus(string PLC_AgvTaskNum)
{
try
{
// 77 反馈AGV任务
switch (PLC_AgvTaskNum)
{
case "10":
// AGV触发装配任务 正在送料
//label_AgvSongliao.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Black;
ShowLabelControl(label_AgvSongliao, Color.Green);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Black);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
case "11":
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Green;
//label_AgvRequestLeave.ForeColor = Color.Black;
break;
// 允许AGV进行上料 --允许进入
// 允许AGV进行下料 --允许进入
case "2":
case "4":
ShowLabelControl(label_AgvCanEnter, Color.Green);
ShowLabelControl(label_AgvCanLeave, Color.Black);
//label_AgvCanEnter.ForeColor = Color.Green;
//label_AgvCanLeave.ForeColor = Color.Black;
break;
case "21":
// AGV 上料完成
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Green);
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Green;
break;
case "3":
// 1.调用FSS-接收IPC下料请求的接口
// 2.反馈任务号30 AGV已呼叫成功正在去往下料区
break;
case "31":
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Green);
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Green;
// AGV已到达下料区
break;
case "41":
// AGV下料完成
break;
// 允许AGV离开
case "5":
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Green);
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Green;
break;
case "51":
//label_AgvSongliao.ForeColor = Color.Black;
//label_AgvRequestLeave.ForeColor = Color.Black;
//label_AgvRequestEnter.ForeColor = Color.Black;
//label_AgvCanEnter.ForeColor = Color.Black;
//label_AgvCanLeave.ForeColor = Color.Black;
//label_AgvLeaved.ForeColor = Color.Green;
ShowLabelControl(label_AgvSongliao, Color.Black);
ShowLabelControl(label_AgvRequestLeave, Color.Black);
ShowLabelControl(label_AgvRequestEnter, Color.Black);
ShowLabelControl(label_AgvCanEnter, Color.Black);
ShowLabelControl(label_AgvCanLeave, Color.Black);
ShowLabelControl(label_AgvLeaved, Color.Green);
ProductInfo_search();
SolvePicAndMeasureValueWorking();
break;
}
}
catch (Exception err)
{
}
}
/// <summary>
/// 设备PLC心跳button5_heartBeat_Ning
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat(string tagValue)
{
WritePLC(15, OpNameCurrent, tagValue);
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat, Color.Green);
//button5_heartBeat.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat, Color.Gray);
//button5_heartBeat.BackColor = Color.Gray;
}
}
/// <summary>
/// 设备PLC心跳
/// </summary>
/// <param name="tagValue"></param>
private void DeviceHeartBeat_NingJinQiang(string tagValue)
{
if (tagValue == "1")
{
ShowButtonControl(button5_heartBeat_Ning, Color.Green);
//button5_heartBeat_Ning.BackColor = Color.Green;
}
else
{
ShowButtonControl(button5_heartBeat_Ning, Color.Red);
//button5_heartBeat_Ning.BackColor = Color.Red;
}
}
private void MoNiHeartBeat()
{
bool tv = false;
new Thread(new ThreadStart(delegate () {
while (true)
{
try
{
WritePLC(14, OpNameCurrent, tv);
tv = !tv;
}
catch (Exception err) { }
Thread.Sleep(2000);
}
}))
{ IsBackground = true }.Start();
}
private void label5_Click(object sender, EventArgs e)
{
}
private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timHSCZ.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 221</value>
</metadata>
<metadata name="timUI.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 221</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>33</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz
UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC
QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm
Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX
dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT
PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0
F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd
0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI
Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg
gg==
</value>
</data>
</root>

171
CCYQ_JieFang/OP/logInfo.Designer.cs generated Normal file
View File

@@ -0,0 +1,171 @@
namespace CCYQ_JieFang
{
partial class logInfo
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dateTimePicker1_log = new System.Windows.Forms.DateTimePicker();
this.dataGridView1_log = new System.Windows.Forms.DataGridView();
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1_log)).BeginInit();
this.SuspendLayout();
//
// dateTimePicker1_log
//
this.dateTimePicker1_log.CustomFormat = "yyyy-MM-dd";
this.dateTimePicker1_log.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker1_log.Location = new System.Drawing.Point(6, 14);
this.dateTimePicker1_log.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.dateTimePicker1_log.Name = "dateTimePicker1_log";
this.dateTimePicker1_log.Size = new System.Drawing.Size(162, 28);
this.dateTimePicker1_log.TabIndex = 1;
//
// dataGridView1_log
//
this.dataGridView1_log.AllowUserToAddRows = false;
this.dataGridView1_log.AllowUserToDeleteRows = false;
this.dataGridView1_log.AllowUserToResizeRows = false;
this.dataGridView1_log.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1_log.ColumnHeadersHeight = 29;
this.dataGridView1_log.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.dataGridView1_log.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ID,
this.,
this.,
this.,
this.,
this.});
this.dataGridView1_log.Location = new System.Drawing.Point(6, 52);
this.dataGridView1_log.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.dataGridView1_log.Name = "dataGridView1_log";
this.dataGridView1_log.ReadOnly = true;
this.dataGridView1_log.RowHeadersVisible = false;
this.dataGridView1_log.RowHeadersWidth = 51;
this.dataGridView1_log.RowTemplate.Height = 27;
this.dataGridView1_log.Size = new System.Drawing.Size(1302, 793);
this.dataGridView1_log.TabIndex = 2;
//
// ID
//
this.ID.DataPropertyName = "ID";
this.ID.HeaderText = "ID";
this.ID.MinimumWidth = 6;
this.ID.Name = "ID";
this.ID.ReadOnly = true;
this.ID.Width = 80;
//
// 工位号
//
this..DataPropertyName = "工位号";
this..HeaderText = "工位号";
this..MinimumWidth = 6;
this..Name = "工位号";
this..ReadOnly = true;
this..Width = 150;
//
// 日志类型
//
this..DataPropertyName = "日志类型";
this..HeaderText = "日志类型";
this..MinimumWidth = 6;
this..Name = "日志类型";
this..ReadOnly = true;
this..Width = 150;
//
// 日志内容
//
this..DataPropertyName = "日志内容";
this..HeaderText = "日志内容";
this..MinimumWidth = 6;
this..Name = "日志内容";
this..ReadOnly = true;
this..Width = 420;
//
// 操作日期
//
this..DataPropertyName = "操作日期";
this..HeaderText = "操作日期";
this..MinimumWidth = 6;
this..Name = "操作日期";
this..ReadOnly = true;
this..Width = 150;
//
// 操作时间
//
this..DataPropertyName = "操作时间";
this..HeaderText = "操作时间";
this..MinimumWidth = 6;
this..Name = "操作时间";
this..ReadOnly = true;
this..Width = 200;
//
// button1
//
this.button1.Location = new System.Drawing.Point(185, 10);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 32);
this.button1.TabIndex = 3;
this.button1.Text = "查询";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// logInfo
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1314, 859);
this.Controls.Add(this.button1);
this.Controls.Add(this.dataGridView1_log);
this.Controls.Add(this.dateTimePicker1_log);
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "logInfo";
this.Text = "logoInfo";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1_log)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DateTimePicker dateTimePicker1_log;
private System.Windows.Forms.DataGridView dataGridView1_log;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.Button button1;
}
}

View File

@@ -0,0 +1,56 @@
using MesWork;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CCYQ_JieFang
{
public partial class logInfo : Form
{
string currentOpName;
public logInfo(string opName)
{
currentOpName = opName;
InitializeComponent();
this.dateTimePicker1_log.CustomFormat = "yyyy-MM-dd";
dataGridView1_log.AutoGenerateColumns = false;
SearchLogInit(currentOpName, DateTime.Now.ToString("yyyy-MM-dd"));
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
SearchLogInit(currentOpName, dateTimePicker1_log.Value.ToString());
}
private void SearchLogInit(string opName, string logDate)
{
logDate = string.Format("{0:yyyy-MM-dd}", logDate);
SearchLog(opName, logDate, out DataTable dt, out string errorMsg);
if (dt.Rows.Count > 0)
{
dataGridView1_log.DataSource = dt;
}
}
private bool SearchLog(string opName, string logDate, out DataTable dt, out string errorMsg)
{
string procedureName;
procedureName = "系统_操作日志_查询";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@操作日期", logDate);
return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg);
}
private void button1_Click(object sender, EventArgs e)
{
SearchLogInit(currentOpName, dateTimePicker1_log.Value.ToString());
}
}
}

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="工位号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="日志类型.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="日志内容.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="操作日期.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="操作时间.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

305
CCYQ_JieFang/OP/partInfo.Designer.cs generated Normal file
View File

@@ -0,0 +1,305 @@
namespace CCYQ_JieFang
{
partial class partInfo
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGridView1_part = new System.Windows.Forms.DataGridView();
this.button1_search = new System.Windows.Forms.Button();
this.dateTimePicker1_part = new System.Windows.Forms.DateTimePicker();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.comboBox1_isOk = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox1_partId = new System.Windows.Forms.TextBox();
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.NG原因 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
this. = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).BeginInit();
this.SuspendLayout();
//
// dataGridView1_part
//
this.dataGridView1_part.AllowUserToAddRows = false;
this.dataGridView1_part.AllowUserToDeleteRows = false;
this.dataGridView1_part.AllowUserToResizeRows = false;
this.dataGridView1_part.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1_part.ColumnHeadersHeight = 29;
this.dataGridView1_part.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.dataGridView1_part.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ID,
this.,
this.,
this.,
this.,
this.,
this.,
this.NG原因,
this.,
this.,
this.,
this.});
this.dataGridView1_part.Location = new System.Drawing.Point(12, 49);
this.dataGridView1_part.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.dataGridView1_part.Name = "dataGridView1_part";
this.dataGridView1_part.ReadOnly = true;
this.dataGridView1_part.RowHeadersVisible = false;
this.dataGridView1_part.RowHeadersWidth = 51;
this.dataGridView1_part.RowTemplate.Height = 27;
this.dataGridView1_part.Size = new System.Drawing.Size(1364, 842);
this.dataGridView1_part.TabIndex = 5;
//
// button1_search
//
this.button1_search.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button1_search.Location = new System.Drawing.Point(810, 8);
this.button1_search.Name = "button1_search";
this.button1_search.Size = new System.Drawing.Size(75, 32);
this.button1_search.TabIndex = 8;
this.button1_search.Text = "查询";
this.button1_search.UseVisualStyleBackColor = true;
this.button1_search.Click += new System.EventHandler(this.button1_search_Click);
//
// dateTimePicker1_part
//
this.dateTimePicker1_part.CustomFormat = "yyyy-MM-dd";
this.dateTimePicker1_part.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker1_part.Location = new System.Drawing.Point(68, 12);
this.dateTimePicker1_part.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.dateTimePicker1_part.Name = "dateTimePicker1_part";
this.dateTimePicker1_part.Size = new System.Drawing.Size(162, 28);
this.dateTimePicker1_part.TabIndex = 7;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 11F);
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 22);
this.label1.TabIndex = 9;
this.label1.Text = "日期";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 11F);
this.label2.Location = new System.Drawing.Point(566, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(98, 22);
this.label2.TabIndex = 9;
this.label2.Text = "测量结果";
//
// comboBox1_isOk
//
this.comboBox1_isOk.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1_isOk.FormattingEnabled = true;
this.comboBox1_isOk.Location = new System.Drawing.Point(671, 12);
this.comboBox1_isOk.Name = "comboBox1_isOk";
this.comboBox1_isOk.Size = new System.Drawing.Size(121, 26);
this.comboBox1_isOk.TabIndex = 10;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 11F);
this.label3.Location = new System.Drawing.Point(236, 15);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(98, 22);
this.label3.TabIndex = 9;
this.label3.Text = "产品编码";
//
// textBox1_partId
//
this.textBox1_partId.Location = new System.Drawing.Point(338, 12);
this.textBox1_partId.Name = "textBox1_partId";
this.textBox1_partId.Size = new System.Drawing.Size(222, 28);
this.textBox1_partId.TabIndex = 11;
//
// ID
//
this.ID.DataPropertyName = "Id";
this.ID.HeaderText = "ID";
this.ID.MinimumWidth = 6;
this.ID.Name = "ID";
this.ID.ReadOnly = true;
this.ID.Width = 80;
//
// 工位号
//
this..DataPropertyName = "工位号";
this..HeaderText = "工位号";
this..MinimumWidth = 6;
this..Name = "工位号";
this..ReadOnly = true;
this..Width = 80;
//
// 产品编码
//
this..DataPropertyName = "EngineID";
this..HeaderText = "产品编码";
this..MinimumWidth = 6;
this..Name = "产品编码";
this..ReadOnly = true;
this..Width = 150;
//
// 测量项目
//
this..DataPropertyName = "测量项目";
this..HeaderText = "测量项目";
this..MinimumWidth = 6;
this..Name = "测量项目";
this..ReadOnly = true;
this..Width = 80;
//
// 测量位置
//
this..DataPropertyName = "测量位置";
this..HeaderText = "测量位置";
this..MinimumWidth = 6;
this..Name = "测量位置";
this..ReadOnly = true;
this..Width = 80;
//
// 测量值
//
this..DataPropertyName = "TagValue";
this..HeaderText = "测量值";
this..MinimumWidth = 8;
this..Name = "测量值";
this..ReadOnly = true;
this..Width = 150;
//
// 是否合格
//
this..DataPropertyName = "IsOK";
this..HeaderText = "是否合格";
this..MinimumWidth = 8;
this..Name = "是否合格";
this..ReadOnly = true;
this..Width = 80;
//
// NG原因
//
this.NG原因.DataPropertyName = "不合格原因";
this.NG原因.HeaderText = "NG原因";
this.NG原因.MinimumWidth = 8;
this.NG原因.Name = "NG原因";
this.NG原因.ReadOnly = true;
this.NG原因.Width = 150;
//
// 单位
//
this..DataPropertyName = "测量单位";
this..HeaderText = "单位";
this..MinimumWidth = 8;
this..Name = "单位";
this..ReadOnly = true;
this..Width = 80;
//
// 上限值
//
this..DataPropertyName = "上限值";
this..HeaderText = "上限值";
this..MinimumWidth = 8;
this..Name = "上限值";
this..ReadOnly = true;
this..Width = 80;
//
// 下限值
//
this..DataPropertyName = "下限值";
this..HeaderText = "下限值";
this..MinimumWidth = 8;
this..Name = "下限值";
this..ReadOnly = true;
this..Width = 80;
//
// 测量时间
//
this..DataPropertyName = "操作时间";
this..HeaderText = "测量时间";
this..MinimumWidth = 6;
this..Name = "测量时间";
this..ReadOnly = true;
this..Width = 150;
//
// partInfo
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1388, 897);
this.Controls.Add(this.textBox1_partId);
this.Controls.Add(this.comboBox1_isOk);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1_search);
this.Controls.Add(this.dateTimePicker1_part);
this.Controls.Add(this.dataGridView1_part);
this.Name = "partInfo";
this.Text = "产品测量数据";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1_part;
private System.Windows.Forms.Button button1_search;
private System.Windows.Forms.DateTimePicker dateTimePicker1_part;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboBox1_isOk;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox1_partId;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn NG原因;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
}
}

View File

@@ -0,0 +1,79 @@
using MesWork;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace CCYQ_JieFang
{
public partial class partInfo : Form
{
string currentOpName;
public partInfo(string opName)
{
currentOpName = opName;
InitializeComponent();
initMeasureComboBox();
dataGridView1_part.AutoGenerateColumns = false;
SearchPartInit(currentOpName, "全部", "", DateTime.Now.ToString("yyyy-MM-dd"));
}
private void initMeasureComboBox()
{
// 全部 OK NG
comboBox1_isOk.Items.Add("全部");
comboBox1_isOk.Items.Add("OK");
comboBox1_isOk.Items.Add("NG");
comboBox1_isOk.SelectedIndex = 0;
}
private void button1_search_Click(object sender, EventArgs e)
{
string selectedItem = comboBox1_isOk.SelectedItem.ToString();
SearchPartInit(Name, selectedItem, textBox1_partId.Text, dateTimePicker1_part.Value.ToString("yyyy-MM-dd"));
}
private void dateTimePicker1_part_ValueChanged(object sender, EventArgs e)
{
// SearchPartInit(Name, dateTimePicker1_part.Value.ToString());
}
private void SearchPartInit(string opName, string isOk, string partId, string logDate)
{
try
{
SearchPartInfo(opName, logDate, isOk, partId, out DataTable dt, out string errorMsg);
if (dt.Rows.Count > 0)
{
dataGridView1_part.DataSource = dt;
}
else
{
dataGridView1_part.DataSource = dt;
}
}
catch (Exception err)
{
}
}
private bool SearchPartInfo(string opName, string partDate, string isOk, string partId, out DataTable dt, out string errorMsg)
{
string procedureName;
procedureName = "测量数据合格_查询";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@操作日期", partDate);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@IsOK", isOk);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", partId);
return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg);
}
}
}

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="工位号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="产品编码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量项目.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量位置.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="是否合格.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="NG原因.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="单位.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="上限值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="下限值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="测量时间.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@@ -0,0 +1,676 @@
using DataLinkMesWork;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Robot.Common;
using NPOI.SS.UserModel;
namespace MesWork
{
public partial class publicCore
{
public static int partCount = 0;
public static string FSSRequestMsgId = "";
public static string Hello_You_All_Never_Know(string[] args)
{
return Guid.NewGuid().ToString();
}
/// <summary>
/// PLC事件变化委托
/// </summary>
public static Action<OpcData.CustomeEvetnArgs> MIS_Funtion_PLC_OP = null;
/// <summary>
/// 读取PLC正在装配第几个件
/// </summary>
/// <param name="opName"></param>
/// <returns></returns>
public static int Get_PartPosition(string opName)
{
// 当前装配第几个件 54
int PartPosition = -1;
PartPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName)) ;
return PartPosition;
}
/// <summary>
/// 设备状态发生变化,处理完成之后,发给管控系统
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// </summary>
public static void SolveDeviceStatus(string opName)
{
// 空闲(请求上料) 51
string isFree = "0";
// 完成(请求下料) 52
string isWorkFinish = "0";
// 故障 53
string isAlarm = "0";
string finalStatus = "0";
isFree = MesWorkForm.ReadPLC(51, opName).ToString();
if (isFree.ToLower() == "true" || isFree.ToLower() == "1")
{
isFree = "1";
}
isWorkFinish = MesWorkForm.ReadPLC(52, opName).ToString();
if (isWorkFinish.ToLower() == "true" || isWorkFinish.ToLower() == "1")
{
isWorkFinish = "1";
}
isAlarm = MesWorkForm.ReadPLC(53, opName).ToString();
if (isAlarm.ToLower() == "true" || isAlarm.ToLower() == "1")
{
isAlarm = "1";
}
if (isAlarm == "1")
{
finalStatus = "4";
}
else if (isWorkFinish == "1")
{
finalStatus = "3";
}
else if (isFree == "1")
{
finalStatus = "2";
}
else
{
finalStatus = "1";
}
if (finalStatus == "3")
{
QualityData_Insert_Final(opName, out string errMag);
publicCore.LogInsert("Quality", "Info", "保存质量数据:" + errMag);
}
AnalysisMsg.DeviceStatus(opName, Convert.ToInt32(finalStatus));
}
/// <summary>
/// 设备状态发生变化,处理完成之后,发给管控系统
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// 接口用 不重复保存质量数据
/// </summary>
public static void SolveDeviceStatus_WebApi_Use(string opName)
{
// 空闲(请求上料) 51
string isFree = "0";
// 完成(请求下料) 52
string isWorkFinish = "0";
// 故障 53
string isAlarm = "0";
string finalStatus = "0";
isFree = MesWorkForm.ReadPLC(51, opName).ToString();
if (isFree.ToLower() == "true" || isFree.ToLower() == "1")
{
isFree = "1";
}
isWorkFinish = MesWorkForm.ReadPLC(52, opName).ToString();
if (isWorkFinish.ToLower() == "true" || isWorkFinish.ToLower() == "1")
{
isWorkFinish = "1";
}
isAlarm = MesWorkForm.ReadPLC(53, opName).ToString();
if (isAlarm.ToLower() == "true" || isAlarm.ToLower() == "1")
{
isAlarm = "1";
}
if (isAlarm == "1")
{
finalStatus = "4";
}
else if (isWorkFinish == "1")
{
finalStatus = "3";
}
else if (isFree == "1")
{
finalStatus = "2";
}
else
{
finalStatus = "1";
}
AnalysisMsg.DeviceStatus(opName, Convert.ToInt32(finalStatus));
}
/// <summary>
/// 设备状态发生变化,处理完成之后,发给管控系统
/// 1工作中 2空闲请求上料 3完成请求下料 4 报警
/// </summary>
public static string SolveDeviceStatus_Read(string opName)
{
// 空闲(请求上料) 51
string isFree = "0";
// 完成(请求下料) 52
string isWorkFinish = "0";
// 故障 53
string isAlarm = "0";
string finalStatus = "0";
isFree = MesWorkForm.ReadPLC(51, opName).ToString();
if(isFree.ToLower() == "true" || isFree.ToLower() == "1")
{
isFree = "1";
}
isWorkFinish = MesWorkForm.ReadPLC(52, opName).ToString();
if (isWorkFinish.ToLower() == "true" || isWorkFinish.ToLower() == "1")
{
isWorkFinish = "1";
}
isAlarm = MesWorkForm.ReadPLC(53, opName).ToString();
if (isAlarm.ToLower() == "true" || isAlarm.ToLower() == "1")
{
isAlarm = "1";
}
if (isAlarm == "1")
{
finalStatus = "4";
}
else if (isWorkFinish == "1")
{
finalStatus = "3";
}
else if (isFree == "1")
{
finalStatus = "2";
}
else
{
finalStatus = "1";
}
return finalStatus;
}
/// <summary>
/// AGV任务号
/// </summary>
public static void SolveAgvTaskNum(string OpName, string PLC_AgvTaskNum)
{
// 77 反馈AGV任务
switch (PLC_AgvTaskNum)
{
// AGV已呼叫成功正在去往上料区
case "10":
MesWorkForm.WritePLC(77, OpName, "10");
break;
// AGV已到达上料区_带货,申请进入上料位置
case "11":
string previousTaskValue = MesWorkForm.ReadPLC(77, OpName).ToString();
string AgvCanEnter = MesWorkForm.ReadPLC(50, OpName).ToString();
if (previousTaskValue == "10")
{
// 写任务--满AGV是达上料区
MesWorkForm.WritePLC(77, OpName, "1");
if (AgvCanEnter == "2")
{
// 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口
AnalysisMsg.ResponseEnterOrLeave(OpName, 1);
MesWorkForm.WritePLC(77, OpName, "20");
}
}
if (previousTaskValue == "30")
{
// 写任务--空AGV是达上料区
MesWorkForm.WritePLC(77, OpName, "3");
if (AgvCanEnter == "4")
{
// 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口
AnalysisMsg.ResponseEnterOrLeave(OpName, 1);
MesWorkForm.WritePLC(77, OpName, "40");
}
}
break;
// 允许AGV进行上料 --允许进入
case "2":
string FullAgvIsRequestEnter = MesWorkForm.ReadPLC(77, OpName).ToString();
// 需要判断前序任务是否完成-- 满AGV是否到达上料区
if (FullAgvIsRequestEnter == "1")
{
// 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口
AnalysisMsg.ResponseEnterOrLeave(OpName, 1);
MesWorkForm.WritePLC(77, OpName, "20");
}
break;
case "21":
// AGV 上料完成
string previousTaskValue1 = MesWorkForm.ReadPLC(77, OpName).ToString();
if(previousTaskValue1 == "20")
{
MesWorkForm.WritePLC(77, OpName, "2");
}
if (previousTaskValue1 == "40")
{
MesWorkForm.WritePLC(77, OpName, "4");
}
break;
// PLC呼叫AGV进行下料
case "3":
// 1.调用FSS-接收IPC下料请求的接口
AnalysisMsg.FinishCall(OpName);
// 2.反馈任务号30 AGV已呼叫成功正在去往下料区
MesWorkForm.WritePLC(77, OpName, "30");
break;
// 允许AGV进行下料 --允许进入
case "4":
string EmptyAgvIsRequestEnter = MesWorkForm.ReadPLC(77, OpName).ToString();
// 需要判断前序任务是否完成-- 空AGV是否到达上料区
if (EmptyAgvIsRequestEnter == "3")
{
// 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口
AnalysisMsg.ResponseEnterOrLeave(OpName, 1);
MesWorkForm.WritePLC(77, OpName, "40");
}
break;
// 允许AGV离开
case "5":
string FullOrEmptyAgvIsRequestLeave = MesWorkForm.ReadPLC(77, OpName).ToString();
// 需要判断前序任务是否完成-- AGV上料完成或者下料完成
if(FullOrEmptyAgvIsRequestLeave == "2" || FullOrEmptyAgvIsRequestLeave == "4")
{
// 1.调用FSS-接收允许进入或离开 (类型:允许离开)的接口
AnalysisMsg.ResponseEnterOrLeave(OpName, 2);
MesWorkForm.WritePLC(77, OpName, "50");
}
break;
case "51":
// AGV 已离开 反馈任务号5
MesWorkForm.WritePLC(77, OpName, "5");
break;
}
switch (OpName)
{
case "OP10":
if (DAS_OP10.AGV_Task_change != null)
{
DAS_OP10.AGV_Task_change(PLC_AgvTaskNum);
}
break;
case "OP20":
if (DAS_OP20.AGV_Task_change != null)
{
DAS_OP20.AGV_Task_change(PLC_AgvTaskNum);
}
break;
case "OP30":
if (DAS_OP30.AGV_Task_change != null)
{
DAS_OP30.AGV_Task_change(PLC_AgvTaskNum);
}
break;
case "OP40":
if (DAS_OP40.AGV_Task_change != null)
{
DAS_OP40.AGV_Task_change(PLC_AgvTaskNum);
}
break;
case "OP50":
if (DAS_OP50.AGV_Task_change != null)
{
DAS_OP50.AGV_Task_change(PLC_AgvTaskNum);
}
break;
}
}
/// <summary>
/// 读取泄漏量的数据
/// </summary>
public static void ReadQualityData_LeakageRate(string opName)
{
string Pressure = MesWorkForm.ReadPLC(57, opName).ToString();
int partPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName));
int MeasurePosition = 9;
string IsOK = "1";
string NgStr = "";
//保存质量数
QualityData_MobyInsert(partPosition, MeasurePosition, opName, Pressure, IsOK, NgStr, out string errMsg);
}
/// <summary>
/// 拧紧数据的变化
/// </summary>
public static void MeasurePositionChange(string opName, int MeasureStatus)
{
int MeasurePosition = Convert.ToInt32(MesWorkForm.ReadPLC(55, opName));
int partPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName));
QualityData_MobyUpdate(partPosition, MeasurePosition, opName, MeasureStatus, out string errMsg);
}
/// <summary>
/// 读压力的数据
/// </summary>
public static void ReadQualityData_Pressure(string opName)
{
string LeakageRate1 = MesWorkForm.ReadPLC(57, opName).ToString();
string LeakageRate2 = MesWorkForm.ReadPLC(58, opName).ToString();
int partPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName));
int MeasurePosition = 1;
string IsOK1 = "1";
string NgStr1 = "";
//保存质量数
QualityData_MobyInsert(partPosition, MeasurePosition, opName, LeakageRate1, IsOK1, NgStr1, out string errMsg);
MeasurePosition = 2;
string IsOK2 = "1";
string NgStr2 = "";
QualityData_MobyInsert(partPosition, MeasurePosition, opName, LeakageRate2, IsOK1, NgStr2, out string errMsg1);
}
/// <summary>
/// 质量数据的保存
/// </summary>
/// <param name="PartPosition"></param>
/// <param name="MeasurePosition"></param>
/// <param name="opName"></param>
/// <param name="TagValue"></param>
/// <param name="IsOK"></param>
/// <returns></returns>
public static bool QualityData_MobyUpdate(int PartPosition, int MeasurePosition, string opName, int MeasureStatus, out string errorMsg)
{
string procedureName;
procedureName = "测量数据合格_Moby_更新";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@测量状态", MeasureStatus);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@测量位置", MeasurePosition);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition);
return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg);
}
/// <summary>
/// 质量数据的保存
/// </summary>
/// <param name="PartPosition"></param>
/// <param name="MeasurePosition"></param>
/// <param name="opName"></param>
/// <param name="TagValue"></param>
/// <param name="IsOK"></param>
/// <returns></returns>
public static bool QualityData_MobyInsert(int PartPosition, int MeasurePosition, string opName, string TagValue, string IsOK, string NgStr, out string errorMsg)
{
string procedureName;
procedureName = "测量数据合格_Moby_增加";
SqlParameter[] thisParms = new SqlParameter[6];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@TagValue", TagValue);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@IsOK", IsOK);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@测量位置", MeasurePosition);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@不合格原因", NgStr);
return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg);
}
/// <summary>
/// 质量数据的保存
/// </summary>
/// <param name="PartPosition"></param>
/// <param name="MeasurePosition"></param>
/// <param name="opName"></param>
/// <param name="TagValue"></param>
/// <param name="IsOK"></param>
/// <returns></returns>
public static bool QualityData_Insert_Final(string opName, out string errorMsg)
{
string procedureName;
procedureName = "测量数据合格_增加";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg);
}
/// <summary>
/// 判断来料是否满托盘
/// </summary>
public static void JudgeMaterialFull(string opName, List<IPC_product_AssemblyInformation> product_AssemblyInformation)
{
int partCount = product_AssemblyInformation.Count;
if (publicCore.partCount == partCount)
{
MesWorkForm.WritePLC(78, opName, true);
}
else
{
MesWorkForm.WritePLC(78, opName, false);
}
MesWorkForm.WritePLC(79, opName, false);
MesWorkForm.WritePLC(80, opName, false);
MesWorkForm.WritePLC(81, opName, false);
MesWorkForm.WritePLC(82, opName, false);
foreach (var item in product_AssemblyInformation)
{
if(item.productPosition == 1)
{
MesWorkForm.WritePLC(79, opName, true);
}
if (item.productPosition == 2)
{
MesWorkForm.WritePLC(80, opName, true);
}
if (item.productPosition == 3)
{
MesWorkForm.WritePLC(81, opName, true);
}
if (item.productPosition == 4)
{
MesWorkForm.WritePLC(82, opName, true);
}
MesWorkForm.WritePLC(60, opName, false);
}
}
/// <summary>
/// 是否允许工作
/// </summary>
/// <param name="opName"></param>
/// <param name="isAllowWork"></param>
public static void FixedAllow(string opName, object isAllowWork)
{
MesWorkForm.WritePLC(85, opName, isAllowWork);
}
/// <summary>
/// 测量数据_测量信息_初始化查询
/// </summary>
/// <param name="PartPosition"></param>
/// <param name="MeasurePosition"></param>
/// <param name="opName"></param>
/// <param name="TagValue"></param>
/// <param name="IsOK"></param>
/// <returns></returns>
public static bool GetQualityInfo_Init(string opName, int PartPosition, out DataTable dt, out string errorMsg)
{
string procedureName;
procedureName = "测量数据_测量信息_初始化查询";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition);
return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg);
}
public static bool GetProductInfo_Init(string opName, int PartPosition, out DataTable dt, out string errorMsg)
{
string procedureName;
procedureName = "装配信息_初始化查询";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition);
return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg);
}
public static void LogInsert(string opName, string logType, string log)
{
string procedureName;
procedureName = "系统_操作日志_新增";
SqlParameter[] thisParms = new SqlParameter[5];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@日志类型", logType);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@日志内容", log);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@操作日期", DateTime.Now.ToString("yyyy-MM-dd"));
thisParms[4] = new System.Data.SqlClient.SqlParameter("@操作时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out string errorMsg);
}
#region
/// <summary>
/// 提供通用的调用存储过程的方法(需要返回查询的记录集的调用)
/// </summary>
/// <param name="procedureName">存储过程名称</param>
/// <param name="connectionString">连库字符串</param>
/// <param name="sqlParameters">存储过程参数数组</param>
/// <param name="ds">存储过程里面返回的记录集</param>
/// <param name="errorMessage">错误信息</param>
/// <returns>布尔值true表示该执行成功false表示执行失败</returns>
public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
{
bool result = false;
errorMessage = "";
ds = new DataSet();
if (connectionString.Length < 1) return false;
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
dsCommand.Fill(ds);
}
// SqlServerConnectionStatus = true;
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
// TestConnection();
//ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程\r\n" + procedureName + "\r\n连接字符串\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
/// <summary>
/// 提供通用的调用存储过程的方法(需要返回查询的记录集的调用)
/// </summary>
/// <param name="procedureName">存储过程名称</param>
/// <param name="connectionString">连库字符串</param>
/// <param name="sqlParameters">存储过程参数数组</param>
/// <param name="dt">存储过程里面返回的记录表</param>
/// <param name="errorMessage">错误信息</param>
/// <returns>布尔值true表示该执行成功false表示执行失败</returns>
public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataTable dt, out string errorMessage)
{
bool result = false;
errorMessage = "";
dt = new DataTable();
DataSet ds = new DataSet();
if (connectionString.Length < 1) return false;
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
dsCommand.Fill(ds);
}
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
}
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
// TestConnection();
//ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程\r\n" + procedureName + "\r\n连接字符串\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
/// <summary>
/// 提供通用的调用存储过程的方法(需要返回查询的记录集的调用)
/// </summary>
/// <param name="procedureName">存储过程名称</param>
/// <param name="connectionString">连库字符串</param>
/// <param name="sqlParameters">存储过程参数数组</param>
/// <param name="dt">存储过程里面返回的记录表</param>
/// <param name="errorMessage">错误信息</param>
/// <returns>布尔值true表示该执行成功false表示执行失败</returns>
public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out string errorMessage)
{
bool result = false;
errorMessage = "";
DataSet ds = new DataSet();
if (connectionString.Length < 1) return false;
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
//if (!SqlServerConnectionStatus) return false;
conn.Open();
using (SqlDataAdapter dsCommand = new SqlDataAdapter())
{
dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < sqlParameters.Length; i++)
{
dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
}
dsCommand.Fill(ds);
}
result = true;
}
catch (Exception e)
{
errorMessage = e.ToString();
// TestConnection();
//ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程\r\n" + procedureName + "\r\n连接字符串\r\n" + connectionString);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
return result;
}
#endregion
}
}