{:from PyQt4 import QtGui} {:from library.Utils import forceDateTime, formatDateTime, forceString, forceInt} {:from library.DateEdit import CDateEdit} {:from library.crbcombobox import CRBComboBox} {def: checkValue()} {if: edtIntInput.value()} {:buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)} {else:} {:buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)} {end:} {end:} {:dialog = QtGui.QDialog()} {:buttonBox = QtGui.QDialogButtonBox(dialog)} {:buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.Cancel)} {:buttonBox.accepted.connect(dialog.accept)} {:buttonBox.rejected.connect(dialog.reject)} {:buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)} {:edtIntInput = QtGui.QSpinBox(dialog)} {:edtIntInput.setMinimum(0)} {:edtIntInput.setMaximum(2147483647)} {:edtIntInput.setSingleStep(1)} {:edtIntInput.setMinimumWidth(100)} {:edtIntInput.valueChanged.connect(checkValue)} {:edtBool1 = QtGui.QCheckBox(dialog)} {:edtBool2 = QtGui.QCheckBox(dialog)} {:layout = QtGui.QGridLayout(dialog)} {:layout.addWidget(QtGui.QLabel(u'Идентификатор события'), 0, 0)} {:layout.addWidget(edtIntInput, 0, 1)} {: edtBool1.setText(u'Выгружать повторно')} {:layout.addWidget(edtBool1, 1, 0)} {: edtBool2.setText(u'Отобразить детальный лог выгрузки')} {:layout.addWidget(edtBool2, 2, 0)} {:layout.setRowStretch(3, 1)} {:layout.addWidget(buttonBox, 4, 0, 1, 2)} {:dialog.setWindowTitle(u'Параметры экспорта')} {if: not dialog.exec_()} {:exit()} {end:} {:event_id = edtIntInput.value()} {:db = QtGui.qApp.db} {:exportE = db.getRecordEx('Event_Export', '*', 'master_id = %d' % (event_id))} {if: exportE} {:dateTime = forceDateTime(exportE.value('dateTime'))} {:modifyDatetime = forceDateTime(exportE.value('masterDatetime'))} {end:} {if: dateTime and modifyDatetime} {if: dateTime >= modifyDatetime and edtBool1.isChecked()} {:QtGui.qApp.db.query('UPDATE Event_Export SET masterDatetime=DATE_SUB(masterDatetime, INTERVAL 1 MINUTE),dateTime=masterDatetime WHERE master_id = %d' % (event_id))} {end:} {end:} {:exportCase = readUrl("http://"+dbServerName+"/exportCasesManually/exportCasesManually.php?eventId=%i"%(event_id), timeout=300)} {:exportE = db.getRecordEx('Event_Export', '*', 'master_id = %d' % (event_id))} {if: exportE} {:dateTime = forceDateTime(exportE.value('dateTime'))} {if: len(exportCase.strip()) == 0 and exportE.value('success').toBool()}