feat: mlog quick跳过创建mlogbw
This commit is contained in:
parent
b35015b58d
commit
f34356057d
|
@ -484,7 +484,7 @@ class MlogViewSet(CustomModelViewSet):
|
||||||
sr_2 = MlogbInSerializer(data=mlogbin_data)
|
sr_2 = MlogbInSerializer(data=mlogbin_data)
|
||||||
sr_2.is_valid(raise_exception=True)
|
sr_2.is_valid(raise_exception=True)
|
||||||
mlogbin = sr_2.save()
|
mlogbin = sr_2.save()
|
||||||
MlogbInViewSet.p_create_after(mlogbin)
|
MlogbInViewSet.p_create_after(mlogbin, skip_mlogbw=True)
|
||||||
return Response({"mlog": str(mlog.id), "mlogbin": str(mlogbin.id)})
|
return Response({"mlog": str(mlog.id), "mlogbin": str(mlogbin.id)})
|
||||||
|
|
||||||
class HandoverViewSet(CustomModelViewSet):
|
class HandoverViewSet(CustomModelViewSet):
|
||||||
|
@ -714,7 +714,7 @@ class MlogbInViewSet(BulkCreateModelMixin, BulkUpdateModelMixin, BulkDestroyMode
|
||||||
mlog.cal_mlog_count_from_mlogb()
|
mlog.cal_mlog_count_from_mlogb()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def p_create_after(cls, mlogbin:Mlogb):
|
def p_create_after(cls, mlogbin:Mlogb, skip_mlogbw=False):
|
||||||
mlogbin_parent:Mlogb = mlogbin.parent
|
mlogbin_parent:Mlogb = mlogbin.parent
|
||||||
mlog:Mlog = mlogbin.mlog
|
mlog:Mlog = mlogbin.mlog
|
||||||
mgroup:Mgroup = mlog.mgroup
|
mgroup:Mgroup = mlog.mgroup
|
||||||
|
@ -744,8 +744,8 @@ class MlogbInViewSet(BulkCreateModelMixin, BulkUpdateModelMixin, BulkDestroyMode
|
||||||
wm_in: WMaterial = mlogbin.wm_in
|
wm_in: WMaterial = mlogbin.wm_in
|
||||||
|
|
||||||
if material_in.tracking == Material.MA_TRACKING_SINGLE:
|
if material_in.tracking == Material.MA_TRACKING_SINGLE:
|
||||||
if mlogbin.count_use == wm_in.count: # 自动创建mlogbw
|
if mlogbin.count_use == wm_in.count - wm_in.count_working and skip_mlogbw is False: # 自动创建mlogbw
|
||||||
for wpr in Wpr.objects.filter(wm=wm_in).order_by("number"):
|
for wpr in Wpr.objects.filter(wm=wm_in, wpr_mlogbw__mlogb__mlog__submit_time__isnull=True).order_by("number"):
|
||||||
Mlogbw.objects.get_or_create(wpr=wpr, mlogb=mlogbin, defaults={"number": wpr.number})
|
Mlogbw.objects.get_or_create(wpr=wpr, mlogb=mlogbin, defaults={"number": wpr.number})
|
||||||
|
|
||||||
# if qct is None:
|
# if qct is None:
|
||||||
|
|
Loading…
Reference in New Issue