Z
zouduanke
Unregistered / Unconfirmed
GUEST, unregistred user!
label Exit_Click;var kq:_Connect_v70; Temp,DataCount: String; PortNum, VarAddr,I,WeekFlag,DataNum,CardLen : Integer; VarDescritption, CardID, EmployeeNo, EmployeeName, TimeSect: WideString;begin Enabled:=False; WeekFlag:=0; TimeSect:='00000000'; VarAddr:=aMacNo; PortNum:=aMacPort; kq:=CoConnect_v70.Create; kq.SetPort(PortNum); if not kq.GatherRecordSum(VarAddr,DataNum,VarDescritption) then begin Application.MessageBox('无法进行发卡记录下传', '消息', 48); goto Exit_Click; end; if DataNum>0 then begin Application.MessageBox(Pchar(IntToStr(VarAddr)+'号机上有刷卡记录,请先进行数据采集并清除'), '消息', 48); goto Exit_Click; end; if not KQ.ClearNameList(VarAddr) then begin Application.MessageBox('无法清除原发卡记录', '消息', 48); goto Exit_Click; end; frmWaitForm.Show; if A_Card.Active then A_Card.Close; A_Card.Parameters.ParamByName('MacNo').Value:=VarAddr; A_Card.Open; DataCount:=IntToStr(A_Card.RecordCount); I:=1; A_Card.First; while not A_Card.Eof do begin if IsCardOrEmp_K then Temp := Trim(A_Card.Fields[0].AsString) else Temp := Trim(A_Card.Fields[3].AsString); CardLen:=8-Length(Temp); EmployeeNo := Temp; if CardLen=1 then EmployeeNo:='0'+Temp; if CardLen=2 then EmployeeNo:='00'+Temp; if CardLen=3 then EmployeeNo:='000'+Temp; if CardLen=4 then EmployeeNo:='0000'+Temp; if CardLen=5 then EmployeeNo:='00000'+Temp; if CardLen=6 then EmployeeNo:='000000'+Temp; if CardLen=7 then EmployeeNo:='0000000'+Temp; {if Emp_Lost=0 then EmployeeNo:='00'+Temp else EmployeeNo := Temp; } CardID := Trim(A_Card.Fields[2].AsString); EmployeeName := Trim(A_Card.Fields[1].AsString); if not kq.CardSendToMachine(VarAddr,CardID,EmployeeNo,EmployeeName,WeekFlag,TimeSect) then begin Sleep(1); if not kq.CardSendToMachine(VarAddr,CardID,EmployeeNo,EmployeeName,WeekFlag,TimeSect) then begin Sleep(2); if not kq.CardSendToMachine(VarAddr,CardID,EmployeeNo,EmployeeName,WeekFlag,TimeSect) then Application.MessageBox('发卡记录下传有误','消息',48); end; end; A_Card.Next; I:=I+1; end; if A_Card.Active then A_Card.Close; frmWaitForm.Hide; Application.MessageBox(PChar('共下传发卡记录 '+ IntToStr(I-1) +' 条'), '消息',48);Exit_Click: kq.DestoryPort; Enabled := True;end;有时出现蓝屏,不知道是什么原因,怎么解决