Created
April 28, 2012 13:06
-
-
Save NicholasTD07/2518948 to your computer and use it in GitHub Desktop.
strangeProblemOfPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def groupStaff(self, Id, grpNum) : | |
self.log("\t\t{}号员工分组(第{}组)操作:"\ | |
.format(Id, grpNum)) | |
# 1. 初始化局部变量 | |
unGrpIDs = self.__unGrpIDs | |
groups = self.__groups | |
staff = self.__staffs[Id] | |
# 2. 检查员工是否处于 IDLE 状态 | |
if staff.wType != self.IDLE : | |
msg = "员工状态错误.\n需要在空闲态才能分组." | |
self.log(msg) | |
raise wrongType(msg) | |
# 3. 将员工序号从 未分组员工中弹出 | |
if Id in unGrpIDs : | |
unGrpIDs.remove(Id) | |
else : | |
msg = "分组失败: 员工不在未分组员工中." | |
self.log(msg) | |
raise notFoundInGroup(msg) | |
# 4. 将员工序号插入分组 | |
# 4.1 检测分组是否存在并且更新分组 | |
while len(groups) < (grpNum + 1) : | |
groups.append([]) | |
# 4.2 将员工放入分组, 并且使员工处于等待状态. | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # | |
groups[grpNum].append(Id) | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # | |
self.staffWait(Id) | |
self.log("\t\t员工进入第{}组分组.".format(grpNum)) | |
# 5. 更新员工组号 | |
staff.group = grpNum | |
# 6. 操作完成 | |
self.log("\t\t@@@----成功: 员工进入分组.----@@@") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment