def endPT(request): content_header = "Finish" eID = request.GET['eID'] planID = request.GET['pID'] today = todayDate() is_enable_leftbutton = True is_enable_rightbutton = True plan = FakeStatusTracking.objects.get(plan_id = planID) amount = str(plan.plan_amount) task = "end" at = "PT" current_date_time = todayDate() product_code = plan.product_id productCat = ProductCatalog.objects.get(product_code = product_code) color = productCat.rope_color cv_machine = productCat.next_process speed = getCVSpeed(cv_machine) product_name = productCat.product_name partner = productCat.cname product = Products.objects.get(product_code = product_code) amount = plan.plan_amount pID = planID title = "Finished "+product_code+" in pad /partition" return render_to_response('PT/updateEndCV.html',locals())
def endWH(request): content_header = "Out" eID = request.GET['eID'] planID = request.GET['pID'] today = todayDate() is_enable_leftbutton = True is_enable_rightbutton = True plan = FakeStatusTracking.objects.get(plan_id = planID) amount = str(plan.plan_amount) task = "end" at = "WH" current_date_time = todayDate() pID = planID return render_to_response('updateEndWH.html',locals())
def workCV(eID,title): is_enable_leftbutton = True is_enable_rightbutton = True today = todayDate() #create items for CV if(currentProcess("3CS")=='idle'): cvThreeCS = 'idle' else: cvThreeCS = str(currentProcess("3CS"))[2:8] if(currentProcess("3CL")=='idle'): cvThreeCL = 'idle' else: cvThreeCL = str(currentProcess("3CL"))[2:8] if(currentProcess("2CL")=='idle'): cvTwoCL = 'idle' else: cvTwoCL = str(currentProcess("2CL"))[2:8] if(currentProcess("3CW")=='idle'): cvThreeCW = 'idle' else: cvThreeCW = str(currentProcess("3CW"))[2:8] if(currentProcess("2CS")=='idle'): cvTwoCS = 'idle' else: cvTwoCS = str(currentProcess("2CS"))[2:8] item_plan = FakeStatusTracking.objects.filter(plan_cv_start__year=today.year, plan_cv_start__month=today.month, plan_cv_start__day=today.day).values_list("plan_id","plan_cv_start", "plan_cv_end", "product_id", "actual_cv_start", "actual_cv_end", "cv_machine", "process1","process3","process4").order_by('plan_cv_start') items = list(item_plan) return render_to_response('CV/listCV.html', locals())
def showGM(eID,title): is_enable_leftbutton = True is_enable_rightbutton = True today= todayDate() showGM_items = FakeStatusTracking.objects.filter(plan_cr_start__year= today.year, plan_cr_start__month=today.month, plan_cr_start__day=today.day).values_list("product_id","plan_amount","actual_amount_cr","plan_cr_start","actual_amount_cv","plan_cv_start","actual_amount_pt","plan_pt_start","actual_amount_wh","plan_wh_start","plan_due") content_header = "Please select product item in order to view realtime progress" return render_to_response('GM/GM.html',locals())
def endUpdate(request): current_time = todayDate() eID = request.GET['eID'] task = request.GET['task'] at = request.GET['at'] amount = request.GET['amount'] pID = request.GET['pID'] obj = FakeStatusTracking.objects.get(plan_id=pID) if (at=="CR"): obj.actual_cr_end = current_time obj.actual_amount_cr = amount obj.save() path = "/likitomi/home/?eID="+eID+"&Enter=Enter" return HttpResponseRedirect(path) elif (at=="CV"): obj.actual_cv_end = current_time obj.actual_amount_cv = amount obj.save() path = "/likitomi/home/?eID="+eID+"&Enter=Enter" return HttpResponseRedirect(path) elif (at=="PT"): obj.actual_pt_end = current_time obj.actual_amount_pt = amount obj.save() path = "/likitomi/home/?eID="+eID+"&Enter=Enter" return HttpResponseRedirect(path) elif (at=="WH"): obj.actual_wh_start = current_time obj.actual_amount_wh = amount obj.save() path = "/likitomi/home/?eID="+eID+"&Enter=Enter" return HttpResponseRedirect(path) else: return render_to_response('update.html', locals())
def section(request): eID = request.GET['eID'] today = todayDate() temp_contents = '' title = str(today) is_enable_table = True is_enable_desktop = True employee = Employee.objects.get(eid=eID) page = employee.task #section_title = employee.lastname section_title = "Homepage for " + employee.task + " Login as " + employee.firstname + " " + employee.lastname if(page == "PC"): return showPC(eID,section_title) if(page == "GM"): return showGM(eID,section_title) if(page == "CR"): return workCR(eID,section_title) if(page == "CV"): return workCV(eID,section_title) if(page == "PT"): return workPT(eID,section_title) if(page == "WH"): return workWH(eID,section_title) return render_to_response('home.html', locals())
def workPT(eID,title): is_enable_leftbutton = True is_enable_rightbutton = True #create items for PT today = todayDate() pt = str(currentTimeProcess("PT")) item_plan = FakeStatusTracking.objects.filter(plan_pt_start__year=today.year, plan_pt_start__month=today.month, plan_pt_start__day=today.day).values_list("plan_id","plan_pt_start", "plan_pt_end", "product_id", "actual_pt_start", "actual_pt_end","process2","process4").order_by('plan_pt_start') items = list(item_plan) return render_to_response('PT/listPT.html', locals())
def workWH(eID,title): is_enable_leftbutton = True is_enable_rightbutton = True today = todayDate() #create items for WH wh = currentTimeProcess("WH") item_plan = FakeStatusTracking.objects.filter(plan_wh_start__year=today.year, plan_wh_start__month=today.month, plan_wh_start__day=today.day).values_list("plan_id","plan_wh_start", "product_id","actual_wh_start","process1","process2","process3").order_by('plan_wh_start') items = list(item_plan) return render_to_response('WH/listWH.html',locals())
def endCR(request): content_header = "Finish" eID = request.GET['eID'] planID = request.GET['pID'] today = todayDate() is_enable_leftbutton = True is_enable_rightbutton = True ### plan = FakeStatusTracking.objects.get(plan_id = planID ) product_code = plan.product_id productCat = ProductCatalog.objects.get(product_code = product_code) product_name = productCat.product_name cname = productCat.cname product = Products.objects.get(product_code = product_code) flute = product.flute df = product.df bm = product.bm bl = product.bl cm = product.cm cl = product.cl width_mm = product.width_mm length_mm = product.length_mm cut = productCat.cut blank = productCat.blank slit = productCat.slit scoreline = productCat.scoreline_d next_process = productCat.next_process amount = plan.plan_amount task = "start" at = "CR" current_date_time = todayDate() pID = planID #product = ProductCatalog.objects.filter(product_code= product_id) #product_name = product.product_name #product = list(ProductCatalog.objects.all()) title = "Finished "+product_code+" in corrugator" ### task = "end" at = "CR" current_date_time = todayDate() pID = planID return render_to_response('CR/updateEndCR.html',locals())
def showCR(eid,section_title): today = todayDate() is_enable_leftbutton = True is_enable_rightbutton = True title = "View corrugator plan" eID = eid #create items for CR cr = str(currentProcess("CR"))[2:8] item_plan = FakeStatusTracking.objects.filter(plan_cr_start__year=today.year, plan_cr_start__month=today.month, plan_cr_start__day=today.day).values_list("plan_cr_start", "plan_cr_end", "product_id", "actual_cr_start", "actual_cr_end").order_by('plan_cr_start') items = list(item_plan) return render_to_response('PC/CR.html', locals())
def startWH(request): content_header = "In" eID = request.GET['eID'] planID = request.GET['pID'] plan = FakeStatusTracking.objects.get(plan_id = planID) amount = str(plan.plan_amount) today = todayDate() is_enable_leftbutton = True is_enable_rightbutton = True plan = FakeStatusTracking.objects.get(plan_id = planID) product_code = plan.product_id productCat = ProductCatalog.objects.get(product_code = product_code) product_name = productCat.product_name cname = productCat.cname product = Products.objects.get(product_code = product_code) amount = str(plan.plan_amount) pID = planID current_date_time = todayDate() task = "start" at = "WH" title = "Finished "+product_code+" warehouse" return render_to_response('WH/updateStartWH.html',locals())
def showCV(eid,section_title): today = todayDate() is_enable_leftbutton = True is_enable_rightbutton = True title = "View convertor plan" eID = eid #create items for CV cvThreeCL = str(currentProcess("3CL"))[2:8] cvTwoCL = str(currentProcess("2CL"))[2:8] cvThreeCS = str(currentProcess("3CS"))[2:8] item_plan = FakeStatusTracking.objects.filter(plan_cv_start__year=today.year, plan_cv_start__month=today.month, plan_cv_start__day=today.day).values_list("plan_cv_start", "plan_cv_end", "product_id", "actual_cv_start", "actual_cv_end", "cv_machine", "process1","process3","process4").order_by('plan_cv_start') items = list(item_plan) return render_to_response('PC/CV.html', locals())
def workCR(eID,title): is_enable_leftbutton = True is_enable_rightbutton = True eID = eID today = todayDate() #create items for CR if(currentProcess("CR")=='idle'): cr = 'idle' else: cr = str(currentProcess("CR"))[2:8] #temp_contents = cr item_plan = FakeStatusTracking.objects.filter(plan_cr_start__year=today.year, plan_cr_start__month=today.month, plan_cr_start__day=today.day).values_list("plan_id","plan_cr_start", "plan_cr_end", "product_id", "actual_cr_start", "actual_cr_end").order_by('plan_cr_start') items = list(item_plan) x = '' return render_to_response('CR/listCR.html', locals())
def startCV(request): content_header = "Load" eID = request.GET['eID'] planID = request.GET['pID'] today = todayDate() is_enable_leftbutton = True is_enable_rightbutton = True plan = FakeStatusTracking.objects.get(plan_id = planID) product_code = plan.product_id productCat = ProductCatalog.objects.get(product_code = product_code) color = productCat.rope_color cv_machine = productCat.next_process speed = getCVSpeed(cv_machine) product_name = productCat.product_name partner = productCat.cname product = Products.objects.get(product_code = product_code) amount = plan.plan_amount pID = planID current_date_time = todayDate() task = "start" at = "CV" title = "starting "+product_code+" in convertor" return render_to_response('CV/updateStartCV.html',locals())
def pcdetail(request): eID = request.GET['eID'] page =request.GET['page'] today = todayDate() title = str(today) is_enable_table = True is_enable_desktop = True employee = Employee.objects.get(eid=eID) section_title = "Homepage for " + page + " Login as " + employee.firstname + " " + employee.lastname if(page == "CR"): return showCR(eID,section_title) if(page == "CV"): return showCV(eID,section_title) if(page == "PT"): return showPT(eID,section_title) if(page == "WH"): return showWH(eID,section_title) return render_to_response('home.html', locals())
def machine_list(request): today = todayDate() machine = request.GET['machine'] eID = request.GET['eID'] is_enable_leftbutton = True is_enable_rightbutton = True #create items for CV if(machine == "3CL"): cvThreeCL = str(currentProcess("3CL"))[2:8] if(machine == "2CL"): cvTwoCL = str(currentProcess("2CL"))[2:8] if(machine == "3CS"): cvThreeCS = str(currentProcess("3CS"))[2:8] if(machine == "2CS"): cvTwoCS = str(currentProcess("2CS"))[2:8] if(machine == "3CW"): cvThreeCW = str(currentProcess("3CW"))[2:8] item_plan = FakeStatusTracking.objects.filter(plan_cv_start__year=today.year, plan_cv_start__month=today.month, plan_cv_start__day=today.day).filter(cv_machine=machine).values_list("plan_id","plan_cv_start", "plan_cv_end", "product_id", "actual_cv_start", "actual_cv_end", "cv_machine", "previous_section").order_by('plan_cv_start') items = list(item_plan) return render_to_response('machine.html', locals())
def showPC(eID,title): today = todayDate() page = "PC" is_enable_leftbutton = True is_enable_rightbutton = True #create items for PC #extra = db_type(FakeStatusTracking.objects.all()) item_plan_cr = FakeStatusTracking.objects.filter(plan_cr_start__year= today.year, plan_cr_start__month=today.month, plan_cr_start__day=today.day).values_list("plan_cr_start","plan_cr_end","product_id","actual_cr_start","actual_cr_end","days_left","plan_amount","actual_amount_cr").order_by('plan_cr_start') #temp_contents = extra[0].days_left #item_plan_cr = FakeStatusTracking.objects.filter(plan_cr_start__year= today.year, plan_cr_start__month=today.month, plan_cr_start__day=today.day).values_list("plan_cr_start","plan_cr_end","product_id","actual_cr_start","actual_cr_end").order_by('plan_cr_start') #item_plan_cr = FakeStatusTracking.objects.filter(plan_cr_start__year= item_plan_cv = FakeStatusTracking.objects.filter(plan_cv_start__year=today.year, plan_cv_start__month=today.month, plan_cv_start__day=today.day).values_list("plan_cv_start", "plan_cv_end", "product_id", "actual_cv_start", "actual_cv_end", "cv_machine","process1","plan_due").order_by('plan_cv_start') item_plan_pt = FakeStatusTracking.objects.filter(plan_pt_start__year=today.year, plan_pt_start__month=today.month, plan_pt_start__day=today.day).values_list("plan_pt_start", "plan_pt_end", "product_id", "actual_pt_start", "actual_pt_end","process2","plan_due").order_by('plan_pt_start') #bug here ordering (also in utility line67) item_plan_wh = FakeStatusTracking.objects.filter(plan_wh_start__year=today.year, plan_wh_start__month=today.month, plan_wh_start__day=today.day).values_list("plan_wh_start", "product_id","actual_wh_start","process1","process2","process3","plan_due").order_by('plan_wh_start') items_plan_cr = list(item_plan_cr) items_plan_cv = list(item_plan_cv) items_plan_pt = list(item_plan_pt) items_plan_wh = list (item_plan_wh) cr = currentTimeProcess("CR") cv = currentTimeProcess("CV") cvThreeCS = currentTimeProcess("3CS") cvThreeCL = currentTimeProcess("3CL") cvTwoCL = currentTimeProcess("2CL") cvThreeCW = currentTimeProcess("3CW") cvTwoCS = currentTimeProcess("2CS") pt = currentTimeProcess("PT") wh = currentTimeProcess("WH") currentTimeProcess("WH") #prepare list for CR size = len(items_plan_cr) if(currentProcess("CR")!='idle'): pos = positionOfCurrentProcess("CR",currentProcess("CR")[0][0:8]) else : pos = size #temp_contents = currentProcess("CV") startList = returnStartingPoint(pos,size) endList = startList+getPCItemNum() items_plan_cr=items_plan_cr[startList:endList] #prepare list for CV size = len(items_plan_cv) pos = positionOfCurrentProcess("CV",currentProcess("CV")[0][0:8]) startList = returnStartingPoint(pos,size) endList = startList+getPCItemNum() items_plan_cv=items_plan_cv[startList:endList] #prepare list for PT size = len(items_plan_pt) pos = positionOfCurrentProcess("PT",currentProcess("PT")[0][0:8]) startList = returnStartingPoint(pos,size) endList = startList+getPCItemNum() items_plan_pt=items_plan_pt[startList:endList] #prepare list for WH size = len(items_plan_wh) #pos =currentProcess("WH")[0][0] #temp_contents = currentProcess("WH")[0][0] pos = positionOfCurrentProcess("WH",currentProcess("WH")[0][0]) startList = returnStartingPoint(pos,size) endList = startList+getPCItemNum() items_plan_wh=items_plan_wh[startList:endList] #temp_contents = currentProcess("2CL") return render_to_response('PC/view.html', locals())