1600-箱體類零件工藝分析及知識庫研究(減速機(jī))
1600-箱體類零件工藝分析及知識庫研究(減速機(jī)),箱體,零件,工藝,分析,知識庫,研究,鉆研,減速
unit xjgy;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, ComCtrls, Grids, DBGrids, StdCtrls, OleCtrls, VOLOVIEWXLib_TLB,Buttons, ExtCtrls,shellapi, Menus, DB, ADODB;typeTl_xjgy = class(TForm)StatusBar1: TStatusBar;Splitter2: TSplitter;Splitter1: TSplitter;SaveDialog1: TSaveDialog;ADOQuery8: TADOQuery;ADOQuery7: TADOQuery;ADOQuery6: TADOQuery;ADOQuery5: TADOQuery;ADOQuery4: TADOQuery;ADOQuery3: TADOQuery;DataSource1: TDataSource;ADOQuery2: TADOQuery;ADOQuery1: TADOQuery;PopupMenu1: TPopupMenu;N1: TMenuItem;N2: TMenuItem;Panel3: TPanel;Splitter3: TSplitter;Splitter4: TSplitter;Panel4: TPanel;Panel7: TPanel;SpeedButton2: TSpeedButton;SpeedButton1: TSpeedButton;SpeedButton5: TSpeedButton;SpeedButton4: TSpeedButton;SpeedButton6: TSpeedButton;SpeedButton3: TSpeedButton;Panel8: TPanel;AvViewX1: TAvViewX;Panel5: TPanel;Label1: TLabel;Label2: TLabel;Label3: TLabel; Edit1: TEdit;Edit2: TEdit;Edit3: TEdit;Panel6: TPanel;DBGrid1: TDBGrid;Panel2: TPanel;Panel9: TPanel;Label6: TLabel;Panel10: TPanel;Panel11: TPanel;Label7: TLabel;Label8: TLabel;Edit7: TEdit;Edit8: TEdit;Panel12: TPanel;Label4: TLabel;Label5: TLabel;Edit4: TEdit;Edit5: TEdit;Panel1: TPanel;TreeView1: TTreeView;TreeView2: TTreeView;TreeView3: TTreeView;TreeView4: TTreeView;TreeView5: TTreeView;TreeView6: TTreeView;OpenDialog1: TOpenDialog;N3: TMenuItem;N4: TMenuItem;ADOQuery9: TADOQuery;ADOQuery10: TADOQuery;Label9: TLabel;Label10: TLabel;Edit6: TEdit;Edit9: TEdit;ADOQuery8DSDesigner: TIntegerField;ADOQuery8DSDesigner2: TIntegerField;ADOQuery8DSDesigner3: TStringField;ADOQuery8DSDesigner4: TStringField;ADOQuery8DSDesigner5: TStringField;ADOQuery8DSDesigner6: TStringField;ADOQuery8DSDesigner7: TStringField;ADOQuery8DSDesigner8: TStringField;ADOQuery8DSDesigner9: TStringField; ADOQuery8DSDesigner10: TStringField;ADOQuery8DSDesigner11: TFloatField;ADOQuery8DSDesigner12: TStringField;ADOQuery8DSDesigner13: TStringField;ADOQuery8DSDesigner14: TStringField;ADOQuery8DSDesigner15: TStringField;ADOQuery8DSDesigner16: TStringField;ADOQuery8DSDesigner17: TStringField;ADOQuery8DSDesigner18: TStringField;ADOQuery8DSDesigner19: TStringField;ADOQuery8DSDesigner20: TStringField;tuxing2: TBlobField;ADOQuery2DSDesigner: TIntegerField;ADOQuery2DSDesigner2: TIntegerField;ADOQuery2DSDesigner3: TStringField;ADOQuery2DSDesigner4: TStringField;ADOQuery2DSDesigner5: TStringField;ADOQuery2DSDesigner6: TStringField;ADOQuery2DSDesigner7: TStringField;ADOQuery2DSDesigner8: TStringField;ADOQuery2DSDesigner9: TStringField;ADOQuery2DSDesigner10: TStringField;ADOQuery2DSDesigner11: TFloatField;ADOQuery2DSDesigner12: TStringField;ADOQuery2DSDesigner13: TStringField;ADOQuery2DSDesigner14: TStringField;ADOQuery2DSDesigner15: TStringField;ADOQuery2DSDesigner16: TStringField;ADOQuery2DSDesigner17: TStringField;ADOQuery2DSDesigner18: TStringField;ADOQuery2DSDesigner19: TStringField;ADOQuery2DSDesigner20: TStringField;tuxing: TBlobField;procedure FormCreate(Sender: TObject);procedure SpeedButton3Click(Sender: TObject);procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);procedure TreeView1Change(Sender: TObject; Node: TTreeNode);procedure TreeView2Change(Sender: TObject; Node: TTreeNode);procedure TreeView3Change(Sender: TObject; Node: TTreeNode);procedure TreeView4Change(Sender: TObject; Node: TTreeNode);procedure TreeView5Change(Sender: TObject; Node: TTreeNode);procedure TreeView6Change(Sender: TObject; Node: TTreeNode);procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject);procedure SpeedButton6Click(Sender: TObject);procedure SpeedButton4Click(Sender: TObject);procedure SpeedButton5Click(Sender: TObject);procedure SpeedButton1Click(Sender: TObject);procedure SpeedButton2Click(Sender: TObject);procedure N3Click(Sender: TObject);procedure N4Click(Sender: TObject);private{ Private declarations }public{ Public declarations }procedure LoadgcmcTREE;procedure LoadgcnrTREE;procedure LoadjckTREE;procedure LoadjjkTREE;procedure LoaddjkTREE;procedure LoadljkTREE;end;varl_xjgy: Tl_xjgy;tup,wjj:string;implementationuses unit1;{$R *.dfm}procedure Tl_xjgy.FormCreate(Sender: TObject);vari,ss:integer;serveString: string;beginwjj:=GetCurrentDir;//下面一部分是動態(tài)連接數(shù)據(jù)庫adoquery1.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery1.SQL.Clear;adoquery1.SQL.Add('select * from 工序名稱庫') ;adoquery1.open;adoquery2.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery2.SQL.Clear;adoquery2.SQL.Add('select * from 機(jī)械加工工藝過程卡片') ;adoquery2.open;adoquery3.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery3.SQL.Clear;adoquery3.SQL.Add('select * from 工序內(nèi)容') ;adoquery3.open;adoquery4.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery4.SQL.Clear;adoquery4.SQL.Add('select * from 機(jī)床庫') ;adoquery4.open;adoquery5.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery5.SQL.Clear;adoquery5.SQL.Add('select * from 夾具庫') ;adoquery5.open;adoquery6.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery6.SQL.Clear;adoquery6.SQL.Add('select * from 刀具庫') ;adoquery6.open;adoquery7.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery7.SQL.Clear; adoquery7.SQL.Add('select * from 量具庫') ;adoquery7.open;adoquery8.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery8.SQL.Clear;adoquery8.SQL.Add('select * from 機(jī)械加工工藝過程卡片 2') ;adoquery8.open;adoquery9.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery9.SQL.Clear;adoquery9.SQL.Add('select * from 零件名稱匯總') ;adoquery9.open;adoquery10.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery10.SQL.Clear;adoquery10.SQL.Add('select * from 零件工藝匯總') ;adoquery10.open;LoadgcnrTREE;LoadjckTREE;LoadjjkTREE;LoaddjkTREE;LoadljkTREE;LoadgcmcTREE;treeview1.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;adoquery2.First;while not adoquery2.Eof dobeginadoquery2.Delete;end; ss:=10;for i:=1 to 15 dobeginadoquery2.Append;adoquery2['工序標(biāo)志']:=ss;adoquery2.Post;ss:=ss+10;end;adoquery2.Active:=false;adoquery2.Active:=true;//改變網(wǎng)格大小dbgrid1.Columns[0].Width:=50;dbgrid1.Columns[1].Width:=100;dbgrid1.Columns[2].Width:=100;dbgrid1.Columns[3].Width:=60;dbgrid1.Columns[4].Width:=60;dbgrid1.Columns[5].Width:=70;dbgrid1.Columns[6].Width:=70;dbgrid1.Columns[7].Width:=70;dbgrid1.Columns[8].Width:=70;dbgrid1.Columns[9].Width:=60;end;procedure Tl_xjgy.LoadgcmcTREE;varRootNode, CatNode : TTreeNode;Category : string;begintreeview1.Items.Clear;RootNode := treeview1.Items.Add( nil, '工序名稱' );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;adoquery1.First;while not adoquery1.Eof dobeginCategory := adoquery1.fieldbyname('工序名稱').AsString;CatNode := treeview1.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;adoquery1.Next;end;end;procedure Tl_xjgy.LoadgcnrTREE;varRootNode, CatNode : TTreeNode;Category : string;begintreeview2.Items.Clear;RootNode := treeview2.Items.Add( nil, '工序內(nèi)容' );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;adoquery3.First;while not adoquery3.Eof dobeginCategory := adoquery3.fieldbyname('工序內(nèi)容').AsString;CatNode := treeview2.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;adoquery3.Next;end;end;procedure Tl_xjgy.LoadjckTREE;varRootNode, TipNode, CatNode : TTreeNode;ss,Category,jidian : string;begintreeview3.Items.Clear;adoquery4.First;while not adoquery4.Eof dobeginif (adoquery4['機(jī)床標(biāo)志 1']=0) and (adoquery4['機(jī)床標(biāo)志 2']=0) and (adoquery4['機(jī)床標(biāo)志 3']=0)thenbeginss:=adoquery4['機(jī)床名稱'];RootNode := treeview3.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery4['機(jī)床標(biāo)志 1']=0) and (adoquery4['機(jī)床標(biāo)志 2']=0) and (adoquery4['機(jī)床標(biāo)志 3']=1)thenbeginCategory := adoquery4.fieldbyname('機(jī)床分類').AsString;CatNode := treeview3.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end; if (adoquery4['機(jī)床標(biāo)志 1']=1) and (adoquery4['機(jī)床標(biāo)志 2']=1) and (adoquery4['機(jī)床標(biāo)志 3']=1)thenbeginjidian := adoquery4.fieldbyname('機(jī)床型號').AsString;tipNode := treeview3.Items.addchild( catnode,jidian );tipNode.ImageIndex := 5;tipNode.SelectedIndex := 2;end;adoquery4.Next;end;end;procedure Tl_xjgy.LoadjjkTREE;varRootNode, TipNode, CatNode : TTreeNode;ss,Category,jidian : string;begintreeview4.Items.Clear;adoquery5.First;while not adoquery5.Eof dobeginif (adoquery5['夾具標(biāo)志 1']=0) and (adoquery5['夾具標(biāo)志 2']=0) and (adoquery5['夾具標(biāo)志 3']=0)thenbeginss:=adoquery5['夾具總稱'];RootNode := treeview4.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery5['夾具標(biāo)志 1']=0) and (adoquery5['夾具標(biāo)志 2']=0) and (adoquery5['夾具標(biāo)志 3']=1)thenbeginCategory := adoquery5.fieldbyname('夾具分類').AsString;CatNode := treeview4.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end;if (adoquery5['夾具標(biāo)志 1']=1) and (adoquery5['夾具標(biāo)志 2']=1) and (adoquery5['夾具標(biāo)志 3']=1)thenbeginjidian := adoquery5.fieldbyname('夾具名稱').AsString;tipNode := treeview4.Items.addchild( catnode,jidian );tipNode.ImageIndex := 5;tipNode.SelectedIndex := 2; end;adoquery5.Next;end;end;procedure Tl_xjgy.LoaddjkTREE;varRootNode,CatNode : TTreeNode;ss,Category : string;begintreeview5.Items.Clear;adoquery6.First;while not adoquery6.Eof dobeginif (adoquery6['刀具標(biāo)志 1']=0) and (adoquery6['刀具標(biāo)志 2']=1) thenbeginss:=adoquery6['刀具名稱'];RootNode := treeview5.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery6['刀具標(biāo)志 1']=1) and (adoquery6['刀具標(biāo)志 2']=0) thenbeginCategory := adoquery6.fieldbyname('刀具規(guī)格').AsString;CatNode := treeview5.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end;adoquery6.Next;end;end;procedure Tl_xjgy.LoadljkTREE;varRootNode, CatNode : TTreeNode;ss,Category : string;begintreeview6.Items.Clear;adoquery7.First;while not adoquery7.Eof dobeginif (adoquery7['量具標(biāo)志 1']=0) and (adoquery7['量具標(biāo)志 2']=1) thenbeginss:=adoquery7['量具名稱']; RootNode := treeview6.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery7['量具標(biāo)志 1']=1) and (adoquery7['量具標(biāo)志 2']=0) thenbeginCategory := adoquery7.fieldbyname('量具規(guī)格').AsString;CatNode := treeview6.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end;adoquery7.Next;end;end;procedure Tl_xjgy.SpeedButton3Click(Sender: TObject);beginclose;end;procedure Tl_xjgy.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);beginif (DBGrid1.SelectedIndex = 1) thenbegin//調(diào)用相應(yīng)樹形結(jié)構(gòu)treeview1.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 2) thenbegintreeview2.Visible:=true;treeview1.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 5) thenbegin treeview3.Visible:=true;treeview2.Visible:=false;treeview1.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 6) thenbegintreeview4.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview1.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 7) thenbegintreeview5.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview1.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 8) thenbegintreeview6.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview1.Visible:=false;end;end;procedure Tl_xjgy.TreeView1Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 1) thenbeginadoquery2.Edit;adoquery2['工序名稱']:=TreeView1.Selected.Text;adoquery2.Post;end; end;procedure Tl_xjgy.TreeView2Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 2) thenbeginadoquery2.Edit;adoquery2['工序內(nèi)容']:=TreeView2.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView3Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 5) thenbeginadoquery2.Edit;adoquery2['機(jī)床設(shè)備']:=TreeView3.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView4Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 6) thenbeginadoquery2.Edit;adoquery2['夾具設(shè)備']:=TreeView4.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView5Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 7) thenbeginadoquery2.Edit;adoquery2['刀具設(shè)備']:=TreeView5.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView6Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 8) thenbeginadoquery2.Edit;adoquery2['量具設(shè)備']:=TreeView6.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.N1Click(Sender: TObject);beginavviewx1.ClearMarkup ;if opendialog1.Execute thenbegintup:=opendialog1.filename;end;avviewx1.src :=tup ;if tup'')and (edit8.Text'' thenbeginavviewx1.ClearMarkup;avviewx1.Visible:=false;ShellExecute(handle,'open','acad.exe',pchar(tup),nil,SW_ShowNormal);avviewx1.Refresh;avviewx1.src:=tup;endelse showmessage('請加載圖形后在編輯,謝謝!');end;procedure Tl_xjgy.N4Click(Sender: TObject);begin// 圖形重新顯示avviewx1.ClearMarkup;avviewx1.Visible:=true;avviewx1.Refresh;avviewx1.src:=tup;end;end.unit xjgy;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, ComCtrls, Grids, DBGrids, StdCtrls, OleCtrls, VOLOVIEWXLib_TLB,Buttons, ExtCtrls,shellapi, Menus, DB, ADODB;typeTl_xjgy = class(TForm)StatusBar1: TStatusBar;Splitter2: TSplitter;Splitter1: TSplitter;SaveDialog1: TSaveDialog;ADOQuery8: TADOQuery;ADOQuery7: TADOQuery;ADOQuery6: TADOQuery;ADOQuery5: TADOQuery;ADOQuery4: TADOQuery;ADOQuery3: TADOQuery;DataSource1: TDataSource;ADOQuery2: TADOQuery;ADOQuery1: TADOQuery;PopupMenu1: TPopupMenu;N1: TMenuItem;N2: TMenuItem;Panel3: TPanel;Splitter3: TSplitter;Splitter4: TSplitter;Panel4: TPanel;Panel7: TPanel;SpeedButton2: TSpeedButton;SpeedButton1: TSpeedButton;SpeedButton5: TSpeedButton;SpeedButton4: TSpeedButton;SpeedButton6: TSpeedButton;SpeedButton3: TSpeedButton;Panel8: TPanel;AvViewX1: TAvViewX;Panel5: TPanel;Label1: TLabel;Label2: TLabel;Label3: TLabel; Edit1: TEdit;Edit2: TEdit;Edit3: TEdit;Panel6: TPanel;DBGrid1: TDBGrid;Panel2: TPanel;Panel9: TPanel;Label6: TLabel;Panel10: TPanel;Panel11: TPanel;Label7: TLabel;Label8: TLabel;Edit7: TEdit;Edit8: TEdit;Panel12: TPanel;Label4: TLabel;Label5: TLabel;Edit4: TEdit;Edit5: TEdit;Panel1: TPanel;TreeView1: TTreeView;TreeView2: TTreeView;TreeView3: TTreeView;TreeView4: TTreeView;TreeView5: TTreeView;TreeView6: TTreeView;OpenDialog1: TOpenDialog;N3: TMenuItem;N4: TMenuItem;ADOQuery9: TADOQuery;ADOQuery10: TADOQuery;Label9: TLabel;Label10: TLabel;Edit6: TEdit;Edit9: TEdit;ADOQuery8DSDesigner: TIntegerField;ADOQuery8DSDesigner2: TIntegerField;ADOQuery8DSDesigner3: TStringField;ADOQuery8DSDesigner4: TStringField;ADOQuery8DSDesigner5: TStringField;ADOQuery8DSDesigner6: TStringField;ADOQuery8DSDesigner7: TStringField;ADOQuery8DSDesigner8: TStringField;ADOQuery8DSDesigner9: TStringField; ADOQuery8DSDesigner10: TStringField;ADOQuery8DSDesigner11: TFloatField;ADOQuery8DSDesigner12: TStringField;ADOQuery8DSDesigner13: TStringField;ADOQuery8DSDesigner14: TStringField;ADOQuery8DSDesigner15: TStringField;ADOQuery8DSDesigner16: TStringField;ADOQuery8DSDesigner17: TStringField;ADOQuery8DSDesigner18: TStringField;ADOQuery8DSDesigner19: TStringField;ADOQuery8DSDesigner20: TStringField;tuxing2: TBlobField;ADOQuery2DSDesigner: TIntegerField;ADOQuery2DSDesigner2: TIntegerField;ADOQuery2DSDesigner3: TStringField;ADOQuery2DSDesigner4: TStringField;ADOQuery2DSDesigner5: TStringField;ADOQuery2DSDesigner6: TStringField;ADOQuery2DSDesigner7: TStringField;ADOQuery2DSDesigner8: TStringField;ADOQuery2DSDesigner9: TStringField;ADOQuery2DSDesigner10: TStringField;ADOQuery2DSDesigner11: TFloatField;ADOQuery2DSDesigner12: TStringField;ADOQuery2DSDesigner13: TStringField;ADOQuery2DSDesigner14: TStringField;ADOQuery2DSDesigner15: TStringField;ADOQuery2DSDesigner16: TStringField;ADOQuery2DSDesigner17: TStringField;ADOQuery2DSDesigner18: TStringField;ADOQuery2DSDesigner19: TStringField;ADOQuery2DSDesigner20: TStringField;tuxing: TBlobField;procedure FormCreate(Sender: TObject);procedure SpeedButton3Click(Sender: TObject);procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);procedure TreeView1Change(Sender: TObject; Node: TTreeNode);procedure TreeView2Change(Sender: TObject; Node: TTreeNode);procedure TreeView3Change(Sender: TObject; Node: TTreeNode);procedure TreeView4Change(Sender: TObject; Node: TTreeNode);procedure TreeView5Change(Sender: TObject; Node: TTreeNode);procedure TreeView6Change(Sender: TObject; Node: TTreeNode);procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject);procedure SpeedButton6Click(Sender: TObject);procedure SpeedButton4Click(Sender: TObject);procedure SpeedButton5Click(Sender: TObject);procedure SpeedButton1Click(Sender: TObject);procedure SpeedButton2Click(Sender: TObject);procedure N3Click(Sender: TObject);procedure N4Click(Sender: TObject);private{ Private declarations }public{ Public declarations }procedure LoadgcmcTREE;procedure LoadgcnrTREE;procedure LoadjckTREE;procedure LoadjjkTREE;procedure LoaddjkTREE;procedure LoadljkTREE;end;varl_xjgy: Tl_xjgy;tup,wjj:string;implementationuses unit1;{$R *.dfm}procedure Tl_xjgy.FormCreate(Sender: TObject);vari,ss:integer;serveString: string;beginwjj:=GetCurrentDir;//下面一部分是動態(tài)連接數(shù)據(jù)庫adoquery1.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery1.SQL.Clear;adoquery1.SQL.Add('select * from 工序名稱庫') ;adoquery1.open;adoquery2.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery2.SQL.Clear;adoquery2.SQL.Add('select * from 機(jī)械加工工藝過程卡片') ;adoquery2.open;adoquery3.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery3.SQL.Clear;adoquery3.SQL.Add('select * from 工序內(nèi)容') ;adoquery3.open;adoquery4.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery4.SQL.Clear;adoquery4.SQL.Add('select * from 機(jī)床庫') ;adoquery4.open;adoquery5.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery5.SQL.Clear;adoquery5.SQL.Add('select * from 夾具庫') ;adoquery5.open;adoquery6.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery6.SQL.Clear;adoquery6.SQL.Add('select * from 刀具庫') ;adoquery6.open;adoquery7.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery7.SQL.Clear; adoquery7.SQL.Add('select * from 量具庫') ;adoquery7.open;adoquery8.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery8.SQL.Clear;adoquery8.SQL.Add('select * from 機(jī)械加工工藝過程卡片 2') ;adoquery8.open;adoquery9.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery9.SQL.Clear;adoquery9.SQL.Add('select * from 零件名稱匯總') ;adoquery9.open;adoquery10.ConnectionString:='Provider=SQLOLEDB.1;Password='+trim(form1.Edit4.Text)+';Persist Security Info=True;User ID=sa;Initial Catalog=bysjcapp;Data Source='+trim(form1.Edit3.Text)+'';adoquery10.SQL.Clear;adoquery10.SQL.Add('select * from 零件工藝匯總') ;adoquery10.open;LoadgcnrTREE;LoadjckTREE;LoadjjkTREE;LoaddjkTREE;LoadljkTREE;LoadgcmcTREE;treeview1.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;adoquery2.First;while not adoquery2.Eof dobeginadoquery2.Delete;end; ss:=10;for i:=1 to 15 dobeginadoquery2.Append;adoquery2['工序標(biāo)志']:=ss;adoquery2.Post;ss:=ss+10;end;adoquery2.Active:=false;adoquery2.Active:=true;//改變網(wǎng)格大小dbgrid1.Columns[0].Width:=50;dbgrid1.Columns[1].Width:=100;dbgrid1.Columns[2].Width:=100;dbgrid1.Columns[3].Width:=60;dbgrid1.Columns[4].Width:=60;dbgrid1.Columns[5].Width:=70;dbgrid1.Columns[6].Width:=70;dbgrid1.Columns[7].Width:=70;dbgrid1.Columns[8].Width:=70;dbgrid1.Columns[9].Width:=60;end;procedure Tl_xjgy.LoadgcmcTREE;varRootNode, CatNode : TTreeNode;Category : string;begintreeview1.Items.Clear;RootNode := treeview1.Items.Add( nil, '工序名稱' );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;adoquery1.First;while not adoquery1.Eof dobeginCategory := adoquery1.fieldbyname('工序名稱').AsString;CatNode := treeview1.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;adoquery1.Next;end;end;procedure Tl_xjgy.LoadgcnrTREE;varRootNode, CatNode : TTreeNode;Category : string;begintreeview2.Items.Clear;RootNode := treeview2.Items.Add( nil, '工序內(nèi)容' );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;adoquery3.First;while not adoquery3.Eof dobeginCategory := adoquery3.fieldbyname('工序內(nèi)容').AsString;CatNode := treeview2.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;adoquery3.Next;end;end;procedure Tl_xjgy.LoadjckTREE;varRootNode, TipNode, CatNode : TTreeNode;ss,Category,jidian : string;begintreeview3.Items.Clear;adoquery4.First;while not adoquery4.Eof dobeginif (adoquery4['機(jī)床標(biāo)志 1']=0) and (adoquery4['機(jī)床標(biāo)志 2']=0) and (adoquery4['機(jī)床標(biāo)志 3']=0)thenbeginss:=adoquery4['機(jī)床名稱'];RootNode := treeview3.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery4['機(jī)床標(biāo)志 1']=0) and (adoquery4['機(jī)床標(biāo)志 2']=0) and (adoquery4['機(jī)床標(biāo)志 3']=1)thenbeginCategory := adoquery4.fieldbyname('機(jī)床分類').AsString;CatNode := treeview3.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end; if (adoquery4['機(jī)床標(biāo)志 1']=1) and (adoquery4['機(jī)床標(biāo)志 2']=1) and (adoquery4['機(jī)床標(biāo)志 3']=1)thenbeginjidian := adoquery4.fieldbyname('機(jī)床型號').AsString;tipNode := treeview3.Items.addchild( catnode,jidian );tipNode.ImageIndex := 5;tipNode.SelectedIndex := 2;end;adoquery4.Next;end;end;procedure Tl_xjgy.LoadjjkTREE;varRootNode, TipNode, CatNode : TTreeNode;ss,Category,jidian : string;begintreeview4.Items.Clear;adoquery5.First;while not adoquery5.Eof dobeginif (adoquery5['夾具標(biāo)志 1']=0) and (adoquery5['夾具標(biāo)志 2']=0) and (adoquery5['夾具標(biāo)志 3']=0)thenbeginss:=adoquery5['夾具總稱'];RootNode := treeview4.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery5['夾具標(biāo)志 1']=0) and (adoquery5['夾具標(biāo)志 2']=0) and (adoquery5['夾具標(biāo)志 3']=1)thenbeginCategory := adoquery5.fieldbyname('夾具分類').AsString;CatNode := treeview4.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end;if (adoquery5['夾具標(biāo)志 1']=1) and (adoquery5['夾具標(biāo)志 2']=1) and (adoquery5['夾具標(biāo)志 3']=1)thenbeginjidian := adoquery5.fieldbyname('夾具名稱').AsString;tipNode := treeview4.Items.addchild( catnode,jidian );tipNode.ImageIndex := 5;tipNode.SelectedIndex := 2; end;adoquery5.Next;end;end;procedure Tl_xjgy.LoaddjkTREE;varRootNode,CatNode : TTreeNode;ss,Category : string;begintreeview5.Items.Clear;adoquery6.First;while not adoquery6.Eof dobeginif (adoquery6['刀具標(biāo)志 1']=0) and (adoquery6['刀具標(biāo)志 2']=1) thenbeginss:=adoquery6['刀具名稱'];RootNode := treeview5.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery6['刀具標(biāo)志 1']=1) and (adoquery6['刀具標(biāo)志 2']=0) thenbeginCategory := adoquery6.fieldbyname('刀具規(guī)格').AsString;CatNode := treeview5.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end;adoquery6.Next;end;end;procedure Tl_xjgy.LoadljkTREE;varRootNode, CatNode : TTreeNode;ss,Category : string;begintreeview6.Items.Clear;adoquery7.First;while not adoquery7.Eof dobeginif (adoquery7['量具標(biāo)志 1']=0) and (adoquery7['量具標(biāo)志 2']=1) thenbeginss:=adoquery7['量具名稱']; RootNode := treeview6.Items.Add( nil, ss );RootNode.ImageIndex := 0; { Specify which bitmap to use }RootNode.SelectedIndex := 0;end;if (adoquery7['量具標(biāo)志 1']=1) and (adoquery7['量具標(biāo)志 2']=0) thenbeginCategory := adoquery7.fieldbyname('量具規(guī)格').AsString;CatNode := treeview6.Items.AddChild( RootNode, Category );CatNode.ImageIndex := 5;CatNode.SelectedIndex := 2;end;adoquery7.Next;end;end;procedure Tl_xjgy.SpeedButton3Click(Sender: TObject);beginclose;end;procedure Tl_xjgy.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);beginif (DBGrid1.SelectedIndex = 1) thenbegin//調(diào)用相應(yīng)樹形結(jié)構(gòu)treeview1.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 2) thenbegintreeview2.Visible:=true;treeview1.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 5) thenbegin treeview3.Visible:=true;treeview2.Visible:=false;treeview1.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 6) thenbegintreeview4.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview1.Visible:=false;treeview5.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 7) thenbegintreeview5.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview1.Visible:=false;treeview6.Visible:=false;end;if (DBGrid1.SelectedIndex = 8) thenbegintreeview6.Visible:=true;treeview2.Visible:=false;treeview3.Visible:=false;treeview4.Visible:=false;treeview5.Visible:=false;treeview1.Visible:=false;end;end;procedure Tl_xjgy.TreeView1Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 1) thenbeginadoquery2.Edit;adoquery2['工序名稱']:=TreeView1.Selected.Text;adoquery2.Post;end; end;procedure Tl_xjgy.TreeView2Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 2) thenbeginadoquery2.Edit;adoquery2['工序內(nèi)容']:=TreeView2.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView3Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 5) thenbeginadoquery2.Edit;adoquery2['機(jī)床設(shè)備']:=TreeView3.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView4Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 6) thenbeginadoquery2.Edit;adoquery2['夾具設(shè)備']:=TreeView4.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView5Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 7) thenbeginadoquery2.Edit;adoquery2['刀具設(shè)備']:=TreeView5.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.TreeView6Change(Sender: TObject; Node: TTreeNode);beginif (DBGrid1.SelectedIndex = 8) thenbeginadoquery2.Edit;adoquery2['量具設(shè)備']:=TreeView6.Selected.Text;adoquery2.Post;end;end;procedure Tl_xjgy.N1Click(Sender: TObject);beginavviewx1.ClearMarkup ;if opendialog1.Execute thenbegintup:=opendialog1.filename;end;avviewx1.src :=tup ;if tup'')and (edit8.Text'' thenbeginavviewx1.ClearMarkup;avviewx1.Visible:=false;ShellExecute(handle,'open','acad.exe',pchar(tup),nil,SW_ShowNormal);avviewx1.Refresh;avviewx1.src:=tup;endelse showmessage('請加載圖形后在編輯,謝謝!');end;procedure Tl_xjgy.N4Click(Sender: TObject);begin// 圖形重新顯示avviewx1.ClearMarkup;avviewx1.Visible:=true;avviewx1.Refresh;avviewx1.src:=tup;end;end.
收藏