Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
fab4ef2571
|
@ -123,7 +123,7 @@
|
|||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<span v-show="item.help_text" class="helpText">说明:{{item.help_text}}</span>
|
||||
<span v-show="item.help_text&&item.field_type !== 'draw'" class="helpText">说明:{{item.help_text}}</span>
|
||||
<span v-if="item.need_judge&&item.is_testok===true" class="adoptTip">合格</span>
|
||||
<span v-if="item.need_judge&&item.is_testok===false" class="failTip">不合格</span>
|
||||
</el-col>
|
||||
|
@ -144,7 +144,7 @@
|
|||
<div class="canvasBtn" @click="error1">标记</div>
|
||||
<div class="canvasBtn" @click="word1()">文字</div>
|
||||
<div class="canvasBtn" @click="back()">回退</div>
|
||||
<div class="canvasBtn" @click="saveTu()">保存</div>
|
||||
<!--<div class="canvasBtn" @click="saveTu()">保存</div>-->
|
||||
</div>
|
||||
<div id="res"></div>
|
||||
</div>
|
||||
|
@ -196,11 +196,13 @@
|
|||
isDisabled:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
isMidTesting:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
debugger;
|
||||
debugger;
|
||||
let that = this;
|
||||
that.checkForm = {};
|
||||
this.form = this.formID;
|
||||
|
@ -725,7 +727,7 @@
|
|||
that.testrecord.record_data = that.field;//检查项列表
|
||||
that.testrecord.is_testok = that.is_testok;//检查表检查结果
|
||||
that.testrecord.id = that.recordId;//记录id
|
||||
if(submit){//提交
|
||||
if(submit&&that.isMidTesting!==true){//提交
|
||||
this.$emit('recordSubmit',that.testrecord);
|
||||
}else {//保存
|
||||
this.$emit('recordSave',that.testrecord);
|
||||
|
|
|
@ -282,6 +282,10 @@
|
|||
hasPicture:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
isMidTesting:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -299,7 +303,7 @@
|
|||
});
|
||||
that.formData=[...that.formData];
|
||||
// debugger;
|
||||
console.log(that.formData);
|
||||
// console.log(that.formData);
|
||||
//当前表的数据存储
|
||||
for(let i=0;i<this.results.length;i++){
|
||||
let key = this.results[i].field_key;
|
||||
|
@ -316,7 +320,7 @@
|
|||
obj = item;
|
||||
that.judgeList.push(obj)
|
||||
});
|
||||
debugger;
|
||||
// debugger;
|
||||
//图片地址
|
||||
let imag= this.formData.filter(item => {
|
||||
return item.field_type === 'draw';
|
||||
|
@ -814,7 +818,7 @@
|
|||
that.testrecord.is_testok = that.is_testok;//检查表检查结果
|
||||
that.testrecord.id = that.recordId;
|
||||
// debugger;
|
||||
if(submit){//提交
|
||||
if(submit&&that.isMidTesting!==true){//提交
|
||||
this.$emit('recordSubmit',that.testrecord);
|
||||
}else {//保存
|
||||
this.$emit('recordSave',that.testrecord);
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<div style="width: 100%;height: 100%;">
|
||||
<div>
|
||||
<div class="video-box">
|
||||
<video id="video" width="960" height="640" preload autoplay loop muted></video>
|
||||
<canvas id="canvas" width="960" height="640"></canvas>
|
||||
<video id="video" width="749" height="640" preload autoplay loop muted></video>
|
||||
<canvas id="canvas" width="749" height="640"></canvas>
|
||||
</div>
|
||||
<canvas id="screenshotCanvas" width="960" height="640"></canvas>
|
||||
<canvas id="screenshotCanvas" width="749" height="640"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -147,8 +147,8 @@
|
|||
.video-box {
|
||||
margin: auto;
|
||||
position: relative;
|
||||
width: 960px;
|
||||
height: 640px;
|
||||
/*width: 90%;
|
||||
height: 90%;*/
|
||||
}
|
||||
|
||||
video, canvas {
|
||||
|
|
|
@ -307,4 +307,8 @@
|
|||
.login-code-img {
|
||||
height: 38px;
|
||||
}
|
||||
.testTracking{
|
||||
width:100%;
|
||||
height: 700px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -406,6 +406,7 @@
|
|||
:hasPicture="hasPicture"
|
||||
:wproduct="wproduct"
|
||||
:recordId="recordId"
|
||||
:isMidTesting="is_midtesting"
|
||||
@recordSave="recordSave"
|
||||
@recordSubmit="recordSubmit"
|
||||
@recordCancel="recordCancel"
|
||||
|
@ -427,6 +428,7 @@
|
|||
:wproduct="wproduct"
|
||||
:recordId="recordId"
|
||||
:isDisabled="isDisabled"
|
||||
:isMidTesting="is_midtesting"
|
||||
@recordSubmit="recordSubmit"
|
||||
@recordSave="recordSave"
|
||||
@recordCancel="recordCancel"
|
||||
|
@ -788,6 +790,7 @@
|
|||
mutipID: [],
|
||||
wproduct: null,
|
||||
isPost: false,
|
||||
is_midtesting: false,
|
||||
isDisabled: false,
|
||||
origin_test: null,
|
||||
hasPicture: false,
|
||||
|
@ -1008,7 +1011,7 @@
|
|||
this.innerIndex = index;
|
||||
// this.outerVisible = true;
|
||||
this.wproduct = scope.row.id;//半成品ID
|
||||
this.listQueryrecordform.material = scope.row.material_.id;//
|
||||
this.listQueryrecordform.material = scope.row.material_check!==null ? scope.row.material_check :scope.row.material_.id;//
|
||||
this.listQueryrecordform.type = 2;
|
||||
this.listQueryrecordform.enabled = true;
|
||||
this.recordform = null;
|
||||
|
@ -1073,6 +1076,7 @@
|
|||
getTestRecordItem(scope.row.id).then((res) => {
|
||||
let arr = [];
|
||||
let fieldList = res.data.record_data;
|
||||
that.is_midtesting = res.data.is_midtesting;
|
||||
for (let i = 0; i < that.fieldList.length; i++) {
|
||||
let obj = that.fieldList[i];
|
||||
obj.is_testok = null;
|
||||
|
|
|
@ -67,11 +67,13 @@ class FIFO(CommonADModel):
|
|||
FIFO_TYPE_SALE_OUT = 2
|
||||
FIFO_TYPE_PUR_IN = 3
|
||||
FIFO_TYPE_DO_IN = 4
|
||||
FIFO_TYPE_OTHER_IN = 5
|
||||
type_choices = (
|
||||
(FIFO_TYPE_DO_OUT, '生产领料'),
|
||||
(FIFO_TYPE_SALE_OUT, '销售提货'),
|
||||
(FIFO_TYPE_PUR_IN, '采购入库'),
|
||||
(FIFO_TYPE_DO_IN, '生产入库')
|
||||
(FIFO_TYPE_DO_IN, '生产入库'),
|
||||
(FIFO_TYPE_OTHER_IN, '其他入库')
|
||||
)
|
||||
number = models.CharField('记录编号', max_length=100)
|
||||
type = models.IntegerField('出入库类型', default=1)
|
||||
|
|
|
@ -80,10 +80,12 @@ class FIFOItemCreateSerializer(serializers.ModelSerializer):
|
|||
class Meta:
|
||||
model = FIFOItem
|
||||
fields = ['warehouse',
|
||||
'material', 'batch', 'fifo', 'files', 'pu_order_item']
|
||||
'material', 'batch', 'fifo', 'files', 'pu_order_item', 'count']
|
||||
|
||||
def create(self, validated_data):
|
||||
fifo = validated_data['fifo']
|
||||
if fifo.is_audited:
|
||||
raise ValidationError('该出入库记录已审核')
|
||||
pu_order_item = validated_data.get('pu_order_item', None)
|
||||
if pu_order_item:
|
||||
if fifo.pu_order != pu_order_item.pu_order:
|
||||
|
@ -97,7 +99,7 @@ class FIFOItemCreateSerializer(serializers.ModelSerializer):
|
|||
class FIFOItemUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = FIFOItem
|
||||
fields = ['warehouse', 'batch', 'files']
|
||||
fields = ['warehouse', 'batch', 'files', 'count']
|
||||
|
||||
class FIFOItemSerializer(serializers.ModelSerializer):
|
||||
warehouse_ = WareHouseSimpleSerializer(source='warehouse', read_only=True)
|
||||
|
@ -140,12 +142,12 @@ class FIFOInOtherSerializer(serializers.ModelSerializer):
|
|||
def create(self, validated_data):
|
||||
details = validated_data.pop('details')
|
||||
with transaction.atomic():
|
||||
validated_data['type'] = FIFO.FIFO_TYPE_PUR_IN
|
||||
validated_data['type'] = FIFO.FIFO_TYPE_OTHER_IN
|
||||
validated_data['number'] = 'RK' + ranstr(7)
|
||||
obj = FIFO(**validated_data)
|
||||
obj.save()
|
||||
for i in details:
|
||||
if 'details' in i:
|
||||
i['number'] = 'RK' + ranstr(7)
|
||||
p_details = i.pop('details')
|
||||
if len(p_details) != i['count']:
|
||||
raise serializers.ValidationError('数目对不上')
|
||||
|
@ -160,7 +162,6 @@ class FIFOInOtherSerializer(serializers.ModelSerializer):
|
|||
FIFOItemProduct.objects.bulk_create(p_list0)
|
||||
else:
|
||||
i['fifo'] = obj
|
||||
i['number'] = 'RK' + ranstr(7)
|
||||
FIFOItem.objects.create(**i)
|
||||
return obj
|
||||
|
||||
|
@ -179,6 +180,7 @@ class FIFOInPurSerializer(serializers.ModelSerializer):
|
|||
pu_order = validated_data['pu_order']
|
||||
validated_data['vendor'] = pu_order.vendor
|
||||
validated_data['number'] = 'RK' + ranstr(7)
|
||||
validated_data['type'] = FIFO.FIFO_TYPE_PUR_IN
|
||||
obj = FIFO.objects.create(**validated_data)
|
||||
return obj
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ class WarehouseViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
仓库-增删改查
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'warehouse_create',
|
||||
'put':'warehouse_update', 'delete':'warehouse_delete'}
|
||||
queryset = WareHouse.objects.select_related('create_by').all()
|
||||
serializer_class = WareHouseSerializer
|
||||
search_fields = ['name', 'number', 'place']
|
||||
|
@ -43,7 +44,7 @@ class InventoryViewSet(ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
仓库物料表
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = Inventory.objects.select_related(
|
||||
'material', 'warehouse').filter(count__gt=0).all()
|
||||
serializer_class = InventorySerializer
|
||||
|
@ -54,7 +55,7 @@ class InventoryViewSet(ListModelMixin, GenericViewSet):
|
|||
|
||||
|
||||
class MaterialBatchViewSet(ListModelMixin, GenericViewSet):
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = MaterialBatch.objects.select_related(
|
||||
'material', 'warehouse').filter(count__gt=0).all()
|
||||
serializer_class = MaterialBatchSerializer
|
||||
|
@ -81,7 +82,8 @@ class FIFOItemViewSet(ListModelMixin, CreateModelMixin, DestroyModelMixin, Updat
|
|||
"""
|
||||
出入库记录详情表
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'fifoitem_create',
|
||||
'put':'fifoitem_update', 'delete':'fifoitem_delete'}
|
||||
queryset = FIFOItem.objects.select_related('material', 'fifo').prefetch_related('files').all()
|
||||
serializer_class = FIFOItemSerializer
|
||||
filterset_fields = ['material', 'fifo',
|
||||
|
@ -97,12 +99,6 @@ class FIFOItemViewSet(ListModelMixin, CreateModelMixin, DestroyModelMixin, Updat
|
|||
return FIFOItemCreateSerializer
|
||||
return super().get_serializer_class()
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
if obj.fifo.is_audited:
|
||||
raise ValidationError('该出入库记录已审核')
|
||||
return super().create(request, *args, **kwargs)
|
||||
|
||||
def update(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
if obj.fifo.is_audited:
|
||||
|
@ -115,7 +111,7 @@ class FIFOItemViewSet(ListModelMixin, CreateModelMixin, DestroyModelMixin, Updat
|
|||
raise ValidationError('该出入库记录已审核')
|
||||
return super().destroy(request, *args, **kwargs)
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=InmTestRecordCreateSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'fifoitem_test'}, serializer_class=InmTestRecordCreateSerializer)
|
||||
def test(self, request, pk=None):
|
||||
"""
|
||||
检验
|
||||
|
@ -147,7 +143,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
|||
"""
|
||||
出入库记录
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'delete':'fifo_delete'}
|
||||
queryset = FIFO.objects.select_related('auditor', 'create_by')
|
||||
serializer_class = FIFOListSerializer
|
||||
filterset_fields = '__all__'
|
||||
|
@ -166,7 +162,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
|||
raise exceptions.APIException('该记录已审核,不可删除')
|
||||
return super().destroy(request, *args, **kwargs)
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=FIFOInPurSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'fifo_in_pur'}, serializer_class=FIFOInPurSerializer)
|
||||
def in_pur(self, request, pk=None):
|
||||
"""
|
||||
采购入库
|
||||
|
@ -176,7 +172,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
|||
serializer.save(create_by=request.user)
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'fifo_in_other'},
|
||||
serializer_class=FIFOInOtherSerializer)
|
||||
def in_other(self, request, pk=None):
|
||||
"""
|
||||
|
@ -187,7 +183,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
|||
serializer.save(create_by=request.user)
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=serializers.Serializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post': 'fifo_audit'}, serializer_class=serializers.Serializer)
|
||||
def audit(self, request, pk=None):
|
||||
"""
|
||||
审核通过
|
||||
|
@ -213,7 +209,7 @@ class IProductViewSet(ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
半成品库存表
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = IProduct.objects.select_related(
|
||||
'material', 'warehouse',
|
||||
'wproduct__subproduction_plan__production_plan__order',
|
||||
|
|
|
@ -45,7 +45,7 @@ def get_file_list(file_path):
|
|||
return dir_list
|
||||
|
||||
class LogView(APIView):
|
||||
|
||||
permission_classes = [IsAuthenticated]
|
||||
@swagger_auto_schema(manual_parameters=[
|
||||
openapi.Parameter('name', openapi.IN_QUERY, description='日志文件名', type=openapi.TYPE_STRING)
|
||||
])
|
||||
|
@ -82,7 +82,7 @@ class LogView(APIView):
|
|||
|
||||
|
||||
class LogDetailView(APIView):
|
||||
|
||||
permission_classes = [IsAuthenticated]
|
||||
def get(self, request, name):
|
||||
"""
|
||||
查看日志详情
|
||||
|
|
|
@ -42,6 +42,7 @@ class ProcessSimpleSerializer(serializers.ModelSerializer):
|
|||
model = Process
|
||||
fields = ['id', 'name', 'number', 'type']
|
||||
|
||||
|
||||
class StepSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Step
|
||||
|
@ -138,7 +139,7 @@ class UsedStepCreateSerializer(serializers.ModelSerializer):
|
|||
"""
|
||||
class Meta:
|
||||
model = UsedStep
|
||||
fields = ['step', 'subproduction', 'remark']
|
||||
fields = ['step', 'subproduction', 'remark', 'need_test']
|
||||
|
||||
class UsedStepUpdateSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
|
@ -146,7 +147,7 @@ class UsedStepUpdateSerializer(serializers.ModelSerializer):
|
|||
"""
|
||||
class Meta:
|
||||
model = UsedStep
|
||||
fields = ['remark']
|
||||
fields = ['remark', 'need_test']
|
||||
|
||||
class UsedStepListSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
|
|
|
@ -58,7 +58,8 @@ class StepViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
子工序-增删改查
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'step_create',
|
||||
'put':'step_update', 'delete':'step_delete'}
|
||||
queryset = Step.objects.all()
|
||||
serializer_class = StepSerializer
|
||||
search_fields = ['name', 'number']
|
||||
|
@ -74,7 +75,8 @@ class SubProductionViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
产品生产分解增删改查
|
||||
"""
|
||||
perms_map={'*':'*'}
|
||||
perms_map={'get':'*', 'post':'subproduction_create',
|
||||
'put':'subproduction_update', 'delete':'subproduction_delete'}
|
||||
queryset = SubProduction.objects.select_related('process').all()
|
||||
filterset_fields = ['product', 'process']
|
||||
search_fields = ['name']
|
||||
|
@ -89,7 +91,8 @@ class InputMaterialViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
输入物料-增删改查
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'subproduction_update',
|
||||
'put':'subproduction_update', 'delete':'subproduction_update'}
|
||||
queryset = SubprodctionMaterial.objects.select_related('material').filter(type=SubprodctionMaterial.SUB_MA_TYPE_IN)
|
||||
serializer_class = InputMaterialSerializer
|
||||
filterset_fields = ['subproduction']
|
||||
|
@ -106,7 +109,8 @@ class OutputMaterialViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
输出物料-增删改查
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'subproduction_update',
|
||||
'put':'subproduction_update', 'delete':'subproduction_update'}
|
||||
queryset = SubprodctionMaterial.objects.select_related('material').filter(type=SubprodctionMaterial.SUB_MA_TYPE_OUT)
|
||||
serializer_class = OutputMaterialSerializer
|
||||
filterset_fields = ['subproduction']
|
||||
|
@ -123,7 +127,8 @@ class OtherMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, DestroyModel
|
|||
"""
|
||||
其他物料-增删改查
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'subproduction_update',
|
||||
'put':'subproduction_update', 'delete':'subproduction_update'}
|
||||
queryset = SubprodctionMaterial.objects.select_related('material').filter(type=SubprodctionMaterial.SUB_MA_TYPE_TOOL)
|
||||
serializer_class = OutputMaterialSerializer
|
||||
filterset_fields = ['subproduction']
|
||||
|
@ -138,7 +143,8 @@ class UsedStepViewSet(OptimizationMixin, CreateModelMixin, DestroyModelMixin, Li
|
|||
"""
|
||||
产品生产子工序表
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'subproduction_update',
|
||||
'put':'subproduction_update', 'delete':'subproduction_update'}
|
||||
queryset = UsedStep.objects.all()
|
||||
filterset_fields = ['subproduction', 'step']
|
||||
ordering = ['step__sort', '-step__create_time']
|
||||
|
@ -154,7 +160,8 @@ class RecordFormViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet
|
|||
"""
|
||||
记录表格增删改查
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'recordform_create',
|
||||
'put':'recordform_update', 'delete':'recordform_delete'}
|
||||
queryset = RecordForm.objects.all()
|
||||
filterset_fields = ['step', 'type', 'material', 'number', 'enabled']
|
||||
search_fields = ['name']
|
||||
|
@ -186,7 +193,8 @@ class RecordFormFieldViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelVi
|
|||
"""
|
||||
表格字段表 增删改查
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'recordform_update',
|
||||
'put':'recordform_update', 'delete':'recordform_update'}
|
||||
queryset = RecordFormField.objects.all()
|
||||
filterset_fields = ['field_type', 'form']
|
||||
search_fields = ['field_name', 'field_key']
|
||||
|
@ -204,7 +212,8 @@ class TechDocViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
技术文件增删改查
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'subproduction_update',
|
||||
'put':'subproduction_update', 'delete':'subproduction_update'}
|
||||
queryset = TechDoc.objects.select_related('file').all()
|
||||
filterset_class = TechDocFilterset
|
||||
search_fields = ['name']
|
||||
|
|
|
@ -39,7 +39,7 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
|
|||
"""
|
||||
生产计划
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'plan_create'}
|
||||
queryset = ProductionPlan.objects.select_related('order', 'order__contract', 'product')
|
||||
serializer_class = ProductionPlanSerializer
|
||||
search_fields = ['number', 'order__number', 'order__contract__number', 'product__number']
|
||||
|
@ -69,7 +69,7 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
|
|||
updateOrderPlanedCount(instance.order)
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=PlanDestorySerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'plan_delete'}, serializer_class=PlanDestorySerializer)
|
||||
def deletes(self, request, pk=None):
|
||||
"""
|
||||
批量物理删除
|
||||
|
@ -77,7 +77,7 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
|
|||
ProductionPlan.objects.filter(id__in=request.data.get('ids', [])).delete(soft=False)
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=GenSubPlanSerializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'gen_subplan'}, serializer_class=GenSubPlanSerializer)
|
||||
@transaction.atomic
|
||||
def gen_subplan(self, request, pk=None):
|
||||
"""
|
||||
|
@ -109,7 +109,7 @@ class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateMo
|
|||
"""
|
||||
子生产计划-列表/修改
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'put':'subplan_update'}
|
||||
queryset = SubProductionPlan.objects.select_related('process', 'workshop', 'subproduction', 'product', 'production_plan__product')
|
||||
search_fields = []
|
||||
serializer_class = SubProductionPlanListSerializer
|
||||
|
@ -133,7 +133,7 @@ class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateMo
|
|||
serializer = SubProductionProgressSerializer(instance=obj.progress_subplan, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=serializers.Serializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'subplan_issue'}, serializer_class=serializers.Serializer)
|
||||
@transaction.atomic
|
||||
def issue(self, request, pk=None):
|
||||
"""
|
||||
|
@ -150,7 +150,7 @@ class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateMo
|
|||
return Response()
|
||||
raise APIException('计划状态有误')
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=serializers.Serializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'subplan_start'}, serializer_class=serializers.Serializer)
|
||||
def start(self, request, pk=None):
|
||||
"""
|
||||
开始生产
|
||||
|
@ -197,7 +197,7 @@ class SubProductionProgressViewSet(ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
生产进度
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = SubProductionProgress.objects.select_related('material', 'subproduction_plan')
|
||||
search_fields = []
|
||||
serializer_class = SubProductionProgressSerializer
|
||||
|
@ -208,7 +208,7 @@ class SubProductionProgressViewSet(ListModelMixin, GenericViewSet):
|
|||
class ResourceViewSet(GenericViewSet):
|
||||
|
||||
perms_map = {'*': '*'}
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=ResourceCalListSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'resource_cal'}, serializer_class=ResourceCalListSerializer)
|
||||
def cal(self, request, pk=None):
|
||||
"""
|
||||
物料消耗计算
|
||||
|
@ -240,7 +240,7 @@ class ResourceViewSet(GenericViewSet):
|
|||
'count_safe':m['material__count_safe']})
|
||||
return Response(res)
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=ResourceCalListSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'resource_cal_equip'}, serializer_class=ResourceCalListSerializer)
|
||||
def cal_equip(self, request, pk=None):
|
||||
"""
|
||||
设备状态查看
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from django.shortcuts import render
|
||||
from numpy import delete
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
from rest_framework.mixins import CreateModelMixin, DestroyModelMixin, ListModelMixin
|
||||
from rest_framework.mixins import CreateModelMixin, DestroyModelMixin, ListModelMixin, RetrieveModelMixin
|
||||
from rest_framework.viewsets import GenericViewSet
|
||||
from apps.pum.models import PuOrder, PuOrderItem, Vendor
|
||||
from apps.pum.serializers import PuOrderCreateUpdateSerializer, PuOrderItemCreateSerializer, PuOrderItemSerializer, PuOrderItemUpdateSerializer, PuOrderSerializer, VendorSerializer
|
||||
|
@ -31,8 +31,8 @@ class PuOrderViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
采购订单-增删改查
|
||||
"""
|
||||
perms_map = {'get': '*', 'post': '*',
|
||||
'put': '*', 'delete': '*'}
|
||||
perms_map = {'get': '*', 'post': 'puorder_create',
|
||||
'put': 'puorder_update', 'delete': 'puorder_delete'}
|
||||
queryset = PuOrder.objects.select_related('vendor').\
|
||||
prefetch_related('item_pu_order').all()
|
||||
serializer_class = PuOrderSerializer
|
||||
|
@ -57,7 +57,7 @@ class PuOrderViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
raise ValidationError('该采购订单已审核')
|
||||
return super().destroy(request, *args, **kwargs)
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'*'},
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'puorder_audit'},
|
||||
serializer_class=serializers.Serializer)
|
||||
def audit(self, request, pk=None):
|
||||
obj = self.get_object()
|
||||
|
@ -68,12 +68,12 @@ class PuOrderViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
return Response()
|
||||
return Response('订单状态有误', status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
class PuOrderItemViewSet(CreateModelMixin, ListModelMixin, DestroyModelMixin, GenericViewSet):
|
||||
class PuOrderItemViewSet(CreateModelMixin, ListModelMixin, DestroyModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||
"""
|
||||
采购订单条目
|
||||
"""
|
||||
perms_map = {'get': '*', 'post': '*',
|
||||
'put': '*', 'delete': '*'}
|
||||
perms_map = {'get': '*', 'post': 'puorder_update',
|
||||
'put': 'puorder_update', 'delete': 'puorder_update'}
|
||||
queryset = PuOrderItem.objects.select_related('material').all()
|
||||
serializer_class = PuOrderItemSerializer
|
||||
filterset_fields = ['pu_order', 'material']
|
||||
|
|
|
@ -129,13 +129,14 @@ class TestRecordUpdateSerializer(serializers.ModelSerializer):
|
|||
record_data = validated_data.pop('record_data')
|
||||
for attr, value in validated_data.items():
|
||||
setattr(instance, attr, value)
|
||||
instance.save(update_by=update_by)
|
||||
instance.update_by = update_by
|
||||
instance.save()
|
||||
for i in record_data:
|
||||
tri = i['id']
|
||||
tri.is_testok = i['is_testok']
|
||||
tri.is_hidden = i['is_hidden']
|
||||
tri.field_value = i['field_value']
|
||||
if i['field_value'] != tri.field_value:
|
||||
tri.field_value = i['field_value']
|
||||
tri.update_by = update_by
|
||||
tri.is_testok = i['is_testok']
|
||||
tri.is_hidden = i['is_hidden']
|
||||
tri.save()
|
||||
tri.save()
|
||||
return instance
|
||||
|
|
|
@ -52,7 +52,7 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
|||
"""
|
||||
检验记录
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'testrecord_update', 'delete':'testrecord_delete'}
|
||||
queryset = TestRecord.objects.select_related('fifo_item', 'form').prefetch_related('item_test_record').all()
|
||||
serializer_class = TestRecordListSerializer
|
||||
filterset_fields = ['wproduct', 'material', 'step', 'subproduction_plan', 'fifo_item', 'origin_test', 'type']
|
||||
|
@ -80,15 +80,16 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
|||
WpmService.add_wproduct_flow_log(obj.wproduct, 'test_delete')
|
||||
return super().destroy(request, *args, **kwargs)
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=TestRecordUpdateSerializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'testrecord_submit'}, serializer_class=serializers.Serializer)
|
||||
def submit(self, request, pk=None):
|
||||
obj = self.get_object()
|
||||
if obj.is_submited and obj.is_midtesting is False:
|
||||
raise exceptions.APIException('该记录已提交')
|
||||
# 校验是否有未填项目
|
||||
if obj.type != TestRecord.TEST_PROCESS_RE and obj.is_midtesting is False:
|
||||
if TestRecordItem.objects.filter(field_value__isnull=True, is_hidden=False, test_record=obj).exists():
|
||||
raise exceptions.APIException('存在未填写项目')
|
||||
items_not = TestRecordItem.objects.filter(field_value__isnull=True, is_hidden=False, test_record=obj)
|
||||
if items_not.exists():
|
||||
raise exceptions.APIException('存在未填写项目:'+ ','.join(list(items_not.values_list('form_field__field_name', flat=True))))
|
||||
with transaction.atomic():
|
||||
obj.is_submited=True
|
||||
obj.save()
|
||||
|
|
|
@ -12,7 +12,8 @@ class CustomerViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
"""
|
||||
客户-增删改查
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'customer_create',
|
||||
'put':'customer_update', 'delete':'customer_delete'}
|
||||
queryset = Customer.objects.all()
|
||||
serializer_class = CustomerSerializer
|
||||
search_fields = ['name', 'contact']
|
||||
|
@ -30,7 +31,8 @@ class ContractViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
"""
|
||||
合同-增删改查
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'contract_create',
|
||||
'put':'contract_update', 'delete':'contract_delete'}
|
||||
queryset = Contract.objects.select_related('customer').all()
|
||||
serializer_class = ContractSerializer
|
||||
search_fields = ['name']
|
||||
|
@ -47,7 +49,8 @@ class OrderViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
"""
|
||||
订单-增删改查
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'order_create',
|
||||
'put':'order_update', 'delete':'order_delete'}
|
||||
queryset = Order.objects.select_related('contract', 'customer').all()
|
||||
serializer_class = OrderSerializer
|
||||
search_fields = ['number', 'product']
|
||||
|
@ -60,7 +63,7 @@ class OrderViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
return OrderCreateUpdateSerializer
|
||||
return super().get_serializer_class()
|
||||
|
||||
@action(methods=['get'], detail=False, perms_map={'get':'*'})
|
||||
@action(methods=['get'], detail=False, perms_map={'get':'order_toplan'})
|
||||
def toplan(self, request, pk=None):
|
||||
queryset = Order.objects.filter(count__gt=F('planed_count')).order_by('-id')
|
||||
page = self.paginate_queryset(queryset)
|
||||
|
|
|
@ -21,7 +21,7 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
|||
"""
|
||||
销售记录
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'sale_create', 'delete':'sale_delete'}
|
||||
queryset = Sale.objects.select_related('customer', 'order', 'product', 'order__contract').all()
|
||||
serializer_class = SaleListSerializer
|
||||
search_fields = ['customer__name', 'order__number']
|
||||
|
@ -57,7 +57,7 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
|||
SaleProduct.objects.bulk_create(i_l)
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=serializers.Serializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post':'sale_audit'}, serializer_class=serializers.Serializer)
|
||||
@transaction.atomic
|
||||
def audit(self, request, pk=None):
|
||||
"""
|
||||
|
@ -124,7 +124,7 @@ class SaleProductViewSet(ListModelMixin, DestroyModelMixin, CreateModelMixin, Ge
|
|||
"""
|
||||
销售记录关联产品
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'sale_update', 'delete':'sale_delete'}
|
||||
queryset = SaleProduct.objects.select_related('iproduct', 'iproduct__material', 'iproduct__warehouse').all()
|
||||
serializer_class = SaleProductListSerializer
|
||||
search_fields = []
|
||||
|
|
|
@ -24,6 +24,7 @@ from .scripts import GetParticipants, HandleScripts
|
|||
|
||||
# Create your views here.
|
||||
class FromCodeListView(APIView):
|
||||
perms_map = {'*':'*'}
|
||||
def get(self, request, format=None):
|
||||
"""
|
||||
获取处理人代码列表
|
||||
|
@ -88,7 +89,8 @@ class WorkflowViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
|||
return Response(ret)
|
||||
|
||||
class StateViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'workflow_update',
|
||||
'put':'workflow_update', 'delete':'workflow_delete'}
|
||||
queryset = State.objects.all()
|
||||
serializer_class = StateSerializer
|
||||
search_fields = ['name']
|
||||
|
@ -96,7 +98,8 @@ class StateViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, Destr
|
|||
ordering = ['sort']
|
||||
|
||||
class TransitionViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'workflow_update',
|
||||
'put':'workflow_update', 'delete':'workflow_delete'}
|
||||
queryset = Transition.objects.all()
|
||||
serializer_class = TransitionSerializer
|
||||
search_fields = ['name']
|
||||
|
@ -104,7 +107,8 @@ class TransitionViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin,
|
|||
ordering = ['id']
|
||||
|
||||
class CustomFieldViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'workflow_update',
|
||||
'put':'workflow_update', 'delete':'workflow_delete'}
|
||||
queryset = CustomField.objects.all()
|
||||
serializer_class = CustomFieldSerializer
|
||||
search_fields = ['field_name']
|
||||
|
@ -117,7 +121,7 @@ class CustomFieldViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin,
|
|||
return super().get_serializer_class()
|
||||
|
||||
class TicketViewSet(OptimizationMixin, CreateUpdateCustomMixin, CreateModelMixin, ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*', 'post':'ticket_create'}
|
||||
queryset = Ticket.objects.all()
|
||||
serializer_class = TicketSerializer
|
||||
search_fields = ['title']
|
||||
|
@ -348,7 +352,7 @@ class TicketViewSet(OptimizationMixin, CreateUpdateCustomMixin, CreateModelMixin
|
|||
else:
|
||||
return Response('工单不可关闭', status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=TicketDestorySerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post':'ticket_deletes'}, serializer_class=TicketDestorySerializer)
|
||||
def destory(self, request, pk=None):
|
||||
"""
|
||||
批量物理删除
|
||||
|
@ -362,7 +366,7 @@ class TicketFlowViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
"""
|
||||
工单日志
|
||||
"""
|
||||
perms_map = {'*':'*'}
|
||||
perms_map = {'get':'*'}
|
||||
queryset = TicketFlow.objects.all()
|
||||
serializer_class = TicketFlowSerializer
|
||||
search_fields = ['suggestion']
|
||||
|
|
|
@ -55,7 +55,7 @@ class WpmService(object):
|
|||
wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||
|
||||
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and \
|
||||
test.is_midtesing is True:
|
||||
test.is_midtesting is True:
|
||||
wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||
test_i = test
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
车间生产计划
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = SubProductionPlan.objects.select_related(
|
||||
'process', 'workshop', 'subproduction', 'product').exclude(state=0)
|
||||
search_fields = []
|
||||
|
@ -57,7 +57,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
|||
ordering_fields = []
|
||||
ordering = ['-update_time']
|
||||
|
||||
@action(methods=['post', 'get'], detail=True, perms_map={'post': '*', 'get': '*'}, serializer_class=PickHalfsSerializer)
|
||||
@action(methods=['post', 'get'], detail=True, perms_map={'post': 'pick_half', 'get': '*'}, serializer_class=PickHalfsSerializer)
|
||||
@transaction.atomic
|
||||
def pick_half(self, request, pk=None):
|
||||
"""
|
||||
|
@ -124,7 +124,7 @@ class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
车间物料表
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = WMaterial.objects.select_related(
|
||||
'material', 'subproduction_plan').filter(count__gt=0)
|
||||
serializer_class = WMaterialListSerializer
|
||||
|
@ -132,7 +132,7 @@ class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
|
|||
ordering_fields = ['material__number']
|
||||
ordering = ['material__number']
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=PickSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'pick'}, serializer_class=PickSerializer)
|
||||
def pick(self, request, pk=None):
|
||||
"""
|
||||
领料
|
||||
|
@ -148,7 +148,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
"""
|
||||
半成品
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = WProduct.objects.select_related('step', 'material',
|
||||
'subproduction_plan', 'warehouse', 'subproduction_plan__production_plan__order',
|
||||
'to_order').prefetch_related('wp_child')
|
||||
|
@ -169,7 +169,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
queryset = queryset.filter(is_hidden=False)
|
||||
return queryset
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WpmTestFormInitSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'wp_test_init'}, serializer_class=WpmTestFormInitSerializer)
|
||||
@transaction.atomic
|
||||
def test_init(self, request, pk=None):
|
||||
"""
|
||||
|
@ -228,7 +228,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
return Response(TestRecordDetailSerializer(instance=tr).data)
|
||||
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WproductPutInsSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'wp_putins'}, serializer_class=WproductPutInsSerializer)
|
||||
@transaction.atomic
|
||||
def putins(self, request, pk=None):
|
||||
"""
|
||||
|
@ -287,7 +287,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
WpmService.add_wproduct_flow_log(i, 'putins')
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=WproductPutInSerializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post': 'wp_putin'}, serializer_class=WproductPutInSerializer)
|
||||
@transaction.atomic
|
||||
def putin(self, request, pk=None):
|
||||
"""
|
||||
|
@ -334,7 +334,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
WpmService.add_wproduct_flow_log(wproduct, 'putin')
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=ScrapSerializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post': 'wp_scrap'}, serializer_class=ScrapSerializer)
|
||||
def scrap(self, request, pk=None):
|
||||
"""
|
||||
报废操作
|
||||
|
@ -399,7 +399,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
else:
|
||||
raise exceptions.APIException('未找到对应审批流程')
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=WproductMtestSerializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post': 'wp_mtest'}, serializer_class=WproductMtestSerializer)
|
||||
@transaction.atomic
|
||||
def mtest(self, request, pk=None):
|
||||
"""
|
||||
|
@ -424,7 +424,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
WpmService.add_wproduct_flow_log(instance=obj, change_str=change_str)
|
||||
return Response()
|
||||
|
||||
@action(methods=['get'], detail=True, perms_map={'get': '*'})
|
||||
@action(methods=['get'], detail=True, perms_map={'get': 'wp_card'})
|
||||
def card(self, request, pk=None):
|
||||
"""
|
||||
流程卡
|
||||
|
@ -449,7 +449,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
ret.append([str(index + 1), item['step_name'], item['actions']])
|
||||
return Response(ret)
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WproductNeedToOrderSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'wp_need_to_order'}, serializer_class=WproductNeedToOrderSerializer)
|
||||
@transaction.atomic
|
||||
def need_to_order(self, request, pk=None):
|
||||
"""
|
||||
|
@ -467,7 +467,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
WpmService.add_wproduct_flow_log(i, change_str='need_to_order')
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WproductToOrderSerializer)
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'wp_to_order'}, serializer_class=WproductToOrderSerializer)
|
||||
@transaction.atomic
|
||||
def to_order(self, request, pk=None):
|
||||
"""
|
||||
|
@ -496,7 +496,7 @@ class WproductTicketViewSet(ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
玻璃审批工单
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan',
|
||||
'resp_process', 'subproduction_plan__production_plan__order',
|
||||
'subproduction_plan__production_plan')
|
||||
|
@ -512,7 +512,8 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
|||
"""
|
||||
生产操作记录
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'operation_create',
|
||||
'put':'operation_update', 'delete':'operation_delete'}
|
||||
queryset = Operation.objects.select_related('step').prefetch_related(
|
||||
'ow_operation', 'oe_operation', 'or_operation').all()
|
||||
serializer_class = OperationListSerializer
|
||||
|
@ -622,7 +623,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
|||
opm.save()
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=serializers.Serializer)
|
||||
@action(methods=['post'], detail=True, perms_map={'post': 'operation_submit'}, serializer_class=serializers.Serializer)
|
||||
@transaction.atomic
|
||||
def submit(self, request, pk=None):
|
||||
"""
|
||||
|
@ -775,7 +776,8 @@ class OperationWproductViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMix
|
|||
"""
|
||||
操作使用的半成品
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'operation_update',
|
||||
'put':'operation_update', 'delete':'operation_delete'}
|
||||
queryset = OperationWproduct.objects.select_related(
|
||||
'subproduction_plan', 'material').all()
|
||||
serializer_class = OperationWproductListSerializer
|
||||
|
@ -804,7 +806,8 @@ class OperationEquipViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin,
|
|||
"""
|
||||
操作使用的设备
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'operation_update',
|
||||
'put':'operation_update', 'delete':'operation_delete'}
|
||||
queryset = OperationEquip.objects.select_related(
|
||||
'operation', 'equip').all()
|
||||
serializer_class = OperationEquipListSerializer
|
||||
|
@ -836,7 +839,8 @@ class OperationRecordViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin
|
|||
"""
|
||||
操作使用的自定义表格
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'operation_update',
|
||||
'put':'operation_update', 'delete':'operation_delete'}
|
||||
queryset = OperationRecord.objects.select_related(
|
||||
'operation', 'form').all()
|
||||
serializer_class = OperationRecordListSerializer
|
||||
|
@ -880,7 +884,7 @@ class OperationMaterialInputViewSet(ListModelMixin, CreateModelMixin, DestroyMod
|
|||
"""
|
||||
消耗物料
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'}
|
||||
queryset = OperationMaterial.objects.select_related(
|
||||
'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_IN)
|
||||
serializer_class = OperationMaterialListSerializer
|
||||
|
@ -893,7 +897,7 @@ class OperationMaterialInputViewSet(ListModelMixin, CreateModelMixin, DestroyMod
|
|||
return OperationMaterialCreate1Serailizer
|
||||
return super().get_serializer_class()
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'operation_update'},
|
||||
serializer_class=OperationMaterialCreate1ListSerailizer)
|
||||
def creates(self, request, pk=None):
|
||||
"""
|
||||
|
@ -917,7 +921,7 @@ class CuttingListViewSet(ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
下料清单
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*'}
|
||||
queryset = OperationMaterial.objects.select_related('operation',
|
||||
'subproduction_plan', 'material',
|
||||
'operation__create_by').filter(operation__step__id=1,
|
||||
|
@ -932,7 +936,7 @@ class OperationMaterialOutputViewSet(ListModelMixin, CreateModelMixin, DestroyMo
|
|||
"""
|
||||
产出物料
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'}
|
||||
queryset = OperationMaterial.objects.select_related(
|
||||
'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_OUT)
|
||||
serializer_class = OperationMaterialListSerializer
|
||||
|
@ -945,7 +949,7 @@ class OperationMaterialOutputViewSet(ListModelMixin, CreateModelMixin, DestroyMo
|
|||
return OperationMaterialCreate2Serailizer
|
||||
return super().get_serializer_class()
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'operation_update'},
|
||||
serializer_class=OperationMaterialCreate2ListSerailizer)
|
||||
def creates(self, request, pk=None):
|
||||
"""
|
||||
|
@ -969,7 +973,7 @@ class OperationMaterialToolViewSet(ListModelMixin, CreateModelMixin, DestroyMode
|
|||
"""
|
||||
工具工装
|
||||
"""
|
||||
perms_map = {'*': '*'}
|
||||
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'}
|
||||
queryset = OperationMaterial.objects.select_related(
|
||||
'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_TOOL)
|
||||
serializer_class = OperationMaterialListSerializer
|
||||
|
|
Loading…
Reference in New Issue