Дипломная работа: Автоматизация учета простоев лифтов в ООО "Подъёмник"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
116
procedure TfCommandMaker.FormCreate(Sender: TObject);
begin
FLift := nil;
end;
procedure TfCommandMaker.FormShow(Sender: TObject);
begin
eLevel.SetFocus;
eLevel.SelectAll;
end;
procedure TfCommandMaker.SetLevel(Value: Integer);
begin
FLevel := Value;
end;
procedure TfCommandMaker.SetLift(Lift: TLift);
begin
FLift := Lift;
end;
end.
unit ufMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, uLift, Vcl.ComCtrls, Vcl.StdCtrls,
ufCommandMaker;
type
TfMain = class(TForm)
GroupBox1: TGroupBox;
lLevel: TLabel;
Label1: TLabel;
cbLiftMoving: TComboBox;
Label2: TLabel;
GroupBox3: TGroupBox;
bCall: TButton;
bCommand: TButton;
GroupBox4: TGroupBox;
lbCalls: TListBox;
GroupBox5: TGroupBox;
lbCommands: TListBox;
StatusBar1: TStatusBar;
GroupBox6: TGroupBox;
tbLevel: TTrackBar;
Label3: TLabel;
cbLiftState: TComboBox;
lWaitTime: TLabel;
lHighLevel: TLabel;
lLowLevel: TLabel;
procedure FormCreate(Sender: TObject);
procedure bCallClick(Sender: TObject);
117
procedure bCommandClick(Sender: TObject);
private
{ Private declarations }
FLift : TLift;
procedure LiftOnProcess(Sender: TObject);
public
{ Public declarations }
end;
var
fMain: TfMain;
implementation
{$R *.dfm}
procedure TfMain.bCallClick(Sender: TObject);
begin
fCommandMaker.Lift := FLift;
fCommandMaker.Caption := bCall.Caption;
if fCommandMaker.ShowModal = mrOk then
begin
FLift.AddCall(fCommandMaker.Level);
end;
end;
procedure TfMain.bCommandClick(Sender: TObject);
begin
fCommandMaker.Lift := FLift;
fCommandMaker.Caption := bCommand.Caption;
if fCommandMaker.ShowModal = mrOk then
begin
FLift.AddCommand(fCommandMaker.Level);
end;
end;
procedure TfMain.FormCreate(Sender: TObject);
begin
FLift := TLift.Create;
FLift.OnProcess := LiftOnProcess;
end;
procedure TfMain.LiftOnProcess(Sender: TObject);
var
Lift : TLift;
begin
//
Lift := Sender as TLift;
cbLiftState.ItemIndex := Ord(Lift.LiftState);
cbLiftMoving.ItemIndex := Ord(Lift.LiftMoving);
tbLevel.Max := Lift.HighLevel;
tbLevel.Min := Lift.LowLevel;
lLowLevel.Caption := IntToStr(Lift.LowLevel);
lHighLevel.Caption := IntToStr(Lift.HighLevel);
tbLevel.Position := Lift.HighLevel - Lift.Level + 1;
lLevel.Caption := IntToStr(Lift.Level);
if Lift.WaitTime > 0 then
118
lWaitTime.Caption := IntToStr(Round(Lift.WaitTime))
else
lWaitTime.Caption := '';
lbCalls.Items.Clear;
lbCalls.Items.AddStrings(Lift.CallList);
lbCommands.Items.Clear;
lbCommands.Items.AddStrings(Lift.CommandList);
end;
end.
Источник: https://baza.diplomsite.ru/previewfile/2415