Exemplo n.º 1
0
def set_leaving_time(staff_id, date_time_str):
    return get_data_xml(
        "SetLeavingTime",
        dict_to_xml(
            {'PARAMS': {
                'STAFF_ID': staff_id,
                'DATE_TIME': date_time_str
            }}))
Exemplo n.º 2
0
def get_worksheets(staff_id, date):
    return get_data_xml(
        "GetWorksheets",
        dict_to_xml({
            'PARAMS': {
                'STAFF_ID': staff_id,
                'INPUT_DATE': date.toString('dd.MM.yyyy')
            }
        }))
Exemplo n.º 3
0
def get_staff_by_user(user_id):
    result_xml = get_data_xml("GetStaffByUser",
                              dict_to_xml({'PARAMS': {
                                  'USER_ID': user_id
                              }}))
    staff_id = int(get_xml_field_value(result_xml, 'RESULT'))
    if staff_id is None:
        raise GuiException('Вы не являетесь сотрудником Novelty')
    return staff_id
Exemplo n.º 4
0
def get_timesheet(staff_id, date_beg, date_end):
    return get_data_xml(
        "GetTimesheet",
        dict_to_xml({
            'PARAMS': {
                'STAFF_ID': staff_id,
                'BEG_DATE': date_beg,
                'END_DATE': date_end
            }
        }))
Exemplo n.º 5
0
def create_ore_replace_dinner_order(menu, salad, first, second):
    return get_data_xml(
        "CreateOrReplaceDinnerOrder",
        dict_to_xml({
            'PARAMS': {
                'MENU': menu,
                'ORDER': {
                    'SALAD': salad,
                    'FIRST': first,
                    'SECOND': second
                }
            }
        }))
Exemplo n.º 6
0
    def saveData(self):
        self.buttonBox.setFocus()
        self.cboCustomer.validateValue()
        self.cboTaskType.validateValue()
        new_desc = self.txt.toPlainText().trimmed()
        new_desc_utf8 = new_desc.toUtf8()
        if new_desc.length() == 0:
            self.txt.setFocus()
            raise GuiException('Укажите описание выполненных работ')

        try:
            new_group_id = self.cboCustomer.itemData(
                self.cboCustomer.currentIndex()).toInt()[0]
            new_task_type_id = self.cboTaskType.itemData(
                self.cboTaskType.currentIndex()).toInt()[0]
            new_time = self.txtTime.value()

            xml_str = dict_to_xml(
                dict(WORKSHEETS=dict(
                    WORKSHEET=dict(WORKSHEET_ID=self.worksheet_id,
                                   CUSTOMER_ID=new_group_id,
                                   TASK_TYPE_ID=new_task_type_id,
                                   DESCRIPTION=prepare_string(new_desc_utf8),
                                   DURATION=new_time,
                                   STAFF_ID=self.parent_task_list.staff_id))))

            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

            result_xml = set_worksheet(xml_str)
            if '<ACTION>INSERTED</ACTION>' in result_xml:
                self.worksheet_id = int(
                    get_xml_field_value(result_xml, 'WORKSHEET_ID'))

            if new_group_id != self.group_id:
                gr = self.parent_task_list.getGroupById(new_group_id)
                if gr is None:
                    group_name = getCustomerNameById(new_group_id)
                    if group_name is None:
                        raise GuiException(
                            'Заказчик с ID равным %i не существет' %
                            new_group_id)
                    gr = task_group(self.parent_task_list)
                    gr.setCaption(group_name)
                    self.parent_task_list.addGroup(gr, new_group_id)
                old_group_id = self.group_id
                self.parent_task_list.moveItemToGroup(self.item_index,
                                                      new_group_id)
                if self.parent_task_list.getItemsCountInGroup(
                        old_group_id) == 0:
                    if old_group_id != -1:
                        self.parent_task_list.removeGroup(old_group_id)
                    else:
                        self.parent_task_list.hideNewItemGroup()

            self.setTaskType(new_task_type_id)
            self.setDesc(new_desc)
            self.setTime(new_time)

            self.stopEdit()
        except Exception as err:
            raise RaisedGuiException(err)
        finally:
            QApplication.restoreOverrideCursor()
Exemplo n.º 7
0
def set_new_in_version(txt):
    return get_data_xml("SetAssistantVersionDescription",
                        dict_to_xml({'PARAMS': {
                            'VERSION_DESCRIPTION': txt
                        }}))
Exemplo n.º 8
0
def set_program_version(version_number):
    vn = int(version_number)
    return get_data_xml("SetAssistantVersion",
                        dict_to_xml({'PARAMS': {
                            'VERSION_NUMBER': vn
                        }}))
Exemplo n.º 9
0
def remote_call_ex(function, params, server, port, use_ssl, url=SERVICES_URL):
    xml = xml_template % {'function':function, 'param_list':dict_to_xml(params)}
    return request_ex(xml, [server], port, use_ssl, url, 'Сервис управления серверами приложений недоступен')
Exemplo n.º 10
0
def remote_call(function, params):
    xml = xml_template % {'function':function, 'param_list':dict_to_xml(params)}
    return request(xml)