📄 mainprofile.pas.~631~
字号:
else
begin
subs:=Copy(s,0,pts-1);
j:=pts+1;
s:=Copy(s,j,(i-pts));
StringGrid1.Cells[colofgrid,rowofgrid1]:=subs;
colofgrid:=colofgrid+1;
end;
end; //end while here
rowofgrid1:=rowofgrid1+1;
colofgrid:=0;
Readln(f,s);
end; //end if
//another if here
if AnsiCompareText(filename,'gj.txt')=0 then
begin
if pts<24 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=23 then
begin
pts:=26;
end;
end
else
if pts<29 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=28 then
begin
pts:=30;
end;
end
else
if pts<40 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=39 then
pts:=41;
end
else
if pts<61 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=60 then
pts:=62;
end
else
if pts<70 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=69 then
pts:=70;
end
else
if pts<106 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=105 then
pts:=106;
end
else
if pts<126 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=125 then
pts:=127;
end
else
if pts<130 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
if pts=129 then
pts:=201;
end
else
//if pts>200 then
begin
buslines[pts]:=s;
Readln(f,s);
inc(tempi);
inc(pts);
end;
// showmessage(buslines[pts-1]+' '+inttostr(pts)+' '+inttostr(tempi));
end;
//end another if for read bus herer
end;
// showmessage(buslines[24]+''+buslines[130]+''+buslines[68]+' '+inttostr(pts));
closefile(f);
end;
{用于读取文件,一行行的初始化问题内容}
procedure TForm1.initstringgrid();
var i,j:integer;
{ONLY FOR input valuse for the stringgrids and more}
begin
{ with StringGrid1 do
begin
For i:=0 to ColCount do
For j:=0 to RowCount do
if (i<>0) and (j<>0) then
begin
Cells[i,j]:=IntToStr(i)+'|'+IntToStr(j);
end
else
begin
end;
end;
}
end;
//
procedure TForm1.FormCreate(Sender:TObject);
var s1:string;
tempi:integer;
begin
tempi:=1;
rowofgrid1:=1;
rowofgrid2:=1;
rowofgrid3:=1;
selectg1:=0;
selectg2:=0;
selectg3:=0;
selectg1c:=0;
selectg2c:=0;
selectg3c:=0;
searchedpos:=1;
with StringGrid1 do
begin
Cells[0,0]:='电话号码';
Cells[1,0]:=' 短信内容 ';
Cells[2,0]:='定时日期';
Cells[3,0]:='定时时间';
Cells[4,0]:='制作日期';
Cells[5,0]:='制作时间';
Cells[6,0]:='写信人';
Cells[7,0]:='处理状态';
s1:='sm2send.txt';
readfromfiles(s1);
end;
with StringGrid2 do
begin
Cells[0,0]:='电话号码';
Cells[1,0]:=' 姓名 ';
Cells[2,0]:='电话组';
Cells[3,0]:='服务级别';
Cells[4,0]:='累计服务次数';
end;
with StringGrid3 do
begin
Cells[0,0]:='发信人号码';
Cells[1,0]:=' 姓名 ';
Cells[2,0]:='电话组';
Cells[3,0]:='短信内容';
Cells[4,0]:='格式';
Cells[5,0]:='收信日期';
Cells[6,0]:='收信时间';
Cells[7,0]:='处理标志';
end;
statusbar2.Panels[5].Text:=datetostr(date());
//getstringgrid1(s1,tempi);
//statusbar2.Panels[6].Text:=timetostr(time());
//init the buslines here
for tempi:=1 to 220 do
begin
buslines[tempi]:=inttostr(tempi)+' 路尚未开通';
end;
for tempi:=1 to 20 do
begin
searchedrowofgrid3[tempi]:=1;
end;
//
s1:='gj.txt';
readfromfiles(s1);
//
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
res:integer;
begin
initstringgrid;
Label1.Caption := '正在启动....';
Label1.Refresh;
res := InfoDataComOpen;
if res = 0 then
begin
ShowMessage('启动成功');
Label1.Caption :='启动成功';
Label1.Refresh;
//启动线程
TSendThread.Create(false);
TWorkThread.Create(false);
end
else
case res of
1: begin
showmessage('系统已经启动');
Label1.Caption := '启动失败 原因 系统已经启动了';
end;
2..3:
begin
ShowMessage('启动失败:'+IntToStr(res)+'短信中心号码未定');
Label1.Caption := '启动失败 原因 短信中心号码未定';
end;
4: begin
showmessage('启动失败'+Inttostr(res)+'硬件错误' );
Label1.Caption := '启动失败 原因 硬件错误';
end;
end;
Label1.Refresh;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
var iclose:integer; //for close the mc devices
begin
{int InfoDataComClose( )
返回值
0—关闭成功
}
iclose:=InfoDataComClose();
if(iclose<>0) then
begin
showmessage('不能关闭');
end
else
begin
Label1.Caption:='关闭成功';
end;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin //直接关闭系统,先关闭硬件设备
InfoDataComClose();
Close();
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
CheckBox1.Enabled:=true;
ComboBox1.Enabled:=true;
//此处加入日期和时间的选择
end;
procedure TForm1.Button1Click(Sender: TObject);
var //发送到发件箱,具体的发送由线程来负责
res:integer;
tempi:integer;
sm,sm1,sm2:string;
clausepos:integer;
begin
If Length(Trim(memo1.Text)) <= 0 Then begin
ShowMessage( '发送信息不能为空');
Exit;
end;
if rowofgrid2 =1
then begin
showmessage('请添加发送对象');
Exit;
end;
{ Label1.Caption := '正在发送....';
Label1.Refresh;
str := Trim(EditMno.Text) + '|' + Trim(EditMsg.Text);
res := InfoDataComSend(PChar(str));
If res = 0 Then
ShowMessage('发送成功')
Else
ShowMessage('失败:'+IntToStr(res));
Label1.Caption := ''; }
////////////
tempi:=1;
sm:='$';
sm1:='$';
sm2:='$';
clausepos:=120;
while tempi<rowofgrid2 do
begin
with stringgrid2 do
begin //it must decode the memo's text here
setofstringgrid1[1]:= Cells[0,tempi];
// showmessage('memo1s length'+inttostr(length(Trim(memo1.Text))));
//3-6未定制日期和实际日期时间
setofstringgrid1[3]:=datetostr(date());
setofstringgrid1[4]:=datetostr(time());
setofstringgrid1[5]:=datetostr(date());
setofstringgrid1[6]:=datetostr(time());
setofstringgrid1[7]:=Cells[1,tempi];
setofstringgrid1[8]:='未处理';
sm:=Trim(memo1.Text);
sm2:=Copy(sm,129,28);
while(length(Trim(sm))>130)do
begin
clausepos:=pos(';',sm2);
// showmessage(sm2+inttostr(clausepos));
if clausepos<>0
then
clausepos:=clausepos+129;
sm1:=Copy(sm,1,clausepos);
sm:='接上条:'+Copy(sm,clausepos+1,length(sm)-clausepos);
sm2:=Copy(sm,129,20);
setofstringgrid1[2]:=sm1;
insertstringgrid1();
// tempi:=tempi+1;
end;
if(length(sm)>1)
then
begin
setofstringgrid1[2]:=sm;
insertstringgrid1();
tempi:=tempi+1;
end;
end; //end the insert for grid1
end;//end while
{
if length(smcontent)>256 then
begin
sm:='接上条 '+Copy(smcontent,254,length(smcontent)-252);
// statusbar2.Panels[1].Text:=sm;
smcontent:=Copy(smcontent,1,124);
//statusbar2.Panels[1].Text:='12'+smcontent;
if length(sm1)>126 then
begin
sm1:='接上条 '+Copy(sm,126,length(smcontent)-124);
sm:= Copy(sm,1,124);
end;
end
else
begin
;//sm:=null;
end;
end
else
begin
smcontent:=inttostr(busnumber)+'路尚未开通';
end;
end
else
begin
smcontent:='请用gj或GJ开头编辑短信';
end;
// s1:=Copy(S1,1,length(s1)-1);
//if it too lang cut this for more
//get the just content of reback message
//get the same results for bus line
setofstringgrid1[1]:=stringgrid3.Cells[0,tempi];
setofstringgrid1[2]:=smcontent;
setofstringgrid1[3]:=datetostr(date());
setofstringgrid1[4]:=timetostr(time());
setofstringgrid1[5]:=datetostr(date());
setofstringgrid1[6]:=timetostr(time());
setofstringgrid1[7]:='administrator';
setofstringgrid1[8]:='未处理';
if CompareText(Trim(stringgrid3.Cells[7,tempi]),'未处理')=0
then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -