仓库管理仓库管理系统源码.docx
《仓库管理仓库管理系统源码.docx》由会员分享,可在线阅读,更多相关《仓库管理仓库管理系统源码.docx(103页珍藏版)》请在冰点文库上搜索。
仓库管理仓库管理系统源码
(仓库管理)仓库管理系统源码
unitUnit1;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,StdCtrls,DB,ADODB,jpeg,ExtCtrls;
type
TForm1=class(TForm)
ADOConnection1:
TADOConnection;
ADOQuery1:
TADOQuery;
Edit1:
TEdit;
Edit2:
TEdit;
Button1:
TButton;
Button2:
TButton;
ADOTable1:
TADOTable;
Image1:
TImage;
Label1:
TLabel;
Label2:
TLabel;
Label3:
TLabel;
Label4:
TLabel;
Button3:
TButton;
procedureButton1Click(Sender:
TObject);
procedureButton2Click(Sender:
TObject);
procedureButton3Click(Sender:
TObject);
private
{Privatedeclarations}
public
count:
integer;
{Publicdeclarations}
end;
var
Form1:
TForm1;
implementation
usesUnit12,Unit19;
{$R*.dfm}
procedureTForm1.Button1Click(Sender:
TObject);
var
yonghu:
string;
begin
yonghu:
=trim(edit1.Text);//trim去除字符串空格
count:
=count+1;//登陆次数
withadoquery1do
begin
Close;
;
:
='select*from用户信息表where用户名='''+yonghu+'''';
open;
if(adoQuery1.RecordCount<>0)and(edit2.Text<>'')and(adoQuery1.FieldByName('密码').AsString=edit2.Text)then
begin
ifadoQuery1.FieldByName('是否管理员').AsString='True'then
begin
form12.SpeedButton1.Visible:
=true;
form12.Button13.Visible:
=true;
('密码正确,即将进入系统。
','提示',mb_ok);
form1.Hide;
form12.Show;
end
else
begin
form12.SpeedButton1.Visible:
=false;
form12.Button13.Visible:
=false;
('密码正确,即将进入系统。
','提示',mb_ok);
form1.Hide;
form12.Show;
end;
end
else
begin
if(count=1)then
begin
('用户名或密码错误,还剩2次机会','提示',mb_ok);
edit1.SetFocus;//光标是向左对齐的也就是在编辑框的最左边
end;
if(count=2)then
begin
('您还有最后一次机会,请仔细核对用户名和密码','提示',mb_ok);
edit1.Clear;
edit2.clear;
edit1.SetFocus;
end;
if(count=3)then
begin
('密码错误超过三次系统即将关闭','提示',mb_ok);
;//退出程序
end;
end;
end;
end;
procedureTForm1.Button2Click(Sender:
TObject);
begin
;
end;
procedureTForm1.Button3Click(Sender:
TObject);
begin
form19.ShowModal;
end;
End.
unitUnit2;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,StdCtrls,Grids,DBGrids,jpeg,ExtCtrls,DB,ADODB;
type
TForm2=class(TForm)
Image1:
TImage;
Label1:
TLabel;
GroupBox1:
TGroupBox;
DBGrid1:
TDBGrid;
Button1:
TButton;
GroupBox2:
TGroupBox;
GroupBox3:
TGroupBox;
GroupBox4:
TGroupBox;
Label3:
TLabel;
Label4:
TLabel;
Edit1:
TEdit;
Edit2:
TEdit;
Label5:
TLabel;
RadioButton1:
TRadioButton;
RadioButton2:
TRadioButton;
Button2:
TButton;
Label6:
TLabel;
Label7:
TLabel;
Edit3:
TEdit;
RadioButton3:
TRadioButton;
RadioButton4:
TRadioButton;
Button3:
TButton;
ADOConnection1:
TADOConnection;
ADOTable1:
TADOTable;
ADOQuery1:
TADOQuery;
ADOQuery2:
TADOQuery;
DataSource1:
TDataSource;
procedureButton1Click(Sender:
TObject);
procedureButton2Click(Sender:
TObject);
procedureButton3Click(Sender:
TObject);
procedureFormShow(Sender:
TObject);
private
{Privatedeclarations}
public
{Publicdeclarations}
end;
var
Form2:
TForm2;
implementation
{$R*.dfm}
procedureTForm2.Button1Click(Sender:
TObject);
begin
if('请确认是否要删除','超市仓库管理系统',mb_iconinformation+mb_yesno)=idyesthen//MB_ICONINFORMATION是显示出的对话框里会有一个“i”图标,mb_yesno同时显示确定和取消按钮,idyes单击”是“按钮
ADOtable1.Delete;
end;
procedureTForm2.Button2Click(Sender:
TObject);
var
yonghuming,mima:
string;
quanxian:
boolean;
begin
if(edit1.Text<>'')and(edit2.Text<>'')and(radiobutton1.Checkedxorradiobutton2.Checked)then
begin
yonghuming:
=edit1.Text;
adoquery1.Close;
adoquery1.:
='select*from用户信息表where用户名='''+yonghuming+'''';
adoquery1.open;
ifnotadoquery1.Eofthen//判断表是否为空
begin
MessageBox(handle,'此用户名已存在!
','提示',mb_IconInformation+mb_Ok);
exit;
end;
mima:
=edit2.Text;
ifradiobutton1.Checked=truethen
quanxian:
=true
else
quanxian:
=false;
adotable1.InsertRecord([yonghuming,mima,quanxian]);
adotable1.Close;//把ADOTable控件对应的数据源关闭
adotable1.Open;//重新打开ADOTable控件对应的数据源,这样做的目的是刷新数据源
showmessage('新建用户添加成功');
edit1.Clear;
edit2.Clear;
radiobutton1.Checked:
=false;
radiobutton2.Checked:
=false;
end
else
showmessage('信息填写不全');
end;
procedureTForm2.Button3Click(Sender:
TObject);
var
yonghuming:
string;
quanxian:
boolean;
begin
if(edit3.Text<>'')and(radiobutton3.Checkedxorradiobutton4.Checked)then
begin
yonghuming:
=edit3.Text;
adoquery1.Close;
adoquery1.:
='select*from用户信息表where用户名='''+yonghuming+'''';
adoquery1.open;
ifadoquery1.RecordCount=0then
begin
showmessage('不存在此用户,请重新输入');
edit3.SetFocus;
exit;
end;
ifradiobutton3.Checked=truethen
quanxian:
=true
else
quanxian:
=false;
if('请确认是否要修改','超市仓库管理系统',mb_iconinformation+mb_yesno)=idyesthen
begin
adotable1.Locate('用户名',yonghuming,[]);
adotable1.Edit;
adotable1['是否管理员']:
=quanxian;
adotable1.Post;
adotable1.Close;
adotable1.Open;//更改一个已经从数据库中读取的数据库表格
showmessage('修改成功');
end;
end
else
showmessage('信息填写不全');
end;
procedureTForm2.FormShow(Sender:
TObject);
begin
adoconnection1:
=(nil);////动态创建ADO控件
adoconnection1.LoginPrompt:
=false;//如果不加这句的话,每次连接数据库时都会跳出一个身份验证对话框,要求你输入用户名和密码
adoconnection1.Connected:
=false;//释放连接
adoconnection1.ConnectionString:
='Provider=SQLOLEDB.1;PersistSecurityInfo=False;UserID=sa;InitialCatalog=天天;DataSource=WIN-RNSK1TMAK9L';
adoconnection1.Connected:
=true;
adotable1:
=(nil);
adotable1.Connection:
=adoconnection1;
adotable1.TableName:
='用户信息表';
adotable1.Open;
datasource1.DataSet:
=adotable1;
adoquery1:
=(nil);
adoquery1.Connection:
=adoconnection1;
adoquery2:
=(nil);
adoquery2.Connection:
=adoconnection1;
end;
end.
unitUnit3;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,ADODB,DB,StdCtrls,Grids,DBGrids,jpeg,ExtCtrls;
type
TForm3=class(TForm)
GroupBox1:
TGroupBox;
GroupBox2:
TGroupBox;
GroupBox3:
TGroupBox;
Image1:
TImage;
Label1:
TLabel;
DBGrid1:
TDBGrid;
Button1:
TButton;
Button2:
TButton;
Button3:
TButton;
Label2:
TLabel;
Label3:
TLabel;
Label4:
TLabel;
Label5:
TLabel;
Label6:
TLabel;
Label7:
TLabel;
Label8:
TLabel;
Label9:
TLabel;
Label10:
TLabel;
Edit1:
TEdit;
Edit2:
TEdit;
Edit3:
TEdit;
Edit4:
TEdit;
Edit5:
TEdit;
Edit6:
TEdit;
Edit7:
TEdit;
ComboBox1:
TComboBox;
ComboBox2:
TComboBox;
Label11:
TLabel;
ComboBox3:
TComboBox;
Edit8:
TEdit;
Button4:
TButton;
Button5:
TButton;
Button6:
TButton;
ADOConnection1:
TADOConnection;
ADOTable1:
TADOTable;
DataSource1:
TDataSource;
ADOQuery1:
TADOQuery;
procedureButton2Click(Sender:
TObject);
procedureButton1Click(Sender:
TObject);
procedureButton3Click(Sender:
TObject);
procedureButton4Click(Sender:
TObject);
procedureButton5Click(Sender:
TObject);
procedureButton6Click(Sender:
TObject);
procedureFormShow(Sender:
TObject);
private
{Privatedeclarations}
public
{Publicdeclarations}
end;
var
Form3:
TForm3;
implementation
{$R*.dfm}
procedureTForm3.FormShow(Sender:
TObject);
begin
adoconnection1:
=(nil);
adoconnection1.LoginPrompt:
=false;
adoconnection1.Connected:
=false;
adoconnection1.ConnectionString:
='Provider=SQLOLEDB.1;Password=411114;PersistSecurityInfo=True;UserID=sa;InitialCatalog=天天;DataSource=win-rnsk1tmak9l';
adoconnection1.Connected:
=true;
adotable1:
=(nil);
adotable1.Connection:
=adoconnection1;
adotable1.TableName:
='商品信息表';
adotable1.Open;
datasource1.DataSet:
=adotable1;
adoquery1:
=(nil);
adoquery1.Connection:
=adoconnection1;
adoquery1.Close;
adoquery1.;
adoquery1.:
='select仓库名称from仓库信息表';
adoquery1.Open;
whilenotadoquery1.Eofdo
begin
bobox2.(adoquery1['仓库名称']);
adoquery1.Next;
end;
end;
procedureTForm3.Button2Click(Sender:
TObject);
begin
adotable1.Edit;
end;
procedureTForm3.Button1Click(Sender:
TObject);
begin
if('确定要删除?
','超市仓库管理系统',mb_iconinformation+mb_yesno)=idyesthen
begin
adotable1.Delete;
showmessage('删除成功');
end;
end;
procedureTForm3.Button3Click(Sender:
TObject);
begin
adotable1.Post;
showmessage('修改成功');
end;
procedureTForm3.Button4Click(Sender:
TObject);
var
temp:
string;
juti:
string;
begin
juti:
=edit8.Text;
if(bobox3.Text<>'')and(edit8.Text<>'')then
begin
if(bobox3.ItemIndex=0)then//ItemIndex=0列表标号从0开始
begin
adotable1.Filtered:
=false;
adotable1.Filter:
='商品编号='''+juti+'''';
adotable1.Filtered:
=true;
end;
if(bobox3.ItemIndex=1)then
begin
adotable1.Filtered:
=false;//解除过滤
temp:
=trim('%'+juti+'%');
adotable1.Filter:
='商品名称like'''+temp+'''';
adotable1.Filtered:
=true;
end;
if(bobox3.ItemIndex=2)then
begin
adotable1.Filtered:
=false;
adotable1.Filter:
='型号='''+juti+'''';
adotable1.Filtered:
=true;
end;
if(bobox3.ItemIndex=3)then
begin
adotable1.Filtered:
=false;
adotable1.Filter:
='仓库名称='''+juti+'''';
adotable1.Filtered:
=true;
end;
end;
end;
procedureTForm3.Button5Click(Sender:
TObject);
begin
adotable1.Filtered:
=false;
adotable1.Close;
adotable1.Open;
end;
procedureTForm3.Button6Click(Sender:
TObject);
begin
if(edit1.Text<>'')and(edit2.Text<>'')and(edit3.Text<>'')and(edit4.Text<>'')and(edit5.Text<>'')and(edit6.Text<>'')and(edit7.Text<>'')and(bobox1.Text<>'')and(bobox2.Text<>'')then
begin
if('确定要添加?
','超市仓库管理系统',mb_iconinformation+mb_yesno)=idyesthen
begin
adotable1.InsertRecord([edit1.Text,edit2.Text,edit3.Text,bobox1.Text,edit4.Text,edit5.Text,bobox2.Text,edit6.Text,edit7.Text]);
adotable1.Close;
adotable1.Open;
showmessage('新商品添加成功');
end;
end
else
showmessage('信息未填全');
end;
Unit4;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,ADODB,DB,StdCtrls,Grids,DBGrids,jpeg,ExtCtrls;
type
TForm4=class(TForm)
Image1:
TImage;
Label1:
TLabel;
GroupBox1:
TGroupBox;
GroupBox2:
TGroupBox;
DBGrid1:
TDBGrid;
DBGrid2:
TDBGrid;
Button1:
TButton;
Button2:
TButton;
Button3:
TButton;
Button4:
TButton;
Edit1:
TEdit;
Edit2:
TEdit;
Edit3:
TEdit;
Edit4:
TEdit;
Edit5:
TEdit;
DataSource1:
TDataSource;
DataSource2:
TDataSource;
ADOConnection1:
TADOConnection;
ADOTable1:
TADOTable;
ADOQuery1:
TADOQuery;
ADOQuery2:
TADOQuery;
ADOQuery3:
TADOQuery;
Label2:
TLabel;
Label3:
TLabel;
Label4:
TLabel;
Label5:
TLabel;
Label6:
TLabel;
procedureButton1Click(Sender:
TObject);
procedureButton2Click(Sender:
TObject);
procedureButton3Click(Sender:
TObject);
procedureButton4Click(Sender:
TObject);
procedureEdit3KeyUp(Sender:
TObject;varKey:
Word;
Shift:
TShiftState);
procedureDBGrid1CellClick(Column:
TColumn);