From 1fa86988f1362a22c9e7a9f28983e15a0986635b Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 2 Nov 2021 09:49:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E6=89=B9=E6=AC=A1=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_client/.env.development | 4 +-- .../inm/migrations/0008_auto_20211102_0935.py | 25 ++++++++++++++++++ hb_server/apps/inm/models.py | 2 +- hb_server/apps/inm/serializers.py | 7 ++--- hb_server/apps/pum/models.py | 1 - .../wpm/migrations/0003_auto_20211102_0935.py | 26 +++++++++++++++++++ hb_server/apps/wpm/views.py | 7 ++++- 7 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 hb_server/apps/inm/migrations/0008_auto_20211102_0935.py create mode 100644 hb_server/apps/wpm/migrations/0003_auto_20211102_0935.py diff --git a/hb_client/.env.development b/hb_client/.env.development index 003a43c..ef83e12 100644 --- a/hb_client/.env.development +++ b/hb_client/.env.development @@ -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, diff --git a/hb_server/apps/inm/migrations/0008_auto_20211102_0935.py b/hb_server/apps/inm/migrations/0008_auto_20211102_0935.py new file mode 100644 index 0000000..2349543 --- /dev/null +++ b/hb_server/apps/inm/migrations/0008_auto_20211102_0935.py @@ -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='批次号'), + ), + ] diff --git a/hb_server/apps/inm/models.py b/hb_server/apps/inm/models.py index 9a2ac61..9259409 100644 --- a/hb_server/apps/inm/models.py +++ b/hb_server/apps/inm/models.py @@ -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 = '库存表' diff --git a/hb_server/apps/inm/serializers.py b/hb_server/apps/inm/serializers.py index 191a2dd..0087fae 100644 --- a/hb_server/apps/inm/serializers.py +++ b/hb_server/apps/inm/serializers.py @@ -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 diff --git a/hb_server/apps/pum/models.py b/hb_server/apps/pum/models.py index a705f8a..bf5d5a7 100644 --- a/hb_server/apps/pum/models.py +++ b/hb_server/apps/pum/models.py @@ -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 diff --git a/hb_server/apps/wpm/migrations/0003_auto_20211102_0935.py b/hb_server/apps/wpm/migrations/0003_auto_20211102_0935.py new file mode 100644 index 0000000..fcf3bed --- /dev/null +++ b/hb_server/apps/wpm/migrations/0003_auto_20211102_0935.py @@ -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='当前子生产计划'), + ), + ] diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 0630101..ead3278 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -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() \ No newline at end of file + return Response() + +class DoFormInit(CreateAPIView): + """ + + """ \ No newline at end of file