L
libaoliang
Unregistered / Unconfirmed
GUEST, unregistred user!
大狭们看看这段代码为什么出错,delphi5.0+paradox数据库
其中table1-table9 分别代表 cktjbb1-cktjbb9 数据库
以前是可以执行的,当cktjbb1-cktjbb9 这9个数据库各在其最后增加了两个字段a8,l9后
就不行了,另外这种query组件的多次使用方式是否合理,
设计风格是否有问题?欢迎指教!
出问题的是被//的代码部分,其它可以
procedure TForm1.BitBtn1Click(Sender: TObject);
var s,s1,s2,s3,s4,s5,s6,s7,s8:string;
begin
with table1 do
begin
close;
emptytable;
end;
with table2 do
begin
close;
emptytable;
end;
with table3 do
begin
close;
emptytable;
end;
with table4 do
begin
close;
emptytable;
end;
with table5 do
begin
close;
emptytable;
end;
with table6 do
begin
close;
emptytable;
end;
with table7 do
begin
close;
emptytable;
end;
with table8 do
begin
close;
emptytable;
end;
with table9 do
begin
close;
emptytable;
end;
// s:='insert into cktjbb1(bz,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select bz,';
// s:=s+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s:=s+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s:=s+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),asum(a6),sum(a6)*100/sum(rys),';
// s:=s+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7),sum(a1+a2+a3+a4+a5+a6+a7)*100/sum(rys),sum(a8),sum(a8)*100/sum(rys) ';
// s:=s+'from cpkck where (rq between :rq1 and :rq2) group by bz,cpmc';
// query1.close;
// query1.sql.Clear;
// query1.sql.add(s);
// query1.parambyname('rq1').asdate:=datetimepicker1.date;
// query1.parambyname('rq2').asdate:=datetimepicker2.date;
// query1.execsql;
s:='select bz as 班组,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s:=s+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s:=s+'sum(dwp) as 等外品,sum(fp) as 废品,';
s:=s+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s:=s+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s:=s+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s:=s+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s:=s+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s:=s+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s:=s+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s:=s+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s:=s+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s:=s+' from cpkck where (rq between :rq1 and :rq2) group by bz,cpmc';
query1.close;
query1.sql.Clear;
query1.sql.add(s);
query1.parambyname('rq1').asdate:=datetimepicker1.date;
query1.parambyname('rq2').asdate:=datetimepicker2.date;
query1.Open;
// s1:='insert into cktjbb2(cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select cpmc,';
// s1:='insert into cktjbb2(cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select cpmc,';
// s1:=s1+'sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s1:=s1+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s1:=s1+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s1:=s1+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s1:=s1+' from cpkck where (rq between :rq1 and :rq2) group by cpmc';
// query2.close;
// query2.sql.Clear;
// query2.sql.add(s1);
// query2.parambyname('rq1').asdate:=datetimepicker1.date;
// query2.parambyname('rq2').asdate:=datetimepicker2.date;
// query2.execsql;
s1:='select cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s1:=s1+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s1:=s1+'sum(dwp) as 等外品,sum(fp) as 废品,';
s1:=s1+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s1:=s1+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s1:=s1+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s1:=s1+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s1:=s1+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s1:=s1+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s1:=s1+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s1:=s1+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s1:=s1+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s1:=s1+' from cpkck where (rq between :rq1 and :rq2) group by cpmc';
query2.close;
query2.sql.Clear;
query2.sql.add(s1);
query2.parambyname('rq1').asdate:=datetimepicker1.date;
query2.parambyname('rq2').asdate:=datetimepicker2.date;
query2.Open;
// s2:='insert into cktjbb3(thxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select thxm,';
// s2:='insert into cktjbb3(thxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select thxm,';
// s2:=s2+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s2:=s2+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s2:=s2+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s2:=s2+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s2:=s2+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc';
// query3.close;
// query3.sql.Clear;
// query3.sql.add(s2);
// query3.parambyname('rq1').asdate:=datetimepicker1.date;
// query3.parambyname('rq2').asdate:=datetimepicker2.date;
// query3.execsql;
s2:='select thxm as 贴花人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s2:=s2+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s2:=s2+'sum(dwp) as 等外品,sum(fp) as 废品,';
s2:=s2+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s2:=s2+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s2:=s2+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s2:=s2+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s2:=s2+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s2:=s2+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s2:=s2+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s2:=s2+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s2:=s2+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s2:=s2+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc';
query3.close;
query3.sql.Clear;
query3.sql.add(s2);
query3.parambyname('rq1').asdate:=datetimepicker1.date;
query3.parambyname('rq2').asdate:=datetimepicker2.date;
query3.Open;
// s3:='insert into cktjbb4(mkxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select mkxm,';
// s3:='insert into cktjbb4(mkxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select mkxm,';
// s3:=s3+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s3:=s3+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s3:=s3+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s3:=s3+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s3:=s3+' from cpkck where (rq between :rq1 and :rq2) group by mkxm,cpmc';
// query4.close;
// query4.sql.Clear;
// query4.sql.add(s3);
// query4.parambyname('rq1').asdate:=datetimepicker1.date;
// query4.parambyname('rq2').asdate:=datetimepicker2.date;
// query4.execsql;
s3:='select mkxm as 抹口人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s3:=s3+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s3:=s3+'sum(dwp) as 等外品,sum(fp) as 废品,';
s3:=s3+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s3:=s3+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s3:=s3+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s3:=s3+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s3:=s3+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s3:=s3+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s3:=s3+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s3:=s3+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s3:=s3+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s3:=s3+' from cpkck where (rq between :rq1 and :rq2) group by mkxm,cpmc';
query4.close;
query4.sql.Clear;
query4.sql.add(s3);
query4.parambyname('rq1').asdate:=datetimepicker1.date;
query4.parambyname('rq2').asdate:=datetimepicker2.date;
query4.Open;
// s4:='insert into cktjbb5(jxxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select jxxm,';
// s4:='insert into cktjbb5(jxxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select jxxm,';
// s4:=s4+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s4:=s4+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s4:=s4+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s4:=s4+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s4:=s4+' from cpkck where (rq between :rq1 and :rq2) group by jxxm,cpmc';
// query5.close;
// query5.sql.Clear;
// query5.sql.add(s4);
// query5.parambyname('rq1').asdate:=datetimepicker1.date;
// query5.parambyname('rq2').asdate:=datetimepicker2.date;
// query5.execsql;
s4:='select jxxm as 介线人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s4:=s4+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s4:=s4+'sum(dwp) as 等外品,sum(fp) as 废品,';
s4:=s4+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s4:=s4+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s4:=s4+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s4:=s4+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s4:=s4+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s4:=s4+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s4:=s4+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s4:=s4+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s4:=s4+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s4:=s4+' from cpkck where (rq between :rq1 and :rq2) group by jxxm,cpmc';
query5.close;
query5.sql.Clear;
query5.sql.add(s4);
query5.parambyname('rq1').asdate:=datetimepicker1.date;
query5.parambyname('rq2').asdate:=datetimepicker2.date;
query5.Open;
// s5:='insert into cktjbb6(khxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select khxm,';
// s5:='insert into cktjbb6(khxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select khxm,';
// s5:=s5+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s5:=s5+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s5:=s5+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s5:=s5+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s5:=s5+' from cpkck where (rq between :rq1 and :rq2) group by khxm,cpmc';
// query6.close;
// query6.sql.Clear;
// query6.sql.add(s5);
// query6.parambyname('rq1').asdate:=datetimepicker1.date;
// query6.parambyname('rq2').asdate:=datetimepicker2.date;
// query6.execsql;
s5:='select khxm as 烤花人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s5:=s5+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s5:=s5+'sum(dwp) as 等外品,sum(fp) as 废品,';
s5:=s5+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s5:=s5+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s5:=s5+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s5:=s5+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s5:=s5+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s5:=s5+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s5:=s5+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s5:=s5+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s5:=s5+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s5:=s5+' from cpkck where (rq between :rq1 and :rq2) group by khxm,cpmc';
query6.close;
query6.sql.Clear;
query6.sql.add(s5);
query6.parambyname('rq1').asdate:=datetimepicker1.date;
query6.parambyname('rq2').asdate:=datetimepicker2.date;
query6.Open;
// s6:='insert into cktjbb7(jsxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select jsxm,';
// s6:='insert into cktjbb7(jsxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select jsxm,';
// s6:=s6+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s6:=s6+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s6:=s6+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s6:=s6+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s6:=s6+' from cpkck where (rq between :rq1 and :rq2) group by jsxm,cpmc';
// query7.close;
// query7.sql.Clear;
// query7.sql.add(s6);
// query7.parambyname('rq1').asdate:=datetimepicker1.date;
// query7.parambyname('rq2').asdate:=datetimepicker2.date;
// query7.execsql;
s6:='select jsxm as 检选人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s6:=s6+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s6:=s6+'sum(dwp) as 等外品,sum(fp) as 废品,';
s6:=s6+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s6:=s6+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s6:=s6+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s6:=s6+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s6:=s6+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s6:=s6+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s6:=s6+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s6:=s6+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s6:=s6+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s6:=s6+' from cpkck where (rq between :rq1 and :rq2) group by jsxm,cpmc';
query7.close;
query7.sql.Clear;
query7.sql.add(s6);
query7.parambyname('rq1').asdate:=datetimepicker1.date;
query7.parambyname('rq2').asdate:=datetimepicker2.date;
query7.Open;
// s7:='insert into cktjbb8(cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select cpmc,hh,';
// s7:='insert into cktjbb8(cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select cpmc,hh,';
// s7:=s7+'sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s7:=s7+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s7:=s7+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s7:=s7+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s7:=s7+' from cpkck where (rq between :rq1 and :rq2) group by cpmc,hh';
// query8.close;
// query8.sql.Clear;
// query8.sql.add(s7);
// query8.parambyname('rq1').asdate:=datetimepicker1.date;
// query8.parambyname('rq2').asdate:=datetimepicker2.date;
// query8.execsql;
s7:='select cpmc as 产品名称,hh as 花号,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s7:=s7+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s7:=s7+'sum(dwp) as 等外品,sum(fp) as 废品,';
s7:=s7+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s7:=s7+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s7:=s7+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s7:=s7+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s7:=s7+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s7:=s7+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s7:=s7+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s7:=s7+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s7:=s7+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s7:=s7+' from cpkck where (rq between :rq1 and :rq2) group by cpmc,hh';
query8.close;
query8.sql.Clear;
query8.sql.add(s7);
query8.parambyname('rq1').asdate:=datetimepicker1.date;
query8.parambyname('rq2').asdate:=datetimepicker2.date;
query8.Open;
// s8:='insert into cktjbb9(thxm,cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select thxm,cpmc,hh,';
// s8:='insert into cktjbb9(thxm,cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select thxm,cpmc,hh,';
// s8:=s8+'sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s8:=s8+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s8:=s8+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s8:=s8+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s8:=s8+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc,hh';
// query9.close;
// query9.sql.Clear;
// query9.sql.add(s8);
// query9.parambyname('rq1').asdate:=datetimepicker1.date;
// query9.parambyname('rq2').asdate:=datetimepicker2.date;
// query9.execsql;
s8:='select thxm as 贴花人,cpmc as 产品名称,hh as 花号,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s8:=s8+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s8:=s8+'sum(dwp) as 等外品,sum(fp) as 废品,';
s8:=s8+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s8:=s8+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s8:=s8+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s8:=s8+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s8:=s8+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s8:=s8+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s8:=s8+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s8:=s8+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s8:=s8+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s8:=s8+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc,hh';
query9.close;
query9.sql.Clear;
query9.sql.add(s8);
query9.parambyname('rq1').asdate:=datetimepicker1.date;
query9.parambyname('rq2').asdate:=datetimepicker2.date;
query9.Open;
end;
其中table1-table9 分别代表 cktjbb1-cktjbb9 数据库
以前是可以执行的,当cktjbb1-cktjbb9 这9个数据库各在其最后增加了两个字段a8,l9后
就不行了,另外这种query组件的多次使用方式是否合理,
设计风格是否有问题?欢迎指教!
出问题的是被//的代码部分,其它可以
procedure TForm1.BitBtn1Click(Sender: TObject);
var s,s1,s2,s3,s4,s5,s6,s7,s8:string;
begin
with table1 do
begin
close;
emptytable;
end;
with table2 do
begin
close;
emptytable;
end;
with table3 do
begin
close;
emptytable;
end;
with table4 do
begin
close;
emptytable;
end;
with table5 do
begin
close;
emptytable;
end;
with table6 do
begin
close;
emptytable;
end;
with table7 do
begin
close;
emptytable;
end;
with table8 do
begin
close;
emptytable;
end;
with table9 do
begin
close;
emptytable;
end;
// s:='insert into cktjbb1(bz,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select bz,';
// s:=s+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s:=s+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s:=s+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),asum(a6),sum(a6)*100/sum(rys),';
// s:=s+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7),sum(a1+a2+a3+a4+a5+a6+a7)*100/sum(rys),sum(a8),sum(a8)*100/sum(rys) ';
// s:=s+'from cpkck where (rq between :rq1 and :rq2) group by bz,cpmc';
// query1.close;
// query1.sql.Clear;
// query1.sql.add(s);
// query1.parambyname('rq1').asdate:=datetimepicker1.date;
// query1.parambyname('rq2').asdate:=datetimepicker2.date;
// query1.execsql;
s:='select bz as 班组,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s:=s+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s:=s+'sum(dwp) as 等外品,sum(fp) as 废品,';
s:=s+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s:=s+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s:=s+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s:=s+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s:=s+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s:=s+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s:=s+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s:=s+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s:=s+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s:=s+' from cpkck where (rq between :rq1 and :rq2) group by bz,cpmc';
query1.close;
query1.sql.Clear;
query1.sql.add(s);
query1.parambyname('rq1').asdate:=datetimepicker1.date;
query1.parambyname('rq2').asdate:=datetimepicker2.date;
query1.Open;
// s1:='insert into cktjbb2(cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select cpmc,';
// s1:='insert into cktjbb2(cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select cpmc,';
// s1:=s1+'sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s1:=s1+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s1:=s1+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s1:=s1+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s1:=s1+' from cpkck where (rq between :rq1 and :rq2) group by cpmc';
// query2.close;
// query2.sql.Clear;
// query2.sql.add(s1);
// query2.parambyname('rq1').asdate:=datetimepicker1.date;
// query2.parambyname('rq2').asdate:=datetimepicker2.date;
// query2.execsql;
s1:='select cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s1:=s1+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s1:=s1+'sum(dwp) as 等外品,sum(fp) as 废品,';
s1:=s1+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s1:=s1+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s1:=s1+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s1:=s1+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s1:=s1+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s1:=s1+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s1:=s1+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s1:=s1+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s1:=s1+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s1:=s1+' from cpkck where (rq between :rq1 and :rq2) group by cpmc';
query2.close;
query2.sql.Clear;
query2.sql.add(s1);
query2.parambyname('rq1').asdate:=datetimepicker1.date;
query2.parambyname('rq2').asdate:=datetimepicker2.date;
query2.Open;
// s2:='insert into cktjbb3(thxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select thxm,';
// s2:='insert into cktjbb3(thxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select thxm,';
// s2:=s2+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s2:=s2+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s2:=s2+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s2:=s2+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s2:=s2+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc';
// query3.close;
// query3.sql.Clear;
// query3.sql.add(s2);
// query3.parambyname('rq1').asdate:=datetimepicker1.date;
// query3.parambyname('rq2').asdate:=datetimepicker2.date;
// query3.execsql;
s2:='select thxm as 贴花人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s2:=s2+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s2:=s2+'sum(dwp) as 等外品,sum(fp) as 废品,';
s2:=s2+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s2:=s2+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s2:=s2+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s2:=s2+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s2:=s2+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s2:=s2+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s2:=s2+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s2:=s2+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s2:=s2+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s2:=s2+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc';
query3.close;
query3.sql.Clear;
query3.sql.add(s2);
query3.parambyname('rq1').asdate:=datetimepicker1.date;
query3.parambyname('rq2').asdate:=datetimepicker2.date;
query3.Open;
// s3:='insert into cktjbb4(mkxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select mkxm,';
// s3:='insert into cktjbb4(mkxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select mkxm,';
// s3:=s3+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s3:=s3+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s3:=s3+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s3:=s3+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s3:=s3+' from cpkck where (rq between :rq1 and :rq2) group by mkxm,cpmc';
// query4.close;
// query4.sql.Clear;
// query4.sql.add(s3);
// query4.parambyname('rq1').asdate:=datetimepicker1.date;
// query4.parambyname('rq2').asdate:=datetimepicker2.date;
// query4.execsql;
s3:='select mkxm as 抹口人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s3:=s3+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s3:=s3+'sum(dwp) as 等外品,sum(fp) as 废品,';
s3:=s3+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s3:=s3+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s3:=s3+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s3:=s3+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s3:=s3+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s3:=s3+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s3:=s3+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s3:=s3+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s3:=s3+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s3:=s3+' from cpkck where (rq between :rq1 and :rq2) group by mkxm,cpmc';
query4.close;
query4.sql.Clear;
query4.sql.add(s3);
query4.parambyname('rq1').asdate:=datetimepicker1.date;
query4.parambyname('rq2').asdate:=datetimepicker2.date;
query4.Open;
// s4:='insert into cktjbb5(jxxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select jxxm,';
// s4:='insert into cktjbb5(jxxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select jxxm,';
// s4:=s4+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s4:=s4+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s4:=s4+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s4:=s4+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s4:=s4+' from cpkck where (rq between :rq1 and :rq2) group by jxxm,cpmc';
// query5.close;
// query5.sql.Clear;
// query5.sql.add(s4);
// query5.parambyname('rq1').asdate:=datetimepicker1.date;
// query5.parambyname('rq2').asdate:=datetimepicker2.date;
// query5.execsql;
s4:='select jxxm as 介线人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s4:=s4+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s4:=s4+'sum(dwp) as 等外品,sum(fp) as 废品,';
s4:=s4+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s4:=s4+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s4:=s4+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s4:=s4+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s4:=s4+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s4:=s4+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s4:=s4+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s4:=s4+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s4:=s4+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s4:=s4+' from cpkck where (rq between :rq1 and :rq2) group by jxxm,cpmc';
query5.close;
query5.sql.Clear;
query5.sql.add(s4);
query5.parambyname('rq1').asdate:=datetimepicker1.date;
query5.parambyname('rq2').asdate:=datetimepicker2.date;
query5.Open;
// s5:='insert into cktjbb6(khxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select khxm,';
// s5:='insert into cktjbb6(khxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select khxm,';
// s5:=s5+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s5:=s5+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s5:=s5+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s5:=s5+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s5:=s5+' from cpkck where (rq between :rq1 and :rq2) group by khxm,cpmc';
// query6.close;
// query6.sql.Clear;
// query6.sql.add(s5);
// query6.parambyname('rq1').asdate:=datetimepicker1.date;
// query6.parambyname('rq2').asdate:=datetimepicker2.date;
// query6.execsql;
s5:='select khxm as 烤花人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s5:=s5+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s5:=s5+'sum(dwp) as 等外品,sum(fp) as 废品,';
s5:=s5+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s5:=s5+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s5:=s5+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s5:=s5+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s5:=s5+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s5:=s5+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s5:=s5+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s5:=s5+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s5:=s5+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s5:=s5+' from cpkck where (rq between :rq1 and :rq2) group by khxm,cpmc';
query6.close;
query6.sql.Clear;
query6.sql.add(s5);
query6.parambyname('rq1').asdate:=datetimepicker1.date;
query6.parambyname('rq2').asdate:=datetimepicker2.date;
query6.Open;
// s6:='insert into cktjbb7(jsxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select jsxm,';
// s6:='insert into cktjbb7(jsxm,cpmc,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select jsxm,';
// s6:=s6+'cpmc,sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s6:=s6+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s6:=s6+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s6:=s6+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s6:=s6+' from cpkck where (rq between :rq1 and :rq2) group by jsxm,cpmc';
// query7.close;
// query7.sql.Clear;
// query7.sql.add(s6);
// query7.parambyname('rq1').asdate:=datetimepicker1.date;
// query7.parambyname('rq2').asdate:=datetimepicker2.date;
// query7.execsql;
s6:='select jsxm as 检选人,cpmc as 产品名称,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s6:=s6+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s6:=s6+'sum(dwp) as 等外品,sum(fp) as 废品,';
s6:=s6+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s6:=s6+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s6:=s6+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s6:=s6+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s6:=s6+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s6:=s6+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s6:=s6+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s6:=s6+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s6:=s6+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s6:=s6+' from cpkck where (rq between :rq1 and :rq2) group by jsxm,cpmc';
query7.close;
query7.sql.Clear;
query7.sql.add(s6);
query7.parambyname('rq1').asdate:=datetimepicker1.date;
query7.parambyname('rq2').asdate:=datetimepicker2.date;
query7.Open;
// s7:='insert into cktjbb8(cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select cpmc,hh,';
// s7:='insert into cktjbb8(cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select cpmc,hh,';
// s7:=s7+'sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s7:=s7+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s7:=s7+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s7:=s7+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s7:=s7+' from cpkck where (rq between :rq1 and :rq2) group by cpmc,hh';
// query8.close;
// query8.sql.Clear;
// query8.sql.add(s7);
// query8.parambyname('rq1').asdate:=datetimepicker1.date;
// query8.parambyname('rq2').asdate:=datetimepicker2.date;
// query8.execsql;
s7:='select cpmc as 产品名称,hh as 花号,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s7:=s7+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s7:=s7+'sum(dwp) as 等外品,sum(fp) as 废品,';
s7:=s7+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s7:=s7+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s7:=s7+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s7:=s7+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s7:=s7+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s7:=s7+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s7:=s7+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s7:=s7+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s7:=s7+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s7:=s7+' from cpkck where (rq between :rq1 and :rq2) group by cpmc,hh';
query8.close;
query8.sql.Clear;
query8.sql.add(s7);
query8.parambyname('rq1').asdate:=datetimepicker1.date;
query8.parambyname('rq2').asdate:=datetimepicker2.date;
query8.Open;
// s8:='insert into cktjbb9(thxm,cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8,a8,l9) select thxm,cpmc,hh,';
// s8:='insert into cktjbb9(thxm,cpmc,hh,rys,yjp,yjl,hgs,hgl,dwp,fp,a1,l1,a2,l2,a3,l3,a4,l4,a5,l5,a6,l6,a7,l7,hj,l8) select thxm,cpmc,hh,';
// s8:=s8+'sum(rys),sum(yjp),sum(yjp)*100/sum(rys),sum(hgs),sum(hgs)*100/sum(rys),sum(dwp),sum(fp),';
// s8:=s8+'sum(a1),sum(a1)*100/sum(rys),sum(a2),sum(a2)*100/sum(rys),sum(a3),sum(a3)*100/sum(rys),';
// s8:=s8+'sum(a4),sum(a4)*100/sum(rys),sum(a5),sum(a5)*100/sum(rys),sum(a6),sum(a6)*100/sum(rys),';
// s8:=s8+'sum(a7),sum(a7)*100/sum(rys),sum(a1+a2+a3+a4+a5+a6+a7+a8),sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys)';
// s8:=s8+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc,hh';
// query9.close;
// query9.sql.Clear;
// query9.sql.add(s8);
// query9.parambyname('rq1').asdate:=datetimepicker1.date;
// query9.parambyname('rq2').asdate:=datetimepicker2.date;
// query9.execsql;
s8:='select thxm as 贴花人,cpmc as 产品名称,hh as 花号,sum(rys) as 入窑数,sum(yjp) as 一级品,sum(yjp)*100/sum(rys) as 一级率,';
s8:=s8+'sum(hgs) as 合格数,sum(hgs)*100/sum(rys) as 合格率,';
s8:=s8+'sum(dwp) as 等外品,sum(fp) as 废品,';
s8:=s8+'sum(a1) as 炸瓷,sum(a1)*100/sum(rys) as 比率,';
s8:=s8+'sum(a2) as 爆花,sum(a2)*100/sum(rys) as 比率,';
s8:=s8+'sum(a3) as 断线,sum(a3)*100/sum(rys) as 比率,';
s8:=s8+'sum(a4) as 脏金,sum(a4)*100/sum(rys) as 比率,';
s8:=s8+'sum(a5) as 色脏,sum(a5)*100/sum(rys) as 比率,';
s8:=s8+'sum(a6) as 磕碰,sum(a6)*100/sum(rys) as 比率,';
s8:=s8+'sum(a8) as 白瓷过序,sum(a8)*100/sum(rys) as 比率,';
s8:=s8+'sum(a7) as 其它,sum(a7)*100/sum(rys) as 比率,';
s8:=s8+'sum(a1+a2+a3+a4+a5+a6+a7+a8) as 缺陷合计,sum(a1+a2+a3+a4+a5+a6+a7+a8)*100/sum(rys) as 比率';
s8:=s8+' from cpkck where (rq between :rq1 and :rq2) group by thxm,cpmc,hh';
query9.close;
query9.sql.Clear;
query9.sql.add(s8);
query9.parambyname('rq1').asdate:=datetimepicker1.date;
query9.parambyname('rq2').asdate:=datetimepicker2.date;
query9.Open;
end;