def unload(self, products, warehouse): if not self.is_waiting: counted_products = Counter(products) if not(self.warehouse == warehouse): self.move(warehouse) warehouse.addProducts(counted_products) OrderWriter.write([self.id, "U", warehouse.id, OrderWriter.products_to_string(counted_products)])
def deliver(self, order): if not self.is_waiting: self.products.subtract(order.products) # something for indicating the order is finished OrderWriter.write([ self.id, "D", order.id, OrderWriter.products_to_string(order.products) ])
def unload(self, products, warehouse): if not self.is_waiting: counted_products = Counter(products) if not (self.warehouse == warehouse): self.move(warehouse) warehouse.addProducts(counted_products) OrderWriter.write([ self.id, "U", warehouse.id, OrderWriter.products_to_string(counted_products) ])
def load(self, products, warehouse): if not self.is_waiting: counted_products = Counter(products) if not(self.warehouse == warehouse): self.move(warehouse) total_weight = 0 for product in counted_products: total_weight += product.weight if total_weight <= self.max_load - self.current_load: warehouse.removeProducts(counted_products) OrderWriter.write([self.id, "L", warehouse.id, OrderWriter.products_to_string(counted_products)])
def load(self, products, warehouse): if not self.is_waiting: counted_products = Counter(products) if not (self.warehouse == warehouse): self.move(warehouse) total_weight = 0 for product in counted_products: total_weight += product.weight if total_weight <= self.max_load - self.current_load: warehouse.removeProducts(counted_products) OrderWriter.write([ self.id, "L", warehouse.id, OrderWriter.products_to_string(counted_products) ])
def deliver(self, order): if not self.is_waiting: self.products.subtract(order.products) # something for indicating the order is finished OrderWriter.write([self.id, "D", order.id, OrderWriter.products_to_string(order.products)])