From 3439440a0dfdd414a17e698ec1f34057d3386095 Mon Sep 17 00:00:00 2001
From: zhangqi7131 <qi_zhang714@163.com>
Date: Wed, 31 Jul 2024 16:58:08 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E2=80=9C=E6=96=B0=E5=A2=9E?=
 =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E2=80=9D=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 STS/Form1.Designer.cs | 147 ++++++++++--------
 STS/Form1.cs          |  31 ++--
 STS/Form2.Designer.cs | 345 ++++++++++++++++++++++++++++++++++++++++++
 STS/Form2.cs          |  87 +++++++++++
 STS/Form2.resx        | 120 +++++++++++++++
 STS/STS.csproj        |   9 ++
 STS_Table.sql         |  29 ----
 7 files changed, 662 insertions(+), 106 deletions(-)
 create mode 100644 STS/Form2.Designer.cs
 create mode 100644 STS/Form2.cs
 create mode 100644 STS/Form2.resx

diff --git a/STS/Form1.Designer.cs b/STS/Form1.Designer.cs
index 3ae4b1a..74560de 100644
--- a/STS/Form1.Designer.cs
+++ b/STS/Form1.Designer.cs
@@ -30,13 +30,6 @@
         {
             this.components = new System.ComponentModel.Container();
             this.dataGridView1 = new System.Windows.Forms.DataGridView();
-            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
-            this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
-            this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
-            this.querybtn1 = new System.Windows.Forms.Button();
-            this.label1 = new System.Windows.Forms.Label();
-            this.textBox1 = new System.Windows.Forms.TextBox();
-            this.comboBox1 = new System.Windows.Forms.ComboBox();
             this.Barcode_DGV = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -49,6 +42,14 @@
             this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+            this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+            this.querybtn1 = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
+            this.insert_btn1 = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
             this.contextMenuStrip1.SuspendLayout();
             this.SuspendLayout();
@@ -80,66 +81,6 @@
             this.dataGridView1.TabIndex = 0;
             this.dataGridView1.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseDown);
             // 
-            // contextMenuStrip1
-            // 
-            this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
-            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.toolStripMenuItem1,
-            this.toolStripMenuItem2});
-            this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(169, 52);
-            // 
-            // toolStripMenuItem1
-            // 
-            this.toolStripMenuItem1.Name = "toolStripMenuItem1";
-            this.toolStripMenuItem1.Size = new System.Drawing.Size(168, 24);
-            this.toolStripMenuItem1.Text = "【任务完成】";
-            this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
-            // 
-            // toolStripMenuItem2
-            // 
-            this.toolStripMenuItem2.Name = "toolStripMenuItem2";
-            this.toolStripMenuItem2.Size = new System.Drawing.Size(168, 24);
-            this.toolStripMenuItem2.Text = "【任务删除】";
-            this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
-            // 
-            // querybtn1
-            // 
-            this.querybtn1.Location = new System.Drawing.Point(876, 35);
-            this.querybtn1.Name = "querybtn1";
-            this.querybtn1.Size = new System.Drawing.Size(101, 25);
-            this.querybtn1.TabIndex = 1;
-            this.querybtn1.Text = "开始查询";
-            this.querybtn1.UseVisualStyleBackColor = true;
-            this.querybtn1.Click += new System.EventHandler(this.querybtn1_Click);
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(451, 39);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(67, 15);
-            this.label1.TabIndex = 2;
-            this.label1.Text = "任务查询";
-            // 
-            // textBox1
-            // 
-            this.textBox1.Location = new System.Drawing.Point(742, 35);
-            this.textBox1.Name = "textBox1";
-            this.textBox1.Size = new System.Drawing.Size(128, 25);
-            this.textBox1.TabIndex = 3;
-            // 
-            // comboBox1
-            // 
-            this.comboBox1.FormattingEnabled = true;
-            this.comboBox1.Items.AddRange(new object[] {
-            "条码",
-            "调度任务索引"});
-            this.comboBox1.Location = new System.Drawing.Point(529, 36);
-            this.comboBox1.Name = "comboBox1";
-            this.comboBox1.Size = new System.Drawing.Size(192, 23);
-            this.comboBox1.TabIndex = 4;
-            // 
             // Barcode_DGV
             // 
             this.Barcode_DGV.DataPropertyName = "Barcode";
@@ -248,11 +189,82 @@
             this.Column12.ReadOnly = true;
             this.Column12.Width = 60;
             // 
+            // contextMenuStrip1
+            // 
+            this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
+            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.toolStripMenuItem1,
+            this.toolStripMenuItem2});
+            this.contextMenuStrip1.Name = "contextMenuStrip1";
+            this.contextMenuStrip1.Size = new System.Drawing.Size(169, 52);
+            // 
+            // toolStripMenuItem1
+            // 
+            this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+            this.toolStripMenuItem1.Size = new System.Drawing.Size(168, 24);
+            this.toolStripMenuItem1.Text = "【任务完成】";
+            this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
+            // 
+            // toolStripMenuItem2
+            // 
+            this.toolStripMenuItem2.Name = "toolStripMenuItem2";
+            this.toolStripMenuItem2.Size = new System.Drawing.Size(168, 24);
+            this.toolStripMenuItem2.Text = "【任务删除】";
+            this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
+            // 
+            // querybtn1
+            // 
+            this.querybtn1.Location = new System.Drawing.Point(737, 34);
+            this.querybtn1.Name = "querybtn1";
+            this.querybtn1.Size = new System.Drawing.Size(101, 25);
+            this.querybtn1.TabIndex = 1;
+            this.querybtn1.Text = "开始查询";
+            this.querybtn1.UseVisualStyleBackColor = true;
+            this.querybtn1.Click += new System.EventHandler(this.querybtn1_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(312, 38);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(67, 15);
+            this.label1.TabIndex = 2;
+            this.label1.Text = "任务查询";
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(603, 34);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(128, 25);
+            this.textBox1.TabIndex = 3;
+            // 
+            // comboBox1
+            // 
+            this.comboBox1.FormattingEnabled = true;
+            this.comboBox1.Items.AddRange(new object[] {
+            "条码",
+            "调度任务索引"});
+            this.comboBox1.Location = new System.Drawing.Point(390, 35);
+            this.comboBox1.Name = "comboBox1";
+            this.comboBox1.Size = new System.Drawing.Size(192, 23);
+            this.comboBox1.TabIndex = 4;
+            // 
+            // insert_btn1
+            // 
+            this.insert_btn1.Location = new System.Drawing.Point(867, 34);
+            this.insert_btn1.Name = "insert_btn1";
+            this.insert_btn1.Size = new System.Drawing.Size(101, 25);
+            this.insert_btn1.TabIndex = 5;
+            this.insert_btn1.Text = "新增任务";
+            this.insert_btn1.UseVisualStyleBackColor = true;
+            this.insert_btn1.Click += new System.EventHandler(this.insert_btn1_Click);
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1348, 721);
+            this.Controls.Add(this.insert_btn1);
             this.Controls.Add(this.comboBox1);
             this.Controls.Add(this.textBox1);
             this.Controls.Add(this.label1);
@@ -290,6 +302,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn Column10;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column11;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
+        private System.Windows.Forms.Button insert_btn1;
     }
 }
 
diff --git a/STS/Form1.cs b/STS/Form1.cs
index 92548f2..b39fcd7 100644
--- a/STS/Form1.cs
+++ b/STS/Form1.cs
@@ -13,6 +13,7 @@ namespace STS
 {
     public partial class Form1 : Form
     {
+        SqlConnection conn;
         public Form1()
         {
             InitializeComponent();
@@ -20,16 +21,14 @@ namespace STS
 
         private void Form1_Load(object sender, EventArgs e)
         {
+            conn = new SqlConnection();
+            conn.ConnectionString = "Server=localhost;Database=TaskManagementDB;Trusted_Connection=True;";
             showAllInformation();
-            //开始时不选中任何行
-            dataGridView1.ClearSelection();
         }
 
         //展示数据库表中所有信息
         private void showAllInformation() 
         {
-            SqlConnection conn = new SqlConnection();
-            conn.ConnectionString = "Server=localhost;Database=TaskManagementDB;Trusted_Connection=True;";
             conn.Open();
             SqlCommand cmd = new SqlCommand();
             cmd.Connection = conn;
@@ -44,6 +43,9 @@ namespace STS
             DataTable dt = ds.Tables["STM"];
             dataGridView1.DataSource = dt;
             conn.Close();
+
+            //默认不选中任何行
+            dataGridView1.ClearSelection();
         }
 
         //单击“开始查询”按钮触发事件
@@ -60,8 +62,6 @@ namespace STS
                 key = "ScheduledTaskIndex";
             }
 
-            SqlConnection conn = new SqlConnection();
-            conn.ConnectionString = "Server=localhost;Database=TaskManagementDB;Trusted_Connection=True;";
             conn.Open();
             SqlCommand cmd = new SqlCommand();
             cmd.Connection = conn;
@@ -85,6 +85,9 @@ namespace STS
             DataTable dt = ds.Tables["STM"];
             dataGridView1.DataSource = dt;
             conn.Close();
+
+            //默认不选中任何行
+            dataGridView1.ClearSelection();
         }
 
         //鼠标右键单击某行,触发事件
@@ -115,8 +118,6 @@ namespace STS
                 return;
             }
             //数据库连接
-            SqlConnection conn = new SqlConnection();
-            conn.ConnectionString = "Server=localhost;Database=TaskManagementDB;Trusted_Connection=True;";
             conn.Open();
             SqlCommand cmd = new SqlCommand();
             cmd.Connection = conn;
@@ -143,8 +144,6 @@ namespace STS
             int crindex = dataGridView1.CurrentRow.Index;
             string barcode = dataGridView1.Rows[crindex].Cells["Barcode_DGV"].Value.ToString();
 
-            SqlConnection conn = new SqlConnection();
-            conn.ConnectionString = "Server=localhost;Database=TaskManagementDB;Trusted_Connection=True;";
             conn.Open();
             SqlCommand cmd = new SqlCommand();
             cmd.Connection = conn;
@@ -162,5 +161,17 @@ namespace STS
                 MessageBox.Show("任务状态更新失败!");
             }
         }
+        //单击“新增任务”新建窗口
+        private void insert_btn1_Click(object sender, EventArgs e)
+        {
+            Form2 form2 = new Form2();
+            form2.Form2Closed += Form2_Form2Closed ;
+            form2.ShowDialog();
+        }
+        //Form2关闭时触发事件
+        private void Form2_Form2Closed(object sender, EventArgs e)
+        {
+            showAllInformation();
+        }
     }
 }
diff --git a/STS/Form2.Designer.cs b/STS/Form2.Designer.cs
new file mode 100644
index 0000000..ccc3786
--- /dev/null
+++ b/STS/Form2.Designer.cs
@@ -0,0 +1,345 @@
+namespace STS
+{
+    partial class Form2
+    {
+        /// <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.barcode_tb = new System.Windows.Forms.TextBox();
+            this.STI_tb = new System.Windows.Forms.TextBox();
+            this.taskType_tb = new System.Windows.Forms.TextBox();
+            this.RTI_tb = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.label6 = new System.Windows.Forms.Label();
+            this.startPoint_tb = new System.Windows.Forms.TextBox();
+            this.endPoint_tb = new System.Windows.Forms.TextBox();
+            this.startLocation_tb = new System.Windows.Forms.TextBox();
+            this.endLocation_tb = new System.Windows.Forms.TextBox();
+            this.taskStatus_tb = new System.Windows.Forms.TextBox();
+            this.errorInfor_tb = new System.Windows.Forms.TextBox();
+            this.label7 = new System.Windows.Forms.Label();
+            this.label8 = new System.Windows.Forms.Label();
+            this.label9 = new System.Windows.Forms.Label();
+            this.label10 = new System.Windows.Forms.Label();
+            this.label11 = new System.Windows.Forms.Label();
+            this.label12 = new System.Windows.Forms.Label();
+            this.jobType_cbb = new System.Windows.Forms.ComboBox();
+            this.button1 = new System.Windows.Forms.Button();
+            this.startTime_dtp = new System.Windows.Forms.DateTimePicker();
+            this.SuspendLayout();
+            // 
+            // barcode_tb
+            // 
+            this.barcode_tb.Location = new System.Drawing.Point(124, 46);
+            this.barcode_tb.Name = "barcode_tb";
+            this.barcode_tb.Size = new System.Drawing.Size(234, 25);
+            this.barcode_tb.TabIndex = 0;
+            // 
+            // STI_tb
+            // 
+            this.STI_tb.Location = new System.Drawing.Point(124, 108);
+            this.STI_tb.Name = "STI_tb";
+            this.STI_tb.Size = new System.Drawing.Size(234, 25);
+            this.STI_tb.TabIndex = 0;
+            // 
+            // taskType_tb
+            // 
+            this.taskType_tb.Location = new System.Drawing.Point(124, 169);
+            this.taskType_tb.Name = "taskType_tb";
+            this.taskType_tb.Size = new System.Drawing.Size(234, 25);
+            this.taskType_tb.TabIndex = 0;
+            // 
+            // RTI_tb
+            // 
+            this.RTI_tb.Location = new System.Drawing.Point(434, 108);
+            this.RTI_tb.Name = "RTI_tb";
+            this.RTI_tb.Size = new System.Drawing.Size(234, 25);
+            this.RTI_tb.TabIndex = 0;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(124, 24);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(37, 15);
+            this.label1.TabIndex = 1;
+            this.label1.Text = "条码";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(124, 86);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(97, 15);
+            this.label2.TabIndex = 1;
+            this.label2.Text = "调度任务索引";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(124, 147);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(67, 15);
+            this.label3.TabIndex = 1;
+            this.label3.Text = "任务类型";
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label4.Location = new System.Drawing.Point(434, 24);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(67, 15);
+            this.label4.TabIndex = 1;
+            this.label4.Text = "开始时间";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(434, 86);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(97, 15);
+            this.label5.TabIndex = 1;
+            this.label5.Text = "关联任务索引";
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label6.Location = new System.Drawing.Point(431, 147);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(67, 15);
+            this.label6.TabIndex = 1;
+            this.label6.Text = "作业类型";
+            // 
+            // startPoint_tb
+            // 
+            this.startPoint_tb.Location = new System.Drawing.Point(124, 227);
+            this.startPoint_tb.Name = "startPoint_tb";
+            this.startPoint_tb.Size = new System.Drawing.Size(234, 25);
+            this.startPoint_tb.TabIndex = 0;
+            // 
+            // endPoint_tb
+            // 
+            this.endPoint_tb.Location = new System.Drawing.Point(124, 289);
+            this.endPoint_tb.Name = "endPoint_tb";
+            this.endPoint_tb.Size = new System.Drawing.Size(234, 25);
+            this.endPoint_tb.TabIndex = 0;
+            // 
+            // startLocation_tb
+            // 
+            this.startLocation_tb.Location = new System.Drawing.Point(434, 227);
+            this.startLocation_tb.Name = "startLocation_tb";
+            this.startLocation_tb.Size = new System.Drawing.Size(234, 25);
+            this.startLocation_tb.TabIndex = 0;
+            // 
+            // endLocation_tb
+            // 
+            this.endLocation_tb.Location = new System.Drawing.Point(434, 289);
+            this.endLocation_tb.Name = "endLocation_tb";
+            this.endLocation_tb.Size = new System.Drawing.Size(234, 25);
+            this.endLocation_tb.TabIndex = 0;
+            // 
+            // taskStatus_tb
+            // 
+            this.taskStatus_tb.Location = new System.Drawing.Point(124, 350);
+            this.taskStatus_tb.Name = "taskStatus_tb";
+            this.taskStatus_tb.Size = new System.Drawing.Size(234, 25);
+            this.taskStatus_tb.TabIndex = 0;
+            // 
+            // errorInfor_tb
+            // 
+            this.errorInfor_tb.Location = new System.Drawing.Point(434, 350);
+            this.errorInfor_tb.Name = "errorInfor_tb";
+            this.errorInfor_tb.Size = new System.Drawing.Size(234, 25);
+            this.errorInfor_tb.TabIndex = 0;
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label7.Location = new System.Drawing.Point(124, 205);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(37, 15);
+            this.label7.TabIndex = 1;
+            this.label7.Text = "起点";
+            // 
+            // label8
+            // 
+            this.label8.AutoSize = true;
+            this.label8.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label8.Location = new System.Drawing.Point(124, 267);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(37, 15);
+            this.label8.TabIndex = 1;
+            this.label8.Text = "终点";
+            // 
+            // label9
+            // 
+            this.label9.AutoSize = true;
+            this.label9.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label9.Location = new System.Drawing.Point(434, 205);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(67, 15);
+            this.label9.TabIndex = 1;
+            this.label9.Text = "起点货位";
+            // 
+            // label10
+            // 
+            this.label10.AutoSize = true;
+            this.label10.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label10.Location = new System.Drawing.Point(434, 267);
+            this.label10.Name = "label10";
+            this.label10.Size = new System.Drawing.Size(67, 15);
+            this.label10.TabIndex = 1;
+            this.label10.Text = "终点货位";
+            // 
+            // label11
+            // 
+            this.label11.AutoSize = true;
+            this.label11.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label11.Location = new System.Drawing.Point(124, 328);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(67, 15);
+            this.label11.TabIndex = 1;
+            this.label11.Text = "任务状态";
+            // 
+            // label12
+            // 
+            this.label12.AutoSize = true;
+            this.label12.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label12.Location = new System.Drawing.Point(434, 328);
+            this.label12.Name = "label12";
+            this.label12.Size = new System.Drawing.Size(67, 15);
+            this.label12.TabIndex = 1;
+            this.label12.Text = "故障信息";
+            // 
+            // jobType_cbb
+            // 
+            this.jobType_cbb.FormattingEnabled = true;
+            this.jobType_cbb.Items.AddRange(new object[] {
+            "移库",
+            "出库",
+            "入库"});
+            this.jobType_cbb.Location = new System.Drawing.Point(434, 171);
+            this.jobType_cbb.Name = "jobType_cbb";
+            this.jobType_cbb.Size = new System.Drawing.Size(234, 23);
+            this.jobType_cbb.TabIndex = 2;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(328, 404);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(131, 34);
+            this.button1.TabIndex = 3;
+            this.button1.Text = "提交";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // startTime_dtp
+            // 
+            this.startTime_dtp.Location = new System.Drawing.Point(434, 46);
+            this.startTime_dtp.Name = "startTime_dtp";
+            this.startTime_dtp.Size = new System.Drawing.Size(234, 25);
+            this.startTime_dtp.TabIndex = 4;
+            // 
+            // Form2
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(800, 450);
+            this.Controls.Add(this.startTime_dtp);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.jobType_cbb);
+            this.Controls.Add(this.label12);
+            this.Controls.Add(this.label6);
+            this.Controls.Add(this.label11);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.label10);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.label9);
+            this.Controls.Add(this.label4);
+            this.Controls.Add(this.label8);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label7);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.errorInfor_tb);
+            this.Controls.Add(this.taskStatus_tb);
+            this.Controls.Add(this.endLocation_tb);
+            this.Controls.Add(this.taskType_tb);
+            this.Controls.Add(this.startLocation_tb);
+            this.Controls.Add(this.RTI_tb);
+            this.Controls.Add(this.endPoint_tb);
+            this.Controls.Add(this.startPoint_tb);
+            this.Controls.Add(this.STI_tb);
+            this.Controls.Add(this.barcode_tb);
+            this.Name = "Form2";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "新增任务";
+            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form2_FormClosed);
+            this.Load += new System.EventHandler(this.Form2_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox barcode_tb;
+        private System.Windows.Forms.TextBox STI_tb;
+        private System.Windows.Forms.TextBox taskType_tb;
+        private System.Windows.Forms.TextBox RTI_tb;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.TextBox startPoint_tb;
+        private System.Windows.Forms.TextBox endPoint_tb;
+        private System.Windows.Forms.TextBox startLocation_tb;
+        private System.Windows.Forms.TextBox endLocation_tb;
+        private System.Windows.Forms.TextBox taskStatus_tb;
+        private System.Windows.Forms.TextBox errorInfor_tb;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.Label label10;
+        private System.Windows.Forms.Label label11;
+        private System.Windows.Forms.Label label12;
+        private System.Windows.Forms.ComboBox jobType_cbb;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.DateTimePicker startTime_dtp;
+    }
+}
\ No newline at end of file
diff --git a/STS/Form2.cs b/STS/Form2.cs
new file mode 100644
index 0000000..5d32ac0
--- /dev/null
+++ b/STS/Form2.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Data.SqlClient;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace STS
+{
+    public partial class Form2 : Form
+    {
+        private SqlConnection conn2;
+        public event EventHandler Form2Closed;
+        public Form2()
+        {
+            InitializeComponent();
+        }
+        private void Form2_Load(object sender, EventArgs e)
+        {
+            //设置默认值
+            taskType_tb.Text = "调度任务";
+            jobType_cbb.SelectedIndex = 0;
+            RTI_tb.Text = "-1";
+            taskStatus_tb.Text = "开始执行";
+
+            conn2 = new SqlConnection();
+            conn2.ConnectionString = "Server=localhost;Database=TaskManagementDB;Trusted_Connection=True;";
+        }
+        //判断字符串后5位是否为数字
+        private bool isDigit(string str)
+        {
+            if (str.Length != 6)
+            {
+                return false;
+            }
+            for (int i = 1; i < str.Length; i++)
+            {
+                if (str[i] < '0' || str[i] > '9')
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+        private void button1_Click(object sender, EventArgs e)
+        {
+
+            //判断条码格式是否正确
+            if (barcode_tb.Text.Equals(""))
+            {
+                MessageBox.Show("条码不能为空!"); return;
+            }
+            if (barcode_tb.Text[0].ToString() != "T" || !isDigit(barcode_tb.Text.ToString()))
+            {
+                MessageBox.Show("条码格式错误!\n应以T开头后面跟5个数字"); return;
+            }
+            conn2.Open();
+            SqlCommand cmd = new SqlCommand();
+            cmd.Connection = conn2;
+            cmd.CommandText = $"insert into STM values('{barcode_tb.Text}','{STI_tb.Text}','{RTI_tb.Text}','{taskType_tb.Text}'," +
+                                                    $"'{jobType_cbb.Text}','{startPoint_tb.Text}','{startLocation_tb.Text}','{endPoint_tb.Text}'," +
+                                                    $"'{endLocation_tb.Text}','{taskStatus_tb.Text}','{startTime_dtp.Text}','{errorInfor_tb.Text}')";
+            Console.WriteLine(cmd.CommandText);
+            int count = cmd.ExecuteNonQuery();
+            if (count > 0)
+            {
+                MessageBox.Show("提交成功!");
+                //关闭该窗口
+                this.Close();
+            }
+            else
+            {
+                MessageBox.Show("提交失败!");
+            }
+            conn2.Close();
+        }
+        //关闭窗口时触发事件
+        private void Form2_FormClosed(object sender, FormClosedEventArgs e)
+        {
+            Form2Closed?.Invoke(this, EventArgs.Empty);
+        }
+    }
+}
diff --git a/STS/Form2.resx b/STS/Form2.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/STS/Form2.resx
@@ -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>
\ No newline at end of file
diff --git a/STS/STS.csproj b/STS/STS.csproj
index afb28b5..600c4ed 100644
--- a/STS/STS.csproj
+++ b/STS/STS.csproj
@@ -52,11 +52,20 @@
     <Compile Include="Form1.Designer.cs">
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
+    <Compile Include="Form2.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form2.Designer.cs">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Form2.resx">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
diff --git a/STS_Table.sql b/STS_Table.sql
index d466433..8b13789 100644
--- a/STS_Table.sql
+++ b/STS_Table.sql
@@ -1,30 +1 @@
-USE [TaskManagementDB]
-GO
-
-/****** Object:  Table [dbo].[STM]    Script Date: 2024/7/29 9:58:25 ******/
-SET ANSI_NULLS ON
-GO
-
-SET QUOTED_IDENTIFIER ON
-GO
-
-CREATE TABLE [dbo].[STM](
-	[Barcode] [nvarchar](50) NOT NULL,
-	[ScheduledTaskIndex] [nvarchar](50) NULL,
-	[RelatedTaskIndex] [nvarchar](50) NULL,
-	[TaskType] [nvarchar](50) NULL,
-	[JobType] [nvarchar](50) NULL,
-	[StartPoint] [nvarchar](50) NULL,
-	[StartLocation] [nvarchar](50) NULL,
-	[EndPoint] [nvarchar](50) NULL,
-	[EndLocation] [nvarchar](50) NULL,
-	[TaskStatus] [nvarchar](50) NULL,
-	[StartTime] [nvarchar](50) NULL,
-	[ErrorInformation] [nvarchar](50) NULL,
- CONSTRAINT [PK_STM] PRIMARY KEY CLUSTERED 
-(
-	[Barcode] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO