def post(self,request): #是否是设置系数 user=User.objects.get(username=request.user.username) if request.is_ajax and isK_Seter(user) and request.POST.get('k_set')=='true': # print(request.POST.get('k_set')) record_id=request.POST.get('record_id') printnum=request.POST.get('printnum') k_val=request.POST.get('k_val') record=PRO_table.objects.get(id=record_id,PrintNum=printnum) record.K_val=k_val record.staticcode='CHECKED' record.CheckBy=request.user.username record.CheckTime=datetime.now() record.save() set_prdFinalQty(record) gw_list=PRO_table.objects.filter(staticcode='POST').order_by('posttime')[:1000] data=serializers.serialize('json',gw_list) # 不是设置工务系数,就是发还操作 else: record_id=request.POST.get('record_id') printnum=request.POST.get('printnum') record=PRO_table.objects.get(id=record_id,PrintNum=printnum) record.staticcode='POST' record.save() gw_list=PRO_table.objects.filter(staticcode='CHECKED') data=serializers.serialize('json',gw_list) return JsonResponse(data,safe=False)
def get(self,request): user=User.objects.get(username=request.user.username) if request.is_ajax and isK_Seter(user): staict_code=request.GET.get('static_code') gw_list=PRO_table.objects.filter(staticcode=staict_code).order_by('-createtime')[:1000] data=serializers.serialize('json',gw_list) return JsonResponse(data,safe=False) else: data={} return JsonResponse(data,safe=False)
def get(self,request): user=User.objects.get(username=request.user.username) if request.is_ajax and isK_Seter(user): staict_code=request.GET.get('static_code') print(staict_code) gw_list=OUT_table.objects.filter(staticcode=staict_code) data=serializers.serialize('json',gw_list) return JsonResponse(data,safe=False) else: data={} return JsonResponse(data,safe=False)
def post(self,request): user=User.objects.get(username=request.user.username) if request.is_ajax and isK_Seter(user): gw_k_val=request.POST.get('k_val') record_id=request.POST.get('record_id') gw_printnum=request.POST.get('printnum') gw_record=GW_pre_table.objects.get(id=record_id,PrintNum=gw_printnum) gw_record.K_val=float(gw_k_val) gw_record.updateBy=request.user.first_name gw_record.updatetime=datetime.now() gw_record.save() # 返回所有已过帐状态的记录 form_list=[] template_name='Tango_app/gw_mdf.html' gw_list=GW_pre_table.objects.filter(staticcode='POST').order_by('-posttime')[:1000] data=serializers.serialize('json',gw_list) return JsonResponse(data,safe=False) else: data={} return JsonResponse(data,safe=False)