📄 zhcx.pas
字号:
unit Zhcx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB,comobj, WNQueryEx, ExtCtrls, Grids, DBGridEh;
type
TFrm_zhcx = class(TForm)
Temp: TADOQuery;
DataSource1: TDataSource;
WNQueryEx1: TWNQueryEx;
WNQueryEx2: TWNQueryEx;
WNQueryEx3: TWNQueryEx;
WNQueryEx4: TWNQueryEx;
WNQueryEx5: TWNQueryEx;
WNQueryEx6: TWNQueryEx;
WNQueryEx7: TWNQueryEx;
WNQueryEx8: TWNQueryEx;
WNQueryEx9: TWNQueryEx;
Panel1: TPanel;
DBGridEh5: TDBGridEh;
Panel2: TPanel;
ComboBox1: TComboBox;
Label11: TLabel;
bsSkinButton4: TButton;
bsSkinButton1: TButton;
bsSkinButton2: TButton;
bsSkinButton5: TButton;
bsSkinButton3: TButton;
Panel3: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
LJSC: TLabel;
LJFH: TLabel;
LJFX: TLabel;
LJKC: TLabel;
SaveDialog1: TSaveDialog;
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton1Click(Sender: TObject);
procedure DBGridEh5TitleClick(Column: TColumnEh);
private
{ Private declarations }
procedure WMSysCommand(var Message:TWMSysCommand);message WM_SYSCOMMAND;
public
{ Public declarations }
end;
var
Frm_zhcx: TFrm_zhcx;
flag:boolean;
implementation
{$R *.dfm}
uses main,KCCX,share,dm;
procedure TFrm_zhcx.WMSysCommand(var Message: TWMSysCommand);
begin
if (Message.CmdType = SC_MINIMIZE) or (Message.CmdType = SC_RESTORE)then
WindowState:=wsMaximized
else
inherited;
end;
procedure TFrm_zhcx.bsSkinButton3Click(Sender: TObject);
begin
close;
end;
procedure TFrm_zhcx.bsSkinButton2Click(Sender: TObject);
var i:integer;
begin
case combobox1.ItemIndex of
0:begin
runsql(temp,'select sj as 生产时间, name as 模块名称,gg as 规格, xh as 型号,sl as 生产数量,'
+' czy as 操作员, bz as 备注 from mokuai order by sj desc','open');
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['生产数量']);
temp.Next;
end;
end;
1:begin
runsql(temp,'select sj as 生产时间, name as 半成品名称,gg as 规格, xh as 型号,sl as 生产数量,'
+' czy as 操作员, bz as 备注 from banchengpin order by sj desc','open');
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['生产数量']);
temp.Next;
end;
end;
2:begin
runsql(temp,'select sj as 生产时间, name as 成品名称,gg as 规格, xh as 型号,sl as 生产数量,'
+'sheng as 供应省,shi as 供应市,czy as 操作员 from chengpin order by sj desc','open');
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['生产数量']);
temp.Next;
end;
end;
3:begin
runsql(temp,'select name as 附件名称,xh as 型号,sl as 数量,'
+' bz as 备注 from fujian order by name','open');
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['数量']);
temp.Next;
end;
end;
4:begin
runsql(temp,'select sj as 发货时间, name as 产品名称,gg as 规格, xh as 型号,sl as 发货数量,'
+'sheng as 省,shi as 市, bz as 备注 from fahuo order by sj desc','open');
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljfh.Caption:=inttostr(strtoint(ljfh.Caption)+temp.FieldValues['发货数量']);
temp.Next;
end;
end;
5:runsql(temp,'select name as 模块名称,gg as 规格, xh as 型号,sl as 剩余数量,'
+' bz as 备注 from mokuai_sy order by name','open');
6:runsql(temp,'select name as 半成品名称,gg as 规格, xh as 型号,sl as 剩余数量,'
+' bz as 备注 from banchengpin_sy order by name','open');
7:runsql(temp,'select name as 成品名称,gg as 规格, xh as 型号,sl as 剩余数量,'
+' bz as 备注 from chengpin_sy order by name','open');
8:begin
runsql(temp,'select sj as 返回时间, name as 返修名称,gg as 规格, xh as 型号,sl as 返回数量,'
+'sheng as 返回省,shi as 返回市,bz as 备注 from fanxiu order by sj desc','open');
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljfx.Caption:=inttostr(strtoint(ljfx.Caption)+temp.FieldValues['返回数量']);
temp.Next;
end;
end;
end;
end;
procedure TFrm_zhcx.bsSkinButton4Click(Sender: TObject);
var s1:string;
qstr: string;
i:integer;
begin
try
case combobox1.ItemIndex of
0:begin
s1:='select sj as 生产时间,name as 模块名称,gg as 规格, xh as 型号,sl as 生产数量,'
+' czy as 操作员, bz as 备注 from mokuai where ';
if wnqueryex1.Execute(true) then
begin
qstr :=s1+wnqueryex1.QUeryTerm;
runsql(temp,qstr,'open');
end;
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['生产数量']);
temp.Next;
end;
end;
1:begin
s1:='select sj as 生产时间, name as 半成品名称,gg as 规格, xh as 型号,sl as 生产数量,'
+' czy as 操作员, bz as 备注 from banchengpin where ';
if wnqueryex2.Execute(true) then
begin
qstr :=s1+wnqueryex2.QUeryTerm;
runsql(temp,qstr,'open');
end;
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['生产数量']);
temp.Next;
end;
end;
2:begin
s1:='select sj as 生产时间,name as 成品名称,gg as 规格, xh as 型号,sl as 生产数量,'
+'sheng as 供货省,shi as 供货市,czy as 操作员 from chengpin where ';
if wnqueryex3.Execute(true) then
begin
qstr :=s1+wnqueryex3.QUeryTerm;
runsql(temp,qstr,'open');
end;
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['生产数量']);
temp.Next;
end;
end;
3:begin
s1:='select name as 附件名称,xh as 型号,sl as 数量,'
+' bz as 备注 from fujian where ';
if wnqueryex4.Execute(true) then
begin
qstr :=s1+wnqueryex4.QUeryTerm;
runsql(temp,qstr,'open');
end;
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljsc.Caption:=inttostr(strtoint(ljsc.Caption)+temp.FieldValues['数量']);
temp.Next;
end;
end;
4:begin
s1:='select sj as 发货时间, name as 产品名称,gg as 规格, xh as 型号,sl as 发货数量,'
+' sheng as 省,shi as 市, bz as 备注 from fahuo where ';
if wnqueryex5.Execute(true) then
begin
qstr :=s1+wnqueryex5.QUeryTerm;
runsql(temp,qstr,'open');
end;
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljfh.Caption:=inttostr(strtoint(ljfh.Caption)+temp.FieldValues['发货数量']);
temp.Next;
end;
end;
5:begin
s1:='select name as 模块名称,gg as 规格, xh as 型号,sl as 剩余数量,'
+' bz as 备注 from mokuai_sy where ';
if wnqueryex6.Execute(true) then
begin
qstr :=s1+wnqueryex6.QUeryTerm;
runsql(temp,qstr,'open');
end;
end;
6:begin
s1:='select name as 半成品名称,gg as 规格, xh as 型号,sl as 剩余数量,'
+' bz as 备注 from banchengpin_sy where ';
if wnqueryex7.Execute(true) then
begin
qstr :=s1+wnqueryex7.QUeryTerm;
runsql(temp,qstr,'open');
end;
end;
7:begin
s1:='select name as 成品名称,gg as 规格, xh as 型号,sl as 剩余数量,fhsl as 已发货数量,'
+' bz as 备注 from chengpin_sy where ';
if wnqueryex8.Execute(true) then
begin
qstr :=s1+wnqueryex8.QUeryTerm;
runsql(temp,qstr,'open');
end;
end;
8:begin
s1:='select sj as 返回时间, name as 返修名称,gg as 规格, xh as 型号,sl as 返回数量,'
+'sheng as 返回省,shi as 返回市,bz as 备注 from fanxiu where ';
if wnqueryex9.Execute(true) then
begin
qstr :=s1+wnqueryex9.QUeryTerm;
runsql(temp,qstr,'open');
end;
ljsc.Caption:='0';
ljfh.Caption:='0';
ljfx.Caption:='0';
ljkc.Caption:='0';
if temp.IsEmpty then exit;
for i:=0 to temp.RecordCount-1 do
begin
ljfx.Caption:=inttostr(strtoint(ljfx.Caption)+temp.FieldValues['返回数量']);
temp.Next;
end;
end;
end;
except
messagebox(handle,'请添加查询条件!','提示',64);
exit;
end;
end;
procedure TFrm_zhcx.bsSkinButton5Click(Sender: TObject);
begin
Frm_KCCX:=TFrm_KCCX.Create(Application);
tocombobox(Frm_kccx.box_MC,Frm_kccx.temp,'select distinct name from chengpin order by name','name');
Frm_kccx.box_MC.ItemIndex:=0;
tocombobox(Frm_kccx.box_xh,Frm_kccx.temp,'select distinct xh from chengpin order by xh','xh');
tocombobox(Frm_kccx.box_gg,Frm_kccx.temp,'select distinct gg from chengpin order by gg','gg');
tocombobox(Frm_kccx.box_sheng,Frm_kccx.temp,'select distinct sheng from chengpin order by sheng','sheng');
tocombobox(Frm_kccx.box_shi,Frm_kccx.temp,'select distinct shi from chengpin order by shi','shi');
Frm_kccx.showmodal;
end;
procedure TFrm_zhcx.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Frm_zhcx:=nil;//先
Action:=cafree;//后
frm_main.rzfieldStatus2.Caption :='主界面';
end;
procedure TFrm_zhcx.bsSkinButton1Click(Sender: TObject);
begin
if DBGridEh5.DataSource.DataSet.IsEmpty then exit;
DBGridEHOut(DBGridEh5,SaveDialog1.FileName);
end;
procedure TFrm_zhcx.DBGridEh5TitleClick(Column: TColumnEh);
begin
if temp.IsEmpty then exit;
flag:=not flag;
if Flag then temp.sort:=Column.FieldName+' ASC'
else temp.sort:=Column.FieldName+' DESC';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -