Exemple #1
0
 def GetEnvInfo(self):
     SQL = r'select distinct Env from dfr_productline'
     result = []
     if g_DB.Execute(SQL):
         res = g_DB.fetchAll()
         if res:
             for data in res:
                 for key in data:
                     result.append(data[key])
         g_Log.LogInfo('获取环境信息成功')
     else:
         g_Log.LogError('获取环境信息失败')
         g_Log.LogDebug('SQL语句:' + SQL)
     return result
Exemple #2
0
    def GetProductFamilyInfo(self, ProductType):
        SQL = r'select productFamily from dfr_productline where Class="' + ProductType + '"'
        result = []
        if g_DB.Execute(SQL):
            res = g_DB.fetchAll()
            if res:
                for data in res:
                    for key in data:
                        result.append(data[key])

            g_Log.LogInfo('从数据库获取产品族信息成功')
        else:
            g_Log.LogError('从数据库获取产品族信息失败')
            g_Log.LogDebug('SQL语句:' + SQL)

        return result
Exemple #3
0
    def Submit(self):
        try:
            result = False
            destPath = g_Data.path + 'Project\\' + g_Task.task + '\\'
            if not os.path.exists(destPath):
                os.mkdir(destPath)

            SQL = 'select * from u_r_pcb_product where TaskName="' + g_Task.Task + '"'
            if not g_DB.Execute(SQL):
                return result
            res = g_DB.fetchAll()
            if not res: return result

            PCBCode = res[0]['PCBCode']
            ExcelFileName = destPath + g_Task.Task + PCBCode + '_Input.xls'
            if not self._SaveDataToExcel(ExcelFileName):
                g_Log.LogError('存储Excel错误')
                return result

            BDMPos, BrdPos = self.GetFileName()
            shutil.copy(BDMPos, destPath + '_' + PCBCode + '_Bom.xls')
            shutil.copy(BrdPos, destPath + '_' + PCBCode + '_Brd.brd')

            data = {}
            data.setdefault('brd_LocalPath', '"%s"' % BrdPos)
            data.setdefault('Bom_LocalPath', '"%s"' % BDMPos)
            data.setdefault('Input_LocalPath', '"%s"' % ExcelFileName)
            data.setdefault('InputFlag', '1')

            if not g_DB.insert('u_r_pcb_product', data, 'TaskName="'+g_Task.Task + '"'):
                return result

            result = True
            return result
        finally:
            if result:
                self._ShowMessage((PCBCode + '单板信息提交完成!'))
            else:
                self._ShowMessage(('单板信息提交失败!'))