RTFormwork/项目代码/RTBasicsV1/F05染色检验/DbPanel/dsr.pas

331 lines
8.7 KiB
ObjectPascal
Raw Normal View History

2024-07-07 09:35:27 +08:00
unit dsr;
interface
uses
SysUtils, StrUtils, Forms, Classes, DB, ADODB, Grids, DBGrids, Messages;
var
CanLCCL :Boolean;
V_User,V_UserID :string;
TmpHandle :THandle;
cnn_Base :TAdoConnection;
function SplitString(STR_Source :string; STR_Split:string):TStringList;
procedure DoAbnormalC(H: THandle;AConn: TADOConnection;UID: String;
UName: String;TRCarNo: String);stdcall;external 'frabnml.dll';
{
procedure DoRinseprt(H: THandle;//<2F><><EFBFBD>ô<EFBFBD><C3B4>ھ<EFBFBD><DABE><EFBFBD>
AConn: TADOConnection;//ADO<44><4F><EFBFBD><EFBFBD>
UID: String;//<2F><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>
UName: String;//<2F><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>
Machine: String;//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
Task: String//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
);stdcall;
}
procedure DoRinseprt(H: THandle;AConn: TADOConnection;UID:String;
UName :String; Machine:String; Task:String); stdcall; external 'rinsepf.dll';
procedure Set_NextControl( Pass_Form: TCustomForm;var Key:Char);
function checkfunc(handle: Integer; DogFlag: String): Integer; stdcall; external 'FUTONG.DLL';
//<2F><><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// handleΪ<65><CEAA><EFBFBD><EFBFBD><EFBFBD>ھ<EFBFBD><DABE><EFBFBD>
// DogFlagΪ<67><CEAA><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
// DLL<4C>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DogFlag<61><67><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function GetParm(flag: Integer; out len: Integer; outHex: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
//Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡ<EFBFBD>ض<EFBFBD><D8B6><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>IP<49><50>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>flagȡֵ<C8A1><D6B5>ΧΪ0--4<><34><EFBFBD><EFBFBD>ռ<EFBFBD>һ<EFBFBD><D2BB>Ϊ20<32><30><EFBFBD>ֽڣ<D6BD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ<EFBFBD>ռ<EFBFBD>
//Ҳ<><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>Ϊ20<32><30><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <09><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>Ϊ4
//DogFlagΪ<67>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϣ
function SetParm(flag, len: Integer; inHex: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
//flag=5IP,=6User,=7Pass,=8DB
//Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IPʱ<50><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ <20><>C8A00164<36><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>루192.168.1.100<EFBFBD><EFBFBD>
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD>ͬ<EFBFBD><CDAC>
function InfoFunc(order: Integer; info: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<D6B5><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD>ǵ<EFBFBD>ijЩ<C4B3><D0A9><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ѯ<EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װʱҪ<CAB1><D2AA><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
//orderΪ<72>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʼ
function GetHostIpAddr(DogParm, HostName, IPAddr: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
//<2F><>ȡӲ<C8A1><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ,<2C><><EFBFBD><EFBFBD>IP<49><50>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>IP<49><50>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮һ<D6AE><D2BB>
//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function PBEncode(Inbuf: PAnsiChar; out Outbuf: AnsiString; nInLen: Word; nOutLen: Word): Integer;
function PBEncode1(Inbuf: PAnsiChar; out Outbuf: AnsiString; nInLen: Word; nOutLen: Word): Integer;
function PBDecode(Inbuf: PAnsiChar; out Outbuf: AnsiString; nInLen: Word; nOutLen: Word): Integer;
implementation
function SplitString(STR_Source :string; STR_Split:string):TStringList;
var
temp:String;
i:Integer;
begin
Result:=TStringList.Create;
//<2F><><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>Է<EFBFBD><D4B7><EFBFBD><EFBFBD>򷵻ؿ<F2B7B5BB><D8BF>б<EFBFBD>
if trim(STR_Source) = '' then exit;
temp:=STR_Source;
i:=pos(STR_Split,STR_Source);
while i <> 0 do
begin
Result.add(copy(temp,0,i-1));
Delete(temp,1,i+length(STR_Split)-1); //<2F><><EFBFBD><EFBFBD>STR_Split<69><74><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>1<EFBFBD>Ļ<EFBFBD><><D4AD><EFBFBD><EFBFBD>ֻɾ<D6BB><C9BE>STR_Split<69>ַ<EFBFBD><D6B7>ĵ<EFBFBD>һ<EFBFBD><D2BB>.
i:=pos(STR_Split,temp);
end;
Result.add(temp);
end;
procedure Set_NextControl( Pass_Form: TCustomForm;var Key:Char);
label
labe_A;
begin
if key=#13 then
if not (Pass_Form.ActiveControl is TDbgrid) Then
Begin
key:=#0;
Pass_Form.perform(WM_NEXTDLGCTL,0,0);
end
else
if (Pass_Form.ActiveControl is TDbgrid) Then
begin
With TDbgrid(Pass_Form.ActiveControl) Do
begin
labe_A:
if Selectedindex<(FieldCount-1) then
Selectedindex:=Selectedindex+1
else Selectedindex:=0;
if not Columns[Selectedindex].Visible then
goto labe_A;
end;
end;
end;
function PBEncode(Inbuf: PAnsiChar; out Outbuf: AnsiString; nInLen: Word; nOutLen: Word): Integer;
var
table: array[0..63] of AnsiChar;
c80, c81, c82, c6: AnsiChar;
i, k, len: Integer;
Tmpbuf: array[0..255] of AnsiChar;
begin
table := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
if (nInLen*4)>(nOutLen*3+3) then Result := 1;
k := nInLen div 3;
len := k*4;
for i:=0 to k-1 do
begin
c80 := Inbuf[i*3];
c6 := Char(Integer(c80) shr 2);
Tmpbuf[i*4] := table[Integer(c6) and $3f];
c80 := Char((Integer(c80) shl 4) and $30);
c81 := Inbuf[i*3+1];
c6 := Char((Integer(c81) shr 4) and $0f);
Tmpbuf[i*4+1] := table[Integer(c80) or Integer(c6)];
c81 := Char((Integer(c81) shl 2) and $3c);
c82 := Inbuf[i*3+2];
c6 := Char((Integer(c82) shr 6) and $03);
Tmpbuf[i*4+2] := table[Integer(c81) or Integer(c6)];
Tmpbuf[i*4+3] := table[Integer(c82) and $3f];
end;
i := nInLen mod 3;
k := nInLen div 3;
if i<>0 then
begin
len := len+4;
c80 := Inbuf[k*3];
c6 := Char(Integer(c80) shr 2);
Tmpbuf[k*4] := table[Integer(c6) and $3f];
if k=1 then
begin
c80 := Char((Integer(c80) shl 4) and $30);
Tmpbuf[k*4+1] := table[Integer(c80)];
Tmpbuf[k*4+2] := '=';
end
else
begin
c80 := Char((Integer(c80) shl 4) and $30);
c81 := Inbuf[k*3+1];
c6 := Char((Integer(c81) shr 4) and $0f);
Tmpbuf[k*4+1] := table[Integer(c80) or Integer(c6)];
c81 := Char((Integer(c81) shl 2) and $3c);
Tmpbuf[k*4+2] := table[Integer(c81)];
end;
Tmpbuf[k*4+3] := '=';
end;
Tmpbuf[len] := #0;
Outbuf := Tmpbuf;
Result := len;
end;
function PBEncode1(Inbuf: PAnsiChar; out Outbuf: AnsiString; nInLen: Word; nOutLen: Word): Integer;
var
table: array[0..63] of AnsiChar;
c80, c81, c82, c6: AnsiChar;
i, k, len: Integer;
Tmpbuf: array[0..255] of AnsiChar;
begin
table := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
if (nInLen*4)>(nOutLen*3+3) then Result := 1;
k := nInLen div 3;
len := k*4;
for i:=0 to k-1 do
begin
c80 := Inbuf[i*3];
c6 := Char(Integer(c80) shr 2);
Tmpbuf[i*4] := table[Integer(c6) and $3f];
c80 := Char((Integer(c80) shl 4) and $30);
c81 := Inbuf[i*3+1];
c6 := Char((Integer(c81) shr 4) and $0f);
Tmpbuf[i*4+1] := table[Integer(c80) or Integer(c6)];
c81 := Char((Integer(c81) shl 2) and $3c);
c82 := Inbuf[i*3+2];
c6 := Char((Integer(c82) shr 6) and $03);
Tmpbuf[i*4+2] := table[Integer(c81) or Integer(c6)];
Tmpbuf[i*4+3] := table[Integer(c82) and $3f];
end;
i := nInLen mod 3;
k := nInLen div 3;
if i<>0 then
begin
len := len+4;
c80 := Inbuf[k*3];
c6 := Char(Integer(c80) shr 2);
Tmpbuf[k*4] := table[Integer(c6) and $3f];
if i=1 then
begin
c80 := Char((Integer(c80) shl 4) and $30);
Tmpbuf[k*4+1] := table[Integer(c80)];
Tmpbuf[k*4+2] := '=';
end
else
begin
c80 := Char((Integer(c80) shl 4) and $30);
c81 := Inbuf[k*3+1];
c6 := Char((Integer(c81) shr 4) and $0f);
Tmpbuf[k*4+1] := table[Integer(c80) or Integer(c6)];
c81 := Char((Integer(c81) shl 2) and $3c);
Tmpbuf[k*4+2] := table[Integer(c81)];
end;
Tmpbuf[k*4+3] := '=';
end;
Tmpbuf[len] := #0;
Outbuf := Tmpbuf;
Result := len;
end;
function PBDecode(Inbuf: PAnsiChar; out Outbuf: AnsiString; nInLen: Word; nOutLen: Word): Integer;
var
pBufIn: PAnsiChar;
szBufTmp: array[0..255] of AnsiChar;
i, dwCoded, nprbytes, nbytesdecoded: Integer;
pszCoded: PAnsiChar;
szBufout: array[0..255] of AnsiChar;
pszBufout: PAnsiChar;
pr2six: array[0..255] of Word;
begin
for i := 0 to 42 do
pr2six[i] := 64;
pr2six[43] := 62;
for i := 44 to 46 do
pr2six[i] := 64;
pr2six[47] := 63;
for i := 48 to 57 do
pr2six[i] := i+4;
for i := 58 to 64 do
pr2six[i] := 64;
for i := 65 to 90 do
pr2six[i] := i-65;
for i := 91 to 96 do
pr2six[i] := 64;
for i := 97 to 122 do
pr2six[i] := i-71;
for i := 123 to 255 do
pr2six[i] := 64;
dwCoded := nInlen;
pszCoded := Inbuf;
while (dwCoded>0) and (pszCoded=' ') do
begin
Inc(pszCoded);
Dec(dwCoded);
end;
if dwCoded>(350-4) then result := 1;
StrLCopy(szBufTmp, pszCoded, dwCoded);
szBufTmp[dwCoded] := #0;
szBufTmp[dwCoded+1] := #0;
szBufTmp[dwCoded+2] := #0;
szBufTmp[dwCoded+3] := #0;
pBufIn := szBufTmp;
repeat
i := pr2six[Integer(pBufIn^)];
Inc(pBufIn);
until i>63;
nprbytes := pBufin-szBufTmp-1;
nbytesdecoded := ((nprbytes+3) div 4)*3;
if nOutLen<nbytesdecoded then result := 2;
if nbytesdecoded>(256-4) then result := 2;
pszBufout := szBufout;
pBufin := szBufTmp;
while nprbytes>0 do
begin
pszBufout^ := Char((pr2six[Integer(pBufin[0])] shl 2) or ((pr2six[Integer(pBufin[1])] shr 4)));
Inc(pszBufout);
pszBufout^ := Char((pr2six[Integer(pBufin[1])] shl 4) or ((pr2six[Integer(pBufin[2])] shr 2)));
Inc(pszBufout);
pszBufout^ := Char((pr2six[Integer(pBufin[2])] shl 6) or (pr2six[Integer(pBufin[3])]));
Inc(pszBufout);
Inc(pBufin, 4);
Dec(nprbytes, 4);
end;
if (nprbytes and $03) <> 0 then
begin
if pr2six[Integer(pBufin[-2])]>63 then Dec(nbytesdecoded, 2)
else Dec(nbytesdecoded);
end;
szBufout[nbytesdecoded] := #0;
Outbuf := szBufout;
result := nbytesdecoded;
end;
end.