⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uquerykc.pas

📁 物流行业
💻 PAS
字号:
unit Uquerykc;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, DB, DBTables, Buttons, ExtCtrls, Grids,
  DBGrids;

type
  Tfmquerykc = class(TForm)
    DataSource1: TDataSource;
    Label1: TLabel;
    groupbox1: TGroupBox;
    GroupBox2: TGroupBox;
    DBGrid1: TDBGrid;
    BitBtn4: TBitBtn;
    StatusBar1: TStatusBar;
    Table2: TTable;
    ListBox1: TListBox;
    RadioGroup1: TRadioGroup;
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Query3: TQuery;
    Table2Cxh: TStringField;
    Table2Ccc: TStringField;
    Table2Cxx: TStringField;
    Table2Lzt: TBooleanField;
    Table2Ccxr: TStringField;
    Table2Cxw: TStringField;
    Table2Chm: TStringField;
    Table2Lyc: TBooleanField;
    ListBox2: TListBox;
    ListBox3: TListBox;
    RadioGroup2: TRadioGroup;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    BitBtn1: TBitBtn;
    ComboBox1: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmquerykc: Tfmquerykc;

implementation

uses Uquerykcreport;

{$R *.dfm}

procedure Tfmquerykc.FormCreate(Sender: TObject);
var i:integer;
begin
for i:=0 to table2.FieldCount-1 do
begin listbox1.Items.Add(table2.Fields[i].DisplayName);
end;
edit1.Text:='';
edit2.Text:='';
edit2.Visible:=false;
combobox1.Visible:=false;
listbox1.ItemIndex:=0;
end;

procedure Tfmquerykc.BitBtn4Click(Sender: TObject);
begin
fmquerykc.Close;
end;


procedure Tfmquerykc.Button1Click(Sender: TObject);
var listarray:array[0..7] of string;
     tj,lj,skc:string;
     i:integer;
begin
listarray[0]:='cxh';
listarray[1]:='ccc';
listarray[2]:='cxx';
listarray[3]:='lzt1';
listarray[4]:='ccxr';
listarray[5]:='cxw';
listarray[6]:='chm';
listarray[7]:='lyc';

if combobox1.Visible=true then skc:=combobox1.Text else skc:=trim(edit1.Text);

if radiogroup1.ItemIndex=0 then tj:=' = ';
if radiogroup1.ItemIndex=1 then tj:=' <> ';
if radiogroup1.ItemIndex=2 then tj:=' like ';

if listbox2.Items.text<>'' then
begin if radiogroup2.ItemIndex=0 then lj:=' and ' else lj:=' or ';
end
else lj:='';

if not (radiogroup1.ItemIndex=3) then
begin
if not (radiogroup1.ItemIndex=2) then
begin
for i:=listbox1.Items.Count-1 downto 0 do
begin if listbox1.Selected[i] then
begin
listbox2.Items.Add(lj+listbox1.Items[listbox1.itemindex]+tj+'"'+skc+'"');
listbox3.Items.Add(lj+listarray[listbox1.itemindex]+tj+'"'+skc+'"');
end;
end;
end
else
begin
for i:=listbox1.items.count-1 downto 0 do
begin if listbox1.Selected[i] then
begin
listbox2.Items.add(lj+listbox1.Items[listbox1.itemindex]+tj+'"'+skc+'%'+'"');
listbox3.Items.add(lj+listarray[listbox1.itemindex]+tj+'"'+skc+'%'+'"');

end;
end
end;
end
else
for i:=listbox1.items.count-1 downto 0 do
begin
if listbox1.Selected[i] then
begin
listbox2.Items.Add(listbox1.Items[listbox1.itemindex]+'>='+'"'+skc+'"'+' and '+listbox1.Items[listbox1.itemindex]+'<='+'"'+edit2.Text+'"');
listbox3.Items.Add(listarray[listbox1.itemindex]+'>='+'"'+skc+'"'+' and '+listbox1.Items[listbox1.itemindex]+'<='+'"'+edit2.Text+'"');
end;
end;
end;

procedure Tfmquerykc.RadioGroup1Click(Sender: TObject);
begin
if (radiogroup1.ItemIndex=0) or  (radiogroup1.ItemIndex=1) or (radiogroup1.ItemIndex=2) then edit2.Visible:=false;
if radiogroup1.ItemIndex=3 then begin
edit2.Visible:=true;
end;
end;

procedure Tfmquerykc.ListBox1Click(Sender: TObject);
begin

if listbox1.ItemIndex=1 then
begin
combobox1.Visible:=true;
edit1.Visible:=false;
combobox1.Clear;
combobox1.Items.Add('20''');
combobox1.Items.Add('40''');
combobox1.Items.Add('45''');
combobox1.Width:=edit1.Width;
combobox1.Height:=edit1.Height;
combobox1.Left:=edit1.Left;
combobox1.Top:=edit1.Top;
end;

if listbox1.ItemIndex=2 then
begin
combobox1.Visible:=true;
edit1.Visible:=false;
combobox1.Clear;
combobox1.Items.Add('GP');
combobox1.Items.Add('FR');
combobox1.Items.Add('OT');
combobox1.Items.Add('OS');
combobox1.Width:=edit1.Width;
combobox1.Height:=edit1.Height;
combobox1.Left:=edit1.Left;
combobox1.Top:=edit1.Top;
end;

if listbox1.ItemIndex=3 then
begin
combobox1.Visible:=true;
edit1.Visible:=false;
combobox1.Clear;
combobox1.Items.Add('E');
combobox1.Items.Add('F');
combobox1.Width:=edit1.Width;
combobox1.Height:=edit1.Height;
combobox1.Left:=edit1.Left;
combobox1.Top:=edit1.Top;
end;

if listbox1.ItemIndex=5 then
begin
combobox1.Visible:=true;
edit1.Visible:=false;
combobox1.Clear;
combobox1.Items.Add('码头前沿');
combobox1.Items.Add('后方库场');
combobox1.Width:=edit1.Width;
combobox1.Height:=edit1.Height;
combobox1.Left:=edit1.Left;
combobox1.Top:=edit1.Top;
end;

if listbox1.ItemIndex=6 then
begin
combobox1.Visible:=true;
edit1.Visible:=false;
combobox1.Clear;
combobox1.Items.Add('废纸');
combobox1.Items.Add('设备');
combobox1.Width:=edit1.Width;
combobox1.Height:=edit1.Height;
combobox1.Left:=edit1.Left;
combobox1.Top:=edit1.Top;
end;


if listbox1.ItemIndex=7 then
begin
combobox1.Visible:=true;
edit1.Visible:=false;
combobox1.Clear;
combobox1.Items.Add('True');
combobox1.Items.Add('False');
combobox1.Width:=edit1.Width;
combobox1.Height:=edit1.Height;
combobox1.Left:=edit1.Left;
combobox1.Top:=edit1.Top;
end;

if (listbox1.ItemIndex=0) or (listbox1.ItemIndex=4)then
begin
combobox1.Visible:=false;
edit1.Visible:=true;
edit2.Text:='';
edit1.Text:='';
EDIT1.SetFocus;
end;


end;

procedure Tfmquerykc.Button2Click(Sender: TObject);
begin
if listbox2.Items.Text<>'' then
begin
query3.Close;
query3.SQL.Clear;
query3.SQL.Add('select * from importcontainer where '+listbox3.Items.Text+'and (Lout=false)');
query3.Open;
statusbar1.Panels[0].Text:='共计: '+inttostr(query3.RecordCount)+' 条记录 ';
end
else
query3.Active:=false;
fmquerykc.Activate;
end;
procedure Tfmquerykc.Button3Click(Sender: TObject);
var j:integer;
begin
j:=listbox2.ItemIndex;
listbox2.DeleteSelected;
listbox3.Items.Delete(j);

end;

procedure Tfmquerykc.Button4Click(Sender: TObject);
begin
listbox2.Clear;
listbox3.Clear;
end;

procedure Tfmquerykc.BitBtn1Click(Sender: TObject);
begin
application.CreateForm(Tfmquerykcreport,fmquerykcreport);
fmquerykcreport.Query1:=query3;
fmquerykcreport.QuickRep1.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText1.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText2.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText3.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText4.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText5.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText6.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText7.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText8.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText9.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText10.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText11.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText12.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText13.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText14.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText15.DataSet:=fmquerykcreport.Query1;
fmquerykcreport.QRDBText16.DataSet:=fmquerykcreport.Query1;

fmquerykcreport.QRLabel18.Caption:=inttostr(fmquerykc.Query3.RecordCount)+' 条记录';
fmquerykcreport.QRLabel19.Caption:='';
fmquerykcreport.QRLabel20.Caption:='';
fmquerykcreport.QRLabel21.Caption:='';
fmquerykcreport.QRLabel22.Caption:='';
fmquerykcreport.QRLabel23.Caption:='';
fmquerykcreport.QuickRep1.Preview;

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -