库存管理系统

Posted nianlao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了库存管理系统相关的知识,希望对你有一定的参考价值。

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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}
bool jc;                                                                   三个都为全局变量一个定义    product[] one = new product[10];       产品总数的数组,         strehouse sto = new strehouse(10); 定义仓库数组的产品上限          product[] one = new product[10];

strehouse sto = new strehouse(10);                    i 用来控制是存在产品存方在第几个仓库里
int i = 0;
private void button1_Click(object sender, EventArgs e)
{
one[i] = new product(Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, Convert.ToDouble((textBox4.Text)), Convert.ToInt16(textBox5.Text));                /**产品信息导入添加

sto.add(one[i]);                                                                                                                                                                                                                                         /** 产品数组导入仓库数组
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";

}

private void button2_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
{
priioduct pro1 = sto.getproduct(Convert.ToString(textBox1.Text));
label6.Text = "根据编号查找结果: 编号:" + Convert.ToInt32(pro1.Pid) + " 姓名:" + pro1.Name + " 类型:" +
pro1.Type + " 单价:" + Convert.ToString(pro1.Price) + " 库存量:" + Convert.ToString(pro1.Amount);
};
if (textBox2.Text != "")
{
product pro2 = sto.getproduct(Convert.ToInt16(textBox2.Text));
label6.Text = "根据编号查找结果: 编号:" + Convert.ToInt32(pro2.Pid) + " 姓名:" + pro2.Name + " 类型:" +
pro2.Type + " 单价:" + Convert.ToString(pro2.Price) + " 库存量:" + Convert.ToString(pro2.Amount);
};
     textBox1.Text = "";
           textBox2.Text = "";
           textBox3.Text = "";
           textBox4.Text = "";
           textBox5.Text = "";

}

private void label6_Click(object sender, EventArgs e)
{

}
}
class product
{
private int _pid;             定义product产品信息和产品信息的类成员                

public int Pid           
{
get { return _pid; }                  get set 设置可读可写属性 ctrl+r+e为创建方式 当return出值后,属性为pid get set 上的名字如之前的属性为_pid后get set的名字为Pid后续属性边为Pid
set { _pid = value; }
}
private string _name;

public string Name
{
get { return _name; }
set { _name = value; }
}
private string _type;

public string Type
{
get { return _type; }
set { _type = value; }
}
private double _price;

public double Price
{
get { return _price; }
set { _price = value; }
}
private int _amount;

public int Amount
{
get { return _amount; }
set { _amount = value; }
}
public product(int _pid, string _name, string _type, double _price, int _amount)
{
this._pid = _pid;                                                                                               /**构造函数的初始值对象
this._name = _name;
this._price = _price;
this._type = _type;
this._amount = _amount;
}


}
class strehouse
{
private product[] products;                                /**类成员为其他类型的数组
public int namer;          
public strehouse(int n)        
{
namer = 0;
products = new product[n];                                 /**构造函数初始化**/
}
public bool add(product a)                              
{                                                                                /**产品添加进仓库   numer控制进第几个
products[namer] = a;                        
namer++;
return true;
}
public product getproduct(string name)                 /**重载函数类,自动识别进入的类型从而判断进入何种方式 string为参数 则为string的参数进入
{
bool pi = false;

for (int i = 0; i < namer; i++)
{
if (products[i].Name == name)
{
pi = true;
return products[i];
}
}
if (pi == true)
{
products[namer] = new product(0, "无", "无", 0, 0);
return products[namer];
}
return products[0];


}
public product getproduct(int id)
{
bool pi = false;

for (int i = 0; i < namer; i++)
{
if (products[i].Pid == id)
{
pi = true;
return products[i];
}
}
if (pi == true)
{
products[namer] = new product(0, "无", "无", 0, 0);
return products[namer];
}
return products[0];

}
}
}

以上是关于库存管理系统的主要内容,如果未能解决你的问题,请参考以下文章

BAPI调用 - SAP 库存管理常用BAPI

机械设备行业库存压力大怎么办?应用数商云供应链管理系统实现智能化库存管理

机械设备行业库存压力大怎么办?应用数商云供应链管理系统实现智能化库存管理

设计库存需求预测系统

SAP中MM模块库存管理常用表都有哪些?

实现对库存管理系统的模块化编程