Compare commits

...
7 Commits
Author SHA1 Message Date
gf zhou 752e1f37b6 页面布局修改 2025-04-04 23:28:46 +08:00
zhougf d20b935213 修改密码 固化锁线程 加oldplctrigger,避免重复调用 2025-04-01 15:15:05 +08:00
zhougf 60cafc4f8c test 331 2025-03-31 13:39:28 +08:00
zhougf 2b56f8e7d3 csv 页面等 2025-03-29 11:46:48 +08:00
zhougf 57299c0b55 图片测试,csv文件日志,文件复制半成品 2025-03-27 20:37:21 +08:00
zhougf d9a3f19678 扫材料码页面,固化时间,事件记录 2025-03-26 10:59:36 +08:00
zhougf 083c4ec3ac 3.25 测试
改端子扫码,产线页面,主页
2025-03-25 21:22:36 +08:00
43 changed files with 4883 additions and 1895 deletions

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@
# Mono auto generated files
mono_crash.*
.DS_Store
# Build results
[Dd]ebug/
[Dd]ebugPublic/
BIN
View File
Binary file not shown.
Binary file not shown.
+35 -2
View File
@@ -35,11 +35,15 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CsvHelper">
<HintPath>..\..\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="HslCommunication, Version=7.0.1.0, Culture=neutral, PublicKeyToken=cdb2261fa039ed67, processorArchitecture=MSIL">
<HintPath>..\packages\HslCommunication.7.0.1\lib\net451\HslCommunication.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.TimeProvider, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.TimeProvider.8.0.0\lib\net462\Microsoft.Bcl.TimeProvider.dll</HintPath>
@@ -147,6 +151,9 @@
<Compile Include="form\editForm\FLow_Insert.Designer.cs">
<DependentUpon>FLow_Insert.cs</DependentUpon>
</Compile>
<Compile Include="form\ImageDisplayForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="form\Line_Manage.cs">
<SubType>Form</SubType>
</Compile>
@@ -165,6 +172,9 @@
<Compile Include="form\Angleaddress_Manage.Designer.cs">
<DependentUpon>Angleaddress_Manage.cs</DependentUpon>
</Compile>
<Compile Include="form\LoadingForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="form\ScanForm_DZ.cs">
<SubType>Form</SubType>
</Compile>
@@ -177,6 +187,9 @@
<Compile Include="form\ScanForm_SSQ.Designer.cs">
<DependentUpon>ScanForm_SSQ.cs</DependentUpon>
</Compile>
<Compile Include="form\SimpleImageDisplayForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="form\Torqueaddress_Manage.cs">
<SubType>Form</SubType>
</Compile>
@@ -231,6 +244,16 @@
<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_imageposition.cs" />
<Compile Include="mod\database\t_lineplc.cs" />
<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" />
@@ -258,6 +281,7 @@
<Compile Include="server\ApiClient.cs" />
<Compile Include="server\ApiFormResult.cs" />
<Compile Include="server\BllResult.cs" />
<Compile Include="server\CsvHelper.cs" />
<Compile Include="server\FormHelp.cs" />
<Compile Include="server\LogExecute.cs" />
<Compile Include="server\SiemensHelp.cs" />
@@ -295,6 +319,9 @@
<EmbeddedResource Include="form\Flow_Manage.resx">
<DependentUpon>Flow_Manage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="form\ImageDisplayForm.resx">
<DependentUpon>ImageDisplayForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="form\Line_Manage.resx">
<DependentUpon>Line_Manage.cs</DependentUpon>
</EmbeddedResource>
@@ -310,6 +337,9 @@
<EmbeddedResource Include="form\ScanForm_SSQ.resx">
<DependentUpon>ScanForm_SSQ.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="form\SimpleImageDisplayForm.resx">
<DependentUpon>SimpleImageDisplayForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="form\Torqueaddress_Manage.resx">
<DependentUpon>Torqueaddress_Manage.cs</DependentUpon>
</EmbeddedResource>
@@ -340,6 +370,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>
+701 -990
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+239
View File
@@ -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;
}
}
+267
View File
@@ -0,0 +1,267 @@
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();
// 检查串口是否可用
if (Init.ScanPort != null)
{
try
{
// 如果串口未打开,尝试打开
if (!Init.ScanPort.IsOpen)
{
Init.ScanPort.Open();
}
// 订阅事件
Init.ScanPort.DataReceived += SerialPort_DataReceived_CL;
}
catch (Exception ex)
{
MessageBox.Show($"扫码枪串口初始化失败: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("扫码枪串口未配置,请检查系统设置", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
_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 != null && !Init.ScanPort.IsOpen)
{
try
{
Init.ScanPort.Open();
}
catch (Exception ex)
{
MessageBox.Show($"无法打开扫码枪串口: {ex.Message}");
return;
}
}
// 读取串口接收到的数据
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);
if (mesResult.Mesresult == mesresult.FAIL)
{
MessageBox.Show("上线失败!", mesResult.Msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
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);
if (mesResult.Mesresult == mesresult.FAIL)
{
MessageBox.Show("下线失败!", mesResult.Msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
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;
}
}
}
}
+120
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>
+9 -1
View File
@@ -40,7 +40,7 @@ namespace WindowsFormsApp1
public static t_user t_User;
public static List<t_flow> t_Flows;
public static List<t_lineplc> t_Lineplcs;
public static List<t_interface> t_Interfaces;
public static List<t_plcaddress> t_Plcaddresses;
@@ -68,5 +68,13 @@ namespace WindowsFormsApp1
//其他线程获取的气密参数
public static Airtight airtight = new Airtight();
public static string SN { get; set; }
public static string ImageName { get; set; }
public static int ImageLocation { get; set; }
public static int PlcTrigger { get; set; }
}
}
Binary file not shown.
+21 -21
View File
@@ -97,24 +97,24 @@
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView1.Location = new System.Drawing.Point(6, 5);
this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.dataGridView1.Location = new System.Drawing.Point(7, 6);
this.dataGridView1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowHeadersWidth = 72;
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4);
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(1557, 818);
this.dataGridView1.Size = new System.Drawing.Size(1698, 934);
this.dataGridView1.TabIndex = 1;
//
// 关闭
//
this.关闭.Anchor = System.Windows.Forms.AnchorStyles.None;
this.关闭.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.关闭.Location = new System.Drawing.Point(1575, 708);
this.关闭.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.关闭.Location = new System.Drawing.Point(1719, 810);
this.关闭.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.关闭.Name = "关闭";
this.关闭.Size = new System.Drawing.Size(163, 72);
this.关闭.Size = new System.Drawing.Size(177, 82);
this.关闭.TabIndex = 6;
this.关闭.Text = "关闭";
this.关闭.UseVisualStyleBackColor = true;
@@ -124,10 +124,10 @@
//
this.查询.Anchor = System.Windows.Forms.AnchorStyles.None;
this.查询.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.查询.Location = new System.Drawing.Point(1575, 46);
this.查询.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.查询.Location = new System.Drawing.Point(1719, 53);
this.查询.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.查询.Name = "查询";
this.查询.Size = new System.Drawing.Size(163, 72);
this.查询.Size = new System.Drawing.Size(177, 82);
this.查询.TabIndex = 4;
this.查询.Text = "查询";
this.查询.UseVisualStyleBackColor = true;
@@ -144,24 +144,24 @@
this.tableLayoutPanel1.Controls.Add(this.button1, 1, 2);
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(6, 5, 6, 5);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1744, 828);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1903, 946);
this.tableLayoutPanel1.TabIndex = 7;
//
// button1
//
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
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(1575, 542);
this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.button1.Location = new System.Drawing.Point(1719, 620);
this.button1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(163, 72);
this.button1.Size = new System.Drawing.Size(177, 82);
this.button1.TabIndex = 7;
this.button1.Text = "新增";
this.button1.UseVisualStyleBackColor = true;
@@ -256,8 +256,8 @@
// fileupload
//
this.fileupload.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.fileupload.DataPropertyName = "fileupload";
this.fileupload.HeaderText = "文件上传";
this.fileupload.DataPropertyName = "dzscan";
this.fileupload.HeaderText = "端子扫码";
this.fileupload.MinimumWidth = 9;
this.fileupload.Name = "fileupload";
this.fileupload.ReadOnly = true;
@@ -307,15 +307,15 @@
this.airtight.Name = "airtight";
this.airtight.ReadOnly = true;
//
// FLOW_Manage
// Flow_Manage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1744, 828);
this.ClientSize = new System.Drawing.Size(1903, 946);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.Name = "FLOW_Manage";
this.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.Name = "Flow_Manage";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FLOW_Mange";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
+1 -1
View File
@@ -152,7 +152,7 @@ namespace WindowsFormsApp1.form
finaltorquecurve = flow.finaltorquecurve,
finalpressurecurve = flow.finalpressurecurve,
airtight = flow.airtight,
dzscan = flow.dzscan
});
}
dataGridView1.DataSource = null;
+300
View File
@@ -0,0 +1,300 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.IO;
using WindowsFormsApp1.mod;
using WindowsFormsApp1.db;
namespace WindowsFormsApp1
{
public partial class ImageDisplayForm : Form
{
#region 控件字段
protected PictureBox pictureBox;
#endregion
#region 私有字段
private IContainer components = null;
private Bitmap originalImage;
private Bitmap markedImage;
private Timer blinkTimer;
private Timer autoUpdateTimer;
private string currentName = "";
private string currentPosition = "";
private bool isBlinking = false;
// 圆形标记相关参数
private float currentRadius = 20f;
private const float MIN_RADIUS = 20f;
private const float MAX_RADIUS = 50f;
private bool isExpanding = true;
private const float RADIUS_CHANGE_SPEED = 2f;
#endregion
#region 构造函数和初始化
public ImageDisplayForm()
{
InitializeComponent();
SetCurrentName(Init.ImageName);
// 初始化自动更新定时器
autoUpdateTimer = new Timer();
autoUpdateTimer.Interval = 1000;
autoUpdateTimer.Tick += new EventHandler(AutoUpdateTimer_Tick);
autoUpdateTimer.Start();
}
#endregion
#region 公共方法
// 设置当前名称的方法,可以从外部调用
public void SetCurrentName(string name)
{
currentName = name;
LoadImageByName(name);
}
#endregion
#region 图像加载和处理
// 根据名称加载图片
private void LoadImageByName(string name)
{
if (string.IsNullOrEmpty(name))
return;
string imagesFolder = Path.Combine(Application.StartupPath, "images");
// 检查目录是否存在
if (!Directory.Exists(imagesFolder))
{
MessageBox.Show($"图片目录不存在: {imagesFolder}");
return;
}
// 获取目录中所有文件
string[] files = Directory.GetFiles(imagesFolder);
// 查找文件名以指定名称开头的文件
string imagePath = null;
foreach (string file in files)
{
string fileName = Path.GetFileNameWithoutExtension(file);
if (fileName.Equals(name, StringComparison.OrdinalIgnoreCase))
{
imagePath = file;
break;
}
}
if (!string.IsNullOrEmpty(imagePath))
{
try
{
// 停止闪烁定时器并重置状态
blinkTimer?.Stop();
isBlinking = false;
// 加载新图片
originalImage = new Bitmap(imagePath);
markedImage = new Bitmap(originalImage);
pictureBox.Image = markedImage;
}
catch (Exception ex)
{
MessageBox.Show($"加载图片失败:{ex.Message}");
}
}
else
{
MessageBox.Show($"未找到名称为 {name} 的图片");
}
}
// 在图像上绘制标记
private void DrawMark(int x, int y)
{
if (originalImage == null)
return;
markedImage = new Bitmap(originalImage);
using (Graphics g = Graphics.FromImage(markedImage))
{
if (isBlinking)
{
// 设置高质量绘图模式
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// 只绘制白色圆
using (Brush whiteBrush = new SolidBrush(Color.White))
{
g.FillEllipse(whiteBrush,
x - currentRadius,
y - currentRadius,
currentRadius * 2,
currentRadius * 2);
}
// 更新半径
if (isExpanding)
{
currentRadius += RADIUS_CHANGE_SPEED;
if (currentRadius >= MAX_RADIUS)
{
currentRadius = MAX_RADIUS;
isExpanding = false;
}
}
else
{
currentRadius -= RADIUS_CHANGE_SPEED;
if (currentRadius <= MIN_RADIUS)
{
currentRadius = MIN_RADIUS;
isExpanding = true;
}
}
}
}
pictureBox.Image = markedImage;
}
#endregion
#region 数据查询和更新
// 自动更新定时器事件
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)))
{
currentPosition = newPosition;
// 如果名称和位置都有值,则查询坐标并标注
if (!string.IsNullOrEmpty(currentName) && !string.IsNullOrEmpty(currentPosition))
{
QueryAndMarkPosition(currentName, currentPosition);
}
}
}
// 获取当前位置的方法(需要根据实际情况实现)
private string GetCurrentPosition()
{
// 生成1-10的随机数
Random random = new Random();
int position = random.Next(1, 11); // 1到10之间的随机数
return position.ToString();
}
// 根据名称和位置查询坐标并标注
private void QueryAndMarkPosition(string name, string position)
{
try
{
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
var positions = sQLiteHelper_position.Query(x => x.name == name
&& x.position == position).Data;
if (positions != null && positions.Count > 0)
{
var pos = positions[0];
// 标记位置
if (originalImage != null)
{
isBlinking = true; // 设置为 true 后不再切换
currentRadius = MIN_RADIUS; // 重置半径
blinkTimer.Start();
DrawMark(pos.x, pos.y);
}
}
}
catch (Exception ex)
{
Console.WriteLine($"查询坐标失败:{ex.Message}");
}
}
#endregion
#region 事件处理
// 闪烁定时器事件
private void BlinkTimer_Tick(object sender, EventArgs e)
{
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
var positions = sQLiteHelper_position.Query(x => x.name == currentName
&& x.position == currentPosition).Data;
if (positions != null && positions.Count > 0)
{
var pos = positions[0];
DrawMark(pos.x, pos.y);
}
}
// 移除了 BtnLoadImage_Click 事件处理程序
#endregion
#region 资源释放
protected override void Dispose(bool disposing)
{
if (disposing)
{
blinkTimer?.Stop();
blinkTimer?.Dispose();
autoUpdateTimer?.Stop();
autoUpdateTimer?.Dispose();
originalImage?.Dispose();
markedImage?.Dispose();
components?.Dispose();
}
base.Dispose(disposing);
}
#endregion
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.blinkTimer = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
// pictureBox
//
this.pictureBox.BackColor = System.Drawing.Color.LightGray;
this.pictureBox.Cursor = System.Windows.Forms.Cursors.Cross;
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 0);
this.pictureBox.Margin = new System.Windows.Forms.Padding(6);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(1600, 1250);
this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false;
//
// blinkTimer
//
this.blinkTimer.Interval = 50; // 修改为50毫秒
this.blinkTimer.Tick += new System.EventHandler(this.BlinkTimer_Tick);
//
// ImageDisplayForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1600, 1250);
this.Controls.Add(this.pictureBox);
this.Margin = new System.Windows.Forms.Padding(6);
this.Name = "ImageDisplayForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "螺丝引导";
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
}
}
+123
View File
@@ -0,0 +1,123 @@
<?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="blinkTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
+55 -9
View File
@@ -38,12 +38,15 @@
this.新增 = new System.Windows.Forms.Button();
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.linename = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.linetype = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.linemode = new System.Windows.Forms.DataGridViewTextBoxColumn();
//this.linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
//this.linetype = new System.Windows.Forms.DataGridViewTextBoxColumn();
//this.linemode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineremark1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineremark2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineremark3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineremark4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineremark5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineremark6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.flowname = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
@@ -97,12 +100,15 @@
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.id,
this.linename,
this.linecode,
this.linetype,
this.linemode,
//this.linecode,
//this.linetype,
//this.linemode,
this.lineremark1,
this.lineremark2,
this.lineremark3,
this.lineremark4,
this.lineremark5,
this.lineremark6,
this.flowname,
this.plcname});
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
@@ -174,6 +180,8 @@
this.linename.MinimumWidth = 9;
this.linename.Name = "linename";
this.linename.ReadOnly = true;
#region 不显示
/*
//
// linecode
//
@@ -201,12 +209,14 @@
this.linemode.MinimumWidth = 9;
this.linemode.Name = "linemode";
this.linemode.ReadOnly = true;
*/
#endregion 不显示
//
// lineremark1
//
this.lineremark1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.lineremark1.DataPropertyName = "lineremark1";
this.lineremark1.HeaderText = "备用显示1";
this.lineremark1.HeaderText = "Line";
this.lineremark1.MinimumWidth = 9;
this.lineremark1.Name = "lineremark1";
this.lineremark1.ReadOnly = true;
@@ -217,7 +227,7 @@
//
this.lineremark2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.lineremark2.DataPropertyName = "lineremark2";
this.lineremark2.HeaderText = "备用显示2";
this.lineremark2.HeaderText = "StationID";
this.lineremark2.MinimumWidth = 9;
this.lineremark2.Name = "lineremark2";
this.lineremark2.ReadOnly = true;
@@ -228,13 +238,46 @@
//
this.lineremark3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.lineremark3.DataPropertyName = "lineremark3";
this.lineremark3.HeaderText = "备用显示3";
this.lineremark3.HeaderText = "MachineID";
this.lineremark3.MinimumWidth = 9;
this.lineremark3.Name = "lineremark3";
this.lineremark3.ReadOnly = true;
this.lineremark3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.lineremark3.ToolTipText = "lineremark3";
//
// lineremark4
//
this.lineremark4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.lineremark4.DataPropertyName = "lineremark4";
this.lineremark4.HeaderText = "Token";
this.lineremark4.MinimumWidth = 9;
this.lineremark4.Name = "lineremark4";
this.lineremark4.ReadOnly = true;
this.lineremark4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.lineremark4.ToolTipText = "lineremark4";
//
// lineremark5
//
this.lineremark5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.lineremark5.DataPropertyName = "lineremark5";
this.lineremark5.HeaderText = "FixSn";
this.lineremark5.MinimumWidth = 9;
this.lineremark5.Name = "lineremark5";
this.lineremark5.ReadOnly = true;
this.lineremark5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.lineremark5.ToolTipText = "lineremark5";
//
// lineremark6
//
this.lineremark6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.lineremark6.DataPropertyName = "lineremark6";
this.lineremark6.HeaderText = "Mold";
this.lineremark6.MinimumWidth = 9;
this.lineremark6.Name = "lineremark6";
this.lineremark6.ReadOnly = true;
this.lineremark6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.lineremark6.ToolTipText = "lineremark6";
//
// flowname
//
this.flowname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
@@ -292,6 +335,9 @@
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark1;
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark2;
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark3;
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark4;
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark5;
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark6;
private System.Windows.Forms.DataGridViewTextBoxColumn flowname;
private System.Windows.Forms.DataGridViewTextBoxColumn plcname;
}
+6 -3
View File
@@ -93,14 +93,17 @@ namespace WindowsFormsApp1.form
id = line.id,
flowid = line.flowid,
linename = line.linename,
linecode = line.linecode,
linetype = line.linetype,
linemode = line.linemode,
//linecode = line.linecode,
//linetype = line.linetype,
//linemode = line.linemode,
flowname = flowname.flowname,
plcname = plcname.plcname,
lineremark1 = line.lineremark1,
lineremark2 = line.lineremark2,
lineremark3 = line.lineremark3,
lineremark4 = line.lineremark4,
lineremark5 = line.lineremark5,
lineremark6 = line.lineremark6,
});
}
+72
View File
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp1.db;
using WindowsFormsApp1.mod;
namespace WindowsFormsApp1
{
public partial class LoadingForm : Form
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// LoadingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(300, 100);
this.Name = "LoadingForm";
this.Text = "LoadingForm";
this.ResumeLayout(false);
}
public LoadingForm(string message = "正在处理中...")
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.None;
this.Size = new Size(300, 100);
this.BackColor = Color.White;
this.TopMost = true; // 设置窗体始终显示在最顶层
this.ShowInTaskbar = false; // 不在任务栏显示
Label loadingLabel = new Label();
loadingLabel.Text = message;
loadingLabel.AutoSize = false;
loadingLabel.Size = new Size(280, 30);
loadingLabel.TextAlign = ContentAlignment.MiddleCenter;
loadingLabel.Location = new Point((this.Width - loadingLabel.Width) / 2,
(this.Height - loadingLabel.Height) / 2);
this.Controls.Add(loadingLabel);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ClassStyle |= 0x20000; // CS_DROPSHADOW
return cp;
}
}
}
}
+37 -33
View File
@@ -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";
+28 -5
View File
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp1.db;
using WindowsFormsApp1.mod;
using WindowsFormsApp1.server;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace WindowsFormsApp1
@@ -30,19 +31,41 @@ namespace WindowsFormsApp1
}
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>();
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;
}
else
{
Init.t_User = result.Data;
SQLiteHelper<t_lineplc> sQLiteHelper_lineplc = new db.SQLiteHelper<t_lineplc>();
var lineplc_result = sQLiteHelper_lineplc.Query(a => a.lineid == result_combox.Data.id);
if (!lineplc_result.Success)
{
MessageBox.Show("无法初始化PLC-产线关联信息!");
return;
}
Init.t_Lineplcs = lineplc_result.Data;
Init.t_Line = result_combox.Data;
DialogResult = DialogResult.OK;
this.Close();
@@ -52,7 +75,7 @@ namespace WindowsFormsApp1
private void LoginForm_Load(object sender, EventArgs e)
{
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)
{
MessageBox.Show("查询失败");
+16
View File
@@ -81,11 +81,27 @@ namespace WindowsFormsApp1
LOt号.Text = ReturnValue;
LOt号.Visible = true;
}));
// 添加延时后自动确认
System.Threading.Thread.Sleep(500); // 显示扫码结果0.5秒
if (!string.IsNullOrWhiteSpace(ReturnValue))
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
else
{
LOt号.Text = ReturnValue;
LOt号.Visible = true;
// 添加延时后自动确认
System.Threading.Thread.Sleep(500); // 显示扫码结果0.5秒
if (!string.IsNullOrWhiteSpace(ReturnValue))
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}
catch (Exception ex)
+55 -55
View File
@@ -64,10 +64,10 @@ namespace WindowsFormsApp1
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
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(0, 0);
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.groupBox1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.groupBox1.Size = new System.Drawing.Size(1647, 704);
this.groupBox1.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.groupBox1.Size = new System.Drawing.Size(1797, 805);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "端子扫码";
@@ -103,7 +103,7 @@ namespace WindowsFormsApp1
this.tableLayoutPanel1.Controls.Add(this.端子2校验, 5, 3);
this.tableLayoutPanel1.Controls.Add(this.端子3校验, 5, 4);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37);
this.tableLayoutPanel1.Location = new System.Drawing.Point(7, 43);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 8;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
@@ -114,16 +114,16 @@ namespace WindowsFormsApp1
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1783, 756);
this.tableLayoutPanel1.TabIndex = 0;
//
// button3
//
this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(1390, 372);
this.button3.Location = new System.Drawing.Point(1516, 424);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(157, 106);
this.button3.Size = new System.Drawing.Size(172, 122);
this.button3.TabIndex = 14;
this.button3.Text = "清空条码";
this.button3.UseVisualStyleBackColor = true;
@@ -133,9 +133,9 @@ namespace WindowsFormsApp1
//
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(1390, 260);
this.button2.Location = new System.Drawing.Point(1516, 296);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(157, 106);
this.button2.Size = new System.Drawing.Size(172, 122);
this.button2.TabIndex = 13;
this.button2.Text = "清空条码";
this.button2.UseVisualStyleBackColor = true;
@@ -145,9 +145,9 @@ namespace WindowsFormsApp1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(1390, 148);
this.button1.Location = new System.Drawing.Point(1516, 168);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(157, 106);
this.button1.Size = new System.Drawing.Size(172, 122);
this.button1.TabIndex = 12;
this.button1.Text = "清空条码";
this.button1.UseVisualStyleBackColor = true;
@@ -157,9 +157,9 @@ namespace WindowsFormsApp1
//
this.确认.Dock = System.Windows.Forms.DockStyle.Fill;
this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.确认.Location = new System.Drawing.Point(84, 517);
this.确认.Location = new System.Drawing.Point(92, 589);
this.确认.Name = "确认";
this.确认.Size = new System.Drawing.Size(321, 106);
this.确认.Size = new System.Drawing.Size(350, 122);
this.确认.TabIndex = 2;
this.确认.Text = "确认";
this.确认.UseVisualStyleBackColor = true;
@@ -170,9 +170,9 @@ namespace WindowsFormsApp1
this.tableLayoutPanel1.SetColumnSpan(this.取消, 2);
this.取消.Dock = System.Windows.Forms.DockStyle.Fill;
this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.取消.Location = new System.Drawing.Point(1227, 517);
this.取消.Location = new System.Drawing.Point(1338, 589);
this.取消.Name = "取消";
this.取消.Size = new System.Drawing.Size(320, 106);
this.取消.Size = new System.Drawing.Size(350, 122);
this.取消.TabIndex = 3;
this.取消.Text = "取消";
this.取消.UseVisualStyleBackColor = true;
@@ -182,10 +182,10 @@ namespace WindowsFormsApp1
//
this.端子2结果.Anchor = System.Windows.Forms.AnchorStyles.None;
this.端子2结果.AutoSize = true;
this.端子2结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子2结果.Location = new System.Drawing.Point(1274, 292);
this.端子2结果.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
this.端子2结果.Location = new System.Drawing.Point(1395, 338);
this.端子2结果.Name = "端子2结果";
this.端子2结果.Size = new System.Drawing.Size(62, 42);
this.端子2结果.Size = new System.Drawing.Size(57, 38);
this.端子2结果.TabIndex = 7;
this.端子2结果.Text = "NG";
//
@@ -193,12 +193,12 @@ namespace WindowsFormsApp1
//
this.端子3结果.Anchor = System.Windows.Forms.AnchorStyles.None;
this.端子3结果.AutoSize = true;
this.端子3结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子3结果.Location = new System.Drawing.Point(1274, 404);
this.端子3结果.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
this.端子3结果.Location = new System.Drawing.Point(1395, 466);
this.端子3结果.Name = "端子3结果";
this.端子3结果.Size = new System.Drawing.Size(62, 42);
this.端子3结果.Size = new System.Drawing.Size(57, 38);
this.端子3结果.TabIndex = 8;
this.端子3结果.Text = "OK";
this.端子3结果.Text = "NG";
//
// 端子1
//
@@ -206,9 +206,9 @@ namespace WindowsFormsApp1
this.端子1.AutoSize = true;
this.tableLayoutPanel1.SetColumnSpan(this.端子1, 2);
this.端子1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子1.Location = new System.Drawing.Point(645, 180);
this.端子1.Location = new System.Drawing.Point(698, 205);
this.端子1.Name = "端子1";
this.端子1.Size = new System.Drawing.Size(260, 42);
this.端子1.Size = new System.Drawing.Size(295, 48);
this.端子1.TabIndex = 1;
this.端子1.Text = "12112312312";
//
@@ -218,9 +218,9 @@ namespace WindowsFormsApp1
this.端子2.AutoSize = true;
this.tableLayoutPanel1.SetColumnSpan(this.端子2, 2);
this.端子2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子2.Location = new System.Drawing.Point(645, 292);
this.端子2.Location = new System.Drawing.Point(698, 333);
this.端子2.Name = "端子2";
this.端子2.Size = new System.Drawing.Size(260, 42);
this.端子2.Size = new System.Drawing.Size(295, 48);
this.端子2.TabIndex = 6;
this.端子2.Text = "12112312312";
//
@@ -230,9 +230,9 @@ namespace WindowsFormsApp1
this.端子3.AutoSize = true;
this.tableLayoutPanel1.SetColumnSpan(this.端子3, 2);
this.端子3.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子3.Location = new System.Drawing.Point(645, 404);
this.端子3.Location = new System.Drawing.Point(698, 461);
this.端子3.Name = "端子3";
this.端子3.Size = new System.Drawing.Size(260, 42);
this.端子3.Size = new System.Drawing.Size(295, 48);
this.端子3.TabIndex = 5;
this.端子3.Text = "12112312312";
//
@@ -240,12 +240,12 @@ namespace WindowsFormsApp1
//
this.端子1结果.Anchor = System.Windows.Forms.AnchorStyles.None;
this.端子1结果.AutoSize = true;
this.端子1结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子1结果.Location = new System.Drawing.Point(1274, 180);
this.端子1结果.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
this.端子1结果.Location = new System.Drawing.Point(1395, 210);
this.端子1结果.Name = "端子1结果";
this.端子1结果.Size = new System.Drawing.Size(62, 42);
this.端子1结果.Size = new System.Drawing.Size(57, 38);
this.端子1结果.TabIndex = 4;
this.端子1结果.Text = "OK";
this.端子1结果.Text = "NG";
//
// 请扫描条码
//
@@ -254,9 +254,9 @@ namespace WindowsFormsApp1
this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3);
this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.请扫描条码.ForeColor = System.Drawing.Color.Red;
this.请扫描条码.Location = new System.Drawing.Point(508, 61);
this.请扫描条码.Location = new System.Drawing.Point(543, 69);
this.请扫描条码.Name = "请扫描条码";
this.请扫描条码.Size = new System.Drawing.Size(452, 56);
this.请扫描条码.Size = new System.Drawing.Size(515, 64);
this.请扫描条码.TabIndex = 0;
this.请扫描条码.Text = "请扫描端子条码:";
//
@@ -265,9 +265,9 @@ namespace WindowsFormsApp1
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(160, 180);
this.label6.Location = new System.Drawing.Point(171, 205);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(169, 42);
this.label6.Size = new System.Drawing.Size(192, 48);
this.label6.TabIndex = 9;
this.label6.Text = "端子1:";
//
@@ -276,9 +276,9 @@ namespace WindowsFormsApp1
this.label7.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(160, 292);
this.label7.Location = new System.Drawing.Point(171, 333);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(169, 42);
this.label7.Size = new System.Drawing.Size(192, 48);
this.label7.TabIndex = 10;
this.label7.Text = "端子2:";
//
@@ -287,9 +287,9 @@ namespace WindowsFormsApp1
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(160, 404);
this.label8.Location = new System.Drawing.Point(171, 461);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(169, 42);
this.label8.Size = new System.Drawing.Size(192, 48);
this.label8.TabIndex = 11;
this.label8.Text = "端子3:";
//
@@ -297,21 +297,21 @@ namespace WindowsFormsApp1
//
this.端子1校验.Anchor = System.Windows.Forms.AnchorStyles.None;
this.端子1校验.AutoSize = true;
this.端子1校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子1校验.Location = new System.Drawing.Point(1111, 180);
this.端子1校验.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
this.端子1校验.Location = new System.Drawing.Point(1217, 210);
this.端子1校验.Name = "端子1校验";
this.端子1校验.Size = new System.Drawing.Size(62, 42);
this.端子1校验.Size = new System.Drawing.Size(57, 38);
this.端子1校验.TabIndex = 15;
this.端子1校验.Text = "OK";
this.端子1校验.Text = "NG";
//
// 端子2校验
//
this.端子2校验.Anchor = System.Windows.Forms.AnchorStyles.None;
this.端子2校验.AutoSize = true;
this.端子2校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子2校验.Location = new System.Drawing.Point(1111, 292);
this.端子2校验.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
this.端子2校验.Location = new System.Drawing.Point(1217, 338);
this.端子2校验.Name = "端子2校验";
this.端子2校验.Size = new System.Drawing.Size(62, 42);
this.端子2校验.Size = new System.Drawing.Size(57, 38);
this.端子2校验.TabIndex = 16;
this.端子2校验.Text = "NG";
//
@@ -319,12 +319,12 @@ namespace WindowsFormsApp1
//
this.端子3校验.Anchor = System.Windows.Forms.AnchorStyles.None;
this.端子3校验.AutoSize = true;
this.端子3校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.端子3校验.Location = new System.Drawing.Point(1111, 404);
this.端子3校验.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
this.端子3校验.Location = new System.Drawing.Point(1217, 466);
this.端子3校验.Name = "端子3校验";
this.端子3校验.Size = new System.Drawing.Size(62, 42);
this.端子3校验.Size = new System.Drawing.Size(57, 38);
this.端子3校验.TabIndex = 17;
this.端子3校验.Text = "OK";
this.端子3校验.Text = "NG";
//
// timer1
//
@@ -334,16 +334,16 @@ namespace WindowsFormsApp1
//
// ScanForm_DZ
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1647, 704);
this.ClientSize = new System.Drawing.Size(1797, 805);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "ScanForm_DZ";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "扫码界面";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScanForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ScanForm_DZ_FormClosed);
this.groupBox1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
+85 -19
View File
@@ -14,6 +14,7 @@ using WindowsFormsApp1.mod;
using WindowsFormsApp1.mod.database;
using WindowsFormsApp1.mod.server;
using WindowsFormsApp1.server;
using static SQLite.SQLite3;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace WindowsFormsApp1
@@ -24,7 +25,7 @@ namespace WindowsFormsApp1
public ScanForm_DZ()
{
InitializeComponent();
Init.ScanPort.DataReceived += SerialPort_DataReceived;
Init.ScanPort.DataReceived += SerialPort_DataReceived_DZ;
端子1.Text = "";
端子2.Text = "";
端子3.Text = "";
@@ -33,6 +34,18 @@ namespace WindowsFormsApp1
private void button1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
//Init.ScanPort.DataReceived -= SerialPort_DataReceived_DZ;
//if (string.IsNullOrEmpty(端子1.Text)
// || string.IsNullOrEmpty(端子2.Text)
// || string.IsNullOrEmpty(端子3.Text))
//{
// //MessageBox.Show($"有端子未扫描!");
// //return;
//}
//else
//{
// this.Close();
//}
this.Close();
}
@@ -54,10 +67,11 @@ namespace WindowsFormsApp1
}
}
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
public void SerialPort_DataReceived_DZ(object sender, SerialDataReceivedEventArgs e)
{
try
{
var PlcData = new plcdata();
if (!Init.ScanPort.IsOpen)
{
Init.ScanPort?.Open();
@@ -75,29 +89,37 @@ namespace WindowsFormsApp1
return;
}
SQLiteHelper<t_keyvalue> sQLiteHelper_key = new db.SQLiteHelper<t_keyvalue>();
var key_sqlresult = sQLiteHelper_key.QueryAll();
if (string.IsNullOrWhiteSpace(端子1.Text))
{
this.Invoke(new Action(() =>
{
端子1.Text = barcode;
}));
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
if (result.Success)
var result = ApiClient.CallFunctionByName("SN_FeedingCheck", PlcData, new otherdata() { JS_SN = barcode });
if (result.Success && result.Mesresult == mesresult.PASS)
{
this.Invoke(new Action(() =>
{
端子1校验.Text = "校验OK";
}));
//继续调用接口
var result2 = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
if (result2.Success)
var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
if (result2.Success && result2.Mesresult == mesresult.PASS)
{
this.Invoke(new Action(() =>
{
端子1结果.Text = "绑定OK";
button1.Visible = false;
}));
// 写数据到 主页的barcode 数据库改,缓存改
var txt = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode1");
txt.value = 端子1.Text;
var code = key_sqlresult.Data.First(x => x.key == txt.key);
code.value = 端子1.Text;
sQLiteHelper_key.Update(code);
}
else
{
@@ -121,8 +143,8 @@ namespace WindowsFormsApp1
{
端子2.Text = barcode;
}));
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
if (result.Success)
var result = ApiClient.CallFunctionByName("SN_FeedingCheck", PlcData, new otherdata() { JS_SN = barcode });
if (result.Success && result.Mesresult == mesresult.PASS)
{
this.Invoke(new Action(() =>
{
@@ -130,10 +152,30 @@ namespace WindowsFormsApp1
}));
//继续调用接口
this.Invoke(new Action(() =>
var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
if (result2.Success && result2.Mesresult == mesresult.PASS)
{
button2.Visible = false;
}));
this.Invoke(new Action(() =>
{
端子2结果.Text = "绑定OK";
button2.Visible = false;
}));
// 写数据到 主页的barcode 数据库改,缓存改
var txt = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode2");
txt.value = 端子2.Text;
var code = key_sqlresult.Data.First(x => x.key == txt.key);
code.value = 端子2.Text;
sQLiteHelper_key.Update(code);
}
else
{
this.Invoke(new Action(() =>
{
端子2结果.Text = "绑定NG";
}));
}
}
else
{
@@ -149,19 +191,38 @@ namespace WindowsFormsApp1
{
端子3.Text = barcode;
}));
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
if (result.Success)
var result = ApiClient.CallFunctionByName("SN_FeedingCheck", PlcData, new otherdata() { JS_SN = barcode });
if (result.Success && result.Mesresult == mesresult.PASS)
{
this.Invoke(new Action(() =>
{
端子3校验.Text = "校验OK";
}));
//继续调用接口
this.Invoke(new Action(() =>
var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
if (result2.Success && result2.Mesresult == mesresult.PASS)
{
button3.Visible = false;
}));
this.Invoke(new Action(() =>
{
端子3结果.Text = "绑定OK";
button3.Visible = false;
}));
// 写数据到 主页的barcode 数据库改,缓存改
var txt = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode3");
txt.value = 端子3.Text;
var code = key_sqlresult.Data.First(x => x.key == txt.key);
code.value = 端子3.Text;
sQLiteHelper_key.Update(code);
}
else
{
this.Invoke(new Action(() =>
{
端子3结果.Text = "绑定NG";
}));
}
}
else
{
@@ -169,7 +230,7 @@ namespace WindowsFormsApp1
{
端子3校验.Text = "校验NG";
}));
}
}
@@ -209,5 +270,10 @@ namespace WindowsFormsApp1
{
端子3.Text = "";
}
private void ScanForm_DZ_FormClosed(object sender, FormClosedEventArgs e)
{
FormHelp.RemoveAllEventHandlers(Init.ScanPort, "DataReceived");
}
}
}
+21 -20
View File
@@ -48,10 +48,10 @@
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
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(0, 0);
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.groupBox1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5);
this.groupBox1.Size = new System.Drawing.Size(1647, 704);
this.groupBox1.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.groupBox1.Size = new System.Drawing.Size(1797, 805);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "物料扫码";
@@ -71,7 +71,7 @@
this.tableLayoutPanel1.Controls.Add(this.确认, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.取消, 3, 6);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37);
this.tableLayoutPanel1.Location = new System.Drawing.Point(7, 43);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 8;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.588645F));
@@ -82,16 +82,16 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.50806F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.19009F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1783, 756);
this.tableLayoutPanel1.TabIndex = 0;
//
// button1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(184, 304);
this.button1.Location = new System.Drawing.Point(201, 347);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(539, 85);
this.button1.Size = new System.Drawing.Size(588, 98);
this.button1.TabIndex = 4;
this.button1.Text = "位置1";
this.button1.UseVisualStyleBackColor = true;
@@ -101,9 +101,9 @@
//
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
this.button2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(910, 304);
this.button2.Location = new System.Drawing.Point(993, 347);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(539, 85);
this.button2.Size = new System.Drawing.Size(588, 98);
this.button2.TabIndex = 5;
this.button2.Text = "位置2";
this.button2.UseVisualStyleBackColor = true;
@@ -116,9 +116,9 @@
this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3);
this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.请扫描条码.ForeColor = System.Drawing.Color.Red;
this.请扫描条码.Location = new System.Drawing.Point(647, 47);
this.请扫描条码.Location = new System.Drawing.Point(698, 54);
this.请扫描条码.Name = "请扫描条码";
this.请扫描条码.Size = new System.Drawing.Size(338, 56);
this.请扫描条码.Size = new System.Drawing.Size(385, 64);
this.请扫描条码.TabIndex = 0;
this.请扫描条码.Text = "请扫描条码:";
//
@@ -128,9 +128,9 @@
this.LOt号.AutoSize = true;
this.tableLayoutPanel1.SetColumnSpan(this.LOt号, 3);
this.LOt号.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.LOt号.Location = new System.Drawing.Point(544, 153);
this.LOt号.Location = new System.Drawing.Point(581, 175);
this.LOt号.Name = "LOt号";
this.LOt号.Size = new System.Drawing.Size(544, 56);
this.LOt号.Size = new System.Drawing.Size(619, 64);
this.LOt号.TabIndex = 1;
this.LOt号.Text = "LOt号:12112312312";
//
@@ -138,9 +138,9 @@
//
this.确认.Dock = System.Windows.Forms.DockStyle.Fill;
this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.确认.Location = new System.Drawing.Point(184, 457);
this.确认.Location = new System.Drawing.Point(201, 522);
this.确认.Name = "确认";
this.确认.Size = new System.Drawing.Size(539, 85);
this.确认.Size = new System.Drawing.Size(588, 98);
this.确认.TabIndex = 2;
this.确认.Text = "上线";
this.确认.UseVisualStyleBackColor = true;
@@ -150,9 +150,9 @@
//
this.取消.Dock = System.Windows.Forms.DockStyle.Fill;
this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.取消.Location = new System.Drawing.Point(910, 457);
this.取消.Location = new System.Drawing.Point(993, 522);
this.取消.Name = "取消";
this.取消.Size = new System.Drawing.Size(539, 85);
this.取消.Size = new System.Drawing.Size(588, 98);
this.取消.TabIndex = 3;
this.取消.Text = "下线";
this.取消.UseVisualStyleBackColor = true;
@@ -166,15 +166,16 @@
//
// ScanForm_SSQ
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1647, 704);
this.ClientSize = new System.Drawing.Size(1797, 805);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "ScanForm_SSQ";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "扫码界面";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ScanForm_SSQ_FormClosed);
this.groupBox1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
+45 -6
View File
@@ -12,6 +12,7 @@ using System.Windows.Forms;
using WindowsFormsApp1.db;
using WindowsFormsApp1.mod;
using WindowsFormsApp1.mod.database;
using WindowsFormsApp1.mod.server;
using WindowsFormsApp1.server;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
@@ -25,12 +26,12 @@ namespace WindowsFormsApp1
/// </summary>
int index = 0;
public string ReturnValue { get; set; }
public ApiClient ApiClient = new ApiClient();
public ScanForm_SSQ()
{
InitializeComponent();
//Init.ScanPort.DataReceived += SerialPort_DataReceived;
Init.ScanPort.DataReceived += SerialPort_DataReceived_SSQ;
LOt号.Visible = false;
}
private void button1_Click(object sender, EventArgs e)
{
@@ -39,9 +40,25 @@ namespace WindowsFormsApp1
MessageBox.Show("扫码为空,请确认!");
return;
}
//LogExecute.logNet.WriteDebug($"{ReturnValue}上线点击");
//this.Close();
//请求后端接口,index代表位置
//更新下数据库和init里面的keyvalue值
var PlcData = new plcdata();
var OtherData = new otherdata();
OtherData.locationindex = index;
OtherData.opindex = 1;
OtherData.JS_SN = ReturnValue;
var result = ApiClient.CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
if (result.Success && result.Mesresult == mesresult.PASS)
{
this.Close();
}
else
{
//失败逻辑
}
//更新下数据库和init里面的keyvalue值,缓存
}
private void button2_Click(object sender, EventArgs e)
@@ -51,8 +68,25 @@ namespace WindowsFormsApp1
MessageBox.Show("扫码为空,请确认!");
return;
}
LogExecute.logNet.WriteDebug($"{ReturnValue}下线点击");
this.Close();
//请求后端接口,index代表位置
//更新下数据库和init里面的keyvalue值
var PlcData = new plcdata();
var OtherData = new otherdata();
OtherData.locationindex = index;
OtherData.opindex = 1;
OtherData.JS_SN = ReturnValue;
var result = ApiClient.CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
if (result.Success)
{
this.Close();
}
else
{
//失败逻辑
}
//更新下数据库和init里面的keyvalue值,删除缓存
}
private void timer1_Tick(object sender, EventArgs e)
@@ -67,7 +101,7 @@ namespace WindowsFormsApp1
}
}
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
public void SerialPort_DataReceived_SSQ(object sender, SerialDataReceivedEventArgs e)
{
try
{
@@ -135,5 +169,10 @@ namespace WindowsFormsApp1
button1.BackColor = SystemColors.Control;
}
}
private void ScanForm_SSQ_FormClosed(object sender, FormClosedEventArgs e)
{
FormHelp.RemoveAllEventHandlers(Init.ScanPort, "DataReceived");
}
}
}
@@ -0,0 +1,475 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.IO;
using WindowsFormsApp1.mod;
using WindowsFormsApp1.db;
namespace WindowsFormsApp1
{
public partial class SimpleImageDisplayForm : Form
{
#region 控件字段
protected PictureBox pictureBox;
protected Button btnLoadImage;
protected TextBox txtX;
protected TextBox txtY;
protected TextBox txtName;
protected TextBox txtPosition;
protected Button btnSave;
protected Panel panel;
protected Label lblX;
protected Label lblY;
protected Label lblName;
protected Label lblPosition;
#endregion
#region 私有字段
private IContainer components = null;
private Bitmap originalImage;
private Bitmap markedImage;
private Timer blinkTimer;
private bool isBlinking = false;
// 圆形标记相关参数
private float currentRadius = 20f;
private const float MIN_RADIUS = 20f;
private const float MAX_RADIUS = 50f;
private bool isExpanding = true;
private const float RADIUS_CHANGE_SPEED = 2f;
#endregion
#region 构造函数和初始化
public SimpleImageDisplayForm()
{
InitializeComponent();
}
#endregion
#region 图像加载和处理
// 在图像上绘制标记
private void DrawMark(int x, int y)
{
if (originalImage == null)
return;
markedImage = new Bitmap(originalImage);
using (Graphics g = Graphics.FromImage(markedImage))
{
if (isBlinking)
{
// 设置高质量绘图模式
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// 只绘制白色圆
using (Brush whiteBrush = new SolidBrush(Color.White))
{
g.FillEllipse(whiteBrush,
x - currentRadius,
y - currentRadius,
currentRadius * 2,
currentRadius * 2);
}
// 更新半径
if (isExpanding)
{
currentRadius += RADIUS_CHANGE_SPEED;
if (currentRadius >= MAX_RADIUS)
{
currentRadius = MAX_RADIUS;
isExpanding = false;
}
}
else
{
currentRadius -= RADIUS_CHANGE_SPEED;
if (currentRadius <= MIN_RADIUS)
{
currentRadius = MIN_RADIUS;
isExpanding = true;
}
}
}
}
pictureBox.Image = markedImage;
}
#endregion
#region 事件处理
// 闪烁定时器事件
private void BlinkTimer_Tick(object sender, EventArgs e)
{
if (!int.TryParse(txtX.Text, out int x) || !int.TryParse(txtY.Text, out int y))
return;
DrawMark(x, y);
}
// 图片点击事件
private void PictureBox_Click(object sender, EventArgs e)
{
if (originalImage == null || !(e is MouseEventArgs me))
return;
// 获取图片在 PictureBox 中的实际显示尺寸和位置
float ratioX = (float)originalImage.Width / pictureBox.ClientSize.Width;
float ratioY = (float)originalImage.Height / pictureBox.ClientSize.Height;
float ratio = Math.Max(ratioX, ratioY);
float imageWidth = originalImage.Width / ratio;
float imageHeight = originalImage.Height / ratio;
// 计算图片在 PictureBox 中的显示位置
float imageX = (pictureBox.ClientSize.Width - imageWidth) / 2;
float imageY = (pictureBox.ClientSize.Height - imageHeight) / 2;
// 将点击坐标转换为图片实际坐标
int x = (int)((me.X - imageX) * ratio);
int y = (int)((me.Y - imageY) * ratio);
// 确保坐标在图片范围内
if (x >= 0 && x < originalImage.Width && y >= 0 && y < originalImage.Height)
{
txtX.Text = x.ToString();
txtY.Text = y.ToString();
MarkPosition(); // 自动标记位置
}
}
// 标记位置
private void MarkPosition()
{
if (markedImage == null || !int.TryParse(txtX.Text, out int x) || !int.TryParse(txtY.Text, out int y))
{
MessageBox.Show("请先加载图片并输入有效的坐标值");
return;
}
DrawMark(x, y);
isBlinking = true;
blinkTimer.Start();
}
// 加载图片按钮事件
private void BtnLoadImage_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "图片文件|*.jpg;*.jpeg;*.png;*.bmp|所有文件|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
// 停止闪烁定时器并重置状态
blinkTimer?.Stop();
isBlinking = false;
originalImage = new Bitmap(openFileDialog.FileName);
markedImage = new Bitmap(originalImage);
pictureBox.Image = markedImage;
}
}
}
// 保存按钮事件
private void BtnSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(txtName.Text) ||
string.IsNullOrWhiteSpace(txtPosition.Text) ||
string.IsNullOrWhiteSpace(txtX.Text) ||
string.IsNullOrWhiteSpace(txtY.Text))
{
MessageBox.Show("请填写完整信息");
return;
}
// 添加坐标值验证
if (!int.TryParse(txtX.Text, out int x) || !int.TryParse(txtY.Text, out int y))
{
MessageBox.Show("坐标值必须是有效的数字");
return;
}
// 检查图片是否已加载
if (originalImage == null)
{
MessageBox.Show("请先加载图片");
return;
}
// 检查坐标是否在图片范围内
if (x < 0 || y < 0 || x >= originalImage.Width || y >= originalImage.Height)
{
MessageBox.Show($"坐标值超出范围!\n有效范围:X(0-{originalImage.Width-1}) Y(0-{originalImage.Height-1})");
return;
}
try
{
// 保存数据到数据库
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
// 检查是否存在相同名称和位置的记录
var existingPositions = sQLiteHelper_position.Query(a =>
a.name == txtName.Text &&
a.position == txtPosition.Text).Data;
t_imageposition position = new t_imageposition
{
name = txtName.Text,
position = txtPosition.Text,
x = int.Parse(txtX.Text),
y = int.Parse(txtY.Text),
createtime = DateTime.Now
};
bool success = false;
if (existingPositions != null && existingPositions.Count > 0)
{
// 更新现有记录
position.id = existingPositions[0].id;
var result = sQLiteHelper_position.Update(position);
success = result.Success;
}
else
{
// 插入新记录
var result = sQLiteHelper_position.Insert(position);
success = result.Success;
}
// 保存图片到images文件夹
if (success)
{
SaveImageToFolder(txtName.Text);
// 只清空position的值
txtPosition.Text = "";
MessageBox.Show("保存成功!");
}
else
{
MessageBox.Show("保存失败");
}
}
catch (Exception ex)
{
MessageBox.Show($"保存失败:{ex.Message}");
}
}
// 保存图片到images文件夹
private void SaveImageToFolder(string name)
{
string imagesFolder = Path.Combine(Application.StartupPath, "images");
// 确保目录存在
if (!Directory.Exists(imagesFolder))
{
Directory.CreateDirectory(imagesFolder);
}
string imagePath = Path.Combine(imagesFolder, $"{name}.png");
// 检查文件是否已存在,如果存在则不覆盖
if (!File.Exists(imagePath))
{
originalImage.Save(imagePath, System.Drawing.Imaging.ImageFormat.Png);
}
}
#endregion
#region 资源释放
protected override void Dispose(bool disposing)
{
if (disposing)
{
blinkTimer?.Stop();
blinkTimer?.Dispose();
originalImage?.Dispose();
markedImage?.Dispose();
components?.Dispose();
}
base.Dispose(disposing);
}
#endregion
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.panel = new System.Windows.Forms.Panel();
this.btnLoadImage = new System.Windows.Forms.Button();
this.txtX = new System.Windows.Forms.TextBox();
this.txtY = new System.Windows.Forms.TextBox();
this.txtName = new System.Windows.Forms.TextBox();
this.txtPosition = new System.Windows.Forms.TextBox();
this.btnSave = new System.Windows.Forms.Button();
this.lblX = new System.Windows.Forms.Label();
this.lblY = new System.Windows.Forms.Label();
this.lblName = new System.Windows.Forms.Label();
this.lblPosition = new System.Windows.Forms.Label();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.blinkTimer = new System.Windows.Forms.Timer(this.components);
this.panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
// panel
//
this.panel.Controls.Add(this.btnLoadImage);
this.panel.Controls.Add(this.txtX);
this.panel.Controls.Add(this.txtY);
this.panel.Controls.Add(this.txtName);
this.panel.Controls.Add(this.txtPosition);
this.panel.Controls.Add(this.btnSave);
this.panel.Controls.Add(this.lblX);
this.panel.Controls.Add(this.lblY);
this.panel.Controls.Add(this.lblName);
this.panel.Controls.Add(this.lblPosition);
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
this.panel.Location = new System.Drawing.Point(0, 0);
this.panel.Margin = new System.Windows.Forms.Padding(6);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(1600, 120);
this.panel.TabIndex = 0;
//
// btnLoadImage
//
this.btnLoadImage.Location = new System.Drawing.Point(20, 20);
this.btnLoadImage.Margin = new System.Windows.Forms.Padding(6);
this.btnLoadImage.Name = "btnLoadImage";
this.btnLoadImage.Size = new System.Drawing.Size(200, 60);
this.btnLoadImage.TabIndex = 0;
this.btnLoadImage.Text = "加载图片";
this.btnLoadImage.UseVisualStyleBackColor = true;
this.btnLoadImage.Click += new System.EventHandler(this.BtnLoadImage_Click);
//
// txtX
//
this.txtX.Location = new System.Drawing.Point(240, 20);
this.txtX.Margin = new System.Windows.Forms.Padding(6);
this.txtX.Name = "txtX";
this.txtX.Size = new System.Drawing.Size(116, 35);
this.txtX.TabIndex = 1;
this.txtX.Text = "0";
//
// txtY
//
this.txtY.Location = new System.Drawing.Point(380, 20);
this.txtY.Margin = new System.Windows.Forms.Padding(6);
this.txtY.Name = "txtY";
this.txtY.Size = new System.Drawing.Size(116, 35);
this.txtY.TabIndex = 2;
this.txtY.Text = "0";
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(519, 20);
this.txtName.Margin = new System.Windows.Forms.Padding(6);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(196, 35);
this.txtName.TabIndex = 4;
//
// txtPosition
//
this.txtPosition.Location = new System.Drawing.Point(744, 20);
this.txtPosition.Margin = new System.Windows.Forms.Padding(6);
this.txtPosition.Name = "txtPosition";
this.txtPosition.Size = new System.Drawing.Size(196, 35);
this.txtPosition.TabIndex = 5;
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(964, 14);
this.btnSave.Margin = new System.Windows.Forms.Padding(6);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(200, 60);
this.btnSave.TabIndex = 6;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.BtnSave_Click);
//
// lblX
//
this.lblX.AutoSize = true;
this.lblX.ForeColor = System.Drawing.Color.Gray;
this.lblX.Location = new System.Drawing.Point(240, 80);
this.lblX.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.lblX.Name = "lblX";
this.lblX.Size = new System.Drawing.Size(70, 24);
this.lblX.TabIndex = 7;
this.lblX.Text = "X坐标";
//
// lblY
//
this.lblY.AutoSize = true;
this.lblY.ForeColor = System.Drawing.Color.Gray;
this.lblY.Location = new System.Drawing.Point(380, 80);
this.lblY.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.lblY.Name = "lblY";
this.lblY.Size = new System.Drawing.Size(70, 24);
this.lblY.TabIndex = 8;
this.lblY.Text = "Y坐标";
//
// lblName
//
this.lblName.AutoSize = true;
this.lblName.ForeColor = System.Drawing.Color.Gray;
this.lblName.Location = new System.Drawing.Point(515, 80);
this.lblName.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(130, 24);
this.lblName.TabIndex = 9;
this.lblName.Text = "请输入名称";
//
// lblPosition
//
this.lblPosition.AutoSize = true;
this.lblPosition.ForeColor = System.Drawing.Color.Gray;
this.lblPosition.Location = new System.Drawing.Point(740, 80);
this.lblPosition.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.lblPosition.Name = "lblPosition";
this.lblPosition.Size = new System.Drawing.Size(130, 24);
this.lblPosition.TabIndex = 10;
this.lblPosition.Text = "请输入位置";
//
// pictureBox
//
this.pictureBox.BackColor = System.Drawing.Color.LightGray;
this.pictureBox.Cursor = System.Windows.Forms.Cursors.Cross;
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 120);
this.pictureBox.Margin = new System.Windows.Forms.Padding(6);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(1600, 1080);
this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false;
this.pictureBox.Click += new System.EventHandler(this.PictureBox_Click);
//
// blinkTimer
//
this.blinkTimer.Interval = 50;
this.blinkTimer.Tick += new System.EventHandler(this.BlinkTimer_Tick);
//
// SimpleImageDisplayForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1600, 1200);
this.Controls.Add(this.pictureBox);
this.Controls.Add(this.panel);
this.Margin = new System.Windows.Forms.Padding(6);
this.Name = "SimpleImageDisplayForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "图片标注";
this.panel.ResumeLayout(false);
this.panel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,123 @@
<?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="blinkTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
+73 -60
View File
@@ -29,14 +29,14 @@
private void InitializeComponent()
{
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.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.SuspendLayout();
//
@@ -51,89 +51,102 @@
this.groupBox1.Controls.Add(this.textBox2);
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.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.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.TabStop = false;
this.groupBox1.Text = "修改密码";
//
// textBox1
// label3
//
this.textBox1.Location = new System.Drawing.Point(105, 45);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(201, 26);
this.textBox1.TabIndex = 0;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(34, 312);
this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 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.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(201, 26);
this.textBox2.TabIndex = 1;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(34, 208);
this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
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.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(201, 26);
this.textBox3.TabIndex = 2;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(34, 90);
this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(111, 33);
this.label1.TabIndex = 5;
this.label1.Text = "原密码";
//
// 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.Size = new System.Drawing.Size(100, 40);
this.button1.Size = new System.Drawing.Size(200, 80);
this.button1.TabIndex = 3;
this.button1.Text = "修改密码";
this.button1.UseVisualStyleBackColor = true;
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
//
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.Size = new System.Drawing.Size(100, 40);
this.button2.Size = new System.Drawing.Size(200, 80);
this.button2.TabIndex = 4;
this.button2.Text = "关闭";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label1
// UserChangeP
//
this.label1.AutoSize = true;
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.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
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.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.Text = "USER_ChangeP";
this.groupBox1.ResumeLayout(false);
@@ -148,10 +161,10 @@
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox2;
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.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp1.db;
using WindowsFormsApp1.mod;
namespace WindowsFormsApp1.form
{
@@ -24,7 +26,34 @@ namespace WindowsFormsApp1.form
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();
}
}
}
+66 -66
View File
@@ -116,7 +116,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1087, 854);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1186, 976);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
@@ -124,9 +124,9 @@
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(154, 113);
this.label1.Location = new System.Drawing.Point(165, 129);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(124, 28);
this.label1.Size = new System.Drawing.Size(143, 33);
this.label1.TabIndex = 0;
this.label1.Text = "流程名称";
//
@@ -135,9 +135,9 @@
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(616, 113);
this.label8.Location = new System.Drawing.Point(671, 129);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(68, 28);
this.label8.Size = new System.Drawing.Size(79, 33);
this.label8.TabIndex = 7;
this.label8.Text = "扫码";
//
@@ -146,20 +146,20 @@
this.label9.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(588, 198);
this.label9.Location = new System.Drawing.Point(639, 226);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(124, 28);
this.label9.Size = new System.Drawing.Size(143, 33);
this.label9.TabIndex = 8;
this.label9.Text = "文件上传";
this.label9.Text = "端子扫码";
//
// label10
//
this.label10.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.Location = new System.Drawing.Point(588, 283);
this.label10.Location = new System.Drawing.Point(639, 323);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(124, 28);
this.label10.Size = new System.Drawing.Size(143, 33);
this.label10.TabIndex = 9;
this.label10.Text = "螺丝扭力";
//
@@ -168,9 +168,9 @@
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.button1, 2);
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(228, 683);
this.button1.Location = new System.Drawing.Point(249, 779);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(194, 79);
this.button1.Size = new System.Drawing.Size(212, 90);
this.button1.TabIndex = 14;
this.button1.Text = "保存";
this.button1.UseVisualStyleBackColor = true;
@@ -181,9 +181,9 @@
this.button2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.button2, 2);
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(664, 683);
this.button2.Location = new System.Drawing.Point(725, 779);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(190, 79);
this.button2.Size = new System.Drawing.Size(207, 90);
this.button2.TabIndex = 15;
this.button2.Text = "取消";
this.button2.UseVisualStyleBackColor = true;
@@ -194,9 +194,9 @@
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(856, 542);
this.压力曲线.Location = new System.Drawing.Point(933, 617);
this.压力曲线.Name = "压力曲线";
this.压力曲线.Size = new System.Drawing.Size(22, 21);
this.压力曲线.Size = new System.Drawing.Size(28, 27);
this.压力曲线.TabIndex = 23;
this.压力曲线.UseVisualStyleBackColor = true;
//
@@ -205,9 +205,9 @@
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(856, 287);
this.螺丝扭力.Location = new System.Drawing.Point(933, 326);
this.螺丝扭力.Name = "螺丝扭力";
this.螺丝扭力.Size = new System.Drawing.Size(22, 21);
this.螺丝扭力.Size = new System.Drawing.Size(28, 27);
this.螺丝扭力.TabIndex = 26;
this.螺丝扭力.UseVisualStyleBackColor = true;
//
@@ -216,9 +216,9 @@
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(856, 202);
this.文件上传.Location = new System.Drawing.Point(933, 229);
this.文件上传.Name = "文件上传";
this.文件上传.Size = new System.Drawing.Size(22, 21);
this.文件上传.Size = new System.Drawing.Size(28, 27);
this.文件上传.TabIndex = 27;
this.文件上传.UseVisualStyleBackColor = true;
//
@@ -226,9 +226,9 @@
//
this.流程名称.Anchor = System.Windows.Forms.AnchorStyles.None;
this.流程名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.流程名称.Location = new System.Drawing.Point(328, 108);
this.流程名称.Location = new System.Drawing.Point(358, 123);
this.流程名称.Name = "流程名称";
this.流程名称.Size = new System.Drawing.Size(211, 39);
this.流程名称.Size = new System.Drawing.Size(230, 44);
this.流程名称.TabIndex = 16;
//
// 气密参数
@@ -236,9 +236,9 @@
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(856, 627);
this.气密参数.Location = new System.Drawing.Point(933, 714);
this.气密参数.Name = "气密参数";
this.气密参数.Size = new System.Drawing.Size(22, 21);
this.气密参数.Size = new System.Drawing.Size(28, 27);
this.气密参数.TabIndex = 22;
this.气密参数.UseVisualStyleBackColor = true;
//
@@ -247,9 +247,9 @@
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(126, 623);
this.label6.Location = new System.Drawing.Point(133, 711);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(180, 28);
this.label6.Size = new System.Drawing.Size(207, 33);
this.label6.TabIndex = 5;
this.label6.Text = "错误调用接口";
//
@@ -258,9 +258,9 @@
this.label5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(147, 538);
this.label5.Location = new System.Drawing.Point(157, 614);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(138, 28);
this.label5.Size = new System.Drawing.Size(159, 33);
this.label5.TabIndex = 4;
this.label5.Text = "错误PLC值";
//
@@ -269,9 +269,9 @@
this.label4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(126, 453);
this.label4.Location = new System.Drawing.Point(133, 517);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(180, 28);
this.label4.Size = new System.Drawing.Size(207, 33);
this.label4.TabIndex = 3;
this.label4.Text = "成功调用接口";
//
@@ -280,9 +280,9 @@
this.label3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(147, 368);
this.label3.Location = new System.Drawing.Point(157, 420);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(138, 28);
this.label3.Size = new System.Drawing.Size(159, 33);
this.label3.TabIndex = 2;
this.label3.Text = "期望PLC值";
//
@@ -291,9 +291,9 @@
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(182, 283);
this.label2.Location = new System.Drawing.Point(197, 323);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 28);
this.label2.Size = new System.Drawing.Size(79, 33);
this.label2.TabIndex = 1;
this.label2.Text = "步骤";
//
@@ -301,18 +301,18 @@
//
this.期望PLC值.Anchor = System.Windows.Forms.AnchorStyles.None;
this.期望PLC值.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.期望PLC值.Location = new System.Drawing.Point(328, 363);
this.期望PLC值.Location = new System.Drawing.Point(358, 414);
this.期望PLC值.Name = "期望PLC值";
this.期望PLC值.Size = new System.Drawing.Size(211, 39);
this.期望PLC值.Size = new System.Drawing.Size(230, 44);
this.期望PLC值.TabIndex = 20;
//
// 步骤
//
this.步骤.Anchor = System.Windows.Forms.AnchorStyles.None;
this.步骤.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.步骤.Location = new System.Drawing.Point(328, 278);
this.步骤.Location = new System.Drawing.Point(358, 317);
this.步骤.Name = "步骤";
this.步骤.Size = new System.Drawing.Size(211, 39);
this.步骤.Size = new System.Drawing.Size(230, 44);
this.步骤.TabIndex = 17;
//
// label7
@@ -320,9 +320,9 @@
this.label7.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(154, 198);
this.label7.Location = new System.Drawing.Point(165, 226);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(124, 28);
this.label7.Size = new System.Drawing.Size(143, 33);
this.label7.TabIndex = 29;
this.label7.Text = "流程编号";
//
@@ -330,9 +330,9 @@
//
this.流程编号.Anchor = System.Windows.Forms.AnchorStyles.None;
this.流程编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.流程编号.Location = new System.Drawing.Point(328, 193);
this.流程编号.Location = new System.Drawing.Point(358, 220);
this.流程编号.Name = "流程编号";
this.流程编号.Size = new System.Drawing.Size(211, 39);
this.流程编号.Size = new System.Drawing.Size(230, 44);
this.流程编号.TabIndex = 30;
//
// label11
@@ -340,9 +340,9 @@
this.label11.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label11.AutoSize = true;
this.label11.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label11.Location = new System.Drawing.Point(588, 368);
this.label11.Location = new System.Drawing.Point(639, 420);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(124, 28);
this.label11.Size = new System.Drawing.Size(143, 33);
this.label11.TabIndex = 10;
this.label11.Text = "螺丝角度";
//
@@ -351,9 +351,9 @@
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(856, 372);
this.螺丝角度.Location = new System.Drawing.Point(933, 423);
this.螺丝角度.Name = "螺丝角度";
this.螺丝角度.Size = new System.Drawing.Size(22, 21);
this.螺丝角度.Size = new System.Drawing.Size(28, 27);
this.螺丝角度.TabIndex = 24;
this.螺丝角度.UseVisualStyleBackColor = true;
//
@@ -362,9 +362,9 @@
this.label12.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label12.Location = new System.Drawing.Point(588, 453);
this.label12.Location = new System.Drawing.Point(639, 517);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(124, 28);
this.label12.Size = new System.Drawing.Size(143, 33);
this.label12.TabIndex = 11;
this.label12.Text = "扭力曲线";
//
@@ -373,9 +373,9 @@
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(856, 457);
this.扭力曲线.Location = new System.Drawing.Point(933, 520);
this.扭力曲线.Name = "扭力曲线";
this.扭力曲线.Size = new System.Drawing.Size(22, 21);
this.扭力曲线.Size = new System.Drawing.Size(28, 27);
this.扭力曲线.TabIndex = 25;
this.扭力曲线.UseVisualStyleBackColor = true;
//
@@ -384,9 +384,9 @@
this.label13.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label13.AutoSize = true;
this.label13.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label13.Location = new System.Drawing.Point(588, 538);
this.label13.Location = new System.Drawing.Point(639, 614);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(124, 28);
this.label13.Size = new System.Drawing.Size(143, 33);
this.label13.TabIndex = 12;
this.label13.Text = "压力曲线";
//
@@ -395,9 +395,9 @@
this.label14.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label14.AutoSize = true;
this.label14.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label14.Location = new System.Drawing.Point(588, 623);
this.label14.Location = new System.Drawing.Point(639, 711);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(124, 28);
this.label14.Size = new System.Drawing.Size(143, 33);
this.label14.TabIndex = 13;
this.label14.Text = "气密参数";
//
@@ -406,9 +406,9 @@
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(856, 117);
this.扫码.Location = new System.Drawing.Point(933, 132);
this.扫码.Name = "扫码";
this.扫码.Size = new System.Drawing.Size(22, 21);
this.扫码.Size = new System.Drawing.Size(28, 27);
this.扫码.TabIndex = 28;
this.扫码.UseVisualStyleBackColor = true;
//
@@ -416,9 +416,9 @@
//
this.错误PLC值.Anchor = System.Windows.Forms.AnchorStyles.None;
this.错误PLC值.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.错误PLC值.Location = new System.Drawing.Point(328, 533);
this.错误PLC值.Location = new System.Drawing.Point(358, 608);
this.错误PLC值.Name = "错误PLC值";
this.错误PLC值.Size = new System.Drawing.Size(211, 39);
this.错误PLC值.Size = new System.Drawing.Size(230, 44);
this.错误PLC值.TabIndex = 18;
//
// 成功接口
@@ -426,9 +426,9 @@
this.成功接口.Anchor = System.Windows.Forms.AnchorStyles.None;
this.成功接口.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.成功接口.FormattingEnabled = true;
this.成功接口.Location = new System.Drawing.Point(328, 453);
this.成功接口.Location = new System.Drawing.Point(358, 513);
this.成功接口.Name = "成功接口";
this.成功接口.Size = new System.Drawing.Size(211, 36);
this.成功接口.Size = new System.Drawing.Size(230, 41);
this.成功接口.TabIndex = 31;
//
// 错误接口
@@ -436,19 +436,19 @@
this.错误接口.Anchor = System.Windows.Forms.AnchorStyles.None;
this.错误接口.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.错误接口.FormattingEnabled = true;
this.错误接口.Location = new System.Drawing.Point(328, 623);
this.错误接口.Location = new System.Drawing.Point(358, 707);
this.错误接口.Name = "错误接口";
this.错误接口.Size = new System.Drawing.Size(211, 36);
this.错误接口.Size = new System.Drawing.Size(230, 41);
this.错误接口.TabIndex = 32;
//
// FLOW_Insert
// FLow_Insert
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1087, 854);
this.ClientSize = new System.Drawing.Size(1186, 976);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "FLOW_Insert";
this.Name = "FLow_Insert";
this.Text = "Form_Insert";
this.Load += new System.EventHandler(this.FLOW_Insert_Load);
this.tableLayoutPanel1.ResumeLayout(false);
@@ -63,12 +63,13 @@ namespace WindowsFormsApp1.form
t_Flow.errstatus = _错误PLC值;
t_Flow.errinterfaceid = (int)错误接口.SelectedValue;
t_Flow.scan = 扫码.Checked;
t_Flow.fileupload = 文件上传.Checked;
//t_Flow.fileupload = 文件上传.Checked;
t_Flow.finaltorquevalue = 螺丝扭力.Checked;
t_Flow.finalanglevaluue = 螺丝角度.Checked;
t_Flow.finaltorquecurve = 扭力曲线.Checked;
t_Flow.finalpressurecurve = 压力曲线.Checked;
t_Flow.airtight = 气密参数.Checked;
t_Flow.dzscan = 文件上传.Checked;
SQLiteHelper<t_flow> sQLiteHelper1 = new db.SQLiteHelper<t_flow>();
if (Operation == OperationType.Edit)
@@ -145,7 +146,7 @@ namespace WindowsFormsApp1.form
错误PLC值.Text = DataToEdit.errstatus.ToString();
SelectItemByValue(错误接口, DataToEdit.errinterfaceid.ToString());
扫码.Checked = DataToEdit.scan;
文件上传.Checked = DataToEdit.fileupload;
文件上传.Checked = DataToEdit.dzscan;
螺丝扭力.Checked = DataToEdit.finaltorquevalue;
螺丝角度.Checked = DataToEdit.finalanglevaluue;
扭力曲线.Checked = DataToEdit.finaltorquecurve;
@@ -30,11 +30,11 @@ namespace WindowsFormsApp1.form
MessageBox.Show("关键字不能为空");
return;
}
if (string.IsNullOrWhiteSpace(值.Text))
{
MessageBox.Show("值不能为空");
return;
}
//if (string.IsNullOrWhiteSpace(值.Text))
//{
// MessageBox.Show("值不能为空");
// return;
//}
if (string.IsNullOrWhiteSpace(备注.Text))
{
MessageBox.Show("备注不能为空");
+73 -73
View File
@@ -41,9 +41,9 @@
this.label7 = new System.Windows.Forms.Label();
this.产线编号 = new System.Windows.Forms.TextBox();
this.关联流程 = new System.Windows.Forms.ComboBox();
this.备用显示1 = new System.Windows.Forms.TextBox();
this.备用显示2 = new System.Windows.Forms.TextBox();
this.备用显示3 = new System.Windows.Forms.TextBox();
this.Line = new System.Windows.Forms.TextBox();
this.StationID = new System.Windows.Forms.TextBox();
this.MachineID = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
@@ -73,9 +73,9 @@
this.tableLayoutPanel1.Controls.Add(this.label7, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.产线编号, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.关联流程, 2, 5);
this.tableLayoutPanel1.Controls.Add(this.备用显示1, 4, 1);
this.tableLayoutPanel1.Controls.Add(this.备用显示2, 4, 2);
this.tableLayoutPanel1.Controls.Add(this.备用显示3, 4, 3);
this.tableLayoutPanel1.Controls.Add(this.Line, 4, 1);
this.tableLayoutPanel1.Controls.Add(this.StationID, 4, 2);
this.tableLayoutPanel1.Controls.Add(this.MachineID, 4, 3);
this.tableLayoutPanel1.Controls.Add(this.label5, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.label6, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.label8, 3, 3);
@@ -96,7 +96,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1087, 854);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1186, 976);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
@@ -104,9 +104,9 @@
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(182, 113);
this.label1.Location = new System.Drawing.Point(197, 129);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 28);
this.label1.Size = new System.Drawing.Size(79, 33);
this.label1.TabIndex = 0;
this.label1.Text = "名称";
//
@@ -115,9 +115,9 @@
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.button1, 2);
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(228, 683);
this.button1.Location = new System.Drawing.Point(249, 779);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(194, 79);
this.button1.Size = new System.Drawing.Size(212, 90);
this.button1.TabIndex = 14;
this.button1.Text = "保存";
this.button1.UseVisualStyleBackColor = true;
@@ -128,9 +128,9 @@
this.button2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.button2, 2);
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(664, 683);
this.button2.Location = new System.Drawing.Point(725, 779);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(190, 79);
this.button2.Size = new System.Drawing.Size(207, 90);
this.button2.TabIndex = 15;
this.button2.Text = "取消";
this.button2.UseVisualStyleBackColor = true;
@@ -140,9 +140,9 @@
//
this.名称.Anchor = System.Windows.Forms.AnchorStyles.None;
this.名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.名称.Location = new System.Drawing.Point(328, 108);
this.名称.Location = new System.Drawing.Point(358, 123);
this.名称.Name = "名称";
this.名称.Size = new System.Drawing.Size(211, 39);
this.名称.Size = new System.Drawing.Size(230, 44);
this.名称.TabIndex = 16;
//
// label4
@@ -150,9 +150,9 @@
this.label4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(154, 453);
this.label4.Location = new System.Drawing.Point(165, 517);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(124, 28);
this.label4.Size = new System.Drawing.Size(143, 33);
this.label4.TabIndex = 3;
this.label4.Text = "关联流程";
//
@@ -161,39 +161,39 @@
this.label3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(182, 368);
this.label3.Location = new System.Drawing.Point(197, 420);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 28);
this.label3.Size = new System.Drawing.Size(79, 33);
this.label3.TabIndex = 2;
this.label3.Text = "模组";
this.label3.Text = "Mold";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(154, 283);
this.label2.Location = new System.Drawing.Point(189, 323);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(124, 28);
this.label2.Size = new System.Drawing.Size(95, 33);
this.label2.TabIndex = 1;
this.label2.Text = "产线类型";
this.label2.Text = "FixSn";
//
// 模组
//
this.模组.Anchor = System.Windows.Forms.AnchorStyles.None;
this.模组.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.模组.Location = new System.Drawing.Point(328, 363);
this.模组.Location = new System.Drawing.Point(358, 414);
this.模组.Name = "模组";
this.模组.Size = new System.Drawing.Size(211, 39);
this.模组.Size = new System.Drawing.Size(230, 44);
this.模组.TabIndex = 20;
//
// 产线类型
//
this.产线类型.Anchor = System.Windows.Forms.AnchorStyles.None;
this.产线类型.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.产线类型.Location = new System.Drawing.Point(328, 278);
this.产线类型.Location = new System.Drawing.Point(358, 317);
this.产线类型.Name = "产线类型";
this.产线类型.Size = new System.Drawing.Size(211, 39);
this.产线类型.Size = new System.Drawing.Size(230, 44);
this.产线类型.TabIndex = 17;
//
// label7
@@ -201,19 +201,19 @@
this.label7.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(154, 198);
this.label7.Location = new System.Drawing.Point(189, 226);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(124, 28);
this.label7.Size = new System.Drawing.Size(95, 33);
this.label7.TabIndex = 29;
this.label7.Text = "产线编号";
this.label7.Text = "Token";
//
// 产线编号
//
this.产线编号.Anchor = System.Windows.Forms.AnchorStyles.None;
this.产线编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.产线编号.Location = new System.Drawing.Point(328, 193);
this.产线编号.Location = new System.Drawing.Point(358, 220);
this.产线编号.Name = "产线编号";
this.产线编号.Size = new System.Drawing.Size(211, 39);
this.产线编号.Size = new System.Drawing.Size(230, 44);
this.产线编号.TabIndex = 30;
//
// 关联流程
@@ -222,79 +222,79 @@
this.tableLayoutPanel1.SetColumnSpan(this.关联流程, 3);
this.关联流程.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.关联流程.FormattingEnabled = true;
this.关联流程.Location = new System.Drawing.Point(364, 453);
this.关联流程.Location = new System.Drawing.Point(398, 517);
this.关联流程.Name = "关联流程";
this.关联流程.Size = new System.Drawing.Size(573, 36);
this.关联流程.Size = new System.Drawing.Size(625, 41);
this.关联流程.TabIndex = 31;
//
// 备用显示1
// Line
//
this.备用显示1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.备用显示1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.备用显示1.Location = new System.Drawing.Point(762, 108);
this.备用显示1.Name = "备用显示1";
this.备用显示1.Size = new System.Drawing.Size(211, 39);
this.备用显示1.TabIndex = 32;
this.Line.Anchor = System.Windows.Forms.AnchorStyles.None;
this.Line.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Line.Location = new System.Drawing.Point(832, 123);
this.Line.Name = "Line";
this.Line.Size = new System.Drawing.Size(230, 44);
this.Line.TabIndex = 32;
//
// 备用显示2
// StationID
//
this.备用显示2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.备用显示2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.备用显示2.Location = new System.Drawing.Point(762, 193);
this.备用显示2.Name = "备用显示2";
this.备用显示2.Size = new System.Drawing.Size(211, 39);
this.备用显示2.TabIndex = 33;
this.StationID.Anchor = System.Windows.Forms.AnchorStyles.None;
this.StationID.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StationID.Location = new System.Drawing.Point(832, 220);
this.StationID.Name = "StationID";
this.StationID.Size = new System.Drawing.Size(230, 44);
this.StationID.TabIndex = 33;
//
// 备用显示3
// MachineID
//
this.备用显示3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.备用显示3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.备用显示3.Location = new System.Drawing.Point(762, 278);
this.备用显示3.Name = "备用显示3";
this.备用显示3.Size = new System.Drawing.Size(211, 39);
this.备用显示3.TabIndex = 34;
this.MachineID.Anchor = System.Windows.Forms.AnchorStyles.None;
this.MachineID.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.MachineID.Location = new System.Drawing.Point(832, 317);
this.MachineID.Name = "MachineID";
this.MachineID.Size = new System.Drawing.Size(230, 44);
this.MachineID.TabIndex = 34;
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(581, 113);
this.label5.Location = new System.Drawing.Point(671, 129);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(138, 28);
this.label5.Size = new System.Drawing.Size(79, 33);
this.label5.TabIndex = 35;
this.label5.Text = "备用显示1";
this.label5.Text = "Line";
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(581, 198);
this.label6.Location = new System.Drawing.Point(631, 226);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(138, 28);
this.label6.Size = new System.Drawing.Size(159, 33);
this.label6.TabIndex = 36;
this.label6.Text = "备用显示2";
this.label6.Text = "StationID";
//
// label8
//
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(581, 283);
this.label8.Location = new System.Drawing.Point(631, 323);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(138, 28);
this.label8.Size = new System.Drawing.Size(159, 33);
this.label8.TabIndex = 37;
this.label8.Text = "备用显示3";
this.label8.Text = "MachineID";
//
// label9
//
this.label9.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(161, 538);
this.label9.Location = new System.Drawing.Point(173, 614);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(110, 28);
this.label9.Size = new System.Drawing.Size(127, 33);
this.label9.TabIndex = 38;
this.label9.Text = "关联PLC";
//
@@ -304,16 +304,16 @@
this.tableLayoutPanel1.SetColumnSpan(this.关联PLC, 3);
this.关联PLC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.关联PLC.FormattingEnabled = true;
this.关联PLC.Location = new System.Drawing.Point(364, 538);
this.关联PLC.Location = new System.Drawing.Point(398, 614);
this.关联PLC.Name = "关联PLC";
this.关联PLC.Size = new System.Drawing.Size(573, 36);
this.关联PLC.Size = new System.Drawing.Size(625, 41);
this.关联PLC.TabIndex = 39;
//
// Line_Insert
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1087, 854);
this.ClientSize = new System.Drawing.Size(1186, 976);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Line_Insert";
@@ -340,9 +340,9 @@
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox 产线编号;
private System.Windows.Forms.ComboBox 关联流程;
private System.Windows.Forms.TextBox 备用显示1;
private System.Windows.Forms.TextBox 备用显示2;
private System.Windows.Forms.TextBox 备用显示3;
private System.Windows.Forms.TextBox Line;
private System.Windows.Forms.TextBox StationID;
private System.Windows.Forms.TextBox MachineID;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
+46 -43
View File
@@ -31,36 +31,36 @@ namespace WindowsFormsApp1.form
MessageBox.Show("名称不能为空");
return;
}
if (string.IsNullOrWhiteSpace(产线类型.Text))
{
MessageBox.Show("产线类型不能为空");
return;
}
if (string.IsNullOrWhiteSpace(产线编号.Text))
{
MessageBox.Show("产线编号不能为空");
return;
}
if (string.IsNullOrWhiteSpace(模组.Text))
{
MessageBox.Show("模组不能为空");
return;
}
if (string.IsNullOrWhiteSpace(备用显示1.Text))
{
MessageBox.Show("备用显示1不能为空");
return;
}
if (string.IsNullOrWhiteSpace(备用显示2.Text))
{
MessageBox.Show("备用显示2不能为空");
return;
}
if (string.IsNullOrWhiteSpace(备用显示3.Text))
{
MessageBox.Show("备用显示3不能为空");
return;
}
//if (string.IsNullOrWhiteSpace(产线类型.Text))
//{
// MessageBox.Show("产线类型不能为空");
// return;
//}
//if (string.IsNullOrWhiteSpace(产线编号.Text))
//{
// MessageBox.Show("产线编号不能为空");
// return;
//}
//if (string.IsNullOrWhiteSpace(模组.Text))
//{
// MessageBox.Show("模组不能为空");
// return;
//}
//if (string.IsNullOrWhiteSpace(Line.Text))
//{
// MessageBox.Show("Line不能为空");
// return;
//}
//if (string.IsNullOrWhiteSpace(StationID.Text))
//{
// MessageBox.Show("StationID不能为空");
// return;
//}
//if (string.IsNullOrWhiteSpace(MachineID.Text))
//{
// MessageBox.Show("MachineID不能为空");
// return;
//}
if (关联流程.SelectedValue == null || (int)关联流程.SelectedValue == 0)
{
MessageBox.Show("关联流程不能为空");
@@ -74,14 +74,17 @@ namespace WindowsFormsApp1.form
t_line t_Flow = new t_line();
t_Flow.linename = 名称.Text;
t_Flow.linetype = 产线类型.Text;
t_Flow.linecode = 产线编号.Text;
t_Flow.linemode = 模组.Text;
//t_Flow.linetype = 产线类型.Text;
//t_Flow.linecode = 产线编号.Text;
//t_Flow.linemode = 模组.Text;
t_Flow.flowid = (int)关联流程.SelectedValue;
t_Flow.plcid = (int)关联PLC.SelectedValue;
t_Flow.lineremark1 = 备用显示1.Text;
t_Flow.lineremark2 = 备用显示2.Text;
t_Flow.lineremark3 = 备用显示3.Text;
t_Flow.lineremark1 = Line.Text;
t_Flow.lineremark2 = StationID.Text;
t_Flow.lineremark3 = MachineID.Text;
t_Flow.lineremark4 = 产线编号.Text;
t_Flow.lineremark5 = 产线类型.Text;
t_Flow.lineremark6 = 模组.Text;
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
@@ -92,7 +95,7 @@ namespace WindowsFormsApp1.form
}
else
{
sQLiteHelper1.Insert(t_Flow);
var re = sQLiteHelper1.Insert(t_Flow);
}
MessageBox.Show("保存成功");
this.Close();
@@ -158,12 +161,12 @@ namespace WindowsFormsApp1.form
}
var DataToEdit = result.Data;
名称.Text = DataToEdit.linename;
产线编号.Text = DataToEdit.linecode;
产线类型.Text = DataToEdit.linetype;
模组.Text = DataToEdit.linemode;
备用显示1.Text = DataToEdit.lineremark1;
备用显示2.Text = DataToEdit.lineremark2;
备用显示3.Text = DataToEdit.lineremark3;
产线编号.Text = DataToEdit.lineremark4;
产线类型.Text = DataToEdit.lineremark5;
模组.Text = DataToEdit.lineremark6;
Line.Text = DataToEdit.lineremark1;
StationID.Text = DataToEdit.lineremark2;
MachineID.Text = DataToEdit.lineremark3;
SelectItemByValue(关联流程, DataToEdit.flowid.ToString());
SelectItemByValue2(关联PLC, DataToEdit.plcid.ToString());
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SQLite;
namespace WindowsFormsApp1.mod
{
public class t_imageposition
{
[PrimaryKey, AutoIncrement]
public int id { get; set; }
public string name { get; set; }
public string position { get; set; }
public int x { get; set; }
public int y { get; set; }
public DateTime createtime { get; set; }
}
}
+18
View File
@@ -16,11 +16,29 @@ namespace WindowsFormsApp1.mod
public string linecode { get; set; }
public string linetype { get; set; }
public string linemode { get; set; }
/// <summary>
/// line
/// </summary>
public string lineremark1 { get; set; }
/// <summary>
/// stationid
/// </summary>
public string lineremark2 { get; set; }
/// <summary>
/// machineid
/// </summary>
public string lineremark3 { get; set; }
/// <summary>
/// token
/// </summary>
public string lineremark4 { get; set; }
/// <summary>
/// fixsn
/// </summary>
public string lineremark5 { get; set; }
/// <summary>
/// mold
/// </summary>
public string lineremark6 { get; set; }
public string lineremark7 { get; set; }
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SQLite;
namespace WindowsFormsApp1.mod
{
[Table("lineplc")]
public class t_lineplc
{
[PrimaryKey, AutoIncrement]
public int id { get; set; }
public int lineid { get; set; }
public int plcid { get; set; }
}
}
@@ -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; }
}
}
+24
View File
@@ -23,11 +23,26 @@ namespace WindowsFormsApp1.mod.server
/// </summary>
public string FileUploadAddress { get; set; }
/// <summary>
/// 图片地址地址
/// </summary>
public string ImageAddress { get; set; }
/// <summary>
/// 视频地址
/// </summary>
public string VedioAddress { get; set; }
/// <summary>
/// 前端返回的扫码
/// </summary>
public string JS_SN { get; set; }
/// <summary>
/// 前端返回的扫码
/// </summary>
public string SN { get; set; }
/// <summary>
/// 螺丝枪扭力
/// </summary>
@@ -52,6 +67,15 @@ namespace WindowsFormsApp1.mod.server
/// 气密仪参数
/// </summary>
public Airtight FinalAirtightValue { get; set; }
/// <summary>
/// 上下料位置
/// </summary>
public int locationindex { get; set; }
/// <summary>
/// 上下料操作 上料:1;下料 2
/// </summary>
public int opindex { get; set; }
}
File diff suppressed because it is too large. Load diff
+115
View File
@@ -0,0 +1,115 @@
using CsvHelper;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
namespace WindowsFormsApp1
{
// 定义日志条目类
public class LogEntry
{
public DateTime Timestamp { get; set; }
public string Level { get; set; }
public string Message { get; set; }
public string Exception { get; set; }
}
// 封装 CsvHelper 的日志记录类,设为静态类
public static class CsvLogger
{
private static string _baseFilePath;
private static List<string> _customHeaders = new List<string>();
private static readonly object _lockObj = new object(); // 添加锁对象用于线程安全
private static bool _initialized = false;
public static void Initialize(string baseFilePath)
{
if (string.IsNullOrEmpty(baseFilePath))
throw new ArgumentNullException(nameof(baseFilePath), "日志文件路径不能为空");
_baseFilePath = baseFilePath;
_initialized = true;
// 确保目录存在
string directory = Path.GetDirectoryName(baseFilePath);
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
}
// 设置自定义表头
public static void SetHeaders(List<string> headers)
{
if (headers == null)
throw new ArgumentNullException(nameof(headers));
lock (_lockObj)
{
_customHeaders = new List<string>(headers); // 创建副本
}
}
private static string GetCurrentLogFilePath()
{
var date = DateTime.Now.ToString("yyyy-MM-dd");
var fileExtension = Path.GetExtension(_baseFilePath);
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(_baseFilePath);
return $"{Path.GetDirectoryName(_baseFilePath)}/{fileNameWithoutExtension}_{date}{fileExtension}";
}
public static void Log(string csvFormattedString)
{
if (!_initialized)
throw new InvalidOperationException("CsvLogger 未初始化,请先调用 Initialize 方法");
lock (_lockObj)
{
try
{
var filePath = GetCurrentLogFilePath();
bool fileExists = File.Exists(filePath);
// 如果文件不存在,先写入表头
if (!fileExists)
{
using (var writer = new StreamWriter(filePath, false, Encoding.UTF8))
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
if (_customHeaders.Count > 0)
{
foreach (var header in _customHeaders)
{
csv.WriteField(header);
}
csv.NextRecord();
}
else
{
csv.WriteHeader<LogEntry>();
csv.NextRecord();
}
}
}
// 直接写入日志,不使用队列
using (var writer = new StreamWriter(filePath, true, Encoding.UTF8))
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
var fields = csvFormattedString.Split(',');
foreach (var field in fields)
{
csv.WriteField(field);
}
csv.NextRecord();
}
}
catch (Exception ex)
{
// 记录错误,但不抛出异常
Console.WriteLine($"写入日志文件时出错: {ex.Message}");
}
}
}
}
}
+3 -1
View File
@@ -12,7 +12,9 @@ namespace WindowsFormsApp1.server
public static ILogNet logNet = new LogNetDateTime("C:\\Log\\Logs", GenerateMode.ByEveryDay);
public static ILogNet PlclogNet = new LogNetDateTime("C:\\Log\\PlcLogs", GenerateMode.ByEveryDay);
public static ILogNet ApilogNet = new LogNetDateTime("C:\\Log\\Apilogs", GenerateMode.ByEveryHour);
public static ILogNet QMlogNet = new LogNetDateTime("C:\\Log\\QMlogs", GenerateMode.ByEveryHour);
public static ILogNet SNlogNet = new LogNetDateTime("C:\\Log\\SNlogs", GenerateMode.ByEveryDay);
public static ILogNet OEElogNet = new LogNetDateTime("C:\\Log\\Apilogs", GenerateMode.ByEveryDay);
public static HslCommunication.BasicFramework.SoftNumericalOrder softNumericalOrder = new HslCommunication.BasicFramework.SoftNumericalOrder("", "yyyyMMdd", 4, @"\numericalOrder.txt");
public LogExecute()