class ProjectTask(models.Model): '''任务表''' msprojectid=models.CharField(max_length=40,blank=True,verbose_name='') name = models.CharField(max_length=60,verbose_name='任务名称') parentid=models.ForeignKey('self',verbose_name='父节点',null=True,blank=True) planstart=models.DateTimeField(verbose_name='计划开始时间') planfinish=models.DateTimeField(verbose_name='计划结束时间') actualstart=models.DateTimeField(null=True,blank=True,verbose_name='实际开始时间') acutalfinish=models.DateTimeField(null=True,blank=True,verbose_name='实际结束时间') constructionunit = CrossDbForeignKey(Company,verbose_name='施工单位',null=True,blank=True) major=CrossDbForeignKey(UserMajor,verbose_name='专业',null=True,blank=True) curstatus=models.ForeignKey(TaskStatus,verbose_name='当前状态',null=True,blank=True) percentage=models.FloatField(verbose_name='完成百分比',default=0) ismilestone = models.BooleanField(verbose_name='是否里程碑节点',default=False) iskeypath = models.BooleanField(verbose_name='是否关键路径',default=False) description=models.CharField(max_length=200,verbose_name='描述',null=True,blank=True) type = models.ForeignKey(TaskType,verbose_name='类型') taskpath=models.CharField(max_length=256,verbose_name='任务路径',null=True,blank=True) relatestatus=models.ForeignKey(PBStatus,verbose_name='关联工序',null=True,blank=True) def __str__(self): return self.name class Meta: verbose_name = '生产任务' verbose_name_plural = '生产任务'
class projectevent(models.Model): '''事件表''' number = models.CharField(max_length=60,verbose_name='问题编号') title = models.CharField(max_length=120,verbose_name='标题',default='') describe = models.CharField(max_length=256,verbose_name='描述') deadline = models.DateTimeField(verbose_name='截止时间') priority = models.IntegerField(verbose_name='优先级',default=1) curflowstep= models.ForeignKey(FlowTemplateStep,verbose_name='当前流程步骤') updatetime = models.DateTimeField(verbose_name='更新时间',blank=True, null=True) template= models.ForeignKey(FlowTemplate,verbose_name='流程模板') voicedoc= models.ForeignKey("Document",verbose_name='声音文档',blank=True, null=True) relatedmonitoringelement = models.ForeignKey("Monitoringelement",verbose_name='过程监控元素',blank=True, null=True) pbstatus = models.ForeignKey("PBStatus",verbose_name='关联状态',blank=True, null=True) createtime = models.DateTimeField(auto_now_add=True,verbose_name='创建时间',blank=True, null=True) createuser =CrossDbForeignKey(User,verbose_name='创建人',related_name='createuser',blank=True, null=True) issave = models.BooleanField(verbose_name='是否保存',default=False) saveuser =CrossDbForeignKey(User,verbose_name='保存人',related_name='saveuser',blank=True, null=True) savecomment = models.CharField(max_length=200,verbose_name='意见',blank=True, null=True) curdealstep = models.IntegerField(verbose_name='处理阶段',default=1) #1:未处理 2:处理中 3:已结束 extend = models.CharField(max_length=256,verbose_name='扩展参数',blank=True, null=True) def __str__(self): return self.describe class Meta: verbose_name = '事件' verbose_name_plural = '事件' db_table = 'taskandflow_projectevent' @staticmethod def get_priority_desc(priority): priority_desc='' for Choices in PRIORTITY_CHOICES: if Choices[0]== priority: priority_desc=Choices[1] break return priority_desc
class DirectoryNotifyuser(models.Model): directory = models.ForeignKey(Directory) notifyuser = CrossDbForeignKey(User) class Meta: managed = False db_table = 'taskandflow_directory_notifyuser'
class DocumentNotifyuser(models.Model): document = models.ForeignKey(Document) notifyuser = CrossDbForeignKey(User) class Meta: managed = False db_table = 'taskandflow_document_notifyuser'
class PbtypeUser(models.Model): pbtype = models.ForeignKey(PBType) user = CrossDbForeignKey(User) class Meta: managed = False db_table = 'taskandflow_pbtype_user'
class Message(models.Model): '''消息表''' receiver=CrossDbForeignKey(User,related_name='receiver',verbose_name='接收人') message=models.CharField(max_length=240,verbose_name='内容') sender=CrossDbForeignKey(User,related_name='sender',verbose_name='发起人') isread = models.BooleanField(verbose_name='是否已读',default=False) readtime=models.DateTimeField(auto_now_add=True,verbose_name='读取时间') sendtime=models.DateTimeField(auto_now_add=True,verbose_name='发起时间') type=models.ForeignKey(MessageType,verbose_name='类型') relatetype = models.CharField(max_length=60,verbose_name='关联元素类型',choices=RELATE_TYPE_CHOICES,blank=True, null=True) relateid = models.IntegerField(verbose_name='元素编号',blank=True, null=True) def __str__(self): return self.message class Meta: verbose_name = '消息' verbose_name_plural = '消息'
class MeetingZhouqiUser(models.Model): meeting = models.ForeignKey(MeetingZhouqi, blank=True, null=True) user = CrossDbForeignKey(User, blank=True, null=True) class Meta: managed = False db_table = 'assist_meeting_zhouqi_user'
class DirectoryCompany(models.Model): directory = models.ForeignKey(Directory) company = CrossDbForeignKey(Company) class Meta: managed = False db_table = 'taskandflow_directory_company'
class BiaoDanMuBan(models.Model): name = models.CharField(max_length=40, verbose_name='名称') content = models.CharField(max_length=200000, verbose_name='内容') creater = CrossDbForeignKey(User, verbose_name='创建人') createdate = models.DateTimeField(auto_now=True, verbose_name='创建日期') major = CrossDbForeignKey(UserMajor, verbose_name='专业', blank=True, null=True) formtype = models.ForeignKey(BiaoDanType, verbose_name='表单类型') def __str__(self): return self.name class Meta: db_table = 'taskandflow_formtemplet'
class DirectoryUser(models.Model): directory = models.ForeignKey(Directory) user = CrossDbForeignKey(User) auth = models.IntegerField(verbose_name='权限',default=4) class Meta: managed = False db_table = 'taskandflow_directory_user'
class User2CMStatus(models.Model): '''用户施工机械状态权限表''' user=CrossDbForeignKey(User,verbose_name='用户') status=models.ForeignKey(CMStatus,verbose_name='施工机械状态') class Meta: unique_together = ( ("user", "status"), ) verbose_name = '用户施工机械状态' verbose_name_plural = '用户施工机械状态'
class Usershortcut(models.Model): user = CrossDbForeignKey(User) function = models.ForeignKey(AdminFunction) seq = models.IntegerField(blank=True, null=True) class Meta: unique_together = (("user", "function")) managed = False db_table = 'taskandflow_usershortcut'
class FlowStepUser(models.Model): '''流程模板步骤人员表''' user = CrossDbForeignKey(User,verbose_name='用户') flowstep= models.ForeignKey(FlowTemplateStep,verbose_name='所属流程步骤') isactor = models.BooleanField(verbose_name='是否执行者',default=True) # def __str__(self): # return self.name class Meta: verbose_name = '流程模板步骤人员' verbose_name_plural = '流程模板步骤人员'
class Hazardevent(models.Model): '''危险源事件''' hazard_code = models.CharField(max_length=24, blank=True, null=True) name = models.CharField(max_length=128, blank=True, null=True) major = CrossDbForeignKey(UserMajor, blank=True, null=True) curstatus = models.ForeignKey(HazardStatus, blank=True, null=True) responsunit = CrossDbForeignKey(Company, blank=True, null=True) remarks = models.CharField(max_length=256, blank=True, null=True) relatedele_type = models.CharField(max_length=60, blank=True, null=True) relatedele_id = models.IntegerField(blank=True, null=True) relatedspace_type = models.CharField(max_length=60, blank=True, null=True) relatedspace_id = models.IntegerField(blank=True, null=True) ownerlist = models.ForeignKey(Hazardlisthistory, blank=True, null=True) duration = models.IntegerField(blank=True, null=True,verbose_name='持续时间') his_date = models.DateField() class Meta: managed = False db_table = 'taskandflow_hazardevent' unique_together = ( ("hazard_code", "relatedspace_type","relatedspace_id","his_date"), )
class Zone(models.Model): '''分区''' name = models.CharField(max_length=20) description = models.CharField(max_length=120, blank=True) major =CrossDbForeignKey(UserMajor, blank=True, null=True) elevations = models.ManyToManyField(Elevation,through = 'ZoneElevation') class Meta: managed = False db_table = 'taskandflow_zone'
class User2HazardStatus(models.Model): '''用户重大危险源状态权限表''' user=CrossDbForeignKey(User,verbose_name='用户') status=models.ForeignKey(HazardStatus,verbose_name='重大危险源状态') def __str__(self): return self.status class Meta: unique_together = ( ("user", "status"), ) verbose_name = '用户重大危险源状态' verbose_name_plural = '用户重大危险源状态'
class Doc2Relate(models.Model): '''文档关联表''' document= models.ForeignKey(Document,verbose_name='文档') relatetype = models.CharField(max_length=60,verbose_name='关联元素类型',choices=RELATE_TYPE_CHOICES,blank=True, null=True) relateid = models.IntegerField(verbose_name='元素编号',blank=True, null=True) creator= CrossDbForeignKey(User,verbose_name='关联人') createtime = models.DateTimeField(auto_now_add=True,verbose_name='关联时间') class Meta: verbose_name = '文档关联表' verbose_name_plural = '文档关联表'
class Projectversion(models.Model): version_code = models.CharField(max_length=64) update_time = models.DateTimeField(auto_now_add=True) isworkinigversion = models.BooleanField(default=False) label = models.CharField(max_length=64, blank=True) update_user = CrossDbForeignKey(User) description = models.CharField(max_length=256, blank=True) class Meta: managed = False db_table = 'taskandflow_projectversion'
class FlowTemplateUser(models.Model): '''流程模板浏览者表''' template= models.ForeignKey(FlowTemplate,verbose_name='流程模板') user = CrossDbForeignKey(User,verbose_name='用户') def __str__(self): return self.template.name class Meta: verbose_name = '流程模板浏览者' verbose_name_plural = '流程模板浏览者' db_table = 'taskandflow_flowtemplate_user'
class TaskStatusRecord(models.Model): '''任务状态记录表''' status=models.ForeignKey(TaskStatus,verbose_name='状态') task=models.ForeignKey(ProjectTask,verbose_name='任务') actor=CrossDbForeignKey(User,verbose_name='用户') time=models.DateTimeField(auto_now_add=True,verbose_name='时间') description=models.CharField(max_length=200,verbose_name='描述',blank=True) class Meta: unique_together = ( ("status", "task"), ) verbose_name = '任务状态记录' verbose_name_plural = '任务状态记录'
class MonthPlan(models.Model): '''月度计划''' month_date = models.DateField() update_time = models.DateTimeField(auto_now_add=True, verbose_name='添加时间') desc = models.CharField(max_length=256, blank=True) user = CrossDbForeignKey(User) file = models.ForeignKey('TaskAndFlow.Document', blank=True, null=True) class Meta: managed = False db_table = 'taskandflow_monthplan'
class Feedback(models.Model): submittime = models.DateTimeField(auto_now_add=True, verbose_name='提交时间') content = models.CharField(max_length=400, verbose_name='内容') submitor = CrossDbForeignKey('UserAndPrj.User', verbose_name='提交人') def __str__(self): return self.content class Meta: verbose_name = '使用反馈' verbose_name_plural = '使用反馈'
class UserRoles(models.Model): '''用户-项目-角色表''' user = CrossDbForeignKey('UserAndPrj.User', verbose_name='用户', related_name='userroles') role = models.ForeignKey(Role, verbose_name='角色') class Meta: unique_together = (("user", "role"), ) verbose_name = '用户-项目-角色' verbose_name_plural = '用户-项目-角色'
class UserDivision(models.Model): '''用户-项目-参建方''' user = CrossDbForeignKey('UserAndPrj.User', verbose_name='用户', related_name='userdivisions') division = models.ForeignKey(Division, verbose_name='参建方') class Meta: unique_together = (("user", "division"), ) verbose_name = '用户-项目-参建方' verbose_name_plural = '用户-项目-参建方'
class PushMessage(models.Model): '''推送消息表''' touser=CrossDbForeignKey(User,related_name='touser',verbose_name='接收人',blank=True, null=True) title=models.CharField(max_length=120,verbose_name='标题',blank=True, null=True) message=models.CharField(max_length=240,verbose_name='内容',blank=True, null=True) fromuser=CrossDbForeignKey(User,related_name='fromuser',verbose_name='发起人',blank=True, null=True) status = models.IntegerField(verbose_name='状态',blank=True, null=True) createtime=models.DateTimeField(auto_now_add=True,verbose_name='创建时间') pushtime=models.DateTimeField(verbose_name='推送时间',blank=True, null=True) readtime=models.DateTimeField(verbose_name='读取时间',blank=True, null=True) relatetype = models.CharField(max_length=60,verbose_name='关联元素类型',choices=RELATE_TYPE_CHOICES,blank=True, null=True) relateid = models.IntegerField(verbose_name='元素编号',blank=True, null=True) toparty = models.IntegerField(verbose_name='部门编号',blank=True, null=True) totag = models.IntegerField(verbose_name='标签编号',blank=True, null=True) agentid = models.IntegerField(verbose_name='应用编号',blank=True, null=True) def __str__(self): return self.message class Meta: verbose_name = '推送消息' verbose_name_plural = '推送消息'
class EventStepOperation(models.Model): '''事件步骤操作表''' flowstepoper= models.ForeignKey(FlowStepOperation,verbose_name='流程模板步骤操作',blank=True, null=True) eventstep= models.ForeignKey(Eventstep,verbose_name='所属事件步骤') oprtime = models.DateTimeField(auto_now_add=True,verbose_name='操作时间') actor= CrossDbForeignKey(User,verbose_name='操作人') comment = models.CharField(max_length=200,verbose_name='评论',blank=True, null=True) def __str__(self): return self.comment class Meta: verbose_name = '事件步骤操作' verbose_name_plural = '事件步骤操作'
class Notice(models.Model): '''通知表''' title=models.CharField(max_length=40,verbose_name='标题') message=models.CharField(max_length=400,verbose_name='内容') sender=CrossDbForeignKey(User,verbose_name='发起人') time=models.DateTimeField(auto_now_add=True,verbose_name='时间') expire=models.DateTimeField(verbose_name='过期时间',blank=True, null=True) def __str__(self): return self.title class Meta: verbose_name = '通知' verbose_name_plural = '通知'
class Acceptanceinfo(models.Model): '''质量验收工作信息''' relatedspace_type = models.CharField(max_length=64, blank=True) relatedspace_id = models.IntegerField(blank=True, null=True) finiishedtime = models.DateTimeField(blank=True, null=True) acceptuser = CrossDbForeignKey(User, blank=True, null=True) status = models.IntegerField(blank=True, null=True)#1 未处理,2处理中,3关闭 acceptancetype= models.ForeignKey('Acceptancetype') comment = models.CharField(max_length=200,verbose_name='意见',blank=True, null=True) class Meta: managed = False db_table = 'taskandflow_acceptanceinfo'
class Acceptancetype(models.Model): '''质量验收工作类型''' name = models.CharField(max_length=64, blank=True) major = CrossDbForeignKey(UserMajor, blank=True, null=True) classification_code = models.CharField(max_length=64, blank=True, null=True) def __str__(self): return self.name class Meta: managed = False db_table = 'taskandflow_acceptancetype'
class FlowTemplate(models.Model): '''流程模板表''' name = models.CharField(max_length=60,verbose_name='流程模板名称') major = CrossDbForeignKey(UserMajor,verbose_name='专业') flowtype = models.ForeignKey(FlowType,verbose_name='流程类型') describe = models.CharField(max_length=120,verbose_name='模板描述') def __str__(self): return self.name class Meta: verbose_name = '流程模板' verbose_name_plural = '流程模板'