Xreferat.com » Рефераты по информатике и программированию » Оптимизация сетевого графика по времени

Оптимизация сетевого графика по времени

Edit2: TEdit;

Edit3: TEdit;

Label1: TLabel;

Label2: TLabel;

N12: TMenuItem;

procedure FormCreate(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure SpeedButton4Click(Sender: TObject);

procedure SpeedButton3Click(Sender: TObject);

procedure SpeedButton2Click(Sender: TObject);

procedure N5Click(Sender: TObject);

procedure SpeedButton6Click(Sender: TObject);

procedure SpeedButton5Click(Sender: TObject);

procedure N6Click(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure N7Click(Sender: TObject);

procedure Edit1KeyPress(Sender: TObject; var Key: Char);

procedure N12Click(Sender: TObject);

private

{ Private declarations }

public

l:integer;

Count,Sum:integer;

buf1:array[1..100] of real;

buf2:array[0..30] of real;

err:integer;

{ Public declarations }

end;

var


Proizvod : String;//Производительность

Str : String;//колличество строк

Rab_I : String;//Работы

Rab_J : String;//Работы

OB_Rabot : String; //Обьем работ изделий

KolRes : String; //Колличество рабочих

Prodolgit : String; //Продолжительность


Err,i,j : Integer;

General : TGeneral;

F : Textfile;

implementation


uses Unit2, Unit3, Unit4;


{$R *.DFM}


procedure TGeneral.FormCreate(Sender: TObject);

begin

//General.WindowState:=WsMaximized;

General.Position:=poDesktopCenter;

General.Caption:='Оптимезация сетевого графика по времени.';

GroupBox1.Caption:='';

GroupBox2.Caption:='';

SG1.cells[0,0]:='I';

SG1.cells[1,0]:='J';

SG1.cells[2,0]:='Объем работ';

SG1.cells[3,0]:='Необход. ресурсов';

SG1.cells[4,0]:='Число ресурсов';

SG1.cells[5,0]:='Продолжительность';

SG1.cells[6,0]:='События';

SG1.cells[7,0]:='Рез. времени';

SG1.RowCount:=2;

end;


procedure TGeneral.N3Click(Sender: TObject);

begin

Close;

end;


procedure TGeneral.SpeedButton1Click(Sender: TObject);

var

i,j:Integer;

Sum,Sum2,a: Real;


begin

Panel1.Visible:=true;

label1.Visible:=true;

label2.Visible:=true;

label4.Visible:=true;

label5.Visible:=true;

label7.Visible:=true;

Sg4.Visible:=true;

edit2.Visible:=true;

edit3.Visible:=true;

edit4.Visible:=true;

//edit5.Visible:=true;

{Выясним необходимое число ресурсов}

for i:=1 to sg1.RowCount-1 do

Begin

a:=StrToInt(sg1.Cells[2,i])/StrToInt(edit1.text);

sg1.Cells[3,i]:=FloatToStr(a);

{Выясним необходимое число ресурсов}

Sum2:=Sum2+StrToFloat(sg1.Cells[4,i]);

Edit3.Text:=FloatToStr(Sum2);

{Всего необходимых ресурсов}

Sum:=Sum+StrToFloat(sg1.Cells[3,i]);

Edit2.Text:=FloatToStr(Sum);

end;

{Продолжительность работ}

for i:=1 to sg1.RowCount-1 do

Begin

a:=StrToFloat(sg1.Cells[3,i])/StrToFloat(sg1.Cells[4,i]);

sg1.Cells[5,i]:=FloatToStr(a);


end;


end;


procedure TGeneral.SpeedButton4Click(Sender: TObject);

begin

close;

end;


procedure TGeneral.SpeedButton3Click(Sender: TObject);

begin

For I:=0 to 2 do

For j:=1 to Sg1.RowCount-1 do

Begin

if Sg1.Cells[i,j]= '' then err:=err+1;

end;

For j:=1 to Sg1.RowCount-1 do

if Sg1.Cells[4,j]= '' then err:=err+1;

if err <>0 then

begin

MessageDlg('Ошибка'+#13+'Таблица заполнена не полностью.'+#13+'Сохранение не произведено!'

, mtError,[mbOk], 0);

err:=0;

end

else

Begin

Proizvod:=edit1.text;

Str:=IntToStr(sg1.RowCount);

For i:=1 to Sg1.RowCount-1 do

Begin

Rab_I :=(Sg1.Cells[0,i]);

Rab_J :=(Sg1.Cells[1,i]);

OB_Rabot:=(Sg1.Cells[2,i]);

write(f,Rab_I);

write(f,Rab_J);

write(f,OB_Rabot);

End;

For I:=1 to Sg1.RowCount-1 do

KolRes:=(Sg1.Cells[4,i])

end;

CloseFile(f);

end;


procedure TGeneral.SpeedButton2Click(Sender: TObject);

begin

General.N7.Click;

if OpenDialog1.Execute then

{$I-}

AssignFile(F,OpenDialog1.FileName); Reset(F);

Proizvod:=edit1.text;

Str:=IntToStr(sg1.RowCount);

For i:=1 to Sg1.RowCount-1 do

Begin

Rab_I :=(Sg1.Cells[0,i]);

Rab_J :=(Sg1.Cells[1,i]);

OB_Rabot:=(Sg1.Cells[2,i]);

write(f,Rab_I);

write(f,Rab_J);

write(f,OB_Rabot);

End;

For I:=1 to Sg1.RowCount-1 do

KolRes:=(Sg1.Cells[4,i])

{$I+}

CloseFile(f);

end;


procedure TGeneral.N5Click(Sender: TObject);

begin

if OpenDialog1.Execute then

end;


procedure TGeneral.SpeedButton6Click(Sender: TObject);

begin

Edit1.Text:='5';

sg1.RowCount:=12;

sg1.Cells[0,1]:=INttoStr(0);

sg1.Cells[1,1]:=INttoStr(1);

sg1.Cells[2,1]:=INttoStr(25);

sg1.Cells[4,1]:=INttoStr(5);


sg1.Cells[0,2]:=INttoStr(0);

sg1.Cells[1,2]:=INttoStr(2);

sg1.Cells[2,2]:=INttoStr(30);

sg1.Cells[4,2]:=INttoStr(6);


sg1.Cells[0,3]:=INttoStr(0);

sg1.Cells[1,3]:=INttoStr(3);

sg1.Cells[2,3]:=INttoStr(20);

sg1.Cells[4,3]:=INttoStr(4);


sg1.Cells[0,4]:=INttoStr(1);

sg1.Cells[1,4]:=INttoStr(4);

sg1.Cells[2,4]:=INttoStr(22);

sg1.Cells[4,4]:=INttoStr(5);


sg1.Cells[0,5]:=INttoStr(2);

sg1.Cells[1,5]:=INttoStr(3);

sg1.Cells[2,5]:=INttoStr(10);

sg1.Cells[4,5]:=INttoStr(4);


sg1.Cells[0,6]:=INttoStr(2);

sg1.Cells[1,6]:=INttoStr(4);

sg1.Cells[2,6]:=INttoStr(15);

sg1.Cells[4,6]:=INttoStr(3);


sg1.Cells[0,7]:=INttoStr(2);

sg1.Cells[1,7]:=INttoStr(5);

sg1.Cells[2,7]:=INttoStr(5);

sg1.Cells[4,7]:=INttoStr(4);


sg1.Cells[0,8]:=INttoStr(3);

sg1.Cells[1,8]:=INttoStr(6);

sg1.Cells[2,8]:=INttoStr(25);

sg1.Cells[4,8]:=INttoStr(5);


sg1.Cells[0,9]:=INttoStr(4);

sg1.Cells[1,9]:=INttoStr(6);

sg1.Cells[2,9]:=INttoStr(20);

sg1.Cells[4,9]:=INttoStr(4);


sg1.Cells[0,10]:=INttoStr(5);

sg1.Cells[1,10]:=INttoStr(6);

sg1.Cells[2,10]:=INttoStr(5);

sg1.Cells[4,10]:=INttoStr(4);


sg1.Cells[0,11]:=INttoStr(6);

sg1.Cells[1,11]:=INttoStr(7);

sg1.Cells[2,11]:=INttoStr(30);

sg1.Cells[4,11]:=INttoStr(6);

end;


procedure TGeneral.SpeedButton5Click(Sender: TObject);

begin

form2.show;

end;


procedure TGeneral.N6Click(Sender: TObject);

begin

form2.show;

end;


procedure TGeneral.FormClose(Sender: TObject; var Action: TCloseAction);

begin

case Application.MessageBox('Вы уверены, что хотите выйти?','Выход',mb_yesno or mb_iconquestion or mb_defbutton2) of

idyes:action:=caFree;

idno:action:=caNone;

end;

end;


procedure TGeneral.N7Click(Sender: TObject);

var q,w:byte;

i:integer;

begin

for q:=0 to SG1.ColCount do

for w:=1 to SG1.RowCount do


SG1.Cells[q,w]:='';


SG1.RowCount:=2;

Edit1.Text:='';

Edit2.Text:='';

Edit3.Text:='';

Edit4.Text:='';

//Edit5.Text:='';

end;


procedure TGeneral.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

case key of

'0'.. '9', chr (8):;

',':;

else key:=#0;

end;

end;

procedure TGeneral.N12Click(Sender: TObject);

begin

Sg1.RowCount:=Sg1.RowCount+1;

If Sg1.RowCount>30 then

MessageDlg('Ошибка'+#13+'строк не может быть больше 30 !!!', mtError,[mbOk], 0);

Sg1.RowCount:=30;

end;


end.

Если Вам нужна помощь с академической работой (курсовая, контрольная, диплом, реферат и т.д.), обратитесь к нашим специалистам. Более 90000 специалистов готовы Вам помочь.
Бесплатные корректировки и доработки. Бесплатная оценка стоимости работы.

Поможем написать работу на аналогичную тему

Получить выполненную работу или консультацию специалиста по вашему учебному проекту
Нужна помощь в написании работы?
Мы - биржа профессиональных авторов (преподавателей и доцентов вузов). Пишем статьи РИНЦ, ВАК, Scopus. Помогаем в публикации. Правки вносим бесплатно.

Похожие рефераты: