Ejemplo n.º 1
0
 def __init__(self, name, die_x, die_y):
     self.name = name
     self.die_x = die_x
     self.die_y = die_y
     self.db_epi = dbConn('epi', 'epi', 'epi')
     self.db_db = dbConn('pd', 'test', 'DB00')
     self.epi_mask_id = self.get_epi_mask_id()
Ejemplo n.º 2
0
 def addLog(self, order_no, d_dict, l_type):
     content = json.dumps(d_dict)
     ctime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
     log_params = [order_no, content, l_type, ctime]
     if (not order_no):
         return False
     sql = 'insert into comm_payment.app_logs (`order_no`, `content`, `type`, ctime) values(%s,%s,%s,%s)'
     res = dbConn().insertUpdate(sql, log_params)
     return dbConn().getLastId()
Ejemplo n.º 3
0
 def __init__(self,
              wafer_list,
              rot_list=[
                  'TGR-491-1-A', 'TGR-491-4-A', 'TGR-491-11-A',
                  'TGR-491-12-A', 'TGR-491-13-A'
              ],
              rot=45):
     self.wafer_list = wafer_list
     self.rot_list = rot_list
     self.theta = -rot * math.pi / 180
     self.dbPD = dbConn('pd', 'test', 'pd')
     self.dbEpi = dbConn('epi', 'epi', 'epi')
Ejemplo n.º 4
0
    def notifyOrder(self, order_no):
        if not order_no:
            return False
        db_con = dbConn()
        sql = 'select * from comm_payment.app_order where order_no=%s limit 1'
        order_info = db_con.getFetchOne(sql, [order_no])
        if (not order_info):
            return False

        if (order_info['is_notify'] == self.is_notify_success):
            return self.notify_return

        if (not order_info['notify_url']):
            return False

        # jn = ','
        # jn = jn.join(self.return_params)

        sql = 'select * from comm_payment.app_type where id=%s limit 1'
        id_config = db_con.getFetchOne(sql, [order_info['app_type_id']])
        key = id_config['sign_key']

        return_params = {}
        for x in self.return_params:
            return_params[x] = order_info[x]

        s = self.getSignContent(return_params)
        return_params['sign'] = self.makeSign(s, key)
        data = parse.urlencode(return_params).encode('utf-8')
        try:
            f = request.urlopen(order_info['notify_url'], data)
        except Exception as err:
            print(err)
            return False
        return f.read().decode('utf-8')
Ejemplo n.º 5
0
 def __init__(self, mask_name, mask_type):
     self.mask_name = mask_name
     self.mask_type = mask_type
     if mask_type.lower() == 'eel' or mask_type.lower == 'eel':
         schema = 'laser'
     elif mask_type.lower() == 'pd':
         schema = 'test'
     self.db = dbConn('db00', schema, 'db00')
     return
Ejemplo n.º 6
0
def getFieldNames(table):
    """
    Pre:    conn     - database connection
            table    - the table being queried

    Post:   Returns the field names of table
    """
    conn = dbConn.dbConn()
    cur = conn.cursor()
    cur.execute("DESC %s" %(table))
    rows = cur.fetchall()
    names = [r[0] for r in rows]
    cur.close()
    conn.close()
    return names
Ejemplo n.º 7
0
def getColumns(table, cols):
    """
    Pre:    conn     - database connection
            table    - the table being queried
            cols     - list of columns to be selected

    Post:   Returns the columns of the fields selected
    """
    conn = dbConn.dbConn()
    cur = conn.cursor()
    cur.execute("SELECT %s FROM %s" %(', '.join(cols), table))
    t = cur.fetchall()
    cur.close()
    conn.close()
    return [list(l) for l in t ]
Ejemplo n.º 8
0
def showTable(table):
    """
    Pre:    conn     - database connection
            table    - table to be inserted into

    Post:   Returns the tables rows as a list of tuples
    """
    conn = dbConn.dbConn()
    cur = conn.cursor()
    sql = "SELECT * FROM %s" % (table)
    print sql + ';'
    cur.execute(sql)
    t = cur.fetchall()
    cur.close()
    conn.close()
    return [list(l) for l in t]
Ejemplo n.º 9
0
def selectFrom(table, cols):
    """
    Pre:    conn     - database connection
            table    - table to be inserted into
            cols     - list of columns to be selected
            conds    - conditions for rows to be selected

    Post:   Returns the tables rows as a list of tuples
    """
    conn = dbConn.dbConn()
    cur = conn.cursor()
    sql = "SELECT %s FROM %s" % (', '.join(cols), table)
    print sql
    cur.execute(sql)
    t = cur.fetchall()
    cur.close()
    conn.close()
    return [ list(l) for l in t ]
Ejemplo n.º 10
0
def deleteTuple(table, conds):
    """
    Pre:    conn     - database connection
            table    - table to be inserted into
            conds    - conditions for rows to be deleted

    Post:   Deletes row(s) from table
    """
    conn = dbConn.dbConn()
    sql = "DELETE FROM %s WHERE %s" % (table, str(conds))
    print sql + ';'
    cur = conn.cursor()
    try:
        cur.execute(sql)
        conn.commit()
    except:
        conn.rollback()
        print("Query Failed: " + sql)
    cur.close()
    conn.close()
Ejemplo n.º 11
0
def insertTuple(table, row):
    """
    Pre:    conn     - database connection
            table    - table to be inserted into
            row      - tuple to be inserted

    Post:   Inserts row into table
    """
    conn = dbConn.dbConn()
    sql = "INSERT INTO %s VALUE %s" % (table, str(row))
    print sql + ';'
    cur = conn.cursor()
    try:
        cur.execute(sql)
        conn.commit()
    except:
        conn.rollback()
        print("Query Failed: " + sql)
    cur.close()
    conn.close()
Ejemplo n.º 12
0
def usw(table, settings, conds):
    """
    Pre:    conn     - database connection
            table    - table to be inserted into
            settings - values to be set
            conds    - conditions for rows to be updated

    Post:   Deletes row(s) from table
    """
    conn = dbConn.dbConn()
    sql = "UPDATE %s SET %s WHERE %s" % (table, settings, conds)
    print sql + ';'
    cur = conn.cursor()
    try:
        cur.execute(sql)
        conn.commit()
    except:
        conn.rollback()
        print("Query Failed: " + sql)
    cur.close()
    conn.close()
Ejemplo n.º 13
0
def get_lot_stage(days=30):
    db = dbConn('epi','epi','epi')
    sql = """select ms.category, ms.name as manufacturing_stage, p.sales_order_number as project,
    l.name as lot_name, w.wafer_name,
    concat(w.ingot_number, "-", w.substrate_sn) as scribe, w.structure_name,
    m.device_mask, 
    date(max(me.date)) as last_event_date, datediff(NOW(), date(max(me.date))) as days_since_last_event
    from epi.manufacturing_lot l 
    inner join epi.manufacturing_lot_wafer lw on l.id= lw.lot_id
    inner join epi.epi_wafer w on lw.wafer_id = w.wafer_id
    left join epi.epi_device_mask m on w.device_mask_id = m.device_mask_id
    left join epi.manufacturing_stage ms on w.manufacturing_stage_id = ms.id
    inner join epi.manufacturing_event_log me on w.wafer_id = me.wafer_id
    left join epi.production_order_wafers pw on pw.wafer_name = w.wafer_name
    left join epi.production_orders p on p.id = pw.production_order_id
    where ms.category in ('Back-Fab','Front-Fab','Test')
    and ms.id not in ('0221','0222','0223','0480','0490','0495')"""
    sql = sql + "\r\n" + "and me.date BETWEEN NOW() - INTERVAL " + str(int(days)) + " DAY AND NOW()\r\n"
    sql = sql + "group by w.wafer_id\r\n" + "order by ms.id"
    #print (sql)
    df = db.getDF_bySQL(sql)
    return df
Ejemplo n.º 14
0
# -*- coding: utf-8 -*-
"""
Created on Wed Oct  2 09:58:49 2019
upload PL for all the tested pd wafers
@author: dding
"""

from dbConn import dbConn
from pdPL import pdPL

dbPD = dbConn('pd', 'test', 'pd')
dbEpi = dbConn('epi', 'epi', 'epi')

lot = 'SJC_ENG_432_4-GaAs'
_, wafer_lst, _ = dbEpi.getWaferList_byLotName(lot)
pl = pdPL(wafer_lst)
pl.process()
Ejemplo n.º 15
0
 def get_epi_mask_id(self):
     dbEpi = dbConn('epi', 'epi', 'epi')
     epi_mask_id = dbEpi.getDF_byUniqueName('epi_device_mask',
                                            'device_mask_id', 'device_mask',
                                            self.mask_name)
     return epi_mask_id
Ejemplo n.º 16
0
 def update(self, order_no, is_notify, notify_time):
     if (not order_no):
         return False
     sql = 'update comm_payment.app_order set is_notify=%s, notify_time=%s where order_no=%s limit 1'
     res = dbConn().insertUpdate(sql, [is_notify, notify_time, order_no])
     return res
Ejemplo n.º 17
0
 def __init__(self, isPulse=True):
     self.isPulse = isPulse
     self.db = dbConn('db00', 'laser', 'db00')
     return
Ejemplo n.º 18
0
 def __init__(self, folders):
     self.folders = folders
     self.dbEpi = dbConn('epi', 'epi', 'epi')
     self.dbPD = dbConn('pd', 'test', 'pd')
     self.dbLS = dbConn('laser', 'laser', 'db00')
     return
Ejemplo n.º 19
0
 def __init__(self, mask_name, device_type):
     self.mask_name = mask_name
     self.device_type = device_type
     self.db_el = dbConn('el', 'laser', 'el')
Ejemplo n.º 20
0
from dbConn import dbConn
import pandas as pd


def get_device_list(devices):
    d_list = "("
    for index, row in devices.iterrows():
        d_list = d_list + str(row['device_id']) + ","
    d_list = d_list[:-1] + ")"
    return d_list


if __name__ == "__main__":
    #get all the wafer_id list
    time_period = "'2020-02-01' and '2020-03-16'"
    db0 = dbConn('epi', 'epi', 'epi')
    db1 = dbConn('db', 'laser', 'db00')
    sql = 'SELECT distinct wafer_id FROM laser.eel_device'
    df = db1.getDF_bySQL(sql)
    for index, row in df.iterrows():

        wafer_id = row['wafer_id']
        wafer_name = db0.getWaferName_byWaferID(wafer_id)
        sql1 = 'select distinct v.label_name, date(v.test_time) as test_date\r\n' + \
        'from v_eel_pliv_internal v\r\n' + \
        'where v.wafer_id = ' + str(wafer_id) +'\r\n' + \
        'and v.test_time between ' + time_period + ";"
        temp = db1.getDF_bySQL(sql1)
        n = len(temp)
        if index == 0:
            df_out = pd.DataFrame({
Ejemplo n.º 21
0
        sys_time = int(time.time())
        if (int(count) > max_counts):
            queModel().getInstance().addLog(order_no, {
                'line': sys._getframe().f_lineno,
                'order_str': order_str
            }, 'cmd_moreMax')
        else:
            if (count not in secodes.keys()):
                continue

            if (sys_time - pay_time >= secodes[count]):
                try:
                    result = apiModel().getInstance().notifyOrder(order_no)

                except Exception as e:
                    dbConn().clear(e)
                    result = apiModel().getInstance().notifyOrder(order_no)

                if (result != apiModel().getInstance().notify_return):
                    res = queModel().getInstance().repushQueue(
                        order_no, pay_time,
                        int(count) + 1)
                    queModel().getInstance().lrem(redis_des_key, 1,
                                                  des_key_value)
                    if (not res):
                        queModel().getInstance().addLog(
                            order_no, {
                                'line': sys._getframe().f_lineno,
                                'order_str': order_str
                            }, 'cmdRepushFail')
Ejemplo n.º 22
0
 def __init__(self, folder):
     self.folders = folders
     #self.dbEpi = dbConn('epi','epi','epi')
     self.dbPD = dbConn('pd', 'test', 'pd')