📄 goodsgz_form.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace test007
{
/// <summary>
/// goodsgz_Form 的摘要说明。
/// </summary>
public class goodsgz_Form : System.Windows.Forms.Form
{
private LinkDataBase link = new LinkDataBase();
private DataTable temptable1=new DataTable();
private DataTable temptable2=new DataTable();
private DataTable temptable3=new DataTable();
private static string connectionString = "workstation id=localhost;Integrated Security=SSPI;database=logistics";
private SqlConnection myConnection=new SqlConnection(connectionString);
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button button3;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public goodsgz_Form()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 96);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(120, 24);
this.label1.TabIndex = 1;
this.label1.Text = "此订单运输路线为:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 192);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(168, 32);
this.label2.TabIndex = 2;
this.label2.Text = "目前已经到达的配送点为:";
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 11F);
this.label3.Location = new System.Drawing.Point(24, 32);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 24);
this.label3.TabIndex = 3;
this.label3.Text = "订单编号:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(112, 32);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(168, 21);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(336, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(136, 32);
this.button1.TabIndex = 5;
this.button1.Text = "货物跟踪";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label4
//
this.label4.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label4.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.ForeColor = System.Drawing.Color.Red;
this.label4.Location = new System.Drawing.Point(24, 240);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(528, 40);
this.label4.TabIndex = 6;
//
// label5
//
this.label5.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label5.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label5.Location = new System.Drawing.Point(24, 128);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(528, 48);
this.label5.TabIndex = 7;
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 32);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(96, 16);
this.label6.TabIndex = 8;
this.label6.Text = "收到回执单后,";
//
// button2
//
this.button2.Location = new System.Drawing.Point(40, 64);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(192, 32);
this.button2.TabIndex = 9;
this.button2.Text = "将此订单列为已完成订单";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label3,
this.textBox1,
this.button1});
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(560, 80);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
//
// groupBox2
//
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button2,
this.label6});
this.groupBox2.Location = new System.Drawing.Point(304, 296);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(272, 112);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
//
// groupBox3
//
this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button3,
this.label7});
this.groupBox3.Location = new System.Drawing.Point(8, 296);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(280, 112);
this.groupBox3.TabIndex = 12;
this.groupBox3.TabStop = false;
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 32);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(176, 24);
this.label7.TabIndex = 0;
this.label7.Text = "收到配送员的到货消息后,";
//
// button3
//
this.button3.Location = new System.Drawing.Point(40, 64);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(208, 32);
this.button3.TabIndex = 1;
this.button3.Text = "货物到达当前配送点";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// goodsgz_Form
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(584, 413);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBox3,
this.groupBox2,
this.groupBox1,
this.label5,
this.label4,
this.label2,
this.label1});
this.Name = "goodsgz_Form";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "货物跟踪与运输管理";
this.Load += new System.EventHandler(this.goodsgz_Form_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void goodsgz_Form_Load(object sender, System.EventArgs e)
{
if(notfinish_orderForm.flog1)
this.textBox1.Text=notfinish_orderForm.ordernumber;
else
this.textBox1.Text="";
}
private void button1_Click(object sender, System.EventArgs e)
{
string orderform=this.textBox1.Text.Trim();
int ordernum=System.Int32.Parse(orderform);
try //调用存储过程
{
string tempPRD="exec PRD_VIEW '"+ordernum+"'";
this.link.UpdateDataBase(tempPRD);
}
catch
{
MessageBox.Show("错误产生!!!!","提示");
}
Console.Write("成功");
string sendSQL1="select 节点名称 from pragh_temp";
temptable1=this.link.SelectDataBase(sendSQL1);
string 运输路线="";
for(int i=0;i<temptable1.Rows.Count-1;i++)
{
运输路线+=temptable1.Rows[i][0].ToString().Trim()+"--";
}
运输路线+=temptable1.Rows[temptable1.Rows.Count-1][0].ToString().Trim();
this.label5.Text=运输路线;
string sendSQL2="select 节点名称 from pragh_temp where 标志='1'";
temptable2=this.link.SelectDataBase(sendSQL2);
string 已到达地点="";
for(int i=0;i<temptable2.Rows.Count-1;i++)
{
已到达地点+=temptable2.Rows[i][0].ToString().Trim()+"--";
}
已到达地点+=temptable2.Rows[temptable2.Rows.Count-1][0].ToString().Trim();
this.label4.Text=已到达地点;
}
private void button2_Click(object sender, System.EventArgs e)
{
string orderform1=this.textBox1.Text.Trim();
int ordernum1=System.Int32.Parse(orderform1);
bool flog=false;
string sendSQL3="select 订单编号 from return_receipt";
temptable3=this.link.SelectDataBase(sendSQL3);
for(int i=0;i<temptable3.Rows.Count;i++)
{
if(orderform1==temptable3.Rows[i][0].ToString().Trim())
flog=true;
else
flog=false;
}
if(this.label4.Text==this.label5.Text)
{
if(flog)
{
try //调用存储过程
{
string tempPRD2="exec PRD_weidaoyi '"+ordernum1+"'";
this.link.UpdateDataBase(tempPRD2);
}
catch
{
MessageBox.Show("错误产生!!!!","提示");
}
MessageBox.Show("已经成功将此订单设为已完成订单!!:)","提示");
}
else
MessageBox.Show("还未收到收货方的回执单,无法将此订单加入已完成订单!!","提示");
}
else
{
MessageBox.Show("该订单的运输并未完成!!","提示");
}
}
private void button3_Click(object sender, System.EventArgs e)
{
string order_n=this.textBox1.Text.Trim();
int order_number=System.Int32.Parse(order_n);
try //调用存储过程
{
string tempPRD1="exec PRD_VIEW '"+order_number+"'";
this.link.UpdateDataBase(tempPRD1);
}
catch
{
MessageBox.Show("错误产生!!!!","提示");
}
try //调用存储过程
{
string tempPRD2="exec PRD_update '"+order_number+"'";
this.link.UpdateDataBase(tempPRD2);
}
catch
{
MessageBox.Show("错误产生!!!!","提示");
}
MessageBox.Show("成功修改该订单的运输状态!!!","提示");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -