Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
shilixia 2022-02-25 16:21:24 +08:00
commit 5443938dd7
7 changed files with 27 additions and 16 deletions

View File

@ -131,7 +131,7 @@
faceLogin(imgData).then((res) => { faceLogin(imgData).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
if(res.data.access){ 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.$emit('func',item);
that.$message.success("身份认证成功!"); that.$message.success("身份认证成功!");
this.closeCamera(); this.closeCamera();

View File

@ -101,6 +101,7 @@
v-model="recordform.form" v-model="recordform.form"
style="width: 100%" style="width: 100%"
clearable clearable
filterable
placeholder="请选择" placeholder="请选择"
> >
<el-option <el-option
@ -661,7 +662,7 @@
label: "工序检查表", label: "工序检查表",
}, { }, {
value: 30, value: 30,
label: "检验表", label: "检验表",
}, { }, {
value: 40, value: 40,
label: "成品检验表", label: "成品检验表",
@ -673,7 +674,7 @@
typeOptions_:{ typeOptions_:{
10 : "生产记录表", 10 : "生产记录表",
20 : "工序检查表", 20 : "工序检查表",
30 : "检验表", 30 : "检验表",
40 : "成品检验表", 40 : "成品检验表",
50 : "首件检查表", 50 : "首件检查表",
}, },

View File

@ -230,7 +230,8 @@
import customForm from '@/components/customForm/index'; import customForm from '@/components/customForm/index';
import faceLogin from '@/components/faceLogin/review.vue'; import faceLogin from '@/components/faceLogin/review.vue';
import {getProcessList,getrecordformList} from "@/api/mtm"; 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"; import {getTestRecordItem,putTestRecordItem,subTestRecordItem} from "@/api/qm";
export default { export default {
@ -300,7 +301,7 @@
getTableData() { getTableData() {
this.listLoading = true; this.listLoading = true;
this.listQuery.production_plan = this.id; this.listQuery.production_plan = this.id;
getsubproductionplanList(this.listQuery).then((response) => { getsubplanList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.subPlanList = response.data.results; this.subPlanList = response.data.results;
this.count = response.data.count; this.count = response.data.count;

View File

@ -1,7 +1,8 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from rest_framework.response import Response from rest_framework.response import Response
from celery import shared_task from celery import shared_task
import os
import subprocess
@shared_task @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') ret = os.popen('sudo pg_dump -U postgres -d hberp -f /home/lighthouse/hberp_backup.sql')
return Response() return Response()
@shared_task @shared_task
def reload_server(): def reload_server():
import os # 更新后端
os.chdir('/home/lighthouse/hberp') 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()) return Response(ret.read())

View File

@ -192,6 +192,8 @@ class FIFOInPurSerializer(serializers.ModelSerializer):
def create(self, validated_data): def create(self, validated_data):
pu_order = validated_data['pu_order'] pu_order = validated_data['pu_order']
if not pu_order.is_audited:
raise ValidationError('该采购订单未审核')
validated_data['vendor'] = pu_order.vendor validated_data['vendor'] = pu_order.vendor
validated_data['number'] = 'RK' + ranstr(7) validated_data['number'] = 'RK' + ranstr(7)
validated_data['type'] = FIFO.FIFO_TYPE_PUR_IN validated_data['type'] = FIFO.FIFO_TYPE_PUR_IN

View File

@ -17,15 +17,19 @@ class InmService:
for i in FIFOItem.objects.filter(fifo=instance): for i in FIFOItem.objects.filter(fifo=instance):
material = i.material material = i.material
warehouse = i.warehouse 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,\ o2, _ = MaterialBatch.objects.get_or_create(material=material, warehouse=warehouse, batch=i.batch,\
defaults={'material':material, 'warehouse':warehouse, 'count':0, 'batch':i.batch}) defaults={'material':material, 'warehouse':warehouse, 'count':0, 'batch':i.batch})
o2.count = o2.count + i.count o2.count = o2.count + i.count
o2.save() 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).aggregate(total=Sum('count')).get('total', 0)
iv.save()
material.count = MaterialBatch.objects.filter(material=material).aggregate(total=Sum('count')).get('total', 0)
material.save() material.save()
# 创建IProduct # 创建IProduct
@ -63,10 +67,12 @@ class InmService:
mb.save() mb.save()
iv = Inventory.objects.get(material=material, warehouse=warehouse) 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() 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() material.save()
# 删除IProduct # 删除IProduct

View File

@ -352,6 +352,8 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
serializer = ScrapSerializer(data=request.data) serializer = ScrapSerializer(data=request.data)
serializer.is_valid(raise_exception=True) serializer.is_valid(raise_exception=True)
vdata = serializer.validated_data vdata = serializer.validated_data
if obj.ticket is not None:
raise exceptions.APIException('该产品存在进行工单')
if obj.act_state == WProduct.WPR_ACT_STATE_NOTOK: if obj.act_state == WProduct.WPR_ACT_STATE_NOTOK:
pass pass
elif obj.step.process.id == 1 and \ elif obj.step.process.id == 1 and \