shengchanzijihua

This commit is contained in:
shilixia 2021-10-15 10:14:19 +08:00
parent 9592cb5fbc
commit e683cf39ca
5 changed files with 257 additions and 11 deletions

View File

@ -3,14 +3,14 @@ import request from '@/utils/request'
//生产排程
export function getProductionplanList(query) {
return request({
url: 'pm/productionplan/',
url: 'pm/production_plan/',
method: 'get',
params: query
})
}
export function createProductionplan(data) {
return request({
url: 'pm/productionplan/',
url: 'pm/production_plan/',
method: 'post',
data
})
@ -31,3 +31,27 @@ export function createequip(data) {
data
})
}
//生成子计划
export function createsubplan(id, data) {
return request({
url: `/pm/production_plan/${id}/gen_subplan/`,
method: 'post',
data
})
}
//子计划列表
export function getsubproductionplanList(query) {
return request({
url: '/pm/subproduction_plan/',
method: 'get',
params: query
})
}
//子计划编辑开始结束时间
export function updatesubproductionplan(id, data) {
return request({
url: `/pm/subproduction_plan/${id}/`,
method: 'put',
data
})
}

View File

@ -144,6 +144,14 @@ export const asyncRoutes = [
name: 'plan',
component: () => import('@/views/pm/plan'),
meta: { title: '生产计划管理', icon: 'example', perms: ['index_manage'] }
}
,
{
path: 'work/:id',
name: 'work',
component: () => import('@/views/pm/work'),
meta: { title: '生产子计划', perms: ['vendor_manage'] },
hidden: true
},
{
path: 'resources',

View File

@ -51,7 +51,12 @@
<el-table-column label="交付截止时间">
<template slot-scope="scope">{{ scope.row.order_.delivery_date }}</template>
</el-table-column>
<el-table-column label="是否生成子计划">
<template slot-scope="scope" >
<el-tag v-if="scope.row.is_planed==false"></el-tag>
<el-tag v-if="scope.row.is_planed==true"></el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
@ -61,13 +66,14 @@
width="100px"
>
<template slot-scope="scope">
<el-link type="primary"
v-if="checkPermission(['warehouse_update'])"
@click="handleclick(scope)"
>车间排产</el-link
>
v-if="scope.row.is_planed"
@click="handleselectplan(scope)"
>查看子计划</el-link>
<el-link type="primary"
v-else
@click="handleWork(scope)"
>生产子计划</el-link>
</template>
</el-table-column>
</el-table>
@ -118,6 +124,8 @@
<el-table-column label="交货日期">
<template slot-scope="scope">{{ scope.row.delivery_date }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
@ -190,7 +198,7 @@
</template>
<script>
import { getordertoplan } from "@/api/sam";
import { createProductionplan,getProductionplanList} from "@/api/pm";
import { createProductionplan,getProductionplanList,createsubplan} from "@/api/pm";
import { getMaterialList } from "@/api/mtm";
import checkPermission from "@/utils/permission";
@ -282,6 +290,31 @@ export default {
}
});
},
handleWork(scope)
{
this.$confirm("确认生成子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await createsubplan(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("生成子计划成功!");
}
});
})
.catch((err) => {
console.error(err);
});
},
//查看子计划
handleselectplan(scope)
{
this.$router.push({name: "work", params: { id: scope.row.id }, })
}
},
};

View File

@ -0,0 +1,181 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>生产任务列表</span>
</div>
<el-table
:data="subproductionplanList.results"
border
fit
stripe
style="width: 100%"
max-height="400"
>
<el-table-column type="index" width="50" />
<el-table-column label="生产子计划名">
<template slot-scope="scope">{{ scope.row.workshop_.name }}</template>
</el-table-column>
<el-table-column label="工序名">
<template slot-scope="scope">{{ scope.row.process_.name }}</template>
</el-table-column>
<el-table-column label="工序编号">
<template slot-scope="scope">{{ scope.row.process_.number }}</template>
</el-table-column>
<el-table-column label="开工时间">
<template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column>
<el-table-column label="完工时间">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="100px"
>
<template slot-scope="scope">
<el-link type="primary"
v-if="checkPermission(['warehouse_update'])"
@click="handleclick(scope)"
>编辑</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="subproductionplanList.count > 0"
:total="subproductionplanList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getspList"
/>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
>
<el-form
ref="Form"
:model="subproductionplan"
label-width="180px"
label-position="right"
:rules="rule1"
>
<el-form-item label="子计划开工时间" prop="start_date">
<el-date-picker
v-model="subproductionplan.start_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
>
</el-date-picker>
</el-form-item>
<el-form-item label="子计划完工时间" prop="end_date">
<el-date-picker
v-model="subproductionplan.end_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
>
</el-date-picker>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getsubproductionplanList,updatesubproductionplan } from "@/api/pm";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultesubproductionplan = {
};
export default {
components: { Pagination },
data() {
return {
subproductionplan: defaultesubproductionplan,
subproductionplanList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.id=this.$route.params.id;
this.getspList();
},
methods: {
checkPermission,
//订单列表
getspList() {
this.listLoading = true;
this.listQuery.production_plan = this.id;
console.log(this.listQuery)
getsubproductionplanList(this.listQuery).then((response) => {
if (response.data) {
this.subproductionplanList = response.data;
}
this.listLoading = false;
});
},
handleclick(scope)
{
this.subproductionplan = Object.assign({}, scope.row); // copy obj
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
confirm()
{
updatesubproductionplan(this.subproductionplan.id,this.subproductionplan).then((res) => {
if (res.code >= 200) {
this.getspList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
},
};
</script>

View File

@ -74,7 +74,7 @@
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
v-if="scope.row.planed_count==0&&checkPermission(['warehouse_update'])"
@click="handleEdit(scope)"
>编辑</el-link
>