From 262895d6e63c20e17231a451123108223df2abe0 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 4 Jan 2022 17:06:12 +0800 Subject: [PATCH 01/24] update_cutting_list_with_operation bug --- hb_server/apps/wpm/services.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hb_server/apps/wpm/services.py b/hb_server/apps/wpm/services.py index 72fbd10..dcff705 100644 --- a/hb_server/apps/wpm/services.py +++ b/hb_server/apps/wpm/services.py @@ -167,6 +167,8 @@ class WpmServies(object): for m in input_q: count_cut = count_cut + m.count from_batch = from_batch + ';' + m.batch if m.batch else from_batch + i.count_cut = count_cut + i.from_batch = from_batch wpfs = WproductFlow.objects.filter(subproduction_plan=i.subproduction_plan, is_lastlog=True, coperation=op)# 筛选本次操作下子计划的产品日志 i.count_real = wpfs.count() From ccd2d2e375183ea4104afcfd6cc41d839e0a33ef Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 5 Jan 2022 09:20:45 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E4=B8=8B=E6=96=99=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/develop/urls.py | 3 ++- hb_server/apps/develop/views.py | 25 +++++++++++++++++++++++-- hb_server/apps/wpm/filters.py | 10 ++++++++-- hb_server/apps/wpm/serializers.py | 2 +- hb_server/apps/wpm/services.py | 5 ++++- hb_server/apps/wpm/views.py | 4 ++-- 6 files changed, 40 insertions(+), 9 deletions(-) diff --git a/hb_server/apps/develop/urls.py b/hb_server/apps/develop/urls.py index 6c1c780..250f0c3 100644 --- a/hb_server/apps/develop/urls.py +++ b/hb_server/apps/develop/urls.py @@ -2,9 +2,10 @@ from django.db.models import base from rest_framework import urlpatterns from django.urls import path, include from rest_framework.routers import DefaultRouter -from apps.develop.views import CleanDataView +from apps.develop.views import CleanDataView, UpdateCuttingView urlpatterns = [ path('cleandata/', CleanDataView.as_view()), + path('update_cutting/', UpdateCuttingView.as_view()) ] diff --git a/hb_server/apps/develop/views.py b/hb_server/apps/develop/views.py index b3cf203..a36a550 100644 --- a/hb_server/apps/develop/views.py +++ b/hb_server/apps/develop/views.py @@ -1,4 +1,6 @@ +from django.db import transaction from django.shortcuts import render +from rest_framework.decorators import permission_classes from rest_framework.views import APIView from rest_framework.permissions import IsAdminUser from rest_framework.response import Response @@ -7,7 +9,8 @@ from apps.mtm.models import Material from apps.pm.models import ProductionPlan from apps.sam.models import Order from apps.wf.models import Ticket -from apps.wpm.models import Operation +from apps.wpm.models import Operation, OperationMaterial, WProduct, WproductFlow +from apps.wpm.services import WpmServies # Create your views here. class CleanDataView(APIView): @@ -25,4 +28,22 @@ class CleanDataView(APIView): Inventory.objects.filter(material__type__in=[Material.MA_TYPE_GOOD, Material.MA_TYPE_HALFGOOD]).delete() Ticket.objects.all().delete(soft=False) Operation.objects.all().delete() - return Response() \ No newline at end of file + return Response() + + +class UpdateCuttingView(APIView): + permission_classes = [IsAdminUser] + @transaction.atomic + def post(self, request, format=None): + """ + 更新下料清单 + """ + for i in WProduct.objects.all(): + sp = WproductFlow.objects.filter(wproduct=i).order_by('id').first().subproduction_plan + op_q = OperationMaterial.objects.filter(subproduction_plan=sp, operation__step__id=1, operation__is_submited=True) + op = op_q.first().operation + i.coperation = op + i.save() + WproductFlow.objects.filter(wproduct=i).update(coperation=op) + WpmServies.update_cutting_list_with_operation(op) + return Response() diff --git a/hb_server/apps/wpm/filters.py b/hb_server/apps/wpm/filters.py index bf3783e..7719d7b 100644 --- a/hb_server/apps/wpm/filters.py +++ b/hb_server/apps/wpm/filters.py @@ -2,7 +2,7 @@ from django_filters import rest_framework as filters from apps.mtm.models import Material, Step from apps.wpm.services import WpmServies -from .models import Operation, WMaterial, WProduct +from .models import Operation, OperationMaterial, WMaterial, WProduct class WMaterialFilterSet(filters.FilterSet): @@ -33,4 +33,10 @@ class WProductFilterSet(filters.FilterSet): def filter_tag(self, queryset, name, value): if value == 'no_scrap': queryset = queryset.exclude(act_state=WProduct.WPR_ACT_STATE_SCRAP) - return queryset \ No newline at end of file + return queryset + +class CuttingFilterSet(filters.FilterSet): + production_plan = filters.NumberFilter(field_name='subproduction_plan__production_plan') + class Meta: + model = OperationMaterial + fields = ['operation', 'subproduction_plan', 'material'] \ No newline at end of file diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index b5d168c..cb36774 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -207,7 +207,7 @@ class OperationCreateSerializer(serializers.Serializer): class OperationUpdateSerializer(serializers.ModelSerializer): class Meta: model = Operation - fields =['use_scrap', 'remark'] + fields =['remark'] class OperationInitSerializer(serializers.Serializer): step = serializers.PrimaryKeyRelatedField(queryset=Step.objects.all(), label="子工序ID") diff --git a/hb_server/apps/wpm/services.py b/hb_server/apps/wpm/services.py index dcff705..829b938 100644 --- a/hb_server/apps/wpm/services.py +++ b/hb_server/apps/wpm/services.py @@ -166,7 +166,10 @@ class WpmServies(object): from_batch = '' for m in input_q: count_cut = count_cut + m.count - from_batch = from_batch + ';' + m.batch if m.batch else from_batch + if from_batch and m.batch: + from_batch = from_batch + ';' + m.batch + else: + from_batch = m.batch i.count_cut = count_cut i.from_batch = from_batch wpfs = WproductFlow.objects.filter(subproduction_plan=i.subproduction_plan, diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 464f0bd..08dc91b 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -19,7 +19,7 @@ from apps.system.mixins import CreateUpdateModelAMixin, OptimizationMixin from rest_framework.decorators import action from apps.wf.models import Workflow from apps.wf.serializers import WorkflowSimpleSerializer -from apps.wpm.filters import WMaterialFilterSet, WProductFilterSet +from apps.wpm.filters import CuttingFilterSet, WMaterialFilterSet, WProductFilterSet from apps.wpm.models import OperationEquip, OperationWproduct, Pick, PickWproduct, WMaterial, WProduct, Operation, OperationMaterial, OperationRecord, OperationRecordItem, WprouctTicket from apps.wpm.serializers import CuttingListSerializer, OperationEquipListSerializer, OperationEquipUpdateSerializer, OperationMaterialCreate1ListSerailizer, OperationMaterialCreate1Serailizer, OperationMaterialCreate2ListSerailizer, OperationMaterialCreate2Serailizer, OperationMaterialCreate3Serializer, OperationMaterialListSerializer, OperationRecordDetailSerializer, OperationRecordListSerializer, OperationRecordSubmitSerializer, OperationUpdateSerializer, OperationWproductListSerializer, OperationCreateSerializer, OperationDetailSerializer, OperationListSerializer, PickHalfSerializer, PickHalfsSerializer, PickSerializer, OperationInitSerializer, OperationSubmitSerializer, ScrapSerializer, WMaterialListSerializer, WProductListSerializer, WplanPutInSerializer, WpmTestFormInitSerializer, WpmTestRecordCreateSerializer, WproductPutInSerializer, WproductPutInsSerializer, WproductTicketListSerializer @@ -807,7 +807,7 @@ class CuttingListViewSet(ListModelMixin, GenericViewSet): queryset = OperationMaterial.objects.select_related('operation', 'subproduction_plan', 'material', 'create_by').filter(operation__step__process__id=1) serializer_class = CuttingListSerializer - filterset_fields = ['operation', 'subproduction_plan', 'material'] + filterset_class = CuttingFilterSet ordering_fields = ['id'] ordering = ['-id'] From 9ad37f0cef3d58694bcbb48cb3d66775815a3493 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 5 Jan 2022 09:26:50 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=E4=B8=8B=E6=96=99=E6=B8=85=E5=8D=95query?= =?UTF-8?q?set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/serializers.py | 2 +- hb_server/apps/wpm/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index cb36774..2d48b4d 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -449,7 +449,7 @@ class WproductTicketListSerializer(serializers.ModelSerializer): class CuttingListSerializer(serializers.ModelSerializer): subproduction_plan_ = SubproductionPlanSimpleSerializer(source='subproduction_plan', read_only=True) from_material_ = MaterialSimpleSerializer(source='from_material', read_only=True) - create_by_ = UserSimpleSerializer(source='create_by', read_only=True) + create_by_ = UserSimpleSerializer(source='operation.create_by', read_only=True) class Meta: model = OperationMaterial fields = '__all__' \ No newline at end of file diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 08dc91b..09d144d 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -805,7 +805,7 @@ class CuttingListViewSet(ListModelMixin, GenericViewSet): """ perms_map={'*':'*'} queryset = OperationMaterial.objects.select_related('operation', - 'subproduction_plan', 'material', 'create_by').filter(operation__step__process__id=1) + 'subproduction_plan', 'material', 'operation__create_by').filter(operation__step__id=1, type=SubprodctionMaterial.SUB_MA_TYPE_OUT) serializer_class = CuttingListSerializer filterset_class = CuttingFilterSet ordering_fields = ['id'] From a1e1d0b9b4e2894a88ee2fc2a1b95bafb4c3a2b1 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 5 Jan 2022 09:35:51 +0800 Subject: [PATCH 04/24] updatecuttinglist bug --- hb_server/apps/wpm/services.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hb_server/apps/wpm/services.py b/hb_server/apps/wpm/services.py index 829b938..1cc1b26 100644 --- a/hb_server/apps/wpm/services.py +++ b/hb_server/apps/wpm/services.py @@ -175,7 +175,7 @@ class WpmServies(object): wpfs = WproductFlow.objects.filter(subproduction_plan=i.subproduction_plan, is_lastlog=True, coperation=op)# 筛选本次操作下子计划的产品日志 i.count_real = wpfs.count() - i.count_ok = wpfs.exclude(scrap_reason=None).count() + i.count_ok = wpfs.filter(scrap_reason=None).count() i.count_qipao = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_QIPAO).count() i.count_podian = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_PODIAN).count() i.count_hua = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_HUA).count() From c8589cb158343558b76b63355aa70d8a14607f99 Mon Sep 17 00:00:00 2001 From: shilixia <2309368887@qq.com> Date: Thu, 6 Jan 2022 08:34:46 +0800 Subject: [PATCH 05/24] xialiao --- hb_client/.env.development | 4 +- hb_client/src/api/wpm.js | 10 + hb_client/src/router/index.js | 18 ++ hb_client/src/views/pm/management.vue | 16 +- hb_client/src/views/pm/plan.vue | 36 ++- hb_client/src/views/pm/plandetails.vue | 179 +++++++++++++ hb_client/src/views/pm/processcard.vue | 34 +++ hb_client/src/views/qm/producttest.vue | 358 ++++++------------------- hb_client/src/views/qm/taskdetails.vue | 75 +++++- 9 files changed, 441 insertions(+), 289 deletions(-) create mode 100644 hb_client/src/views/pm/plandetails.vue create mode 100644 hb_client/src/views/pm/processcard.vue diff --git a/hb_client/.env.development b/hb_client/.env.development index ef83e12..003a43c 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_client/src/api/wpm.js b/hb_client/src/api/wpm.js index 723bede..8bbb1c9 100644 --- a/hb_client/src/api/wpm.js +++ b/hb_client/src/api/wpm.js @@ -324,3 +324,13 @@ export function getwproductticketList(query) { params: query }) } + +//下料清单 +export function getcutList(query) { + return request({ + url: '/wpm/cutting_list/', + method: 'get', + params: query + }) +} + diff --git a/hb_client/src/router/index.js b/hb_client/src/router/index.js index de1ab74..69c48ff 100644 --- a/hb_client/src/router/index.js +++ b/hb_client/src/router/index.js @@ -184,7 +184,25 @@ export const asyncRoutes = [ name: 'management', component: () => import('@/views/pm/management'), meta: { title: '生产任务管理', icon: 'example', perms: ['pm_resources'] } + }, + + { + path: 'plandetails/:id', + name: 'plandetails', + component: () => import('@/views/pm/plandetails'), + meta: { title: '生产任务详情', perms: ['vendor_manage'] }, + hidden: true } + , + + { + path: 'processcard/:id', + name: 'processcard', + component: () => import('@/views/pm/processcard'), + meta: { title: '流程卡', perms: ['vendor_manage'] }, + hidden: true + } + ] } , diff --git a/hb_client/src/views/pm/management.vue b/hb_client/src/views/pm/management.vue index 8ee84b8..d40fe31 100644 --- a/hb_client/src/views/pm/management.vue +++ b/hb_client/src/views/pm/management.vue @@ -65,8 +65,8 @@ - - + + @@ -131,7 +131,13 @@ export default { page: 1, page_size: 20, }, - + state_:{ + 10:'制定中', + 20:'已下达', + 30:'已接受', + 40:'生产中', + 50:'已完成', + 60:'军检完成'}, listLoading: true, proList: [], @@ -271,6 +277,10 @@ export default { this.listLoading = false; }); }, + //详情 + handleselectplan(scope){ + this.$router.push({ name: "plandetails", params: { id: scope.row.id } }); + }, }, }; diff --git a/hb_client/src/views/pm/plan.vue b/hb_client/src/views/pm/plan.vue index 9dd9a63..faed2a3 100644 --- a/hb_client/src/views/pm/plan.vue +++ b/hb_client/src/views/pm/plan.vue @@ -5,7 +5,27 @@ 生产任务列表 - + + 搜索 + 重置 { + getProductionplanList(this.listQuery1).then((response) => { if (response.data) { this.productionplanList = response.data; let list = response.data.results; @@ -314,6 +334,18 @@ this.listLoading = false; }); }, + //搜索生产计划 + handleFilter() { + this.listQuery1.page = 1; + this.getplanList(); + }, + resetFilter() { + this.listQuery1 = { + page: 1, + page_size: 20, + } + this.getplanList(); + }, handleclick(scope) { this.orderID = scope.row.id; this.countsx = scope.row.count; diff --git a/hb_client/src/views/pm/plandetails.vue b/hb_client/src/views/pm/plandetails.vue new file mode 100644 index 0000000..71440bf --- /dev/null +++ b/hb_client/src/views/pm/plandetails.vue @@ -0,0 +1,179 @@ + + diff --git a/hb_client/src/views/pm/processcard.vue b/hb_client/src/views/pm/processcard.vue new file mode 100644 index 0000000..8879834 --- /dev/null +++ b/hb_client/src/views/pm/processcard.vue @@ -0,0 +1,34 @@ + + diff --git a/hb_client/src/views/qm/producttest.vue b/hb_client/src/views/qm/producttest.vue index cc195a2..8377d41 100644 --- a/hb_client/src/views/qm/producttest.vue +++ b/hb_client/src/views/qm/producttest.vue @@ -1,191 +1,67 @@