syncing master
This commit is contained in:
@@ -5,6 +5,8 @@ from helix.constants import ebom_parts
|
||||
from helix.constants.ebom_parts import *
|
||||
from helix.constants.parts import wire_clip_large, cable_support, cable_support_lid, channel_nut, sunshade
|
||||
from helix.constants.system_type import SystemType
|
||||
from helix.constants.inverter_brand import InverterBrand
|
||||
from helix.forms.ebom_form import InverterBrandForm
|
||||
|
||||
|
||||
class EbomCalculator(object):
|
||||
@@ -36,11 +38,25 @@ class EbomCalculator(object):
|
||||
monitors = self.values.power_monitors()
|
||||
module_type = self.values.module_type()
|
||||
system_type = self.values.system_type()
|
||||
|
||||
is_delta=None
|
||||
try:
|
||||
is_delta=(self.values.inverter_brands()[0]['inverter_brand_id']==InverterBrand.DELTA.value)
|
||||
except IndexError :
|
||||
#Some tests are calculating bom without providing inverter brand so inverter_brands is empty
|
||||
#for those tests, inverter brand is irrelevant
|
||||
is_delta=False
|
||||
|
||||
inverter_count = 0
|
||||
total_ac_run_length = 0
|
||||
panel_board_counts = [0, 0]
|
||||
proper_monitor_controller = self.resolve_power_monitor_type()
|
||||
|
||||
try:
|
||||
is_delta = (self.values.inverter_brands()[0]['inverter_brand_id']==InverterBrand.DELTA.value)
|
||||
except IndexError:
|
||||
is_delta = False
|
||||
|
||||
for power_station in power_stations:
|
||||
power_station_count = power_station['power_station_quantity']
|
||||
total_ac_run_length += power_station['ac_run_length']
|
||||
@@ -75,6 +91,8 @@ class EbomCalculator(object):
|
||||
for monitor in monitors:
|
||||
if monitor['power_source'][0] == 'Switch Gear/External':
|
||||
add_parts_to_list(part_list, {proper_monitor_controller: 1}, 1)
|
||||
if (is_delta):
|
||||
add_parts_to_list(part_list, {ethernet_plug: 2},1)
|
||||
|
||||
add_parts_to_list(part_list, {wire_clip_large: inverter_count}, self.row_count)
|
||||
|
||||
@@ -84,8 +102,9 @@ class EbomCalculator(object):
|
||||
add_parts_to_list(part_list, {rear_skirt: -1}, ceil(cable_supports*.38))
|
||||
|
||||
dependent_part_list = {}
|
||||
|
||||
for part, quantity in part_list.items():
|
||||
dependent_parts = ebom_parts.dependent_parts(module_type, system_type).get(part)
|
||||
dependent_parts = ebom_parts.dependent_parts(module_type, system_type,is_delta).get(part)
|
||||
if dependent_parts:
|
||||
add_parts_to_list(dependent_part_list, dependent_parts, quantity)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user