var a,b:integer;
begin
For a:=1 to StrToInt(Edit2.Text) do
begin
with Adoquery2 do //保存主表信息
begin
Close;
SQl.Clear;
SQl.Add('select * from fj');
open;
insert;
FieldByName('fj').AsString:=edit1.Text+'0'+IntToStr(a);
FieldByName('kd').AsString:=edit3.Text;
post;
end;
with Adoquery4 do
begin
Close;
SQl.Clear;
SQl.Add('select * from bomindex where name = :b');
parameters.ParamByName('b').Value:=''+Edit1.Text+'';
open;
Edit;
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[strtofloat(Edit4.Text)-strtofloat(Edit3.Text)]));
updaterecord;
post;
end;
end;
end;
begin
For a:=1 to StrToInt(Edit2.Text) do
begin
with Adoquery2 do //保存主表信息
begin
Close;
SQl.Clear;
SQl.Add('select * from fj');
open;
insert;
FieldByName('fj').AsString:=edit1.Text+'0'+IntToStr(a);
FieldByName('kd').AsString:=edit3.Text;
post;
end;
with Adoquery4 do
begin
Close;
SQl.Clear;
SQl.Add('select * from bomindex where name = :b');
parameters.ParamByName('b').Value:=''+Edit1.Text+'';
open;
Edit;
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[strtofloat(Edit4.Text)-strtofloat(Edit3.Text)]));
updaterecord;
post;
end;
end;
end;
解决方案 »
- DELPHI下该用哪个函数代替VB下的CSTR函数?
- 谁知道adoconnection的open时,如果服务器关闭,会触发哪个异常?
- 关于线程的问题
- 请问:是不是有现成的中文语音库,怎么调用TTS ???
- ~~~~~~~~~~~~~~~~~~~~~~~10代码500分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 菜虫问题:已知一个字符串str,怎么从头到尾得到她的每一个字符???
- 请教一个adoquery与dbgrid的问题??
- DLL问题(高手请进)
- 15000行代码,100多个窗体,的进销存,值多少钱
- 又是派分的问题
- 请大家推荐一些intraweb的好书和资料
- 图像问题
For a:=1 to StrToInt(Edit2.Text) do
begin
with Adoquery2 do //保存主表信息
begin
Close;
SQl.Clear;
SQl.Add('select * from fj');
open;
insert;
FieldByName('fj').AsString:=edit1.Text+'0'+IntToStr(a);
FieldByName('kd').AsString:=edit3.Text;
post;
end;
通过上述得到
a=3
edit1.Text=00001 edit3.Text=20
确定后得到
分卷号 宽度
0000101 20
0000102 20
0000103 20这实现成功了,没问题
with Adoquery4 do
begin
Close;
SQl.Clear;
SQl.Add('select * from bomindex where name = :b');
parameters.ParamByName('b').Value:=''+Edit1.Text+'';
open;
Edit;
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[strtofloat(Edit4.Text)-strtofloat(Edit3.Text)]));
updaterecord;
post;
end;
这里想实现00001 总宽数123cm要减去每次切的宽度20cm,最后得到123-20*3=63,这才是正确的
但这里只实现了123-20*1,只实现了一次,没有切三次with Adoquery4 do
begin
Close;
SQl.Clear;
SQl.Add('select * from bomindex where name = :b');
parameters.ParamByName('b').Value:=''+Edit1.Text+'';
open;
Edit;
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[strtofloat(Edit4.Text)-strtofloat(Edit3.Text)]));
updaterecord;
post;
end;
清楚了吧
begin
Close;
SQl.Clear;
SQl.Add('select * from bomindex where name = :b');
//parameters.ParamByName('b').Value:=''+Edit1.Text+'';
parameters.ParamByName('b').Value:=Edit1.Text; //!!改一下试试
open;
Edit;
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[strtofloat(Edit4.Text)-strtofloat(Edit3.Text)]));
updaterecord;
post;
end;
a,b:integer;
Width: Double;//!!
begin
Width := strtofloat(Edit4.Text); //!!
For a:=1 to StrToInt(Edit2.Text) do
begin
with Adoquery2 do //保存主表信息
begin
Close;
SQl.Clear;
SQl.Add('select * from fj');
open;
insert;
FieldByName('fj').AsString:=edit1.Text+'0'+IntToStr(a);
FieldByName('kd').AsString:=edit3.Text;
post;
end;
with Adoquery4 do
begin
Close;
SQl.Clear;
SQl.Add('select * from bomindex where name = :b');
parameters.ParamByName('b').Value:=''+Edit1.Text+'';
open;
Edit;
Width := Width - strtofloat(Edit3.Text);//每更减一点
//strtofloat(Edit3.Text)]));
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[strtofloat(Edit4.Text)-strtofloat(Edit3.Text)])); //这里有问题
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[Width]));
updaterecord;
post;
end;
end;
end;
begin
inherited;
if strtofloat(Edit4.Text)<strtofloat(Edit2.Text) * strtofloat(Edit3.Text) then
begin
Application.MessageBox('分卷宽度大于实现宽度','提示',mb_ok);
Exit;
end; begin
try
dm1.ADOConnection1.BeginTrans; //启动事务
For a:=1 to StrToInt(Edit2.Text) do
begin
with Adoquery2 do //保存主表信息
begin
Close;
SQl.Clear;
SQl.Add('select * from fj');
open;
insert;
FieldByName('fj').AsString:=edit1.Text+'0'+IntToStr(a);
FieldByName('kd').AsString:=edit3.Text;
FieldByName('name').AsString:=edit1.Text;
post;
end;
with Adoquery4 do
begin
Close;
SQl.Clear;
SQl.Add('select * from bomindex where name = :b');
parameters.ParamByName('b').Value:=''+Edit1.Text+'';
open;
Edit;
FieldByName('kd').AsFloat:=strtofloat(format('%10.4f',[strtofloat(Edit4.Text)-strtofloat(Edit2.Text)*strtofloat(Edit3.Text)]));
updaterecord;
post;
end;end;
dm1.ADOConnection1.CommitTrans; //提交事务
Application.MessageBox('分卷成功','提示',mb_ok); except
dm1.ADOConnection1.RollbackTrans; //回滚事务
Application.MessageBox('分卷不成功','提示',mb_ok);
end;
不过我还想得到相应的分切明细表,如图编号为00001的卷,下面还有三个小卷,当切三次时,应该得到9小卷,
也就是还想得到
小卷编号 大卷编号
p0000101 0000101
p0000102 0000101
p0000103 0000101
p0000101 0000102
p0000102 0000102
p0000103 0000102
p0000101 0000103
p0000102 0000103
p0000103 0000103
我不知道如何循环取得小卷编号,并与切卷数关联产生
这是输入大卷号得到相应小卷的代码
with adoquery1 do
begin
close;
SQl.Clear;
SQl.Add('select * from bomdetail where name = :a');
parameters.ParamByName('a').Value:=''+Edit1.Text+'';
Open;
end;希望你再帮我一次,万分感激