Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. 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']
  2. 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']
  3. almaHrs = [0 for i in range(12)] #ARREGLO CON MIS 12 CEROS
  4. almaPQ = [0 for i in range(12)]
  5. almaRQ = [0 for i in range(12)]
  6. dateNow = datetime.now()
  7. datos = []
  8. start = request.POST.get('startDate')
  9. end = request.POST.get('endDate')
  10. sistemDI = request.POST.get('sistemDI')
  11. print "Soy comienzo",start
  12. print "Soy fin",end
  13. print "Soy sistema",sistemDI
  14.  
  15. planned = sJobPlanned.objects.filter(Q(PlannedStartDateTime__date=start)|Q(PlannedEndDateTime__date=end),SystemID=sistemDI).values('id','PlannedStartDateTime','PlannedEndDateTime') #,'PlannedStartDateTime','PlannedEndDateTime'
  16. print planned
  17. for q in range(0,len(planned)):
  18. psdt = planned[q]['PlannedStartDateTime'].strftime("%H:%M:%S")
  19. pedt = planned[q]['PlannedEndDateTime'].strftime("%H:%M:%S")
  20. print psdt
  21. print pedt
  22. processIn = sWarehouseMovementProcessIn.objects.filter(Q(DateTimeMovement__date=start) | Q(DateTimeMovement__date=end),JobPlannedID__in=planned).values('DateTimeMovement','JobPlannedID')
  23. # print processIn
  24. for a in range(0,len(processIn)):
  25. temp = processIn[a]['DateTimeMovement'].strftime("%H:%M:%S")
  26. dato = processIn[a]['JobPlannedID']
  27. timePlanned = sJobPlanned.objects.filter(id=dato)
  28. for x in timePlanned:
  29. plan = x.PlannedQuantity
  30. i = x.id
  31. timeJob = sJob.objects.filter(JobPlannedID=i)
  32. for a in timeJob:
  33. rq = a.RealQuantity
  34. h = a.id
  35. notes = sProductionNotes.objects.filter(JobID=h)
  36. for r in notes:
  37. n = r.Notes
  38. for i, (fif, fef) in enumerate(zip(DateFIF, DateFEF)): #MIS ARREGLOS FIJOS DE HORAS
  39. if temp:
  40. if (fif <= temp <= fef): #COMPARACIÓN DE MIS ARREGLOS FIJOS CON EL DATO DE BD
  41. almaHrs[i]=temp #ASIGANACIÓN DE POSICIONES con 'i'
  42. almaPQ[i]=plan
  43. almaRQ[i]=rq
  44. datos.append([plan,rq,n])
  45.  
  46. // Mi select
  47. function dataFilter(sistemDI, startDate, endDate){
  48. startDateA = moment(startDate).add(00, 'hours').add(00, 'minutes').format('HH:mm');
  49. endDateA = moment(endDate).add(23, 'hours').add(59, 'minutes').format('HH:mm');
  50. console.log(startDate)
  51. console.log(endDate)
  52. console.log(sistemDI)
  53. $.ajax({
  54. type: "POST",
  55. url: '/client/mes/production/production/fridgeProductivity/',
  56. dataType: 'json',
  57. data: {
  58. 'operationNo':1,
  59. 'sistemDI' : $('#select2_sistema').select2('val'),
  60. 'startDate':startDate,
  61. 'endDate': endDate,
  62. 'csrfmiddlewaretoken': '{{ csrf_token }}',
  63.  
  64. },
  65. success: function(cntxAjax) {
  66. // rellenando mi tabla
  67. $('#SearchBut').prop('enable', true);
  68. set_graphs(cntxAjax.cntxPQ, cntxAjax.cntxRQ);
  69. table.clear().draw()
  70.  
  71. var sumaCumu = 0;
  72.  
  73. // var table = [];
  74. cntxAjax.cntxDato.forEach(function(datos){
  75.  
  76. var valPQ = parseInt(datos[0])
  77. var valRQ = parseInt(datos[1])
  78. var cumu = valPQ - valRQ
  79. sumaCumu += cumu
  80. console.log(sumaCumu)
  81. table.row.add({
  82. '0': datos[0],
  83. '1': datos[1],
  84. '2': cumu,
  85. '3': sumaCumu,
  86. '4': datos[2],
  87. }).draw();
  88. })
  89.  
  90.  
  91. }
  92. });
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement