From 10225d3a01dd5ca934e5db7ea9146301f2adfd2d Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Mon, 17 Nov 2025 10:51:48 +0700 Subject: (andri) ubah status so_to_po leadtime_so_to_po_working_hour dari 3 jam ke 6 jam --- calculate_leadtime_so_to_po.ktr | 851 ++++++++++++++++++++-------------------- 1 file changed, 416 insertions(+), 435 deletions(-) diff --git a/calculate_leadtime_so_to_po.ktr b/calculate_leadtime_so_to_po.ktr index fe76ef8..931bf2e 100644 --- a/calculate_leadtime_so_to_po.ktr +++ b/calculate_leadtime_so_to_po.ktr @@ -431,7 +431,7 @@ 2025/07/14 14:00:11.471 - 2025/07/14 14:00:11.471 - + H4sIAAAAAAAAAAMAAAAAAAAAAAA= N @@ -555,10 +555,10 @@ - Table input - TableInput + Insert / update + InsertUpdate - N + Y 1 @@ -566,110 +566,48 @@ dw bi indoteknik (localhost) - select so_confirm_date, po_confirm_date, sale_order_line_id, sale_order_id -from mv_leadtime_so_to_delivered -where 1=1 -and so_to_po >= 0 - 0 - - N - N - N - N - - - Timestamp - normal + 100 + N + + public + leadtime_so_to_po_working_hour
+ + sale_order_line_id + sale_order_line_id + = + + + so_confirm_date - 6 - -1 - Table input - so_confirm_date - - . - , - - none - N - Y - 0 - N - N - N - en_US - Asia/Bangkok - N -
- - Timestamp - normal + so_confirm_date + Y + + po_confirm_date - 6 - -1 - Table input - po_confirm_date - - . - , - - none - N - Y - 0 - N - N - N - en_US - Asia/Bangkok - N - - - Integer - normal + po_confirm_date + Y + + sale_order_line_id - 9 - 0 - Table input - sale_order_line_id - ####0;-####0 - . - , - - none - N - Y - 0 - N - N - N - en_US - Asia/Bangkok - N - - - Integer - normal + sale_order_line_id + N + + sale_order_id - 9 - 0 - Table input - sale_order_id - ####0;-####0 - . - , - - none - N - Y - 0 - N - N - N - en_US - Asia/Bangkok - N - -
+ sale_order_id + Y + + + working_hours + working_hours + Y + + + so_to_po_status + so_to_po_status + Y + +
@@ -679,7 +617,94 @@ and so_to_po >= 0 - 96 + 816 + 144 + Y + +
+ + Merge join + MergeJoin + + Y + + 1 + + none + + + LEFT OUTER + Sort rows + Sort rows 2 + + sale_order_line_id + + + sale_order_line_id + + + + + + + + + + + 384 + 240 + Y + + + + Modified JavaScript value + ScriptValueMod + + Y + + 1 + + none + + + N + 9 + + + 0 + Script 1 + //Script here +var so_to_po_status = 'not achieve'; +if (working_hours <= 6) +{ + so_to_po_status = 'achieve' +} +else{ + so_to_po_status = 'not achieve' +} + + + + + + so_to_po_status + so_to_po_status + String + -1 + -1 + N + + + + + + + + + + + + 656 48 Y @@ -698,19 +723,15 @@ and so_to_po >= 0 so_confirm_date - po_confirm_date - sale_order_line_id - sale_order_id - N @@ -742,19 +763,15 @@ and so_to_po >= 0 so_confirm_date - po_confirm_date - sale_order_line_id - sale_order_id - N @@ -773,8 +790,8 @@ and so_to_po >= 0 - Table input 2 - TableInput + Select values 3 + SelectValues Y @@ -783,109 +800,24 @@ and so_to_po >= 0 none - dw bi indoteknik (localhost) - WITH params AS ( - SELECT - ?::timestamp AS start_time, - ?::timestamp AS end_time -), -hours AS ( - SELECT generate_series( - (SELECT start_time FROM params), - (SELECT end_time FROM params), - interval '1 hour' - ) AS ts -), -filtered_hours AS ( - SELECT ts - FROM hours - WHERE - EXTRACT(HOUR FROM ts) BETWEEN 8 AND 16 - AND ( - EXTRACT(HOUR FROM ts) > 8 OR EXTRACT(MINUTE FROM ts) >= 30 - ) - AND EXTRACT(DOW FROM ts) NOT IN (0) - AND DATE(ts) NOT IN (SELECT holiday_date FROM holidays) -) -SELECT COUNT(*) AS working_hours, ? as sale_order_line_id, ? as sale_order_id -FROM filtered_hours; - 0 - Select values - Y - Y - N - N - - - Integer - normal - working_hours - 15 - 0 - Table input 2 - working_hours - ####0;-####0 - . - , - - none - N - Y - 0 - N - N - N - en_US - Asia/Bangkok - N - - - String - normal + + + so_confirm_date + + + po_confirm_date + + sale_order_line_id - 2147483647 - -1 - Table input 2 - sale_order_line_id - - . - , - - none - N - Y - 0 - N - N - N - en_US - Asia/Bangkok - N - - - String - normal + + sale_order_id - 2147483647 - -1 - Table input 2 - sale_order_id - - . - , - - none - N - Y - 0 - N - N - N - en_US - Asia/Bangkok - N - - + + + working_hours + + N + @@ -895,14 +827,14 @@ FROM filtered_hours; - 384 - 48 + 496 + 240 Y - Sort rows - SortRows + Select values 4 + SelectValues Y @@ -911,22 +843,26 @@ FROM filtered_hours; none - %%java.io.tmpdir%% - out - 1000000 - - N - - N + + so_confirm_date + + + po_confirm_date + sale_order_line_id - Y - N - N - 0 - N + + sale_order_id + + + working_hours + + + so_to_po_status + + N @@ -937,13 +873,13 @@ FROM filtered_hours; - 96 - 240 + 816 + 48 Y - Sort rows 2 + Sort rows SortRows Y @@ -979,96 +915,14 @@ FROM filtered_hours; - 384 - 144 - Y - - - - Merge join - MergeJoin - - Y - - 1 - - none - - - LEFT OUTER - Sort rows - Sort rows 2 - - sale_order_line_id - - - sale_order_line_id - - - - - - - - - - - 384 - 240 - Y - - - - Select values 3 - SelectValues - - Y - - 1 - - none - - - - - so_confirm_date - - - - po_confirm_date - - - - sale_order_line_id - - - - sale_order_id - - - - working_hours - - - N - - - - - - - - - - - 496 + 96 240 Y - Unique rows - Unique + Sort rows 2 + SortRows Y @@ -1077,18 +931,21 @@ FROM filtered_hours; none - N - - N - + %%java.io.tmpdir%% + out + 1000000 + + N + + N sale_order_line_id - N - - - sale_order_id - N + Y + N + N + 0 + N @@ -1100,8 +957,8 @@ FROM filtered_hours; - 496 - 48 + 384 + 144 Y @@ -1156,44 +1013,121 @@ FROM filtered_hours; - Modified JavaScript value - ScriptValueMod + Table input + TableInput - Y + N 1 none - N - 9 - - - 0 - Script 1 - //Script here -var so_to_po_status = 'not achieve'; -if (working_hours <= 3) -{ - so_to_po_status = 'achieve' -} -else{ - so_to_po_status = 'not achieve' -} - - - - - - so_to_po_status - so_to_po_status - String - -1 + dw bi indoteknik (localhost) + select so_confirm_date, po_confirm_date, sale_order_line_id, sale_order_id +from mv_leadtime_so_to_delivered +where 1=1 +and so_to_po >= 0 + 0 + + N + N + N + N + + + Timestamp + normal + so_confirm_date + 6 -1 - N - - + Table input + so_confirm_date + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + Timestamp + normal + po_confirm_date + 6 + -1 + Table input + po_confirm_date + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + Integer + normal + sale_order_line_id + 9 + 0 + Table input + sale_order_line_id + ####0;-####0 + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + Integer + normal + sale_order_id + 9 + 0 + Table input + sale_order_id + ####0;-####0 + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + @@ -1203,14 +1137,14 @@ else{ - 656 + 96 48 Y - Select values 4 - SelectValues + Table input 2 + TableInput Y @@ -1219,33 +1153,109 @@ else{ none - - - so_confirm_date - - - - po_confirm_date - - - + dw bi indoteknik (localhost) + WITH params AS ( + SELECT + ?::timestamp AS start_time, + ?::timestamp AS end_time +), +hours AS ( + SELECT generate_series( + (SELECT start_time FROM params), + (SELECT end_time FROM params), + interval '1 hour' + ) AS ts +), +filtered_hours AS ( + SELECT ts + FROM hours + WHERE + EXTRACT(HOUR FROM ts) BETWEEN 8 AND 16 + AND ( + EXTRACT(HOUR FROM ts) > 8 OR EXTRACT(MINUTE FROM ts) >= 30 + ) + AND EXTRACT(DOW FROM ts) NOT IN (0) + AND DATE(ts) NOT IN (SELECT holiday_date FROM holidays) +) +SELECT COUNT(*) AS working_hours, ? as sale_order_line_id, ? as sale_order_id +FROM filtered_hours; + 0 + Select values + Y + Y + N + N + + + Integer + normal + working_hours + 15 + 0 + Table input 2 + working_hours + ####0;-####0 + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + String + normal sale_order_line_id - - - + 2147483647 + -1 + Table input 2 + sale_order_line_id + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + + String + normal sale_order_id - - - - working_hours - - - - so_to_po_status - - - N - + 2147483647 + -1 + Table input 2 + sale_order_id + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + + @@ -1255,14 +1265,14 @@ else{ - 816 + 384 48 Y - Insert / update - InsertUpdate + Unique rows + Unique Y @@ -1271,49 +1281,20 @@ else{ none - dw bi indoteknik (localhost) - 100 - N - - public - leadtime_so_to_po_working_hour
- - sale_order_line_id - sale_order_line_id - = - - - - so_confirm_date - so_confirm_date - Y - - - po_confirm_date - po_confirm_date - Y - - + N + + N + + + sale_order_line_id - sale_order_line_id - N - - + N + + sale_order_id - sale_order_id - Y - - - working_hours - working_hours - Y - - - so_to_po_status - so_to_po_status - Y - -
+ N + + @@ -1323,8 +1304,8 @@ else{ - 816 - 144 + 496 + 48 Y
-- cgit v1.2.3