コード例 #1
0
def setProbeResultToActionProperties(tissueJournalId, testId, result):
    db = QtGui.qApp.db

    tableAction = db.table('Action')
    tableActionPropertyType = db.table('ActionPropertyType')

    queryTable = tableAction.innerJoin(
        tableActionPropertyType, tableActionPropertyType['actionType_id'].eq(
            tableAction['actionType_id']))

    cond = [
        tableAction['takenTissueJournal_id'].eq(tissueJournalId),
        tableActionPropertyType['test_id'].eq(testId)
    ]

    actionRecordList = db.getRecordList(queryTable, 'Action.*', cond)

    for actionRecord in actionRecordList:

        needSave = False

        action = CAction(record=actionRecord)

        actionType = action.getType()
        propertyTypeItemsList = actionType.getPropertiesById().items()
        for propertyTypeId, propertyType in propertyTypeItemsList:
            if propertyType.testId == testId:
                property = action.getPropertyById(propertyTypeId)
                if not propertyType.isVector:
                    property.setValue(
                        propertyType.convertQVariantToPyValue(result))
                    needSave = True

        if needSave:
            action.save(idx=forceInt(actionRecord.value('idx')))
コード例 #2
0
def getPlannedEndDateByJobTicketProperty(record):
    # план заполняется по номерку, a номерок может подбираться автоматом
    if record:
        action = CAction(record=record)
        actionType = action.getType()
        propertyTypeList = actionType.getPropertiesById().values()
        for propertyType in propertyTypeList:
            if type(propertyType.valueType
                    ) == CJobTicketActionPropertyValueType:
                property = action.getPropertyById(propertyType.id)
                jobTicketId = property.getValue()
                if jobTicketId:
                    db = QtGui.qApp.db
                    date = forceDate(
                        db.translate('Job_Ticket', 'id', jobTicketId,
                                     'datetime'))
                    jobId = forceRef(
                        db.translate('Job_Ticket', 'id', jobTicketId,
                                     'master_id'))
                    jobTypeId = forceRef(
                        db.translate('Job', 'id', jobId, 'jobType_id'))
                    ticketDuration = forceInt(
                        db.translate('rbJobType', 'id', jobTypeId,
                                     'ticketDuration'))
                    return date.addDays(ticketDuration)
        return None
コード例 #3
0
 def loadEvent(self, event_id):
     db = QtGui.qApp.db
     for rec in db.getRecordList('Action',
                                 where='event_id=%d AND deleted=0' %
                                 event_id):
         action = CAction(record=rec)
         action_type = action.getType()  # type: CActionType
         self._items[action_type.class_].append(action)