@jetta/blocks-allocator 0.0.0-stage → 0.1.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -2
- package/package.json +67 -5
- package/src/Allocation_Attempt.js +135 -0
- package/src/Allocation_Error_Handler.js +69 -0
- package/src/Allocation_Flow.js +162 -0
- package/src/Allocation_Optimization/Allocation_LP.js +150 -0
- package/src/Allocation_Optimization/Block_Allocator.js +129 -0
- package/src/Allocation_Optimization/Block_Layer_Order.js +50 -0
- package/src/Allocation_Optimization/Block_Potential_Weight.js +54 -0
- package/src/Allocation_Optimization/Chosen_Blocks_Stock_Cap.js +82 -0
- package/src/Allocation_Optimization/block_builder/Allocation_Item_Creator.js +37 -0
- package/src/Allocation_Optimization/block_builder/Block_Item_List_Validator.js +18 -0
- package/src/Allocation_Optimization/block_builder/Block_Wall_Builder.js +303 -0
- package/src/Allocation_Optimization/block_builder/Blocks_Builder.js +40 -0
- package/src/Allocation_Optimization/block_builder/Next_Block_Position.js +33 -0
- package/src/Allocation_Optimization/block_builder/Slot_Item_Assigner.js +45 -0
- package/src/Allocation_Optimization/block_builder/Stacking_Validation.js +30 -0
- package/src/Allocation_Optimization/block_builder/assert_tie_ratio_block_matches_orientation_below.js +44 -0
- package/src/Allocation_Optimization/block_builder/block_shape_stock.js +129 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Empty_Block_Item_List_Exception.js +21 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Invalid_Stacking_Exception.js +14 -0
- package/src/Allocation_Optimization/block_builder/exceptions/No_Suitable_Item_Exception.js +16 -0
- package/src/Allocation_Optimization/block_builder/exceptions/Restricted_Block_Exception.js +21 -0
- package/src/Allocation_Optimization/block_builder/should_omit_block_group_id.js +29 -0
- package/src/Allocation_Optimization/block_builder/snap_elevated_block_wall_items.js +34 -0
- package/src/Allocation_Optimization/block_builder/stacking_rules_input.js +52 -0
- package/src/Allocation_Optimization/cap_chosen_blocks_by_shape_stock.js +110 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Preparer.js +21 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Selector.js +55 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Threshold_Resolver.js +28 -0
- package/src/Allocation_Optimization/density_groups/Adaptive_Density_Group_Thresholds.js +23 -0
- package/src/Allocation_Optimization/density_groups/Container_Utilization.js +67 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Partitioner.js +74 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Scheduler.js +168 -0
- package/src/Allocation_Optimization/density_groups/Density_Group_Stock.js +49 -0
- package/src/Allocation_Optimization/density_groups/Density_Groups_Strategy.js +26 -0
- package/src/Allocation_Optimization/density_groups/Item_Density_Calculator.js +20 -0
- package/src/Allocation_Optimization/density_groups/Lock_Weight_Ahead_Release.js +75 -0
- package/src/Allocation_Optimization/exceptions/Invalid_Item_Amount_Exception.js +17 -0
- package/src/Allocation_Optimization/exceptions/No_Valid_Allocation_Exception.js +14 -0
- package/src/Allocation_Optimization/exceptions/Optimization_Infeasible_Exception.js +14 -0
- package/src/Allocation_Optimization/functions/Measure_Reader.js +20 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Cobination_Mode.js +25 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Cobination_Strategies.js +8 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Measure_Combination_Mode_Checkers.js +70 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Translation.js +22 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/Variable_Weight_Getter.js +85 -0
- package/src/Allocation_Optimization/functions/Weight_Getter/constants.js +16 -0
- package/src/Allocation_Optimization/functions/measure_to_optimize.js +6 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Capacity_Bias_Item_Order.js +76 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Choose_Item_Heuristic_Context.js +63 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Item_Chooser.js +159 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Item_For_Slot_Chooser.js +49 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Slot_Compatible_Items_Finder.js +88 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Slots_Items_Assigner.js +182 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Stack_Slot_Calculator.js +87 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/Weight_Slot_Distribution.js +72 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/Empty_Slot_Exception.js +17 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/Item_Taller_Than_Limit_Exception.js +21 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/No_Available_Items_Exception.js +14 -0
- package/src/Allocation_Optimization/item_consumption_heuristic/exceptions/No_Slots_For_Items_Exception.js +14 -0
- package/src/Allocation_Optimization/lp_model/Block_Weight_Calculator.js +31 -0
- package/src/Allocation_Optimization/lp_model/LP_Data_Processor.js +42 -0
- package/src/Allocation_Optimization/lp_model/LP_Item_Slot_Assignment.js +93 -0
- package/src/Allocation_Optimization/lp_model/LP_Result_Mapper.js +47 -0
- package/src/Allocation_Optimization/lp_model/model_builder/Dimension_Range_Helper.js +49 -0
- package/src/Allocation_Optimization/lp_model/model_builder/Item_Assignment_Variables.js +133 -0
- package/src/Allocation_Optimization/lp_model/model_builder/LP_Model_Builder.js +132 -0
- package/src/Allocation_Optimization/lp_model/model_builder/exceptions/Missing_Item_Stock_Exception.js +18 -0
- package/src/Allocation_Optimization/lp_model/model_builder/goal_function/Goal_Function_Creator.js +83 -0
- package/src/Allocation_Optimization/lp_model/model_builder/item_dimension_hashes.js +31 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Block_Item_Amount_Restriction.js +53 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Coherence_Restriction.js +65 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Container_Supported_Weight_Restriction.js +42 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Relational_Exact_Pass_Amount_Restriction.js +62 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Relational_Group_Restriction.js +97 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Single_Item_Type_Restriction.js +79 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Space_Restriction.js +47 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Unavailable_Block_Restriction.js +27 -0
- package/src/Allocation_Optimization/lp_model/model_builder/restrictions/Uniform_Block_Measure_Restriction.js +92 -0
- package/src/Allocation_Optimization/next_group_id_after_preloaded.js +30 -0
- package/src/Allocation_Optimization/preferential_blocks/Preferential_Block_Identifier.js +74 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/Key_Item_Mapper.js +49 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Almost_Unique_Item.js +31 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Cant_Stack_It_Self.js +68 -0
- package/src/Allocation_Optimization/preferential_blocks/key_item/rules/Rule_Interface.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Intercalation_State.js +49 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Orientation_Filter.js +33 -0
- package/src/Allocation_Optimization/tie_ratio/Tie_Ratio_Vertical_Stack_Filter.js +20 -0
- package/src/Allocation_Optimization/tie_ratio/collect_tie_ratio_orientations_below_footprint.js +64 -0
- package/src/Allocation_Optimization/tie_ratio/filter_blocks_by_orientation.js +17 -0
- package/src/Allocation_Optimization/tie_ratio/find_orientation_below_space.js +77 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/allocated_item_penetrates_any.js +31 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/apply_loose_placement_to_allocated_item.js +94 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/axis_overlap_length.js +16 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/block_local_origin.js +18 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/box_fits_inside_container.js +39 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_allocated_item_at_placement.js +18 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_placement_on_generic_supporter.js +64 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/build_slot_grid_from_cluster.js +66 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/compare_group_ids.js +20 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/container_with_pending_wall_items.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/empty_space_is_on_floor.js +16 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/finalize_loose_item_placement.js +58 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_best_generic_supporter_placement.js +58 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_next_free_slot_index.js +119 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_supporter_directly_below.js +51 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/find_tie_ratio_supporter_cluster.js +57 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/footprint_xz_overlap_area.js +26 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/item_fits_supporter_slot.js +22 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_footprint_region_from_options.js +24 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_fits_inside_container.js +21 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_item_has_geometric_support.js +21 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/loose_on_block_slot_state.js +88 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/placement_coords_fit_inside_container.js +34 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/read_empilhar_area_igual_from_allocation_item.js +12 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/realigned_loose_geometry_gates.js +25 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_on_generic_supporter.js +65 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_loose_placement_position.js +68 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_placement_y_at_slot.js +45 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/resolve_without_tie_ratio_cluster.js +79 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/select_tie_ratio_slot_placement.js +84 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/slot_footprint_collision.js +105 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_cluster_selection.js +119 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_footprint_overlap.js +56 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_placement_plane.js +109 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/tie_ratio_supporter_predicate.js +23 -0
- package/src/Allocation_Optimization/tie_ratio/loose_on_block/try_tie_ratio_slot_placement.js +62 -0
- package/src/Allocation_Optimization/tie_ratio/snap_stacked_items_to_floor_footprints.js +138 -0
- package/src/Allocation_Optimization/tie_ratio/supporters_by_top_y_index.js +78 -0
- package/src/Allocation_Optimization/tie_ratio/tie_ratio_orientation_below_empty_space.js +89 -0
- package/src/Allocation_Optimization/tie_ratio/tie_ratio_orientation_from_group.js +48 -0
- package/src/Block_Management.js +34 -0
- package/src/Blocks_Preparation/Cube_Map_Function.js +27 -0
- package/src/Blocks_Wall_Allocation.js +3 -0
- package/src/IO/Answer_Status.js +4 -0
- package/src/IO/Output_Builder.js +35 -0
- package/src/IO/count_allocated_items.js +31 -0
- package/src/IO/create_error_response.js +62 -0
- package/src/IO/format_allocation_error_message.js +25 -0
- package/src/Item_Continuation_Lock.js +129 -0
- package/src/Item_Picking_Continuity.js +41 -0
- package/src/allocation_flow/chooser_session_state.js +21 -0
- package/src/allocation_flow/compound_probe_fallback.js +17 -0
- package/src/allocation_flow/container_remaining_capacity.js +23 -0
- package/src/allocation_flow/density_group_item_filter.js +31 -0
- package/src/allocation_flow/effective_item_fingerprint.js +14 -0
- package/src/allocation_flow/item_continuation_lock_gate.js +38 -0
- package/src/allocation_flow/no_space_left_recovery.js +48 -0
- package/src/allocation_flow/run_allocation_iteration.js +155 -0
- package/src/allocation_flow/space_skip_state.js +91 -0
- package/src/allocation_flow/try_no_space_left_recovery.js +50 -0
- package/src/exceptions/Invalid_Parameter_Exception.js +17 -0
- package/src/exceptions/Relational_Allocation_Incomplete_Exception.js +24 -0
- package/src/exceptions/Relational_Colocation_Violation_Exception.js +23 -0
- package/src/exceptions/Relational_Config_Mismatch_Exception.js +17 -0
- package/src/exceptions/There_Is_No_Block_Options_To_Allocate_Exception.js +14 -0
- package/src/index.js +6 -0
- package/src/input_preparation/Block_Formatter.js +179 -0
- package/src/input_preparation/Input_Creator.js +76 -0
- package/src/input_preparation/Input_State_Preparation.js +47 -0
- package/src/input_preparation/State_Builder.js +27 -0
- package/src/input_preparation/block_formatter/align_flush_axis_config.js +36 -0
- package/src/input_preparation/block_formatter/align_flush_axis_single_round.js +112 -0
- package/src/input_preparation/block_formatter/align_flush_stacked_slots.js +67 -0
- package/src/input_preparation/block_formatter/overlapped_slots.js +24 -0
- package/src/input_preparation/block_formatter/parallelepiped_shell.js +38 -0
- package/src/input_preparation/block_formatter/rectangle_coverage.js +112 -0
- package/src/input_preparation/block_formatter/shell_face_coverage.js +64 -0
- package/src/input_preparation/block_formatter/shell_snap_convergence.js +104 -0
- package/src/input_preparation/block_preparation/Block_Data_To_Object_Transformer.js +57 -0
- package/src/input_preparation/block_preparation/Block_Module_Name.js +17 -0
- package/src/input_preparation/block_preparation/Blocks_Creator.js +101 -0
- package/src/input_preparation/block_preparation/Blocksmith.js +19 -0
- package/src/input_preparation/block_preparation/block_modules/create_block_candidates.js +41 -0
- package/src/input_preparation/block_preparation/block_modules/manual_blocks.js +10 -0
- package/src/input_preparation/block_preparation/block_modules/module_registry.js +20 -0
- package/src/input_preparation/block_preparation/block_modules/run_creator.js +34 -0
- package/src/input_preparation/block_preparation/block_modules/single_item_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/spiral_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/tie_ratio_blocks.js +12 -0
- package/src/input_preparation/block_preparation/block_modules/tower_blocks.js +12 -0
- package/src/input_preparation/block_preparation/exceptions/Failed_To_Create_Block_Exception.js +14 -0
- package/src/input_preparation/block_preparation/exceptions/Failed_To_Retrieve_Block_Exception.js +17 -0
- package/src/input_preparation/block_preparation/exceptions/Missing_Object_Store_Exception.js +10 -0
- package/src/input_preparation/block_preparation/exceptions/No_Blocks_Were_Created_Exception.js +14 -0
- package/src/input_preparation/block_preparation/input/Input_Creator.js +96 -0
- package/src/input_preparation/block_preparation/manual_blocks/Manual_Blocks.js +95 -0
- package/src/input_preparation/build_empty_space_finder_options.js +43 -0
- package/src/input_preparation/item_preparation/Items_Reader.js +27 -0
- package/src/input_preparation/min_extents_from_items.js +29 -0
- package/src/input_preparation/stackability_index/Blocks_Stackability_Index_Calculator.js +58 -0
- package/src/input_preparation/stackability_index/Slots_Stackability_index_Calculator.js +28 -0
- package/src/input_preparation/stackability_index/Stackability_Input_Creator.js +27 -0
- package/src/input_preparation/stackability_index/stackability_index_pop_stack.js +81 -0
- package/src/input_preparation/stacking_constraints/Weight_Stacking_Validation.js +15 -0
- package/src/lp_optimizer_result_status.js +20 -0
- package/src/messages/Allocator_Message.js +42 -0
- package/src/messages/resolve_error_message_entry.js +57 -0
- package/src/models/Allocated_Item.js +136 -0
- package/src/models/Allocation_Item.js +219 -0
- package/src/models/Block.js +198 -0
- package/src/models/Cargo_Profile.js +418 -0
- package/src/models/Preloaded_Allocated_Item.js +132 -0
- package/src/models/Slot.js +67 -0
- package/src/models/Stacking_Rules.js +58 -0
- package/src/models/auxiliaryFunctions/Available_Block_Module_List_Creator.js +9 -0
- package/src/models/auxiliaryFunctions/Measure_Translator.js +24 -0
- package/src/models/auxiliaryFunctions/item_json_reader.js +44 -0
- package/src/models/item_json_reader.js +71 -0
- package/src/models/placed_item_record.js +70 -0
- package/src/models/preloaded_rotation_helpers.js +38 -0
- package/src/models/slots_have_same_measure.js +45 -0
- package/src/models/transport/Container.js +162 -0
- package/src/models/transport/Transport.js +62 -0
- package/src/models/transport/build_stacking_feasibility_checker.js +64 -0
- package/src/models/transport/container_stacking_checkpoint.js +42 -0
- package/src/models/transport/factory/Container_Factory.js +46 -0
- package/src/models/transport/factory/Corner_Casting_Factory.js +62 -0
- package/src/models/transport/factory/Previously_Allocated_Item_Factory.js +28 -0
- package/src/models/transport/factory/Transport_Factory.js +13 -0
- package/src/models/transport/items_for_empty_space_finder.js +91 -0
- package/src/models/transport/resolve_container_stacking_inputs.js +23 -0
- package/src/models/transport/stacking_input_from_wire.js +58 -0
- package/src/optimizer_connection_errors.js +50 -0
- package/src/relational/Relational_Error_Codes.js +7 -0
- package/src/relational/finalize_relational_allocation.js +20 -0
- package/src/relational/has_relational_items.js +11 -0
- package/src/relational/is_relational_error_code.js +15 -0
- package/src/relational/resolve_relational_container_sequences.js +29 -0
- package/src/run_core_allocation.js +118 -0
- package/src/space_and_block_chooser/Space_And_Blocks_Chooser.js +115 -0
- package/src/space_and_block_chooser/blocks_filters/Block_Filter_Interface.js +19 -0
- package/src/space_and_block_chooser/blocks_filters/Filter_Runner.js +46 -0
- package/src/space_and_block_chooser/blocks_filters/initial_blocks_filter/Block_With_Overlapped_Slots_Filter.js +14 -0
- package/src/space_and_block_chooser/blocks_filters/initial_blocks_filter/Initial_Blocks_Filter_List.js +19 -0
- package/src/space_and_block_chooser/blocks_filters/pos_selection_filters/Blocks_Bigger_Than_Space_Filter.js +17 -0
- package/src/space_and_block_chooser/blocks_filters/pos_selection_filters/Post_Selection_Filter_List.js +9 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/Insuficient_Items_Filter.js +81 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/Pre_Selection_Filter_List.js +8 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/max_tower_height/Blocks_Lower_Than_Max_Tower_Height.js +23 -0
- package/src/space_and_block_chooser/blocks_filters/pre_selection_filter/max_tower_height/Max_Tower_Height.js +82 -0
- package/src/space_and_block_chooser/build_allocated_item_snapshots.js +19 -0
- package/src/space_and_block_chooser/compound_first_empty_space_branch.js +61 -0
- package/src/space_and_block_chooser/compound_first_with_leftover_fill.js +142 -0
- package/src/space_and_block_chooser/compound_first_without_leftover_fill.js +56 -0
- package/src/space_and_block_chooser/empty_spaces_where_post_selection_keeps_blocks.js +83 -0
- package/src/space_and_block_chooser/exceptions/Invalid_Space_To_Allocate_Exception.js +14 -0
- package/src/space_and_block_chooser/leftover_space_memory.js +113 -0
- package/src/space_and_block_chooser/leftover_unitary_blocks.js +153 -0
- package/src/space_and_block_chooser/leftover_unitary_empty_spaces.js +135 -0
- package/src/space_and_block_chooser/probe_set_pool.js +35 -0
- package/src/space_and_block_chooser/run_space_and_block_selection_attempt.js +88 -0
- package/src/tools/Array_Validator.js +6 -0
- package/src/tools/Clone.js +27 -0
- package/src/tools/Hash.js +8 -0
- package/src/tools/Rounder.js +5 -0
- package/src/tools/String_To_Boolean.js +12 -0
- package/src/tools/cargo_profile/Cargo_Profile_Field_Value_Resolver.js +44 -0
- package/src/tools/compact_items_with_stock.js +9 -0
- package/src/tools/mm_to_allocation_domain.js +14 -0
- package/src/tracing/Allocation_Tracer.js +52 -0
- package/src/tracing/Trace_Context.js +18 -0
- package/src/tracing/trace_outcome.js +18 -0
- package/src/tracing/traced_step.js +57 -0
- package/src/validation/Item_Continuation_Lock_Flag.js +52 -0
- package/src/validation/Item_Validation.js +29 -0
- package/src/validation/Relational_Colocation_Validator.js +60 -0
- package/src/validation/Relational_Completeness_Validator.js +146 -0
- package/src/validation/Relational_Continuation_Lock_Validation.js +37 -0
- package/src/validation/Relational_Proportional_Normalizer.js +194 -0
- package/src/validation/Validation.js +9 -0
- package/src/validation/Validation_Runner.js +20 -0
- package/src/validation/exceptions/Invalid_Block_Module_Config_Exception.js +14 -0
- package/src/validation/exceptions/Invalid_Input_Exception.js +14 -0
- package/src/validation/exceptions/Invalid_Input_Type_Exception.js +14 -0
- package/src/validation/schemas/allocated_item_schema.js +18 -0
- package/src/validation/schemas/allocation_request_schema.js +178 -0
- package/src/validation/schemas/container_row_schema.js +16 -0
- package/src/validation/schemas/item_schema.js +60 -0
- package/src/validation/schemas/transport_env_schema.js +19 -0
- package/src/validation/validate_block_module_config.js +147 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const {allocation_item_map_function} = require('../../Blocks_Preparation/Cube_Map_Function')
|
|
2
|
+
const calculate_slots_stackability_index = require('./Slots_Stackability_index_Calculator')
|
|
3
|
+
const {
|
|
4
|
+
create_stackability_pop_stack,
|
|
5
|
+
add_stackability_index_amount,
|
|
6
|
+
finalize_stackability_pop_stack
|
|
7
|
+
} = require('./stackability_index_pop_stack')
|
|
8
|
+
|
|
9
|
+
module.exports = function(block_list, item_list)
|
|
10
|
+
{
|
|
11
|
+
const item_stackability_index_map = map_item_by_stackability_index(item_list)
|
|
12
|
+
|
|
13
|
+
for (const block of block_list)
|
|
14
|
+
{
|
|
15
|
+
calculate_slots_stackability_index(block, item_stackability_index_map)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {object[]} item_list
|
|
21
|
+
* @returns {Record<string, { segments: Array<{ value: number, remaining: number }>, segment_index: number }>}
|
|
22
|
+
*/
|
|
23
|
+
function map_item_by_stackability_index(item_list)
|
|
24
|
+
{
|
|
25
|
+
const mapped_items = {}
|
|
26
|
+
for (const item of item_list)
|
|
27
|
+
{
|
|
28
|
+
for (const rotated_item of item.get_all_rotated_options())
|
|
29
|
+
{
|
|
30
|
+
const hash = allocation_item_map_function(rotated_item)
|
|
31
|
+
if (!mapped_items[hash])
|
|
32
|
+
{
|
|
33
|
+
mapped_items[hash] = create_stackability_pop_stack()
|
|
34
|
+
}
|
|
35
|
+
add_stackability_index_amount(
|
|
36
|
+
mapped_items[hash],
|
|
37
|
+
item.get_stackability_index(),
|
|
38
|
+
item.get_amount()
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return finalize_mapped_pop_stacks(mapped_items)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {Record<string, { counts: Map<number, number> }>} mapped_items
|
|
48
|
+
* @returns {Record<string, { segments: Array<{ value: number, remaining: number }>, segment_index: number }>}
|
|
49
|
+
*/
|
|
50
|
+
function finalize_mapped_pop_stacks(mapped_items)
|
|
51
|
+
{
|
|
52
|
+
const finalized = {}
|
|
53
|
+
for (const key of Object.keys(mapped_items))
|
|
54
|
+
{
|
|
55
|
+
finalized[key] = finalize_stackability_pop_stack(mapped_items[key])
|
|
56
|
+
}
|
|
57
|
+
return finalized
|
|
58
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const {cube_map_function} = require('../../Blocks_Preparation/Cube_Map_Function')
|
|
2
|
+
const {
|
|
3
|
+
clone_stackability_pop_stack,
|
|
4
|
+
pop_stackability_index
|
|
5
|
+
} = require('./stackability_index_pop_stack')
|
|
6
|
+
|
|
7
|
+
module.exports = function(block, item_stackability_index_map)
|
|
8
|
+
{
|
|
9
|
+
const slot_hash_set = new Set(block.get_slot_list().map(slot => cube_map_function(slot)))
|
|
10
|
+
const possible_slots_stackability_index = {}
|
|
11
|
+
for (const slot_hash of slot_hash_set)
|
|
12
|
+
{
|
|
13
|
+
if (item_stackability_index_map[slot_hash])
|
|
14
|
+
{
|
|
15
|
+
possible_slots_stackability_index[slot_hash]
|
|
16
|
+
= clone_stackability_pop_stack(item_stackability_index_map[slot_hash])
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const slot of block.get_slot_list())
|
|
21
|
+
{
|
|
22
|
+
const slot_hash = cube_map_function(slot)
|
|
23
|
+
const slot_stackability_index = pop_stackability_index(possible_slots_stackability_index[slot_hash])
|
|
24
|
+
slot.set_stackability_index(slot_stackability_index)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
block.calculate_stackability_index()
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module.exports = function(item_list)
|
|
2
|
+
{
|
|
3
|
+
return item_list.map(item => create_input_item(item))
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function create_input_item(item)
|
|
7
|
+
{
|
|
8
|
+
return {
|
|
9
|
+
id: item._id,
|
|
10
|
+
amount: item.qtd,
|
|
11
|
+
width: item.largura,
|
|
12
|
+
height: item.altura,
|
|
13
|
+
length: item.comprimento,
|
|
14
|
+
weight: item.peso,
|
|
15
|
+
supported_weight: item.pesoMaxSuportado,
|
|
16
|
+
maximum_stacking: item.empilhamentoMaximo,
|
|
17
|
+
rotation_list: Object.keys(item.rotacao).filter(rotation => item.rotacao[rotation]),
|
|
18
|
+
stacking_unit: item.stackingUnit.toLowerCase(),
|
|
19
|
+
stacking_rules: {
|
|
20
|
+
family: item.stacking.family,
|
|
21
|
+
supported_families: item.stacking.supported_families,
|
|
22
|
+
only_stack_same_family: item.restricoes.empilharFamilias,
|
|
23
|
+
only_stack_same_area: item.restricoes.empilharAreaIgual,
|
|
24
|
+
only_stack_same_item: item.restricoes.empilharItemIgual
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns {{ counts: Map<number, number> }}
|
|
3
|
+
*/
|
|
4
|
+
function create_stackability_pop_stack()
|
|
5
|
+
{
|
|
6
|
+
return { counts: new Map() }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {{ counts: Map<number, number> }} stack
|
|
11
|
+
* @param {number} index_value
|
|
12
|
+
* @param {number} amount
|
|
13
|
+
*/
|
|
14
|
+
function add_stackability_index_amount(stack, index_value, amount)
|
|
15
|
+
{
|
|
16
|
+
const previous = stack.counts.get(index_value) || 0
|
|
17
|
+
stack.counts.set(index_value, previous + amount)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {{ counts: Map<number, number> }} stack
|
|
22
|
+
* @returns {{ segments: Array<{ value: number, remaining: number }>, segment_index: number }}
|
|
23
|
+
*/
|
|
24
|
+
function finalize_stackability_pop_stack(stack)
|
|
25
|
+
{
|
|
26
|
+
const sorted_values = [...stack.counts.keys()].sort((left, right) => left - right)
|
|
27
|
+
const segments = sorted_values.map(value => ({
|
|
28
|
+
value,
|
|
29
|
+
remaining: stack.counts.get(value)
|
|
30
|
+
}))
|
|
31
|
+
return {
|
|
32
|
+
segments,
|
|
33
|
+
segment_index: segments.length - 1
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {{ segments: Array<{ value: number, remaining: number }>, segment_index: number }} stack
|
|
39
|
+
* @returns {{ segments: Array<{ value: number, remaining: number }>, segment_index: number }}
|
|
40
|
+
*/
|
|
41
|
+
function clone_stackability_pop_stack(stack)
|
|
42
|
+
{
|
|
43
|
+
const segments = stack.segments.map(segment => ({
|
|
44
|
+
value: segment.value,
|
|
45
|
+
remaining: segment.remaining
|
|
46
|
+
}))
|
|
47
|
+
let segment_index = stack.segment_index
|
|
48
|
+
while (segment_index >= 0 && segments[segment_index].remaining === 0)
|
|
49
|
+
{
|
|
50
|
+
segment_index--
|
|
51
|
+
}
|
|
52
|
+
return { segments, segment_index }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Pops the highest remaining stackability index (same order as pop on sorted expanded array).
|
|
57
|
+
* @param {{ segments: Array<{ value: number, remaining: number }>, segment_index: number }} stack
|
|
58
|
+
* @returns {number|undefined}
|
|
59
|
+
*/
|
|
60
|
+
function pop_stackability_index(stack)
|
|
61
|
+
{
|
|
62
|
+
while (stack.segment_index >= 0)
|
|
63
|
+
{
|
|
64
|
+
const segment = stack.segments[stack.segment_index]
|
|
65
|
+
if (segment.remaining > 0)
|
|
66
|
+
{
|
|
67
|
+
segment.remaining--
|
|
68
|
+
return segment.value
|
|
69
|
+
}
|
|
70
|
+
stack.segment_index--
|
|
71
|
+
}
|
|
72
|
+
return undefined
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = {
|
|
76
|
+
create_stackability_pop_stack,
|
|
77
|
+
add_stackability_index_amount,
|
|
78
|
+
finalize_stackability_pop_stack,
|
|
79
|
+
clone_stackability_pop_stack,
|
|
80
|
+
pop_stackability_index
|
|
81
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const {le} = require('@jetta/number-compare')
|
|
2
|
+
const GAP = 1.5
|
|
3
|
+
|
|
4
|
+
const sort_height_desc = (a, b) => b.altura - a.altura
|
|
5
|
+
const sort_weight_desc = (a, b) => b.peso - a.peso
|
|
6
|
+
|
|
7
|
+
const get_tallest_container_height = (container_list) => container_list.sort(sort_height_desc)[0].altura
|
|
8
|
+
|
|
9
|
+
module.exports = function enable_weight_stacking_validation(transport, item_list)
|
|
10
|
+
{
|
|
11
|
+
const tallest_container_height = get_tallest_container_height(transport.containers)
|
|
12
|
+
const heaviest_item = item_list.sort(sort_weight_desc)[0]
|
|
13
|
+
const stacked_items = Math.floor(tallest_container_height / heaviest_item.altura)
|
|
14
|
+
return le(heaviest_item.pesoMaxSuportado, (stacked_items * heaviest_item.peso * GAP))
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when the remote optimizer status should be mapped as a successful LP for allocation.
|
|
3
|
+
* @param {string|number} status - Return value of `OptimizationResult.status()` from `@jetta/lp-framework`.
|
|
4
|
+
* @returns {boolean}
|
|
5
|
+
*/
|
|
6
|
+
function is_lp_optimizer_result_success(status)
|
|
7
|
+
{
|
|
8
|
+
if (status === 1)
|
|
9
|
+
{
|
|
10
|
+
return true
|
|
11
|
+
}
|
|
12
|
+
if (typeof status !== 'string')
|
|
13
|
+
{
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
16
|
+
const normalized = status.toLowerCase()
|
|
17
|
+
return normalized !== 'infeasible' && normalized !== 'not initialized'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = { is_lp_optimizer_result_success }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable dotted keys for blocks-wall-allocation messages in jettacargo_messages.
|
|
3
|
+
* Portal-api resolves these against locales; do not use English as lookup keys.
|
|
4
|
+
*/
|
|
5
|
+
const ALLOCATOR_MESSAGE = Object.freeze({
|
|
6
|
+
INVALID_INPUT: 'allocator.061001',
|
|
7
|
+
INVALID_INPUT_TYPE: 'allocator.061002',
|
|
8
|
+
INVALID_BLOCK_MODULE_CONFIG: 'allocator.061003',
|
|
9
|
+
RELATION_CONFIG_MISMATCH: 'allocator.061004',
|
|
10
|
+
INTERNAL_ERROR: 'allocator.064001',
|
|
11
|
+
RELATION_COLOCATION_VIOLATION: 'allocator.064002',
|
|
12
|
+
RELATION_ALLOCATION_INCOMPLETE: 'allocator.064003',
|
|
13
|
+
NO_BLOCKS_WERE_CREATED: 'allocator.064004',
|
|
14
|
+
FAILED_TO_RETRIEVE_BLOCK: 'allocator.064005',
|
|
15
|
+
FAILED_TO_CREATE_BLOCKS: 'allocator.064006',
|
|
16
|
+
NO_BLOCK_OPTIONS: 'allocator.064007',
|
|
17
|
+
INVALID_SPACE: 'allocator.064008',
|
|
18
|
+
NO_SPACE_LEFT: 'allocator.064009',
|
|
19
|
+
OPTIMIZATION_INFEASIBLE: 'allocator.064010',
|
|
20
|
+
NO_VALID_ALLOCATION: 'allocator.064011',
|
|
21
|
+
INVALID_STACKING: 'allocator.064012',
|
|
22
|
+
NO_SUITABLE_ITEM: 'allocator.064013',
|
|
23
|
+
TIE_RATIO_ORIENTATION_MISMATCH: 'allocator.064014',
|
|
24
|
+
LOOSE_ON_TIE_RATIO_FAILED: 'allocator.064015',
|
|
25
|
+
NO_FLOOR_FOOTPRINT_TWIN: 'allocator.064016',
|
|
26
|
+
NO_AVAILABLE_ITEMS: 'allocator.064017',
|
|
27
|
+
EMPTY_SLOT: 'allocator.064018',
|
|
28
|
+
ITEM_TALLER_THAN_LIMIT: 'allocator.064019',
|
|
29
|
+
NO_SLOTS_FOR_ITEMS: 'allocator.064020',
|
|
30
|
+
RESTRICTED_BLOCK: 'allocator.064021',
|
|
31
|
+
EMPTY_BLOCK_ITEM_LIST: 'allocator.064022',
|
|
32
|
+
MISSING_ITEM_STOCK: 'allocator.064023',
|
|
33
|
+
INVALID_ITEM_AMOUNT: 'allocator.064024',
|
|
34
|
+
INVALID_PARAMETER: 'allocator.064025',
|
|
35
|
+
INSUFFICIENT_SHAPE_STOCK: 'allocator.064026',
|
|
36
|
+
LP_PLAN_ITEM_UNAVAILABLE: 'allocator.064027',
|
|
37
|
+
LP_PLAN_ITEM_STACKING_FAILED: 'allocator.064028'
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
ALLOCATOR_MESSAGE
|
|
42
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const { ALLOCATOR_MESSAGE } = require('./Allocator_Message')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Builds a catalog wire tuple [dotted.key, ...params].
|
|
5
|
+
* @param {string} message_key
|
|
6
|
+
* @param {string[]} [params=[]]
|
|
7
|
+
* @returns {string[]}
|
|
8
|
+
*/
|
|
9
|
+
function build_message_entry(message_key, params = [])
|
|
10
|
+
{
|
|
11
|
+
return [message_key, ...params]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {unknown} error_value
|
|
16
|
+
* @returns {boolean}
|
|
17
|
+
*/
|
|
18
|
+
function has_message_entry(error_value)
|
|
19
|
+
{
|
|
20
|
+
return error_value !== null
|
|
21
|
+
&& typeof error_value === 'object'
|
|
22
|
+
&& Array.isArray(error_value.message_entry)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Resolves thrown values into catalog message tuples for the error envelope.
|
|
27
|
+
* @param {unknown} error_value
|
|
28
|
+
* @returns {string[][]}
|
|
29
|
+
*/
|
|
30
|
+
function resolve_error_message_entry(error_value)
|
|
31
|
+
{
|
|
32
|
+
if (has_message_entry(error_value))
|
|
33
|
+
{
|
|
34
|
+
return [error_value.message_entry]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (is_no_space_left_exception(error_value))
|
|
38
|
+
{
|
|
39
|
+
return [[ALLOCATOR_MESSAGE.NO_SPACE_LEFT]]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return [[ALLOCATOR_MESSAGE.INTERNAL_ERROR]]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {unknown} error_value
|
|
47
|
+
* @returns {boolean}
|
|
48
|
+
*/
|
|
49
|
+
function is_no_space_left_exception(error_value)
|
|
50
|
+
{
|
|
51
|
+
return error_value !== null
|
|
52
|
+
&& typeof error_value === 'object'
|
|
53
|
+
&& error_value.name === 'NoSpaceLeftException'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = resolve_error_message_entry
|
|
57
|
+
module.exports.build_message_entry = build_message_entry
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const { PositionedCube} = require('@jetta/empty-spaces-manager')
|
|
2
|
+
const { read_stacking_rules } = require('./Stacking_Rules')
|
|
3
|
+
class Allocated_Item extends PositionedCube
|
|
4
|
+
{
|
|
5
|
+
#item
|
|
6
|
+
#group_id
|
|
7
|
+
#tie_ratio_orientation
|
|
8
|
+
constructor(item, x, y, z)
|
|
9
|
+
{
|
|
10
|
+
super({
|
|
11
|
+
x,
|
|
12
|
+
y,
|
|
13
|
+
z,
|
|
14
|
+
width: item.get_width(),
|
|
15
|
+
height: item.get_height(),
|
|
16
|
+
length: item.get_length()
|
|
17
|
+
})
|
|
18
|
+
this.#item = item
|
|
19
|
+
this.#group_id = item.get_group_id()
|
|
20
|
+
this.#tie_ratio_orientation = item.get_tie_ratio_orientation?.()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get_weight()
|
|
24
|
+
{
|
|
25
|
+
return this.#item.get_weight()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get_allocation_item()
|
|
29
|
+
{
|
|
30
|
+
return this.#item.copy()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Returns the wrapped allocation item without copying (for stacking validation reads).
|
|
35
|
+
* @returns {object}
|
|
36
|
+
*/
|
|
37
|
+
get_stacking_source_item()
|
|
38
|
+
{
|
|
39
|
+
return this.#item
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
set_group_id(group_id)
|
|
43
|
+
{
|
|
44
|
+
this.#group_id = group_id
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @returns {'3_2'|'2_3'|undefined} Tie-ratio variant orientation for compound blocks.
|
|
49
|
+
*/
|
|
50
|
+
get_tie_ratio_orientation()
|
|
51
|
+
{
|
|
52
|
+
return this.#tie_ratio_orientation
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set_tie_ratio_orientation(tie_ratio_orientation)
|
|
56
|
+
{
|
|
57
|
+
this.#tie_ratio_orientation = tie_ratio_orientation
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @returns {string|number|undefined} Block group identifier shared by slots in the same compound block.
|
|
62
|
+
*/
|
|
63
|
+
get_group_id()
|
|
64
|
+
{
|
|
65
|
+
return this.#group_id
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
to_json()
|
|
69
|
+
{
|
|
70
|
+
const contract = {
|
|
71
|
+
'type': this.#item.get_json()['tipo'],
|
|
72
|
+
'y': this.get_z(),//disgraça de inversão
|
|
73
|
+
'x': this.get_x(),
|
|
74
|
+
'z': this.get_y(),//disgraça de inversão
|
|
75
|
+
'tipo': this.#item.get_json()['tipo'],
|
|
76
|
+
'rotation': this.#item.get_current_rotation_id(),
|
|
77
|
+
'_id': this.#item.get_json()['_id'],
|
|
78
|
+
'rotaSequencia': this.#item.get_json()['rotaSequencia'] ?? 0,
|
|
79
|
+
'h': this.get_height(),
|
|
80
|
+
'w': this.get_width(),
|
|
81
|
+
'd': this.get_length(),
|
|
82
|
+
'wg': this.#item.get_json()['peso'] ?? this.#item.get_json()['wg'],
|
|
83
|
+
'supported_weight': this.#item.get_json()['pesoMaxSuportado'] ?? this.#item.get_json()['supported_weight'],
|
|
84
|
+
'constraint': read_stacking_rules(this.#item.get_json()),
|
|
85
|
+
'current_rotation': this.#item.get_current_rotation(),
|
|
86
|
+
'stacking': this.#item.get_json()['stacking'],
|
|
87
|
+
'stacking_limit': this.#item.get_json()['empilhamentoMaximo'] ?? this.#item.get_json()['stacking_limit'],
|
|
88
|
+
'waypoint_id': this.#item.get_json()['cliente'] ?? this.#item.get_json()['waypoint_id'] ?? '',
|
|
89
|
+
'priority': this.#item.get_json()['priority'] ?? this.#item.get_json()['prioridade'] ?? 0,
|
|
90
|
+
'restrictions':this.#item.get_json()['restricoes'] ?? this.#item.get_json()['restrictions'],
|
|
91
|
+
'is_previously_allocated':this.#item.get_json()['is_previously_allocated'],
|
|
92
|
+
'embalagem':this.#item.get_json()['embalagem'],
|
|
93
|
+
'id':this.#item.get_json()['id'],
|
|
94
|
+
'stackingUnit':this.#item.get_json()['stackingUnit']
|
|
95
|
+
}
|
|
96
|
+
if (this.#group_id !== undefined)
|
|
97
|
+
{
|
|
98
|
+
contract.groupId = this.#group_id
|
|
99
|
+
}
|
|
100
|
+
if (this.#tie_ratio_orientation !== undefined)
|
|
101
|
+
{
|
|
102
|
+
contract.tie_ratio_orientation = this.#tie_ratio_orientation
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return contract
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
is_block_with_slots_of_same_measure()
|
|
109
|
+
{
|
|
110
|
+
return this.#item.get_json()['is_slots_of_same_measure'] || false
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
get_id()
|
|
114
|
+
{
|
|
115
|
+
return this.#item.get_id()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
to_simplified_json()
|
|
119
|
+
{
|
|
120
|
+
const contract = {
|
|
121
|
+
'type': this.#item.get_json()['tipo'],
|
|
122
|
+
'y': this.get_y(),//disgraça de inversão
|
|
123
|
+
'x': this.get_x(),
|
|
124
|
+
'z': this.get_z(),//disgraça de inversão
|
|
125
|
+
'_id': this.#item.get_json()['_id'],
|
|
126
|
+
'h': this.get_height(),
|
|
127
|
+
'w': this.get_width(),
|
|
128
|
+
'd': this.get_length(),
|
|
129
|
+
'waypoint_id': this.#item.get_json()['cliente'] || '',
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return contract
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
module.exports = Allocated_Item
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
const { Item, Rotations } = require('@jetta/empty-spaces-manager')
|
|
2
|
+
const item_json_reader = require('./item_json_reader')
|
|
3
|
+
const Allocated_Item = require('./Allocated_Item')
|
|
4
|
+
const round = require('../tools/Rounder')
|
|
5
|
+
const { allocation_item_map_function } = require('../Blocks_Preparation/Cube_Map_Function')
|
|
6
|
+
const SUPPORTED_WEIGTH_STACKING_STR = 'supportedWeight'
|
|
7
|
+
const is_object = (value) => value !== null && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype
|
|
8
|
+
|
|
9
|
+
class Allocation_Item extends Item
|
|
10
|
+
{
|
|
11
|
+
#json
|
|
12
|
+
#weight
|
|
13
|
+
#amount
|
|
14
|
+
#id
|
|
15
|
+
#x
|
|
16
|
+
#y
|
|
17
|
+
#z
|
|
18
|
+
#group_id
|
|
19
|
+
#relational_group_id
|
|
20
|
+
#relational_links
|
|
21
|
+
#tie_ratio_orientation
|
|
22
|
+
#stackability_index
|
|
23
|
+
#stacking_info
|
|
24
|
+
#all_rotated_options_cache = null
|
|
25
|
+
|
|
26
|
+
constructor(data, rotation = Rotations.POS1)
|
|
27
|
+
{
|
|
28
|
+
super(item_json_reader(data, rotation))
|
|
29
|
+
this.#json = data
|
|
30
|
+
this.#weight = data.peso ?? data.weight ?? data.wg
|
|
31
|
+
this.#id = data._id
|
|
32
|
+
this.#amount = data.qtd ?? 0
|
|
33
|
+
const sp = this.#get_starting_point_data(data)
|
|
34
|
+
this.#x = sp.x
|
|
35
|
+
this.#y = sp.y
|
|
36
|
+
this.#z = sp.z
|
|
37
|
+
this.#group_id = data.groupId
|
|
38
|
+
this.#relational_group_id = data.relational_group_id
|
|
39
|
+
this.#relational_links = data.relational_links
|
|
40
|
+
this.#tie_ratio_orientation = data.tie_ratio_orientation
|
|
41
|
+
this.#stackability_index = data.stackability_index
|
|
42
|
+
this.#stacking_info = this.#set_stacking_info(data)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#get_starting_point_data(data)
|
|
46
|
+
{
|
|
47
|
+
if (is_object(data))
|
|
48
|
+
{
|
|
49
|
+
return { x: data.x ?? 0, y: data.z ?? 0, z: data.y ?? 0 }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {x: data.get_x(), y: data.get_y(), z: data.get_z()}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#set_stacking_info(json)
|
|
56
|
+
{
|
|
57
|
+
return {
|
|
58
|
+
weight: json.peso ?? json.wg,
|
|
59
|
+
supported_weight : json.pesoMaxSuportado ?? json.supported_weight,
|
|
60
|
+
max_stacking: json.empilhamentoMaximo ?? json.stacking_limit,
|
|
61
|
+
restrictions : json.restricoes ?? json.restrictions,
|
|
62
|
+
stacking_family : json.stacking?.family,
|
|
63
|
+
stack_by_supported_weight : json.stackingUnit === SUPPORTED_WEIGTH_STACKING_STR,
|
|
64
|
+
supported_families: json.stacking?.supported_families,
|
|
65
|
+
priority: json.prioridade ?? json.priority
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get_stacking_info()
|
|
70
|
+
{
|
|
71
|
+
return this.#stacking_info
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
get_stackability_index()
|
|
76
|
+
{
|
|
77
|
+
return this.#stackability_index
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
set_group_id(group_id)
|
|
81
|
+
{
|
|
82
|
+
this.#group_id = group_id
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
get_group_id()
|
|
86
|
+
{
|
|
87
|
+
return this.#group_id
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get_relational_group_id()
|
|
91
|
+
{
|
|
92
|
+
return this.#relational_group_id
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get_relational_links()
|
|
96
|
+
{
|
|
97
|
+
return this.#relational_links
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
get_relational_link_quantity()
|
|
101
|
+
{
|
|
102
|
+
if (!this.#relational_links)
|
|
103
|
+
{
|
|
104
|
+
return 1
|
|
105
|
+
}
|
|
106
|
+
return this.#relational_links[this.get_user_id()] || 1
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
get_tie_ratio_orientation()
|
|
110
|
+
{
|
|
111
|
+
return this.#tie_ratio_orientation
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
set_tie_ratio_orientation(tie_ratio_orientation)
|
|
115
|
+
{
|
|
116
|
+
this.#tie_ratio_orientation = tie_ratio_orientation
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get_weight()
|
|
120
|
+
{
|
|
121
|
+
return this.#weight
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
get_id()
|
|
125
|
+
{
|
|
126
|
+
return this.#id
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
get_user_id()
|
|
130
|
+
{
|
|
131
|
+
return this.#json.id
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
update_amount(amount)
|
|
135
|
+
{
|
|
136
|
+
this.#amount = amount
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get_amount()
|
|
140
|
+
{
|
|
141
|
+
return this.#amount
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
copy_rotated(rotated_item)
|
|
145
|
+
{
|
|
146
|
+
const copy = this.copy()
|
|
147
|
+
copy.copy_dimensions(rotated_item)
|
|
148
|
+
return copy
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
copy()
|
|
152
|
+
{
|
|
153
|
+
const copy = new Allocation_Item(this.#json)
|
|
154
|
+
copy.update_amount(this.#amount)
|
|
155
|
+
return copy
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
get_x()
|
|
159
|
+
{
|
|
160
|
+
return this.#x
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
get_y()
|
|
164
|
+
{
|
|
165
|
+
return this.#y
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
get_z()
|
|
169
|
+
{
|
|
170
|
+
return this.#z
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
sum_position_vector(vector)
|
|
174
|
+
{
|
|
175
|
+
this.#x = round(vector.get_x() + this.#x)
|
|
176
|
+
this.#y = round(vector.get_y() + this.#y)
|
|
177
|
+
this.#z = round(vector.get_z() + this.#z)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
get_item_as_positioned_cube()
|
|
181
|
+
{
|
|
182
|
+
const item = new Allocated_Item(
|
|
183
|
+
this,
|
|
184
|
+
this.#x,
|
|
185
|
+
this.#y,
|
|
186
|
+
this.#z
|
|
187
|
+
)
|
|
188
|
+
item.set_group_id(this.#group_id)
|
|
189
|
+
if (this.#tie_ratio_orientation !== undefined)
|
|
190
|
+
{
|
|
191
|
+
item.set_tie_ratio_orientation(this.#tie_ratio_orientation)
|
|
192
|
+
}
|
|
193
|
+
return item
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
get_json()
|
|
197
|
+
{
|
|
198
|
+
return Object.assign({}, this.#json)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
get_hash()
|
|
202
|
+
{
|
|
203
|
+
return allocation_item_map_function(this)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @returns {Array<object>}
|
|
208
|
+
*/
|
|
209
|
+
get_all_rotated_options()
|
|
210
|
+
{
|
|
211
|
+
if (this.#all_rotated_options_cache === null)
|
|
212
|
+
{
|
|
213
|
+
this.#all_rotated_options_cache = super.get_all_rotated_options()
|
|
214
|
+
}
|
|
215
|
+
return this.#all_rotated_options_cache
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
module.exports = Allocation_Item
|