Beispiel #1
0
def returnStartingPoint(pos,length):
	limit = getPCItemNum()
	if pos == -2:
		return length-limit
	elif pos < limit:
		return 0
	elif pos > length - 4:
		return length-limit
	else :
		return pos-limit/2
Beispiel #2
0
def showPC(eID,section_title):
	today = todayDate()
	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").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.html', locals())