更改大部分页面,更改各个扫码逻辑

This commit is contained in:
bnala committed 2025-03-24 23:35:51 +08:00
1 parent 2bd24f5316
commit 1670395816
34 files changed
+2420 -1425

No files matched your search

-170
View File
@@ -1,170 +0,0 @@
namespace WindowsFormsApp1.form
{
partial class LinePLC_Insert
{
/// <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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.产线 = new System.Windows.Forms.ComboBox();
this.PLC = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 6;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.Controls.Add(this.button1, 1, 8);
this.tableLayoutPanel1.Controls.Add(this.button2, 3, 8);
this.tableLayoutPanel1.Controls.Add(this.label4, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.label6, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.产线, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.PLC, 2, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 10;
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.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.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.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1087, 854);
this.tableLayoutPanel1.TabIndex = 0;
//
// button1
//
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.Name = "button1";
this.button1.Size = new System.Drawing.Size(194, 79);
this.button1.TabIndex = 14;
this.button1.Text = "保存";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
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.Name = "button2";
this.button2.Size = new System.Drawing.Size(190, 79);
this.button2.TabIndex = 15;
this.button2.Text = "取消";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label4
//
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, 113);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(124, 28);
this.label4.TabIndex = 3;
this.label4.Text = "产线名称";
//
// 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(161, 283);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(110, 28);
this.label6.TabIndex = 5;
this.label6.Text = "关联PLC";
//
// 产线
//
this.产线.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.产线, 3);
this.产线.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.产线.FormattingEnabled = true;
this.产线.Location = new System.Drawing.Point(341, 113);
this.产线.Name = "产线";
this.产线.Size = new System.Drawing.Size(619, 36);
this.产线.TabIndex = 31;
//
// PLC
//
this.PLC.Anchor = System.Windows.Forms.AnchorStyles.None;
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(341, 283);
this.PLC.Name = "PLC";
this.PLC.Size = new System.Drawing.Size(619, 36);
this.PLC.TabIndex = 32;
//
// LinePLC_Insert
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1087, 854);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "LinePLC_Insert";
this.Text = "Form_Insert";
this.Load += new System.EventHandler(this.FLOW_Insert_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ComboBox 产线;
private System.Windows.Forms.ComboBox PLC;
}
}
@@ -1,130 +0,0 @@
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.form
{
public partial class LinePLC_Insert : Form
{
public OperationType Operation { get; set; }
public int dataid { get; set; }
public LinePLC_Insert()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//保存
if (产线.SelectedValue == null)
{
MessageBox.Show("产线不可为空");
}
if (PLC.SelectedValue == null)
{
MessageBox.Show("PLC不可为空");
}
t_lineplc t_Flow = new t_lineplc();
t_Flow.lineid = (int)产线.SelectedValue;
t_Flow.plcid = (int)PLC.SelectedValue;
SQLiteHelper<t_lineplc> sQLiteHelper1 = new db.SQLiteHelper<t_lineplc>();
if (Operation == OperationType.Edit)
{
t_Flow.id = dataid;
sQLiteHelper1.Update(t_Flow);
}
else
{
sQLiteHelper1.Insert(t_Flow);
}
MessageBox.Show("保存成功");
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
//取消
this.Close();
}
private void FLOW_Insert_Load(object sender, EventArgs e)
{
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
var result_combox1 = sQLiteHelper1.QueryAll();
if (!result_combox1.Success)
{
MessageBox.Show("查询失败");
return;
}
// 绑定数据源到 ComboBox
产线.DataSource = result_combox1.Data;
产线.DisplayMember = "linename";
产线.ValueMember = "id";
SQLiteHelper<t_plc> sQLiteHelper2 = new db.SQLiteHelper<t_plc>();
var result_combox2 = sQLiteHelper2.QueryAll();
if (!result_combox2.Success)
{
MessageBox.Show("查询失败");
return;
}
PLC.DataSource = result_combox2.Data;
PLC.DisplayMember = "plcname";
PLC.ValueMember = "id";
if (Operation == OperationType.Edit)
{
SQLiteHelper<t_lineplc> sQLiteHelper = new db.SQLiteHelper<t_lineplc>();
var result = sQLiteHelper.QuerySingle(a=>a.id == dataid);
if (!result.Success)
{
MessageBox.Show("查询失败");
return;
}
var DataToEdit = result.Data;
SelectItemByValue1(产线, DataToEdit.lineid.ToString());
SelectItemByValue2(PLC, DataToEdit.plcid.ToString());
}
}
private void SelectItemByValue1(ComboBox comboBox1, string value)
{
foreach (t_line item in comboBox1.Items)
{
if (item.id.ToString() == value)
{
comboBox1.SelectedItem = item;
break;
}
}
}
private void SelectItemByValue2(ComboBox comboBox1, string value)
{
foreach (t_plc item in comboBox1.Items)
{
if (item.id.ToString() == value)
{
comboBox1.SelectedItem = item;
break;
}
}
}
}
}
@@ -1,120 +0,0 @@
<?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>
+114 -12
View File
@@ -41,6 +41,14 @@
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.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.关联PLC = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
@@ -65,6 +73,14 @@
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.label5, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.label6, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.label8, 3, 3);
this.tableLayoutPanel1.Controls.Add(this.label9, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.关联PLC, 2, 6);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
@@ -123,11 +139,10 @@
// 名称
//
this.名称.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.名称, 3);
this.名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.名称.Location = new System.Drawing.Point(364, 108);
this.名称.Location = new System.Drawing.Point(328, 108);
this.名称.Name = "名称";
this.名称.Size = new System.Drawing.Size(573, 39);
this.名称.Size = new System.Drawing.Size(211, 39);
this.名称.TabIndex = 16;
//
// label4
@@ -166,21 +181,19 @@
// 模组
//
this.模组.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.模组, 3);
this.模组.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.模组.Location = new System.Drawing.Point(364, 363);
this.模组.Location = new System.Drawing.Point(328, 363);
this.模组.Name = "模组";
this.模组.Size = new System.Drawing.Size(573, 39);
this.模组.Size = new System.Drawing.Size(211, 39);
this.模组.TabIndex = 20;
//
// 产线类型
//
this.产线类型.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.产线类型, 3);
this.产线类型.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.产线类型.Location = new System.Drawing.Point(364, 278);
this.产线类型.Location = new System.Drawing.Point(328, 278);
this.产线类型.Name = "产线类型";
this.产线类型.Size = new System.Drawing.Size(573, 39);
this.产线类型.Size = new System.Drawing.Size(211, 39);
this.产线类型.TabIndex = 17;
//
// label7
@@ -197,11 +210,10 @@
// 产线编号
//
this.产线编号.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.产线编号, 3);
this.产线编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.产线编号.Location = new System.Drawing.Point(364, 193);
this.产线编号.Location = new System.Drawing.Point(328, 193);
this.产线编号.Name = "产线编号";
this.产线编号.Size = new System.Drawing.Size(573, 39);
this.产线编号.Size = new System.Drawing.Size(211, 39);
this.产线编号.TabIndex = 30;
//
// 关联流程
@@ -215,6 +227,88 @@
this.关联流程.Size = new System.Drawing.Size(573, 36);
this.关联流程.TabIndex = 31;
//
// 备用显示1
//
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;
//
// 备用显示2
//
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;
//
// 备用显示3
//
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;
//
// 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.Name = "label5";
this.label5.Size = new System.Drawing.Size(138, 28);
this.label5.TabIndex = 35;
this.label5.Text = "备用显示1";
//
// 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.Name = "label6";
this.label6.Size = new System.Drawing.Size(138, 28);
this.label6.TabIndex = 36;
this.label6.Text = "备用显示2";
//
// 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.Name = "label8";
this.label8.Size = new System.Drawing.Size(138, 28);
this.label8.TabIndex = 37;
this.label8.Text = "备用显示3";
//
// 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.Name = "label9";
this.label9.Size = new System.Drawing.Size(110, 28);
this.label9.TabIndex = 38;
this.label9.Text = "关联PLC";
//
// 关联PLC
//
this.关联PLC.Anchor = System.Windows.Forms.AnchorStyles.None;
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.Name = "关联PLC";
this.关联PLC.Size = new System.Drawing.Size(573, 36);
this.关联PLC.TabIndex = 39;
//
// Line_Insert
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
@@ -246,5 +340,13 @@
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.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox 关联PLC;
}
}
+68 -2
View File
@@ -46,11 +46,31 @@ namespace WindowsFormsApp1.form
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 (关联流程.SelectedValue == null || (int)关联流程.SelectedValue == 0)
{
MessageBox.Show("关联流程不能为空");
return;
}
if (关联PLC.SelectedValue == null || (int)关联PLC.SelectedValue == 0)
{
MessageBox.Show("关联PLC不能为空");
return;
}
t_line t_Flow = new t_line();
t_Flow.linename = 名称.Text;
@@ -58,6 +78,11 @@ namespace WindowsFormsApp1.form
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;
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
if (Operation == OperationType.Edit)
@@ -82,8 +107,10 @@ namespace WindowsFormsApp1.form
private void FLOW_Insert_Load(object sender, EventArgs e)
{
SQLiteHelper<t_flow> sQLiteHelper1 = new db.SQLiteHelper<t_flow>();
SQLiteHelper<t_plc> sQLiteHelper2 = new db.SQLiteHelper<t_plc>();
var result_combox1 = sQLiteHelper1.QueryAll();
if (!result_combox1.Success)
var result_combox2 = sQLiteHelper2.QueryAll();
if (!result_combox1.Success || !result_combox2.Success)
{
MessageBox.Show("查询失败");
return;
@@ -103,6 +130,23 @@ namespace WindowsFormsApp1.form
关联流程.DisplayMember = "flowname";
关联流程.ValueMember = "id";
List<plc_combox> list2 = new List<plc_combox>();
var plcresult = result_combox2.Data;
foreach (var group in plcresult)
{
list2.Add(new plc_combox
{
id = group.id,
plcname = group.plcname
});
}
// 绑定数据源到 ComboBox
关联PLC.DataSource = list2;
关联PLC.DisplayMember = "plcname";
关联PLC.ValueMember = "id";
if (Operation == OperationType.Edit)
{
SQLiteHelper<t_line> sQLiteHelper = new db.SQLiteHelper<t_line>();
@@ -117,7 +161,11 @@ namespace WindowsFormsApp1.form
产线编号.Text = DataToEdit.linecode;
产线类型.Text = DataToEdit.linetype;
模组.Text = DataToEdit.linemode;
备用显示1.Text = DataToEdit.lineremark1;
备用显示2.Text = DataToEdit.lineremark2;
备用显示3.Text = DataToEdit.lineremark3;
SelectItemByValue(关联流程, DataToEdit.flowid.ToString());
SelectItemByValue2(关联PLC, DataToEdit.plcid.ToString());
}
}
@@ -132,11 +180,29 @@ namespace WindowsFormsApp1.form
}
}
}
private void SelectItemByValue2(ComboBox comboBox1, string value)
{
foreach (plc_combox item in comboBox1.Items)
{
if (item.id.ToString() == value)
{
comboBox1.SelectedItem = item;
break;
}
}
}
}
public class flow_combox
{
public int id { get; set; }
public string flowname{ get; set; }
}
}
public class plc_combox
{
public int id { get; set; }
public string plcname { get; set; }
}
}