class GoodsFilter(graphene.InputObjectType): manufacturer = IntID() storage = IntID() responsible = IntID() project = IntID() quantity = graphene.Float() quantity_type = graphene.String()
class Input: id = IntID(required=True) code = String(required=True) name = String(required=True) manufacturer_name = String(required=True) action = String(required=True) default_unit = IntID()
class Input: user_id = IntID(required=True) project_id = IntID(required=True) amount = graphene.Int(required=True) cash = graphene.Boolean(required=True) installments = graphene.Int(required=True) description = graphene.String(required=True)
class Input: old_warehouse = IntID(required=True) new_warehouse = IntID(required=True) id_good = IntID(required=True) count = Float(required=True) project_id = IntID() responsible_id = IntID(required=True)
class Input: worker = IntID(required=True) begin = DateTime(required=True) end = DateTime(required=True) time = Time() reason = IntID(required=True) comment = String()
class Input: id = IntID(required=True, description='ID отсутствия для изменения') worker = IntID(required=True) begin = DateTime(required=True) end = DateTime(required=True) time = Time() reason = IntID(required=True) comment = String()
class Input: description = graphene.String(required=True) gip_id = IntID() state_id = IntID(required=True) budget = graphene.Int() customer_id = IntID() manager_id = IntID() comment = graphene.String()
class Input: id = IntID(required=True) last_name = graphene.String(required=True) first_name = graphene.String(required=True) patronum = graphene.String() position = graphene.String() phone_number = graphene.String() client_id = IntID(required=True)
class Input: id = IntID(required=True) client_id = IntID() contacts = graphene.List(IntID) date = graphene.String() interaction = graphene.String() result = graphene.String() next_step_date = graphene.String() next_step = graphene.String()
class ReportsFilter(graphene.InputObjectType): only_own_projects = graphene.Boolean() worker = IntID() projects = graphene.List(IntID) state = IntID() func_role = IntID() process = IntID() sub_process = IntID() date_range = DateRangeType()
class Input: code = String() name = String(required=True) manufacturer_name = String(required=True) mass = Float() good_group_id = IntID() analogs = List(IntID) gosts = List(String, required=True) default_unit = IntID()
class Input: count = Float(required=True) unit_id = IntID(required=True) note = String() defect = Boolean(required=True) project_id = IntID() good_kind_id = IntID(required=True) location_id = IntID(required=True) responsible_id = IntID(required=True)
class TransferPositionSubRowsType(graphene.ObjectType): id = IntID() number = IntID() serial_number = IntID() location = graphene.Field(WarehouseType) project = graphene.Field(ProjectType) count = graphene.Float() transfer = graphene.Float() unit = graphene.Field(UnitType) all_count = graphene.Float()
class LogisticsRequestType(DjangoObjectType): purpose = graphene.String() project = graphene.String() goal = graphene.Field(LogisticsGoal) need_attention = graphene.Boolean() gip_id = IntID() reason_id = IntID() request_completed = graphene.Boolean() class Meta: model = LogisticsRequest def resolve_purpose(self, info, **kwargs): return 'Спец-ия %s' % self.reason.pressmark def resolve_project(self, info, **kwargs): return '%05d - %s' % (self.reason.project.number, self.reason.project.description) def resolve_goal(self, info, **kwargs): if isinstance(self.reason, Specification): return LogisticsGoal(id=self.reason.id, project=self.reason.project, name=self.reason.pressmark) else: return None def resolve_gip_id(self, info, **kwargs): return self.reason.project.gip.id def resolve_reason_id(self, info, **kwargs): return self.reason.id def resolve_request_completed(self, info, **kwargs): lrp = LogisticsRequestPosition.objects.filter(request_id=self.id) competed = True # array = [] # for position in lrp: # array.append(position) # for position in lrp: # if position.canceled_position: # array.remove(position.canceled_position) for position in lrp: if not position.task: competed = False break if not position.canceled and not position.finished_date: competed = False break return competed
class LogisticsRequestPositionFilter(graphene.InputObjectType): late_delivery = graphene.Boolean() overdue = graphene.Boolean() row_status = graphene.String() expected_date = DateDayRangeType() deadline = DateDayRangeType() order_date = DateDayRangeType() projects = graphene.List(IntID) responsible = graphene.List(IntID) worker = IntID() moved = IntID() count_in_stock = graphene.Float() status_in_stock = graphene.String()
class Input: name = graphene.String(required=True) kind_id = IntID() relation_id = IntID() full_name = graphene.String() INN = graphene.String() KPP = graphene.String() OKPO = graphene.String() OGRN = graphene.String() legal_address = graphene.String() street_address = graphene.String() phone_number = graphene.String() manager_id = IntID() other = graphene.String()
class Input: id = IntID(required=True) login = String(required=True) last_name = String(required=True) first_name = String(required=True) patronym = String() work_phone = String() personal_phone = String() email = String() gender = GenderChoicesPropertyEnum(required=True) healthy = Boolean(required=True) birth_date = DateTime() hire_date = DateTime(required=True) fire_date = DateTime() head = IntID()
class UserType(Interface): class Meta: description = 'Абстрактный интерфейс пользователя' id = IntID(required=True) full_name = String() short_name = String() func_roles = List(IntID) gender = GenderChoicesPropertyEnum() positions = List(String, description='Список должностей') avatar = String() @staticmethod def resolve_func_roles(self, info): values = FuncRole.objects.filter( positions__user__id=self.id).values('id') return map(lambda item: item['id'], values) def resolve_gender(self, info, **kwargs): return self.gender def resolve_positions(self, info, **kwargs): # noinspection PyUnresolvedReferences positions = self.positions.select_related('company__client').all() return [ '{} в {}'.format(position.name, position.company.client.name) for position in positions ] def resolve_avatar(self, info, **kwargs): if self.avatar: return self.avatar.url else: return None
class AbsenceFilter(InputObjectType): class Meta: description = 'Фильтр' reason = List(IntID, required=True, description='Причина отсутствия') position = IntID(description='Должность отсутствующего') show_fired = Boolean(description='Показывать уволенных') date_range = DateRangeType(description='Период')
class Input: login = String(required=True) last_name = String(required=True) first_name = String(required=True) patronym = String() password = String(required=True) hire_date = Date(required=True) company = IntID(required=True)
class LogisticsRequestPositionSubRowsType(graphene.ObjectType): id = IntID() expected_date = graphene.String() deadline = graphene.String() order_date = graphene.String() count = graphene.Float() available_in_stock = graphene.Float() count_in_stock = graphene.Float() unit = graphene.String() # transfer - колонка "Задачи на перемещение" transfer = graphene.List(TransferCountType) logistic_request_id = IntID() logistic_task_id = IntID() number = IntID() project = graphene.Field(ProjectType) responsible = graphene.List(UserType) worker = graphene.Field(UserType)
class Input: id = IntID(required=True) worker = IntID(required=True) report_date = Date(required=True) func_role = IntID(required=True) projects = graphene.List(IntID, required=True) process = IntID() sub_process = IntID() tasks = IntID() task = graphene.String() time_spent = Time(required=True) time_from = Time() time_to = Time() place = IntID(required=True) distance = graphene.Float() car = graphene.String() gas = graphene.String() where_from = graphene.String() where_to = graphene.String() money_spent = graphene.Int() vc_project = graphene.Int() vc_digits = graphene.Int() vc_digits_minor = graphene.Int() model = graphene.String() night_shift = graphene.Boolean() quality_grade = graphene.Int() time_grade = graphene.Int() comment = graphene.String()
class GoodSubRowsType(graphene.ObjectType): id = IntID() location = graphene.Field(WarehouseType) count = graphene.Float() unit = graphene.Field(UnitType) project = graphene.Field(ProjectType) responsible = graphene.Field(UserType) note = graphene.String() defect = graphene.Boolean()
class Input: occupation_id = IntID(required=True) salary = Int() fraction = Int() base = Int() advance = Int() by_hours = Boolean() fixed_hour = Int() transportation = Int()
class Input: id = IntID(required=True) general = graphene.Float() welding = graphene.Float() experience = graphene.Float() etech = graphene.Float() schematic = graphene.Float() initiative = graphene.Float() discipline = graphene.Float()
class Query(ObjectType): paged_specification = Field(PagedSpecificationType, paged=PagedInput(required=True)) specifications_positions = List(SpecificationsPositionsType, filters=IntID()) all_specification = List(SpecificationType) all_gosts = List(GOSTType) descriptions_info = List(graphene.String, filters=IntID(required=True)) selected_specification = Field(SpecificationType, specification_id=IntID()) get_specification_id_by_logistic = Field(IntID, logistic_id=IntID(required=True)) def resolve_paged_specification(self, info, paged): specifications, total_count = Specification.objects.list_paged_specifications(info.context.user, **paged) return PagedSpecificationType(specifications=specifications, total_count=total_count) def resolve_specifications_positions(self, info, **kwargs): result = SpecificationsPositions.objects.load_specifications_positions(info, **kwargs) if result: return result return [] def resolve_all_specification(self, info): user = info.context.user return Specification.objects.filter(models.Q(project__gip=user) | models.Q(editors=user)) def resolve_all_gosts(self, info): return GOST.objects.all() def resolve_descriptions_info(self, info, **kwargs): return SpecificationsPositions.objects.load_descriptions_info(info, **kwargs) def resolve_selected_specification(self, info, specification_id=None): try: if not specification_id: return None return Specification.objects.get(id=specification_id) except Specification.DoesNotExist: raise SngyException('Спецификация не найдена') def resolve_get_specification_id_by_logistic(self, info, logistic_id): try: lr = LogisticsRequest.objects.get(id=logistic_id) return Specification.objects.get(id=lr.reason.id).id except Specification.DoesNotExist: raise SngyException('Спецификация не найдена')
class Query(graphene.ObjectType): all_states = graphene.List(StateType, description="Список всех этапов проектов") all_projects = graphene.List( ProjectType, current_gip=graphene.Boolean(), search=graphene.String(), gip=IntID(), require=graphene.List( IntID, description= 'Список ID проектов, информацию о которых необходимо вернуть вне зависимости от прочих совпавших условий' ), description="Список проектов с фильтрацией") paged_projects = graphene.Field(PagedProjects, paged=PagedInput(required=True), filters=ProjectsFilter()) get_hour_prime_cost = graphene.Int() filter_schemas = graphene.List(ProjectAnalysisSchemaType) def resolve_all_states(self, info): return State.objects.all() def resolve_all_projects(self, info, **kwargs): return Project.objects.load_projects(info, **kwargs) def resolve_paged_projects(self, info, paged, **kwargs): projects, total_count = Project.objects.paged_projects( **paged, **kwargs) return PagedProjects(projects=projects, total_count=total_count) def resolve_filter_schemas(self, info): return ProjectAnalysisSchema.objects.load_schemas( user=info.context.user) def resolve_get_hour_prime_cost(self, info): try: return GlobalCoefficient.objects.get(name='hour_prime_cost').value except: return 450
class Input: name = String(required=True) project_id = IntID() user_id = IntID()
class InStockType(graphene.ObjectType): id = IntID() count = graphene.Float() unit = graphene.Field(UnitType) available = graphene.Float()
class Input: id = IntID(required=True)