Einzelnen Beitrag anzeigen

Bonimahoni

Registriert seit: 21. Jul 2010
10 Beiträge
 
Turbo Delphi für Win32
 
#6

AW: Berechnung von Produktionsintervallen

  Alt 26. Jul 2010, 14:08
So ich hab doch mit Industriezeit berechnet nach dem ich im Forum gefunden habe wie man Zeit decoded und endcoded.

Könnte sich jemand den Code anschauen und sagen ob man daran noch etwas verbessern kann?

Aso hat jemand noch zufällig einen Link für ein Tutorial über das Laden von Frames in Frames? Möchte gerne eine Hauptseite mit einem Hauptmenu machen wo ich mein Datengrundladeframe reinlade. Habe leider nichts konkretes dazu gefunden

Die GUI: http://img265.imageshack.us/f/guicw.jpg/

Hier der Code:

Delphi-Quellcode:
procedure TForm_Dateneingabe.Ausfuehren_TaktplanungClick(Sender: TObject);

var

Eingabezeit,Darstellung : Ttime ;
Fr_1_Schulung_Von , Fr_1_Schulung_Bis , Do_1_Schulung_Von, Do_1_Schulung_Bis ,Mi_1_Schulung_Von ,Mi_1_Schulung_Bis, Di_1_Schulung_Bis , Di_1_Schulung_Von, Mo_1_Schulung_Bis, Mo_1_Schulung_Von : Ttime ;
i,hour, minute, Arbeitsanfang : integer;
Dauerschulung, Pause1, Pause2, Pause3, Uebertrag, Taktzeit, Taktimpuls, Startzeit : real ;
h, m, s, ms: Word;

Dauerschulung1, Dauerschulung2 , Dauerschulung3 , Dauerschulung4 , Dauerschulung5 : real ;

begin

Pause1 := 0.08 ; // 5min
Pause2 := 0.33 ; // 15min
Pause3 := 1.00 ; // = Pause1 + 2 + 40min Mittag
Taktzeit := 2 ; // 2h
Arbeitsanfang := 6 ; // 6 Uhr


Eingabezeit := StrToTime(Eingabe_Anfangszeit.text) ;
DecodeTime(Eingabezeit, h, m, s, ms);
Startzeit := h + (m * 10/6)/100 ;

//Montag Schulung

if Mo_1_Schulung.checked then
begin
Mo_1_Schulung_Bis := StrToTime(Eingabe_Mo_1_Schulung_Bis.text) ;
DecodeTime(Mo_1_Schulung_Bis, h, m, s, ms);
Mo_1_Schulung_Bis := h + (m * 10/6)/100 ;

Mo_1_Schulung_Von := StrToTime(Eingabe_Mo_1_Schulung_Von.text) ;
DecodeTime(Mo_1_Schulung_Von, h, m, s, ms);
Mo_1_Schulung_Von := h + (m * 10/6)/100 ;

Dauerschulung1 := Mo_1_Schulung_Bis - Mo_1_Schulung_Von ;
end;

//Dienstag Schulung

if Di_1_Schulung.checked then
begin
Di_1_Schulung_Bis := StrToTime(Eingabe_Di_1_Schulung_Bis.text) ;
DecodeTime(Di_1_Schulung_Bis, h, m, s, ms);
Di_1_Schulung_Bis := h + (m * 10/6)/100 ;

Di_1_Schulung_Von := StrToTime(Eingabe_Di_1_Schulung_Von.text) ;
DecodeTime(Di_1_Schulung_Von, h, m, s, ms);
Di_1_Schulung_Von := h + (m * 10/6)/100 ;

Dauerschulung2 := Di_1_Schulung_Bis - Di_1_Schulung_Von ;
end;

//Mittwoch Schulung

if Mi_1_Schulung.checked then
begin
Mi_1_Schulung_Bis := StrToTime(Eingabe_Mi_1_Schulung_Bis.text) ;
DecodeTime(Mi_1_Schulung_Bis, h, m, s, ms);
Mi_1_Schulung_Bis := h + (m * 10/6)/100 ;

Mi_1_Schulung_Von := StrToTime(Eingabe_Mi_1_Schulung_Von.text) ;
DecodeTime(Mi_1_Schulung_Von, h, m, s, ms);
Mi_1_Schulung_Von := h + (m * 10/6)/100 ;
Dauerschulung3 := Mi_1_Schulung_Bis - Mi_1_Schulung_Von ;
end;

//Donnerstag Schulung

if Do_1_Schulung.checked then
begin
Do_1_Schulung_Bis := StrToTime(Eingabe_Do_1_Schulung_Bis.text) ;
DecodeTime(Do_1_Schulung_Bis, h, m, s, ms);
Do_1_Schulung_Bis := h + (m * 10/6)/100 ;

Do_1_Schulung_Von := StrToTime(Eingabe_Do_1_Schulung_Von.text) ;
DecodeTime(Do_1_Schulung_Von, h, m, s, ms);
Do_1_Schulung_Von := h + (m * 10/6)/100 ;
Dauerschulung4 := Do_1_Schulung_Bis - Do_1_Schulung_Von ;
end;

//Freitag Schulung

if Fr_1_Schulung.checked then
begin
Fr_1_Schulung_Bis := StrToTime(Eingabe_Fr_1_Schulung_Bis.text) ;
DecodeTime(Fr_1_Schulung_Bis, h, m, s, ms);
Fr_1_Schulung_Bis := h + (m * 10/6)/100 ;

Fr_1_Schulung_Von := StrToTime(Eingabe_Fr_1_Schulung_Von.text) ;
DecodeTime(Fr_1_Schulung_Von, h, m, s, ms);
Fr_1_Schulung_Von := h + (m * 10/6)/100 ;
Dauerschulung5 := Fr_1_Schulung_Bis - Fr_1_Schulung_Von ;
end;


//Berechnung Taktimpulse Montag

For i:=0 to 3 do

begin

  Taktimpuls := Startzeit + Taktzeit * i ;

  if Mo_1_Schulung_Von < Taktimpuls then Taktimpuls := Taktimpuls + Dauerschulung1 ;

  if (Taktimpuls > 7.50) and (Taktimpuls < 9.00) then Taktimpuls := Taktimpuls + Pause1 else
  if (Taktimpuls >= 9.00) and (Taktimpuls < 11.50) then Taktimpuls := Taktimpuls + Pause2 ;
  if (Taktimpuls >= 11.50) then Taktimpuls := Taktimpuls + Pause3 ;

  if i = 0 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mo_1_Impuls_1.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 1 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mo_1_Impuls_2.caption := FormatDateTime('hh:nn:ss', Darstellung)
   end;

  if i = 2 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mo_1_Impuls_3.caption := FormatDateTime('hh:nn:ss', Darstellung)
   end;

   if i = 3 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mo_1_Impuls_4.caption := FormatDateTime('hh:nn:ss', Darstellung) ;
    if Taktimpuls > 14 then Mo_1_Impuls_4.visible := false ;
    end;

end;

if taktimpuls < 14 then uebertrag := 2 - (14 - Taktimpuls)
else uebertrag := taktimpuls - 14 ;

Startzeit := uebertrag + Arbeitsanfang ;

//Berechnung Taktimpulse Dienstag

for i := 0 to 3 do

begin

  Taktimpuls := Startzeit + Taktzeit * i ;

  if Di_1_Schulung_Von < Taktimpuls then Taktimpuls := Taktimpuls + Dauerschulung2 ;

  if (Taktimpuls > 7.50) and (Taktimpuls < 9.00) then Taktimpuls := Taktimpuls + Pause1 else
  if (Taktimpuls >= 9.00) and (Taktimpuls < 11.50) then Taktimpuls := Taktimpuls + Pause2 ;
  if (Taktimpuls >= 11.50) then Taktimpuls := Taktimpuls + Pause3 ;

  if i = 0 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Di_1_Impuls_1.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 1 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Di_1_Impuls_2.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 2 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Di_1_Impuls_3.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

   if i = 3 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Di_1_Impuls_4.caption := FormatDateTime('hh:nn:ss', Darstellung);
    if Taktimpuls > 14 then Di_1_Impuls_4.visible := false ;
    end;
end;


if taktimpuls < 14 then uebertrag := 2 - (14 - Taktimpuls)
else uebertrag := taktimpuls - 14 ;

Startzeit := uebertrag + Arbeitsanfang ;

//Berechnung Taktimpulse Mittwoch

for i := 0 to 3 do

begin

  Taktimpuls := Startzeit + Taktzeit * i ;

  if Mi_1_Schulung_Von < Taktimpuls then Taktimpuls := Taktimpuls + Dauerschulung3 ;

  if (Taktimpuls > 7.50) and (Taktimpuls < 9.00) then Taktimpuls := Taktimpuls + Pause1 else
  if (Taktimpuls >= 9.00) and (Taktimpuls < 11.50) then Taktimpuls := Taktimpuls + Pause2 ;
  if (Taktimpuls >= 11.50) then Taktimpuls := Taktimpuls + Pause3 ;

  if i = 0 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mi_1_Impuls_1.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 1 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mi_1_Impuls_2.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 2 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mi_1_Impuls_3.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

   if i = 3 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Mi_1_Impuls_4.caption := FormatDateTime('hh:nn:ss', Darstellung);
    if Taktimpuls > 14 then Mi_1_Impuls_4.visible := false ;
    end;
end;


if taktimpuls < 14 then uebertrag := 2 - (14 - Taktimpuls)
else uebertrag := taktimpuls - 14 ;

Startzeit := uebertrag + Arbeitsanfang ;

//Berechnung Taktimpulse Donnerstag

for i := 0 to 3 do

begin

  Taktimpuls := Startzeit + Taktzeit * i ;

  if Mi_1_Schulung_Von < Taktimpuls then Taktimpuls := Taktimpuls + Dauerschulung4 ;

  if (Taktimpuls > 7.50) and (Taktimpuls < 9.00) then Taktimpuls := Taktimpuls + Pause1 else
  if (Taktimpuls >= 9.00) and (Taktimpuls < 11.50) then Taktimpuls := Taktimpuls + Pause2 ;
  if (Taktimpuls >= 11.50) then Taktimpuls := Taktimpuls + Pause3 ;

  if i = 0 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Do_1_Impuls_1.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 1 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Do_1_Impuls_2.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 2 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Do_1_Impuls_3.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

   if i = 3 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Do_1_Impuls_4.caption := FormatDateTime('hh:nn:ss', Darstellung);
    if Taktimpuls > 14 then Do_1_Impuls_4.visible := false ;
    end;
end;


if taktimpuls < 14 then uebertrag := 2 - (14 - Taktimpuls)
else uebertrag := taktimpuls - 14 ;

Startzeit := uebertrag + Arbeitsanfang ;

//Berechnung Taktimpulse Freitag

for i := 0 to 3 do

begin

  Taktimpuls := Startzeit + Taktzeit * i ;

  if Fr_1_Schulung_Von < Taktimpuls then Taktimpuls := Taktimpuls + Dauerschulung5 ;

  if (Taktimpuls > 7.50) and (Taktimpuls < 9.00) then Taktimpuls := Taktimpuls + Pause1 else
  if (Taktimpuls >= 9.00) and (Taktimpuls < 11.50) then Taktimpuls := Taktimpuls + Pause2 ;
  if (Taktimpuls >= 11.50) then Taktimpuls := Taktimpuls + Pause3 ;

  if i = 0 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Fr_1_Impuls_1.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 1 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Fr_1_Impuls_2.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

  if i = 2 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Fr_1_Impuls_3.caption := FormatDateTime('hh:nn:ss', Darstellung);
    end;

   if i = 3 then
    begin
    hour := trunc(Taktimpuls);
    minute := round( (Taktimpuls - hour) * 6/10 * 100);
    Darstellung := EncodeTime(hour, minute, s, ms) ;
    Fr_1_Impuls_4.caption := FormatDateTime('hh:nn:ss', Darstellung);
    if Taktimpuls > 14 then Fr_1_Impuls_4.visible := false ;
    end;
end;

if taktimpuls < 14 then uebertrag := 2 - (14 - Taktimpuls)
else uebertrag := taktimpuls - 14 ;
hour := trunc(uebertrag);
minute := round( (uebertrag - hour) * 6/10 * 100);
Darstellung := EncodeTime(hour, minute, s, ms) ;
Uebertrag_auf_Montag.caption := FormatDateTime('hh:nn:ss', Darstellung);

end;

end.
  Mit Zitat antworten Zitat