📄 output.~pas
字号:
bumenshu := Query1.FieldByName('zbshuliang').AsString;
bumenshu := FloatToStr(StrToFloat(bumenshu)-StrToFloat(values));
bumenjine := FloatToStr(StrToFloat(bumenshu)*StrToFloat(Edit3.Text));
sql := 'Update WeekHaoCai set chukushuliang='''+chukushu+''',chukujine='''+chukujine+
''',zbshuliang='''+bumenshu+''',zbjine='''+bumenjine+''',jiecunshuliang='''+
jiecunshu+''',jiecunjine='''+jiecunjine+''' where nian='+IntToStr(nian)+' and zhou='+
IntToStr(zhou)+' and class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''';
end;
if ComboBox1.Text = '财务部' then
begin
bumenshu := Query1.FieldByName('cwbshuliang').AsString;
bumenshu := FloatToStr(StrToFloat(bumenshu)-StrToFloat(values));
bumenjine := FloatToStr(StrToFloat(bumenshu)*StrToFloat(Edit3.Text));
sql := 'Update WeekHaoCai set chukushuliang='''+chukushu+''',chukujine='''+chukujine+
''',cwbshuliang='''+bumenshu+''',cwbjine='''+bumenjine+''',jiecunshuliang='''+
jiecunshu+''',jiecunjine='''+jiecunjine+''' where nian='+IntToStr(nian)+' and zhou='+
IntToStr(zhou)+' and class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''';
end;
if ComboBox1.Text = '品管部' then
begin
bumenshu := Query1.FieldByName('pgbshuliang').AsString;
bumenshu := FloatToStr(StrToFloat(bumenshu)-StrToFloat(values));
bumenjine := FloatToStr(StrToFloat(bumenshu)*StrToFloat(Edit3.Text));
sql := 'Update WeekHaoCai set chukushuliang='''+chukushu+''',chukujine='''+chukujine+
''',pgbshuliang='''+bumenshu+''',pgbjine='''+bumenjine+''',jiecunshuliang='''+
jiecunshu+''',jiecunjine='''+jiecunjine+''' where nian='+IntToStr(nian)+' and zhou='+
IntToStr(zhou)+' and class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''';
end;
if ComboBox1.Text = '销管中心' then
begin
bumenshu := Query1.FieldByName('xgzxshuliang').AsString;
bumenshu := FloatToStr(StrToFloat(bumenshu)-StrToFloat(values));
bumenjine := FloatToStr(StrToFloat(bumenshu)*StrToFloat(Edit3.Text));
sql := 'Update WeekHaoCai set chukushuliang='''+chukushu+''',chukujine='''+chukujine+
''',xgzxshuliang='''+bumenshu+''',xgzxjine='''+bumenjine+''',jiecunshuliang='''+
jiecunshu+''',jiecunjine='''+jiecunjine+''' where nian='+IntToStr(nian)+' and zhou='+
IntToStr(zhou)+' and class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''';
end;
if ComboBox1.Text = '业务部' then
begin
bumenshu := Query1.FieldByName('ywbshuliang').AsString;
bumenshu := FloatToStr(StrToFloat(bumenshu)-StrToFloat(values));
bumenjine := FloatToStr(StrToFloat(bumenshu)*StrToFloat(Edit3.Text));
sql := 'Update WeekHaoCai set chukushuliang='''+chukushu+''',chukujine='''+chukujine+
''',ywbshuliang='''+bumenshu+''',ywbjine='''+bumenjine+''',jiecunshuliang='''+
jiecunshu+''',jiecunjine='''+jiecunjine+''' where nian='+IntToStr(nian)+' and zhou='+
IntToStr(zhou)+' and class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''';
end;
Query1.Close; {更新WeekHaoCai和WeekDataCache}
Query1.SQL.Clear;
Query1.SQL.Add(sql);
Query1.ExecSQL;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Update WeekDataCache set chukushu='''+chukushu+''',chukujine='''+
chukujine+''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
Query1.ExecSQL;
end;
{月}
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select max(riqi) as maxDate from MonthHaoCai where class='''+clclass+
''' and cailiaoming='''+Edit1.Text+'''');
Query1.Prepared;
Query1.Open;
if Not Query1.Eof then
riqi := Query1.FieldByName('maxDate').AsString;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from MonthHaoCai where class='''+clclass+''' and cailiaoming='''+
Edit1.Text+''' and riqi='''+riqi+'''');
Query1.Prepared;
Query1.Open; {提取数}
if Not Query1.Eof then
begin
kucunshu := Query1.FieldByName('kucunshu').AsString;
kucunjine := Query1.FieldbyName('kucunjine').AsString;
rukushu := Query1.FieldbyName('rukushu').AsString;
rukujine := Query1.FieldbyName('rukujine').AsString;
chukushu := Query1.FieldbyName('chukushu').AsString;
chukushu := FloatToStr(StrToFloat(chukushu)-StrToFloat(values));
chukujine := FloatToStr(StrToFloat(chukushu)*StrToFloat(Edit3.Text));
jiecunshu := FloatToStr(StrToFloat(kucunshu)+StrToFloat(rukushu)-StrToFloat(chukushu));
jiecunjine := FloatToStr(StrToFloat(kucunjine)+StrToFloat(rukujine)-StrToFloat(chukujine));
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Update MonthHaoCai set chukushu='''+chukushu+''',chukujine='''+chukujine+
''',jiecunshu='''+jiecunshu+''',jiecunjine='''+jiecunjine+''' where class='''+
clclass+''' and cailiaoming='''+Edit1.Text+''' and riqi='''+riqi+'''');
Query1.ExecSQL;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Update MonthDataCache set chukushu='''+chukushu+''',chukujine='''+chukujine+
''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
Query1.ExecSQL;
end;
{年}
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select max(nian) as maxYear from YearHaoCai where class='''+clclass+''' and cailiaoming='''+
Edit1.Text+'''');
Query1.Prepared;
Query1.Open;
if Not Query1.Eof then
nian := Query1.FieldByName('maxYear').AsInteger;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from YearHaoCai where class='''+clclass+''' and cailiaoming='''+Edit1.Text+
''' and nian='+IntToStr(nian));
Query1.Prepared;
Query1.Open;
if Not Query1.Eof then
begin
kucunshu := Query1.FieldByName('kucunshu').AsString;
kucunjine := Query1.FieldByName('kucunjine').AsString;
rukushu := Query1.FieldByName('rukushu').AsString;
rukujine := Query1.FieldByName('rukujine').AsString;
chukushu := Query1.FieldByName('chukushu').AsString;
chukushu := FloatToStr(StrToFloat(chukushu)-StrToFloat(values));
chukujine := FloatToStr(StrToFloat(chukushu)*StrToFloat(Edit3.Text));
jiecunshu := FloatToStr(StrToFloat(kucunshu)+StrToFloat(rukushu)-StrToFloat(chukushu));
jiecunjine := FloatToStr(StrToFloat(kucunjine)+StrToFloat(rukujine)-StrToFloat(chukujine));
Query1.Close;
Query1.SQL.Clear;
Query1.sql.Add('Update YearHaoCai set chukushu='''+chukushu+''',chukujine='''+chukujine+
''',jiecunshu='''+jiecunshu+''',jiecunjine='''+jiecunshu+''' where class='''+clclass+
''' and cailiaoming='''+Edit1.Text+''' and nian='+IntToStr(nian));
Query1.ExecSQL;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Update YearDataCache set chukushu='''+chukushu+''',chukujine='''+
''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
Query1.ExecSQL;
end;
end;
{更新LastWeekOut}
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from LastWeekOut where class='''+clclass+''' and cailiaoming='''+Edit1.Text+
''' and bumenming='''+ComboBox1.Text+'''');
Query1.Prepared;
Query1.Open;
if Not Query1.Eof then
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Update LastWeekOut set lastchukushu='''+Edit7.Text+''',lastchukujine='''+Edit8.Text+
''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+''' and bumenming='''+ComboBox1.Text+'''');
Query1.ExecSQL;
end
else
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Insert into LastWeekOut values('''+clclass+''','''+Edit1.Text+''','''+
ComboBox1.Text+''','''+Edit7.Text+''','''+Edit8.Text+''')');
Query1.ExecSQL;
end;
end;
procedure TFrmCOutPut.ComboBox1Click(Sender: TObject);
var
Query1:TADOQuery;
//name:string;
zhou:Integer;
nian:Integer;
begin
Query1 := TADOQuery.Create(NIL);
Query1.ConnectionString := Frmmain.ADOConnection1.ConnectionString;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select max(nian) as maxyear from WeekHaoCai where cailiaoming='''+Edit1.Text+
''' and class='''+clclass+'''');
Query1.Prepared; //最近的年
Query1.Open;
nian := Query1.FieldByName('maxyear').AsInteger;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select max(zhou) as maxweek from WeekHaoCai where nian='+IntToStr(nian)+' and cailiaoming='''+Edit1.Text+
''' and class='''+clclass+'''');
Query1.Prepared; //最近的周
Query1.Open;
zhou := Query1.FieldByName('maxweek').AsInteger;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from WeekHaoCai where class='''+clclass+''' and cailiaoming='''+Edit1.Text+
''' and nian='+IntToStr(nian)+' and zhou='+IntToStr(zhou));
Query1.Prepared;
Query1.Open;
if ComboBox1.Text = '生产部' then
Edit9.Text := Query1.FieldByName('scbshuliang').AsString;
if ComboBox1.Text = '工程部' then
Edit9.Text := Query1.FieldByName('gcbshuliang').AsString;
if ComboBox1.Text = '器件厂' then
Edit9.Text := Query1.FieldByName('qjcshuliang').AsString;
if ComboBox1.Text = '企管部' then
Edit9.Text := Query1.FieldByName('qgbshuliang').AsString;
if ComboBox1.Text = '总办' then
Edit9.Text := Query1.FieldByName('zbshuliang').AsString;
if ComboBox1.Text = '财务部' then
Edit9.Text := Query1.FieldByName('cwbshuliang').AsString;
if ComboBox1.Text = '品管部' then
Edit9.Text := Query1.FieldByName('pgbshuliang').AsString;
if ComboBox1.Text = '销管中心' then
Edit9.Text := Query1.FieldByName('xgzxshuliang').AsString;
if ComboBox1.Text = '业务部' then
Edit9.Text := Query1.FieldByName('ywbshuliang').AsString;
if ComboBox1.Text <> '' then
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from LastWeekOut where class='''+clclass+''' and cailiaoming='''+
Edit1.Text +''' and bumenming='''+ComboBox1.Text+'''');
Query1.Prepared;
Query1.Open;
if Query1.Eof then
begin
Application.MessageBox('不存在此部门使用此材料的信息.','提示',MB_OK OR MB_ICONINFORMATION);
Self.Close;
end;
Edit7.Text := Query1.FieldByName('lastchukushu').AsString;
Edit8.Text := Query1.FieldByName('lastchukujine').AsString;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -