物料批次号

This commit is contained in:
caoqianming 2021-11-02 09:49:08 +08:00
parent e007885ccf
commit 1fa86988f1
7 changed files with 64 additions and 8 deletions

View File

@ -2,8 +2,8 @@
ENV = 'development'
# base api
#VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
#VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,

View File

@ -0,0 +1,25 @@
# Generated by Django 3.2.6 on 2021-11-02 01:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wpm', '0002_auto_20211029_1336'),
('inm', '0007_auto_20211028_1331'),
]
operations = [
migrations.AddField(
model_name='iproduct',
name='wproduct',
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='wpm.wproduct', verbose_name='关联的动态产品'),
),
migrations.AlterField(
model_name='materialbatch',
name='batch',
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='批次号'),
),
]

View File

@ -41,7 +41,7 @@ class MaterialBatch(BaseModel):
material = models.ForeignKey(Material, on_delete=models.CASCADE, verbose_name='物料信息')
warehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, verbose_name='所在仓库')
count = models.IntegerField('存量', default=0)
batch = models.CharField('批次号', max_length=100, null=True, blank=True, unique=True)
batch = models.CharField('批次号', max_length=100, null=True, blank=True)
expiration_date = models.DateField('有效期', null=True, blank=True)
class Meta:
verbose_name = '库存表'

View File

@ -83,9 +83,10 @@ class FIFOInPurSerializer(serializers.ModelSerializer):
for i in details:
# 校验批次
try:
obj = MaterialBatch.objects.get(batch=i['batch'])
if obj.warehouse != validated_data['warehouse']:
raise serializers.ValidationError('批次号{}在其他仓库已存在'.format(i['batch']))
if i['batch']:
obj = MaterialBatch.objects.get(batch=i['batch'], material=i['material'])
if obj.warehouse != validated_data['warehouse']:
raise serializers.ValidationError('批次号{}在其他仓库已存在'.format(i['batch']))
except:
pass

View File

@ -18,7 +18,6 @@ class Vendor(CommonAModel):
contact_phone = models.CharField('联系电话', max_length=11, unique=True)
address = models.CharField('地址', max_length=200, null=True, blank=True)
description = models.CharField('描述', max_length=200, blank=True, null=True)
material = models.CharField('供应的物料', max_length=200, blank=True, null=True)
class Meta:
verbose_name = '供应商信息'
verbose_name_plural = verbose_name

View File

@ -0,0 +1,26 @@
# Generated by Django 3.2.6 on 2021-11-02 01:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pm', '0009_auto_20211029_1017'),
('wpm', '0002_auto_20211029_1336'),
]
operations = [
migrations.AddField(
model_name='wproduct',
name='production_plan',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='pm.productionplan', verbose_name='关联主生产计划'),
preserve_default=False,
),
migrations.AlterField(
model_name='wproduct',
name='subproduction_plan',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pm.subproductionplan', verbose_name='当前子生产计划'),
),
]

View File

@ -31,4 +31,9 @@ class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
serializer= PickSerializer(data=request.data, context={'request': request})
serializer.is_valid(raise_exception=True)
serializer.save()
return Response()
return Response()
class DoFormInit(CreateAPIView):
"""
"""