-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDyspozytorskaRegulaHarmonogramowaniaAOPN.pas
45 lines (38 loc) · 1.2 KB
/
DyspozytorskaRegulaHarmonogramowaniaAOPN.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
unit DyspozytorskaRegulaHarmonogramowaniaAOPN;
interface
uses
DyspozytorskaRegulaHarmonogramowania, Etapy, ZlecenieEtap;
type
TDyspozytorskaRegulaHarmonogramowaniaAOPN = class(TDyspozytorskaRegulaHarmonogramowania)
public
function WybierzZEtapy(etapy : TEtapy) : TZlecenieEtap; override;
function NazwaReguly() : String; override;
end;
implementation
function TDyspozytorskaRegulaHarmonogramowaniaAOPN.WybierzZEtapy(etapy: TEtapy) : TZlecenieEtap;
var
etapZlecenia : TZlecenieEtap;
resultOPN, etapOPN : TDateTime;
begin
Result := nil;
etapZlecenia := nil;
for etapZlecenia in etapy do
begin
if Result = nil then
begin
Result := etapZlecenia;
end
else
begin
resultOPN := (Result.daneZlecenia.PLAN_TERMIN_REALIZACJI - Result.DataProponowana) / IloscPozostalychOperacji(Result);
etapOPN := (etapZlecenia.daneZlecenia.PLAN_TERMIN_REALIZACJI - etapZlecenia.DataProponowana) / IloscPozostalychOperacji(etapZlecenia);
if (resultOPN > etapOPN) then
Result := etapZlecenia;
end;
end;
end;
function TDyspozytorskaRegulaHarmonogramowaniaAOPN.NazwaReguly;
begin
Result := 'A/OPN';
end;
end.