扫材料码页面,固化时间,事件记录
This commit is contained in:
1 parent
083c4ec3ac
commit
d9a3f19678
10 files changed
+842
-94
No files matched your search
@@ -231,6 +231,14 @@
|
||||
<Compile Include="form\MESUrl.Designer.cs">
|
||||
<DependentUpon>MESUrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MaterialScanForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MaterialScanForm.Designer.cs">
|
||||
<DependentUpon>MaterialScanForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="mod\database\t_materialcall.cs" />
|
||||
<Compile Include="mod\database\t_materialscan.cs" />
|
||||
<Compile Include="mod\database\t_pressurecurve.cs" />
|
||||
<Compile Include="mod\database\t_flow.cs" />
|
||||
<Compile Include="mod\database\t_interface.cs" />
|
||||
@@ -340,6 +348,9 @@
|
||||
<EmbeddedResource Include="form\MESUrl.resx">
|
||||
<DependentUpon>MESUrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MaterialScanForm.resx">
|
||||
<DependentUpon>MaterialScanForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
Generated
+59
-49
@@ -1,4 +1,6 @@
|
||||
namespace WindowsFormsApp1
|
||||
using System;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
@@ -49,6 +51,7 @@
|
||||
this.扭力曲线配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.压力曲线设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.系统参数配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.材料扫码ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
@@ -76,11 +79,11 @@
|
||||
this.MES提示信息 = new System.Windows.Forms.Label();
|
||||
this.原料包装LOT号 = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.Tray盘二维码 = new System.Windows.Forms.Label();
|
||||
this.MES提示 = 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.Label();
|
||||
this.MES提示 = new System.Windows.Forms.Label();
|
||||
this.Tray盘二维码 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.开始处理 = new System.Windows.Forms.Button();
|
||||
@@ -102,7 +105,7 @@
|
||||
this.底部注释4 = new System.Windows.Forms.Label();
|
||||
this.底部注释5 = new System.Windows.Forms.Label();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.剩余寿命 = new System.Windows.Forms.Label();
|
||||
this.胶水上下线 = new System.Windows.Forms.Button();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.tableLayoutPanel4.SuspendLayout();
|
||||
@@ -133,7 +136,8 @@
|
||||
this.流程管理ToolStripMenuItem,
|
||||
this.mES接口配置ToolStripMenuItem,
|
||||
this.扫码枪配置ToolStripMenuItem,
|
||||
this.系统参数配置ToolStripMenuItem});
|
||||
this.系统参数配置ToolStripMenuItem,
|
||||
this.材料扫码ToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2);
|
||||
@@ -283,6 +287,13 @@
|
||||
this.系统参数配置ToolStripMenuItem.Text = "系统参数配置";
|
||||
this.系统参数配置ToolStripMenuItem.Click += new System.EventHandler(this.系统参数配置ToolStripMenuItem_Click);
|
||||
//
|
||||
// 材料扫码ToolStripMenuItem
|
||||
//
|
||||
this.材料扫码ToolStripMenuItem.Name = "材料扫码ToolStripMenuItem";
|
||||
this.材料扫码ToolStripMenuItem.Size = new System.Drawing.Size(166, 45);
|
||||
this.材料扫码ToolStripMenuItem.Text = "材料扫码";
|
||||
this.材料扫码ToolStripMenuItem.Click += new System.EventHandler(this.材料扫码ToolStripMenuItem_Click);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
@@ -662,32 +673,9 @@
|
||||
this.tableLayoutPanel5.RowCount = 2;
|
||||
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel5.Size = new System.Drawing.Size(1215, 258);
|
||||
this.tableLayoutPanel5.TabIndex = 0;
|
||||
//
|
||||
// Tray盘二维码
|
||||
//
|
||||
this.Tray盘二维码.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.Tray盘二维码.AutoSize = true;
|
||||
this.Tray盘二维码.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Tray盘二维码.Location = new System.Drawing.Point(339, 163);
|
||||
this.Tray盘二维码.Name = "Tray盘二维码";
|
||||
this.Tray盘二维码.Size = new System.Drawing.Size(664, 59);
|
||||
this.Tray盘二维码.TabIndex = 2;
|
||||
this.Tray盘二维码.Text = "托盘二维码:921391293";
|
||||
//
|
||||
// MES提示
|
||||
//
|
||||
this.MES提示.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.MES提示.AutoSize = true;
|
||||
this.MES提示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.MES提示.Location = new System.Drawing.Point(26, 169);
|
||||
this.MES提示.Name = "MES提示";
|
||||
this.MES提示.Size = new System.Drawing.Size(212, 48);
|
||||
this.MES提示.TabIndex = 4;
|
||||
this.MES提示.Text = "托盘码:";
|
||||
//
|
||||
// LOT号显示
|
||||
//
|
||||
this.LOT号显示.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
@@ -710,17 +698,38 @@
|
||||
this.LOT号.TabIndex = 0;
|
||||
this.LOT号.Text = "SN:23199191";
|
||||
//
|
||||
// 胶水上下线
|
||||
// 剩余寿命
|
||||
//
|
||||
this.胶水上下线.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.胶水上下线.Location = new System.Drawing.Point(1081, 5);
|
||||
this.胶水上下线.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.胶水上下线.Name = "胶水上下线";
|
||||
this.胶水上下线.Size = new System.Drawing.Size(130, 119);
|
||||
this.胶水上下线.TabIndex = 3;
|
||||
this.胶水上下线.Text = "材料\r\n上下线";
|
||||
this.胶水上下线.UseVisualStyleBackColor = true;
|
||||
this.胶水上下线.Click += new System.EventHandler(this.胶水上下线_Click);
|
||||
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(1090, 160);
|
||||
this.剩余寿命.Name = "剩余寿命";
|
||||
this.剩余寿命.Size = new System.Drawing.Size(111, 66);
|
||||
this.剩余寿命.TabIndex = 5;
|
||||
this.剩余寿命.Text = "剩余寿命";
|
||||
//
|
||||
// MES提示
|
||||
//
|
||||
this.MES提示.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.MES提示.AutoSize = true;
|
||||
this.MES提示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.MES提示.Location = new System.Drawing.Point(26, 169);
|
||||
this.MES提示.Name = "MES提示";
|
||||
this.MES提示.Size = new System.Drawing.Size(212, 48);
|
||||
this.MES提示.TabIndex = 4;
|
||||
this.MES提示.Text = "托盘码:";
|
||||
//
|
||||
// Tray盘二维码
|
||||
//
|
||||
this.Tray盘二维码.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.Tray盘二维码.AutoSize = true;
|
||||
this.Tray盘二维码.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Tray盘二维码.Location = new System.Drawing.Point(339, 163);
|
||||
this.Tray盘二维码.Name = "Tray盘二维码";
|
||||
this.Tray盘二维码.Size = new System.Drawing.Size(664, 59);
|
||||
this.Tray盘二维码.TabIndex = 2;
|
||||
this.Tray盘二维码.Text = "托盘二维码:921391293";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
@@ -1028,16 +1037,16 @@
|
||||
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(1090, 160);
|
||||
this.剩余寿命.Name = "剩余寿命";
|
||||
this.剩余寿命.Size = new System.Drawing.Size(111, 66);
|
||||
this.剩余寿命.TabIndex = 5;
|
||||
this.剩余寿命.Text = "剩余寿命";
|
||||
this.胶水上下线.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.胶水上下线.Location = new System.Drawing.Point(1081, 5);
|
||||
this.胶水上下线.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.胶水上下线.Name = "胶水上下线";
|
||||
this.胶水上下线.Size = new System.Drawing.Size(130, 119);
|
||||
this.胶水上下线.TabIndex = 3;
|
||||
this.胶水上下线.Text = "胶水寿命";
|
||||
this.胶水上下线.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -1092,6 +1101,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem pLC地址设置ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 扫码枪配置ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 系统参数配置ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 材料扫码ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 扫码枪配置ToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem 修改密码ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 切换用户ToolStripMenuItem;
|
||||
@@ -1119,7 +1129,6 @@
|
||||
private System.Windows.Forms.Label LOT号显示;
|
||||
private System.Windows.Forms.Label LOT号;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Button 胶水上下线;
|
||||
private System.Windows.Forms.Label MES提示;
|
||||
private System.Windows.Forms.ToolStripMenuItem 产线基础信息管理ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem pLC报警设置ToolStripMenuItem;
|
||||
@@ -1157,6 +1166,7 @@
|
||||
private System.Windows.Forms.Label linecode;
|
||||
private System.Windows.Forms.Label linename;
|
||||
private System.Windows.Forms.Label 剩余寿命;
|
||||
private System.Windows.Forms.Button 胶水上下线;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ using WindowsFormsApp1.mod.database;
|
||||
using WindowsFormsApp1.mod.server;
|
||||
using WindowsFormsApp1.server;
|
||||
using static SQLite.SQLite3;
|
||||
using static WindowsFormsApp1.server.ApiClient;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
@@ -359,6 +360,75 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 判断物料调用次数 固化站
|
||||
if (Init.t_Line.lineremark1 == "Curing")
|
||||
{
|
||||
SQLiteHelper<t_materialcall> materialCallHelper = new SQLiteHelper<t_materialcall>();
|
||||
string materialId = PlcData.Read_MaterialCode1;
|
||||
bool shouldCallApi = false;
|
||||
|
||||
var materialCall = materialCallHelper.Query(m => m.materialid == materialId).Data.FirstOrDefault();
|
||||
if (materialCall == null)
|
||||
{
|
||||
// 首次进站,需要调用接口
|
||||
materialCall = new t_materialcall { materialid = materialId };
|
||||
materialCall.checkin1 = DateTime.Now;
|
||||
materialCallHelper.Insert(materialCall);
|
||||
shouldCallApi = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 判断当前是第几次调用
|
||||
if (!materialCall.checkin1.HasValue)
|
||||
{
|
||||
materialCall.checkin1 = DateTime.Now;
|
||||
shouldCallApi = true;
|
||||
}
|
||||
else if (!materialCall.checkout3.HasValue && nowinterface.code.Contains("Checkout"))
|
||||
{
|
||||
// 第三次出站,需要调用接口
|
||||
materialCall.checkout3 = DateTime.Now;
|
||||
shouldCallApi = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 更新对应的时间
|
||||
if (nowinterface.code.Contains("SN_CheckIN"))
|
||||
{
|
||||
if (!materialCall.checkin2.HasValue)
|
||||
materialCall.checkin2 = DateTime.Now;
|
||||
else if (!materialCall.checkin3.HasValue)
|
||||
materialCall.checkin3 = DateTime.Now;
|
||||
}
|
||||
else if (nowinterface.code.Contains("SN_Checkout"))
|
||||
{
|
||||
if (!materialCall.checkout1.HasValue)
|
||||
materialCall.checkout1 = DateTime.Now;
|
||||
else if (!materialCall.checkout2.HasValue)
|
||||
materialCall.checkout2 = DateTime.Now;
|
||||
}
|
||||
}
|
||||
materialCallHelper.Update(materialCall);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 调用后端接口
|
||||
var result = apiClient.CallFunctionByName(nowinterface.code, PlcData, otherdata);
|
||||
if (result.IsShow)
|
||||
@@ -639,6 +709,12 @@ namespace WindowsFormsApp1
|
||||
keyValue.ShowDialog();
|
||||
}
|
||||
|
||||
private void 材料扫码ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MaterialScanForm materialScanForm = new MaterialScanForm();
|
||||
materialScanForm.Show();
|
||||
}
|
||||
|
||||
private void pLC通讯设置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Plc_Manage pLC_Manage = new Plc_Manage();
|
||||
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
partial class MaterialScanForm
|
||||
{
|
||||
/// <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.panelTop = new System.Windows.Forms.Panel();
|
||||
this.lblScan = new System.Windows.Forms.Label();
|
||||
this.lblPosition = new System.Windows.Forms.Label();
|
||||
this.lblDescription = new System.Windows.Forms.Label();
|
||||
this.txtScan = new System.Windows.Forms.TextBox();
|
||||
this.rbPosition1 = new System.Windows.Forms.RadioButton();
|
||||
this.rbPosition2 = new System.Windows.Forms.RadioButton();
|
||||
this.txtDescription = new System.Windows.Forms.TextBox();
|
||||
this.btnAdd = new System.Windows.Forms.Button();
|
||||
this.dgvMaterials = new System.Windows.Forms.DataGridView();
|
||||
this.colOffline = new System.Windows.Forms.DataGridViewButtonColumn();
|
||||
this.colScanCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colPosition = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colDescription = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.panelTop.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvMaterials)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panelTop
|
||||
//
|
||||
this.panelTop.Controls.Add(this.lblScan);
|
||||
this.panelTop.Controls.Add(this.lblPosition);
|
||||
this.panelTop.Controls.Add(this.lblDescription);
|
||||
this.panelTop.Controls.Add(this.txtScan);
|
||||
this.panelTop.Controls.Add(this.rbPosition1);
|
||||
this.panelTop.Controls.Add(this.rbPosition2);
|
||||
this.panelTop.Controls.Add(this.txtDescription);
|
||||
this.panelTop.Controls.Add(this.btnAdd);
|
||||
this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panelTop.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelTop.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.panelTop.Name = "panelTop";
|
||||
this.panelTop.Size = new System.Drawing.Size(2148, 300);
|
||||
this.panelTop.TabIndex = 6;
|
||||
//
|
||||
// lblScan
|
||||
//
|
||||
this.lblScan.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.lblScan.Location = new System.Drawing.Point(24, 50);
|
||||
this.lblScan.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||
this.lblScan.Name = "lblScan";
|
||||
this.lblScan.Size = new System.Drawing.Size(200, 50);
|
||||
this.lblScan.TabIndex = 0;
|
||||
this.lblScan.Text = "扫描条码";
|
||||
//
|
||||
// lblPosition
|
||||
//
|
||||
this.lblPosition.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.lblPosition.Location = new System.Drawing.Point(700, 50);
|
||||
this.lblPosition.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||
this.lblPosition.Name = "lblPosition";
|
||||
this.lblPosition.Size = new System.Drawing.Size(200, 50);
|
||||
this.lblPosition.TabIndex = 1;
|
||||
this.lblPosition.Text = "位置";
|
||||
//
|
||||
// lblDescription
|
||||
//
|
||||
this.lblDescription.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.lblDescription.Location = new System.Drawing.Point(1200, 50);
|
||||
this.lblDescription.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||
this.lblDescription.Name = "lblDescription";
|
||||
this.lblDescription.Size = new System.Drawing.Size(200, 50);
|
||||
this.lblDescription.TabIndex = 2;
|
||||
this.lblDescription.Text = "说明";
|
||||
//
|
||||
// txtScan
|
||||
//
|
||||
this.txtScan.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.txtScan.Location = new System.Drawing.Point(24, 110);
|
||||
this.txtScan.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.txtScan.Name = "txtScan";
|
||||
this.txtScan.Size = new System.Drawing.Size(596, 57);
|
||||
this.txtScan.TabIndex = 3;
|
||||
//
|
||||
// rbPosition1
|
||||
//
|
||||
this.rbPosition1.Checked = true;
|
||||
this.rbPosition1.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.rbPosition1.Location = new System.Drawing.Point(700, 110);
|
||||
this.rbPosition1.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.rbPosition1.Name = "rbPosition1";
|
||||
this.rbPosition1.Size = new System.Drawing.Size(180, 64);
|
||||
this.rbPosition1.TabIndex = 4;
|
||||
this.rbPosition1.TabStop = true;
|
||||
this.rbPosition1.Text = "位置1";
|
||||
//
|
||||
// rbPosition2
|
||||
//
|
||||
this.rbPosition2.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.rbPosition2.Location = new System.Drawing.Point(900, 110);
|
||||
this.rbPosition2.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.rbPosition2.Name = "rbPosition2";
|
||||
this.rbPosition2.Size = new System.Drawing.Size(180, 64);
|
||||
this.rbPosition2.TabIndex = 5;
|
||||
this.rbPosition2.Text = "位置2";
|
||||
//
|
||||
// txtDescription
|
||||
//
|
||||
this.txtDescription.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.txtDescription.Location = new System.Drawing.Point(1200, 110);
|
||||
this.txtDescription.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.txtDescription.Name = "txtDescription";
|
||||
this.txtDescription.Size = new System.Drawing.Size(596, 57);
|
||||
this.txtDescription.TabIndex = 6;
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
this.btnAdd.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.btnAdd.Location = new System.Drawing.Point(1840, 104);
|
||||
this.btnAdd.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Size = new System.Drawing.Size(200, 76);
|
||||
this.btnAdd.TabIndex = 7;
|
||||
this.btnAdd.Text = "上线";
|
||||
//
|
||||
// dgvMaterials
|
||||
//
|
||||
this.dgvMaterials.AllowUserToAddRows = false;
|
||||
this.dgvMaterials.AllowUserToDeleteRows = false;
|
||||
this.dgvMaterials.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dgvMaterials.ColumnHeadersHeight = 40;
|
||||
this.dgvMaterials.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgvMaterials.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.dgvMaterials.Location = new System.Drawing.Point(0, 300);
|
||||
this.dgvMaterials.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.dgvMaterials.Name = "dgvMaterials";
|
||||
this.dgvMaterials.ReadOnly = true;
|
||||
this.dgvMaterials.RowHeadersWidth = 82;
|
||||
this.dgvMaterials.RowTemplate.Height = 35;
|
||||
this.dgvMaterials.Size = new System.Drawing.Size(2148, 1134);
|
||||
this.dgvMaterials.TabIndex = 5;
|
||||
//
|
||||
// colOffline
|
||||
//
|
||||
this.colOffline.HeaderText = "";
|
||||
this.colOffline.MinimumWidth = 10;
|
||||
this.colOffline.Name = "colOffline";
|
||||
this.colOffline.Text = "下线";
|
||||
this.colOffline.UseColumnTextForButtonValue = true;
|
||||
this.colOffline.Width = 80;
|
||||
//
|
||||
// colScanCode
|
||||
//
|
||||
this.colScanCode.HeaderText = "扫描码";
|
||||
this.colScanCode.MinimumWidth = 10;
|
||||
this.colScanCode.Name = "colScanCode";
|
||||
this.colScanCode.Width = 200;
|
||||
//
|
||||
// colPosition
|
||||
//
|
||||
this.colPosition.HeaderText = "位置";
|
||||
this.colPosition.MinimumWidth = 10;
|
||||
this.colPosition.Name = "colPosition";
|
||||
this.colPosition.Width = 200;
|
||||
//
|
||||
// colDescription
|
||||
//
|
||||
this.colDescription.HeaderText = "说明";
|
||||
this.colDescription.MinimumWidth = 10;
|
||||
this.colDescription.Name = "colDescription";
|
||||
this.colDescription.Width = 200;
|
||||
//
|
||||
// colTime
|
||||
//
|
||||
this.colTime.HeaderText = "时间";
|
||||
this.colTime.MinimumWidth = 10;
|
||||
this.colTime.Name = "colTime";
|
||||
this.colTime.ReadOnly = true;
|
||||
this.colTime.Width = 200;
|
||||
//
|
||||
// MaterialScanForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(2148, 1434);
|
||||
this.Controls.Add(this.dgvMaterials);
|
||||
this.Controls.Add(this.panelTop);
|
||||
this.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.Name = "MaterialScanForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "材料扫码管理";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.panelTop.ResumeLayout(false);
|
||||
this.panelTop.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvMaterials)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panelTop;
|
||||
private System.Windows.Forms.TextBox txtScan;
|
||||
private System.Windows.Forms.RadioButton rbPosition1;
|
||||
private System.Windows.Forms.RadioButton rbPosition2;
|
||||
private System.Windows.Forms.TextBox txtDescription;
|
||||
private System.Windows.Forms.Button btnAdd;
|
||||
private System.Windows.Forms.DataGridView dgvMaterials;
|
||||
private System.Windows.Forms.Label lblScan;
|
||||
private System.Windows.Forms.Label lblPosition;
|
||||
private System.Windows.Forms.Label lblDescription;
|
||||
private System.Windows.Forms.DataGridViewButtonColumn colOffline;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colScanCode;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colPosition;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colDescription;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
using WindowsFormsApp1.mod.server;
|
||||
using WindowsFormsApp1.server;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class MaterialScanForm : Form
|
||||
{
|
||||
private SQLiteHelper<t_materialscan> _dbHelper;
|
||||
private List<t_materialscan> materials = new List<t_materialscan>();
|
||||
private ApiClient _apiClient;
|
||||
public MaterialScanForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
//Init.ScanPort.DataReceived += SerialPort_DataReceived_CL;
|
||||
_dbHelper = new SQLiteHelper<t_materialscan>();
|
||||
_apiClient = new ApiClient();
|
||||
LoadMaterials();
|
||||
SetupControls();
|
||||
}
|
||||
|
||||
private void LoadMaterials()
|
||||
{
|
||||
var result = _dbHelper.Query(m => m.isonline);
|
||||
if (result.Success)
|
||||
{
|
||||
materials = result.Data;
|
||||
}
|
||||
RefreshDataGrid();
|
||||
}
|
||||
|
||||
public void SerialPort_DataReceived_CL(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Init.ScanPort.IsOpen)
|
||||
{
|
||||
Init.ScanPort?.Open();
|
||||
}
|
||||
// 读取串口接收到的数据
|
||||
var dataBuilder = new StringBuilder();
|
||||
while (Init.ScanPort.BytesToRead > 0)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
dataBuilder.Append(Init.ScanPort.ReadExisting());
|
||||
}
|
||||
var barcode = dataBuilder.ToString();
|
||||
txtScan.Text = barcode;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"读取数据时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void BtnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(txtScan.Text) || txtScan.Text == "请扫描材料条码")
|
||||
{
|
||||
MessageBox.Show("请扫描材料条码!");
|
||||
return;
|
||||
}
|
||||
|
||||
string scanCode = txtScan.Text;
|
||||
if (materials.Any(m => m.scancode == scanCode))
|
||||
{
|
||||
MessageBox.Show("该材料已经在列表中!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
txtScan.Text = "请扫描材料条码";
|
||||
txtScan.ForeColor = Color.Gray;
|
||||
txtScan.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
var OtherData = new otherdata();
|
||||
OtherData.JS_SN = scanCode;
|
||||
OtherData.locationindex = rbPosition1.Checked ? 1 : 2;
|
||||
OtherData.opindex = 1;
|
||||
var mesResult = _apiClient.CallFunctionByName("Glue_CheckOut", new plcdata(), OtherData);
|
||||
|
||||
var material = new t_materialscan
|
||||
{
|
||||
scancode = scanCode,
|
||||
position = rbPosition1.Checked ? "1" : "2",
|
||||
description = txtDescription.Text == "请输入说明" ? "" : txtDescription.Text,
|
||||
scantime = DateTime.Now,
|
||||
isonline = true
|
||||
};
|
||||
|
||||
var result = _dbHelper.Insert(material);
|
||||
if (result.Success)
|
||||
{
|
||||
materials.Add(material);
|
||||
RefreshDataGrid();
|
||||
|
||||
// 清空输入
|
||||
txtScan.Text = "请扫描材料条码";
|
||||
txtScan.ForeColor = Color.Gray;
|
||||
txtDescription.Text = "请输入说明";
|
||||
txtDescription.ForeColor = Color.Gray;
|
||||
txtScan.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("保存失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void DgvMaterials_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex == 0 && e.RowIndex >= 0)
|
||||
{
|
||||
if (MessageBox.Show("确认要下线该材料吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
var material = materials[e.RowIndex];
|
||||
// 调用接口
|
||||
var OtherData = new otherdata();
|
||||
OtherData.JS_SN = material.scancode;
|
||||
OtherData.locationindex = int.Parse(material.position);
|
||||
OtherData.opindex = 2;
|
||||
var mesResult = _apiClient.CallFunctionByName("Glue_CheckOut", new plcdata(), OtherData);
|
||||
|
||||
material.isonline = false;
|
||||
var result = _dbHelper.Update(material);
|
||||
if (result.Success)
|
||||
{
|
||||
materials.RemoveAt(e.RowIndex);
|
||||
RefreshDataGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("下线失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupControls()
|
||||
{
|
||||
// 设置文本框默认提示
|
||||
SetupTextBoxHint(txtScan, "请扫描材料条码");
|
||||
SetupTextBoxHint(txtDescription, "请输入说明");
|
||||
|
||||
// 绑定事件
|
||||
btnAdd.Click += BtnAdd_Click;
|
||||
dgvMaterials.CellClick += DgvMaterials_CellClick;
|
||||
|
||||
// 调整表格行高和样式
|
||||
dgvMaterials.RowTemplate.Height = 60; // 增加行高
|
||||
dgvMaterials.ColumnHeadersHeight = 60; // 相应调整表头高度
|
||||
dgvMaterials.DefaultCellStyle.Font = new Font("微软雅黑", 14F);
|
||||
dgvMaterials.ColumnHeadersDefaultCellStyle.Font = new Font("微软雅黑", 14F);
|
||||
dgvMaterials.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
|
||||
dgvMaterials.AllowUserToAddRows = false;
|
||||
dgvMaterials.AllowUserToDeleteRows = false;
|
||||
dgvMaterials.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dgvMaterials.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
dgvMaterials.RowHeadersVisible = false;
|
||||
}
|
||||
|
||||
private void SetupTextBoxHint(TextBox textBox, string hint)
|
||||
{
|
||||
textBox.Text = hint;
|
||||
textBox.ForeColor = Color.Gray;
|
||||
|
||||
textBox.Enter += (s, e) => {
|
||||
if (textBox.Text == hint)
|
||||
{
|
||||
textBox.Text = "";
|
||||
textBox.ForeColor = Color.Black;
|
||||
}
|
||||
};
|
||||
|
||||
textBox.Leave += (s, e) => {
|
||||
if (string.IsNullOrWhiteSpace(textBox.Text))
|
||||
{
|
||||
textBox.Text = hint;
|
||||
textBox.ForeColor = Color.Gray;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void RefreshDataGrid()
|
||||
{
|
||||
// 确保表格有列
|
||||
if (dgvMaterials.Columns.Count == 0)
|
||||
{
|
||||
dgvMaterials.Columns.Add(colOffline);
|
||||
dgvMaterials.Columns.Add(colScanCode);
|
||||
dgvMaterials.Columns.Add(colPosition);
|
||||
dgvMaterials.Columns.Add(colDescription);
|
||||
dgvMaterials.Columns.Add(colTime);
|
||||
|
||||
// 调整列宽
|
||||
colOffline.Width = 50;
|
||||
colScanCode.Width = 400;
|
||||
colPosition.Width = 50;
|
||||
colDescription.Width = 80;
|
||||
colTime.Width = 250;
|
||||
}
|
||||
|
||||
dgvMaterials.Rows.Clear();
|
||||
foreach (var material in materials)
|
||||
{
|
||||
dgvMaterials.Rows.Add("下线", material.scancode, material.position,
|
||||
material.description, material.scantime.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
|
||||
// 确保所有行的高度都是60
|
||||
foreach (DataGridViewRow row in dgvMaterials.Rows)
|
||||
{
|
||||
row.Height = 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
+37
-33
@@ -34,18 +34,18 @@
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(201, 274);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.button1.Location = new System.Drawing.Point(402, 548);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(173, 39);
|
||||
this.button1.Size = new System.Drawing.Size(346, 78);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "登录";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
@@ -54,29 +54,30 @@
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.textBox1.Location = new System.Drawing.Point(201, 48);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.textBox1.Location = new System.Drawing.Point(402, 96);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(268, 29);
|
||||
this.textBox1.Size = new System.Drawing.Size(532, 51);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.textBox2.Location = new System.Drawing.Point(201, 120);
|
||||
this.textBox2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.textBox2.Location = new System.Drawing.Point(402, 240);
|
||||
this.textBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(268, 29);
|
||||
this.textBox2.PasswordChar = '*';
|
||||
this.textBox2.Size = new System.Drawing.Size(532, 51);
|
||||
this.textBox2.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label1.Location = new System.Drawing.Point(87, 51);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label1.Location = new System.Drawing.Point(174, 102);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(69, 19);
|
||||
this.label1.Size = new System.Drawing.Size(134, 38);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "用户名";
|
||||
//
|
||||
@@ -84,10 +85,10 @@
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label2.Location = new System.Drawing.Point(103, 123);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label2.Location = new System.Drawing.Point(206, 246);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(49, 19);
|
||||
this.label2.Size = new System.Drawing.Size(95, 38);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "密码";
|
||||
//
|
||||
@@ -101,41 +102,44 @@
|
||||
this.groupBox1.Controls.Add(this.button1);
|
||||
this.groupBox1.Controls.Add(this.textBox2);
|
||||
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(30, 26);
|
||||
this.groupBox1.Location = new System.Drawing.Point(60, 52);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(564, 359);
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1128, 718);
|
||||
this.groupBox1.TabIndex = 5;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "用户登录";
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(201, 195);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(268, 27);
|
||||
this.comboBox1.TabIndex = 5;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label3.Location = new System.Drawing.Point(87, 198);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label3.Location = new System.Drawing.Point(174, 396);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(89, 19);
|
||||
this.label3.Size = new System.Drawing.Size(173, 38);
|
||||
this.label3.TabIndex = 6;
|
||||
this.label3.Text = "选择产线";
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(402, 390);
|
||||
this.comboBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(532, 46);
|
||||
this.comboBox1.TabIndex = 5;
|
||||
//
|
||||
// LoginForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(620, 408);
|
||||
this.ClientSize = new System.Drawing.Size(1240, 816);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.Name = "LoginForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "LoginForm";
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using SQLite;
|
||||
using System;
|
||||
|
||||
namespace WindowsFormsApp1.mod
|
||||
{
|
||||
[Table("material_call")]
|
||||
public class t_materialcall
|
||||
{
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int id { get; set; }
|
||||
public string materialid { get; set; }
|
||||
public DateTime? checkin1 { get; set; }
|
||||
public DateTime? checkin2 { get; set; }
|
||||
public DateTime? checkin3 { get; set; }
|
||||
public DateTime? checkout1 { get; set; }
|
||||
public DateTime? checkout2 { get; set; }
|
||||
public DateTime? checkout3 { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using SQLite;
|
||||
using System;
|
||||
|
||||
namespace WindowsFormsApp1.mod
|
||||
{
|
||||
[Table("material_scan")]
|
||||
public class t_materialscan
|
||||
{
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int id { get; set; }
|
||||
public string scancode { get; set; }
|
||||
public string position { get; set; }
|
||||
public string description { get; set; }
|
||||
public DateTime scantime { get; set; }
|
||||
public bool isonline { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -86,12 +86,10 @@ namespace WindowsFormsApp1.server
|
||||
var station = Init.t_Line.lineremark2.ToLower();
|
||||
switch (station)
|
||||
{
|
||||
case "Potting"://灌胶
|
||||
case "ThermalPaste"://点胶&CCD检测
|
||||
case "UVCoating"://三防漆涂覆
|
||||
case "Sealant"://点密封胶&CCD
|
||||
break;
|
||||
default:
|
||||
case "potting"://灌胶
|
||||
case "thermalpaste"://点胶&CCD检测
|
||||
case "uvcoating"://三防漆涂覆
|
||||
case "sealant"://点密封胶&CCD
|
||||
var power = Init.t_Keyvalues.First(x => x.key == "Power");
|
||||
power.value = DateTime.Now.Millisecond.ToString();
|
||||
SQLiteHelper<t_keyvalue> kvHelper = new db.SQLiteHelper<t_keyvalue>();
|
||||
@@ -327,10 +325,10 @@ namespace WindowsFormsApp1.server
|
||||
var locationindex = 1;
|
||||
switch (station)
|
||||
{
|
||||
case "Potting"://灌胶
|
||||
case "ThermalPaste"://点胶&CCD检测
|
||||
case "UVCoating"://三防漆涂覆
|
||||
case "Sealant"://点密封胶&CCD
|
||||
case "potting"://灌胶
|
||||
case "thermalpaste"://点胶&CCD检测
|
||||
case "uvcoating"://三防漆涂覆
|
||||
case "sealant"://点密封胶&CCD
|
||||
break;
|
||||
default:
|
||||
fixsn_1 = "CompPN";
|
||||
@@ -514,7 +512,7 @@ namespace WindowsFormsApp1.server
|
||||
{
|
||||
// 根据不同的lineCode构建不同的请求
|
||||
var lineCode = Init.t_Line.linecode;
|
||||
var stationid = Init.t_Line.lineremark2;
|
||||
var stationid = Init.t_Line.lineremark2.ToLower();
|
||||
|
||||
var result = PlcData.Read_Result == 1 ? "PASS" : "FAIL";
|
||||
var logresult = PlcData.Read_Result == 1 ? "OK" : "NG";
|
||||
@@ -550,7 +548,7 @@ namespace WindowsFormsApp1.server
|
||||
var compListItem = new CompListItem();
|
||||
|
||||
//气密
|
||||
if ("SWAT".Contains(stationid))
|
||||
if ("WAT,Leakage".Contains(stationid))
|
||||
{
|
||||
|
||||
sninfo.DC_INFO.Add(new DCInfoItem
|
||||
@@ -615,7 +613,33 @@ namespace WindowsFormsApp1.server
|
||||
//固化 时间
|
||||
if ("Curing".Contains(stationid))
|
||||
{
|
||||
SQLiteHelper<t_materialcall> materialHelper = new db.SQLiteHelper<t_materialcall>();
|
||||
var material = materialHelper.QuerySingle(x => x.materialid == PlcData.Read_MaterialCode0);
|
||||
if (material.Success)
|
||||
{
|
||||
// 计算加热时间
|
||||
var time = ((TimeSpan)(material.Data.checkin2 - material.Data.checkout2)).TotalMinutes;
|
||||
var jrTime = Convert.ToInt32(time).ToString();
|
||||
sninfo.DC_INFO.Add(new DCInfoItem
|
||||
{
|
||||
Item = OutItem.固化时间,
|
||||
Value = jrTime,
|
||||
Result = result
|
||||
});
|
||||
sninfo.DC_INFO.Add(new DCInfoItem
|
||||
{
|
||||
Item = OutItem.固化温度,
|
||||
Value = PlcData.Read_UploadData0.ToString(),
|
||||
Up = "85",
|
||||
Down = "75",
|
||||
Result = result
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//报错,没有这个物料
|
||||
}
|
||||
}
|
||||
//胶重
|
||||
if ("Potting,ThermalPaste,Sealant".Contains(stationid))
|
||||
@@ -867,6 +891,8 @@ namespace WindowsFormsApp1.server
|
||||
{
|
||||
public string Item { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string Up { get; set; } = "";
|
||||
public string Down { get; set; } = "";
|
||||
public string Result { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user