X
xhuhuasoft
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TfmMain.Timer1Timer(Sender: TObject);<br>var<br> i, groupBusy: Integer;<br> callee, callTime: String;<br> dailTime: TDatetime;<br> TempQuery: TADOQuery;<br>begin<br> with ADOQuery1 do<br> begin<br> //数据库方式判断白名单<br> { Close;<br> SQL.Clear;<br> SQL.Add('delete from WaitCallBack where Callee not in ');<br> SQL.Add('(select Callee from WaitCallBack,CanCall where Callee=Number)');<br> ExecSQL;<br> Close;<br> SQL.Clear;<br> SQL.Add('delete from AllCall where Callee not in ');<br> SQL.Add('(select Callee from WaitCallBack,CanCall where Callee=Number)');<br> ExecSQL;}<br> //按被叫号码分组锝出待呼叫的记录<br> Close;<br> SQL.Clear;<br> SQL.Add('select Callee from WaitCallBack group by Callee');<br> Open;<br> end;<br><br> TempQuery := TADOQuery.Create(nil);<br> TempQuery.Connection := ADOConnection1;<br><br> while not ADOQuery1.Eof do<br> begin<br> //取分组后当前组的被叫号<br> callee := Trim(ADOQuery1.FieldByName('Callee').AsString);<br><br> //查出所有呼叫过此被叫的主叫号<br> with TempQuery do<br> begin<br> Close;<br> SQL.Clear;<br> SQL.Add('select * from WaitCallBack where Callee=:Callee order by DailTime');<br> Parameters.ParamByName('Callee').Value := callee;<br> Open;<br> end;<br> eCalleeForFirst.Text := callee;<br> eCalleeForSecond.Text := Trim(TempQuery.FieldByName('Caller').AsString);<br> callTime:=FormatDatetime('hh:mm',TempQuery.FieldByName('CallTime').AsDateTime);<br> dailTime:=TempQuery.FieldByName('DailTime').AsDateTime;<br> groupBusy:=TempQuery.FieldByName('GroupBusy').AsInteger;<br><br> if (dailTime<Now) and (groupBusy<>1) then<br> begin<br> //依次从每个pcm上选择中继通道直到有通道可用来呼出<br> for i:=1 to 11 do<br> begin<br> //if(StartDailOut(StrToInt(combPcmForFirst.Text)+i,eCalleeForFirst.Text,<br> // StrToInt(combPcmForSecond.Text)+i,eCalleeForSecond.Text))=true then<br> // Break;<br> end;<br> end;<br><br> //到下一组<br> ADOQuery1.Next;<br> end;<br><br>end;