Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
55
tasks_gen/eval/G0134/reference/grain_check.func.abap
Normal file
55
tasks_gen/eval/G0134/reference/grain_check.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}grain_check
|
||||
IMPORTING
|
||||
iv_grain_type TYPE string
|
||||
iv_weight_kg TYPE decfloat34
|
||||
iv_moisture_pct TYPE decfloat34
|
||||
iv_supplier TYPE string
|
||||
EXPORTING
|
||||
ev_accepted TYPE abap_bool
|
||||
ev_drying_cost TYPE decfloat34
|
||||
RAISING
|
||||
{{p}}cx_grain.
|
||||
|
||||
CONSTANTS lc_rate TYPE decfloat34 VALUE '0.75'.
|
||||
|
||||
ev_accepted = abap_false.
|
||||
ev_drying_cost = 0.
|
||||
|
||||
IF iv_weight_kg <= 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'WEIGHT'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_supplier IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'SUPPLIER'.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_max_moisture TYPE decfloat34.
|
||||
CASE iv_grain_type.
|
||||
WHEN 'WHEAT'.
|
||||
lv_max_moisture = '14.5'.
|
||||
WHEN 'BARLEY'.
|
||||
lv_max_moisture = '14.0'.
|
||||
WHEN 'RYE'.
|
||||
lv_max_moisture = '15.0'.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'GRAIN_TYPE'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_moisture_pct < 0 OR iv_moisture_pct > 100.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'MOISTURE_RANGE'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_moisture_pct > lv_max_moisture.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'MOISTURE'.
|
||||
ENDIF.
|
||||
|
||||
DATA(lv_target) = lv_max_moisture - 2.
|
||||
IF iv_moisture_pct > lv_target.
|
||||
ev_drying_cost = round( val = iv_weight_kg * ( iv_moisture_pct - lv_target ) * lc_rate
|
||||
dec = 2
|
||||
mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ev_accepted = abap_true.
|
||||
|
||||
ENDFUNCTION.
|
||||
Reference in New Issue
Block a user