物料计算结果按物料类型和编号排序
This commit is contained in:
parent
c9ad35b4b5
commit
42cbd43117
|
@ -126,6 +126,24 @@ class FaceLogin(CreateAPIView):
|
|||
if user:
|
||||
refresh = RefreshToken.for_user(user)
|
||||
# 可设为在岗
|
||||
now = timezone.now()
|
||||
now_local = timezone.localtime()
|
||||
if 8<=now_local.hour<=17:
|
||||
ins, created = ClockRecord.objects.get_or_create(
|
||||
create_by = user, create_time__hour__range = [8,18],
|
||||
create_time__year=now_local.year, create_time__month=now_local.month,
|
||||
create_time__day=now_local.day,
|
||||
defaults={
|
||||
'type':ClockRecord.ClOCK_WORK1,
|
||||
'create_by':user,
|
||||
'create_time':now
|
||||
})
|
||||
# 设为在岗
|
||||
if created:
|
||||
user.is_atwork = True
|
||||
user.last_check_time = now
|
||||
user.save()
|
||||
|
||||
return Response({
|
||||
'refresh': str(refresh),
|
||||
'access': str(refresh.access_token),
|
||||
|
|
|
@ -232,7 +232,8 @@ class ResourceViewSet(GenericViewSet):
|
|||
# 计算输入物料
|
||||
materials = SubprodctionMaterial.objects.filter(subproduction__product__id=i['id'],
|
||||
subproduction__is_deleted=False, is_deleted=False,
|
||||
type= SubprodctionMaterial.SUB_MA_TYPE_IN).order_by('material__number')\
|
||||
type= SubprodctionMaterial.SUB_MA_TYPE_IN).order_by(
|
||||
'material__type', 'material__number')\
|
||||
.values('material__id', 'material__name',
|
||||
'material__number', 'material__type',
|
||||
'count', 'material__count', 'material__count_safe')
|
||||
|
|
Loading…
Reference in New Issue