wpm post bug
This commit is contained in:
parent
a28282e331
commit
48caae5c9a
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.2.6 on 2021-11-09 05:44
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wpm', '0010_auto_20211108_2335'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='operationrecorditem',
|
||||
name='operation_record',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.operationrecord', verbose_name='关联的生产记录'),
|
||||
),
|
||||
]
|
|
@ -82,5 +82,5 @@ class OperationRecordItem(BaseModel):
|
|||
field_type = models.CharField('字段类型', choices=RecordForm.type_choices, max_length=50)
|
||||
field_value = models.JSONField('录入值', default=dict, blank=True)
|
||||
sort = models.IntegerField('排序号', default=1)
|
||||
operation_record = models.ForeignKey(Operation, verbose_name='关联的生产记录', on_delete=models.CASCADE)
|
||||
operation_record = models.ForeignKey(OperationRecord, verbose_name='关联的生产记录', on_delete=models.CASCADE)
|
||||
|
||||
|
|
|
@ -149,8 +149,7 @@ class DoFormSubmit(CreateAPIView, GenericAPIView):
|
|||
if 'output' in data and data['output']:
|
||||
for i in vdata['output']: # 已经序列化好的数据
|
||||
ma = i['material']
|
||||
if ma.is_main:
|
||||
# 计划开始, 第一步切割创建动态产品
|
||||
if vdata['subproduction_plan'].main_product == ma: # 如果是该计划主产物
|
||||
# 如果是切割
|
||||
# 获取下一步子工序
|
||||
if vdata['step'].type == Step.STEP_TYPE_DIV:
|
||||
|
@ -231,7 +230,7 @@ class DoFormSubmit(CreateAPIView, GenericAPIView):
|
|||
m['sort'] = form_field.sort
|
||||
m['operation_record'] = wr
|
||||
wrds.append(OperationRecordItem(**m))
|
||||
Operation.objects.bulk_create(wrds)
|
||||
OperationRecordItem.objects.bulk_create(wrds)
|
||||
return Response()
|
||||
|
||||
|
Loading…
Reference in New Issue