Changeset 25
- Timestamp:
- Nov 19, 2012, 2:08:02 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChronIS.lpr
r24 r25 23 23 24 24 begin 25 Application.Title:='ChronIS';26 25 {$IFDEF DEBUG} 27 26 // Heap trace -
trunk/Languages/ChronIS.cs.po
r24 r25 472 472 msgstr "Záznam" 473 473 474 #: umoduleattendance.slogcount 475 msgid "Log count: " 476 msgstr "" 477 474 478 #: umoduleattendance.slogin 475 479 msgctxt "umoduleattendance.slogin" … … 558 562 559 563 #: umoduleattendance.susersread 560 msgid "User read: %s"564 msgid "User read: " 561 565 msgstr "" 562 566 -
trunk/Languages/ChronIS.po
r24 r25 450 450 msgstr "" 451 451 452 #: umoduleattendance.slogcount 453 msgid "Log count: " 454 msgstr "" 455 452 456 #: umoduleattendance.slogin 453 457 msgctxt "umoduleattendance.slogin" … … 536 540 537 541 #: umoduleattendance.susersread 538 msgid "User read: %s"542 msgid "User read: " 539 543 msgstr "" 540 544 -
trunk/Modules/Attendance/UAttendance.pas
r14 r25 44 44 TUserPassage = class 45 45 Id: Integer; 46 Terminal: TTerminal;47 User: TUser;46 Terminal: Integer; //TTerminal; 47 User: Integer; //TUser; 48 48 Time: TDateTime; 49 Operation: TOperation;49 Operation: Integer; //TOperation; 50 50 end; 51 51 -
trunk/Modules/Attendance/UModuleAttendance.pas
r24 r25 7 7 uses 8 8 Classes, SysUtils, FileUtil, UModularSystem, UFormList, UFormEdit, Controls, 9 SpecializedList, Forms, ActnList, Menus, UDataModel, Dialogs, SpecializedDictionary; 9 SpecializedList, Forms, ActnList, Menus, UDataModel, Dialogs, 10 SpecializedDictionary, USqlDatabase; 10 11 11 12 type … … 102 103 SHoliday = 'Holiday'; 103 104 SLog = 'Log'; 104 SUsersRead = 'User read: %s'; 105 SUsersRead = 'User read: '; 106 SLogCount = 'Log count: '; 105 107 106 108 { TDataModuleAttendance } … … 112 114 UserCount: Integer; 113 115 UserRec: TUser; 116 Passage: TUserPassage; 117 PassageCount: Integer; 114 118 Data: TDictionaryStringString; 115 119 I: Integer; … … 118 122 UserRec := nil; 119 123 AccessControler := nil; 124 Passage := nil; 120 125 try 121 126 VirtualAccessControler := TVirtualTerminalBF630.Create; … … 123 128 VirtualAccessControler.Active := True; 124 129 130 Data := TDictionaryStringString.Create; 131 125 132 AccessControler := TTerminalBF630.Create; 126 133 AccessControler.Active := True; 127 134 UserCount := AccessControler.GetUserCount; 128 129 UserRec := TUser.Create; 130 Data := TDictionaryStringString.Create;135 //ShowMessage(SUsersRead + IntToStr(UserCount)); 136 137 (*UserRec := TUser.Create; 131 138 for I := 0 to UserCount - 1 do begin 132 139 Data.Clear; … … 135 142 Data.Add('SecondName', UserRec.SecondName); 136 143 Core.Database.Insert('User', Data); 137 end; 138 ShowMessage(SUsersRead + IntToStr(UserCount)); 144 end; *) 145 146 PassageCount := AccessControler.GetPassageCount; 147 //ShowMessage(SLogCount + IntToStr(PassageCount)); 148 149 Passage := TUserPassage.Create; 150 for I := 0 to PassageCount - 1 do begin 151 Data.Clear; 152 AccessControler.GetPassage(I, Passage); 153 Data.Add('Terminal', IntToStr(Passage.Terminal)); 154 Data.Add('Operation', IntToStr(Passage.Operation)); 155 Data.Add('Time', DateTimeToSQL(Passage.Time)); 156 Data.Add('User', IntToStr(Passage.User)); 157 Core.Database.Insert('Passage', Data); 158 end; 159 139 160 finally 140 161 if Assigned(Data) then Data.Free; 141 162 if Assigned(UserRec) then UserRec.Free; 163 if Assigned(Passage) then Passage.Free; 142 164 if Assigned(AccessControler) then AccessControler.Free; 143 165 VirtualAccessControler.Free; -
trunk/Modules/ChiyuAccessControlers/UTerminalBF630.pas
r24 r25 81 81 function ReadDateTime: TDateTime; 82 82 function GetUserCount: Integer; override; 83 function GetUser(Id: Integer; User: TUser): Boolean; override; 83 function GetUser(Index: Integer; User: TUser): Boolean; override; 84 function GetPassageCount: Integer; override; 85 function GetPassage(Index: Integer; Passage: TUserPassage): Boolean; override; 84 86 constructor Create; override; 85 87 destructor Destroy; override; … … 106 108 end; 107 109 110 TVirtualTerminalBF630Passage = class 111 Id: Integer; 112 Time: TDateTime; 113 User: Integer; 114 Key: Integer; 115 end; 116 108 117 { TVirtualTerminalBF630 } 109 118 … … 116 125 function CommandGetUserIDList(Request: TListByte; Response: TListByte): Byte; 117 126 function CommandGetUserData(Request: TListByte; Response: TListByte): Byte; 127 function CommandLogGet(Request: TListByte; Response: TListByte): Byte; 128 function CommandLogGetCount(Request: TListByte; Response: TListByte): Byte; 118 129 procedure SetActive(AValue: Boolean); 119 130 procedure NewConnection(Sender: TCommTCPServer; Pin: TCommPin); … … 121 132 public 122 133 Users: TListObject; // TListObject<TVirtualTerminalBF630User> 134 Passages: TListObject; // TListObject<TVirtualTerminalBF630Passage> 123 135 Sessions: TListObject; // TListObject<TVirtualTerminalBF630Session> 124 136 AccessKey: array[0..5] of Byte; … … 198 210 else if Command = Byte(toGetDate) then ResultCode := CommandReadDate(Request, Response) 199 211 else if Command = Byte(toUserDataGet) then ResultCode := CommandGetUserData(Request, Response) 212 else if Command = Byte(toLogGet) then ResultCode := CommandLogGet(Request, Response) 213 else if Command = Byte(toLogGetCount) then ResultCode := CommandLogGetCount(Request, Response) 200 214 else ResultCode := ResultCodeUnknownCommand; 201 215 … … 314 328 end; 315 329 330 function TVirtualTerminalBF630.CommandLogGet(Request: TListByte; 331 Response: TListByte): Byte; 332 var 333 UserId: Integer; 334 RequestSerializer: TBinarySerializer; 335 ResponseSerializer: TBinarySerializer; 336 I: Integer; 337 Day, Month, Year: Word; 338 MSec, Sec, Min, Hour: Word; 339 FunctionKey: Integer; 340 begin 341 try 342 RequestSerializer := TBinarySerializer.Create; 343 RequestSerializer.List := Request; 344 //UserId := RequestSerializer.ReadInteger; 345 346 ResponseSerializer := TBinarySerializer.Create; 347 ResponseSerializer.List := Response; 348 DecodeDateTime(TVirtualTerminalBF630Passage(Passages[0]).Time, 349 Year, Month, Day, Hour, Min, Sec, MSec); 350 with ResponseSerializer do begin 351 WriteByte(Sec); 352 WriteByte(Min); 353 WriteByte(Hour); 354 WriteByte(Day); 355 WriteByte(Month); 356 WriteByte(Year mod 100); 357 WriteByte(0); 358 WriteByte(0); 359 WriteByte(0); 360 WriteByte(TVirtualTerminalBF630Passage(Passages[0]).Key); 361 WriteInteger(TVirtualTerminalBF630Passage(Passages[0]).User); 362 WriteByte(0); 363 WriteByte(0); 364 end; 365 finally 366 RequestSerializer.Free; 367 ResponseSerializer.Free; 368 end; 369 end; 370 371 function TVirtualTerminalBF630.CommandLogGetCount(Request: TListByte; 372 Response: TListByte): Byte; 373 var 374 ResponseSerializer: TBinarySerializer; 375 begin 376 try 377 ResponseSerializer := TBinarySerializer.Create; 378 ResponseSerializer.List := Response; 379 ResponseSerializer.WriteInteger(Passages.Count); 380 Result := ResultCodeSuccess; 381 finally 382 ResponseSerializer.Free; 383 end; 384 end; 385 316 386 procedure TVirtualTerminalBF630.SetActive(AValue: Boolean); 317 387 begin … … 356 426 SecondName := 'Second ' + IntToStr(Id); 357 427 end; 428 with TVirtualTerminalBF630Passage(Passages.AddNew(TVirtualTerminalBF630Passage.Create)) do begin 429 Id := Passages.Count; 430 Time := Now; 431 User := 1; 432 Key := 2; 433 end; 358 434 end; 359 435 … … 362 438 Sessions := TListObject.Create; 363 439 Users := TListObject.Create; 440 Passages := TListObject.Create; 364 441 CommSocket := TCommTCPServer.Create(nil); 365 442 CommSocket.Address := 'localhost'; … … 374 451 FreeAndNil(CommSocket); 375 452 FreeAndNil(Users); 453 FreeAndNil(Passages); 376 454 FreeAndNil(Sessions); 377 455 inherited Destroy; … … 550 628 end; 551 629 552 function TTerminalBF630.GetUser(I d: Integer; User: TUser): Boolean;630 function TTerminalBF630.GetUser(Index: Integer; User: TUser): Boolean; 553 631 var 554 632 Request: TListByte; … … 564 642 RequestSerializer := TBinarySerializer.Create; 565 643 RequestSerializer.List := Request; 566 RequestSerializer.WriteInteger(I d);644 RequestSerializer.WriteInteger(Index); 567 645 SendPacket(toUserDataGet, Request, Response); 568 646 if Response[0] <> Id then raise Exception.Create(SWrongId); … … 581 659 582 660 finally 661 Request.Free; 662 RequestSerializer.Free; 663 Response.Free; 664 end; 665 end; 666 667 function TTerminalBF630.GetPassageCount: Integer; 668 var 669 Response: TListByte; 670 ResponseSerializer: TBinarySerializer; 671 begin 672 try 673 Response := TListByte.Create; 674 ResponseSerializer := TBinarySerializer.Create; 675 ResponseSerializer.List := Response; 676 SendPacket(toLogGetCount, nil, Response); 677 Result := ResponseSerializer.ReadInteger; 678 finally 679 Response.Free; 680 end; 681 end; 682 683 function TTerminalBF630.GetPassage(Index: Integer; Passage: TUserPassage): Boolean; 684 var 685 Request: TListByte; 686 RequestSerializer: TBinarySerializer; 687 Response: TListByte; 688 ResponseSerializer: TBinarySerializer; 689 I: Integer; 690 Title: Integer; 691 Department: Integer; 692 Sec, Min, Hour: Byte; 693 Day, Month, Year: Byte; 694 FunctionKey: BYte; 695 Verify: Byte; 696 UserId: Integer; 697 InOutIndication: Byte; 698 VerificationSource: Byte; 699 begin 700 try 701 Response := TListByte.Create; 702 ResponseSerializer := TBinarySerializer.Create; 703 ResponseSerializer.List := Response; 704 Request := TListByte.Create; 705 RequestSerializer := TBinarySerializer.Create; 706 RequestSerializer.List := Request; 707 //RequestSerializer.WriteInteger(Id); 708 SendPacket(toLogGet, Request, Response); 709 with ResponseSerializer do begin 710 Sec := ReadByte; 711 Min := ReadByte; 712 Hour := ReadByte; 713 Day := ReadByte; 714 Month := ReadByte; 715 Year := ReadByte; 716 InOutIndication := ReadByte; 717 VerificationSource := ReadByte; 718 Verify := ReadByte; 719 FunctionKey := ReadByte; 720 UserId := ReadInteger; 721 end; 722 723 Passage.Terminal := Id; 724 Passage.Time := EncodeDateTime(2000 + Year, Month, Day, Hour, Min, Sec, 0); 725 Passage.Operation := FunctionKey; 726 Passage.User := UserId; 727 finally 728 ResponseSerializer.Free; 583 729 Request.Free; 584 730 RequestSerializer.Free;
Note:
See TracChangeset
for help on using the changeset viewer.