修改密码 固化锁线程 加oldplctrigger,避免重复调用

This commit is contained in:
zhougf committed 2025-04-01 15:15:05 +08:00
1 parent 60cafc4f8c
commit d20b935213
9 files changed
+303 -195

No files matched your search

+49 -47
View File
@@ -71,12 +71,14 @@ namespace WindowsFormsApp1
this.MES提示信息 = new System.Windows.Forms.Label(); this.MES提示信息 = new System.Windows.Forms.Label();
this.原料包装LOT号 = new System.Windows.Forms.GroupBox(); this.原料包装LOT号 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.材料值 = new System.Windows.Forms.Label();
this.材料 = new System.Windows.Forms.Label();
this.LOT号显示 = new System.Windows.Forms.Label(); this.LOT号显示 = new System.Windows.Forms.Label();
this.LOT号 = new System.Windows.Forms.Label(); this.LOT号 = new System.Windows.Forms.Label();
this.胶水上下线 = new System.Windows.Forms.Button(); this.胶水上下线 = new System.Windows.Forms.Button();
this.剩余寿命 = new System.Windows.Forms.Label();
this.MES提示 = new System.Windows.Forms.Label(); this.MES提示 = new System.Windows.Forms.Label();
this.Tray盘二维码 = new System.Windows.Forms.Label(); this.Tray盘二维码 = new System.Windows.Forms.Label();
this.剩余寿命 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.开始处理 = new System.Windows.Forms.Button(); this.开始处理 = new System.Windows.Forms.Button();
@@ -96,8 +98,6 @@ namespace WindowsFormsApp1
this.底部注释4 = new System.Windows.Forms.Label(); this.底部注释4 = new System.Windows.Forms.Label();
this.底部注释5 = new System.Windows.Forms.Label(); this.底部注释5 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.材料 = new System.Windows.Forms.Label();
this.材料值 = new System.Windows.Forms.Label();
this.plcStatusGroupBox.SuspendLayout(); this.plcStatusGroupBox.SuspendLayout();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
@@ -173,8 +173,9 @@ namespace WindowsFormsApp1
// //
// 修改密码ToolStripMenuItem // 修改密码ToolStripMenuItem
// //
this.修改密码ToolStripMenuItem.Enabled = false;
this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem"; this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem";
this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(283, 50); this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(359, 50);
this.修改密码ToolStripMenuItem.Text = "修改密码"; this.修改密码ToolStripMenuItem.Text = "修改密码";
this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click); this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click);
// //
@@ -187,8 +188,9 @@ namespace WindowsFormsApp1
// //
// 用户管理ToolStripMenuItem1 // 用户管理ToolStripMenuItem1
// //
this.用户管理ToolStripMenuItem1.Enabled = false;
this.用户管理ToolStripMenuItem1.Name = "用户管理ToolStripMenuItem1"; this.用户管理ToolStripMenuItem1.Name = "用户管理ToolStripMenuItem1";
this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(283, 50); this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(359, 50);
this.用户管理ToolStripMenuItem1.Text = "用户管理"; this.用户管理ToolStripMenuItem1.Text = "用户管理";
this.用户管理ToolStripMenuItem1.Click += new System.EventHandler(this.用户管理ToolStripMenuItem1_Click); this.用户管理ToolStripMenuItem1.Click += new System.EventHandler(this.用户管理ToolStripMenuItem1_Click);
// //
@@ -196,6 +198,7 @@ namespace WindowsFormsApp1
// //
this.产线管理ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.产线管理ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.产线基础信息管理ToolStripMenuItem}); this.产线基础信息管理ToolStripMenuItem});
this.产线管理ToolStripMenuItem.Enabled = false;
this.产线管理ToolStripMenuItem.Name = "产线管理ToolStripMenuItem"; this.产线管理ToolStripMenuItem.Name = "产线管理ToolStripMenuItem";
this.产线管理ToolStripMenuItem.Size = new System.Drawing.Size(166, 45); this.产线管理ToolStripMenuItem.Size = new System.Drawing.Size(166, 45);
this.产线管理ToolStripMenuItem.Text = "产线管理"; this.产线管理ToolStripMenuItem.Text = "产线管理";
@@ -213,6 +216,7 @@ namespace WindowsFormsApp1
this.pLC通讯设置ToolStripMenuItem, this.pLC通讯设置ToolStripMenuItem,
this.pLC地址设置ToolStripMenuItem, this.pLC地址设置ToolStripMenuItem,
this.pLC报警设置ToolStripMenuItem}); this.pLC报警设置ToolStripMenuItem});
this.pLC管理ToolStripMenuItem.Enabled = false;
this.pLC管理ToolStripMenuItem.Name = "pLC管理ToolStripMenuItem"; this.pLC管理ToolStripMenuItem.Name = "pLC管理ToolStripMenuItem";
this.pLC管理ToolStripMenuItem.Size = new System.Drawing.Size(159, 45); this.pLC管理ToolStripMenuItem.Size = new System.Drawing.Size(159, 45);
this.pLC管理ToolStripMenuItem.Text = "PLC管理"; this.pLC管理ToolStripMenuItem.Text = "PLC管理";
@@ -239,6 +243,7 @@ namespace WindowsFormsApp1
// //
// 流程管理ToolStripMenuItem // 流程管理ToolStripMenuItem
// //
this.流程管理ToolStripMenuItem.Enabled = false;
this.流程管理ToolStripMenuItem.Name = "流程管理ToolStripMenuItem"; this.流程管理ToolStripMenuItem.Name = "流程管理ToolStripMenuItem";
this.流程管理ToolStripMenuItem.Size = new System.Drawing.Size(166, 45); this.流程管理ToolStripMenuItem.Size = new System.Drawing.Size(166, 45);
this.流程管理ToolStripMenuItem.Text = "流程管理"; this.流程管理ToolStripMenuItem.Text = "流程管理";
@@ -246,6 +251,7 @@ namespace WindowsFormsApp1
// //
// mES接口配置ToolStripMenuItem // mES接口配置ToolStripMenuItem
// //
this.mES接口配置ToolStripMenuItem.Enabled = false;
this.mES接口配置ToolStripMenuItem.Name = "mES接口配置ToolStripMenuItem"; this.mES接口配置ToolStripMenuItem.Name = "mES接口配置ToolStripMenuItem";
this.mES接口配置ToolStripMenuItem.Size = new System.Drawing.Size(233, 45); this.mES接口配置ToolStripMenuItem.Size = new System.Drawing.Size(233, 45);
this.mES接口配置ToolStripMenuItem.Text = "MES接口配置"; this.mES接口配置ToolStripMenuItem.Text = "MES接口配置";
@@ -259,6 +265,7 @@ namespace WindowsFormsApp1
this.螺丝枪扭力设置ToolStripMenuItem, this.螺丝枪扭力设置ToolStripMenuItem,
this.扭力曲线配置ToolStripMenuItem, this.扭力曲线配置ToolStripMenuItem,
this.压力曲线设置ToolStripMenuItem}); this.压力曲线设置ToolStripMenuItem});
this.扫码枪配置ToolStripMenuItem.Enabled = false;
this.扫码枪配置ToolStripMenuItem.Name = "扫码枪配置ToolStripMenuItem"; this.扫码枪配置ToolStripMenuItem.Name = "扫码枪配置ToolStripMenuItem";
this.扫码枪配置ToolStripMenuItem.Size = new System.Drawing.Size(230, 45); this.扫码枪配置ToolStripMenuItem.Size = new System.Drawing.Size(230, 45);
this.扫码枪配置ToolStripMenuItem.Text = "外围设备配置"; this.扫码枪配置ToolStripMenuItem.Text = "外围设备配置";
@@ -298,6 +305,7 @@ namespace WindowsFormsApp1
// //
// 系统参数配置ToolStripMenuItem // 系统参数配置ToolStripMenuItem
// //
this.系统参数配置ToolStripMenuItem.Enabled = false;
this.系统参数配置ToolStripMenuItem.Name = "系统参数配置ToolStripMenuItem"; this.系统参数配置ToolStripMenuItem.Name = "系统参数配置ToolStripMenuItem";
this.系统参数配置ToolStripMenuItem.Size = new System.Drawing.Size(230, 45); this.系统参数配置ToolStripMenuItem.Size = new System.Drawing.Size(230, 45);
this.系统参数配置ToolStripMenuItem.Text = "系统参数配置"; this.系统参数配置ToolStripMenuItem.Text = "系统参数配置";
@@ -307,14 +315,14 @@ namespace WindowsFormsApp1
// //
this.材料扫码ToolStripMenuItem.Name = "材料扫码ToolStripMenuItem"; this.材料扫码ToolStripMenuItem.Name = "材料扫码ToolStripMenuItem";
this.材料扫码ToolStripMenuItem.Size = new System.Drawing.Size(166, 45); this.材料扫码ToolStripMenuItem.Size = new System.Drawing.Size(166, 45);
this.材料扫码ToolStripMenuItem.Text = "材料扫码"; this.材料扫码ToolStripMenuItem.Text = "材料管理";
this.材料扫码ToolStripMenuItem.Click += new System.EventHandler(this.材料扫码ToolStripMenuItem_Click); this.材料扫码ToolStripMenuItem.Click += new System.EventHandler(this.材料扫码ToolStripMenuItem_Click);
// //
// 图片展示ToolStripMenuItem // 图片展示ToolStripMenuItem
// //
this.图片展示ToolStripMenuItem.Name = "图片展示ToolStripMenuItem"; this.图片展示ToolStripMenuItem.Name = "图片展示ToolStripMenuItem";
this.图片展示ToolStripMenuItem.Size = new System.Drawing.Size(166, 45); this.图片展示ToolStripMenuItem.Size = new System.Drawing.Size(166, 45);
this.图片展示ToolStripMenuItem.Text = "图片展示"; this.图片展示ToolStripMenuItem.Text = "螺丝引导";
this.图片展示ToolStripMenuItem.Click += new System.EventHandler(this.图片展示ToolStripMenuItem_Click); this.图片展示ToolStripMenuItem.Click += new System.EventHandler(this.图片展示ToolStripMenuItem_Click);
// //
// tableLayoutPanel1 // tableLayoutPanel1
@@ -515,6 +523,28 @@ namespace WindowsFormsApp1
this.tableLayoutPanel5.Size = new System.Drawing.Size(1390, 256); this.tableLayoutPanel5.Size = new System.Drawing.Size(1390, 256);
this.tableLayoutPanel5.TabIndex = 0; this.tableLayoutPanel5.TabIndex = 0;
// //
// 材料值
//
this.材料值.AutoSize = true;
this.材料值.Dock = System.Windows.Forms.DockStyle.Fill;
this.材料值.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.材料值.Location = new System.Drawing.Point(306, 103);
this.材料值.Name = "材料值";
this.材料值.Size = new System.Drawing.Size(923, 50);
this.材料值.TabIndex = 7;
this.材料值.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// 材料
//
this.材料.Anchor = System.Windows.Forms.AnchorStyles.None;
this.材料.AutoSize = true;
this.材料.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.材料.Location = new System.Drawing.Point(96, 111);
this.材料.Name = "材料";
this.材料.Size = new System.Drawing.Size(111, 33);
this.材料.TabIndex = 6;
this.材料.Text = "材料:";
//
// LOT号显示 // LOT号显示
// //
this.LOT号显示.Anchor = System.Windows.Forms.AnchorStyles.None; this.LOT号显示.Anchor = System.Windows.Forms.AnchorStyles.None;
@@ -548,18 +578,6 @@ namespace WindowsFormsApp1
this.胶水上下线.Text = "胶水寿命"; this.胶水上下线.Text = "胶水寿命";
this.胶水上下线.UseVisualStyleBackColor = true; this.胶水上下线.UseVisualStyleBackColor = true;
// //
// 剩余寿命
//
this.剩余寿命.AutoSize = true;
this.剩余寿命.Dock = System.Windows.Forms.DockStyle.Fill;
this.剩余寿命.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.剩余寿命.Location = new System.Drawing.Point(1236, 154);
this.剩余寿命.Name = "剩余寿命";
this.剩余寿命.Size = new System.Drawing.Size(150, 101);
this.剩余寿命.TabIndex = 5;
this.剩余寿命.Text = "剩余寿命";
this.剩余寿命.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// MES提示 // MES提示
// //
this.MES提示.Anchor = System.Windows.Forms.AnchorStyles.None; this.MES提示.Anchor = System.Windows.Forms.AnchorStyles.None;
@@ -581,6 +599,18 @@ namespace WindowsFormsApp1
this.Tray盘二维码.Size = new System.Drawing.Size(0, 59); this.Tray盘二维码.Size = new System.Drawing.Size(0, 59);
this.Tray盘二维码.TabIndex = 2; this.Tray盘二维码.TabIndex = 2;
// //
// 剩余寿命
//
this.剩余寿命.AutoSize = true;
this.剩余寿命.Dock = System.Windows.Forms.DockStyle.Fill;
this.剩余寿命.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.剩余寿命.Location = new System.Drawing.Point(1236, 154);
this.剩余寿命.Name = "剩余寿命";
this.剩余寿命.Size = new System.Drawing.Size(150, 101);
this.剩余寿命.TabIndex = 5;
this.剩余寿命.Text = "剩余寿命";
this.剩余寿命.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// groupBox1 // groupBox1
// //
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -845,34 +875,6 @@ namespace WindowsFormsApp1
this.底部注释5.TabIndex = 4; this.底部注释5.TabIndex = 4;
this.底部注释5.Text = "底部注释5"; this.底部注释5.Text = "底部注释5";
// //
// timer1
//
//this.timer1.Enabled = true;
//this.timer1.Interval = 1000;
//this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// 材料
//
this.材料.Anchor = System.Windows.Forms.AnchorStyles.None;
this.材料.AutoSize = true;
this.材料.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.材料.Location = new System.Drawing.Point(96, 111);
this.材料.Name = "材料";
this.材料.Size = new System.Drawing.Size(111, 33);
this.材料.TabIndex = 6;
this.材料.Text = "材料:";
//
// 材料值
//
this.材料值.AutoSize = true;
this.材料值.Dock = System.Windows.Forms.DockStyle.Fill;
this.材料值.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.材料值.Location = new System.Drawing.Point(306, 103);
this.材料值.Name = "材料值";
this.材料值.Size = new System.Drawing.Size(923, 50);
this.材料值.TabIndex = 7;
this.材料值.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F); this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+101 -65
View File
@@ -42,7 +42,8 @@ namespace WindowsFormsApp1
// 在MainForm类的成员变量部分添加一个定时器 // 在MainForm类的成员变量部分添加一个定时器
private System.Windows.Forms.Timer statusReportTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer statusReportTimer = new System.Windows.Forms.Timer();
private ApiClient statusApiClient = new ApiClient(); // 专用于状态上报的API客户端 private ApiClient statusApiClient = new ApiClient(); // 专用于状态上报的API客户端
private object curingLock = new object();
private int OldPlcTrigger = 0;
public MainForm() public MainForm()
{ {
InitializeComponent(); InitializeComponent();
@@ -78,6 +79,18 @@ namespace WindowsFormsApp1
操作人员ID.Text = Init.t_User.username; 操作人员ID.Text = Init.t_User.username;
if (Init.t_User.username == "admin")
{
修改密码ToolStripMenuItem.Enabled = true;
用户管理ToolStripMenuItem.Enabled = true;
产线管理ToolStripMenuItem.Enabled = true;
pLC管理ToolStripMenuItem.Enabled = true;
流程管理ToolStripMenuItem.Enabled = true;
mES接口配置ToolStripMenuItem.Enabled = true;
扫码枪配置ToolStripMenuItem.Enabled = true;
系统参数配置ToolStripMenuItem.Enabled = true;
}
// 添加窗体关闭事件处理 // 添加窗体关闭事件处理
this.FormClosing += MainForm_FormClosing; this.FormClosing += MainForm_FormClosing;
@@ -149,15 +162,17 @@ namespace WindowsFormsApp1
continue; continue;
} }
if(Plc.id == 1) //if(Plc.id == 1)
{ //{
LOT号.Text = PlcData.Read_MaterialCode0; LOT号.Text = PlcData.Read_MaterialCode0;
Tray盘二维码.Text = PlcData.Read_MaterialCode1; Tray盘二维码.Text = PlcData.Read_MaterialCode1;
材料值.Text = PlcData.Read_MaterialCode2; 材料值.Text = PlcData.Read_MaterialCode2;
} Init.ImageLocation = PlcData.Read_Other4;
Init.ImageName = PlcData.Read_Other3.ToString();
//}
当前时间.Text = $"PLC状态:{plcstatus.GetName(typeof(plcstatus), PlcData.Read_Status)}";
当前时间.Text = $"PLC状态:{plcstatus.GetName(typeof(plcstatus),PlcData.Read_Status)}";
DateTime Plc_Time = DateTime.Now; DateTime Plc_Time = DateTime.Now;
@@ -176,12 +191,13 @@ namespace WindowsFormsApp1
otherdata otherdata = new otherdata(); otherdata otherdata = new otherdata();
//Init.SN = PlcData.Read_MaterialCode0; //Init.SN = PlcData.Read_MaterialCode0;
#region 机台状态及报警 #region 机台状态及报警
//机台状态 //机台状态
//机台状态.Text = "机台状态:" + Enum.GetName(typeof(plcstatus), Init.Plcstatus); //机台状态.Text = "机台状态:" + Enum.GetName(typeof(plcstatus), Init.Plcstatus);
int oldstatus = Init.Plcstatus; int oldstatus = Init.Plcstatus;
if (PlcData.Read_Status != 0) //if (PlcData.Read_Status != 0)
if(false)
{ {
DateTime oldPlcstatus_LastTime = Init.Plcstatus_LastTime;
//状态+报警 //状态+报警
if (oldstatus != PlcData.Read_Status) if (oldstatus != PlcData.Read_Status)
{ {
@@ -256,8 +272,19 @@ namespace WindowsFormsApp1
{ {
//机台状态.BackColor = SystemColors.Control; //机台状态.BackColor = SystemColors.Control;
} }
#endregion #endregion
#region 判断及查找流程 #region 判断及查找流程
if (PlcData.Read_Trigger == OldPlcTrigger)
{
continue;
}
else
{
OldPlcTrigger = PlcData.Read_Trigger;
}
if (PlcData.Read_Trigger == 0 && PlcData.Write_Status == 0) if (PlcData.Read_Trigger == 0 && PlcData.Write_Status == 0)
{ {
continue; continue;
@@ -294,6 +321,7 @@ namespace WindowsFormsApp1
} }
#endregion #endregion
#region 根据流程,判断是否需要扫码、气密、扭力等 #region 根据流程,判断是否需要扫码、气密、扭力等
if (nowflow.scan) if (nowflow.scan)
{ {
@@ -313,12 +341,13 @@ namespace WindowsFormsApp1
continue; continue;
} }
} }
// ccd 扫码,dzcan不用了
if (nowflow.dzscan) if (nowflow.dzscan)
{ {
//扫码 //扫码
var stationid = Init.t_Line.lineremark2; var stationid = Init.t_Line.lineremark2;
// ccd扫码 // ccd扫码
if ("Assy1".Contains(stationid)) if ("Assy1,".Contains(stationid))
{ {
SQLiteHelper<t_keyvalue> sQLiteHelper_key = new db.SQLiteHelper<t_keyvalue>(); SQLiteHelper<t_keyvalue> sQLiteHelper_key = new db.SQLiteHelper<t_keyvalue>();
var key_sqlresult = sQLiteHelper_key.QueryAll(); var key_sqlresult = sQLiteHelper_key.QueryAll();
@@ -382,6 +411,7 @@ namespace WindowsFormsApp1
// continue; // continue;
//} //}
} }
//压力曲线
if (nowflow.finalpressurecurve) if (nowflow.finalpressurecurve)
{ {
//压力曲线 //压力曲线
@@ -399,6 +429,7 @@ namespace WindowsFormsApp1
//{ //{
// //扭力曲线(这里不处理,后端API获取) // //扭力曲线(这里不处理,后端API获取)
//} //}
//螺丝扭力
if (nowflow.finaltorquevalue) if (nowflow.finaltorquevalue)
{ {
//螺丝枪扭力数据 //螺丝枪扭力数据
@@ -412,11 +443,13 @@ namespace WindowsFormsApp1
} }
otherdata.FinalTorqueValue = finaltorquevalue_result.Data; otherdata.FinalTorqueValue = finaltorquevalue_result.Data;
} }
//气密
if (nowflow.airtight) if (nowflow.airtight)
{ {
//气密参数 //气密参数
otherdata.FinalAirtightValue = Init.airtight; otherdata.FinalAirtightValue = Init.airtight;
} }
//螺丝角度
if (nowflow.finalanglevaluue) if (nowflow.finalanglevaluue)
{ {
//螺丝枪角度 //螺丝枪角度
@@ -435,77 +468,80 @@ namespace WindowsFormsApp1
//文件上传 //文件上传
} }
#endregion #endregion
// NG料进站不判断,进站MES返回FAIL,记录。该站其他事件不触发MES,直接跳过
//if()
#region 判断物料调用次数 固化站 #region 判断物料调用次数 固化站
if (Init.t_Line.lineremark2 == "Curing")
{
SQLiteHelper<t_materialcall> materialCallHelper = new SQLiteHelper<t_materialcall>();
string materialId = PlcData.Read_MaterialCode0;
bool shouldCallApi = false;
var materialCall = materialCallHelper.QuerySingle(m => m.materialid == materialId).Data; lock (curingLock)
if (materialCall == null) {
if (Init.t_Line.lineremark2 == "Curing")
{ {
// 首次进站,需要调用接口 SQLiteHelper<t_materialcall> materialCallHelper = new SQLiteHelper<t_materialcall>();
materialCall = new t_materialcall { materialid = materialId }; string materialId = PlcData.Read_MaterialCode0;
materialCall.checkin1 = DateTime.Now; bool shouldCallApi = false;
materialCallHelper.Insert(materialCall);
shouldCallApi = true; var materialCall = materialCallHelper.QuerySingle(m => m.materialid == materialId).Data;
} if (materialCall == null)
else
{
// 判断当前是第几次调用
if (!materialCall.checkin1.HasValue)
{ {
// 首次进站,需要调用接口
materialCall = new t_materialcall { materialid = materialId };
materialCall.checkin1 = DateTime.Now; materialCall.checkin1 = DateTime.Now;
shouldCallApi = true; materialCallHelper.Insert(materialCall);
}
else if (!materialCall.checkout3.HasValue
&& materialCall.checkout2.HasValue
&& materialCall.checkout1.HasValue
&& nowinterface.code.Contains("Checkout"))
{
// 第三次出站,需要调用接口
materialCall.checkout3 = DateTime.Now;
shouldCallApi = true; shouldCallApi = true;
} }
else else
{ {
// 更新对应的时间 // 判断当前是第几次调用
if (nowinterface.code.Contains("SN_CheckIN")) if (!materialCall.checkin1.HasValue)
{ {
if (!materialCall.checkin2.HasValue) materialCall.checkin1 = DateTime.Now;
materialCall.checkin2 = DateTime.Now; shouldCallApi = true;
else if (!materialCall.checkin3.HasValue)
materialCall.checkin3 = DateTime.Now;
PlcData.Write_Status = PLC_Status.SN_CheckIN;
} }
else if (nowinterface.code.Contains("SN_Checkout")) else if (!materialCall.checkout3.HasValue
&& materialCall.checkout2.HasValue
&& materialCall.checkout1.HasValue
&& nowinterface.code.Contains("Checkout"))
{ {
if (!materialCall.checkout1.HasValue) // 第三次出站,需要调用接口
materialCall.checkout1 = DateTime.Now; materialCall.checkout3 = DateTime.Now;
else if (!materialCall.checkout2.HasValue) shouldCallApi = true;
materialCall.checkout2 = DateTime.Now;
PlcData.Write_Status = PLC_Status.SN_Checkout;
} }
else
{
// 更新对应的时间
if (nowinterface.code.Contains("SN_CheckIN"))
{
if (!materialCall.checkin2.HasValue)
materialCall.checkin2 = DateTime.Now;
else if (!materialCall.checkin3.HasValue)
materialCall.checkin3 = DateTime.Now;
PlcData.Write_Status = PLC_Status.SN_CheckIN;
}
else if (nowinterface.code.Contains("SN_Checkout"))
{
if (!materialCall.checkout1.HasValue)
materialCall.checkout1 = DateTime.Now;
else if (!materialCall.checkout2.HasValue)
materialCall.checkout2 = DateTime.Now;
PlcData.Write_Status = PLC_Status.SN_Checkout;
}
}
materialCallHelper.Update(materialCall);
} }
materialCallHelper.Update(materialCall);
}
if (!shouldCallApi) if (!shouldCallApi)
{
// 不需要调用接口,直接返回成功
PlcData.Write_Status = nowinterface.code.Contains("SN_CheckIN")
? (short)PLC_Status.SN_CheckIN
: (short)PLC_Status.SN_Checkout;
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!writeresult.Success)
{ {
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); // 不需要调用接口,直接返回成功
PlcData.Write_Status = nowinterface.code.Contains("SN_CheckIN")
? (short)PLC_Status.SN_CheckIN
: (short)PLC_Status.SN_Checkout;
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!writeresult.Success)
{
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
continue;
}
continue; continue;
} }
continue;
} }
} }
#endregion #endregion
@@ -1337,7 +1373,7 @@ namespace WindowsFormsApp1
dataBuilder.Append(Init.AirtightPort.ReadExisting()); dataBuilder.Append(Init.AirtightPort.ReadExisting());
} }
var ReturnValue = dataBuilder.ToString(); var ReturnValue = dataBuilder.ToString();
LogExecute.logNet.WriteDebug($"通过气密仪获取到 {ReturnValue}"); //LogExecute.logNet.WriteDebug($"通过气密仪获取到 {ReturnValue}");
int index1 = 1; int index1 = 1;
int index2 = 1; int index2 = 1;
@@ -1391,8 +1427,8 @@ namespace WindowsFormsApp1
Init.airtight.Airtight_Value = sealInt[0].ToString(); Init.airtight.Airtight_Value = sealInt[0].ToString();
Init.airtight.Leak_Value = sealInt[1].ToString(); Init.airtight.Leak_Value = sealInt[1].ToString();
Init.airtight.LastTime = DateTime.Now; Init.airtight.LastTime = DateTime.Now;
LogExecute.logNet.WriteDebug($"通过气密仪获取到 压力值:{Init.airtight.Airtight_Value},泄露值:{Init.airtight.Leak_Value}"); CsvLogger.Log($"{Init.airtight.Airtight_Value},{Init.airtight.Leak_Value}");
LogExecute.SNlogNet.WriteDebug($"通过气密仪获取到 压力值:{Init.airtight.Airtight_Value},泄露值:{Init.airtight.Leak_Value}");
} }
catch (Exception ex) catch (Exception ex)
{ {
+1 -1
View File
@@ -21,7 +21,7 @@ namespace WindowsFormsApp1
public MaterialScanForm() public MaterialScanForm()
{ {
InitializeComponent(); InitializeComponent();
//Init.ScanPort.DataReceived += SerialPort_DataReceived_CL; Init.ScanPort.DataReceived += SerialPort_DataReceived_CL;
_dbHelper = new SQLiteHelper<t_materialscan>(); _dbHelper = new SQLiteHelper<t_materialscan>();
_apiClient = new ApiClient(); _apiClient = new ApiClient();
LoadMaterials(); LoadMaterials();
+6
View File
@@ -70,5 +70,11 @@ namespace WindowsFormsApp1
public static Airtight airtight = new Airtight(); public static Airtight airtight = new Airtight();
public static string SN { get; set; } public static string SN { get; set; }
public static string ImageName { get; set; }
public static int ImageLocation { get; set; }
public static int PlcTrigger { get; set; }
} }
} }
+2 -2
View File
@@ -35,7 +35,7 @@ namespace WindowsFormsApp1
public ImageDisplayForm() public ImageDisplayForm()
{ {
InitializeComponent(); InitializeComponent();
SetCurrentName("test"); SetCurrentName(Init.ImageName);
// 初始化自动更新定时器 // 初始化自动更新定时器
autoUpdateTimer = new Timer(); autoUpdateTimer = new Timer();
@@ -110,7 +110,7 @@ namespace WindowsFormsApp1
private void AutoUpdateTimer_Tick(object sender, EventArgs e) private void AutoUpdateTimer_Tick(object sender, EventArgs e)
{ {
// 这里应该从某处获取当前位置变量 // 这里应该从某处获取当前位置变量
string newPosition = GetCurrentPosition(); string newPosition = Init.ImageLocation.ToString();
if (newPosition != currentPosition || (string.IsNullOrEmpty(currentPosition) && !string.IsNullOrEmpty(newPosition))) if (newPosition != currentPosition || (string.IsNullOrEmpty(currentPosition) && !string.IsNullOrEmpty(newPosition)))
{ {
+19 -5
View File
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using WindowsFormsApp1.db; using WindowsFormsApp1.db;
using WindowsFormsApp1.mod; using WindowsFormsApp1.mod;
using WindowsFormsApp1.server;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace WindowsFormsApp1 namespace WindowsFormsApp1
@@ -30,14 +31,28 @@ namespace WindowsFormsApp1
} }
SQLiteHelper<t_user> sQLiteHelper = new db.SQLiteHelper<t_user>(); SQLiteHelper<t_user> sQLiteHelper = new db.SQLiteHelper<t_user>();
var result = sQLiteHelper.QuerySingle(a=>a.username == textBox1.Text && a.password == textBox2.Text); if (textBox1.Text == "admin")
{
var result = sQLiteHelper.QuerySingle(a => a.username == textBox1.Text && a.password == textBox2.Text);
if (!result.Success)
{
MessageBox.Show("管理员账户密码错误!");
return;
}
Init.t_User = result.Data;
}
else
{
Init.t_User = new t_user();
Init.t_User.username = textBox1.Text;
}
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>(); SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
var result_combox = sQLiteHelper1.QuerySingle(a=>a.id == (int)comboBox1.SelectedValue); var result_combox = sQLiteHelper1.QuerySingle(a=>a.id == (int)comboBox1.SelectedValue);
if (!result.Success || !result_combox.Success) if (!result_combox.Success)
{ {
MessageBox.Show("账号/密码/产线错误!"); MessageBox.Show("产线错误!");
return; return;
} }
else else
@@ -51,7 +66,6 @@ namespace WindowsFormsApp1
} }
Init.t_Lineplcs = lineplc_result.Data; Init.t_Lineplcs = lineplc_result.Data;
Init.t_User = result.Data;
Init.t_Line = result_combox.Data; Init.t_Line = result_combox.Data;
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
this.Close(); this.Close();
@@ -61,7 +75,7 @@ namespace WindowsFormsApp1
private void LoginForm_Load(object sender, EventArgs e) private void LoginForm_Load(object sender, EventArgs e)
{ {
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>(); SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
var result_combox = sQLiteHelper1.QueryAll(); var result_combox = sQLiteHelper1.Query(x => x.lineremark7 == "1");
if (!result_combox.Success) if (!result_combox.Success)
{ {
MessageBox.Show("查询失败"); MessageBox.Show("查询失败");
+73 -60
View File
@@ -29,14 +29,14 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -51,89 +51,102 @@
this.groupBox1.Controls.Add(this.textBox2); this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.textBox1); this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(25, 28); this.groupBox1.Location = new System.Drawing.Point(50, 56);
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(351, 268); this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.groupBox1.Size = new System.Drawing.Size(702, 536);
this.groupBox1.TabIndex = 0; this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "修改密码"; this.groupBox1.Text = "修改密码";
// //
// textBox1 // label3
// //
this.textBox1.Location = new System.Drawing.Point(105, 45); this.label3.AutoSize = true;
this.textBox1.Name = "textBox1"; this.label3.Location = new System.Drawing.Point(34, 312);
this.textBox1.Size = new System.Drawing.Size(201, 26); this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.textBox1.TabIndex = 0; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(111, 33);
this.label3.TabIndex = 7;
this.label3.Text = "新密码";
// //
// textBox2 // label2
// //
this.textBox2.Location = new System.Drawing.Point(105, 94); this.label2.AutoSize = true;
this.textBox2.Name = "textBox2"; this.label2.Location = new System.Drawing.Point(34, 208);
this.textBox2.Size = new System.Drawing.Size(201, 26); this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.textBox2.TabIndex = 1; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(111, 33);
this.label2.TabIndex = 6;
this.label2.Text = "新密码";
// //
// textBox3 // label1
// //
this.textBox3.Location = new System.Drawing.Point(105, 146); this.label1.AutoSize = true;
this.textBox3.Name = "textBox3"; this.label1.Location = new System.Drawing.Point(34, 90);
this.textBox3.Size = new System.Drawing.Size(201, 26); this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.textBox3.TabIndex = 2; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(111, 33);
this.label1.TabIndex = 5;
this.label1.Text = "原密码";
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(35, 213); this.button1.Location = new System.Drawing.Point(70, 426);
this.button1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 40); this.button1.Size = new System.Drawing.Size(200, 80);
this.button1.TabIndex = 3; this.button1.TabIndex = 3;
this.button1.Text = "修改密码"; this.button1.Text = "修改密码";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(210, 292);
this.textBox3.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.textBox3.Name = "textBox3";
this.textBox3.PasswordChar = '*';
this.textBox3.Size = new System.Drawing.Size(398, 44);
this.textBox3.TabIndex = 2;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(210, 188);
this.textBox2.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.textBox2.Name = "textBox2";
this.textBox2.PasswordChar = '*';
this.textBox2.Size = new System.Drawing.Size(398, 44);
this.textBox2.TabIndex = 1;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(210, 90);
this.textBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(398, 44);
this.textBox1.TabIndex = 0;
//
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(216, 213); this.button2.Location = new System.Drawing.Point(432, 426);
this.button2.Margin = new System.Windows.Forms.Padding(6);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 40); this.button2.Size = new System.Drawing.Size(200, 80);
this.button2.TabIndex = 4; this.button2.TabIndex = 4;
this.button2.Text = "关闭"; this.button2.Text = "关闭";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// label1 // UserChangeP
// //
this.label1.AutoSize = true; this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.label1.Location = new System.Drawing.Point(17, 45);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(55, 16);
this.label1.TabIndex = 5;
this.label1.Text = "原密码";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(17, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 16);
this.label2.TabIndex = 6;
this.label2.Text = "新密码";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(17, 156);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(55, 16);
this.label3.TabIndex = 7;
this.label3.Text = "新密码";
//
// USER_ChangeP
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 320); this.ClientSize = new System.Drawing.Size(808, 640);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "USER_ChangeP"; this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.Name = "UserChangeP";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "USER_ChangeP"; this.Text = "USER_ChangeP";
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
@@ -148,10 +161,10 @@
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
} }
} }
+29
View File
@@ -7,6 +7,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using WindowsFormsApp1.db;
using WindowsFormsApp1.mod;
namespace WindowsFormsApp1.form namespace WindowsFormsApp1.form
{ {
@@ -24,7 +26,34 @@ namespace WindowsFormsApp1.form
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
if(string.IsNullOrEmpty(textBox1.Text)|| string.IsNullOrEmpty(textBox2.Text)|| string.IsNullOrEmpty(textBox3.Text))
{
MessageBox.Show("新旧密码不能为空!");
return;
}
if (textBox1.Text != Init.t_User.password)
{
MessageBox.Show("原密码不正确!");
return;
}
if (textBox2.Text != textBox3.Text)
{
MessageBox.Show("两次新密码不一致!");
return;
}
Init.t_User.password = textBox2.Text;
SQLiteHelper<t_user> userHelper = new SQLiteHelper<t_user>();
var result = userHelper.Update(Init.t_User);
if (!result.Success)
{
MessageBox.Show("密码修改失败!");
return;
}
MessageBox.Show("密码修改成功");
this.Close();
} }
} }
} }
+23 -15
View File
@@ -36,7 +36,6 @@ namespace WindowsFormsApp1.server
private readonly string _fixsn; private readonly string _fixsn;
private readonly string _logBasePath; private readonly string _logBasePath;
public ApiClient() public ApiClient()
{ {
_httpClient = new HttpClient(); _httpClient = new HttpClient();
@@ -125,7 +124,18 @@ namespace WindowsFormsApp1.server
// 创建 StringContent 对象,将 JSON 字符串作为请求体,指定编码和媒体类型 // 创建 StringContent 对象,将 JSON 字符串作为请求体,指定编码和媒体类型
var httpContent = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); var httpContent = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
// 调用接口 #region test
// 回写对应PLC
if (statusCode > 0)
PlcData.Write_Status = (short)statusCode;
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
PlcData.Write_stSN = "testsn";
LogExecute.logNet.WriteDebug($"{eventName} 测ui接口请求成功\n请求:{jsonPayload}\n");
return ApiFormResult.Sucess(mesresult.PASS, true, "PASS", PlcData, DateTime.Now);
#endregion test
/*
#region 正式调用接口
try try
{ {
#region MES交互 #region MES交互
@@ -155,7 +165,7 @@ namespace WindowsFormsApp1.server
// 回写对应PLC // 回写对应PLC
if (statusCode > 0) if (statusCode > 0)
PlcData.Write_Status = (short)statusCode; PlcData.Write_Status = (short)statusCode;
if (eventName == "SN_Release" || eventName == "SN_CheckIn") if (eventName == "SN_Release" || eventName == "SN_CheckIN")
PlcData.Write_stSN = res.SN.Value; PlcData.Write_stSN = res.SN.Value;
if (eventName == "SN_FeedingCheck") if (eventName == "SN_FeedingCheck")
{ {
@@ -212,7 +222,10 @@ namespace WindowsFormsApp1.server
throw new Exception(ex.Message); throw new Exception(ex.Message);
} }
return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now); return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now);
#endregion 正式调用接口
*/
} }
public ApiFormResult SN_CheckIN(string url, plcdata PlcData, otherdata OtherData) public ApiFormResult SN_CheckIN(string url, plcdata PlcData, otherdata OtherData)
@@ -222,7 +235,7 @@ namespace WindowsFormsApp1.server
var stationid = Init.t_Line.lineremark2.ToLower(); var stationid = Init.t_Line.lineremark2.ToLower();
if ("loadaging,exchange2,exchange1".Contains(stationid)) if ("loadaging,exchange2,exchange1".Contains(stationid))
{ {
sn = Init.SN; sn = PlcData.Read_MaterialCode0;
} }
else else
{ {
@@ -353,7 +366,7 @@ namespace WindowsFormsApp1.server
Qty = "1" Qty = "1"
} }
}, },
SN = Init.SN, SN = PlcData.Read_MaterialCode0,
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
}; };
@@ -771,9 +784,6 @@ namespace WindowsFormsApp1.server
//气密 //气密
if ("WAT,Leakage".Contains(stationid)) if ("WAT,Leakage".Contains(stationid))
{ {
var customHeaders = new List<string> { "SN", { OutItem.充气压力 }, { OutItem.泄漏量 }, "时间" };
CsvLogger.SetHeaders(customHeaders);
sninfo.DC_INFO.Add(new DCInfoItem sninfo.DC_INFO.Add(new DCInfoItem
{ {
Item = OutItem.充气压力, Item = OutItem.充气压力,
@@ -796,7 +806,7 @@ namespace WindowsFormsApp1.server
{ {
if ("Assy2,Assy3".Contains(stationid)) if ("Assy2,Assy3".Contains(stationid))
{ {
CsvLogger.Log($"{PlcData.Read_MaterialCode0},{OtherData.FinalAngleValue[i]},{OtherData.FinalTorqueValue[i]},{PlcData.Read_UploadData0.ToString()}"); CsvLogger.Log($"{PlcData.Read_MaterialCode0},{OtherData.FinalAngleValue[i]},{OtherData.FinalTorqueValue[i]},{logresult}");
} }
else else
{ {
@@ -838,9 +848,9 @@ namespace WindowsFormsApp1.server
dcInfo.Value = logresult; dcInfo.Value = logresult;
dcInfo.Result = result; dcInfo.Result = result;
sninfo.DC_INFO.Add(dcInfo); sninfo.DC_INFO.Add(dcInfo);
if (!"Assy2,Assy3".Contains(stationid)) if (!"Assy2,Assy3,Sealant".Contains(stationid))
{ {
CsvLogger.Log($"{PlcData.Read_MaterialCode0},{PlcData.Read_UploadData0.ToString()}"); CsvLogger.Log($"{PlcData.Read_MaterialCode0},{logresult}");
} }
//LogExecute.SNlogNet.WriteDebug($"追溯码:{PlcData.Read_MaterialCode0},检测结果:{logresult}"); //LogExecute.SNlogNet.WriteDebug($"追溯码:{PlcData.Read_MaterialCode0},检测结果:{logresult}");
} }
@@ -909,7 +919,7 @@ namespace WindowsFormsApp1.server
sninfo.DC_INFO.Add(dcInfo); sninfo.DC_INFO.Add(dcInfo);
} }
//胶重 胶宽 //胶重 胶宽 CCD
if ("Sealant".Contains(stationid)) if ("Sealant".Contains(stationid))
{ {
dcInfo = new DCInfoItem(); dcInfo = new DCInfoItem();
@@ -923,7 +933,7 @@ namespace WindowsFormsApp1.server
dcInfo.Item = $"{stationid}_Width"; dcInfo.Item = $"{stationid}_Width";
dcInfo.Value = PlcData.Read_UploadData1.ToString(); dcInfo.Value = PlcData.Read_UploadData1.ToString();
dcInfo.Result = result; dcInfo.Result = result;
CsvLogger.Log($"{PlcData.Read_MaterialCode0},{PlcData.Read_UploadData0.ToString()},{PlcData.Read_UploadData1.ToString()}"); CsvLogger.Log($"{PlcData.Read_MaterialCode0},{PlcData.Read_UploadData0.ToString()},{PlcData.Read_UploadData1.ToString()},{logresult}");
sninfo.DC_INFO.Add(dcInfo); sninfo.DC_INFO.Add(dcInfo);
} }
@@ -1131,8 +1141,6 @@ namespace WindowsFormsApp1.server
public const int Fail = 1001; public const int Fail = 1001;
} }
#region checkout class #region checkout class
// 根对象类 // 根对象类
public class CheckOutObject public class CheckOutObject