def readMPS (self): for row in range(self.mps_row_header+1, self.sheet.nrows): mps_object = Requirement() mps_code = self.sheet.cell_value(row, self.mps_col_code) mps_object.set_code(mps_code) mps_time = self.sheet.cell_value(row, self.mps_col_time) year, month, day, hour, minute, second = xlrd.xldate_as_tuple(mps_time, self.workbook.datemode) mps_date = datetime.date(year, month, day) mps_object.set_time(mps_date) mps_qty = self.sheet.cell_value(row, self.mps_col_qty) mps_object.set_qty(mps_qty) self.data.add_to_masterlist(CONST_MPS_MASTERLIST, mps_object)
def release_order(self, component, requirement): lead_time = component.lead_time release_time = requirement.time - lead_time qty = requirement.qty lot_size = component.lot_size moq = component.moq qty = self.update_actual_qty_lot_size(qty, lot_size) qty = self.update_actual_qty_moq(qty, moq) code = requirement.code order_release = Requirement() order_release.set_code(code) order_release.set_time(release_time) order_release.set_qty(qty) self.por_masterlist = self.update_requirement_list(order_release, self.por_masterlist) self.all_data.add_to_masterlist(CONST_PLANNED_ORDER_RELEASE_MASTERLIST, self.por_masterlist)
def generate_sub_requirement_list_by_parent(self, parent, requirement): sub_component_list = parent.sub_component_and_quantity_list required_time_sub_component = requirement.time - parent.lead_time sub_requirement_list_per_parent = [] if len(sub_component_list) == 0: self.release_order(parent, requirement) else: for code in sub_component_list: qty_per_parent = sub_component_list[code] required_qty_sub_component = self.calc_sub_requirement_qty(code, qty_per_parent, requirement.qty) new_requirement = Requirement() new_requirement.set_code(code) new_requirement.set_time(required_time_sub_component) new_requirement.set_qty(required_qty_sub_component) sub_requirement_list_per_parent.append(new_requirement) return sub_requirement_list_per_parent