📄 frmmain.pas
字号:
struser_id:=qrTemp.fieldbyname('user_id').AsString;
if struser_id=g_user_id then
BitBtn7.Enabled:=true;
qrTemp.Next;
except
qrTemp.Close;//
exit;
end;
end;
end;
StatusBar3.Panels[0].Width:=20;
if length(strdata)*8>20 then
StatusBar3.Panels[0].Width:=length(strdata)*8;
StatusBar3.Panels[0].Text:=strdata;
StatusBar3.Panels[1].Text:=strdata2;
//////////////////////////////////
end;
procedure TFrmmain.SpeedButton03Click(Sender: TObject);
var
qrTemp:TAdoQuery;
i,status:integer;
strdata,strdata2:string;
struser_id:string;
begin
OpenFlag:=3; //审稿人
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
////////////////////////////////////////
qrTemp.SQL.Clear;
qrTemp.SQL.Text:='select a.status,a.user_id,b.name from ent_operater a,ent_person b where a.iindex='+inttostr(iindex)+' and a.step='+inttostr(OpenFlag)+' and a.user_id=b.user_id and a.unit_id='+inttostr(unit_id);
// ShowMessage(qrTemp.SQL.Text);
qrTemp.Open;
if qrTemp.RecordCount>0 then
begin
qrTemp.First;
for i:=0 to qrTemp.RecordCount-1 do
begin
status:=0;
try
status:=qrTemp.fieldbyname('status').AsInteger;
if status=1 then //已操作
begin
if strdata2='' then
strdata2:=qrTemp.fieldbyname('name').AsString
else
strdata2:=strdata2+','+qrTemp.fieldbyname('name').AsString;
end
else //未操作
begin
if strdata='' then
strdata:=qrTemp.fieldbyname('name').AsString
else
strdata:=strdata+','+qrTemp.fieldbyname('name').AsString;
end;
struser_id:=qrTemp.fieldbyname('user_id').AsString;
if struser_id=g_user_id then
BitBtn8.Enabled:=true;
qrTemp.Next;
except
qrTemp.Close;//
exit;
end;
end;
end;
StatusBar4.Panels[0].Width:=20;
if length(strdata)*8>20 then
StatusBar4.Panels[0].Width:=length(strdata)*8;
StatusBar4.Panels[0].Text:=strdata;
StatusBar4.Panels[1].Text:=strdata2;
//////////////////////////////////
end;
procedure TFrmmain.SpeedButton04Click(Sender: TObject);
var
qrTemp:TAdoQuery;
i,status:integer;
strdata,strdata2:string;
struser_id:string;
begin
OpenFlag:=4; //阅稿人
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
////////////////////////////////////////
qrTemp.SQL.Clear;
qrTemp.SQL.Text:='select a.status,a.user_id,b.name from ent_operater a,ent_person b where a.iindex='+inttostr(iindex)+' and a.step='+inttostr(OpenFlag)+' and a.user_id=b.user_id and a.unit_id='+inttostr(unit_id);
// ShowMessage(qrTemp.SQL.Text);
qrTemp.Open;
if qrTemp.RecordCount>0 then
begin
qrTemp.First;
for i:=0 to qrTemp.RecordCount-1 do
begin
status:=0;
try
status:=qrTemp.fieldbyname('status').AsInteger;
if status=1 then //已操作
begin
if strdata2='' then
strdata2:=qrTemp.fieldbyname('name').AsString
else
strdata2:=strdata2+','+qrTemp.fieldbyname('name').AsString;
end
else //未操作
begin
if strdata='' then
strdata:=qrTemp.fieldbyname('name').AsString
else
strdata:=strdata+','+qrTemp.fieldbyname('name').AsString;
end;
struser_id:=qrTemp.fieldbyname('user_id').AsString;
if struser_id=g_user_id then
BitBtn9.Enabled:=true;
qrTemp.Next;
except
qrTemp.Close;//
exit;
end;
end;
end;
StatusBar5.Panels[0].Width:=20;
if length(strdata)*8>20 then
StatusBar5.Panels[0].Width:=length(strdata)*8;
StatusBar5.Panels[0].Text:=strdata;
StatusBar5.Panels[1].Text:=strdata2;
//////////////////////////////////
end;
procedure TFrmmain.BitBtn1Click(Sender: TObject);
var
temppath :string;
begin
if ADOQuery1.RecordCount>0 then //如果没有记录不让点击
begin
if path='' then
begin
showmessage('请先选中某条文档记录!');
exit;
end;
temppath:='\\'+ServerName+'\filetest\'+path;
ShellExecute(Application.Handle, nil, PChar(temppath), nil, nil, SW_SHOWNORMAL);
end;
end;
procedure TFrmmain.BitBtn3Click(Sender: TObject);
begin
TreeView1.Select(TreeView1.Items.Item[5]); //选择发文件
TreeView1.SetFocus;
FileCreateForm.ShowModal;
ADOQuery1.Requery();
end;
procedure TFrmmain.BitBtn11Click(Sender: TObject);
var //选择发送单位
qrTemp2:TAdoQuery;
strSQL2:string;
begin
if ADOQuery1.RecordCount<=0 then //如果没有记录不让点击
exit;
strSQL2:='select * from ent_operater where iindex='+inttostr(iindex)+' and step<4 and status=0 ';
qrTemp2:=TAdoQuery.Create(nil);
qrTemp2.Connection :=G_ADOConnection;
qrTemp2.SQL.Clear;
qrTemp2.SQL.Text:=strSQL2;
try
qrTemp2.Open;
if qrTemp2.RecordCount >0 then
begin
ShowMessage('该文件还不能发送,等前面都已处理完毕再发送!');
exit;
end;
except
ShowMessage('发送不成功!');
exit;
end;
///////////////////////////////////////////////////////////////////////////
// SendPopupMenu1.Popup(mouse.CursorPos.x,mouse.CursorPos.y);
if ADOQuery1.RecordCount>0 then //如果没有记录不让点击
FrmdepartSel.Showmodal;
end;
procedure TFrmmain.BitBtn4Click(Sender: TObject);
var
qrTemp,qrTemp1,qrTemp2,qrTemp3:TAdoQuery;
strfname:string;
i:integer;
begin //删除,要删除文件,附件表的记录,附件等有待完成
if ADOQuery1.RecordCount>0 then //如果没有记录不让点击
begin
if MessageDlg('你确定要删除该文件吗?',mtConfirmation, [mbYes, mbNo], 0)=mrNo then
exit;
DeleteFile('\\'+ServerName+'\filetest\'+path);//删除文档
try
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp1:=TAdoQuery.Create(nil);
qrTemp1.Connection :=G_ADOConnection;
qrTemp2:=TAdoQuery.Create(nil);
qrTemp2.Connection :=G_ADOConnection;
qrTemp3:=TAdoQuery.Create(nil);
qrTemp3.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
qrTemp.SQL.Text:='select * from ent_accessary where iindex='+inttostr(iindex)+' and unit_id='+inttostr(unit_id);
qrTemp.Open;
if qrTemp.RecordCount>0 then
begin
qrTemp.First;
for i:=0 to qrTemp.RecordCount-1 do
begin
strfname:= qrTemp.fieldbyname('path').AsString;
DeleteFile('\\'+ServerName+'\filetest\'+strfname);//删除附件
qrTemp.Next;
end;
end;
qrTemp.Close;
qrTemp1.SQL.Clear;
qrTemp1.SQL.Text:='delete from ent_accessary where iindex='+inttostr(iindex)+' and unit_id='+inttostr(unit_id);
qrTemp1.ExecSQL;
qrTemp2.SQL.Clear;
qrTemp2.SQL.Text:='delete from ent_operater where iindex='+inttostr(iindex)+' and unit_id='+inttostr(unit_id);
qrTemp2.ExecSQL;
qrTemp3.SQL.Clear;
qrTemp3.SQL.Text:='delete from ent_file where iindex='+inttostr(iindex)+' and unit_id='+inttostr(unit_id);
qrTemp3.ExecSQL;
qrTemp.Destroy;
qrTemp1.Destroy;
qrTemp2.Destroy;
qrTemp3.Destroy;
// ADOQuery1.Delete;
except
end;
ADOQuery1.Requery();
end;
end;
procedure TFrmmain.BitBtn2Click(Sender: TObject); //打开附件
var
qrTemp:TAdoQuery;
i,status:integer;
strname,strpath:string;
NewItem: TMenuItem;
begin
if ADOQuery1.RecordCount>0 then //如果没有记录不让点击
begin
g_ACnt:=0;
AccessoryPopupMenu1.Items.Clear;
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
qrTemp.SQL.Text:='select * from ent_accessary where iindex='+inttostr(iindex)+' and unit_id='+inttostr(unit_id);
// ShowMessage(qrTemp.SQL.Text);
qrTemp.Open;
if qrTemp.RecordCount>0 then
begin
qrTemp.First;
setLength(g_accessoryinfo,qrTemp.RecordCount); //预设空间
for i:=0 to qrTemp.RecordCount-1 do
begin
try
strname:=qrTemp.fieldbyname('name').AsString;
strpath:=qrTemp.fieldbyname('path').AsString;
////////////////////////////////////////////增加一项菜单
NewItem := TMenuItem.Create(AccessoryPopupMenu1); // create the new item
AccessoryPopupMenu1.Items.Add(NewItem);// add it to the Popupmenu
NewItem.Caption := strname;
NewItem.Tag := i;
NewItem.OnClick := PopupMenuItemsClick;// assign it an event handler
///////////////////////////////////////////////////////////////
g_accessoryinfo[i].imenutag:=i;
g_accessoryinfo[i].strName:= strname;
g_accessoryinfo[i].strPath:= strpath;
g_ACnt:=g_ACnt+1;
qrTemp.Next;
except
qrTemp.Close;//
end;
end;
end;
AccessoryPopupMenu1.Popup(mouse.CursorPos.x,mouse.CursorPos.y);
end;
//////////////////////////////////
end;
//////////////////////////对附件菜单的处理过程
procedure TFrmmain.PopupMenuItemsClick(Sender: TObject);
begin
with Sender as TMenuItem do
begin
if Tag<=g_ACnt then
ShellExecute(Application.Handle, nil, PChar('\\'+ServerName+'\filetest\'+g_accessoryinfo[Tag].strPath), nil, nil, SW_SHOWNORMAL);
end;
end;
procedure TFrmmain.BitBtn6Click(Sender: TObject); //会稿
var
qrTemp:TAdoQuery;
strSQL:string;
begin
strSQL:='update ent_operater set status=1 where iindex='+inttostr(iindex)+' and step=1 and status=0 and user_id='''+g_user_id+'''';
// showmessage(strSQL);
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
qrTemp.SQL.Text:=strSQL;
try
qrTemp.ExecSQL;
except
ShowMessage('会稿不成功!');
end;
//更新审核人员信息
SpeedButton01Click(nil);
end;
procedure TFrmmain.BitBtn7Click(Sender: TObject); //核稿
var
qrTemp:TAdoQuery;
strSQL:string;
qrTemp2:TAdoQuery;
strSQL2:string;
begin
strSQL2:='select * from ent_operater where iindex='+inttostr(iindex)+' and step<2 and status=0 ';
qrTemp2:=TAdoQuery.Create(nil);
qrTemp2.Connection :=G_ADOConnection;
qrTemp2.SQL.Clear;
qrTemp2.SQL.Text:=strSQL2;
try
qrTemp2.Open;
if qrTemp2.RecordCount >0 then
begin
ShowMessage('该文件未到核稿阶段,等前面都已处理完毕再核稿!');
exit;
end;
except
ShowMessage('核稿不成功!');
exit;
end;
///////////////////////////////////////////////////////////////////////////
strSQL:='update ent_operater set status=1 where iindex='+inttostr(iindex)+' and step=2 and status=0 and user_id='''+g_user_id+'''';
// showmessage(strSQL);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -