📄 mrwx_bjxxllkd.~pas
字号:
end;
procedure TMR_WXBJXX_LLKD.BitBtn11Click(Sender: TObject);
begin
tabsheet1.show;
end;
procedure TMR_WXBJXX_LLKD.TabSheet3Show(Sender: TObject);
begin
bitbtn1.Click;
Dbgrid3.Visible:=False;
end;
procedure TMR_WXBJXX_LLKD.BitBtn3Click(Sender: TObject);
begin
if adotable1.RecordCount=0 then begin
messagedlg('系统无领料单记录',mterror,[mbok],0);
end else begin
adotable2.filter:=format('单号'+'='+'''%s''',[adotable1.fieldbyname('单号').asstring]);
tabsheet2.show;
Edit1.Text:=AdoTable1.FieldByname('单号').Asstring;
Edit2.Text:=DateToStr(AdoTable1.FieldByname('日期').asdatetime);
Edit3.Text:=AdoTable1.Fieldbyname('发料单位').asstring;
end;
end;
procedure TMR_WXBJXX_LLKD.ComboBox1Exit(Sender: TObject);
begin
if combobox1.text<>'' then begin
if not adotable3.Locate('商家名称',combobox1.text,[loCaseInsensitive]) then begin
// adotable3.AppendRecord([combobox1.text]);
adotable3.Insert;
adotable3.FieldByName('商家名称').asstring:=combobox1.text;
adotable3.post;
combobox1.items.add(combobox1.text);
end;
end;
end;
procedure TMR_WXBJXX_LLKD.ComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then begin
combobox2.setfocus;
end;
end;
procedure TMR_WXBJXX_LLKD.BitBtn10Click(Sender: TObject);
begin
TAbSheet1.Show;
end;
procedure TMR_WXBJXX_LLKD.BitBtn4Click(Sender: TObject);
var dan:integer;
begin
adotable1.Append;
adotable1.fieldbyname('日期').asdatetime:=date;
adotable1.FieldByName('单号').asstring:=edit4.text;
adotable1.fieldbyname('发料单位').asstring:=combobox1.text;
adotable1.fieldbyname('是否入库').asstring:='否';
adotable1.fieldbyname('申请人').asstring:=combobox2.text;
adotable1.Post;
for dan:=1 to 50 do begin
if stringgrid1.Cells[1,dan]<>'' then begin
adotable2.Append;
AdoTable2.FieldByname('单号').Asstring:=edit4.text;
adotable2.fieldbyname('名称').asstring:=stringgrid1.cells[1,dan];
adotable2.fieldbyname('数量').asstring:=stringgrid1.cells[2,dan];
adotable2.fieldbyname('物料编码').asstring:=stringgrid1.cells[3,dan];
adotable2.fieldbyname('规格型号').asstring:=stringgrid1.cells[4,dan];
adotable2.fieldbyname('单位').asstring:=stringgrid1.Cells[5,dan];
AdoTAble2.FieldByname('机型').Asstring:=StringGrid1.Cells[6,Dan];
AdoTable2.FieldByname('位号').Asstring:=StringGrid1.Cells[7,dan];
AdoTAble2.FieldByname('备注').Asstring:=StringGrid1.Cells[8,dan];
AdoTable2.Post;
end;
end;
TabSheet1.Show;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1KeyPress(Sender: TObject;
var Key: Char);
begin
if (length(StringGrid1.Cells[1,Stry-1])<>0) then begin
case strx of
1:begin
if key<>#27 then begin
Dbgrid3.Visible:=true;
if StringGrid1.Cells[Strx,Stry]<>'' then begin
if key=#13 then begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('备件名称').Asstring;
StringGrid1.Cells[3,Stry]:=AdoTable4.FieldByname('备件编号').Asstring;
StringGrid1.Cells[4,Stry]:=AdoTable4.FieldByname('备件型号').Asstring;
StringGrid1.Cells[5,Stry]:=AdoTable4.Fieldbyname('单位').Asstring;
StringGrid1.Col:=StringGrid1.Col+1;
Dbgrid3.Visible:=false;
end else begin
AdoTable4.Locate('备件名称',StringGrid1.Cells[1,Stry],[LoPartialKey]);
end;
end;
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('备件名称').Asstring;
key:=#0;
end else begin
dbgrid3.Visible:=false;
stringgrid1.Cells[1,stry]:='';
stringgrid1.Cells[2,stry]:='';
stringgrid1.Cells[3,stry]:='';
stringgrid1.Cells[4,stry]:='';
stringgrid1.Cells[5,stry]:='';
stringgrid1.Cells[6,stry]:='';
stringgrid1.Cells[7,stry]:='';
stringgrid1.Cells[8,stry]:='';
end;
end;
2:begin
if key=#13 then begin
if Length(StringGrid1.Cells[Strx-1,Stry])=0 then begin
key:=#0;
messagedlg('请添加备件名称.',mterror,[mbok],0);
end else begin
StringGrid1.Col:=6;
end;
end;
if (key>'9') or (key<'0') then begin
key:=#0;
end;
end;
6:begin
if key=#13 then begin
StringGrid1.Col:=StringGrid1.Col+1;
end;
end;
7:begin
if key=#13 then begin
StringGrid1.Col:=StringGrid1.Col+1;
end;
end;
8:begin
if key=#13 then begin
Stringgrid1.Row:=StringGrid1.Row+1;
StringGrid1.Col:=1;
end;
end;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
case strx of
1:begin
if DbGrid3.Visible then begin
if key=$26 then begin
key:=$0;
AdoTable4.Prior;
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('备件名称').Asstring;
end;
if key=$28 then begin
key:=$0;
AdoTable4.Next;
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('备件名称').Asstring;
end;
if key=$27 then begin
key:=$0;
dbgrid3.visible:=false;
stringgrid1.cells[1,stry]:='';
end;
end;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.DBGrid3DblClick(Sender: TObject);
begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('备件名称').Asstring;
StringGrid1.Cells[3,Stry]:=AdoTable4.FieldByname('备件编号').Asstring;
StringGrid1.Cells[4,Stry]:=AdoTable4.FieldByname('备件规格').Asstring+' '+
AdoTable4.FieldByname('备件型号').Asstring;
StringGrid1.Cells[5,Stry]:=AdoTable4.Fieldbyname('单位').Asstring;
StringGrid1.Col:=StringGrid1.Col+1;
Dbgrid3.Visible:=false;
StringGrid1.SetFocus;
StringGrid1.Col:=2;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1DblClick(Sender: TObject);
begin
if(length( StringGrid1.Cells[1,Stry-1])<>0) then begin
case Strx of
1:begin
DbGrid3.Visible:=True;
end;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.DBGrid1DblClick(Sender: TObject);
begin
Bitbtn3.Click;
end;
procedure TMR_WXBJXX_LLKD.BitBtn8Click(Sender: TObject);
begin
if Adotable2.RecordCount<>0 then begin
if messagedlg('您确定要删除该记录吗?',mtInformation,[mbyes,mbok],0)=mryes then begin
AdoTable2.Delete;
end;
end else begin
if messagedlg('系统无纪录,是否将该单号废除',mterror,[mbyes,mbno],0)=mryes then begin
adotable1.Delete;
tabsheet1.Show;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.BitBtn6Click(Sender: TObject);
begin
Adotable2.append;
adotable2.fieldbyname('单号').asstring:=edit1.text;
MRWX_BJXXLLD.ShowModal;
end;
procedure TMR_WXBJXX_LLKD.BitBtn7Click(Sender: TObject);
begin
Adotable2.edit;
MRWX_BJXXLLD.ShowModal;
end;
procedure TMR_WXBJXX_LLKD.DBGrid2DblClick(Sender: TObject);
begin
bitbtn7.Click;
end;
procedure TMR_WXBJXX_LLKD.QuickRep1Preview(Sender: TObject);
begin
qrlabel18.Caption:=mr_wxform.ADOTable1.fieldbyname('公司名称').asstring;
qrlabel15.Caption:=mr_wxform.ADOTable1.fieldbyname('公司名称').asstring;
qrlabel19.caption:=mr_wxform.adotable1.fieldbyname('地址').asstring;
qrlabel20.caption:=mr_wxform.ADOTable1.fieldbyname('电话').asstring;
qrlabel21.caption:=mr_wxform.ADOTable1.fieldbyname('传真').asstring;
qrlabel23.caption:=edit1.text;
mr_wxbb.qrpreview1.qrprinter:=quickrep1.qrprinter;
end;
procedure TMR_WXBJXX_LLKD.BitBtn9Click(Sender: TObject);
begin
if not assigned(mr_wxbb) then begin
mr_wxbb:=tmr_wxbb.create(self);
end;
mr_wxbb.show;
QuickRep1.Preview;
end;
procedure TMR_WXBJXX_LLKD.ComboBox2KeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then begin
bitbtn2.setfocus;
end;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1GetEditMask(Sender: TObject; ACol,
ARow: Integer; var Value: String);
begin
if (stry=arow-1) and (stringgrid1.Cells[1,stry]<>'') and (stry<>0) then begin
if (stringgrid1.Cells[2,stry]='') or (strtoint(stringgrid1.Cells[2,stry])=0) then begin
stringgrid1.Row:=stry;
stringgrid1.Col:=2;
messagedlg('数量不能为空或为"0",请添加.',mterror,[mbok],0);
exit;
end;
end;
strx:=acol;
stry:=arow;
end;
procedure TMR_WXBJXX_LLKD.DBGrid3KeyPress(Sender: TObject; var Key: Char);
begin
if key<>#27 then begin
if key=#13 then begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('备件名称').Asstring;
StringGrid1.Cells[3,Stry]:=AdoTable4.FieldByname('备件编号').Asstring;
StringGrid1.Cells[4,Stry]:=AdoTable4.FieldByname('备件型号').Asstring;
StringGrid1.Cells[5,Stry]:=AdoTable4.Fieldbyname('单位').Asstring;
Dbgrid3.Visible:=false;
StringGrid1.Col:=2;
stringgrid1.SetFocus;
exit;
end;
key:=#0;
end else begin
dbgrid3.Visible:=false;
stringgrid1.Cells[1,stry]:='';
stringgrid1.Cells[2,stry]:='';
stringgrid1.Cells[3,stry]:='';
stringgrid1.Cells[4,stry]:='';
stringgrid1.Cells[5,stry]:='';
stringgrid1.Cells[6,stry]:='';
stringgrid1.Cells[7,stry]:='';
stringgrid1.Cells[8,stry]:='';
end;
end;
procedure TMR_WXBJXX_LLKD.DataSource3DataChange(Sender: TObject;
Field: TField);
begin
if dbgrid3.Visible then begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('备件名称').Asstring;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -