feat: 板段号生成逻辑修改
This commit is contained in:
parent
6b6c4b7e57
commit
cbc5d558d9
|
@ -40,6 +40,8 @@ from datetime import datetime, timedelta
|
||||||
from apps.utils.lock import lock_model_record_d_method
|
from apps.utils.lock import lock_model_record_d_method
|
||||||
from apps.em.models import Equipment
|
from apps.em.models import Equipment
|
||||||
from django.db.models import Prefetch
|
from django.db.models import Prefetch
|
||||||
|
from drf_yasg.utils import swagger_auto_schema
|
||||||
|
from drf_yasg import openapi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,6 +214,14 @@ class MlogViewSet(CustomModelViewSet):
|
||||||
return MlogSerializer
|
return MlogSerializer
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
|
@swagger_auto_schema(manual_parameters=[
|
||||||
|
openapi.Parameter(name="query", in_=openapi.IN_QUERY, description="定制返回数据",
|
||||||
|
type=openapi.TYPE_STRING, required=False),
|
||||||
|
openapi.Parameter(name="with_children", in_=openapi.IN_QUERY, description="带有children(yes/no/count)",
|
||||||
|
type=openapi.TYPE_STRING, required=False),
|
||||||
|
openapi.Parameter(name="with_wpr", in_=openapi.IN_QUERY, description="带有wpr(yes/no)",
|
||||||
|
type=openapi.TYPE_STRING, required=False),
|
||||||
|
])
|
||||||
def list(self, request, *args, **kwargs):
|
def list(self, request, *args, **kwargs):
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -261,6 +271,8 @@ class MlogViewSet(CustomModelViewSet):
|
||||||
# if item.get("material_out", None):
|
# if item.get("material_out", None):
|
||||||
# data_dict[item_dict["mlog"]]["mlogb"].append(item_dict)
|
# data_dict[item_dict["mlog"]]["mlogb"].append(item_dict)
|
||||||
# data = list(data_dict.values())
|
# data = list(data_dict.values())
|
||||||
|
if self.request.query_params.get('with_wpr', False) == 'yes':
|
||||||
|
pass
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@lock_model_record_d_method(Mlog)
|
@lock_model_record_d_method(Mlog)
|
||||||
|
@ -859,7 +871,8 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
c_year2 = str(c_year)[-2:]
|
c_year2 = str(c_year)[-2:]
|
||||||
c_month = now.month
|
c_month = now.month
|
||||||
m_model = material_out.model
|
m_model = material_out.model
|
||||||
wpr = Wpr.objects.filter(material_start=material_out, create_time__year=c_year, create_time__month=c_month).order_by("number").last()
|
# 不按产品走,只按生产日期走
|
||||||
|
wpr = Wpr.objects.filter(create_time__year=c_year, create_time__month=c_month).order_by("number").last()
|
||||||
cq_w = 4
|
cq_w = 4
|
||||||
if '02d' in rule:
|
if '02d' in rule:
|
||||||
cq_w = 2
|
cq_w = 2
|
||||||
|
|
Loading…
Reference in New Issue