You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
983 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

class Workpiece:
def __init__(self):
self.being_processed = -1 # 当前正在处理的机器索引(-1表示尚未开始处理被哪台机器加工
self.left_time = 0 # 剩余处理时间 初始为0 为0时表示该工件在当前机器上的处理已完成。
def being_pro(self):
"""获取当前正在处理的机器索引"""
return self.being_processed
def left_time(self):
"""获取剩余处理时间"""
return self.left_time
def next_time(self):
"""减少剩余处理时间"""
if self.left_time > 0:
self.left_time -= 1
def next_machine(self, time):
"""转移到下一台机器并设置处理时间因为加工顺序必须是从0 1 2 3 4 这样一台台排下去的"""
self.being_processed += 1
self.left_time = time
def reset(self):
"""重置工件状态"""
self.being_processed = -1
self.left_time = 0