Line Shift Report, Linear Day Report

I am creating a line break report:

In my application, I provide a drop-down list for selecting shift and line, and they will select a date from the calendar

I have 3 shifts

  • shift1 starts at 7 a.m. and ends at 3 p.m.
  • shift2 starts at 3 p.m. and ends at 11 p.m.
  • shift3 starts at 11:00 and ends at 3 o’clock

I have a table with a name dataloggingwhere the login data will be saved as shown below:

Name       Shiftname       ID          operatorname   Date           plantname    line     Machine
Pradeepa  Shift2(11-7)     3           Operator 3     2011-05-28     Plant 3      Line5    mc10
Ashwini   Shift1(7-3)      1           Operator 1     2011-05-29     Plant 3      Line6    mc12
Deepika   Shift2(11-7)     2           Operator 3     2011-05-29     Plant 5      Line9    mc18
Ashwini   Shift1(7-3)      1           Operator 1     2011-05-24     Plant 1      Line1    mc1
Deepika   Shift2(3-11)     2           Operator 2     2011-05-24     Plant 2      Line3    mc5
Ashwini   Shift2(3-11)     1           Operator 2     2011-05-25     Plant 2      Line3    mc5

etc.

I have a parameter table such as temperature, pressure, ph, speed, co2, etc.

Temperature the table contains the following data, and this table will contain all the readings from 7 am to 3 am

Temperature      Time              Date
27               13:13:54.000      2011-05-25
27.3             13:14:04.000      2011-05-25 
27.6             13:14:14.000      2011-05-25 
27.9             13:14:24.000      2011-05-25
28.2             13:14:34.000      2011-05-25 
28.5             13:14:44.000      2011-05-25 
27               16:13:29.000      2011-05-26 
27               16:13:31.000      2011-05-26 

etc.

, shift2, 3 25/05/2011, 3pm 11pm,

:

Machine     Shiftname   Date               Time             Temperature
mc5         Shift2      25/05/2011         13:13:54.000     27
mc5         Shift2      25/05/2011         13:14:04.000     27.3
mc5         Shift2      25/05/2011         13:14:14.000     27.6

shiftname , , 23:00:00, shift3

, , shift1, line1 , 7:00 15:00

- .

+3
1

SELECT d.Machine
       , CASE WHEN t.time BETWEEN '19:00:00.000' AND '23:59:59.999' THEN 'Shift1'
              WHEN t.time BETWEEN '00:00:00.000' AND '02:59:59.999' THEN 'Shift1'
              WHEN t.time BETWEEN '03:00:00.000' AND '10:59:59.999' THEN 'Shift2'
              WHEN t.time BETWEEN '11:00:00.000' AND '18:59:59.999' THEN 'Shift3'
          END
       , t.Date
       , t.Time
       , t.Temperature
FROM   Datalogging d
       INNER JOIN Temperature t ON t.Date = d.Date
WHERE  d.Shifname = 'Shift2(3-11)'
       AND d.Line = 'Line3'
       AND t.Date = '25/05/2011'

, , , Temperature Datalogging .

+2

All Articles