增加process type字段
This commit is contained in:
parent
bb324727e0
commit
a1a3bac26d
|
@ -12,4 +12,5 @@ celerybeat-schedule.dat
|
|||
celerybeat-schedule.dir
|
||||
db.sqlite3
|
||||
temp/
|
||||
nohup.out
|
||||
nohup.out
|
||||
server/settings_pro.py
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.9 on 2021-12-01 02:04
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mtm', '0037_auto_20211129_1456'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='process',
|
||||
name='type',
|
||||
field=models.IntegerField(default=30, verbose_name='类型'),
|
||||
),
|
||||
]
|
|
@ -51,8 +51,17 @@ class Process(CommonAModel):
|
|||
"""
|
||||
工序
|
||||
"""
|
||||
PROCESS_TYPE_SPEC = 10
|
||||
PROCESS_TYPE_KEY = 20
|
||||
PROCESS_TYPE_NOMAL = 30
|
||||
type_choices = (
|
||||
(PROCESS_TYPE_SPEC, '特殊'),
|
||||
(PROCESS_TYPE_KEY, '关键'),
|
||||
(PROCESS_TYPE_NOMAL, '普通'),
|
||||
)
|
||||
name = models.CharField('工序名称', max_length=100, unique=True)
|
||||
number = models.CharField('编号', max_length=100, unique=True)
|
||||
type = models.IntegerField('类型', default=30)
|
||||
instruction = models.ForeignKey(File, verbose_name='指导书', on_delete=models.SET_NULL, null=True, blank=True)
|
||||
instruction_content = models.TextField('指导书内容', null=True, blank=True)
|
||||
workshop = models.ForeignKey(Organization, verbose_name='生产车间', on_delete=models.CASCADE, null=True, blank=True)
|
||||
|
|
|
@ -38,7 +38,7 @@ class ProcessSerializer(serializers.ModelSerializer):
|
|||
class ProcessSimpleSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Process
|
||||
fields = ['id', 'name', 'number']
|
||||
fields = ['id', 'name', 'number', 'type']
|
||||
|
||||
class StepSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
|
@ -19,6 +19,7 @@ class WMaterial(BaseModel):
|
|||
batch = models.CharField('批次号', max_length=100, null=True, blank=True)
|
||||
count = models.IntegerField('当前数量', default=0, validators=[MinValueValidator(0)])
|
||||
|
||||
|
||||
class WProduct(CommonAModel):
|
||||
"""
|
||||
动态半成品/成品表
|
||||
|
|
|
@ -19,6 +19,7 @@ class PickHalfSerializer(serializers.Serializer):
|
|||
id = serializers.PrimaryKeyRelatedField(queryset=SubProductionProgress.objects.all(), label='子计划进度ID')
|
||||
wproducts = serializers.ListField(child=serializers.PrimaryKeyRelatedField(queryset=WProduct.objects.all(), label='半成品ID'),
|
||||
required=False) # 从半成品表里直接修改状态
|
||||
|
||||
class PickDetailSerializer(serializers.Serializer):
|
||||
material = serializers.PrimaryKeyRelatedField(queryset=Material.objects.all(), label="物料ID")
|
||||
batch = serializers.CharField(label='物料批次', allow_blank=True)
|
||||
|
|
|
@ -178,7 +178,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
|||
vdata = serializer.validated_data
|
||||
record_data = vdata.pop('record_data')
|
||||
wproduct = vdata['wproduct']
|
||||
if wproduct.act_state != WProduct.WPR_ACT_STATE_TOTEST:
|
||||
if wproduct.act_state not in [WProduct.WPR_ACT_STATE_TOTEST, WProduct.WPR_ACT_STATE_TORETEST]:
|
||||
raise exceptions.APIException('该产品当前状态不可检验')
|
||||
if 'is_testok' not in vdata:
|
||||
raise exceptions.APIException('未填写检测结论')
|
||||
|
|
Loading…
Reference in New Issue