📄 databaseoperat.pas
字号:
unit DataBaseOperat;
interface
uses
Windows, Forms, SysUtils, Classes, Registry, Math, Gauges;
procedure ClearLink;
procedure PostDeliverMsg(pRecvType:Integer;pSrcNo,pSPNumber:string;pTpUid,
pTpUdhi,pEncoded,pMsgLength:Integer;pMsg:string);
procedure PostResultMsg(pRecvType,pOid,pCurrTime:Integer;pSendTime,
pSendMode,pSrcNo,pState,pChargeNo:string);
procedure PostMess(Falg,TranType:Integer;pDestNo,pChargeNo,pSvcType:string;
pSendDateTime:TDateTime;pContent,pSPNumber:string);
procedure AfreshSend(pSrcNo:string);
procedure StatemAssay(pSrcNo, pSvcType:string);
procedure SockAddressLink(pHandle:DWord;pHand:byte;pIPAddress,pSPNumber:string;Falg:Integer);
procedure WriteMessageLog(pHandle:DWord;pHand:byte;pIPAddress,pUser,
pCommandID,pDestNo,pChargeNo,pSvcType,pContent,pSPNumber:string);
procedure PostTranClient(pRecvType,pHandle,pHand:Integer;pCommandID,pSrcNo,pSPNumber:string;
pMsgLength:Integer;pRequestMsg:string;pRequestDateTime:TDateTime;pResultValue:Integer);
function SearchSvcType(var pSvcType:string;Falg:Integer):Integer;
function IdentityAttest(pHand:byte;pUser,pPassWord:string):Boolean;
function SPNumberAssay(pNetHandle,pHand:byte;SPNumber:string):Boolean;
implementation
uses SP_DLL, SP_DLLs, ServerDB, SM_SP_Server;
//=========================远程客户端SP号码解析========================//
function SPNumberAssay(pNetHandle,pHand:byte;SPNumber:string):Boolean;
begin
end;
//提交安排发送的数据和查询服务类型代码//
procedure PostMess(Falg,TranType:Integer;pDestNo,pChargeNo,pSvcType:string;
pSendDateTime:TDateTime;pContent,pSPNumber:string);
begin
case Falg of
0:begin
with frmServerDB.aSvcContent do
begin
Close;
Parameters.ParamByName('p_SvcTypeName').Value:=Trim(pSvcType);
Open;
end;
CommandID:=hFD;
if frmServerDB.aSvcContent.RecordCount=0
then begin
ResultValue:=h42;
Exit;
end;
with frmServerDB.aUSvcContent do
begin
Close;
Parameters.ParamByName('pSvcType').Value:=pSvcType;
Parameters.ParamByName('pSvcContent').Value:=pContent;
ExecSQL;
end;
ResultValue:=h4E;
frmServerDB.aSvcContent.Close;
end;
1:begin
with frmServerDB.aSvcContent do
begin
Close;
Parameters.ParamByName('p_SvcTypeName').Value:=Trim(pSvcType);
Open;
end;
CommandID:=h29;
if frmServerDB.aSvcContent.RecordCount=0
then begin
ResultValue:=h4D;
Exit;
end;
MsgResult:=frmServerDB.aSvcContent.Fields[2].Value;
frmServerDB.aSvcContent.Close;
end;
2:begin
with frmServerDB.aScheduleSendData do
begin
Open;
Insert;
Fields[1].Value:=pDestNo;
Fields[2].Value:=pChargeNo;
Fields[3].Value:=pSvcType;
Fields[5].Value:=pSendDateTime;
Fields[6].Value:=pContent;
Fields[7].Value:=TranType;
Fields[8].Value:=pSPNumber;
Fields[9].Value:=1;
Post;
Close;
end;
end;
end;
end;
//提交TRANCLIENT数据
procedure PostTranClient(pRecvType,pHandle,pHand:Integer;pCommandID,pSrcNo,pSPNumber:string;
pMsgLength:Integer;pRequestMsg:string;pRequestDateTime:TDateTime;pResultValue:Integer);
begin
case pRecvType of
1:begin
with frmServerDB.tblTranClient do
begin
Open;
Insert;
Fields[1].Value:=pRecvType;
Fields[2].Value:=pHandle;
Fields[4].Value:=pHand;
Fields[5].Value:=pSrcNo;
Fields[6].Value:=pSPNumber;
Fields[7].Value:=pMsgLength;
Fields[8].Value:=pRequestMsg;
Fields[9].Value:=pRequestDateTime;
Fields[11].Value:='1';
Post;
Close;
end;
end;
2:begin
with frmServerDB.tblTranClient do
begin
Open;
Insert;
Fields[1].Value:=pRecvType;
Fields[2].Value:=pHandle;
Fields[3].Value:=pHand;
Fields[4].Value:=pCommandID;
Fields[8].Value:=pRequestMsg;
Fields[9].Value:=pRequestDateTime;
Fields[10].Value:=pResultValue;
Fields[11].Value:='1';
Post;
Close;
end;
end;
end;
end;
//提交DELIVER数据//
procedure PostDeliverMsg(pRecvType:Integer;pSrcNo,pSPNumber:string;
pTpUid,pTpUdhi,pEncoded,pMsgLength:Integer;pMsg:string);
begin
with frmServerDB.tbDeliver do
begin
Open;
Insert;
Fields[0].Value:=pRecvType;
Fields[1].Value:=pSrcNo;
Fields[2].Value:=pSPNumber;
Fields[3].Value:=pTpUid;
Fields[4].Value:=pTpUDhi;
Fields[5].Value:=pEncoded;
Fields[6].Value:=pMsgLength;
Fields[7].Value:=pMsg;
Fields[8].Value:=Now;
Post;
Close;
end;
end;
//提交RESULT数据 //
procedure PostResultMsg(pRecvType,pOid,pCurrTime:Integer;pSendTime,
pSendMode,pSrcNo,pState,pChargeNo:string);
begin
with frmServerDB.tbResult do
begin
Open;
Insert;
Fields[0].Value:=pRecvType;
Fields[1].Value:=pOid;
Fields[2].Value:=pCurrTime;
Fields[3].Value:=pSendTime;
Fields[4].Value:=pSendMode;
Fields[5].Value:=pSrcNo;
Fields[6].Value:=pState;
Fields[7].Value:=pChargeNo;
Post;
Close;
end;
end;
//进行来访者的身份认证//
function IdentityAttest(pHand:byte;pUser,pPassWord:string):Boolean;
var
sUser,sPassWord:string;
sHand:byte;
begin
Result:=False;
with frmServerDB.aqLogin do
begin
Close;
Parameters.ParamByName('pOptionID').Value:=Trim(pUser);
Parameters.ParamByName('pHand').Value:=pHand;
Open;
end;
if frmServerDB.aqLogin.RecordCount>0
then begin
sUser:=Trim(frmServerDB.aqLogin.Fields[0].Value);
sPassWord:=Trim(frmServerDB.aqLogin.Fields[1].Value);
sHand:=frmServerDB.aqLogin.Fields[3].Value;
if (sUser=pUser)and(sHand=pHand)and
(sPassWord=pPassWord) then
Result:=True;
end;
frmServerDB.aqLogin.Close;
end;
//搜索服务类型//
function SearchSvcType(var pSvcType:string;Falg:Integer):Integer;
var
aAppFalg,aSvcType:string;
s:Integer;
begin
Result:=-1;
with frmServerDB.aqrSvcType do
begin
Close;
Parameters.ParamByName('pSvcType').Value:=pSvcType;
Open;
end;
if frmServerDB.aqrSvcType.RecordCount>0
then begin
s:=frmServerDB.aqrSvcType.Fields[4].Value;
aSvcType:=Trim(frmServerDB.aqrSvcType.Fields[1].Value);
case Falg of
0:if (aSvcType=pSvcType)and((s=0) or(s=1)) then Result:=0;
1:if (aSvcType=pSvcType)and(s=1) then Result:=1;
2:if (aSvcType=pSvcType)and(s=2) then Result:=2;
3:if (aSvcType=pSvcType)and(s=3) then Result:=3;
4:if (aSvcType=pSvcType)and(s=4) then Result:=4;
5:if (aSvcType=pSvcType)and(s=5) then Result:=5;
6:if (aSvcType=pSvcType)and(s=6) then Result:=6;
7:if (aSvcType=pSvcType)and(s=7) then Result:=7;
8:if (aSvcType=pSvcType)and(s=8) then Result:=8;
9:if (aSvcType=pSvcType)and(s=9) then Result:=9;
end;
end;
aAppFalg:=Trim(frmServerDB.aqrSvcType.Fields[2].Text);
if aAppFalg<>'' then pSvcType:=aAppFalg;
frmServerDB.aqrSvcType.Close;
end;
//=============================重新发送信息===================================//
procedure AfreshSend(pSrcNo:string);
var
psSrcNo:string;
pChargeNo:string;
pSvcType:string;
pContent:string;
pTry:Integer;
begin
with frmServerDB.aqrRegister do
begin
Close;
Parameters.ParamByName('p_SrcNo').Value:=pSrcNo;
Open;
end;
if (frmServerDB.aqrRegister.RecordCount>0)and
(frmServerDB.aqrRegister.Fields[4].Value<ReSendTry) then
begin
psSrcNo :=Trim(frmServerDB.aqrRegister.Fields[0].Value);
pChargeNo:=Trim(frmServerDB.aqrRegister.Fields[1].Value);
pSvcType :=Trim(frmServerDB.aqrRegister.Fields[2].Value);
pTry :=frmServerDB.aqrRegister.Fields[4].Value;
with frmServerDB.aSvcContent do
begin
Close;
Parameters.ParamByName('p_SvcTypeName').Value:=pSvcType;
Open;
end;
pContent :=Trim(frmServerDB.aSvcContent.Fields[2].Value);
with frmServerDB.aUpdateTry do
begin
Close;
Parameters.ParamByName('p_Try').Value:=pTry+1;
Parameters.ParamByName('p_SrcNo').Value:=pSrcNo;
ExecSQL;
end;
CurLogMsg(1,'==========信息重新发送==========');
CurLogMsg(1,'被叫号码:'+pSrcNo);
CurLogMsg(1,'服务类型:'+pSvcType);
CurLogMsg(1,'信息内容:'+pContent);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -