📄 plan_unit.pas
字号:
unit plan_unit;
interface
uses
Windows,Messages,SysUtils,Variants,DBclient,Classes,datamodule;
type
Tplan=class(TObject)
private
Datamod:TDataMod;
public
function PlanRec(PlanNo:string):Boolean;
function Plans(FindSQL:string):OLEVariant;
function AllPlans():Boolean;
function GetPlanDate(PlanNo:string):string;
function GetProCode(PlanNo:string):string;
function GetPlanNum(PlanNo:string):string;
function GetUnit(PlanNo:string):string;
procedure PlanInsert(InsertSQL:string);
procedure PlanUpdate(UpdateSQL:string);
procedure PlanDelete(DeleteSQL:string);
constructor create;
destructor Destroy;override;
end;
implementation
constructor TPlan.create;
begin
Datamod:=TDataMod.Create(nil);
end;
destructor TPlan.Destroy ;
begin
freeandnil(Datamod);
inherited;
end;
function TPlan.PlanRec(PlanNo:string):Boolean;
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add('select * from plan_info '
+'where plan_no='''+PlanNo+'''');
DataMod.adoq2.Open;
if DataMod.adoq2.Eof then result:=false
else result:=true;
end;
function Tplan.AllPlans():Boolean;
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add('select * from plan_info');
DataMod.adoq2.Open;
if DataMod.adoq2.Eof then result:=false
else result:=true;
end;
procedure TPlan.PlanInsert(InsertSQL:string);
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add(InsertSQL);
DataMod.adoq2.ExecSQL;
end;
procedure TPlan.PlanUpdate (UpdateSQL:string);
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add(UpdateSQL);
DataMod.adoq2.ExecSQL ;
end;
procedure TPlan.PlanDelete(DeleteSQL:string);
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add(DeleteSQL);
DataMod.adoq2.ExecSQL ;
end;
function TPlan.Plans(FindSQL:string):OLEVariant;
begin
DataMod.sel_adoq1.Close;
DataMod.sel_adoq1.SQL.Clear;
DataMod.sel_adoq1.SQL.Add(FindSQL);
DataMod.sel_adoq1.Open;
result:=DataMod.sel_dsp1.Data;
end;
function TPlan.GetPlanDate(PlanNo:string):string;
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add('select * from plan_info where plan_no='''+PlanNo+'''');
DataMod.adoq2.Open;
result:=DataMod.adoq2.fieldbyname('plan_date').AsString ;
end;
function TPlan.GetProCode(PlanNo:string):string;
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add('select * from plan_info where plan_no='''+PlanNo+'''');
DataMod.adoq2.Open;
result:=DataMod.adoq2.fieldbyname('pro_code').AsString ;
end;
function TPlan.GetPlanNum(PlanNo:string):string;
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add('select * from plan_info where plan_no='''+PlanNo+'''');
DataMod.adoq2.Open;
result:=DataMod.adoq2.fieldbyname('plan_num').AsString ;
end;
function TPlan.GetUnit(PlanNo:string):string;
begin
DataMod.adoq2.Close;
DataMod.adoq2.SQL.Clear;
DataMod.adoq2.SQL.Add('select * from plan_info where plan_no='''+PlanNo+'''');
DataMod.adoq2.Open;
result:=DataMod.adoq2.fieldbyname('unit').AsString ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -