当前位置:网站首页>6、 Implementation of warehouse out management function
6、 Implementation of warehouse out management function
2022-06-13 01:41:00 【Beyond proverb】
One 、 The establishment of database
Still used here yy_textile surface
stay fiber_yy Create... Under database yy_textile surface 

Initial database information 
Two 、 Page perfection
I won't show you on the login page , The previous blog posts also introduced
shipment Issue management page 
main_page The function of the page is improved 
3、 ... and 、 Code implementation
shipment Issue management page
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
namespace fiber_yy
{
public partial class shipment : Form
{
private DataSet dsall;
public string constr = "server=CY-20190824RMES;Initial Catalog=fiber_yy;User ID=sa;pwd=beyond";
private SqlDataAdapter mDataAdapter;
public shipment()
{
InitializeComponent();
try
{
SqlConnection conn = new SqlConnection(constr);
conn = new SqlConnection(constr);
mDataAdapter = new SqlDataAdapter("SELECT name AS ' Name of textile ',number AS ' Textile product No ',warp_density AS ' Density ' ,weft_density AS ' Weft density ',warp_linear_density AS ' Warp yarn density ',weft_linear_density AS ' Weft yarn density ',material AS ' Ingredients ',square_meter_weight AS ' Weight per square meter ',width_of_cloth AS ' width of cloth ',horse_length AS ' Horse length ',organization AS ' Organization used ',stock AS ' Inventory ' FROM yy_textile", conn);
dsall = new DataSet();
mDataAdapter.Fill(dsall, "hard");
dataGridView1.DataSource = dsall.Tables["hard"];
}
catch
{
MessageBox.Show(" Read failed , Please check if the fabric is present ");
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection conn = new SqlConnection(constr);
conn = new SqlConnection(constr);
mDataAdapter = new SqlDataAdapter("SELECT name AS ' Name of textile ',number AS ' Textile product No ',warp_density AS ' Density ' ,weft_density AS ' Weft density ',warp_linear_density AS ' Warp yarn density ',weft_linear_density AS ' Weft yarn density ',material AS ' Ingredients ',square_meter_weight AS ' Weight per square meter ',width_of_cloth AS ' width of cloth ',horse_length AS ' Horse length ',organization AS ' Organization used ',stock AS ' Inventory ' FROM yy_textile", conn);
dsall = new DataSet();
mDataAdapter.Fill(dsall, "hard");
dataGridView1.DataSource = dsall.Tables["hard"];
}
catch
{
MessageBox.Show(" Read failed ");
}
}
private void button2_Click(object sender, EventArgs e)// View fabric information
{
try
{
string number = textBox1.Text;
byte[] MyData = new byte[0];
string sql = "SELECT stock FROM yy_textile WHERE number='" + number + "'";
SqlConnection conn = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
string account = cmd.ExecuteScalar().ToString();
int a = int.Parse(account);
//MessageBox.Show(a.ToString());
if (a > 100)
{
SqlConnection conn1 = new SqlConnection(constr);
conn1.Open();
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = conn1;
cmd1.CommandText = "select * from yy_textile where number='" + number + "'";
SqlDataReader sdr = cmd1.ExecuteReader();
sdr.Read();
object o = sdr["picture"];
MyData = (byte[])sdr["picture"];// Read the bit stream of the first picture
MemoryStream memoryStream = null;
memoryStream = new MemoryStream(MyData);
pictureBox1.Image = Image.FromStream(memoryStream);// Assign pictures to pictureBox1 Control
MessageBox.Show(" Read successful ");
}
else
{
MessageBox.Show(" Insufficient inventory 100 Please add in time !!!");
}
}
catch
{
MessageBox.Show(" Read failed over");
}
}
private void button3_Click(object sender, EventArgs e)
{
try
{
string sql1;
string number = this.textBox1.Text;
int count = int.Parse(textBox2.Text);
SqlConnection conn = new SqlConnection(constr);
conn = new SqlConnection(constr);
string sql = "SELECT number FROM yy_textile WHERE number='" + number + "'";
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
string amount = cmd.ExecuteScalar().ToString();
int a = int.Parse(amount);
sql1 = "update yy_textile set stock = stock - '" + count + "' where number='" + number + "'";
mDataAdapter = new SqlDataAdapter(sql1, conn);
dsall = new DataSet();
mDataAdapter.Fill(dsall, "hard");
dataGridView1.DataSource = dsall.Tables["hard"];
MessageBox.Show(" Delivery succeeded !!!");
}
catch (Exception ex) {
MessageBox.Show(ex.Message); }
finally
{
}
}
private void button4_Click(object sender, EventArgs e)
{
this.Hide();
new main_page().Show();
}
}
}
main_page page
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;
namespace fiber_yy
{
public partial class main_page : Form
{
public main_page()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(" Quit successfully ");
this.Close();
new Form1().Show();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
new warehousing().Show();
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
new shipment().Show();
}
private void button4_Click(object sender, EventArgs e)
{
this.Close();
new query().Show();
}
}
}
Four 、 Effect demonstration
The program runs 
I won't demonstrate if I register , Please refer to the previous blog posts
from yy_user Find an account and password in the table , Direct user login 

Login successful 
Entry system 
demonstration Warehouse out management function 

View fabric information 
Out of stock 20

retrieval once 
When inventory is below 100 Will remind you when , And at this time, you can no longer leave the warehouse , Additional fabric is needed 
边栏推荐
- Large end storage and small end storage
- Numpy multidimensional array transpose transpose
- Leetcode 01 array
- Tweets movement description and chart display
- Detailed explanation of Joseph problem
- 一种不带CPU的DPU架构:Hyperion
- A problem discovery and attempted solution to the strange stop of server script
- MySQL ---- where后使用字段别名
- Startup, connection and stop of MySQL service
- Explanation and application of prefix sum (one-dimensional, two-dimensional)
猜你喜欢

Implementation and design of JMeter interface test database assertion for CSDN salary increase technology

【斯坦福計網CS144項目】Lab1: StreamReassembler

Temporary objects and compilation optimization

【斯坦福计网CS144项目】Lab1: StreamReassembler

Happy string

Run Presto under docker to access redis and Bi presentation

MySQL related summary

Tweets movement description and chart display

Machine learning basic SVM (support vector machine)

谷歌的受众群体是如何发挥作用的?
随机推荐
Torch. Distributions. Normal
Machine learning basic SVM (support vector machine)
Tweens of phaser3
About constructive code blocks, static code blocks, and constructor execution order
Anims of phaser3
项目实训(十七)---个人工作总结
水管工遊戲
Network communication tcp/ip
一种不带CPU的DPU架构:Hyperion
ES6 deconstruction assignment
Detailed explanation of deep learning parameter adjustment skills
A summary of global variables and typedef
他山之石:a16z 的 Web3 投资版图
Temporary objects and compilation optimization
Traversal of binary tree - first order traversal, middle order traversal, and second order traversal
Differences among bio, NiO and AIO
Introduction to ROS runtime
Transaction characteristics and isolation levels
Stone from another mountain: Web3 investment territory of a16z
Go JWT learning summary