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

This commit is contained in:
shijing 2022-01-17 14:16:44 +08:00
commit 9a31871839
9 changed files with 223 additions and 34 deletions

View File

@ -61,6 +61,14 @@ export function getfifoList(query) {
})
}
//出入库记录删除
export function deleteFifo(id, data) {
return request({
url: `/inm/fifo/${id}/`,
method: 'delete',
data
})
}
//出入库记录删除
export function deleteFifoitem(id, data) {
return request({
url: `/inm/fifoitem/${id}/`,
@ -113,4 +121,13 @@ export function saleMtest(id, data) {
method: 'POST',
data
})
}
}
//复验上传
export function itemfiles(id, data) {
return request({
url: `/inm/fifoitem/${id}/`,
method: 'put',
data
})
}

View File

@ -234,6 +234,7 @@ import {
createInventory,
getWarehouseList,
deleteFifoitem,
deleteFifo,
audit,
} from "@/api/inm";
import checkPermission from "@/utils/permission";
@ -402,7 +403,7 @@ export default {
type: "error",
})
.then(async () => {
await deleteFifoitem(scope.row.id);
await deleteFifo(scope.row.id);
this.getList();
this.$message.success("成功");
})

View File

@ -48,20 +48,24 @@
</template>
</el-table-column>
<el-table-column label="文件">
<template slot-scope="scope" v-if="scope.row.files">
<div v-for="item in scope.row.files_" v-bind:key="item.id">
<el-link :href="item.path" target="_blank" type="primary">{{
item.name
}}</el-link>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
type="primary"
@click="handleMaterial(scope)"
<el-link type="primary" @click="handleMaterial(scope)" v-if="scope.row.need_test"
>复验</el-link
>
<el-link
type="primary"
@click="handlefile(scope)"
>上传</el-link
>
<el-link type="primary" @click="handleEdit(scope)">上传</el-link>
</template>
</el-table-column>
</el-table>
@ -73,8 +77,65 @@
@pagination="getList"
/>
</el-card>
<el-dialog
:close-on-click-modal="false"
:visible.sync="dialogVisible"
title="上传文件"
>
<el-form
ref="Form"
:model="FIFOItem"
label-width="100px"
label-position="right"
>
<el-form-item label="是否需要复验" prop="need_test">
<el-switch v-model="FIFOItem.need_test"></el-switch>
</el-form-item>
<el-dialog title="物料检查表" :close-on-click-modal="false" :visible.sync="outerVisible">
<el-form-item label="文件列表">
<el-upload
ref="upload"
:action="upUrl"
:before-upload="beforeUpload"
:on-success="handleUpSuccess"
:headers="upHeaders"
multiple
accept="image/*,.ppt,.pdf,.doc,.docx,.xls,.xlsx"
>
<el-button size="small" type="primary">上传文件</el-button>
<span class="el-upload__tip">
可上传多个pdf,word,ppt,excel,图片文件,单文件大小不超过50M
</span>
</el-upload>
</el-form-item>
<div
v-for="(item, index) in fileList"
v-bind:key="item.id"
style="margin-top: 2px;"
>
<i
class="el-icon-delete"
@click="deleteFile(index)"
style="color: red"
></i>
<el-link :href="item.path" target="_blank" type="primary">{{
item.name
}}</el-link>
</div>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm()">确认</el-button>
</div>
</el-dialog>
<el-dialog
title="物料检查表"
:close-on-click-modal="false"
:visible.sync="outerVisible"
>
<el-select style="width: 100%" v-model="recordform" placeholder="请选择">
<el-option
v-for="item in recordformList"
@ -209,14 +270,18 @@
</div>
</template>
<script>
import { getfifodetailList } from "@/api/inm";
import { getfifodetailList,itemfiles } from "@/api/inm";
import checkPermission from "@/utils/permission";
import { getMaterialList, getrecordformList, getrffieldList } from "@/api/mtm";
import { createTestrecord } from "@/api/inm";
import { getUserList } from "@/api/user";
import { upUrl, upHeaders } from "@/api/file";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultfile = {
files:[],
need_test:false,
};
export default {
components: { Pagination },
data() {
@ -227,6 +292,10 @@ export default {
fifodetailList: {
count: 0,
},
upHeaders: upHeaders(),
upUrl: upUrl(),
fileList: [],
FIFOItem:defaultfile,
listQuery: {
page: 1,
page_size: 20,
@ -242,18 +311,26 @@ export default {
listQueryrecordform: {
page: 0,
},
fileData:{},
outerVisible: false,
innerVisible: false,
dialogVisible: false,
dialogType: "new",
testrecord: {},
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
fileList: [],
};
},
computed: {},
watch: {},
created() {
this.getList();
},
mounted() {
},
methods: {
checkPermission,
@ -269,11 +346,75 @@ export default {
this.listLoading = false;
});
},
//上传物料文件
handlefile(scope)
{
handleUpSuccess(res, file, filelist) {
this.fileList.push({
id: res.data.id,
name: res.data.name,
path: res.data.path,
});
this.handleRemove(file);
},
handleRemove(file) {
// 实现删除文件
let fileList = this.$refs.upload.uploadFiles;
let index = fileList.findIndex((fileItem) => {
return fileItem.uid === file.uid;
});
fileList.splice(index, 1);
},
beforeUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 50;
if (!isLt2M) {
this.$message.error("单文件不能超过50MB!");
}
return isLt2M;
},
deleteFile(index) {
this.$confirm("确定删除该文件, 是否继续?", { type: "error" })
.then(() => {
this.fileList.splice(index, 1);
})
.catch((e) => {});
},
yeschange(val) {
if (!val) {
this.fileList = [];
}
},
handleEdit(scope) {
this.FIFOItem = Object.assign({}, scope.row); // copy obj
this.fileList=[],
this.dialogVisible = true;
for (var i = 0; i < this.FIFOItem.files_.length; i++) {
this.fileList.push({
id: this.FIFOItem.files_[i].id,
name: this.FIFOItem.files_[i].name,
path: this.FIFOItem.files_[i].path,
});
}
},
confirm() {
var files = [];
for (var i = 0; i < this.fileList.length; i++) {
files.push(this.fileList[i].id);
}
this.fileData.files=files;
this.fileData.need_test=this.FIFOItem.need_test;
console.log(this.fileData)
itemfiles(this.FIFOItem.id,this.fileData).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleMaterial(scope) {
//调该物料对应的检查表
this.outerVisible = true;
@ -302,10 +443,9 @@ export default {
let _this = this;
_this.field = []; //检查项目
this.fieldList.forEach((item) => {
_this.field.push({
form_field:item.id,
field_value:item.sort
form_field: item.id,
field_value: item.sort,
});
});

View File

@ -256,7 +256,7 @@ getMaterial(){
})
},
getOrderList(){
getOrderList({product:this.material,page:0}).then((response) => {
getOrderList({material:this.material,page:0}).then((response) => {
if (response.data) {
this.orderlist = response.data;//物料关联的订单
@ -264,7 +264,7 @@ getMaterial(){
})
},
getplanList() {
getProductionplanList({product:this.material,page:0}).then((response) => {
getProductionplanList({material:this.material,page:0}).then((response) => {
if (response.data) {
this.productionplanList = response.data;//物料关联计划
}

View File

@ -129,19 +129,23 @@
@click="handlework(item)"
>{{ item.name }}</el-button
>
<el-button
type="primary"
@click="handleAll()"
style="float: right"
>显示全部</el-button
>
<el-button
<el-button
type="primary"
@click="handleScrapbcp()"
id="scrap"
style="float: right; display: none"
>报废</el-button
>
<el-badge :value="count" class="item" style="float:right">
<el-button
type="primary"
@click="handleAll()"
>显示全部</el-button
>
</el-badge>
<el-table
:data="wproductData"
@ -714,6 +718,12 @@
</div>
</template>
<style>
.item {
margin-right: 20px;
}
</style>
<script>
import { getsubproductionplanList, createPick_need } from "@/api/pm";
import checkPermission from "@/utils/permission";
@ -832,6 +842,7 @@ export default {
{ lable: "划伤", value: 30 },
{ lable: "其他", value: 40 },
],
count:null,
};
},
process: "",
@ -1100,7 +1111,10 @@ export default {
if (this.values++ > this.forms.length) this.values = 0;
},
handleSelectionChange(val) {
this.count=val.length;
console.log(this.count);
let _this = this;
_this.wpID = [];
val.forEach((item) => {
_this.wpID.push(item.id);

View File

@ -147,7 +147,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
def destroy(self, request, *args, **kwargs):
obj = self.get_object()
if obj.is_submited:
if obj.is_audited:
raise exceptions.APIException('该记录已审核,不可删除')
return super().destroy(request, *args, **kwargs)

View File

@ -9,6 +9,7 @@ class PlanFilterSet(filters.FilterSet):
create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte')
create_time_end = filters.DateFilter(field_name="create_time", lookup_expr='lte')
tag = filters.CharFilter(method='filter_tag')
material = filters.NumberFilter(method='filter_material')
class Meta:
model = ProductionPlan
fields = ['product', 'order', 'create_time_start', 'create_time_end']
@ -19,10 +20,17 @@ class PlanFilterSet(filters.FilterSet):
elif value == 'working':
queryset = queryset.exclude(state__in=[ProductionPlan.PLAN_STATE_DONE, ProductionPlan.PLAN_MTEST_DONE])
return queryset
def filter_material(self, queryset, name, value):
"""
按物料筛选
"""
return queryset.filter(subplan_plan__progress_subplan__material__id=value).distinct()
class SubproductionProgressFilterSet(filters.FilterSet):
operation = filters.NumberFilter(method='filter_operation')
class Meta:
model = SubProductionProgress
fields = ['material', 'subproduction_plan', 'operation', 'type']
@ -40,3 +48,5 @@ class SubproductionProgressFilterSet(filters.FilterSet):
queryset = queryset.exclude(material__type__in =[Material.MA_TYPE_HALFGOOD, Material.MA_TYPE_GOOD])
return queryset

View File

@ -29,7 +29,7 @@ class ProductionPlan(CommonAModel):
(PLAN_MTEST_DONE, '军检完成')
)
number = models.CharField('编号', max_length=50, unique=True)
order = models.ForeignKey(Order, verbose_name='关联订单', null=True, blank=True, on_delete=models.SET_NULL)
order = models.ForeignKey(Order, verbose_name='关联订单', null=True, blank=True, on_delete=models.SET_NULL, related_name='plan_order')
state = models.PositiveIntegerField('状态', choices=state_choices, default=PLAN_STATE_PLANING)
product = models.ForeignKey(Material, verbose_name='生产产品', on_delete=models.CASCADE)
count = models.PositiveIntegerField('生产数量', default=1)

View File

@ -6,9 +6,16 @@ from apps.sam.models import Order
class OrderFilterSet(filters.FilterSet):
create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte')
create_time_end = filters.DateFilter(field_name="create_time", lookup_expr='lte')
material = filters.NumberFilter(method='filter_material')
class Meta:
model = Order
fields = ['product', 'contract', 'customer', 'create_time_start', 'create_time_end']
def filter_material(self, queryset, name, value):
"""
按物料筛选
"""
return queryset.filter(plan_order__subplan_plan__progress_subplan__material__id=value).distinct()
class ContractFilterSet(filters.FilterSet):