feat: mlogbin create时生成编号变更2

This commit is contained in:
caoqianming 2024-08-01 09:20:15 +08:00
parent 3f62e8709f
commit 99ab4e1957
1 changed files with 10 additions and 14 deletions

View File

@ -470,7 +470,6 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
# 创建输出
if ins.mtask and ins.material_in:
material_out = mlog.material_out
route = mlog.route
if material_out is None:
raise ParseError('产物不可为空')
m_dict = {
@ -478,19 +477,16 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
"mlog": ins.mlog,
"material_out": ins.mlog.material_out
}
if route.batch_bind: # 批次绑定
m_dict['batch'] = ins.batch
else:
new_batch = ins.batch
if mlog.mtype == Mlog.MTYPE_OUT:
supplier_number = supplier.number if supplier else ''
if supplier_number:
new_batch = f'{new_batch}{supplier_number}'
elif process.batch_append_equip:
number = mlog.equipment.number if mlog.equipment else ''
if number:
new_batch = f'{new_batch}{number}'
m_dict['batch'] = new_batch
new_batch = ins.batch
if mlog.mtype == Mlog.MTYPE_OUT:
supplier_number = supplier.number if supplier else ''
if supplier_number:
new_batch = f'{new_batch}{supplier_number}'
elif process.batch_append_equip:
number = mlog.equipment.number if mlog.equipment else ''
if number:
new_batch = f'{new_batch}{number}'
m_dict['batch'] = new_batch
Mlogb.objects.get_or_create(**m_dict, defaults=m_dict)