📄 unit_publicinfo.pas
字号:
begin
myNode := Items[i];
if (myNode^.FileName=inifile) then
begin
Result := true;
exit;
end;
end;
end;
procedure TCommandFileList.LoadFromFile(inifile: String);
var
sr: TSearchRec;
MyIniFile : TIniFile;
_FileName : String;
I ,j : Integer;
myNode : PTCommandFileNode;
DLLFiles : TStringList;
SelectedColor: array[0..8] of TColor;
begin
SelectedColor[0] :=$0029309C;// $00297047;
SelectedColor[1] :=$00319ACE;// $008A3C6F;
SelectedColor[2] :=$009C659C;// $00D755CD;
SelectedColor[3] :=$00316531;// $00068893;
SelectedColor[4] :=$00639A00;// $0099268D;
SelectedColor[5] :=$009C6531;// $00C08000;
SelectedColor[6] := $00FF0080;
SelectedColor[7] := $00EBA81D;
SelectedColor[8] := $00400080;
ClearAll;
if ( not FileExists(inifile) ) then
begin
Application.MessageBox(pchar('配置文件不存在!'),pchar('警告'),MB_OK);
exit;
end;
DLLFiles := TStringList.Create;
if FindFirst(ExtractFileDir(ParamStr(0))+'\DLLFiles\*.dll', faAnyFile, sr) = 0 then
begin
repeat
DLLFiles.Add(sr.Name);
until FindNext(sr) <> 0;
FindClose(sr);
end;
MyIniFile := TIniFile.Create(inifile);
//以下读取配置文件!
for I:=0 to DLLFiles.Count-1 do
begin
_FileName := Trim(MyIniFile.ReadString('MenuConfig', DLLFiles.Strings[I],''));
if _FileName='' then Continue;
New(mynode);
j :=Pos('|',_FileName);
if j>0 then
begin
mynode.ID := StrToIntDef(Copy(_FileName,1,j-1),0);
_FileName := Copy(_FileName,j+1,Length(_FileName));
j :=Pos('|',_FileName);
if j>0 then
mynode.Caption := Copy(_FileName,1,j-1)
else
mynode.Caption := _FileName ;
end;
mynode^.FileName := DLLFiles.Strings[I];
mynode^.LibModule := 0;
mynode^.Form := nil;
mynode^.Panel := nil;
mynode^.ParentPanel := nil;
mynode^.Color := SelectedColor[ i mod Length(SelectedColor)] ; //颜色可调!
Self.Add(myNode);
end;
MyIniFile.Free;
DLLFiles.Free;
end;
procedure TCommandFileList.SaveToFile(inifile: String);
var
MyIniFile : TIniFile;
I : Integer;
myNode : PTCommandFileNode;
tmpstr : String;
begin
if ( not FileExists(inifile) ) then
begin
ShowMessage('配置文件不存在!');
exit;
end;
MyIniFile := TIniFile.Create(inifile);
MyIniFile.EraseSection('MenuConfig');
for I:=0 to Self.Count-1 do
begin
mynode := Items[i];
if mynode <>nil then
begin
tmpstr := IntToStr(mynode^.ID)+'|'+mynode^.Caption ;
MyIniFile.WriteString('MenuConfig', mynode^.FileName,tmpstr);
end;
end;
MyIniFile.Free;
end;
procedure TCommandFileList.ShowList;
var
I :Integer;
myNode:PTCommandFileNode;
begin
for I:=0 to Self.Count-1 do
begin
mynode := Items[i];
ShowMessage(mynode^.FileName+'|'+mynode^.Caption + '|'+mynode^.Version);
end;
end;
{---------------------------------------------------------------------------------*}
procedure TPublicInfo.MenuFunPower(targetForm: TForm);
var
I:Integer;
myComponent : TComponent;
myButton : TButton;
myspeedbtn : TButton;
myMenu : TMenuItem;
begin
if (publicinfo.Password ='hhldzlzdpmrywmjzjzxf') then exit;
for I:=0 to targetForm.ComponentCount -1 do
begin
myComponent := targetForm.Components[I];
if ( myComponent.ClassNameIs('TSpeedButton')) then
begin
myspeedbtn:= TButton(myComponent);
if myspeedbtn.Tag >100 then
begin
if UserMenuList.IndexOf_Code(myspeedbtn.tag)>=0 then
myspeedbtn.Enabled := true
else
myspeedbtn.Enabled := false;
end;
end;
if ( myComponent.ClassNameIs('TBitBtn'))
or (myComponent.ClassNameIs('TButton')) then
begin
myButton := TButton(myComponent);
if myButton.Tag >100 then
begin
if UserMenuList.IndexOf_Code(myButton.Tag )>=0 then
myButton.Enabled := true
else
myButton.Enabled := false;
end;
end;
if ( myComponent.ClassNameIs('TMenuItem')) then
begin
myMenu:= TMenuItem(myComponent);
if myMenu.Tag >100 then
begin
if UserMenuList.IndexOf_Code(myMenu.tag)>=0 then
myMenu.Enabled := true
else
myMenu.Enabled := false;
end;
end;
end;
end;
procedure TPublicInfo.clearflowobject;
begin
flowobject^.ID :=0;
flowobject^.Flowid :=0;
flowobject^.Functionid :=0;
flowobject^.ObjectID :=0;
flowobject^.ObjectCode :='';
flowobject^.wheresqlstr :='';
end;
function TPublicInfo.Audit(Auditopinion, AuditResult,
updatesqlstr: string): integer;
var
status,opinion:String;
myflow :TFlow;
begin
result:=0;
myflow :=TFlow.Create ;
try
if AuditResult='' then
begin
publicinfo.ReturnItem.clear;
publicinfo.Request(1802); //调用审核意见填写窗体
if publicinfo.ReturnItem.Count <2 then
begin
result:=2;
exit;
end;
status:=publicinfo.ReturnItem.Strings[0] ; //审核结果
opinion:=publicinfo.ReturnItem.Strings[1] ; //审核意见
publicinfo.ReturnItem.clear;
end
else
begin
status :=AuditResult;
opinion :=Auditopinion;
end;
if status ='' then exit;
publicinfo.flowobject.Director :=strtoint(status);
if status=AuditPass then //审核通过
begin
if not myflow.Determine(flowobject.Flowid) then //不具有终审权
begin //不是终审人必须先发送消息才能更改标志位
publicinfo.Request(1801); //调用审核人选取窗体
if publicinfo.ReturnItem.count<1 then exit;
if lowercase(publicinfo.ReturnItem.Strings[0])='1' then
begin
if myflow.UpdateFlowObject(publicinfo.Flowobject^.ID ,status,opinion) then //保存单据审核结果
begin
updatesqlstr:=format(updatesqlstr,[status]);
if myflow.UpdateAuditState(updatesqlstr) then //修改单据审核状态位
begin
publicinfo.Clearflowobject ;
result:=1;
end;
end;
end;
end
else
begin //是终审人
updatesqlstr:=format(updatesqlstr,[status]);
if myflow.UpdateAuditState(updatesqlstr) then
begin
if myflow.UpdateFlowObject(publicinfo.Flowobject^.ID ,status,opinion) then
begin
publicinfo.Clearflowobject ;
result:=1;
end;
end;
end;
end
else //审核不通过
begin
publicinfo.Request(1801); //调用审核人选取窗体选取消息回退人
if publicinfo.ReturnItem.count<1 then exit;
if lowercase(publicinfo.ReturnItem.Strings[0])='1' then
begin
if myflow.Determine(Flowobject^.flowid) then //具有终审权
begin
updatesqlstr:=format(updatesqlstr,[status]);
if myflow.UpdateAuditState(updatesqlstr) then //更新单据审核状态
begin
if myflow.UpdateFlowObject(publicinfo.Flowobject^.ID ,status,opinion) then
begin
publicinfo.Clearflowobject ;
result:=1;
end
end;
end
else
{if UpdateAuditState(updatesqlstr) then //更新单据审核状态
begin
UpdateFlowObject(id,status,opinion); //保存审核结果
result:=1;
end; }
if myflow.UpdateFlowObject(publicinfo.Flowobject^.ID ,status,opinion) then
begin
publicinfo.Clearflowobject ;
result:=1;
end;
end;
end;
finally
myflow.Free ;
end;
end;
function TPublicInfo.sendmsg(functionid, direction, objectid: integer;
objectcode, wheresqlstr: string): boolean;
begin
result:=false;
try
publicinfo.flowobject^.Flowid :=-1;
publicinfo.flowobject^.Functionid :=functionid ;
publicinfo.flowobject^.ObjectID :=objectid ;
publicinfo.flowobject^.Director :=direction ;
publicinfo.flowobject^.Objectcode :=objectcode ;
publicinfo.flowobject^.wheresqlstr :=wheresqlstr;
publicinfo.Request(1801);
if publicinfo.ReturnItem.Count>0 then
begin
if publicinfo.ReturnItem.Strings[0]='1' then
begin
result:=True;
application.MessageBox('成功发送审核消息!','发送审核消息',mb_OK);
end
else if publicinfo.ReturnItem.Strings[0]='0' then
application.MessageBox('发送审核消息出错,请重发!','发送审核消息',mb_OK);
end;
finally
if publicinfo.ReturnItem.Count>0 then publicinfo.ReturnItem.Clear ;
publicinfo.Clearflowobject ;
end;
end;
function TPublicInfo.IsUsed(FunctionID: integer): Boolean;
var
myflow :TFlow;
begin
result :=false;
myflow :=TFlow.Create ;
try
result :=myflow.IsUsed(FunctionID);
finally
myflow.Free ;
end;
end;
procedure TPublicInfo.Getsysparams;
var
mypack :TPack;
i :integer;
_name,_value :String;
begin
mypack:=TPack.Create(nil);
try
mypack.SetFieldValue(1,'fsqlstr','');
if publicinfo.PubConnection.Request(1726,mypack,true) then
begin
if mypack.RecordCount>0 then
begin
for i:=1 to mypack.RecordCount do
begin
_name :=trim(mypack.fieldbyname(i,'rulecode').AsString) ;
_value :=mypack.fieldbyname(i,'rulevalue').AsString ;
//标书销售金
if _name ='BidSaleFundIsUsed' then
begin
if _value='1' then
publicinfo.Sysparams.BidSaleFundIsUsed :=True
else
publicinfo.Sysparams.BidSaleFundIsUsed :=False;
end;
//投标保证金
if _name ='EnsureFundIsUsed' then
begin
if _value='1' then
publicinfo.Sysparams.EnsureFundIsUsed :=True
else
publicinfo.Sysparams.EnsureFundIsUsed :=False;
end;
if _name ='EnsureFundscale' then
begin
if _value<>'' then
publicinfo.Sysparams.EnsureFundscale :=strtofloat(_value)
else
publicinfo.Sysparams.EnsureFundscale :=0;
end;
//履约保证金
if _name ='PerformFundIsUsed' then
begin
if _value='1' then
publicinfo.Sysparams.PerformFundIsUsed :=True
else
publicinfo.Sysparams.PerformFundIsUsed :=False;
end;
if _name ='PerformFundScale' then
begin
if _value<>'' then
publicinfo.Sysparams.PerformFundScale :=strtofloat(_value)
else
publicinfo.Sysparams.PerformFundScale :=0;
end;
//中标服务费
if _name ='ServiceFundIsUsed' then
begin
if _value='1' then
publicinfo.Sysparams.ServiceFundIsUsed :=True
else
publicinfo.Sysparams.ServiceFundIsUsed :=False;
end;
if _name ='ServiceFundScale' then
begin
if _value<>'' then
publicinfo.Sysparams.ServiceFundScale :=strtofloat(_value)
else
publicinfo.Sysparams.ServiceFundScale :=0;
end;
end;
end;
end;
finally
mypack.Free;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -