📄 u_stwh.~pas
字号:
unit U_stwh;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, DB, Menus, DBTables, ExtCtrls, OleCtnrs,
DBCtrls, ComCtrls;
type
Tfrm_stwh = class(TForm)
GroupBox2: TGroupBox;
Label3: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Label1: TLabel;
Label6: TLabel;
combo_zy: TComboBox;
combo_gwlb: TComboBox;
combo_gwzl: TComboBox;
combo_khdx: TComboBox;
combo_km: TComboBox;
combo_sttx: TComboBox;
GroupBox5: TGroupBox;
GroupBox6: TGroupBox;
RadioGroup1: TRadioGroup;
tbl_xlkm: TTable;
tbl_sttx: TTable;
MainMenu1: TMainMenu;
N1: TMenuItem;
mnu_lr: TMenuItem;
mnu_close: TMenuItem;
tbl_stk: TTable;
tbl_stkSTXH: TIntegerField;
tbl_stkZYXH: TSmallintField;
tbl_stkGWLBXH: TSmallintField;
tbl_stkGWZLXH: TSmallintField;
tbl_stkKHDXXH: TSmallintField;
tbl_stkKMXH: TSmallintField;
tbl_stkTXXH: TSmallintField;
tbl_stkZWCD: TBooleanField;
tbl_stkTM: TBlobField;
tbl_stkDA: TBlobField;
tbl_gwzl: TTable;
tbl_khdx: TTable;
tbl_gwlb: TTable;
tbl_zy: TTable;
btn_insert: TBitBtn;
btn_close: TBitBtn;
Panel1: TPanel;
DBNavigator1: TDBNavigator;
DataSource1: TDataSource;
RichEdit1: TRichEdit;
procedure FormCreate(Sender: TObject);
procedure combo_zyChange(Sender: TObject);
procedure combo_gwlbChange(Sender: TObject);
procedure combo_gwzlChange(Sender: TObject);
procedure combo_khdxChange(Sender: TObject);
procedure combo_kmChange(Sender: TObject);
procedure combo_sttxChange(Sender: TObject);
procedure tbl_stkAfterScroll(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_stwh: Tfrm_stwh;
implementation
uses P_RES;
{$R *.dfm}
procedure Tfrm_stwh.FormCreate(Sender: TObject);
begin
tbl_sttx.First;
while not tbl_sttx.Eof do
begin
combo_sttx.Items.AddObject(tbl_sttx.FieldByName('txmc').AsString,TObject(tbl_sttx.FieldByName('txxh').AsInteger));
tbl_sttx.Next;
end;
combo_sttx.ItemIndex:=0;
tbl_sttx.Close;
tbl_zy.First;
while not tbl_zy.Eof do
begin
combo_zy.Items.AddObject(tbl_zy.FieldByName('zymc').AsString,TObject(tbl_zy.FieldByName('zyxh').AsInteger));
tbl_zy.Next;
end;
tbl_zy.Close;
if combo_zy.Items.Count<>0 then
combo_zy.ItemIndex:=0
else
exit;
combo_zyChange(self);
end;
procedure Tfrm_stwh.combo_zyChange(Sender: TObject);
begin
combo_gwlb.Items.Clear;
tbl_gwlb.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]));
tbl_gwlb.First;
while not tbl_gwlb.Eof do
begin
combo_gwlb.Items.AddObject(tbl_gwlb.FieldByName('gwlbmc').AsString,TObject(tbl_gwlb.FieldByName('gwlbxh').AsInteger));
tbl_gwlb.Next;
end;
if combo_gwlb.Items.Count<>0 then
combo_gwlb.ItemIndex:=0;
combo_gwlbChange(self);
end;
procedure Tfrm_stwh.combo_gwlbChange(Sender: TObject);
begin
combo_gwzl.Items.Clear;
if combo_gwlb.Items.Count<>0 then
tbl_gwzl.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwlbxh='+inttostr(Integer(combo_gwlb.Items.Objects[combo_gwlb.ItemIndex]))
else
tbl_gwzl.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]));
tbl_gwzl.First;
while not tbl_gwzl.Eof do
begin
combo_gwzl.Items.AddObject(tbl_gwzl.FieldByName('gwzlmc').AsString,TObject(tbl_gwzl.FieldByName('gwzlxh').AsInteger));
tbl_gwzl.Next;
end;
if combo_gwzl.Items.Count<>0 then
combo_gwzl.ItemIndex:=0
else
begin
if combo_gwlb.Items.Count<>0 then
tbl_stk.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwlbxh='+inttostr(Integer(combo_gwlb.Items.Objects[combo_gwlb.ItemIndex]))
else
tbl_stk.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]));
combo_khdx.Items.Clear;
exit;
end;
combo_gwzlChange(self);
end;
procedure Tfrm_stwh.combo_gwzlChange(Sender: TObject);
begin
combo_khdx.Items.Clear;
if combo_gwlb.Items.Count<>0 then
tbl_khdx.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwlbxh='+inttostr(Integer(combo_gwlb.Items.Objects[combo_gwlb.ItemIndex]))+' and gwzlxh='+inttostr(Integer(combo_gwzl.Items.Objects[combo_gwzl.ItemIndex]))
else
tbl_khdx.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwzlxh='+inttostr(Integer(combo_gwzl.Items.Objects[combo_gwzl.ItemIndex]));
tbl_khdx.First;
while not tbl_khdx.Eof do
begin
combo_khdx.Items.AddObject(tbl_khdx.FieldByName('khdxmc').AsString,TObject(tbl_khdx.FieldByName('khdxxh').AsInteger));
tbl_khdx.Next;
end;
if combo_khdx.Items.Count<>0 then
combo_khdx.ItemIndex:=0
else
exit;
combo_khdxChange(self);
end;
procedure Tfrm_stwh.combo_khdxChange(Sender: TObject);
begin
combo_km.Items.Clear;
if combo_gwlb.Items.Count<>0 then
tbl_xlkm.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwlbxh='+inttostr(Integer(combo_gwlb.Items.Objects[combo_gwlb.ItemIndex]))+' and gwzlxh='+inttostr(Integer(combo_gwzl.Items.Objects[combo_gwzl.ItemIndex]))+' and khdxxh='+inttostr(Integer(combo_khdx.Items.Objects[combo_khdx.ItemIndex]))
else
tbl_xlkm.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwzlxh='+inttostr(Integer(combo_gwzl.Items.Objects[combo_gwzl.ItemIndex]))+' and khdxxh='+inttostr(Integer(combo_khdx.Items.Objects[combo_khdx.ItemIndex]));
tbl_xlkm.First;
while not tbl_xlkm.Eof do
begin
combo_km.Items.AddObject(tbl_xlkm.FieldByName('kmmc').AsString,TObject(tbl_xlkm.FieldByName('kmxh').AsInteger));
tbl_xlkm.Next;
end;
if combo_km.Items.Count<>0 then
combo_km.ItemIndex:=0
else
exit;
combo_kmChange(self);
end;
procedure Tfrm_stwh.combo_kmChange(Sender: TObject);
begin
combo_sttxChange(self);
end;
procedure Tfrm_stwh.combo_sttxChange(Sender: TObject);
begin
if combo_gwlb.Items.Count<>0 then
tbl_stk.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwlbxh='+inttostr(Integer(combo_gwlb.Items.Objects[combo_gwlb.ItemIndex]))+' and gwzlxh='+inttostr(Integer(combo_gwzl.Items.Objects[combo_gwzl.ItemIndex]))
+' and khdxxh='+ inttostr(Integer(combo_khdx.Items.Objects[combo_khdx.ItemIndex]))
+' and txxh='+ inttostr(Integer(combo_sttx.Items.Objects[combo_sttx.ItemIndex]))
+' and kmxh='+ inttostr(Integer(combo_km.Items.Objects[combo_km.ItemIndex]))
else
tbl_stk.Filter:='zyxh='+inttostr(Integer(combo_zy.Items.Objects[combo_zy.ItemIndex]))+' and gwzlxh='+inttostr(Integer(combo_gwzl.Items.Objects[combo_gwzl.ItemIndex]))
+' and khdxxh='+ inttostr(Integer(combo_khdx.Items.Objects[combo_khdx.ItemIndex]))
+' and txxh='+ inttostr(Integer(combo_sttx.Items.Objects[combo_sttx.ItemIndex]))
+' and kmxh='+ inttostr(Integer(combo_km.Items.Objects[combo_km.ItemIndex])) ;
end;
procedure Tfrm_stwh.tbl_stkAfterScroll(DataSet: TDataSet);
begin
if tbl_stk.RecordCount=0 then exit;
if tbl_stkZWCD.Value then
RadioGroup1.ItemIndex:=0
else
RadioGroup1.ItemIndex:=1;
end;
procedure Tfrm_stwh.FormShow(Sender: TObject);
begin
tbl_stk.Filtered:=true;
end;
procedure Tfrm_stwh.FormClose(Sender: TObject; var Action: TCloseAction);
begin
tbl_zy.Close;
tbl_gwlb.Close;
tbl_gwzl.Close;
tbl_khdx.Close;
tbl_sttx.Close;
tbl_xlkm.Close;
tbl_stk.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -