예제 #1
0
def GetTable(request):
    if request.method == 'GET':
        reqDict = request.GET
    elif request.method == 'POST':
        reqDict = request.POST
    reportParams = ast.literal_eval(reqDict["reportParams"])
    lg = Logic('Production')
    tData = lg.GetTable(reportParams)
    # print lg
    return Response({"tData": tData})
예제 #2
0
def GetTrend(request):
    if request.method == 'GET':
        reqDict = request.GET
    elif request.method == 'POST':
        reqDict = request.POST
    reportParams = ast.literal_eval(reqDict["reportParams"])
    # print "sssssssssssssssssssssssssss",reportParams,"###################"
    lg = Logic('Production')
    gData = lg.GetGraph(reportParams)
    # print gData,"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"

    return Response({"gData": gData})
예제 #3
0
def SetShift(request):
    lg = Logic('Production')
    st = datetime.today()
    if request.method == 'GET':
        reqDict = request.GET
    elif request.method == 'POST':
        reqDict = request.POST
    sList = json.loads(reqDict.get("sList"))
    assert sList is not None, "sList not set"
    #sessionDataObj = {}
    #sessionDataObj['production'] = request.user.username.split('@')[-1].split('.')[0]
    #lg = Logic(sessionDataObj["production"])
    lg.SetShift(sList)
    clitaLogger.info("Time : Set Shift...  %s" %
                     ((datetime.today() - st).seconds))
    return Response({"response": "ok"})
예제 #4
0
def GetCurrentShift(request):
    lg = Logic('Production')
    sessionDataObj = {}
    st = datetime.today()
    sessionDataObj['Production'] = request.user.username.split('@')[-1].split(
        '.')[0]
    useremail = request.user.username
    cls = checkListStatus.CheckListStatus(sessionDataObj['Production'])
    dsDict = cls.GetNumberOfShifts(useremail, st)
    return Response(dsDict)
예제 #5
0
def GetShifts(request):
    lg = Logic('Production')
    # print lg
    st = datetime.today()
    sessionDataObj = {}
    #if not request.session.session_key:
    #request.session.save()
    #sessionDataObj['production'] = request.user.username.split('@')[-1].split('.')[0]
    #print sessionDataObj['production']
    #lg = Logic(sessionDataObj["production"])

    dbh = mongoConnector.MongoConnector.getInstance()
    #lg = Logic(sessionDataObj["production"])
    dsDict, sList = lg.getDateShift(dbh)
    if sList:
        return Response(sList[0]["sList"])
    clitaLogger.info("Time : Get Shift...  %s" %
                     ((datetime.today() - st).seconds))
    return Response(sList)
예제 #6
0
def GetMachinesList(request):
    lg = Logic('Production')

    MData = lg.GetMachinesList()
    return Response({"machines": MData})
예제 #7
0
def GetMachines(request):
    lg = Logic('Production')

    tData = lg.GetMachines()
    return Response({"machines": tData})