📄 tcommfunc_unit.pas
字号:
op_money := StrToFloat(SetCardNo_Form.Edit3.Text)*100;
lea_money := StrToFloat(AccPre)*100;
//Main_Form.WriteOperLog(14,1,Trunc(op_money*-1),0,Trunc(op_money));
Main_Form.WriteOperAccountLog(14,StrToInt(CardAcc),0,Trunc(op_money),Trunc(lea_money),
Trunc(op_money*-1),Trunc(lea_money - op_money),CardName);
except
GlbDataModule.ADOConn_ReadCard.RollbackTrans;
end;
end
else
begin
if Active then Close;
SQL.Text := 'INSERT INTO AccountGlideTAB '+
' (Account_No, Account_Name, Account_DeptName, Account_Degree, PreView_Money,Consume_Money,'+
' Now_Money, Record_Time, Operator_Name,Operator_ID,Consume_type,CardFee_type) '+
' VALUES ('+CardAcc+','''+CardName+''','''+CardDept+''','''+CardDeg+''','+
' '+FloatToStr(StrToFloat(AccPre)*100)+','+FloatToStr(StrToFloat(SetCardNo_Form.Edit3.Text)*-100)+','+
' '+FloatToStr((StrToFloat(AccPre)-StrToFloat(SetCardNo_Form.Edit3.Text))*100)+','+
' '''+FormatDateTime('yyyy-mm-dd hh:nn:ss',now)+''','''+UserName+''','+
' '+IntToStr(UserID)+',8,2)';
try
ExecSql;
op_money := StrToFloat(SetCardNo_Form.Edit3.Text)*100;
lea_money := StrToFloat(AccPre)*100;
//Main_Form.WriteOperLog(21,1,Trunc(op_money*-1),0,Trunc(op_money));
Main_Form.WriteOperAccountLog(21,StrToInt(CardAcc),0,Trunc(op_money),Trunc(lea_money),
Trunc(op_money*-1),Trunc(lea_money - op_money),CardName);
except
GlbDataModule.ADOConn_ReadCard.RollbackTrans
end;
end;
SetCardNo_Form.Label5.Caption:= '配卡成功!';
SetCardNo_Form.Label5.Color :=$00200300;
Bleep(bOK);
SetCardNo_Form.ListView1.Selected.SubItems.Strings[2] := IntToHex(CardNo,8);
SetCardNo_Form.ListView1.Selected.SubItems.Strings[5] := SetCardNo_Form.Edit3.Text;
SetCardNo_Form.ListView1.Selected.SubItems.Strings[3] := FloatToStr(StrToFloat(Accpre) -StrToFloat(SetCardNo_Form.Edit3.Text));
if (SetCardNo_Form.ListView1.Selected.Index < SetCardNo_Form.ListView1.Items.Count -1) then
begin
SetCardNo_Form.ListView1.ItemIndex := SetCardNo_Form.ListView1.Selected.Index + 1;
SetCardNo_Form.ListView1.SetFocus;
end;
except
GlbDataModule.ADOConn_ReadCard.RollbackTrans
end;
GlbDataModule.ADOConn_ReadCard.CommitTrans;
end;
end
else
begin
SetCardNo_Form.Label5.Caption:= '帐户余额不足!';
SetCardNo_Form.Label5.Color :=$00FEA89E;
end;
end;
except
end;
finally
if Active then Close;
end;
end;
except
end;
end;
end;
end;
end;
end;
3:
begin
SearchSet_Form.Edit2.text := IntToHex(CardNo,8);
Bleep(bOK);
end;
4:
begin
OpenAccount_Form.Edit15.text := IntToHex(CardNo,8);
Bleep(bOK);
end;
5:
begin
end;
6:
begin
SaveMoney_Form.Edit3.text := IntToHex(CardNo,8);
SaveMoney_Form.FlatButton1.Caption :='查询...';
SaveMoney_Form.FlatButton1.Enabled :=true;
//SaveMoney_Form.Edit2.SetFocus;
SaveMoney_Form.GetInfo;
Bleep(bOK);
end;
7:
begin
AccInfoHandle_Form.Edit3.Text := IntToHex(CardNo,8);
Bleep(bOK);
end;
8:
begin
end;
9:
begin
AccInfoHandle_Form.Edit9.Text := IntToHex(CardNo,8);
Bleep(bOK);
end;
10:
begin
AddOperator_Form.Edit4.Text := IntToHex(CardNo,8);
Bleep(bOK);
end;
11:
begin
UpdateOperator_Form.Edit4.Text := IntToHex(CardNo,8);
Bleep(bOK);
end;
12:
begin
DoorSearchSet_Form.Edit2.text := IntToHex(CardNo,8);
Bleep(bOK);
end;
13:
begin
CardInfo_Form.Edit4.Text :=IntToHex(CardNo,8);
Key_type :=0;
NewKeyData :=GetKeyA(CardNo);
//BlockData :='';
SetLength(BlockData,32);
ZeroMemory(@pDataBuf,32);
Ret :=ReadCard(Key_Type,NewKeyData,1,BlockData);
if Ret =0 then
begin
i:=1;
while i<=32 do
begin
j :=(i+1) div 2;
pDataBuf[j] :=StrToInt('$'+ Copy(BlockData,i,2));
i :=i+2;
end;
///////状态
pStatus := pDataBuf[1];
case pStatus of
0: CardInfo_Form.Edit2.Text :='可用';
else CardInfo_Form.Edit2.Text :='不可用';
end;
//////卡内余额
pDataBuf[33] :=pDataBuf[2];
pDataBuf[2] :=pDataBuf[4];
pDataBuf[4] :=pDataBuf[33];
CopyMemory(@pMoney,@pDataBuf[2],3);
CardInfo_Form.Edit1.Text :=FloatToStr(pMoney*0.01);
////密码限额
pDataBuf[34] :=pDataBuf[5];
pDataBuf[5] :=pDataBuf[6];
pDataBuf[6] :=pDataBuf[34];
CopyMemory(@pLMoney,@pDataBuf[5],2);
CardInfo_Form.Edit12.Text :=FloatToStr(plMoney*0.01);
////密码
pDataBuf[35] :=pDataBuf[7];
pDataBuf[7] :=pDataBuf[8];
pDataBuf[8] :=pDataBuf[35];
CopyMemory(@password,@pDataBuf[7],2);
CardInfo_Form.Edit16.Text :=IntToStr(password);
//////费率
CopyMemory(@Now1Rate,@pDataBuf[9],1);
CardInfo_Form.Edit3.Text :=FloatToStr(Now1Rate*0.01);
CopyMemory(@Now2Rate,@pDataBuf[10],1);
CardInfo_Form.Edit9.Text :=FloatToStr(Now2Rate*0.01);
CopyMemory(@Now3Rate,@pDataBuf[11],1);
CardInfo_Form.Edit11.Text :=FloatToStr(Now3Rate*0.01);
CardInfo_Form.FlatButton17.Caption :='查询...';
iChangeCardNo :=0;
Halt();
Bleep(bOK);
Bleep(bOK);
end
else
begin
CardInfo_Form.Edit4.Text :='';
Halt();
Bleep(bError);
PcSlide;
end;
end;
14:
begin
UnitMoney_Form.Edit3.text := IntToHex(CardNo,8);
UnitMoney_Form.FlatButton1.Caption :='查询...';
UnitMoney_Form.FlatButton1.Enabled :=true;
UnitMoney_Form.Edit5.Text :='';
UnitMoney_Form.Edit6.Text :='';
UnitMoney_Form.Edit7.Text :='';
UnitMoney_Form.Edit8.Text :='';
UnitMoney_Form.Edit9.Text :='';
UnitMoney_Form.Edit10.Text :='';
UnitMoney_Form.Edit4.Text :='';
UnitMoney_Form.Edit11.Text :='';
UnitMoney_Form.ComboBox1.ItemIndex :=-1;
UnitMoney_Form.ComboBox2.ItemIndex :=-1;
UnitMoney_Form.ComboBox4.ItemIndex :=-1;
UnitMoney_Form.ComboBox6.ItemIndex :=-1;
//UnitMoney_Form.FlatButton1.Click;
Bleep(bOK);
end;
15:
begin
AccInfoHandle_Form.Edit13.Text := IntToHex(CardNo,8);
Bleep(bOK);
end;
End;
///刷卡结束 // ***************************************
except
end;
end;
procedure TCommFuncClass.ConCenter_Repos;
{总控机复位}
var
bSendDataBuf : array [1..1024] of Byte;
crc16 : Word;
nLen : Integer;
iLength : Integer;
iHead : Integer;
crc161 : Word;
iCount :integer;
begin
///总控器复位
try
//CommNetDriver.m_hSection.Acquire;
ZeroMemory(@CommNetDriver.GDataBuf,1024);
//CommNetDriver.m_hSection.Release;
ZeroMemory(@bSendDataBuf,1024);
bSendDataBuf[1] := STARSIGN;
bSendDataBuf[2] := SaleMan;
bSendDataBuf[3] := $00;
bSendDataBuf[4] := $00;
bSendDataBuf[5] := $03;
bSendDataBuf[6] := $00;
bSendDataBuf[7] := $00;
bSendDataBuf[8] := $00;
bSendDataBuf[9] := WELLSIGN;
crc16 :=chkcrc16(9,@bSendDataBuf);
CopyMemory(@bSendDataBuf[11],@crc16,2);
bSendDataBuf[10] := bSendDataBuf[12];
bSendDataBuf[12] := $0;
nLen :=CommNetDriver.ClientComm.SendData(@bSendDataBuf,11);
if (nLen>0) then
begin
iCount :=0;
While iCount <3 do
begin
if not AcceptData then
begin
inc(iCount);
if iCount =3 then
break;
CommNetDriver.ClientComm.SendData(@bSendDataBuf,11);
end
else
begin
//CommNetDriver.m_hSection.Acquire;
iLength := 0;
CopyMemory(@iLength,@CommNetDriver.GDataBuf,2);
iHead := FindBufHead(@CommNetDriver.GDataBuf[3],iLength);
//CommNetDriver.m_hSection.Release;
//ReSetEvent(CommNetDriver.m_RWEvent);
if (iHead>0) then
begin
Case CommNetDriver.GDataBuf[iHead+1] Of
RIGHT_CALL:
begin
crc16:=chkcrc16(4,@CommNetDriver.GDataBuf[iHead]);
CopyMemory(@crc161,@CommNetDriver.GDataBuf[iHead+4],2);
if (crc16=crc161) then
begin
break;
end
else
begin
CommNetDriver.ClientComm.SendData(@bSendDataBuf,11);
end;
end;
ERROR_CALL :
begin
Inc(iCount);
end;
End;
end
else
begin
Inc(iCount);
end;
end;
end;
end;
except
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -