⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dataoperat.pas

📁 SPServer.rar一个基于TCP/IP监听发送代码
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit DataOperat;

interface

uses
  Windows, Forms, SysUtils, Classes, Registry, Math, Gauges;


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,pContent,pSPNumber:string);
procedure AfreshSend(pSrcNo:string);
procedure StatemAssay(pSrcNo, pSvcType:string);
procedure ConnAddress(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,pHand:Integer;pCommandID,pSrcNo,pSPNumber:string;
          pMsgLength:Integer;pRequestMsg,pRequestDateTime:string;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;
function CheckPhone(Len:Integer;CheckValue:string):Boolean;stdcall;external 'SMSys_dll.dll';
function ResultDataLayout(pSrcNo,pChargeNo,pSvcType,pContent,pSPNumber:string):string;stdcall;external 'SMSys_dll.dll';
function ResultDataFmt(Value:TStringList;Falg:Integer):string;stdcall;external 'SMSys_dll.dll';
function GetHostPort:Integer;stdcall;external 'SMSys_dll.dll';
function GetREC_UPT:Integer;stdcall;external 'SMSys_dll.dll';
function GetSND_UPT:Integer;stdcall;external 'SMSys_dll.dll';
function GetSeurity:Boolean;stdcall;external 'SMSys_dll.dll';
function GetWarning:Boolean;stdcall;external 'SMSys_dll.dll';
function GetMangPhone:string;stdcall;external 'SMSys_dll.dll';
function GetAnswerTime:Integer;stdcall;external 'SMSys_dll.dll';
function GetInterval:Integer;stdcall;external 'SMSys_dll.dll';
function GetExpireTime:Integer;stdcall;external 'SMSys_dll.dll';
function GetSenAnswTime:Integer;stdcall;external 'SMSys_dll.dll';
function GetCurLogChk:Boolean;stdcall;external 'SMSys_dll.dll';
function ReadCXRecord:LongInt;stdcall;external 'SMSys_dll.dll';
function ReadSNDRecord:LongInt;stdcall;external 'SMSys_dll.dll';
function GetCharge:Integer;stdcall;external 'SMSys_dll.dll';
function Get_Time:string;stdcall;external 'SMSys_dll.dll';
function GetSvcTypeTran:string;stdcall;external 'SMSys_dll.dll';
function GetSPSvcType:string;stdcall;external 'SMSys_dll.dll';
function GetReSend:Boolean;stdcall;external 'SMSys_dll.dll';
function GetSendTry:Integer;stdcall;external 'SMSys_dll.dll';
function GetProgBar(n:Integer):Real;stdcall;external 'SMSys_dll.dll';
function GetLocalIP(var pIPAddress:string):Boolean;stdcall;external 'SMSys_dll.dll';
function GetFeeDate:Integer;stdcall;external 'SMSys_dll.dll';
function GetFeeTime:string;stdcall;external 'SMSys_dll.dll';
function GetSPNumber:string;stdcall;external 'SMSys_dll.dll';
function GetTimeCycle:Integer;stdcall;external 'SMSys_dll.dll';
procedure SetHostPort(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetREC_UPT(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetSND_UPT(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetSeurity(Value:Boolean);stdcall;external 'SMSys_dll.dll';
procedure SetWarning(Value:Boolean);stdcall;external 'SMSys_dll.dll';
procedure SetMangPhone(Value:string);stdcall;external 'SMSys_dll.dll';
procedure SetAnswerTime(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetInterval(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetExpireTime(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetSenAnswTime(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetCurLogChk(Value:Boolean);stdcall;external 'SMSys_dll.dll';
procedure WriteCXRecord(Value:LongInt);stdcall;external 'SMSys_dll.dll';
procedure WriteSNDRecord(Value:LongInt);stdcall;external 'SMSys_dll.dll';
procedure SetCharge(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetTime(Value:string);stdcall;external 'SMSys_dll.dll';
procedure SetSvcTypeTran(Value:string);stdcall;external 'SMSys_dll.dll';
procedure SetSPSvcType(Value:string);stdcall;external 'SMSys_dll.dll';
procedure SetReSend(Value:Boolean);stdcall;external 'SMSys_dll.dll';
procedure SetSendTry(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetFeeDate(Value:Integer);stdcall;external 'SMSys_dll.dll';
procedure SetFeeTime(Value:string);stdcall;external 'SMSys_dll.dll';
procedure SetSPNumber(Value:string);stdcall;external 'SMSys_dll.dll';
procedure SetTimeCycle(Value:Integer);stdcall;external 'SMSys_dll.dll';

implementation

uses ServerDB, SP_DLL, SM_SP_Server;

//=========================远程客户端SP号码解析========================//
function SPNumberAssay(pNetHandle,pHand:byte;SPNumber:string):Boolean;
begin
 
end;

//提交安排发送的数据和查询服务类型代码//
procedure PostMess(Falg,TranType:Integer;pDestNo,pChargeNo,pSvcType,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:=h32;
        Exit;
      end;
     with frmServerDB.aUSvcContent do
      begin
       Close;
       Parameters.ParamByName('pSvcType').Value:=pSvcType;
       Parameters.ParamByName('pSvcContent').Value:=pContent;
       ExecSQL;
      end;
      ResultValue:=h3E;
      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:=h3D;
        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[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,pHand:Integer;pCommandID,pSrcNo,pSPNumber:string;
          pMsgLength:Integer;pRequestMsg,pRequestDateTime:string;pResultValue:Integer);
begin
case pRecvType of
 1:begin
    with frmServerDB.tblTranClient do
      begin
       Open;
       Insert;
       Fields[1].Value:=pRecvType;
       Fields[2].Value:=pHand;
       Fields[4].Value:=pSrcNo;
       Fields[5].Value:=pSPNumber;
       Fields[6].Value:=pMsgLength;
       Fields[7].Value:=pRequestMsg;
       Fields[8].Value:=pRequestDateTime;
       Fields[10].Value:=1;
       Post;
       Close;
     end;
   end;
 2:begin
    with frmServerDB.tblTranClient do
      begin
       Open;
       Insert;
       Fields[1].Value:=pRecvType;
       Fields[2].Value:=pHand;
       Fields[3].Value:=pCommandID;
       Fields[7].Value:=pRequestMsg;
       Fields[9].Value:=pResultValue;
       Fields[10].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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -