Esempio n. 1
0
def getLine(model, name, process, datatype_Id, str_JIG, str_PROCESS, JIG_type, PROCESS_type, limit):
    start_time, end_time = getStart_End_time()
    database = models_common.get_config("database")
    result = []
    dataListResult, dataList = getDataList(model, name, process,datatype_Id,limit,JIG_type)
    for item in database:
        if item["MODEL"] == model:
            line = item["LINE"]
            JIG = str_JIG.split(',')
            PROCESS = str_PROCESS.split(',')
            JIG_COUNT = []
            IN_COUNT = []
            YIELD = []
            green = []
            yellow = []
            red = []
            JIG_Result, IN_Result = models_common.getJIG_NGByLine(model, process, limit, start_time, end_time)
            num = 0
            for i in line:
                sum_green = 0
                sum_yellow = 0
                sum_red = 0
                flag = True
                count_jig = JIG_Result[num]
                count_in = IN_Result[num]
                for j in dataListResult:
                    if i == j["line_cd"]:
                        if j["ng_count"] < int(JIG[0]):
                            # sum_green = sum_green + j["ng_count"]
                            sum_green = sum_green + 1
                        if j["ng_count"] >= int(JIG[0]) and j["ng_count"] < int(JIG[1]):
                            # sum_yellow = sum_yellow + j["ng_count"]
                            sum_yellow = sum_yellow + 1
                        if j["ng_count"] >= int(JIG[1]):
                            # sum_red = sum_red + j["ng_count"]
                            sum_red = sum_red + 1
                        flag = False
                if flag:
                    sum_green = 0
                    sum_yellow = 0
                    sum_red = 0
                green.append(sum_green)
                yellow.append(sum_yellow)
                red.append(sum_red)
                if count_in == 0:
                    Yield = 0
                else:
                    Yield = int((count_in - count_jig) / count_in * 100)
                JIG_COUNT.append(count_jig)
                IN_COUNT.append(count_in)
                YIELD.append(Yield)
                num = num + 1
            result.append(
                {"line": line, "JIG_COUNT": JIG_COUNT, "IN_COUNT": IN_COUNT, "YIELD": YIELD, "JIG": JIG,
                 "PROCESS_YIELD": PROCESS, "INTERVAL": models_common.get_config("hour_interval"),
                 "GREEN": green, "YELLOW": yellow, "RED": red, "DATALIST": dataListResult,"DATALIST_all":dataList, "start_time": start_time,
                 "end_time": end_time,'JIG_type':JIG_type,'PROCESS_type':PROCESS_type})
    return result
Esempio n. 2
0
def time_interval(request):
    Logger.write_log("获取刷新时间")
    result = []
    database = models_common.get_config("database")
    model_name = database[0]['MODEL']
    timepart = models_common.get_config('time_interval')
    datestr = time.strftime('%Y-%m-%d', time.localtime(time.time()))
    result.append({
        'time': timepart,
        'model_name': model_name,
        'datetime': datestr
    })
    jsonstr = json.dumps(result)
    return HttpResponse(jsonstr)
Esempio n. 3
0
def getInspectFromConf(model_name, process_cd):
    INSPECT = []
    database_list = models_common.get_config("database")
    for item in database_list:
        if item["MODEL"] == model_name:
            for dataItem in item["DATA"]:
                if dataItem["PROCESS"] == process_cd:
                    INSPECT = dataItem["INSPECT"]
                    break
    return INSPECT
Esempio n. 4
0
def getDataList(model_name, process_cd, datatype_id, firstFlg=False):
    now = datetime.datetime.now()
    end_time = now.strftime("%Y-%m-%d %H:%M:%S")
    hour_interval = models_common.get_config("hour_interval")
    start_time = (
        now +
        datetime.timedelta(hours=-hour_interval)).strftime("%Y-%m-%d %H:%M:%S")
    # start_time = '2017-08-10 15:07:49.670181'
    result = models_common.getDetailList(model_name, process_cd, datatype_id,
                                         start_time, end_time, firstFlg)
    return result
Esempio n. 5
0
def get_models():
    database = models_common.get_config("database")
    result = []
    flag = True
    for item in database:
        if (flag):
            model_name = item["MODEL"]
            process_cd = item["PROCESS"][0]
            datatype_id = item["DATA_TYPE"][0]
            flag = False
        line_counts = getDataList(model_name, process_cd, datatype_id, True)
        if line_counts == 101 or line_counts == 102:
            return line_counts
        process = []
        data_type = []
        line = []
        counts = []
        for processItem in item["PROCESS"]:
            process.append(processItem)
        for data_typeItem in item["DATA_TYPE"]:
            data_type.append(data_typeItem)
        for lineItem in item["LINE"]:
            num = 0
            line.append(lineItem)
            for line_id in line_counts:
                if (line_id['line_cd'] == lineItem):
                    num = line_id['ng_count']
            counts.append(num)
        result.append({
            'model': item["MODEL"],
            'process': process,
            'data_type': data_type,
            'line': line
        })
    ng_rgb = models_common.get_config("NG_RGB")
    result.append({'ng_rgb': ng_rgb})
    result.append({'count': counts})
    return result
Esempio n. 6
0
def initConfig():
    try:
        database = models_common.get_config("database")
        result = []
        model = database[0]["MODEL"]
        process = model_setting.get_process(model)[0]
        dataType = model_setting.get_datatype(model, process)
        result.append({"model": model})
        result.append({"process": process})
        result.append({"dataType": dataType})
        return result
    except BaseException as exp:
        result = [{'status': 'fail','msg':'Please config setting first'}]
        return result
Esempio n. 7
0
def get_all_line_count(model_name, process_cd, datatype_id):
    database = models_common.get_config("database")
    counts = []
    for item in database:
        if (item["MODEL"] == model_name):
            line_counts = getDataList(model_name, process_cd, datatype_id,
                                      True)
            for lineItem in item["LINE"]:
                num = 0
                for line_id in line_counts:
                    if (line_id['line_cd'] == lineItem):
                        num = line_id['ng_count']
                counts.append(num)
    return counts
Esempio n. 8
0
def get_all_models():
    models = models_common.get_config('BDP')
    # test_list = []
    # qw_list = []
    # jp_list = []
    # cn_list = []
    # for item in models:
    #     if(item["MODEL"] == "QW"):
    #         qw_list = item["CASE"]
    #     if (item["MODEL"] == "JP"):
    #         jp_list = item["CASE"]
    #     if (item["MODEL"] == "CN"):
    #         cn_list = item["CASE"]
    return models
Esempio n. 9
0
def get_all_line_count(model_name, process_cd, datatype_id):
    database = models_common.get_config("database")
    counts = []
    for item in database:
        if item["MODEL"] == model_name:
            for dataItem in item["DATA"]:
                if dataItem["PROCESS"] == process_cd:
                    type = dataItem["TYPE"]
                    break
    for item in database:
        if item["MODEL"] == model_name:
            line_counts = getDataList(model_name, process_cd, datatype_id, True)
            for lineItem in item["LINE"]:
                num = 0
                for line_id in line_counts:
                    if line_id['line_cd'] == lineItem:
                        if type == "NG COUNT":
                            num = line_id['ng_count']
                counts.append(num)
    return counts
Esempio n. 10
0
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os
import time
import logging
import django.utils.log
import logging.handlers
from RtMonSys.models import models_common

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
database = models_common.get_config("database")

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '7a^x(fj+n*zet1z#d#@m=3@1pb4z0ihm8&knmtc_o%)!z$m)wx'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']

# Application definition

INSTALLED_APPS = [
Esempio n. 11
0
def getStart_End_time():
    now = datetime.datetime.now()
    end_time = now.strftime("%Y-%m-%d %H:%M:%S")
    hour_interval = models_common.get_config("hour_interval")
    start_time = (now + datetime.timedelta(hours=-hour_interval)).strftime("%Y-%m-%d %H:%M:%S")
    return start_time,end_time
Esempio n. 12
0
def auto_updating():
    auto_update = models_common.get_config("auto_updating")
    return auto_update