当前位置:网站首页>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 
边栏推荐
- Implementation and design of JMeter interface test database assertion for CSDN salary increase technology
- 兴趣相似的受众群体
- Work and life
- Leetcode question brushing 02 linked list operation
- 开发者来稿|AMD赛灵思中文论坛分享 - 提问的智慧
- [pytorch FAQ] numpy:dll load failed while importing_ multiarray_ Umath: the specified module could not be found.
- Web Application & applet application deployment
- Design of distributed game server
- Wildcard usage of go standard library FMT
- 关于tkinter.Canvas 不显示图片的问题
猜你喜欢

My crawler learning notes

谷歌的受众群体是如何发挥作用的?

路径字段是什么? ——竞价广告
![[andoid][step pit]cts 11_ Testbootclasspathandsystemserverclasspath at the beginning of R3_ Analysis of nonduplicateclasses fail](/img/b5/7ea603775dc0448368d209de037a43.png)
[andoid][step pit]cts 11_ Testbootclasspathandsystemserverclasspath at the beginning of R3_ Analysis of nonduplicateclasses fail

Leetcode question brushing 02 linked list operation
![[wsl2]wsl2 migrate virtual disk file ext4 vhdx](/img/e9/4e08e07c2de2f99c2938e79f7f1c44.png)
[wsl2]wsl2 migrate virtual disk file ext4 vhdx

Plumber game

Happy string

leetcode743. 网络延迟时间(中等, dijkstra)

C language implementation of the classic eight queens problem
随机推荐
[official document summary] writing standards for academic dissertations of National University of science and technology
About retrieving ignored files in cornerstone
Stone from another mountain: Web3 investment territory of a16z
Page optimization - Notes
leetcode743. 网络延迟时间(中等, dijkstra)
Auto commit attribute of MySQL
This of phaser3 add. sprite
Leetcode 01 array
水管工游戏
QT color extraction
Torch. Distributions. Normal
A summary of global variables and typedef
Reinstall opencv and step on the pit.
Should the audience choose observation mode or positioning mode?
Note: common gadgets in project architecture
Detailed explanation of audience characteristics
The storage structure of a tree can adopt the parent representation, that is, the parent pointer array representation. Try to give the corresponding class definition. Each tree node contains two membe
Answer to matrix theory of Nanjing University of Aeronautics and Astronautics
Web Application & applet application deployment
leetcode743. Network latency (medium, Dijkstra)