mardi 21 juillet 2020

Adding Hours to Date based on Working shift duration

I am creating a software which would find out the production complete date based on start date. This will be working like it would find out the total hours required to complete the production and then add it to start date. Now I want to add hours based on how the Production shift is working. These checkboxes tell that weather the shift is working or not. If checkbox is checked it means shift is working, otherwise not. Based on shift working, it would add the hours to date, For example Based on Calculation the time required is 900 hrs, now if Monday and Tuesday only one shift is working then while calculating end date it would consider only 12 hours from this 900 hrs for Monday and Tuesday.

Screenshot of WinForm

production24 = ((rpm * 24 * 60) / (pick * 39.37)) * (eff / 100)
        production12 = ((rpm * addvalue * 60) / (pick * 39.37)) * (eff / 100)
        production1 = ((rpm * 1 * 60) / (pick * 39.37)) * (eff / 100)

        production24 = Math.Round(production24, 2, MidpointRounding.AwayFromZero)
        production12 = Math.Round(production12, 2, MidpointRounding.AwayFromZero)
        production1 = Math.Round(production1, 2, MidpointRounding.AwayFromZero)

        pro_24.Text = Convert.ToString(production24)
        Pro_12.Text = Convert.ToString(production12)
        Pro_1.Text = Convert.ToString(production1)

        If fl <> 0 And production1 <> 0 Then
            timereqinhr = fl / production1
        Else
            timereqinhr = 0
        End If



        getdate = DatePicker.Value + Time_Picker.Value.TimeOfDay
        falldate = getdate.AddHours(timereqinhr + offshift)

        fallingtime.Text = falldate.ToString("dd/MM/yyyy | hh:mm tt")
        Label9.Text = "Time required for " + fabric_Length.Text + " Meters"

        Dim productiontime, productionhr, productionmin As String
        productiontime = Math.Floor(timereqinhr / 24)
        productionhr = Math.Floor(((timereqinhr / 24) - productiontime) * 24)
        productionmin = Math.Floor(((((timereqinhr / 24) - productiontime) * 24) * 60) - (productionhr * 60))
        Label8.Text = (productiontime + " Days, " + productionhr + " Hours " + productionmin + " Min ")




Aucun commentaire:

Enregistrer un commentaire