Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DateFIF = ['06:30:00','07:01:00' ,'08:01:00', '09:01:00','10:01:00','10:31:00','11:31:00','12:01:00','13:01:00','14:01:00','15:01:00','16:01:00']
- DateFEF = ['07:00:00','08:00:00', '09:00:00','10:00:00','10:30:00','11:30:00','12:00:00','13:00:00','14:00:00','15:00:00','16:00:00','17:00:00']
- almaHrs = [0 for i in range(12)] #ARREGLO CON MIS 12 CEROS
- almaPQ = [0 for i in range(12)]
- almaRQ = [0 for i in range(12)]
- dateNow = datetime.now()
- datos = []
- start = request.POST.get('startDate')
- end = request.POST.get('endDate')
- sistemDI = request.POST.get('sistemDI')
- print "Soy comienzo",start
- print "Soy fin",end
- print "Soy sistema",sistemDI
- planned = sJobPlanned.objects.filter(Q(PlannedStartDateTime__date=start)|Q(PlannedEndDateTime__date=end),SystemID=sistemDI).values('id','PlannedStartDateTime','PlannedEndDateTime') #,'PlannedStartDateTime','PlannedEndDateTime'
- print planned
- for q in range(0,len(planned)):
- psdt = planned[q]['PlannedStartDateTime'].strftime("%H:%M:%S")
- pedt = planned[q]['PlannedEndDateTime'].strftime("%H:%M:%S")
- print psdt
- print pedt
- processIn = sWarehouseMovementProcessIn.objects.filter(Q(DateTimeMovement__date=start) | Q(DateTimeMovement__date=end),JobPlannedID__in=planned).values('DateTimeMovement','JobPlannedID')
- # print processIn
- for a in range(0,len(processIn)):
- temp = processIn[a]['DateTimeMovement'].strftime("%H:%M:%S")
- dato = processIn[a]['JobPlannedID']
- timePlanned = sJobPlanned.objects.filter(id=dato)
- for x in timePlanned:
- plan = x.PlannedQuantity
- i = x.id
- timeJob = sJob.objects.filter(JobPlannedID=i)
- for a in timeJob:
- rq = a.RealQuantity
- h = a.id
- notes = sProductionNotes.objects.filter(JobID=h)
- for r in notes:
- n = r.Notes
- for i, (fif, fef) in enumerate(zip(DateFIF, DateFEF)): #MIS ARREGLOS FIJOS DE HORAS
- if temp:
- if (fif <= temp <= fef): #COMPARACIÓN DE MIS ARREGLOS FIJOS CON EL DATO DE BD
- almaHrs[i]=temp #ASIGANACIÓN DE POSICIONES con 'i'
- almaPQ[i]=plan
- almaRQ[i]=rq
- datos.append([plan,rq,n])
- // Mi select
- function dataFilter(sistemDI, startDate, endDate){
- startDateA = moment(startDate).add(00, 'hours').add(00, 'minutes').format('HH:mm');
- endDateA = moment(endDate).add(23, 'hours').add(59, 'minutes').format('HH:mm');
- console.log(startDate)
- console.log(endDate)
- console.log(sistemDI)
- $.ajax({
- type: "POST",
- url: '/client/mes/production/production/fridgeProductivity/',
- dataType: 'json',
- data: {
- 'operationNo':1,
- 'sistemDI' : $('#select2_sistema').select2('val'),
- 'startDate':startDate,
- 'endDate': endDate,
- 'csrfmiddlewaretoken': '{{ csrf_token }}',
- },
- success: function(cntxAjax) {
- // rellenando mi tabla
- $('#SearchBut').prop('enable', true);
- set_graphs(cntxAjax.cntxPQ, cntxAjax.cntxRQ);
- table.clear().draw()
- var sumaCumu = 0;
- // var table = [];
- cntxAjax.cntxDato.forEach(function(datos){
- var valPQ = parseInt(datos[0])
- var valRQ = parseInt(datos[1])
- var cumu = valPQ - valRQ
- sumaCumu += cumu
- console.log(sumaCumu)
- table.row.add({
- '0': datos[0],
- '1': datos[1],
- '2': cumu,
- '3': sumaCumu,
- '4': datos[2],
- }).draw();
- })
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement