仓库管理系统delphi源码(DOC68页).doc_第1页
仓库管理系统delphi源码(DOC68页).doc_第2页
仓库管理系统delphi源码(DOC68页).doc_第3页
仓库管理系统delphi源码(DOC68页).doc_第4页
仓库管理系统delphi源码(DOC68页).doc_第5页
已阅读5页,还剩63页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

unit Unit1;interfaceuses 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; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private Private declarations public count:integer; Public declarations end;var Form1: TForm1;implementationuses Unit12,Unit19;$R *.dfmprocedure TForm1.Button1Click(Sender: TObject); var yonghu:string;begin yonghu:=trim(edit1.Text);/trim去除字符串空格 count:=count+1;/登陆次数 with adoquery1 do begin Close; SQL.Clear; SQL.text:=select * from 用户信息表 where 用户名=+yonghu+; open; if (adoQuery1.RecordCount0) and (edit2.Text) and (adoQuery1.FieldByName(密码).AsString= edit2.Text) then begin if adoQuery1.FieldByName(是否管理员).AsString =True then begin form12.SpeedButton1.Visible:=true; form12.Button13.Visible:=true; application.MessageBox(密码正确,即将进入系统。,提示,mb_ok); form1.Hide; form12.Show; end else begin form12.SpeedButton1.Visible:=false; form12.Button13.Visible:=false; application.MessageBox(密码正确,即将进入系统。,提示,mb_ok); form1.Hide; form12.Show; end; end else begin if (count=1) then begin application.MessageBox(用户名或密码错误,还剩2次机会,提示,mb_ok); edit1.SetFocus;/光标是向左对齐的 也就是在编辑框的最左边 end; if(count=2) then begin application.MessageBox(您还有最后一次机会,请仔细核对用户名和密码,提示,mb_ok); edit1.Clear; edit2.clear; edit1.SetFocus; end; if (count=3) then begin application.MessageBox(密码错误超过三次系统即将关闭,提示,mb_ok); application.Terminate;/退出程序 end; end; end;end;procedure TForm1.Button2Click(Sender: TObject);begin application.Terminate;end;procedure TForm1.Button3Click(Sender: TObject);begin form19.ShowModal;end;End.unit Unit2;interfaceuses 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; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormShow(Sender: TObject); private Private declarations public Public declarations end;var Form2: TForm2;implementation$R *.dfmprocedure TForm2.Button1Click(Sender: TObject);begin if application.MessageBox(请确认是否要删除, 超市仓库管理系统, mb_iconinformation +mb_yesno) = idyes then/MB_ICONINFORMATION是显示出的对话框里会有一个“i”图标,mb_yesno同时显示确定和取消按钮,idyes单击”是“按钮 ADOtable1.Delete;end;procedure TForm2.Button2Click(Sender: TObject);var yonghuming,mima:string; quanxian:boolean;begin if (edit1.Text) and (edit2.Text) and (radiobutton1.Checked xor radiobutton2.Checked) then begin yonghuming:=edit1.Text; adoquery1.Close; adoquery1.SQL.Text := select * from 用户信息表 where 用户名= +yonghuming+ ; adoquery1.open; if not adoquery1.Eof then/判断表是否为空 begin MessageBox(handle, 此用户名已存在!, 提示, mb_IconInformation + mb_Ok); exit; end; mima:=edit2.Text; if radiobutton1.Checked=true then 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;procedure TForm2.Button3Click(Sender: TObject);var yonghuming:string; quanxian:boolean;begin if (edit3.Text) and (radiobutton3.Checked xor radiobutton4.Checked) then begin yonghuming:=edit3.Text; adoquery1.Close; adoquery1.SQL.Text := select * from 用户信息表 where 用户名= +yonghuming+ ; adoquery1.open; if adoquery1.RecordCount = 0 then begin showmessage(不存在此用户,请重新输入); edit3.SetFocus; exit; end; if radiobutton3.Checked=true then quanxian:=true else quanxian:=false; if application.MessageBox(请确认是否要修改, 超市仓库管理系统, mb_iconinformation + mb_yesno) = idyes then begin adotable1.Locate(用户名,yonghuming,); adotable1.Edit; adotable1是否管理员:=quanxian; adotable1.Post; adotable1.Close; adotable1.Open;/更改一个已经从数据库中读取的数据库表格 showmessage(修改成功); end; end else showmessage(信息填写不全);end; procedure TForm2.FormShow(Sender: TObject);beginadoconnection1:=TADOConnection.Create(nil);/动态创建ADO控件adoconnection1.LoginPrompt:=false;/如果不加这句的话,每次连接数据库时都会跳出一个身份验证对话框,要求你输入用户名和密码adoconnection1.Connected:=false;/释放连接adoconnection1.ConnectionString:=Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=天天;Data Source=WIN-RNSK1TMAK9L;adoconnection1.Connected:=true;adotable1:=TADOTable.Create(nil);adotable1.Connection:=adoconnection1;adotable1.TableName:=用户信息表;adotable1.Open;datasource1.DataSet:=adotable1;adoquery1:=TADOQuery.Create(nil);adoquery1.Connection:=adoconnection1;adoquery2:=TADOQuery.Create(nil);adoquery2.Connection:=adoconnection1;end;end.unit Unit3;interfaceuses 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; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure FormShow(Sender: TObject); private Private declarations public Public declarations end;var Form3: TForm3;implementation$R *.dfm procedure TForm3.FormShow(Sender: TObject);begin adoconnection1:=TADOConnection.Create(nil);adoconnection1.LoginPrompt:=false;adoconnection1.Connected:=false;adoconnection1.ConnectionString:=Provider=SQLOLEDB.1;Password=411114;Persist Security Info=True;User ID=sa;Initial Catalog=天天;Data Source=win-rnsk1tmak9l;adoconnection1.Connected:=true;adotable1:=TADOTable.Create(nil);adotable1.Connection:=adoconnection1;adotable1.TableName:=商品信息表;adotable1.Open;datasource1.DataSet:=adotable1;adoquery1:=TADOQuery.Create(nil);adoquery1.Connection:=adoconnection1;adoquery1.Close;adoquery1.SQL.Clear;adoquery1.SQL.Text:=select 仓库名称 from 仓库信息表;adoquery1.Open; while not adoquery1.Eof do begin combobox2.Items.Add(adoquery1仓库名称); adoquery1.Next; end;end;procedure TForm3.Button2Click(Sender: TObject);begin adotable1.Edit;end;procedure TForm3.Button1Click(Sender: TObject);begin if application.MessageBox(确定要删除?, 超市仓库管理系统, mb_iconinformation + mb_yesno) = idyes thenbegin adotable1.Delete; showmessage(删除成功); end;end;procedure TForm3.Button3Click(Sender: TObject);begin adotable1.Post; showmessage(修改成功);end;procedure TForm3.Button4Click(Sender: TObject); vartemp:string; juti:string;begin juti:=edit8.Text; if(combobox3.Text)and(edit8.Text) then begin if (combobox3.ItemIndex=0) then/ItemIndex=0列表标号从0开始 begin adotable1.Filtered:=false; adotable1.Filter:=商品编号=+juti+; adotable1.Filtered:=true; end; if (combobox3.ItemIndex=1) then begin adotable1.Filtered:=false;/ 解除过滤 temp:=trim(%+juti+%); adotable1.Filter:=商品名称 like +temp+; adotable1.Filtered:=true; end; if (combobox3.ItemIndex=2) then begin adotable1.Filtered:=false; adotable1.Filter:=型号=+juti+; adotable1.Filtered:=true; end; if (combobox3.ItemIndex=3) then begin adotable1.Filtered:=false; adotable1.Filter:=仓库名称=+juti+; adotable1.Filtered:=true; end; end;end;procedure TForm3.Button5Click(Sender: TObject);begin adotable1.Filtered:=false;adotable1.Close;adotable1.Open;end;procedure TForm3.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 (combobox1.Text) and (combobox2.Text) then begin if application.MessageBox(确定要添加?, 超市仓库管理系统, mb_iconinformation + mb_yesno) = idyes then begin adotable1.InsertRecord(edit1.Text,edit2.Text,edit3.Text,combobox1.Text,edit4.Text,edit5.Text,combobox2.Text,edit6.Text,edit7.Text); adotable1.Close; adotable1.Open; showmessage(新商品添加成功); end; end else showmessage(信息未填全);end;end.unit Unit4;interfaceuses 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; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Edit3KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure DBGrid1CellClick(Column: TColumn); procedure FormShow(Sender: TObject); private Private declarations public Public declarations end;var Form4: TForm4;implementation$R *.dfmprocedure TForm4.Button1Click(Sender: TObject);begin if application.MessageBox(请确认是否要删除, 超市仓库管理系统, mb_iconinformation + mb_yesno) = idyes then begin adotable1.Delete; end;end;procedure TForm4.Button2Click(Sender: TObject);begin adotable1.Edit;end;procedure TForm4.Button3Click(Sender: TObject);begin adotable1.Post;showmessage(修改成功);end;procedure TForm4.Button4Click(Sender: TObject);var cangku,dizhi,bianhao:string;begin if (edit1.Text) and (edit2.Text) and (edit3.Text) then begin cangku:=edit1.Text; dizhi:=edit2.Text; bianhao:=edit3.Text; adoquery1.Close; adoquery1.SQL.Text := select * from 仓库信息表 where 仓库名称= +cangku+ ; adoquery1.open; if not adoquery1.Eof then begin MessageBox(handle, 此仓库名已存在!, 提示, mb_IconInformation + mb_Ok); exit; end; adoquery1.Close; adoquery1.SQL.Text := select * from 员工信息表 where 编号= +bianhao+ ; adoquery1.open; if adoquery1.RecordCount = 0 then begin showmessage(不存在此用户,请重新输入); edit3.SetFocus; exit; end; if application.MessageBox(确定要添加新仓库?, 超市仓库管理系统, mb_iconinformation + mb_yesno) = idyes then begin adotable1.InsertRecord(cangku,dizhi,bianhao); adotable1.Close; adotable1.Open; showmessage(新仓库添加成功); end; end else showmessage(信息未填全);end;procedure TForm4.Edit3KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); var bianhao:string;begin bianhao:=edit3.Text; with adoquery2 dobegin close; sql.clear; sql.add(select 姓名 from 员工信息表 where 编号=+bianhao+); open; edit4.Text:=Fieldbyname(姓名).AsString; close; sql.clear; sql.add(select 电话 from 员工信息表 where 编号=+bianhao+); open; edit5.Text:=Fieldbyname(电话).AsString;end;end;procedure TForm4.DBGrid1CellClick(Column: TColumn);vartemp:variant;workerId:string;begintemp:=DataSource1.DataSet.FieldValues负责人编号;workerID:=VarToStr(temp);adoquery3.Close;adoquery3.SQL.Clear;adoquery3.SQL.Text:=select 编号,姓名,性别,电话,地址,出生日期,部门,职务 from 员工信息表 where 编号=+workerid+;adoquery3.Open; dbgrid2.Columns0.Width:=100; dbgrid2.Columns1.Width:=100; dbgrid2.Columns2.Width:=100; dbgrid2.Columns3.Width:=100; dbgrid2.Columns4.Width:=100; dbgrid2.Columns5.Width:=100; dbgrid2.Columns6.Width:=100; dbgrid2.Columns7.Width:=100;end; procedure TForm4.FormShow(Sender: TObject);beginadoconnection1:=TADOConnection.Create(nil);adoconnection1.LoginPrompt:=false;adoconnection1.Connected:=false;adoconnection1.ConnectionString:=Provider=SQLOLEDB.1;Password=411114;Persist Security Info=True;User ID=sa;Initial Catalog=天天;Data Source=win-rnsk1tmak9l;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WIN-RNSK1TMAK9L;adoconnection1.Connected:=true;adotable1:=TADOTable.Create(nil);adotable1.Connection:=adoconnection1;adotable1.TableName:=仓库信息表;adotable1.Open;datasource1.DataSet:=adotable1;adoquery1:=TADOQuery.Create(nil);adoquery1.Connection:=adoconnection1;adoquery2:=TADOQuery.Create(nil);adoquery2.Connection:=adoconnection1;adoquery3.Connection:=adoconnection1;end;end.unit Unit5;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids, DBGrids, ComCtrls, DBCtrls, DB, ADODB,JPEG, ExtCtrls;type TForm5 = class(TForm) GroupBox1: TGroupBox; Label1: TLabel; DBGrid1: TDBGrid; Button1: TButton; GroupBox2: TGroupBox; Label2: TLabel; Edit1: TEdit; Label3: TLabel; RadioButton1: TRadioButton; RadioButton2: TRadioButton; Label4: TLabel; Edit2: TEdit; Label5: TLabel; Edit3: TEdit; Label6: TLabel; DateTimePicker1: TDateTimePicker; Label7: TLabel; ComboBox1: TComboBox; Label8: TLabel; Edit4: TEdit; Label9: TLabel; GroupBox3: TGroupBox; Label10: TLabel; ComboBox2: TComboBox; Edit5: TEdit; Button2: TButton; Button3: TButton; ADOConnection1: TADOConnection; ADOTable1: TADOTable; DataSource1: TDataSource; OpenDialog1: TOpenDialog; Button5: TButton; Button6: TButton; Edit6: TEdit; Image1: TImage; Image2: TImage; Label11: TLabel; Button4: TButton; Button7: TButton; procedure Button5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure DBGrid1CellClick(Column: TColumn); procedure Button4Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private Private declarations public Public declarations end;var Form5: TForm5;implementation var myjpeg,myjpeg1:TJpegImage; tempstream,tempstream1:TMemoryStream;$R *.dfmprocedure TForm5.Button5Click(Sender: TObject);var bianhao,yuangong,dianhua,dizhi,bumen,zhiwu,chusheng:string; xingbie:string; max:integer;begin if (edit1.Text) and (edit2.Text)and (edit3.Text) and (edit4.Text) and (radiobutton1.Checked xor radiobutton2.Checked) and(combobox1.Text) then begin yuangong:=edit1.Text; bianhao:=edit6.Text; dianhua:=edit2.Text; dizhi:=edit3.Text; bumen:=combobox1.Text; zhiwu:=edit4.Text; chusheng:= datetostr(datetimepicker1.date); if radiobutton1.Checked=true then xingbie:=男 else xingbie:=女; adotable1.InsertRecord(bianhao,yuangong,xingbie,dianhua,NULL,dizhi,chusheng,bumen,zh

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论