Пример #1
0
    def TransferData(self, cr, uid, ids=False, context=None):
        """
            Exposed method to execute data transfer to other systems.
        """
        operation = False
        reportStatus = 'Failed'
        updateDate = self._get_last_session
        logging.debug("[TransferData] Start : %s" % (str(updateDate)))
        transfer = self.get_data_transfer
        part_data_transfer = self.get_part_data_transfer
        datamap = part_data_transfer['fields']
        if 'exitorder' in part_data_transfer:
            fieldsListed = part_data_transfer['exitorder']
        else:
            fieldsListed = datamap.keys()
        allIDs = self._query_data(cr, uid, updateDate,
                                  part_data_transfer['status'])
        tmpData = self._exportData(cr, uid, allIDs, fieldsListed)
        if tmpData.get('datas'):
            bom_data_transfer = self.get_bom_data_transfer
            tmpData = self._rectify_data(cr, uid, tmpData, part_data_transfer)
            if 'db' in transfer:
                import dbconnector
                dataTargetTable = part_data_transfer['table']
                datatyp = part_data_transfer['types']
                connection = dbconnector.get_connection(transfer['db'])

                checked = dbconnector.saveParts(self, cr, uid, connection,
                                                tmpData.get('datas'),
                                                dataTargetTable, datamap,
                                                datatyp)

                if checked:
                    bomTargetTable = bom_data_transfer['table']
                    bomdatamap = bom_data_transfer['fields']
                    bomdatatyp = bom_data_transfer['types']
                    parentName = bom_data_transfer['PName']
                    childName = bom_data_transfer['CName']
                    kindBomname = bom_data_transfer['kind']
                    operation = dbconnector.saveBoms(
                        self, cr, uid, connection, checked, allIDs,
                        dataTargetTable, datamap, datatyp, kindBomname,
                        bomTargetTable, parentName, childName, bomdatamap,
                        bomdatatyp)

            if 'file' in transfer:
                bomfieldsListed = bom_data_transfer['fields'].keys()
                kindBomname = bom_data_transfer['kind']
                operation = self._extract_data(cr, uid, allIDs, kindBomname,
                                               tmpData, fieldsListed,
                                               bomfieldsListed,
                                               transfer['file'])

        if operation:
            updateDate = self._set_last_session
            reportStatus = 'Successful'

        logging.debug("[TransferData] %s End : %s" %
                      (reportStatus, str(updateDate)))
        return False
Пример #2
0
    def TransferData(self, cr, uid, ids=False, context=None):
        """
            Exposed method to execute data transfer to other systems.
        """ 
        operation=False
        reportStatus='Failed'
        updateDate=self._get_last_session
        logging.debug("[TransferData] Start : %s" %(str(updateDate)))
        transfer=self.get_data_transfer
        part_data_transfer=self.get_part_data_transfer
        datamap=part_data_transfer['fields']
        if 'exitorder' in part_data_transfer:
            fieldsListed=part_data_transfer['exitorder']
        else:
            fieldsListed=datamap.keys()
        allIDs=self._query_data(cr, uid, updateDate, part_data_transfer['status'])
        tmpData=self._exportData(cr, uid, allIDs, fieldsListed)
        if tmpData.get('datas'):
            bom_data_transfer=self.get_bom_data_transfer
            tmpData=self._rectify_data(cr, uid, tmpData, part_data_transfer)
            if 'db' in transfer:
                import dbconnector
                dataTargetTable=part_data_transfer['table']
                datatyp=part_data_transfer['types']
                connection=dbconnector.get_connection(transfer['db'])
            
                checked=dbconnector.saveParts(self,cr, uid, connection, tmpData.get('datas'), dataTargetTable, datamap, datatyp)
    
                if checked:
                    bomTargetTable=bom_data_transfer['table']
                    bomdatamap=bom_data_transfer['fields']
                    bomdatatyp=bom_data_transfer['types']
                    parentName=bom_data_transfer['PName']
                    childName=bom_data_transfer['CName']
                    kindBomname=bom_data_transfer['kind']
                    operation=dbconnector.saveBoms(self, cr, uid, connection, checked, allIDs, dataTargetTable, datamap, datatyp, kindBomname, bomTargetTable, parentName, childName, bomdatamap, bomdatatyp)  
                     
            if 'file' in transfer:
                bomfieldsListed=bom_data_transfer['fields'].keys()
                kindBomname=bom_data_transfer['kind']
                operation=self._extract_data(cr, uid, allIDs, kindBomname, tmpData, fieldsListed, bomfieldsListed, transfer['file'])

        if operation:
            updateDate=self._set_last_session
            reportStatus='Successful'
            
        logging.debug("[TransferData] %s End : %s" %(reportStatus,str(updateDate)))
        return False
Пример #3
0
    def TransferData(self, cr, uid, ids=False, context=None):
        """
            Exposed method to execute data transfer to other systems.
        """
        #         Reset default encoding. to allow to work fine also as service.
        reload(sys)
        sys.setdefaultencoding('utf-8')
        #         Reset default encoding. to allow to work fine also as service.
        operation = False
        fixedformat = False
        queueFiles = False
        reportStatus = 'Failed'
        updateDate = self._get_last_session
        logging.debug("[TransferData] Start : %s" % (str(updateDate)))
        transfer = self.get_data_transfer
        part_data_transfer = self.get_part_data_transfer
        bom_data_transfer = self.get_bom_data_transfer
        datamap = part_data_transfer['fields']
        if 'fixed' in part_data_transfer:
            fixedformat = part_data_transfer['fixed']
            if 'lengths' in part_data_transfer:
                partfieldsLength = part_data_transfer['lengths']
            else:
                partfieldsLength = False
        if 'exitorder' in part_data_transfer:
            fieldsListed = part_data_transfer['exitorder']
        if 'append' in part_data_transfer:
            queueFiles = part_data_transfer['append']
        else:
            fieldsListed = datamap.keys()
        allIDs = self._query_data(cr, uid, updateDate,
                                  part_data_transfer['status'])
        tmpData = self._exportData(cr, uid, allIDs, fieldsListed,
                                   bom_data_transfer['kind'])
        if tmpData.get('datas'):
            tmpData = self._rectify_data(cr, uid, tmpData, part_data_transfer)
            if 'db' in transfer:
                import dbconnector
                dataTargetTable = part_data_transfer['table']
                datatyp = part_data_transfer['types']
                connection = dbconnector.get_connection(transfer['db'])

                checked = dbconnector.saveParts(self, cr, uid, connection,
                                                tmpData.get('datas'),
                                                dataTargetTable, datamap,
                                                datatyp)

                if checked:
                    bomTargetTable = bom_data_transfer['table']
                    bomdatamap = bom_data_transfer['fields']
                    bomdatatyp = bom_data_transfer['types']
                    parentName = bom_data_transfer['PName']
                    childName = bom_data_transfer['CName']
                    kindBomname = bom_data_transfer['kind']
                    operation = dbconnector.saveBoms(
                        self, cr, uid, connection, checked, allIDs,
                        dataTargetTable, datamap, datatyp, kindBomname,
                        bomTargetTable, parentName, childName, bomdatamap,
                        bomdatatyp)

            if 'file' in transfer:
                bomfieldsListed = bom_data_transfer['fields'].keys()
                if 'lengths' in bom_data_transfer:
                    bomfieldsLength = bom_data_transfer['lengths']
                else:
                    bomfieldsLength = False
                kindBomname = bom_data_transfer['kind']
                operation = self._extract_data(cr,
                                               uid,
                                               allIDs,
                                               queueFiles,
                                               fixedformat,
                                               kindBomname,
                                               tmpData,
                                               fieldsListed,
                                               bomfieldsListed,
                                               transfer['file'],
                                               partLengths=partfieldsLength,
                                               bomLengths=bomfieldsLength)

        if operation:
            updateDate = self._set_last_session
            reportStatus = 'Successful'

        logging.debug("[TransferData] %s End : %s" %
                      (reportStatus, str(updateDate)))
        return False
Пример #4
0
    def TransferData(self, cr, uid, ids=False, context=None):
        """
            Exposed method to execute data transfer to other systems.
        """ 
#         Reset default encoding. to allow to work fine also as service.
        reload(sys)
        sys.setdefaultencoding('utf-8')
#         Reset default encoding. to allow to work fine also as service.
        operation=False
        fixedformat=False
        queueFiles=False
        reportStatus='Failed'
        updateDate=self._get_last_session
        logging.debug("[TransferData] Start : %s" %(str(updateDate)))
        transfer=self.get_data_transfer
        part_data_transfer=self.get_part_data_transfer
        bom_data_transfer=self.get_bom_data_transfer
        datamap=part_data_transfer['fields']
        if 'fixed' in part_data_transfer:
            fixedformat=part_data_transfer['fixed']            
            if 'lengths' in part_data_transfer:
                partfieldsLength=part_data_transfer['lengths']
            else:
                partfieldsLength=False
        if 'exitorder' in part_data_transfer:
            fieldsListed=part_data_transfer['exitorder']
        if 'append' in part_data_transfer:
            queueFiles=part_data_transfer['append']
        else:
            fieldsListed=datamap.keys()
        allIDs=self._query_data(cr, uid, updateDate, part_data_transfer['status'])
        tmpData=self._exportData(cr, uid, allIDs, fieldsListed, bom_data_transfer['kind'])
        if tmpData.get('datas'):
            tmpData=self._rectify_data(cr, uid, tmpData, part_data_transfer)
            if 'db' in transfer:
                import dbconnector
                dataTargetTable=part_data_transfer['table']
                datatyp=part_data_transfer['types']
                connection=dbconnector.get_connection(transfer['db'])
            
                checked=dbconnector.saveParts(self,cr, uid, connection, tmpData.get('datas'), dataTargetTable, datamap, datatyp)
    
                if checked:
                    bomTargetTable=bom_data_transfer['table']
                    bomdatamap=bom_data_transfer['fields']
                    bomdatatyp=bom_data_transfer['types']
                    parentName=bom_data_transfer['PName']
                    childName=bom_data_transfer['CName']
                    kindBomname=bom_data_transfer['kind']
                    operation=dbconnector.saveBoms(self, cr, uid, connection, checked, allIDs, dataTargetTable, datamap, datatyp, kindBomname, bomTargetTable, parentName, childName, bomdatamap, bomdatatyp)  
                     
            if 'file' in transfer:
                bomfieldsListed=bom_data_transfer['fields'].keys()
                if 'lengths' in bom_data_transfer:
                    bomfieldsLength=bom_data_transfer['lengths']
                else:
                    bomfieldsLength=False
                kindBomname=bom_data_transfer['kind']
                operation=self._extract_data(cr, uid, allIDs, queueFiles, fixedformat, kindBomname, tmpData, fieldsListed, bomfieldsListed, transfer['file'],partLengths=partfieldsLength,bomLengths=bomfieldsLength)

        if operation:
            updateDate=self._set_last_session
            reportStatus='Successful'
            
        logging.debug("[TransferData] %s End : %s" %(reportStatus,str(updateDate)))
        return False