feat: gen_number_with_rule按生产日志中的工段过滤

This commit is contained in:
caoqianming 2025-09-09 13:37:56 +08:00
parent d19fee8e6f
commit 3906b0f744
1 changed files with 4 additions and 1 deletions

View File

@ -273,6 +273,9 @@ class MlogViewSet(CustomModelViewSet):
# data = list(data_dict.values())
if self.request.query_params.get('with_wpr', False) == 'yes':
pass
# wpr_dict = {item["id"]: None for item in data}
# wpr_out_qs = Mlogbw.objects.filter(mlogb__mlog__id__in=wpr_dict.keys(),
# mlogb__material_out__isnull=False).values_list('mlogb__mlog', 'number')
return data
@lock_model_record_d_method(Mlog)
@ -872,7 +875,7 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
c_month = handle_date.month
m_model = material_out.model
# 按生产日志查询
wpr = Wpr.objects.filter(wpr_mlogbw__mlogb__material_out=material_out,
wpr = Wpr.objects.filter(wpr_mlogbw__mlogb__mlog__mgroup=mlog.mgroup,
wpr_mlogbw__mlogb__mlog__is_fix=False,
wpr_mlogbw__mlogb__mlog__submit_time__isnull=False,
wpr_mlogbw__mlogb__mlog__handle_date__year=c_year, wpr_mlogbw__mlogb__mlog__handle_date__month=c_month).order_by("number").last()