sqbinput.pas
来自「一个仓库管理中的子系统--采购子系统」· PAS 代码 · 共 1,776 行 · 第 1/4 页
PAS
1,776 行
begin
showmessage('您现在还处在记录录入状态,请继续输入记录!');
exit;
end;
if (Cells[1,I]='') then
begin
showMessage('请您输入第'+inttostr(I)+'记录的计划员!');
exit;
end
else
if (Cells[2,I]='') or (Cells[3,I]='') or (cells[4,I]='') or (Cells[5,I]='') or (Cells[6,I]='0.0') then
begin
showmessage('您没有输入第'+inttostr(I)+'记录中的产品名称、型号规格、要申报的数量和计量单位!');
exit;
end;
end;
end;
postFromGrid;}
with datamodule1 do
begin
cgsqxbTable.append;
end;
check_the_reused_id(if_reused);//检查是否重用了已经作废的申请表id
sqbidpanel.Caption:=GetsqBdid;
if_reused:=sqbidpanel.Caption;//给判断是否重用已经作废的申请表ID的变量if_reused赋值
InitInputFrm;
InitstringGrid;
AppendBtnG.Enabled:=False;
postBtnG.Enabled:=True;
NewBtnG.Enabled:=False;
AppendBtnR.Enabled:=False;
postBtnR.Enabled:=True;
NewBtnR.Enabled:=False;
if messageDlg('是否生成刚提交的申请表的实施表?',mtInformation,[mbOK,mbCANCEL],0)=mrOK then
begin
jhssForm:=TjhssForm.Create(Application);
with datamodule1.publicQuery3 do
begin
close;
sql.clear;
sql.Add('select sqbid From dbo.a_cgsqzb');
sql.add('where scssb_flag='+''''+'0'+'''');
prepare;
open;
if RecordCount=0 then
begin
close;
jhssForm.Release;
showmessage('没有未生成实施表的申请表!');
exit;
end;
jhssForm.sqbidCombo.Items.clear;
while not Eof do
begin
jhssForm.sqbidComBo.Items.Add(FieldByName('sqbid').asstring);
next;
end;
jhssForm.sqbidComBo.Text:=jhssForm.sqbidComBo.Items[jhssForm.sqbidComBo.Items.count-1];
close;
end;
hide;
jhssForm.ShowModal;
jhssForm.free;
show;
end;
end;
procedure TsqinputForm.sccjComboExit(Sender: TObject);
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.clear;
sql.add('select gysmc from dbo.e_fczfzb');
open;
first;
sccjCombo.Items.Clear;
while not eof do
begin
sccjCombo.Items.Add(FieldByName('gysmc').asstring);
next;
end;
close;
end;
end;
procedure TsqinputForm.GsccjComboExit(Sender: TObject);
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.clear;
sql.add('select gysmc from dbo.e_fczfzb');
open;
first;
GsccjCombo.Items.Clear;
while not eof do
begin
GsccjCombo.Items.Add(FieldByName('gysmc').asstring);
next;
end;
close;
end;
end;
procedure TsqinputForm.cpbhEditKeyPress(Sender: TObject; var Key: Char);
begin
if length(cpbhedit.Text)=11 then
if not (key in [#8,#13]) then
begin
key:=#0;
beep;
end;
if key=#13 then
begin
if length(cpbhedit.Text)<>11 then
begin
showmessage('请你输入十一位的产品编号!');
exit;
end;
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.add('select wzmc,xhgg from dbo.e_wzdmb');
sql.add('where wzidh='+''''+cpbhedit.Text+'''');
prepare;
open;
if RecordCount=0 then
begin
showmessage('你输入的产品编号不存在!');
cpmcedit.Text:='';
xhggedit.Text:='';
close;
exit;
end;
cpmcedit.Text:=fieldByname('wzmc').asstring;
xhggedit.Text:=fieldByName('xhgg').asstring;
close;
end;
end;
end;
procedure TsqinputForm.sccjComboKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.Add('select gysmc from dbo.e_fczfzb');
sql.Add('where gysmc like ');
sql.add(''''+'%'+sccjCombo.text+'%'+'''');
open;
first;
sccjCombo.Items.Clear;
while not eof do
begin
sccjCombo.Items.Add(FieldByName('gysmc').asstring);
next;
end;
close;
end;
end;
procedure TsqinputForm.StringGrid1SetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
begin
if ACol=2 then
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.add('select wzmc,xhgg from dbo.e_wzdmb');
sql.add('where wzidh='+''''+stringGrid1.Cells[ACol,ARow]+'''');
prepare;
open;
{if RecordCount=0 then
begin
showmessage('你输入的产品编号不存在!');
stringGrid1.Cells[3,ARow]:='';
stringGrid1.Cells[4,ARow]:='';
close;
exit;
end;}
stringGrid1.Cells[3,ARow]:=FieldByName('wzmc').asstring;
stringGrid1.Cells[4,ARow]:=FieldByName('xhgg').asstring;
close;
end;
end;
if (ACol=3) or (ACol=4) then
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.add('select wzidh from dbo.e_wzdmb');
sql.add('where wzmc='+''''+stringGrid1.Cells[3,ARow]+''''+' and ' +'xhgg='+''''+stringGrid1.Cells[4,ARow]+'''');
prepare;
open;
{if RecordCount=0 then
begin
showmessage('你输入的产品编号不存在!');
stringGrid1.Cells[2,ARow]:='';
close;
exit;
end;}
stringGrid1.Cells[2,ARow]:=FieldByname('wzidh').asstring;
close;
end;
end;
end;
procedure TsqinputForm.GsccjComboKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.Add('select gysmc from dbo.e_fczfzb');
sql.Add('where gysmc like ');
sql.add(''''+'%'+GsccjCombo.text+'%'+'''');
open;
first;
GsccjCombo.Items.Clear;
while not eof do
begin
GsccjCombo.Items.Add(FieldByName('gysmc').asstring);
next;
end;
close;
end;
end;
procedure TsqinputForm.sbslEditKeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9','.',#8,#13]) then
begin
key:=#0;
beep;
end;
end;
procedure TsqinputForm.sbslEditExit(Sender: TObject);
begin
sbslEdit.Text:=CheckFloatData(sbslEdit.Text);
end;
procedure TsqinputForm.gjjeEditExit(Sender: TObject);
begin
gjjeEdit.Text:=CheckFloatData(gjjeEdit.Text);
end;
procedure TsqinputForm.gjjeEditKeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9','.',#8,#13]) then
begin
key:=#0;
beep;
end;
end;
procedure TsqinputForm.StringGrid1KeyPress(Sender: TObject; var Key: Char);
begin
oldCol:=0;
if (stringGrid1.Col=2) then
if length(stringGrid1.Cells[2,stringGrid1.Row])=11 then
if not (key in [#8,#13]) then
begin
key:=#0;
beep;
end;
if (stringGrid1.col=6) or (stringGrid1.col=7) then
begin
oldCol:=stringGrid1.col;
oldRow:=stringGrid1.Row;
if not (key in ['0'..'9','.',#8,#13]) then
begin
key:=#0;
beep;
end;
end;
end;
procedure TsqinputForm.StringGrid1Click(Sender: TObject);
begin
if (oldCol=6) or (oldCol=7) then
begin
stringGrid1.Cells[oldCol,oldRow]:=CheckFloatData(stringGrid1.Cells[oldCol,oldRow]);
end;
end;
procedure TsqinputForm.cpbhEditDblClick(Sender: TObject);
begin
wzxxcxForm:=TwzxxcxForm.Create(application);
wzxxcxform.cpbhEdit.Text:=cpbhedit.Text;
hide;
if (wzxxcxForm.ShowModal=mrOK) then
begin
cpbhedit.Text:=wzxxcxForm.cpbhstr;
cpmcedit.Text:=wzxxcxForm.cpmcstr;
xhggedit.Text:=wzxxcxForm.xhggstr;
end;
wzxxcxForm.free;
show;
end;
procedure TsqinputForm.StringGrid1DblClick(Sender: TObject);
begin
if stringGrid1.col=2 then
begin
wzxxcxForm:=TwzxxcxForm.Create(application);
wzxxcxform.cpbhEdit.Text:=stringGrid1.Cells[2,stringGrid1.Row];
hide;
if (wzxxcxForm.ShowModal=mrOK) then
begin
stringGrid1.Cells[2,stringGrid1.Row]:=wzxxcxForm.cpbhstr;
stringGrid1.Cells[3,stringGrid1.Row]:=wzxxcxForm.cpmcstr;
stringGrid1.Cells[4,stringGrid1.Row]:=wzxxcxForm.xhggstr;
end;
wzxxcxForm.free;
show;
end;
end;
procedure TsqinputForm.StringGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
PostMessage(StringGrid1.Handle, WM_KEYDOWN, VK_TAB, 0);
end;
end;
procedure TsqinputForm.cpmcEditKeyPress(Sender: TObject; var Key: Char);
begin
if cpmcedit.Text='' then
exit;
if key=#13 then
if xhggedit.Text<>'' then
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.add('select wzidh from dbo.e_wzdmb');
sql.add('where wzmc='+''''+cpmcedit.Text+''''+' and '+'xhgg='+''''+xhggedit.Text+'''');
prepare;
open;
if RecordCount=0 then
begin
showmessage('你输入的产品编号不存在!');
cpbhedit.Text:='';
close;
exit;
end;
cpbhedit.Text:=fieldByname('wzidh').asstring;
close;
end;
end
else
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.add('select wzidh from dbo.e_wzdmb');
sql.add('where wzmc='+''''+cpmcedit.Text+'''');
prepare;
open;
if RecordCount=0 then
begin
showmessage('你输入的产品编号不存在!');
cpbhedit.Text:='';
close;
exit;
end;
cpbhedit.Text:=fieldByname('wzidh').asstring;
close;
end;
end
end;
procedure TsqinputForm.xhggEditKeyPress(Sender: TObject; var Key: Char);
begin
if xhggedit.Text='' then
exit;
if key=#13 then
if cpmcedit.Text<>'' then
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.add('select wzidh from dbo.e_wzdmb');
sql.add('where wzmc='+''''+cpmcedit.Text+''''+' and '+'xhgg='+''''+xhggedit.Text+'''');
prepare;
open;
if RecordCount=0 then
begin
showmessage('你输入的产品编号不存在!');
cpbhedit.Text:='';
close;
exit;
end;
cpbhedit.Text:=fieldByname('wzidh').asstring;
close;
end;
end
else
begin
with datamodule1.PublicQuery1 do
begin
close;
sql.Clear;
sql.add('select wzidh from dbo.e_wzdmb');
sql.add('where xhgg='+''''+xhggedit.Text+'''');
prepare;
open;
if RecordCount=0 then
begin
showmessage('你输入的产品编号不存在!');
cpbhedit.Text:='';
close;
exit;
end;
cpbhedit.Text:=fieldByname('wzidh').asstring;
close;
end;
end
end;
procedure TsqinputForm.sqrqDateClick(Sender: TObject);
begin
sqrqDate.datetime:=Date;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?