feat: 增加任务类型 mass
This commit is contained in:
parent
95f67b6543
commit
33ea769ad4
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.2.12 on 2023-12-05 09:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pm', '0016_auto_20231130_1628'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='mtask',
|
||||
name='type',
|
||||
field=models.CharField(default='mass', help_text="(('mass', '量产'), ('pilot', '中试'))", max_length=10, verbose_name='任务类型'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='utask',
|
||||
name='type',
|
||||
field=models.CharField(default='mass', help_text="(('mass', '量产'), ('pilot', '中试'))", max_length=10, verbose_name='任务类型'),
|
||||
),
|
||||
]
|
|
@ -4,6 +4,11 @@ from apps.mtm.models import Material, Mgroup
|
|||
|
||||
# Create your models here.
|
||||
|
||||
TASK_TYPE = (
|
||||
('mass', '量产'),
|
||||
('pilot', '中试')
|
||||
)
|
||||
|
||||
|
||||
class Utask(CommonBDModel):
|
||||
"""
|
||||
|
@ -23,6 +28,8 @@ class Utask(CommonBDModel):
|
|||
(UTASK_STOP, '已停止'),
|
||||
(UTASK_DONE, '已提交')
|
||||
)
|
||||
type = models.CharField('任务类型', max_length=10,
|
||||
help_text=str(TASK_TYPE), default='mass')
|
||||
state = models.PositiveIntegerField(
|
||||
'状态', choices=UTASK_STATES, default=UTASK_CREATED, help_text=str(UTASK_STATES))
|
||||
number = models.CharField('编号', max_length=50, unique=True)
|
||||
|
@ -55,6 +62,8 @@ class Mtask(CommonADModel):
|
|||
(MTASK_STOP, '已停止'),
|
||||
(MTASK_DONE, '已提交')
|
||||
)
|
||||
type = models.CharField('任务类型', max_length=10,
|
||||
help_text=str(TASK_TYPE), default='mass')
|
||||
state = models.PositiveIntegerField(
|
||||
'状态', choices=MTASK_STATES, default=MTASK_CREATED, help_text=str(MTASK_STATES))
|
||||
number = models.CharField('编号', max_length=50, unique=True)
|
||||
|
|
|
@ -71,6 +71,7 @@ class PmService:
|
|||
for i in range(rela_days):
|
||||
task_date = start_date + timedelta(days=i)
|
||||
Mtask.objects.create(**{
|
||||
'type': utask.type,
|
||||
'number': f'{number}_{i+1}',
|
||||
'material_out': utask.material,
|
||||
'material_in': utask.material_in,
|
||||
|
@ -124,6 +125,7 @@ class PmService:
|
|||
task_date = start_date + timedelta(days=i)
|
||||
Mtask.objects.create(**{
|
||||
'number': f'{number}_r{ind+1}_{i+1}',
|
||||
'type': utask.type,
|
||||
'material_out': halfgood,
|
||||
'material_in': material_in,
|
||||
'mgroup': mgroup,
|
||||
|
|
Loading…
Reference in New Issue