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})
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})
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"})
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)
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)
def GetMachinesList(request): lg = Logic('Production') MData = lg.GetMachinesList() return Response({"machines": MData})
def GetMachines(request): lg = Logic('Production') tData = lg.GetMachines() return Response({"machines": tData})