清理相关数据
This commit is contained in:
parent
01c3f6274a
commit
f8676bc6ad
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 3.2.6 on 2021-11-02 08:31
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('inm', '0009_auto_20211102_1113'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='fifodetail',
|
||||||
|
name='is_testok',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='是否检测合格'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='fifodetail',
|
||||||
|
name='is_tested',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='是否已检测'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -4,7 +4,7 @@ from django.dispatch import receiver
|
||||||
from apps.inm.models import Inventory, MaterialBatch, FIFO, FIFODetail
|
from apps.inm.models import Inventory, MaterialBatch, FIFO, FIFODetail
|
||||||
|
|
||||||
|
|
||||||
def update_inm(instance:FIFO, type:int):
|
def update_inm(instance:FIFO, type:int=1):
|
||||||
"""
|
"""
|
||||||
更新库存(正反)
|
更新库存(正反)
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2.6 on 2021-11-02 08:31
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mtm', '0026_auto_20211101_1522'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recordformfield',
|
||||||
|
name='need_judge',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='需要判定项目'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 3.2.6 on 2021-11-02 08:31
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pum', '0002_vendor_material'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='vendor',
|
||||||
|
name='material',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Generated by Django 3.2.6 on 2021-11-02 08:31
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('inm', '0010_auto_20211102_1631'),
|
||||||
|
('mtm', '0027_alter_recordformfield_need_judge'),
|
||||||
|
('qm', '0002_alter_analysisitem_rules'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TestRecord',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
|
||||||
|
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
|
||||||
|
('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
|
||||||
|
('record_data', models.JSONField(blank=True, default=dict, verbose_name='记录数据')),
|
||||||
|
('is_testok', models.BooleanField(default=True, verbose_name='是否合格')),
|
||||||
|
('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='testrecord_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
|
||||||
|
('fifo_detail', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='inm.fifodetail', verbose_name='关联的出入库批次')),
|
||||||
|
('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.recordform', verbose_name='所用表格')),
|
||||||
|
('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='testrecord_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -45,19 +45,19 @@ class PickSerializer(serializers.Serializer):
|
||||||
i['count'] = i.pop('pick_count')
|
i['count'] = i.pop('pick_count')
|
||||||
FIFODetail.objects.create(**i)
|
FIFODetail.objects.create(**i)
|
||||||
# 更新车间物料
|
# 更新车间物料
|
||||||
wm = WMaterial.objects.get_or_create(material=i['material'], batch=i['batch'], \
|
wm, _ = WMaterial.objects.get_or_create(material=i['material'], batch=i['batch'], \
|
||||||
process=validated_data['process'],defaults={
|
process=sp.process,defaults={
|
||||||
'material':i['material'],
|
'material':i['material'],
|
||||||
'batch':i['batch'],
|
'batch':i['batch'],
|
||||||
'process':validated_data['process'],
|
'process':sp.process,
|
||||||
'workshop':validated_data['workshop'],
|
'workshop':sp.workshop,
|
||||||
'count':0
|
'count':0
|
||||||
})
|
})
|
||||||
wm.count = wm.count + i['pick_count']
|
wm.count = wm.count + i['count']
|
||||||
wm.save()
|
wm.save()
|
||||||
# 更新子计划物料情况
|
# 更新子计划物料情况
|
||||||
spp = SubProductionProgress.objects.get(material=i['material'], subproduction_plan=sp, type=1)
|
spp = SubProductionProgress.objects.get(material=i['material'], subproduction_plan=sp, type=1)
|
||||||
spp.count_real = spp.count_real + i['pick_count']
|
spp.count_real = spp.count_real + i['count']
|
||||||
spp.save()
|
spp.save()
|
||||||
sp.is_picked=True
|
sp.is_picked=True
|
||||||
sp.save()
|
sp.save()
|
||||||
|
|
Loading…
Reference in New Issue