📄 unit1.~pas
字号:
begin
if lv1.SelCount=0 then exit; //没有焦点退出
fxx('sfnw1'+NMDayTime1.LocalIP,table1ip.Value);
fxx('rest',lv1.Selected.SubItems[12]);
end;
procedure TForm1.lv1ColumnClick(Sender: TObject; Column: TListColumn);
var
//排序
str1,str2:string;
begin
str1:=column.Caption;
str2:='select * from temp order by '+str1;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(str2);
tb1.Prepared;
tb1.Open;
lv1_create_date;
end;
//拖曳换机部分 来自实务经典
procedure TForm1.lv1StartDrag(Sender: TObject;
var DragObject: TDragObject);
//开始拖
begin
lv1.HotTrack:=true;
td1:=lv1.ItemFocused.Caption;
end;
procedure TForm1.lv1DragDrop(Sender, Source: TObject; X, Y: Integer);
//放的对上
var
item1:tlistitem;
td3:string;
td4:integer;
hca1,hca2,hca3,hca4,hca5:string;
hcb1,hcb2,hcb3,hcb4,hcb5:string;
hia1,hia2,hib1,hib2:double;
hta1,htb1:tdatetime;
hda1,hdb1:tdatetime;
begin
td4:=9999; //初始化
hia1:=0; hia2:=0; hib1:=0; hib2:=0;
hta1:=0; htb1:=0; hda1:=0; hdb1:=0;
td2:=lv1.DropTarget.Caption;
td3:='选择[ '+td1+' ]机与[ '+td2+' ]机互换吗?';
if not (td1=td2) then
td4:=Application.MessageBox(pchar(td3),pchar('我要换机'),1,);
if td4=1 then
begin
Table1.First;
while not (Table1.Eof) do
begin
if Table1a1.Value=td1 then
begin
hda1:=table1a3.Value; // 日期
hta1:=table1a4.Value; // 上机时间
hca1:=table1a5.Value; // 卡号
hia1:=table1a6.Value; // 标准
hia2:=table1a7.Value; // 押金
hca2:=table1a12.Value; // 姓名
hca3:=table1a13.Value; // 证件
hca4:=table1a16.Value; // 备注
hca5:=table1a15.Value; // 上机标志
end;
Table1.Next;
end;
Table1.First;
while not (Table1.Eof) do
begin
if Table1a1.Value=td2 then
begin
hdb1:=table1a3.Value; // 日期
htb1:=table1a4.Value; // 上机时间
hcb1:=table1a5.Value; // 卡号
hib1:=table1a6.Value; // 标准
hib2:=table1a7.Value; // 押金
hcb2:=table1a12.Value; // 姓名
hcb3:=table1a13.Value; // 证件
hcb4:=table1a16.Value; // 备注
hcb5:=table1a15.Value;
table1.Edit;
table1a3.Value:=hda1;
table1a4.Value:=hta1;
table1a5.Value:=hca1;
table1a6.Value:=hia1;
table1a7.Value:=hia2;
table1a12.Value:=hca2;
table1a13.Value:=hca3;
table1a16.Value:=hca4;
table1a15.Value:=hca5;
table1a8.Value:=0;
table1a9.Value:=0;
table1a10.Value:=0;
table1a11.Value:=0;
table1.Post;
end;
Table1.Next;
end;
Table1.First;
while not (Table1.Eof) do
begin
if Table1a1.Value=td1 then
begin
table1.Edit;
table1a3.Value:=hdb1;
table1a4.Value:=htb1;
table1a5.Value:=hcb1;
table1a6.Value:=hib1;
table1a7.Value:=hib2;
table1a12.Value:=hcb2;
table1a13.Value:=hcb3;
table1a16.Value:=hcb4;
table1a15.Value:=hcb5;
table1a8.Value:=0;
table1a9.Value:=0;
table1a10.Value:=0;
table1a11.Value:=0;
table1.Post;
end;
Table1.Next;
end;
item1:=lv3.Items.Add;
item1.Caption:=timetostr(now);
item1.SubItems.Add(td1);
item1.SubItems.Add('→');
item1.SubItems.add(td2);
jlsx(0);
tb1.Close;
tb1.Prepared;
tb1.Open;
lv1_create_date;
end; //if td4=1
end; //TForm1.lv1DragDrop
procedure TForm1.lv1EndDrag(Sender, Target: TObject; X, Y: Integer);
// 停止拖
begin
lv1.HotTrack:=false;
end;
procedure TForm1.lv1StartDock(Sender: TObject;
var DragObject: TDragDockObject);
begin
end;
//拖曳换机 完
procedure TForm1.lv1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
var DefaultDraw: Boolean);
// 改变颜色
var
xq_color1:string;
begin
//---qqq 对第 item.SubItems[8] 进行处理文本为数字
xq_color1:=item.SubItems[9];
if xq_color1<>'' then
begin
if pos('-',xq_color1)>0 then xq_color1[pos('-',xq_color1)]:='0';
if pos(':',xq_color1)>0 then xq_color1[pos(':',xq_color1)]:='0';
end
else
xq_color1:='1000'; //当为空时随便给个值以便下行strtofloat(xq_color1)转出错
//---qqq 完
if (strtofloat(xq_color1)<=6) and (item.SubItems[4]<>'') then //如果第8列小于为红色
begin
sender.Canvas.Font.Color:=clRed; //改变字色
if item.Index mod 2 = 1 then
sender.Canvas.Brush.Color:=clwhite //单行背景色为clwhite
else
sender.Canvas.Brush.Color:=clInfoBk; //双行背景色为 clInfoBk
end;
// 脱网标志"?" 则为黑色
if item.SubItems[1]='?' then
begin
sender.Canvas.Brush.Color:=clblack;
sender.Canvas.Font.Color:=clwhite
end;
end;
procedure TForm1.Panel8DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有记录吗','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv3.Clear;
end;
procedure TForm1.Panel5DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有记录吗','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv2.Clear;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
sba1:integer;
begin
sba1:=0;
tb1.First;
while not tb1.Eof do
begin
if tb1a6.Value<>'' then
sba1:=sba1+1;
tb1.Next;
end;
sb1.Panels[1].Width:=form1.Width-480;
sb1.Panels[1].Text:='共有电脑 '+inttostr(lv1.Items.Count)+' 台, 正在使用 '+inttostr(sba1)+' 台, 有'+inttostr(lv1.Items.Count-sba1)+' 台空闲。';
sb1.Panels[2].Text:=NMDayTime1.LocalIP;
end;
procedure TForm1.Panel5Click(Sender: TObject);
begin
IF LV1.Height=round(form1.Height/2) THEN
LV1.Height:=FORM1.Height-135
ELSE
lv1.Height:=round(form1.Height/2); //控制lv1高度
end;
procedure TForm1.FormResize(Sender: TObject);
begin
LV1.Height:=FORM1.Height-135; //当主窗口改变时间也改变lv1
end;
procedure TForm1.N26Click(Sender: TObject);
var
aboutf:thyzl; //添加会员
begin
aboutf:=thyzl.Create(self);
aboutf.ShowModal;
end;
procedure TForm1.lv2DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有记录吗','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv2.Clear;
end;
procedure TForm1.lv4DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有记录吗','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv4.Clear;
end;
procedure TForm1.lv3DblClick(Sender: TObject);
begin
if application.messagebox('要清空所有记录吗','注意',
mb_yesno+mb_defbutton2+mb_iconquestion+mb_systemmodal)=6 then
lv3.Clear;
end;
procedure TForm1.lv1DblClick(Sender: TObject);
begin
if lv1.SelCount=0 then exit; //没有焦点退出
//双击没有卡号则上机 否 则结帐
if lv1.Selected.SubItems[3]='' then Form1.N7Click(Sender)
else Form1.N11Click(Sender);
end;
procedure TForm1.N23Click(Sender: TObject);
var
aboutf7:txckh; //巡查客户
begin
if lv1.SelCount=0 then exit; //没有焦点退出
aboutf7:=txckh.Create(self);
aboutf7.ShowModal;
end;
procedure TForm1.lv1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if item.Index mod 2 = 1 then
sender.Canvas.Brush.Color:=clwhite
else
sender.Canvas.Brush.Color:=clInfoBk;
end;
procedure TForm1.N28Click(Sender: TObject);
begin
close; //关闭主窗口
end;
procedure TForm1.N27Click(Sender: TObject);
var
puGUAN:string;
begin
puGUAN:=xq_mima();
if puGUAN<>'' then
begin //--if1
if puGUAN =table4a0.Value then
begin
form1.Show; //恢复主窗口
end;
end; //--if1if
end;
procedure TForm1.N2Click(Sender: TObject);
var
aboutf:tfwsz; //添加会员
begin
aboutf:=tfwsz.Create(self);
aboutf.ShowModal;
end;
procedure TForm1.N3Click(Sender: TObject);
var
ZUGUAN:string;
begin
ZUGUAN:=xq_mima();
if ZUGUAN<>'' then
begin //--if1
if ZUGUAN =table4a3.Value then
begin
zgtq:='system'; //设主管特权有效
end;
end; //--if1
end;
procedure TForm1.N25Click(Sender: TObject);
var
tg1,tg2:string;
begin
if lv1.SelCount=0 then exit; //没有焦点退出
if lv1.Selected.SubItems[5]='托管上机' then
begin //是 正在托管 则解除
//添加到历史记录中
table2.Active:=true; //打开历史库
table2.Insert;
table2a1.Value:=tb1a2.Value; //电脑
table2a2.Value:=date;
table2a4.Value:=now; //下机时间
table2a5.Value:='托管下机'; //卡号
table2.Post;
table2.Active:=false; //操作完关库
//添加历史库完
fxx('wqtj_qwerty',lv1.Selected.SubItems[12]); //远程托管
tg1:='update temp set 标志="×" where IP="'+lv1.Selected.SubItems[12]+'"';
tg2:=tb1.SQL.Text;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg1);
tb1.Prepared;
tb1.ExecSQL;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg2);
tb1.Prepared;
tb1.Open;
lv1_create_date;
end
else
begin
//添加到历史记录中
table2.Active:=true; //打开历史库
table2.Insert;
table2a1.Value:=tb1a2.Value; //电脑
table2a2.Value:=date;
table2a3.Value:=now; //上机时间
table2a5.Value:='托管上机'; //卡号
table2.Post;
table2.Active:=false; //操作完关库
//添加历史库完
fxx('wqtj_szxzxq_yfjf',lv1.Selected.SubItems[12]); //远程托管
tg1:='update temp set 标志="T" where IP="'+lv1.Selected.SubItems[12]+'"';
tg2:=tb1.SQL.Text;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg1);
tb1.Prepared;
tb1.ExecSQL;
tb1.Close;
tb1.SQL.Clear;
tb1.SQL.Add(tg2);
tb1.Prepared;
tb1.Open;
lv1_create_date;
end;
end;
procedure TForm1.lv1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
// 本事件不能没有 否则不能拖
end;
procedure TForm1.N29Click(Sender: TObject);
//发出查远程机进程
begin
if lv1.SelCount=0 then exit; //没有焦点退出
tproc.Create(self);
proc.Show;
proc.Caption:= lv1.Selected.Caption +' 进程';
fxx('proc',lv1.Selected.SubItems[12]);
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
sb1.Panels[3].Text:=' '+datetostr(date)+' '+timetostr(now);
end;
procedure TForm1.N30Click(Sender: TObject);
var
devmode:tDevicemode;
Reg_id: TDateTime;
RegisterTemp: TRegistry;
InputStr, Get_id: string;
Reg_tag, ClickDok: Boolean;
Allow: Integer;
begin
Reg_tag := False; //软件是否到注册期
registerTemp := TRegistry.Create; //准备使用注册表
with registerTemp do
begin
RootKey := HKEY_LOCAL_MACHINE; //存放
if OpenKey('Software\Microsoft\Windows\CurrentSowft\tag', True) then // 建一目录,存放标志值
begin
if ValueExists('DateTag') then begin //用DateTag的值作为标志
Reg_id := ReadDate('DateTag'); //读出标志值
if Reg_id <> 0 then //允许使用的时间到
Reg_tag := True;
end else
WriteDateTime('DateTag', Now);
end;
if Reg_tag then begin //要求用户输入注册码
ClickDok := InputQuery('请根据下面机器码输入注册码:',form1.Label3.Caption, inputstr);
if ClickDok then begin
Get_id :=floatToStr((strtofloat(form1.Label1.Caption)*3715379)-(strtofloat(form1.Label1.Caption)*313753)); //注册码2
if Get_id = InputStr then begin
WriteDateTime('DateTag', 0); //将标志值置为0,即已注册。
CloseKey;
Free;
end
else begin //若输入的注册码错误
Application.MessageBox('注册码错误!请与作者联系!', '警告框', mb_ok);
CloseKey;
Free;
end;
end
else begin //若用户不输入注册码
Application.MessageBox('请与作者联系,使用注册软件!', '警告框', mb_ok);
CloseKey;
Free;
end;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -