Home > Back-end >  Delphi7 BOM with BOM explosion problem
Delphi7 BOM with BOM explosion problem

Time:11-11

There are more lines in the DBGrid controls into springtime delights and production quantity, number into springtime delights corresponding BOM has been created, how do I cycle DBGrid1 each line into springtime delights, out of the corresponding BOM list and the dosage? Below is my code, but dose not always correspond to the material,, please point out the problem, thank you!

Procedure TBOMTH. BitBtn2Click (Sender: TObject);
Var
B, c, I, k: integer;
D, e, f, g: string;
KB, ka: string;
A: the real;
The begin
Ka:=formatdatetime (' yyyymmdd 'date); No.//credentials
With ADOQuery2 do
The begin
The close;
SQL. The Clear;
SQL. The Add (' select Max (TC001) as kaw from BOMTC where TC001 like ' ' '+ ka +' % '");
The open;
If length (FieldByName (' kaw) AsString) are identical=0 then
The begin
Ka: ka +='001';
End
The else
The begin
KB:=inttostr (strtoint (copy (FieldByName (' kaw). AsString, 9, 3)) + 1);
While length (KB) & lt; 3 do
KB:='0' + KB;
Ka:=ka + KB;
end;
If dbgrid1. The DataSource. The DataSet. FieldByName (' certificate number). AsString="' then
Application. The MessageBox (' there is no production plan can be generated! ', 'prompt', 0 + 64)
The else


The begin

ADOQuery1. First;
While not ADOQuery1. Eof do

//the begin
With ADOQuery2 do
The begin
The close;
SQL. The Clear;
SQL. The Add (' select TA001 TA006, TA007, TA008, TA009, TA011 from BOMTA WHERE TA001='" + DBGrid1. Fields [1]. The Value + "' ");
The open;
//end;
If ADOQuery1. RecordCount> 0 then

D:=DBGrid1 Fields [0]. Value; No.//the original voucher
E:=DBGrid1 Fields. [8] the Value;//material requirements date
//a:=strtofloat (ADOQuery2 FieldByName (' TA011). AsString) are identical. * DBGrid1 Fields. [5] the Value;
ADOQuery1. Next;
//end;

//the begin

ADOQuery2. First;
While not ADOQuery2. Eof do

With ADOQuery3 do
The begin
The close;
SQL. The clear;
SQL. The add (' insert into BOMTC (TC001 TC002, TC003, TC004, TC005, TC006, TC007, TC008, TC009) VALUES (: : a1, a2, a3, : a4, : a5, : a6, : a7, : a8, : a9) ');

The Parameters. ParamByName (" a1 "). The Value:=ka; No.//credentials
The Parameters. ParamByName (' a2 '). The Value:=d; No.//the original vouchers//ADOQuery4 FieldByName (' TB001). AsString;
The Parameters. ParamByName (' a3). The Value:=ADOQuery2. FieldByName (' TA006). AsString;//material quality,
The Parameters. ParamByName (' a4). The Value:=ADOQuery2. FieldByName (' TA007). AsString;//material commodity
The Parameters. ParamByName (' the a5). The Value:=ADOQuery2. FieldByName (' TA008). AsString;//material specification
The Parameters. ParamByName (' a6). The Value:=ADOQuery2. FieldByName (' TA009). AsString;//
The Parameters. ParamByName (' a7). The Value:=strtofloat (ADOQuery2. FieldByName (' TA011). AsString) are identical. * DBGrid1 Fields [5]. The Value;//material dosage//strtoint (ADOQuery4 FieldByName (' TB006). AsString) are identical.
The Parameters. ParamByName (' a8). The Value:=e;//material requirements date//ADOQuery4 FieldByName (' TB009). AsString;
The Parameters. ParamByName (' a9). Value:=1;

Execsql;

ADOQuery2. Next;

//Next;
end;
end;


CodePudding user response:

Take corresponding number out of the material goods, but material usage but can't I finished product on the corresponding production amount,

CodePudding user response:

How simple logic, according to the idea succeeds

CodePudding user response:

I just contact Delphi7, the loop is not too will use, show just a little trouble with all of you, thank you!
  • Related