-
Notifications
You must be signed in to change notification settings - Fork 0
/
URParams.pas
executable file
·199 lines (161 loc) · 4.17 KB
/
URParams.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
unit URParams;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, tc, UTime;
type
TFRParams = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
LineBox: TComboBox;
Panel1: TPanel;
FromBox: TComboBox;
ToBox: TComboBox;
Button2: TButton;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
public
Item : RItem;
Model : TModel;
procedure RefreshLineBox;
procedure RefreshFromBox;
procedure RefreshToBox;
procedure SetLine(value : integer);
function GetLine : integer;
procedure SetTime(value : time);
function GetTime : time;
procedure SetFrom(value : integer);
function GetFrom : integer;
procedure SetTo(value : integer);
function GetTo : integer;
procedure Load;
procedure Save;
property pLine : integer read GetLine write SetLine;
property pTime : time read GetTime write SetTime;
property pFrom : integer read GetFrom write SetFrom;
property pTo : integer read GetTo write SetTo;
end;
var
FRParams: TFRParams;
implementation
var
FTime : TFTime;
{$R *.DFM}
procedure TFRParams.FormActivate(Sender: TObject);
begin
Load;
end;
procedure TFRParams.Button1Click(Sender: TObject);
var
l : TAssembleLine;
begin
if (pLine = -1) or (pFrom = -1) or (pTo = -1) then
begin
MessageDlg('Òàêàÿ ïåðåíàñòðîéêà íåâîçìîæíà!', mtError, [mbOk], 0);
exit;
end;
l := Model.Lines.List[Model.Lines.FindByNumber(pLine)] as TAssembleLine;
if (L.FReconfigure.GetReconfTime(pFrom, pTo) = -1) then
begin
MessageDlg('Âûáðàííàÿ ëèíèÿ íå ìîæåò áûòü òàê ïåðåíàñòðîåíà!' , mtError, [mbOk], 0);
exit;
end;
Save;
ModalResult := mrOk;
end;
procedure TFRParams.Load;
begin
pTime := Item.rTime;
pFrom := Item.rFrom;
pTo := Item.rTo;
pLine := Item.rLine;
end;
procedure TFRParams.Save;
begin
Item.rTime := pTime;
Item.rFrom := pFrom;
Item.rTo := pTo;
Item.rLine := pLine;
end;
function TFRParams.GetFrom: integer;
begin
with FromBox do
if ItemIndex = -1 then result := -1
else
result := (Items.Objects[ItemIndex] as TMaterial).Number;
end;
function TFRParams.GetLine: integer;
begin
with LineBox do
if ItemIndex = -1 then result := -1
else
result := (Items.Objects[ItemIndex] as TAssembleLine).Number;
end;
function TFRParams.GetTime: time;
begin
result := FTime.Number;
end;
function TFRParams.GetTo: integer;
begin
with ToBox do
if ItemIndex = -1 then result := -1
else
result := (Items.Objects[ItemIndex] as TMaterial).Number;
end;
procedure TFRParams.SetFrom(value: integer);
begin
RefreshFromBox;
FromBox.ItemIndex := Model.Materials.FindByNumber(value);
end;
procedure TFRParams.SetLine(value: integer);
begin
RefreshLineBox;
LineBox.ItemIndex := Model.Lines.FindByNumber(value);
end;
procedure TFRParams.SetTime(value: time);
begin
FTime.Number := value;
end;
procedure TFRParams.SetTo(value: integer);
begin
RefreshToBox;
ToBox.ItemIndex := Model.Materials.FindByNumber(value);
end;
procedure TFRParams.FormCreate(Sender: TObject);
begin
Panel1.BorderStyle := bsNone;
FTime := TFTime.CreateEmbedded(self, Panel1);
FTime.Show;
end;
procedure TFRParams.RefreshLineBox;
var
i : integer;
begin
LineBox.Clear;
with Model.Lines do
for i := Low(List) to high(List) do
LineBox.Items.AddObject(List[i].Name, List[i]);
end;
procedure TFRParams.RefreshFromBox;
var
i : integer;
begin
FromBox.Clear;
with Model.Materials do
for i := Low(List) to high(List) do
FromBox.Items.AddObject(List[i].Name, List[i]);
end;
procedure TFRParams.RefreshToBox;
var
i : integer;
begin
ToBox.Clear;
with Model.Materials do
for i := Low(List) to high(List) do
ToBox.Items.AddObject(List[i].Name, List[i]);
end;
end.