From 0910825ad5700e1f5a49e6469491922551ad98ad Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 25 Feb 2022 15:32:00 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AD=98=E5=9C=A8=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E6=8A=A5=E5=BA=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/develop/tasks.py | 7 +++---- hb_server/apps/inm/serializers.py | 2 ++ hb_server/apps/inm/services.py | 13 ++++++++----- hb_server/apps/wpm/views.py | 2 ++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hb_server/apps/develop/tasks.py b/hb_server/apps/develop/tasks.py index f4e566d..a7345dc 100644 --- a/hb_server/apps/develop/tasks.py +++ b/hb_server/apps/develop/tasks.py @@ -1,7 +1,8 @@ from __future__ import absolute_import, unicode_literals from rest_framework.response import Response from celery import shared_task - +import os +import subprocess @shared_task @@ -9,15 +10,13 @@ def backup_database(): """ 备份数据库 """ - import os ret = os.popen('sudo pg_dump -U postgres -d hberp -f /home/lighthouse/hberp_backup.sql') return Response() @shared_task def reload_server(): - import os # 更新后端 os.chdir('/home/lighthouse/hberp') - ret = os.popen('sudo git pull && sudo service supervisor reload') + ret = subprocess.run('sudo git pull && sudo service supervisor reload') return Response(ret.read()) diff --git a/hb_server/apps/inm/serializers.py b/hb_server/apps/inm/serializers.py index 1b14ae3..6f29ac2 100644 --- a/hb_server/apps/inm/serializers.py +++ b/hb_server/apps/inm/serializers.py @@ -192,6 +192,8 @@ class FIFOInPurSerializer(serializers.ModelSerializer): def create(self, validated_data): pu_order = validated_data['pu_order'] + if pu_order.is_audited: + raise ValidationError('该采购订单未审核') validated_data['vendor'] = pu_order.vendor validated_data['number'] = 'RK' + ranstr(7) validated_data['type'] = FIFO.FIFO_TYPE_PUR_IN diff --git a/hb_server/apps/inm/services.py b/hb_server/apps/inm/services.py index aac1d34..3bff1ac 100644 --- a/hb_server/apps/inm/services.py +++ b/hb_server/apps/inm/services.py @@ -17,15 +17,18 @@ class InmService: for i in FIFOItem.objects.filter(fifo=instance): material = i.material warehouse = i.warehouse - o1, _ = Inventory.objects.get_or_create(material=material, warehouse=warehouse, \ - defaults={'material':material, 'warehouse':warehouse, 'count':0}) - o1.count = o1.count + i.count - o1.save() + o2, _ = MaterialBatch.objects.get_or_create(material=material, warehouse=warehouse, batch=i.batch,\ defaults={'material':material, 'warehouse':warehouse, 'count':0, 'batch':i.batch}) o2.count = o2.count + i.count o2.save() - material.count = material.count + i.count + + iv = Inventory.objects.get_or_create(material=material, warehouse=warehouse, \ + defaults={'material':material, 'warehouse':warehouse, 'count':0}) + iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count() + iv.save() + + material.count = MaterialBatch.objects.filter(material=material).count() material.save() # 创建IProduct diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 04c7f9f..00410a0 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -352,6 +352,8 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet): serializer = ScrapSerializer(data=request.data) serializer.is_valid(raise_exception=True) vdata = serializer.validated_data + if obj.ticket is not None: + raise exceptions.APIException('该产品存在进行工单') if obj.act_state == WProduct.WPR_ACT_STATE_NOTOK: pass elif obj.step.process.id == 1 and \ From 5548776cdefdf9f785bb2e76589b9a57cac4eff1 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 25 Feb 2022 15:36:20 +0800 Subject: [PATCH 2/6] =?UTF-8?q?inm=20=E5=85=A5=E5=BA=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/inm/services.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hb_server/apps/inm/services.py b/hb_server/apps/inm/services.py index 3bff1ac..c9fbbeb 100644 --- a/hb_server/apps/inm/services.py +++ b/hb_server/apps/inm/services.py @@ -22,8 +22,8 @@ class InmService: defaults={'material':material, 'warehouse':warehouse, 'count':0, 'batch':i.batch}) o2.count = o2.count + i.count o2.save() - - iv = Inventory.objects.get_or_create(material=material, warehouse=warehouse, \ + + iv, _= Inventory.objects.get_or_create(material=material, warehouse=warehouse, \ defaults={'material':material, 'warehouse':warehouse, 'count':0}) iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count() iv.save() From 131379d676b55fcc2d797745de03dc8d99f9dca0 Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 25 Feb 2022 15:43:38 +0800 Subject: [PATCH 3/6] textAdjust --- hb_client/src/components/faceLogin/review.vue | 2 +- hb_client/src/views/mtm/materialdo.vue | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hb_client/src/components/faceLogin/review.vue b/hb_client/src/components/faceLogin/review.vue index c791bdd..d466c30 100644 --- a/hb_client/src/components/faceLogin/review.vue +++ b/hb_client/src/components/faceLogin/review.vue @@ -131,7 +131,7 @@ faceLogin(imgData).then((res) => { if (res.code >= 200) { if(res.data.access){ - let item= {name:res.data.username,token:res.data.access}; + let item= {name:res.data.name,token:res.data.access}; that.$emit('func',item); that.$message.success("身份认证成功!"); this.closeCamera(); diff --git a/hb_client/src/views/mtm/materialdo.vue b/hb_client/src/views/mtm/materialdo.vue index 306988d..6a63650 100644 --- a/hb_client/src/views/mtm/materialdo.vue +++ b/hb_client/src/views/mtm/materialdo.vue @@ -101,6 +101,7 @@ v-model="recordform.form" style="width: 100%" clearable + filterable placeholder="请选择" > Date: Fri, 25 Feb 2022 16:00:38 +0800 Subject: [PATCH 4/6] =?UTF-8?q?inm=20=E5=85=A5=E5=BA=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/inm/services.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hb_server/apps/inm/services.py b/hb_server/apps/inm/services.py index c9fbbeb..8be61b7 100644 --- a/hb_server/apps/inm/services.py +++ b/hb_server/apps/inm/services.py @@ -25,10 +25,11 @@ class InmService: iv, _= Inventory.objects.get_or_create(material=material, warehouse=warehouse, \ defaults={'material':material, 'warehouse':warehouse, 'count':0}) - iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count() + iv.count = MaterialBatch.objects.filter(material=material, + warehouse=warehouse).aggregate(total=Sum('count')).get('total', 0) iv.save() - material.count = MaterialBatch.objects.filter(material=material).count() + material.count = MaterialBatch.objects.filter(material=material).aggregate(total=Sum('count')).get('total', 0) material.save() # 创建IProduct @@ -66,10 +67,12 @@ class InmService: mb.save() iv = Inventory.objects.get(material=material, warehouse=warehouse) - iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count() + iv.count = MaterialBatch.objects.filter(material=material, + warehouse=warehouse).aggregate(total=Sum('count')).get('total', 0) iv.save() - material.count = MaterialBatch.objects.filter(material=material).count() + material.count = MaterialBatch.objects.filter(material= + material).aggregate(total=Sum('count')).get('total', 0) material.save() # 删除IProduct From ad85757504f4ab4701f74d4e6489681ec5f849f8 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 25 Feb 2022 16:02:55 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=9C=AA=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/inm/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hb_server/apps/inm/serializers.py b/hb_server/apps/inm/serializers.py index 6f29ac2..d033aaa 100644 --- a/hb_server/apps/inm/serializers.py +++ b/hb_server/apps/inm/serializers.py @@ -192,7 +192,7 @@ class FIFOInPurSerializer(serializers.ModelSerializer): def create(self, validated_data): pu_order = validated_data['pu_order'] - if pu_order.is_audited: + if not pu_order.is_audited: raise ValidationError('该采购订单未审核') validated_data['vendor'] = pu_order.vendor validated_data['number'] = 'RK' + ranstr(7) From b9f39f423906b015fb07f7e867a0d9368624044b Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 25 Feb 2022 16:04:28 +0800 Subject: [PATCH 6/6] firstTestchange --- hb_client/src/views/wpm/firstCheck.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hb_client/src/views/wpm/firstCheck.vue b/hb_client/src/views/wpm/firstCheck.vue index 65dad9f..d3159b2 100644 --- a/hb_client/src/views/wpm/firstCheck.vue +++ b/hb_client/src/views/wpm/firstCheck.vue @@ -230,7 +230,8 @@ import customForm from '@/components/customForm/index'; import faceLogin from '@/components/faceLogin/review.vue'; import {getProcessList,getrecordformList} from "@/api/mtm"; - import {getsubproductionplanList,firstTestInit,firstAudit} from "@/api/pm"; + import {getsubplanList} from "@/api/wpm"; + import {firstTestInit,firstAudit} from "@/api/pm"; import {getTestRecordItem,putTestRecordItem,subTestRecordItem} from "@/api/qm"; export default { @@ -300,7 +301,7 @@ getTableData() { this.listLoading = true; this.listQuery.production_plan = this.id; - getsubproductionplanList(this.listQuery).then((response) => { + getsubplanList(this.listQuery).then((response) => { if (response.data) { this.subPlanList = response.data.results; this.count = response.data.count;