Fix induct detailes sqls

This commit is contained in:
Gigi Mamaladze 2025-05-13 13:57:46 +04:00
parent 193547368f
commit 0a111767c1
3 changed files with 25 additions and 39 deletions

View File

@ -32168,7 +32168,7 @@
}, },
"props": { "props": {
"dismissOnSelect": false, "dismissOnSelect": false,
"formattedValue": "May 7, 2025 12:11 PM", "formattedValue": "May 13, 2025 11:34 AM",
"formattedValues": { "formattedValues": {
"date": "Mar 26, 2021", "date": "Mar 26, 2021",
"datetime": "Mar 26, 2021 12:00 AM", "datetime": "Mar 26, 2021 12:00 AM",
@ -32178,9 +32178,9 @@
"$": [ "$": [
"ts", "ts",
192, 192,
1746609088108 1747125250352
], ],
"$ts": 1746605488000 "$ts": 1747121650000
} }
}, },
"type": "ia.input.date-time-input" "type": "ia.input.date-time-input"
@ -32328,7 +32328,7 @@
}, },
"props": { "props": {
"dismissOnSelect": false, "dismissOnSelect": false,
"formattedValue": "May 7, 2025 1:11 PM", "formattedValue": "May 13, 2025 12:34 PM",
"formattedValues": { "formattedValues": {
"date": "Mar 29, 2021", "date": "Mar 29, 2021",
"datetime": "Mar 29, 2021 1:37 PM", "datetime": "Mar 29, 2021 1:37 PM",
@ -32338,9 +32338,9 @@
"$": [ "$": [
"ts", "ts",
192, 192,
1746609088104 1747125250351
], ],
"$ts": 1746609088000 "$ts": 1747125250000
} }
}, },
"type": "ia.input.date-time-input" "type": "ia.input.date-time-input"

View File

@ -1,18 +1,12 @@
Select Select
SorterName,InductName,Total_count,singlecarrier_count,doublecarrier_count,Startstamp,Endtstamp, SorterName,InductName,Total_count,Startstamp,Endtstamp,
Total_count/Total_count as Total_perc, Total_count/Total_count as Total_perc,
singlecarrier_count/Total_count as SingleCarrier_perc, Total_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as Total_rate
doublecarrier_count/Total_count as DoubleCarrier_perc,
Total_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as Total_rate,
singlecarrier_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as SingleCarrier_rate,
doublecarrier_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as DoubleCarrier_rate
FROM FROM
(SELECT (SELECT
'S03' as SorterName, 'S03' as SorterName,
'Induct 1' as InductName, 'Induct 1' as InductName,
COUNT(*) AS Total_count, COUNT(*) AS Total_count,
SUM(alltable.ParcelHistory_TupelLength = 1) AS singlecarrier_count,
SUM(alltable.ParcelHistory_TupelLength = 2) AS doublecarrier_count,
MIN(alltable.t_stamp) AS Startstamp, MIN(alltable.t_stamp) AS Startstamp,
Max(alltable.t_stamp) AS Endtstamp Max(alltable.t_stamp) AS Endtstamp

View File

@ -1,25 +1,17 @@
Select SELECT
roundtime, okey.roundtime,
Total_count,singlecarrier_count,doublecarrier_count, okey.Total_count,
Total_count/Total_count as Total_perc, okey.Total_count / okey.Total_count AS Total_perc,
singlecarrier_count/Total_count as SingleCarrier_perc, okey.Total_count * 3600
doublecarrier_count/Total_count as DoubleCarrier_perc, / TIMESTAMPDIFF(SECOND, :starttime, :endtime) AS Total_rate
Total_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as Total_rate, FROM (
singlecarrier_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as SingleCarrier_rate, SELECT
doublecarrier_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as DoubleCarrier_rate FROM_UNIXTIME(
CEIL(UNIX_TIMESTAMP(alltable.t_stamp) / 60) * 60
FROM ) AS roundtime,
COUNT(*) AS Total_count
(Select
COUNT(*) AS Total_count,
SUM(alltable.ParcelHistory_TupelLength = 1) AS singlecarrier_count,
SUM(alltable.ParcelHistory_TupelLength = 2) AS doublecarrier_count,
FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(alltable.t_stamp) / 60) * 60) roundtime
FROM alltable FROM alltable
Where (alltable.t_stamp BETWEEN :starttime AND :endtime) and ('Induct 1' = :Induct) WHERE (alltable.t_stamp BETWEEN :starttime AND :endtime) and ('Induct 1' = :Induct)
GROUP BY roundtime
Group BY FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(alltable.t_stamp) / 60) * 60) ) AS okey
/***Order By alltable.t_stamp ASC ***/ ORDER BY okey.roundtime;
) okey