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

This commit is contained in:
shijing 2021-12-02 14:56:32 +08:00
commit 90586a7d7d
62 changed files with 3450 additions and 284 deletions

View File

@ -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,

View File

@ -80,4 +80,13 @@ export function createPick_need(id, data) {
method: 'post',
data
})
}
}
//生产进度表
export function getprogressList(query) {
return request({
url: '/pm/subproduction_progress/',
method: 'get',
params: query
})
}

View File

@ -58,6 +58,15 @@ export function wproductTest(data) {
data
})
}
//半成品复检
export function wproductRetest(data) {
return request({
url: '/wpm/wproduct/retest/',
method: 'post',
data
})
}
//半成品入库
@ -68,4 +77,188 @@ export function wproductPutin(id, data) {
data
})
}
//车间领半成品
export function getpickhalfList(id) {
return request({
url: `/wpm/subplan/${id}/pick_half/`,
method: 'get'
})
}
//子计划半成品领料
export function createpickhalf(id, data) {
return request({
url: `/wpm/subplan/${id}/pick_half/`,
method: 'post',
data
})
}
//车间点击对应工序的子工序,创建操作记录
export function createOperation(data) {
return request({
url: '/wpm/operation/',
method: 'post',
data
})
}
//生产记录操作记录列表
export function getoperationList(query) {
return request({
url: '/wpm/operation/',
method: 'get',
params: query
})
}
//生产操作,提交边角料
export function createoperation(id, data) {
return request({
url: `/wpm/operation/${id}/`,
method: 'put',
data
})
}
//调取一条操作记录
export function getoperation(id) {
return request({
url: `/wpm/operation/${id}/`,
method: 'get'
})
}
//操作使用的半成品列表
export function getoperationwproductList(query) {
return request({
url: '/wpm/operation_wproduct/',
method: 'get',
params: query
})
}
//操作半成品删除
export function deleteOperationwproduct(id) {
return request({
url: `/wpm/operation_wproduct/${id}/`,
method: 'delete',
})
}
//删除操作记录
export function deleteOperation(id) {
return request({
url: `/wpm/operation/${id}/`,
method: 'delete',
})
}
//操作设备
export function getequList(query) {
return request({
url: '/wpm/operation_equip/',
method: 'get',
params: query
})
}
//操作设备删除
export function deleteOperationequip(id) {
return request({
url: `/wpm/operation_equip/${id}/`,
method: 'delete',
})
}
//操作自定义表
export function getrecordList(query) {
return request({
url: '/wpm/operation_record/',
method: 'get',
params: query
})
}
//操作提交自定义表
export function createRecord(id, data) {
return request({
url: `/wpm/operation_record/${id}/submit/`,
method: 'post',
data
})
}
//操作消耗物料
export function getinputList(query) {
return request({
url: '/wpm/operation_input/',
method: 'get',
params: query
})
}
//车间物料消耗
export function createInput(data) {
return request({
url: '/wpm/operation_input/',
method: 'post',
data
})
}
//操作,产出物料
export function getoutputList(query) {
return request({
url: '/wpm/operation_output/',
method: 'get',
params: query
})
}
//产出物料
export function createOutput(data) {
return request({
url: '/wpm/operation_output/',
method: 'post',
data
})
}
//提交本次操作
export function submitOperation(id, data) {
return request({
url: `/wpm/operation/${id}/submit/`,
method: 'post',
data
})
}
//操作,工序工装
export function gettoolList(query) {
return request({
url: '/wpm/operation_tool/',
method: 'get',
params: query
})
}
//操作工序工装
export function createTool(data) {
return request({
url: '/wpm/operation_tool/',
method: 'post',
data
})
}

View File

@ -103,6 +103,7 @@ export const asyncRoutes = [
name: 'material',
component: () => import('@/views/mtm/material'),
meta: { title: '物料清单', icon: 'example', perms: ['mtm_material'] }
}
,
{
@ -179,12 +180,26 @@ export const asyncRoutes = [
name: 'pm',
meta: { title: '生产执行', icon: 'example', perms: ['equipment_set'] },
children: [
{
{
path: 'worktask',
name: 'worktask',
component: () => import('@/views/wpm/worktask'),
meta: { title: '车间任务', icon: 'example', perms: ['index_manage'] }
},
{
path: 'operation',
name: 'operation',
component: () => import('@/views/wpm/operation'),
meta: { title: '车间操作', icon: 'example', perms: ['index_manage'] }
}
,
{
path: 'operationdo/:id',
name: 'operationdo',
component: () => import('@/views/wpm/operationdo'),
meta: { title: '车间操作跳转界面', icon: 'example', perms: ['index_manage'] },
hidden: true
},
{
path: 'need/:id',
name: 'need',
@ -323,6 +338,12 @@ export const asyncRoutes = [
component: () => import('@/views/inm/wproduct'),
meta: { title: '半成品', icon: 'example', perms: ['index_manage'] }
},
{
path: 'product',
name: 'product',
component: () => import('@/views/inm/product'),
meta: { title: '成品', icon: 'example', perms: ['index_manage'] }
},
]
},

View File

@ -126,6 +126,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑设备' : '新增设备'"
>
<el-form

View File

@ -135,6 +135,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑设备' : '新增设备'"
>
<el-form

View File

@ -94,6 +94,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑校准检定' : '新增校准检定'"
>
<el-form

View File

@ -37,7 +37,9 @@
fit
stripe
highlight-current-row
max-height="600"
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="出入记录ID">
@ -95,6 +97,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑出/如库记录' : '新增出/如库记录'"
>
<el-form
@ -142,7 +145,7 @@
label="物料:"
:prop="'details.' + index + '.material'"
>
<el-select v-model="item.material" size="small">
<el-select v-model="item.material" filterable size="small">
<el-option
v-for="item in materialoptions"
:key="item.value"

View File

@ -67,7 +67,7 @@
/>
</el-card>
<el-dialog title="物料检查表" :visible.sync="outerVisible">
<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"
@ -82,6 +82,7 @@
width="30%"
title="检查项目"
:visible.sync="innerVisible"
:close-on-click-modal="false"
append-to-body
>
<el-form label-width="80px" label-position="right">

View File

@ -49,9 +49,13 @@
<el-table-column label="物料单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column>
<el-table-column label="物料型号">
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="物料类别">
<template slot-scope="scope"> {{options_[scope.row.material_.type]}}</template>
</el-table-column>
<el-table-column label="物料存量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
@ -90,7 +94,16 @@ export default {
page: 1,
page_size: 20,
},
options_:{
"1":'成品',
"2":'半成品',
"3":'主要原料',
"4":'辅助材料',
"5":'加工工具',
"6":'辅助工装',
},
listLoading: true,
dialogVisible: false,
dialogType: "new",

View File

@ -33,7 +33,9 @@
fit
stripe
highlight-current-row
max-height="600"
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料批次">
@ -42,7 +44,10 @@
<el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="物料编号">
<template slot-scope="scope">{{
scope.row.material_.number

View File

@ -0,0 +1,89 @@
<template>
<div class="app-container">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="iproductData.results"
border
fit
stripe
highlight-current-row
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="成品批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="所在仓库">
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
</el-table>
<pagination
v-show="iproductData.count > 0"
:total="iproductData.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import {
getiproductList,
} from "@/api/inm";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
iproductData: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
//半成品列表
getList() {
this.listLoading = true;
getiproductList(this.listQuery).then((response) => {
if (response.data) {
this.iproductData= response.data;
}
this.listLoading = false;
});
},
},
};
</script>

View File

@ -37,7 +37,9 @@
fit
stripe
highlight-current-row
max-height="600"
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="仓库名称">
@ -85,6 +87,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑仓库' : '新增仓库'"
>
<el-form

View File

@ -9,7 +9,9 @@
fit
stripe
highlight-current-row
max-height="600"
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="半成品编号">

View File

@ -1,13 +1,15 @@
<template>
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增物料</el-button
>
<el-input
v-model="listQuery.search"
placeholder="物料名称/物料编号/物料类型"
placeholder="物料名称/物料编号"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
@ -30,6 +32,14 @@
</el-card>
<el-card style="margin-top: 2px">
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="成品" name="1"></el-tab-pane>
<el-tab-pane label="半成品" name="2"></el-tab-pane>
<el-tab-pane label="主要原料" name="3"></el-tab-pane>
<el-tab-pane label="辅助材料" name="4"></el-tab-pane>
<el-tab-pane label="加工工具" name="5"></el-tab-pane>
<el-tab-pane label="辅助工装" name="6"></el-tab-pane>
</el-tabs>
<el-table
v-loading="listLoading"
:data="materialList.results"
@ -37,9 +47,9 @@
fit
stripe
highlight-current-row
max-height="600"
max-height="620"
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
v-el-height-adaptive-table="{bottomOffset: 10}"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料编号">
@ -60,6 +70,9 @@
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.specification }}</template>
</el-table-column>
<el-table-column label="单片玻璃数量" v-if="materialList.results[0].type==1">
<template slot-scope="scope">{{ scope.row.piece_count }}</template>
</el-table-column>
<el-table-column label="计量单位">
<template slot-scope="scope">{{ scope.row.unit }}</template>
@ -103,6 +116,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑物料' : '新增物料'"
>
<el-form
@ -144,7 +158,11 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="单片玻璃数量" prop="piece_count" v-if="material.type==1">
<el-input v-model="material.piece_count" placeholder="单片玻璃数量" />
</el-form-item>
<el-form-item label="排序" prop="sort_str">
<el-input v-model="material.sort_str" placeholder="排序" />
</el-form-item>
@ -230,7 +248,8 @@ export default {
page: 1,
page_size: 20,
},
activeName:"",
listLoading: true,
dialogVisible: false,
dialogType: "new",
@ -250,8 +269,18 @@ export default {
},
methods: {
checkPermission,
//物料列表
getList() {
//选项卡切换
handleClick(tab) {
this.listLoading = true;
this.listQuery.type=tab.name;
getMaterialList(this.listQuery).then((response) => {
if (response.data) {
this.materialList = response.data;
}
this.listLoading = false;
});
},
getList() {
this.listLoading = true;
getMaterialList(this.listQuery).then((response) => {
if (response.data) {
@ -260,10 +289,6 @@ export default {
this.listLoading = false;
});
},
filterTag(value, row) {
return row.type === value;
},
//工序清单
getProcessList() {
getProcessList().then((res) => {
@ -282,6 +307,7 @@ export default {
this.getList();
},
resetFilter() {
this.activeName="";
this.listQuery = {
page: 1,
page_size: 20,

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<el-card>
<el-row :gutter="24">
<el-row :gutter="2">
<!--表格-->
<el-col :span="6">
<el-card>
@ -20,13 +20,14 @@
</el-button>
<!--表格列表-->
<el-table
v-el-height-adaptive-table="{ bottomOffset: 50 }"
:data="recordformList.results"
border
fit
stripe
highlight-current-row
height="100"
height="670"
v-el-height-adaptive-table="{ bottomOffset: 20 }"
@current-change="handleCurrentChange"
>
<el-table-column type="index" width="50"/>
@ -60,6 +61,7 @@
<!--新增编辑记录表格-->
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑记录表格' : '新增记录表格'"
>
<el-form
@ -84,6 +86,7 @@
<!--表格展示-->
<el-dialog
:visible.sync="dialogVisibleForm"
:close-on-click-modal="false"
:title="tableForm.name"
>
<customForm
@ -250,8 +253,8 @@
fit
stripe
highlight-current-row
height="100"
v-el-height-adaptive-table="{ bottomOffset: 50 }"
height="670"
v-el-height-adaptive-table="{ bottomOffset: 20 }"
>
<el-table-column type="index" width="50"/>
<el-table-column label="字段名称">
@ -331,6 +334,7 @@
<!--表格字段新增编辑-->
<el-dialog
:visible.sync="dialogVisible1"
:close-on-click-modal="false"
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"
>
<el-form

View File

@ -15,9 +15,9 @@
border
fit
stripe
highlight-current-row
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
max-height="620"
height="100"
v-el-height-adaptive-table="{bottomOffset: 10}"
>
<el-table-column type="index" width="50" />
<el-table-column label="工序编号">
@ -25,6 +25,9 @@
</el-table-column>
<el-table-column label="工序名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="工序类别">
<template slot-scope="scope">{{ type_[scope.row.type] }}</template>
</el-table-column>
<el-table-column label="生产车间" >
<template slot-scope="scope" v-if="scope.row.workshop_">{{ scope.row.workshop_.name }}</template>
@ -73,6 +76,7 @@
/>
</el-card>
<el-dialog
:close-on-click-modal="false"
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑工序' : '新增工序'"
>
@ -88,6 +92,16 @@
</el-form-item>
<el-form-item label="工序编号" prop="number">
<el-input v-model="process.number" placeholder="工序编号" />
</el-form-item>
<el-form-item label="工序编号" prop="type">
<el-select style="width: 100%" v-model="process.type" placeholder="请选择" >
<el-option
v-for="item in option"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="生产车间" prop="workshop">
<treeselect v-model="process.workshop" :options="workoptions" placeholder="所属部门"/>
@ -149,7 +163,22 @@ export default {
page: 1,
page_size: 20,
},
type_:{
10:'特殊',
20:'关键',
30:'普通',
},
option: [{
value: 10,
label: '特殊'
}, {
value: 20,
label: '关键'
}, {
value: 30,
label: '普通'
}],
listLoading: true,
dialogVisible: false,
dialogType: "new",

View File

@ -1,8 +1,8 @@
<template>
<div class="app-container">
<el-card >
<el-row :gutter="24">
<el-col :span="6" >
<el-row :gutter="2">
<el-col :span="9" >
<el-card >
<div slot="header" class="clearfix">
<span style="font-size: 16px;
@ -20,11 +20,20 @@
@current-change="handleCurrentChange">
<el-table-column type="index" width="50" />
<el-table-column label="产品信息">
<template slot-scope="scope">{{ scope.row.number }}-{{ scope.row.name }}</template>
<el-table-column label="产品编号">
<template slot-scope="scope"> {{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="产品名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.specification }}</template>
</el-table-column>
</el-table>
@ -54,7 +63,7 @@
</el-card>
</el-col>
<el-col :span="18" >
<el-col :span="15" >
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-size: 16px;

View File

@ -19,7 +19,7 @@
@row-click="rowClick"
>
<el-table-column type="index" width="50" />
<el-table-column label="工序步骤名称">
<el-table-column label="工序名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="步骤编号">
@ -38,9 +38,7 @@
</el-table-column>
<el-table-column label="排序">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
@ -63,6 +61,7 @@
</el-table>
<el-dialog
:visible.sync="dialogVisibles"
:close-on-click-modal="false"
:title="dialogTypes === 'edit' ? '编辑工序' : '新增工序'"
>
<el-form
@ -121,8 +120,8 @@
</el-dialog>
</el-card>
<el-card>
<el-row :gutter="24">
<el-col :span="6" >
<el-row :gutter="2">
<el-col :span="9" >
<el-card >
<div slot="header" class="clearfix">
<span style="font-size: 16px;
@ -142,8 +141,17 @@
@current-change="handleCurrentChange"
>
<el-table-column type="index" width="50" />
<el-table-column label="名称">
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.enabled==true" >启用</el-tag>
<el-tag v-else>禁用</el-tag>
</template>
</el-table-column>
<el-table-column label="文件号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column
align="center"
@ -168,6 +176,7 @@
</el-table>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑记录表格' : '新增记录表格'"
>
<el-form
@ -180,6 +189,14 @@
<el-form-item label="表格名称" prop="name">
<el-input v-model="recordform.name" placeholder="表格名称" />
</el-form-item>
<el-form-item label="文件号" prop="number">
<el-input v-model="recordform.number" placeholder="文件号" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="recordform.enabled"></el-switch>
</el-form-item>
<el-form-item label="表格类型" prop="type">
<el-select style="width: 100%" v-model="recordform.type" placeholder="请选择">
<el-option
@ -201,6 +218,7 @@
</el-dialog>
<el-dialog
:model="tableForm"
:close-on-click-modal="false"
:visible.sync="dialogVisibleForm"
:title="tableForm.name">
<el-form
@ -266,7 +284,7 @@
</el-dialog>
</el-card>
</el-col>
<el-col :span="18" >
<el-col :span="15" >
<el-card >
<div slot="header" class="clearfix">
<span style="font-size: 16px;
@ -334,7 +352,7 @@
:limit.sync="listQueryfield.page_size"
@pagination="fieldLists"
/>
<el-dialog :visible.sync="dialogVisible1" :title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'">
<el-dialog :visible.sync="dialogVisible1" :close-on-click-modal="false" :title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'">
<el-form ref="Form" :model="field" label-width="80px" label-position="right">
<el-form-item label="字段类型" prop="field_type">
<el-select style="width: 100%" v-model="field.field_type" placeholder="请选择">
@ -398,7 +416,7 @@
};
const defaultrecordform = {
enabled:true
};
const defaultfield = {

View File

@ -19,7 +19,7 @@
<el-tabs type="border-card">
<el-tab-pane label="过程记录">
<el-row :gutter="24">
<el-row :gutter="2">
<el-col :span="6" >
<el-card style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
@ -66,6 +66,7 @@
</el-table>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑记录表格' : '新增记录表格'"
>
<el-form
@ -160,6 +161,7 @@
</el-table>
<el-dialog
:visible.sync="dialogVisible1"
:close-on-click-modal="false"
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"
>
<el-form

View File

@ -13,25 +13,24 @@
stripe
style="width: 100%"
height="300"
>
<el-table-column type="index" width="50" />
<el-table-column label="生产计划编号" width="110">
<el-table-column label="任务编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="生产订单编号" width="110">
<el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.order_.number }}</template>
</el-table-column>
<el-table-column label="合同编号" width="110">
<template slot-scope="scope">{{ scope.row.order_.contract_.number }}</template>
</el-table-column>
<el-table-column label="客户名称" width="110" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.order_.customer_.name }}</template>
</el-table-column>
<el-table-column label="产品名称" width="150" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.number }}-{{ scope.row.product_.name }}</template>
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
@ -98,6 +97,7 @@
stripe
style="width: 100%"
height="250"
>
<el-table-column type="index" width="50" />
@ -105,10 +105,14 @@
<el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="客户" width="110">
<el-table-column label="客户名称" width="110">
<template slot-scope="scope" show-overflow-tooltip>{{ scope.row.customer_.name }}</template>
</el-table-column>
<el-table-column label="所属合同" show-overflow-tooltip width="110">
<el-table-column label="合同编号" width="110">
<template slot-scope="scope">{{ scope.row.contract_.number }}</template>
</el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip width="110">
<template slot-scope="scope">{{ scope.row.contract_.name }}</template>
</el-table-column>
<el-table-column label="所需产品" show-overflow-tooltip width="150">
@ -117,7 +121,7 @@
<el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="所需数量" width="110">
<el-table-column label="产品数量" width="110">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="已派数量" width="110">
@ -158,6 +162,7 @@
/>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="'排产计划'"
>
<el-form

View File

@ -33,7 +33,7 @@
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="所需数量">
<el-table-column label="产品数量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="已派数量">
@ -43,10 +43,13 @@
<el-table-column label="产品型号">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="客户" show-overflow-tooltip width="150">
<el-table-column label="客户名称" show-overflow-tooltip width="150">
<template slot-scope="scope">{{ scope.row.customer_.name }}</template>
</el-table-column>
<el-table-column label="所属合同" show-overflow-tooltip width="150">
<el-table-column label="合同编号" show-overflow-tooltip width="150">
<template slot-scope="scope">{{ scope.row.contract_.number }}</template>
</el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip width="150">
<template slot-scope="scope">{{ scope.row.contract_.name }}</template>
</el-table-column>
<el-table-column label="交货日期" width="110">

View File

@ -8,22 +8,27 @@
<el-table
:data="subproductionplanList.results"
border
fit
stripe
style="width: 100%"
max-height="700"
height="100"
stripe
border
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="产品名称">
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.subproduction_.name }}</template>
</el-table-column>
<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>
@ -40,7 +45,10 @@
</template>
</el-table-column>
<el-table-column label="生产个数">
<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.main_count }}</template>
</el-table-column>
<el-table-column label="开工时间">
@ -61,6 +69,7 @@
align="center"
label="操作"
width="100px"
>
<template slot-scope="scope">
<el-link type="primary"
@ -93,6 +102,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
>
<el-form
ref="Form"
@ -131,6 +141,7 @@
</el-dialog>
<el-dialog
:visible.sync="dialogVisibles"
:close-on-click-modal="false"
>
<el-table

View File

@ -2,6 +2,10 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增供应商</el-button >
<el-input
v-model="listQuery.search"
placeholder="供应商名称"
@ -24,11 +28,7 @@
>重置</el-button
>
</div>
<div style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增供应商</el-button
>
</div>
</el-card>
<el-card style="margin-top: 2px">
<el-table
@ -38,7 +38,9 @@
fit
stripe
highlight-current-row
max-height="600"
max-height="700"
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="供应商名">

View File

@ -2,6 +2,8 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增标准</el-button >
<el-input
v-model="listQuery.search"
placeholder="标准名称"
@ -24,11 +26,7 @@
>重置</el-button
>
</div>
<div style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增标准</el-button
>
</div>
</el-card>
<el-card style="margin-top: 2px">
<el-table

View File

@ -2,6 +2,9 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增项目</el-button
>
<el-input
v-model="listQuery.search"
placeholder="项目名称"
@ -24,11 +27,7 @@
>重置</el-button
>
</div>
<div style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增项目</el-button
>
</div>
</el-card>
<el-card style="margin-top: 2px">
<el-table

View File

@ -98,6 +98,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑合同' : '新增合同'"
>
<el-form

View File

@ -91,6 +91,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑客户' : '新增客户'"
>
<el-form

View File

@ -51,13 +51,13 @@
<el-table-column label="所属合同" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.contract_.name }}</template>
</el-table-column>
<el-table-column label="所需产品" width="200" show-overflow-tooltip>
<el-table-column label="产品名称" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="120" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="所需数量" width="90" >
<el-table-column label="产品数量" width="90" >
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="交货日期" width="150" >
@ -98,6 +98,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑订单' : '新增订单'"
>
<el-form

View File

@ -97,6 +97,7 @@
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="dialogType === 'edit' ? '编辑合同' : '新增合同'"
>
<el-form

View File

@ -49,7 +49,55 @@
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="已检半成品">
<el-tab-pane label="复检半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="wproductList2.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope)"
>检验</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList2.count > 0"
:total="wproductList2.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="已合格半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
@ -99,7 +147,7 @@
</el-tab-pane>
</el-tabs>
<el-dialog title="物料检查表" :visible.sync="outerVisible">
<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"
@ -118,7 +166,7 @@
>
<el-form label-width="100px" label-position="right">
<el-row
:gutter="24"
:gutter="2"
v-for="(item, $index) in fieldList"
:key="$index"
>
@ -254,7 +302,7 @@
>
</div>
</el-dialog>
<el-dialog title="半成品入库" :visible.sync="dialogFormVisible">
<el-dialog title="半成品入库" :close-on-click-modal="false" :visible.sync="dialogFormVisible">
<el-form :model="form">
<el-form-item label="仓库" :label-width="formLabelWidth">
<el-select
@ -303,6 +351,9 @@ export default {
wproductList1: {
count: 0,
},
wproductList2: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
@ -310,12 +361,19 @@ export default {
listQuery1: {
page: 1,
page_size: 20,
},
listQuery2: {
page: 1,
page_size: 20,
},
actstate_: {
1: "生产中",
2: "待检测",
3: "已合格",
4: "库存中",
6: "待复检",
10: "生产中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
},
choice: [
{
@ -349,15 +407,16 @@ export default {
watch: {},
created() {
this.getList();
this.getList2();
this.getList1();
this.getLists();
},
methods: {
checkPermission,
//半成品列表
//待检半成品列表
getList() {
this.listLoading = true;
this.listQuery.act_state = 2;
this.listQuery.act_state = 20;
getwproductList(this.listQuery).then((response) => {
if (response.data) {
this.wproductList = response.data;
@ -365,9 +424,21 @@ export default {
this.listLoading = false;
});
},
//复检半成品列表
getList2() {
this.listQuery2.act_state = 6;
getwproductList(this.listQuery2).then((response) => {
if (response.data) {
this.wproductList2 = response.data;
}
});
},
//已合格半成品
getList1() {
this.listQuery1.act_state = 3;
this.listQuery1.act_state = 30;
getwproductList(this.listQuery1).then((response) => {
if (response.data) {
this.wproductList1 = response.data;
@ -389,8 +460,10 @@ export default {
//调该物料对应的检查表
this.outerVisible = true;
this.wproduct=scope.row.id;//半成品ID
this.wproductactstate=scope.row.act_state;//半成品状态
this.listQueryrecordform.material = scope.row.material;//
this.listQueryrecordform.type = 2;
this.recordform="";
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
@ -426,13 +499,22 @@ export default {
this.testrecord.record_data = _this.field;//检查项列表
this.testrecord.is_testok = this.is_testok;//检查表检查结果
this.testrecord.wproduct = this.wproduct;//半成品ID
wproductTest(this.testrecord).then((res) => {
wproductTest(this.testrecord).then((res) => {
if (res.code >= 200) {
this.innerVisible = false;
this.outerVisible = false;
this.getList();
this.getList1();
this.getList2();
}
});
},
//半成品入库
handlePutin(scope){
@ -445,6 +527,7 @@ export default {
if (res.code >= 200) {
this.$message.success("入库成功!");
this.dialogFormVisible=false;
this.getList1();
}
});
}

View File

@ -0,0 +1,155 @@
<template>
<div class="app-container">
<el-card class="box-card">
<el-table
:data="operationList.results"
border
fit
stripe
style="width: 100%"
max-height="670"
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="子工序工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="是否提交">
<template slot-scope="scope">
<el-span v-if="scope.row.is_submited"></el-span>
<el-span v-else></el-span></template
>
</el-table-column>
<el-table-column label="创建人">
<template slot-scope="scope">{{
scope.row.create_by_.username
}}</template>
</el-table-column>
<el-table-column label="是否使用边角料">
<template slot-scope="scope">
<el-span v-if="scope.row.use_scrap"></el-span>
<el-span v-else></el-span></template
>
</el-table-column>
<el-table-column label="过程记录表">
<template slot-scope="scope" v-if="scope.row.record_">
<el-tag v-for="item in scope.row.record_"
:key="item.id"
:label="item.name"
:value="item.id">{{item.name}}</el-tag>
</template>
</el-table-column>
<el-table-column label="产品数量">
<template slot-scope="scope" v-if="scope.row.wproduct_">
{{ scope.row.wproduct_.length }}
</template>
</el-table-column>
<el-table-column label="生产设备">
<template slot-scope="scope" v-if="scope.row.equip_">
<el-tag v-for="item in scope.row.equip_"
:key="item.id"
:label="item.number"
:value="item.id">{{item.number}}</el-tag>
</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
v-if="checkPermission(['warehouse_update'])"
@click="handleoperation(scope)"
>前往操作</el-link>
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleDelete(scope)"
>删除</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="operationList.count > 0"
:total="operationList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import { getoperationList, deleteOperation } from "@/api/wpm";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
operationList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
};
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id;
this.getList();
},
methods: {
checkPermission,
//订单列表
getList() {
getoperationList(this.listQuery).then((response) => {
if (response.data) {
this.operationList = response.data;
}
this.listLoading = false;
});
},
handleoperation(scope)
{
this.$router.push({name: "operationdo", params: { id: scope.row.id }, })
},
//操作记录删除
handleDelete(scope) {
this.$confirm("确认该操作删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOperation(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
},
};
</script>

View File

@ -0,0 +1,822 @@
<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<span>基本信息</span>
</div>
<el-form
ref="form"
inline="true"
:model="operationData"
label-width="80px"
>
<el-form-item label="子工序">
<el-input
v-model="operationData.step_.name"
disabled="disabled"
></el-input>
</el-form-item>
<el-form-item label="创建人">
<el-input
v-model="operationData.create_by_.username"
disabled="disabled"
></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-input
v-model="operationData.create_time"
disabled="disabled"
></el-input>
</el-form-item>
<el-form-item label="边角料">
<el-radio-group v-model="operationData.use_scrap">
<el-radio border
:label="item.value"
:key="item.value"
v-for="item in scrap"
>{{ item.lable }}</el-radio
>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" v-if="operationData.use_scrap">
<el-input type="textarea" v-model="operationData.remark"></el-input>
</el-form-item>
<el-form-item v-if="operationData.use_scrap">
<el-button type="primary" @click="scrapSubmit()">创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</el-card>
<el-row gutter="2">
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>半成品</span>
</div>
<template>
<el-table
:data="operationwpData"
border
fit
stripe
highlight-current-row
height="230"
style="width: 100%"
>
<el-table-column type="index" width="50" />
<el-table-column
prop="subproduction_plan_.number"
label="子计划编号"
>
</el-table-column>
<el-table-column prop="number" label="玻璃编号">
</el-table-column>
<el-table-column prop="material_.name" label="玻璃状态">
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleDeletewproduct(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</template>
</el-card>
</el-col>
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>设备</span>
</div>
<template>
<el-table
:data="equData"
border
fit
stripe
highlight-current-row
height="230"
style="width: 100%"
>
<el-table-column prop="equip_.number" label="设备编号">
</el-table-column>
<el-table-column prop="equip_.name" label="设备名称">
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleDeletequip(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</template>
</el-card>
</el-col>
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>生产记录表</span>
</div>
<template>
<el-table
:data="recordData"
border
fit
stripe
highlight-current-row
height="230"
style="width: 100%"
>
<el-table-column prop="form_.name" label="名称">
</el-table-column>
<el-table-column label="是否填写">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_filled == false">未填写</el-tag>
<el-tag v-else>已填写</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handlerecord(scope)"
>填写表单</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog
:model="tableForm"
:visible.sync="dialogVisibleForm"
:close-on-click-modal="false"
:title="tableForm.name"
>
<el-form label-width="80px" label-position="right">
<el-row v-for="(item, $index) in fieldList" :key="$index">
<el-form-item
v-if="item.field_type === 'string'"
:label="item.field_name"
>
<el-input placeholder="请输入" v-model="item.sort" />
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'int'"
:label="item.field_name"
>
<el-input
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'float'"
:label="item.field_name"
>
<el-input
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'date'"
:label="item.field_name"
>
<el-date-picker
v-model="item.create_time"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'datetime'"
:label="item.field_name"
>
<el-date-picker
v-model="item.create_time"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'select'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="item.sort"
placeholder="请选择"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'selects'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="optio"
multiple
placeholder="请选择"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
</el-row>
</el-form>
<span slot="footer">
<el-button type="danger" @click="dialogVisibleForm = false"
>取消</el-button
>
<el-button type="primary" @click="recordconfirm()"
>提交</el-button
>
</span>
</el-dialog>
</template>
</el-card>
</el-col>
</el-row>
<el-row gutter="2">
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>消耗物料</span>
<el-button
style="float: right; padding: 3px 0"
type="text"
@click="cjllclick()"
>从车间领料</el-button
>
</div>
<template>
<el-table
:data="inputData"
border
fit
stripe
highlight-current-row
height="230"
style="width: 100%"
>
<el-table-column
prop="subproduction_plan_.number"
label="子计划编号"
>
</el-table-column>
<el-table-column prop="batch" label="物料批次">
</el-table-column>
<el-table-column prop="material_.name" label="物料名称">
</el-table-column>
<el-table-column prop="material_.unit" label="物料单位">
</el-table-column>
<el-table-column prop="count" label="消耗数量">
</el-table-column>
</el-table>
<el-dialog title="车间物料" :close-on-click-modal="false" :visible.sync="dialogTablepick">
<el-table
:data="wmaterialData"
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.material_.name
}}</template>
</el-table-column>
<el-table-column label="物料单位">
<template slot-scope="scope">{{
scope.row.material_.unit
}}</template>
</el-table-column>
<el-table-column label="物料批次">
<template slot-scope="scope">{{
scope.row.batch
}}</template>
</el-table-column>
<el-table-column label="车间物料数量">
<template slot-scope="scope">{{
scope.row.count
}}</template>
</el-table-column>
<el-table-column label="实际使用数量" width="140px">
<template slot-scope="scope">
<el-form :model="scope.row" widht="100px">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.pick_count"
:min="0"
:controls="false"
:value="0"
></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handlepick(scope)"
>提交</el-link
>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
</el-card>
</el-col>
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>产出物料</span>
<el-button
style="float: right; padding: 3px 0"
type="text"
@click="dialogTableoutput = true"
>选择产出</el-button
>
</div>
<el-table
:data="outputData"
border
fit
stripe
highlight-current-row
height="230"
style="width: 100%"
>
<el-table-column
prop="subproduction_plan_.number"
label="子计划编号"
>
</el-table-column>
<el-table-column prop="material_.name" label="物料名称">
</el-table-column>
<el-table-column prop="material_.unit" label="物料单位">
</el-table-column>
<el-table-column prop="count" label="产出数量"> </el-table-column>
</el-table>
<el-dialog title="产出物料" :close-on-click-modal="false" :visible.sync="dialogTableoutput">
<el-table
:data="tprogressData"
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.subproduction_plan
}}</template>
</el-table-column>
<el-table-column label="物料名称">
<template slot-scope="scope">{{
scope.row.material_.name
}}</template>
</el-table-column>
<el-table-column label="物料单位">
<template slot-scope="scope">{{
scope.row.material_.unit
}}</template>
</el-table-column>
<el-table-column label="应产数量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="本操作产出数量" width="140px">
<template slot-scope="scope">
<el-form :model="scope.row" widht="100px">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.output_count"
:min="0"
:controls="false"
:value="0"
></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleoutput(scope)"
>提交</el-link
>
</template>
</el-table-column>
</el-table>
</el-dialog>
</el-card>
</el-col>
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>工序工装</span>
</div>
</el-card>
</el-col>
</el-row>
<el-card>
<el-button type="primary" style="float: right" @click="handlesubmit()"
>提交本次操作</el-button
>
</el-card>
</div>
</template>
<style scoped>
.box-card {
height: 300px;
}
</style>
</style>
<script>
import {
getoperation,
createoperation,
getoperationwproductList,
getequList,
getrecordList,
getinputList,
getwmaterialList,
createInput,
getoutputList,
createOutput,
createRecord,
submitOperation,
deleteOperationequip,
deleteOperationwproduct,
gettoolList,
createTool,
} from "@/api/wpm";
import { getrffieldList } from "@/api/mtm";
import checkPermission from "@/utils/permission";
import { getprogressList } from "@/api/pm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
inject: ["reload"],
data() {
return {
operationList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
scrap: [
{ lable: "使用", value: true },
{ lable: "不使用", value: false },
],
listQueryfield: {
page: 1,
page_size: 20,
},
operationData: "",
scrapData: {},
dialogVisibleForm: false,
tableForm: {
name: "",
},
listQueryrecordform: {
page: 1,
page_size: 20,
},
recordformList: {
count: 0,
},
fieldList: {
count: 0,
},
listQueryfield: {
page: 1,
page_size: 20,
},
highoptions: [
{ value: 1, label: "<" },
{ value: 2, label: "<=" },
],
lowoptions: [
{ value: 1, label: ">" },
{ value: 2, label: ">=" },
],
highoptionss_: {
1: "<",
2: "<=",
},
lowoptionss_: {
1: ">",
2: ">=",
},
options_: {
string: "文本",
int: "整数",
float: "小数",
date: "日期",
datetime: "日期时间",
select: "单选",
selects: "多选",
},
fieldtypeoptions: [
{
value: "string",
label: "文本",
},
{
value: "int",
label: "整数",
},
{
value: "float",
label: "小数",
},
{
value: "date",
label: "日期",
},
{
value: "time",
label: "时间",
},
{
value: "datetime",
label: "日期时间",
},
{
value: "select",
label: "单选",
},
{
value: "selects",
label: "多选",
},
],
formID: "",
dialogTablepick: false,
dialogTableoutput: false,
picks: {},
output: {},
record_data: [],
record: {},
inputData: [],
operationwpData: [],
equData: [],
recordData: [],
wmaterialData: [],
outputData: [],
tprogressData: [],
};
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id; //操作ID
this.getList(); //边角料
this.getpwpList(); //半成品
this.getequList(); //设备
this.getrecordLists(); //自定义表
this.getinputLists(); //物料消耗
this.getoutputLists(); //产出物料
this.getwmaterialList();
this.getprogressList(); //产出物料调出
},
methods: {
checkPermission,
//是否使用边角料
getList() {
getoperation(this.id).then((response) => {
if (response.data) {
this.operationData = response.data;
}
});
},
//如果使用边角料提交
scrapSubmit() {
this.scrapData.use_scrap = this.operationData.use_scrap;
this.scrapData.remark = this.operationData.remark;
createoperation(this.id, this.scrapData).then((res) => {
if (res.code >= 200) {
this.$message.success("成功!");
this.getList(); //
}
});
},
//操作使用的半成品
getpwpList() {
getoperationwproductList({ operation: this.id, page: 0 }).then(
(response) => {
if (response.data) {
this.operationwpData = response.data;
}
}
);
},
//操作半成品删除
handleDeletewproduct(scope) {
this.$confirm("确认删除该半成品?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOperationwproduct(scope.row.id);
this.getpwpList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//操作设备
getequList() {
getequList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.equData = response.data;
}
});
},
//操作删除设备
handleDeletequip(scope) {
alert(scope.row.equip_.id);
this.$confirm("确认删除该设备?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOperationequip(scope.row.id);
this.getequList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//操作自定义表
getrecordLists() {
getrecordList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.recordData = response.data;
}
});
},
//调出表单内容
handlerecord(scope) {
this.tableForm = Object.assign({}, scope.row); // copy obj
this.formID = scope.row.id;
this.listQueryfield.form = scope.row.form_.id;
this.listQueryfield.page = 0;
getrffieldList(this.listQueryfield).then((response) => {
if (response.data) {
this.fieldList = response.data;
}
});
this.dialogVisibleForm = true;
},
//提交表单内容
recordconfirm() {
let _this = this;
_this.record_data = []; //检查项目
this.fieldList.forEach((item) => {
_this.record_data.push({
form_field: item.id,
field_value: item.sort,
});
});
this.record.record_data = _this.record_data;
createRecord(this.formID, this.record).then((res) => {
if (res.code >= 200) {
this.getrecordLists();
this.$message.success("创建成功!");
this.dialogVisibleForm = false;
}
});
},
//操作消耗物料列表
getinputLists() {
getinputList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.inputData = response.data;
}
});
},
cjllclick() {
this.dialogTablepick = true;
},
//从车间领料
getwmaterialList() {
getwmaterialList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.wmaterialData = response.data;
}
});
},
//车间物料消耗提交
handlepick(scope) {
this.picks.operation = this.id;
this.picks.wmaterial = scope.row.id;
this.picks.count = scope.row.pick_count;
let _this = this;
createInput(this.picks).then((res) => {
if (res.code >= 200) {
this.$message.success("创建成功!");
_this.getinputLists();
this.dialogTablepick = false;
}
});
},
//操作产出物料列表
getoutputLists() {
getoutputList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.outputData = response.data;
}
});
},
//产出物料选择
getprogressList() {
getprogressList({ operation: this.id, page: 0, type: 2 }).then(
(response) => {
if (response.data) {
this.tprogressData = response.data;
}
}
);
},
//车间产出物料提交
handleoutput(scope) {
this.output.operation = this.id;
this.output.subproduction_progress = scope.row.id;
this.output.count = scope.row.output_count;
createOutput(this.output).then((res) => {
if (res.code >= 200) {
this.getoutputLists();
this.$message.success("创建成功!");
this.dialogTableoutput = false;
}
});
},
//提交本次操作
handlesubmit() {
submitOperation(this.id).then((res) => {
if (res.code >= 200) {
this.$message.success("操作提交成功!");
}
});
},
},
};
</script>

View File

@ -13,12 +13,28 @@
border
stripe
style="width: 100%"
height="300"
height="250"
highlight-current-row
@current-change="handleCurrentChange"
>
<el-table-column type="index" width="50" />
<el-table-column label="任务编号">
<template slot-scope="scope">{{
scope.row.number
}}</template>
</el-table-column>
<el-table-column label="产品名称">
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="生产主产品" width="140">
<template slot-scope="scope" >{{
scope.row.main_product_.name
}}</template>
</el-table-column>
<el-table-column label="名称">
<template slot-scope="scope">{{
scope.row.subproduction_.name
@ -49,34 +65,40 @@
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">{{
<template slot-scope="scope">
{{
state_[scope.row.state]
}}</template>
</el-table-column>
<el-table-column label="领料状态">
<el-table-column label="领料状态" width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_picked == false">未领料</el-tag>
<el-tag v-else>已领料</el-tag>
</template>
</el-table-column>
<el-table-column label="生产主产品">
<template slot-scope="scope" v-if="main_product">{{
scope.row.main_product_.name
}}</template>
</el-table-column>
<el-table-column label="生产进度">
<el-table-column label="计划/生产/合格">
<template slot-scope="scope"
>{{ scope.row.main_count_real }}/{{
>{{
scope.row.main_count
}}/{{ scope.row.main_count_real }}/{{
scope.row.main_count_ok
}}</template
>
</el-table-column>
<el-table-column align="center" label="操作" width="130px">
<template slot-scope="scope">
<el-link @click="handleNeed(scope)"
<el-link type="success" v-if="scope.row.is_picked==false" @click="handleNeed(scope)"
>领料</el-link
>
<el-link type="success" v-if="scope.row.is_picked" @click="handleNeed(scope)"
>继续领料</el-link
>
<el-link type="primary" @click="handlepick(scope)"
>领半成品</el-link
>
</template>
</el-table-column>
</el-table>
@ -87,15 +109,16 @@
:limit.sync="listQuery.page_size"
@pagination="subproductionplanList"
/>
<el-row :gutter="24">
<el-row :gutter="2">
<el-col :span="12">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>车间操作</span>
<span>半成品</span>
</div>
<el-button
<el-button
type="primary"
style="margin-left: 50px"
style="margin-left: 2px"
v-for="item in steps"
:key="item.number"
:label="item.name"
@ -107,13 +130,8 @@
type="primary"
@click="handleAll()"
style="float: right"
>显示全部子计划</el-button
>显示全部</el-button
>
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>半成品</span>
</div>
<el-table
:data="wproductData"
@selection-change="handleSelectionChange"
@ -125,12 +143,15 @@
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" width="50" />
<el-table-column label="子计划编号">
<template slot-scope="scope">{{scope.row.subproduction_plan}}</template>
</el-table-column>
<el-table-column label="半成品编号">
<el-table-column label="玻璃编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="半成品状态">
<el-table-column label="玻璃状态">
<template slot-scope="scope">{{
scope.row.material_.name
}}</template>
@ -140,6 +161,11 @@
<template slot-scope="scope">{{
scope.row.step_.name
}}</template>
</el-table-column>
<el-table-column label="检验状态">
<template slot-scope="scope">{{
actstate_[scope.row.act_state]
}}</template>
</el-table-column>
<el-table-column label="所在子工序执行状态">
<template slot-scope="scope">
@ -167,10 +193,14 @@
fit
stripe
style="width: 100%"
max-height="400"
max-height="300"
>
<el-table-column type="index" width="50" />
<el-table-column label="子计划编号">
<template slot-scope="scope">{{
scope.row.subproduction_plan
}}</template>
</el-table-column>
<el-table-column label="物料名称">
<template slot-scope="scope">{{
scope.row.material_.name
@ -193,14 +223,92 @@
</el-row>
</el-tab-pane>
</el-tabs>
<el-dialog title="领半成品" :close-on-click-modal="false" :visible.sync="dialogTableVisiblepick">
<el-table :data="bcplist" style="width: 100%">
<el-table-column prop="material_.name" label="物料名称">
</el-table-column>
<el-table-column prop="material_.number" label="物料编号">
</el-table-column>
<el-table-column prop="material_.specification" label="物料规格">
</el-table-column>
<el-table-column prop="material_.unit" label="物料单位">
</el-table-column>
<el-table-column prop="count" label="所需物料数量">
</el-table-column>
<el-table-column prop="count_real" label="已领物料数量">
</el-table-column>
<el-table-column prop="count_pick" label="实际产出/消耗">
</el-table-column>
<el-table-column
align="center"
label="操作"
<el-dialog :visible.sync="dialogVisiblenw" width="80%" title="领料">
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
@click="handleReceive(scope)"
>领半成品</el-link >
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogTableVisiblepick = false"> </el-button>
<el-button type="primary" @click="bcpllSubmit"> </el-button>
</div>
</el-dialog>
<el-dialog title="半成品列表" :close-on-click-modal="false" :visible.sync="dialogTableVisiblepicks">
<el-table
:data="wproductslist"
border
fit
stripe
highlight-current-row
max-height="300"
@selection-change="handleSelectionChangess"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" width="50" />
<el-table-column label="玻璃编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="玻璃状态">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="所属子计划">
<template slot-scope="scope">{{ scope.row.subproduction_plan }}</template>
</el-table-column>
<el-table-column label="备注">
<template slot-scope="scope">{{ scope.row.remark }}</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogTableVisiblepicks = false"> </el-button>
<el-button type="primary" @click="wproductSubmit"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisiblenw" :close-on-click-modal="false" width="80%" title="领料">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>生产所需领料表</span>
</div>
<template>
<el-table :data="needwl" style="width: 100%">
<el-table :data="needwl" highlight-current-row height="300" style="width: 100%">
<el-table-column prop="material_.name" label="物料名称">
</el-table-column>
<el-table-column prop="material_.number" label="物料编号">
@ -227,7 +335,7 @@
>
</div>
<template>
<el-table :data="havewl" style="width: 100%" >
<el-table :data="havewl" highlight-current-row height="300" style="width: 100%" >
<el-table-column prop="batch" label="物料批次"> </el-table-column>
<el-table-column prop="material_.name" label="物料名称">
@ -235,9 +343,9 @@
<el-table-column prop="warehouse_.name" label="物料所在仓库">
</el-table-column>
<el-table-column prop="count" label="物料总数量"> </el-table-column>
<el-table-column label="输入领料数量" width="140px">
<el-table-column label="输入领料数量" width="140px" >
<template slot-scope="scope">
<el-form :model="scope.row" widht="100px">
<el-form :model="scope.row" v-if="scope.row.material_.type!=2" widht="100px">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.pick_count"
@ -259,7 +367,8 @@
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
v-if="scope.row.material_.type==2"
@click="handlewproduct(scope)"
>选择半成品</el-link
>
@ -269,7 +378,7 @@
</template>
</el-card>
</el-dialog>
<el-dialog title="半成品列表" :visible.sync="dialogTableVisible">
<el-dialog title="半成品列表" :close-on-click-modal="false" :visible.sync="dialogTableVisible">
<el-table
:data="iproductData"
@ -282,14 +391,14 @@
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" width="50" />
<el-table-column label="半成品编号">
<el-table-column label="玻璃编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="半成品批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="半成品名称">
<el-table-column label="玻璃状态">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
@ -306,6 +415,7 @@
</el-dialog>
<el-dialog
:visible.sync="dialogVisiblework"
:close-on-click-modal="false"
:fullscreen="true"
title="填写记录"
>
@ -324,7 +434,7 @@
>
</el-step>
</el-steps>
<el-row :gutter="24">
<el-row :gutter="2">
<el-col :span="14">
<el-card class="box-card" v-if="showPrise1 && values === 0">
<div slot="header" class="clearfix">
@ -557,7 +667,10 @@ import {
getwmaterialList,
submitWork,
getwproductList,
getsubplanList
getsubplanList,
getpickhalfList,
createpickhalf,
createOperation
} from "@/api/wpm";
import { getiproductList } from "@/api/inm";
import { createWork } from "@/api/wpm";
@ -586,6 +699,15 @@ export default {
needwl: "",
showPrise: false,
showPrise1: false,
actstate_: {
6: "待复检",
10: "生产中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
},
state_: {
0: "制定中",
1: "已下达",
@ -598,6 +720,8 @@ export default {
id: "",
dialogTableVisible:false,
dialogVisible: false,
dialogTableVisiblepick:false,
dialogTableVisiblepicks:false,
dialogType: "new",
dialogVisiblework: false,
dialogVisiblenw: false,
@ -625,10 +749,11 @@ export default {
wproducts: [],
otherforms: [],
from: [],
workdata: {},
Operation: {},
wproductdata: {},
workData:{},
bcplist:"",
wproductslist:"",
};
},
process: "",
@ -649,27 +774,37 @@ export default {
if (response.data) {
this.subproductionplanList = response.data;
}
this.listLoading = false;
});
getwmaterialList({
subproduction_plan__process: this.process,
page: 0,
}).then((response) => {
if (response.data) {
this.wmaterialList = response.data;
}
this.listLoading = false;
});
//子工序列表
getStepLists(tab.name).then((response) => {
if (response.data) {
this.steps = response.data;
}
this.listLoading = false;
});
//车间物料表
this.getwmaterialLists();
// 半成品表
this.getwproductLists();
},
//车间物料
getwmaterialLists()
{
getwmaterialList({
subproduction_plan__process: this.process,
page: 0,
}).then((response) => {
if (response.data) {
this.wmaterialList = response.data;
}
});
},
//工序对应的子计划弹出对应的车间物料
handleCurrentChange(row) {
// this.steps = row.steps; //调出子工序
@ -684,17 +819,17 @@ export default {
if (response.data) {
this.wmaterialList = response.data;
}
this.listLoading = false;
});
},
//工序渲染
//大工序工序渲染
getProcessList() {
getProcessList({ page: 0 }).then((response) => {
if (response.data) {
this.processOption = response.data;
}
this.listLoading = false;
});
},
@ -707,28 +842,15 @@ export default {
if (response.data) {
this.subproductionplanList = response.data;
}
this.listLoading = false;
});
//车间物料表
getwmaterialList({
subproduction_plan__process: this.process,
page: 0,
}).then((response) => {
if (response.data) {
this.wmaterialList = response.data;
}
this.listLoading = false;
});
//半成品
getwproductList({page:0,step__process:this.process}).then((response) => {
if (response.data) {
this.wproductData = response.data;
//console.log( this.wproductData)
}
});
this.getwmaterialLists();
// 半成品表
this.getwproductLists();
},
//大工序下子工序产出的半成品
getwproductLists() {
this.wproductdata.page = 0;
@ -752,7 +874,7 @@ export default {
if (response.data) {
this.iproductData= response.data;
}
this.listLoading = false;
});
@ -778,6 +900,7 @@ export default {
});
},
//领料
handleNeed(scope) {
this.need = Object.assign({}, defaulteneed);
@ -804,9 +927,96 @@ export default {
this.dialogVisiblenw = false;
this.$message.success("领料成功!");
//车间物料表
this.getwmaterialLists();
// 半成品表
this.getwproductLists();
}
});
//半成品
getwproductList({page:0,step__process:this.process}).then((response) => {
if (response.data) {
this.wproductData = response.data;
console.log( this.wproductData)
}
});
},
//领半成品
handlepick(scope){
this.dialogTableVisiblepick=true;
this.spid = scope.row.id;
getpickhalfList(this.spid).then((res) => {
if (res.code >= 200) {
this.bcplist = res.data;
}
});
},
//根据半成品ID+检测状态调取未入库半成品
handleReceive(scope){
this.dialogTableVisiblepicks=true;
this.bcpxlID=scope.row.id;
getwproductList({material:scope.row.material,act_state:30,page:0}).then((res) => {
if (res.code >= 200) {
this.wproductslist = res.data;
}
});
},
handleSelectionChangess(val){
this.bcpproducts= [];
val.forEach((item) => {
this.bcpproducts.push(item.id);
});
},
wproductSubmit()
{
this.dialogTableVisiblepicks = false;
this.bcplist.forEach((item) => {
if(item.id == this.bcpxlID)
{
item.iproducts=this.bcpproducts;
}
});
},
//提交领的半成品
bcpllSubmit()
{
this.bcplists=[];//新的半成品表
this.bcplist.forEach((item) => {
this.bcplists.push({
"id":item.id,
"wproducts": item.iproducts
});
});
console.log(this.bcplists);
createpickhalf(this.spid,this.bcplists).then((res) => {
if (res.code >= 200) {
this.$message.success("半成品领料成功!");
this.dialogTableVisiblepick=false;
//车间物料表
this.getwproductLists();
// 半成品表
this.getwproductLists();
}
});
},
prev() {
--this.values;
if (this.values < 0) this.values = 0;
@ -826,40 +1036,14 @@ export default {
this.step = item.id;
// console.log(this.wpID);
this.values = 0;
this.workdata.step = item.id;
this.workdata.wproducts = this.wpID;
if (this.subproduction_plan != "") {
this.workdata.subproduction_plan = this.subproduction_plan;
}
this.Operation.step = item.id;
this.Operation.wproducts = this.wpID;
createWork(this.workdata).then((res) => {
createOperation(this.Operation).then((res) => {
if (res.code >= 200) {
this.dialogVisiblework = true;
this.forms = res.data.forms;
this.otherforms = res.data.forms.slice(0); //渲染生产表
this.otherforms.shift();
//console.log(this.otherforms)
if (
res.data.forms[0].input !== undefined &&
res.data.forms[0].input.length > 0
) {
this.input = res.data.forms[0].input; //消耗
this.showPrise1 = true;
} else {
this.showPrise1 = false;
}
if (
res.data.forms[0].output !== undefined &&
res.data.forms[0].output.length > 0
) {
this.output = res.data.forms[0].output; //产出
this.showPrise = true;
} else {
this.showPrise = false;
}
this.wproducts = res.data.forms[0].wproducts;
this.$message.success("操作记录创建成功!");
this.$router.push({name: "operation", params: { id: item.id }, })
}
});
},

File diff suppressed because it is too large Load Diff

View File

@ -12,4 +12,5 @@ celerybeat-schedule.dat
celerybeat-schedule.dir
db.sqlite3
temp/
nohup.out
nohup.out
server/settings_pro.py

View File

@ -0,0 +1,28 @@
# Generated by Django 3.2.9 on 2021-12-01 02:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inm', '0018_alter_fifoitem_subproduction_plan'),
]
operations = [
migrations.AlterField(
model_name='fifoitem',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='数量'),
),
migrations.AlterField(
model_name='inventory',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='仓库物料存量'),
),
migrations.AlterField(
model_name='materialbatch',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='存量'),
),
]

View File

@ -29,7 +29,7 @@ class Inventory(BaseModel):
库存物料
"""
material = models.ForeignKey(Material, on_delete=models.CASCADE, verbose_name='物料信息')
count = models.IntegerField('仓库物料存量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('仓库物料存量', default=0)
warehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, verbose_name='所在仓库')
class Meta:
verbose_name = '库存表'
@ -41,7 +41,7 @@ class MaterialBatch(BaseModel):
"""
material = models.ForeignKey(Material, on_delete=models.CASCADE, verbose_name='物料信息')
warehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, verbose_name='所在仓库')
count = models.IntegerField('存量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('存量', default=0)
batch = models.CharField('批次号', max_length=100, default='')
expiration_date = models.DateField('有效期', null=True, blank=True)
class Meta:
@ -79,7 +79,7 @@ class FIFOItem(BaseModel):
is_testok = models.BooleanField('是否检测合格', default=False)
warehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, verbose_name='仓库')
material = models.ForeignKey(Material, verbose_name='物料类型', on_delete=models.CASCADE)
count = models.IntegerField('数量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('数量', default=0)
batch = models.CharField('批次号', max_length=100, default='')
fifo = models.ForeignKey(FIFO, verbose_name='关联出入库', on_delete=models.CASCADE)
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联子生产计划', on_delete=models.CASCADE, null=True, blank=True)

View File

@ -149,9 +149,9 @@ class FIFOViewSet(ListModelMixin, GenericViewSet):
审核通过
"""
obj = self.get_object()
for i in FIFOItem.objects.filter(fifo=obj):
if not i.is_testok:
raise APIException('未检验通过, 不可审核')
# for i in FIFOItem.objects.filter(fifo=obj):
# if not i.is_testok:
# raise APIException('未检验通过, 不可审核')
if obj.is_audited:
raise APIException('该入库记录已审核通过')
with transaction.atomic():

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.9 on 2021-11-29 06:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtm', '0036_auto_20211123_1052'),
]
operations = [
migrations.AlterField(
model_name='recordform',
name='type',
field=models.IntegerField(choices=[(1, '生产记录模板'), (2, '检验记录模板')], default=1, verbose_name='表格类型'),
),
migrations.AlterField(
model_name='step',
name='need_test',
field=models.BooleanField(default=False, verbose_name='是否需要检验'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-12-01 02:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtm', '0037_auto_20211129_1456'),
]
operations = [
migrations.AddField(
model_name='process',
name='type',
field=models.IntegerField(default=30, verbose_name='类型'),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.9 on 2021-12-01 02:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtm', '0038_process_type'),
]
operations = [
migrations.AddField(
model_name='recordform',
name='enabled',
field=models.BooleanField(default=False, verbose_name='是否启用'),
),
migrations.AddField(
model_name='recordform',
name='number',
field=models.CharField(blank=True, max_length=32, null=True, verbose_name='编号'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-12-01 02:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtm', '0039_auto_20211201_1016'),
]
operations = [
migrations.AddField(
model_name='material',
name='piece_count',
field=models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='单片玻璃数量'),
),
]

View File

@ -40,6 +40,7 @@ class Material(CommonAModel):
sort_str = models.CharField('排序字符', max_length=100, null=True, blank=True)
unit = models.CharField('基准计量单位', choices=unit_choices, default='', max_length=10)
count = models.IntegerField('物料总数', default=0)
piece_count = models.PositiveSmallIntegerField('单片玻璃数量', null=True, blank=True)
class Meta:
verbose_name = '物料表'
verbose_name_plural = verbose_name
@ -51,8 +52,17 @@ class Process(CommonAModel):
"""
工序
"""
PROCESS_TYPE_SPEC = 10
PROCESS_TYPE_KEY = 20
PROCESS_TYPE_NOMAL = 30
type_choices = (
(PROCESS_TYPE_SPEC, '特殊'),
(PROCESS_TYPE_KEY, '关键'),
(PROCESS_TYPE_NOMAL, '普通'),
)
name = models.CharField('工序名称', max_length=100, unique=True)
number = models.CharField('编号', max_length=100, unique=True)
type = models.IntegerField('类型', default=30)
instruction = models.ForeignKey(File, verbose_name='指导书', on_delete=models.SET_NULL, null=True, blank=True)
instruction_content = models.TextField('指导书内容', null=True, blank=True)
workshop = models.ForeignKey(Organization, verbose_name='生产车间', on_delete=models.CASCADE, null=True, blank=True)
@ -81,7 +91,7 @@ class Step(CommonAModel):
name = models.CharField('工序步骤名称', max_length=100)
number = models.CharField('步骤编号', max_length=100, null=True, blank=True)
instruction_content = models.TextField('相应操作指导', null=True, blank=True)
need_test = models.BooleanField('是否需要过程检验', default=False)
need_test = models.BooleanField('是否需要检验', default=False)
sort = models.IntegerField('排序号', default=1)
equipments = models.ManyToManyField(Equipment, verbose_name='使用设备', related_name='step_equips')
@ -99,13 +109,15 @@ class RecordForm(CommonAModel):
RF_TYPE_DO = 1
RF_TYPE_TEST = 2
type_choices=(
(RF_TYPE_DO, '生产记录'),
(RF_TYPE_TEST, '检验记录')
(RF_TYPE_DO, '生产记录模板'),
(RF_TYPE_TEST, '检验记录模板')
)
name = models.CharField('表格名称', max_length=100)
type = models.IntegerField('表格类型', choices=type_choices, default=1)
step = models.ForeignKey(Step, verbose_name='关联子工序', on_delete=models.CASCADE, null=True, blank=True)
material = models.ForeignKey(Material, verbose_name='关联物料', on_delete=models.CASCADE, null=True, blank=True)
enabled = models.BooleanField('是否启用', default=False)
number = models.CharField('编号', null=True, blank=True, max_length=32)
class Meta:
verbose_name = '记录表格'

View File

@ -38,7 +38,7 @@ class ProcessSerializer(serializers.ModelSerializer):
class ProcessSimpleSerializer(serializers.ModelSerializer):
class Meta:
model = Process
fields = ['id', 'name', 'number']
fields = ['id', 'name', 'number', 'type']
class StepSerializer(serializers.ModelSerializer):
class Meta:
@ -160,7 +160,7 @@ class RecordFormSimpleSerializer(serializers.ModelSerializer):
class Meta:
model = RecordForm
fields = ['id', 'name']
fields = ['id', 'name', 'number', 'enabled']
class RecordFormSerializer(serializers.ModelSerializer):
step_ = StepSimpleSerializer(source='step', read_only=True)
material_ = MaterialSimpleSerializer(source='material', read_only=True)
@ -180,12 +180,12 @@ class RecordFormSerializer(serializers.ModelSerializer):
class RecordFormCreateSerializer(serializers.ModelSerializer):
class Meta:
model = RecordForm
fields = ['name', 'type', 'step', 'material']
fields = ['name', 'type', 'step', 'material', 'number', 'enabled']
class RecordFormUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = RecordForm
fields = ['name', 'type']
fields = ['name', 'type', 'number', 'enabled']
class RecordFormFieldSerializer(serializers.ModelSerializer):
class Meta:

View File

@ -40,7 +40,7 @@ class ProcessViewSet(PageOrNot, CreateUpdateModelAMixin, ModelViewSet):
queryset = Process.objects.select_related('instruction', 'workshop').all()
serializer_class = ProcessSerializer
search_fields = ['name', 'number']
filterset_fields = ['number', 'workshop']
filterset_fields = ['number', 'workshop', 'type']
ordering_fields = ['number']
ordering = ['number']
@ -151,7 +151,7 @@ class RecordFormViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet
"""
perms_map = {'*':'*'}
queryset = RecordForm.objects.all()
filterset_fields = ['step', 'type', 'material']
filterset_fields = ['step', 'type', 'material', 'number', 'enabled']
search_fields = ['name']
ordering='id'

View File

@ -23,5 +23,5 @@ class SubproductionProgressFilterSet(filters.FilterSet):
subplans = WpmServies.get_subplans_queyset_from_step(step)
queryset = queryset.filter(subproduction_plan__in=subplans)
if step.type == Step.STEP_TYPE_NOM:
queryset = queryset.exclude(material__type=Material.MA_TYPE_HALFGOOD)
queryset = queryset.exclude(material__type__in =[Material.MA_TYPE_HALFGOOD, Material.MA_TYPE_GOOD])
return queryset

View File

@ -1,6 +1,6 @@
from apps.pm.models import ProductionPlan, SubProductionPlan, SubProductionProgress
from rest_framework import serializers
from apps.sam.serializers import OrderSerializer
from apps.sam.serializers import OrderSerializer, OrderSimpleSerializer
from apps.mtm.serializers import MaterialSimpleSerializer, ProcessSimpleSerializer, SubProductionSimpleSerializer
from apps.system.serializers import OrganizationSimpleSerializer
@ -11,7 +11,7 @@ class ProductionPlanCreateFromOrderSerializer(serializers.ModelSerializer):
fields = ['order', 'count', 'start_date', 'end_date']
class ProductionPlanSerializer(serializers.ModelSerializer):
order_ = OrderSerializer(source='order', read_only=True)
order_ = OrderSimpleSerializer(source='order', read_only=True)
product_ = MaterialSimpleSerializer(source='product', read_only=True)
class Meta:
model = ProductionPlan
@ -29,9 +29,13 @@ class SubProductionPlanListSerializer(serializers.ModelSerializer):
process_ = ProcessSimpleSerializer(source='process', read_only=True)
subproduction_ = SubProductionSimpleSerializer(source='subproduction', read_only=True)
main_product_ = MaterialSimpleSerializer(source='main_product', read_only=True)
product_ = serializers.SerializerMethodField()
class Meta:
model=SubProductionPlan
fields = '__all__'
def get_product_(self, obj):
return MaterialSimpleSerializer(instance=obj.production_plan.product).data

View File

@ -13,8 +13,11 @@ def update_subplan_main(sender, instance, created, **kwargs):
subplan.main_product = instance.material
subplan.main_count = instance.count
subplan.main_count_real = instance.count_real
if instance.count_real>= instance.count and instance.count_real != 0:
subplan.main_count_ok = instance.count_ok
if instance.count_ok >= instance.count and instance.count_ok > 0:
subplan.state = SubProductionPlan.SUBPLAN_STATE_DONE
elif instance.count_ok < instance.count and instance.count_ok > 0:
subplan.state = SubProductionPlan.SUBPLAN_STATE_WORKING
subplan.save()

View File

@ -42,7 +42,7 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
queryset = ProductionPlan.objects.select_related('order', 'order__contract', 'product')
serializer_class = ProductionPlanSerializer
search_fields = ['number']
filterset_fields = []
filterset_fields = ['product', 'order']
ordering_fields = ['id']
ordering = ['-id']
@ -106,7 +106,7 @@ class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateMo
子生产计划-列表/修改
"""
perms_map = {'*': '*'}
queryset = SubProductionPlan.objects.select_related('process', 'workshop', 'subproduction', 'main_product')
queryset = SubProductionPlan.objects.select_related('process', 'workshop', 'subproduction', 'main_product', 'production_plan__product')
search_fields = []
serializer_class = SubProductionPlanListSerializer
filterset_fields = ['production_plan', 'process', 'state', 'main_product', 'workshop']
@ -176,7 +176,7 @@ class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateMo
materials = []
for i in need:
materials.append(i['material'])
objs = MaterialBatch.objects.filter(material__id__in=materials).order_by('material__number')
objs = MaterialBatch.objects.filter(material__id__in=materials, count__gt=0).order_by('material__number')
have = MaterialBatchSerializer(instance=objs, many=True).data
return Response({'need':need, 'have':have})

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-11-29 06:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('qm', '0011_auto_20211119_0848'),
]
operations = [
migrations.AlterField(
model_name='testrecorditem',
name='field_type',
field=models.CharField(choices=[(1, '生产记录模板'), (2, '检验记录模板')], max_length=50, verbose_name='字段类型'),
),
]

View File

@ -48,3 +48,9 @@ class OrderSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = '__all__'
class OrderSimpleSerializer(serializers.ModelSerializer):
contract_ = ContractSimpleSerializer(source='contract', read_only=True)
class Meta:
model = Order
fields = '__all__'

View File

@ -50,7 +50,7 @@ class OrderViewSet(CreateUpdateCustomMixin, ModelViewSet):
queryset = Order.objects.select_related('contract', 'customer').all()
serializer_class = OrderSerializer
search_fields = ['number', 'product']
filterset_fields = []
filterset_fields = ['product', 'contract', 'customer']
ordering_fields = ['create_time']
ordering = ['-create_time']

View File

@ -8,5 +8,4 @@ from .permission import get_permission_list
@receiver(m2m_changed, sender=User.roles.through)
def update_perms_cache_user(sender, instance, action, **kwargs):
if action in ['post_remove', 'post_add']:
if cache.get(instance.username+'__perms', None):
get_permission_list(instance)
get_permission_list(instance)

View File

@ -0,0 +1,19 @@
# Generated by Django 3.2.9 on 2021-11-23 15:10
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wpm', '0022_auto_20211123_1425'),
]
operations = [
migrations.AlterField(
model_name='operationmaterial',
name='count',
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='消耗或产出数量'),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.9 on 2021-11-29 06:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wpm', '0023_alter_operationmaterial_count'),
]
operations = [
migrations.AlterField(
model_name='operationrecorditem',
name='field_type',
field=models.CharField(choices=[(1, '生产记录模板'), (2, '检验记录模板')], max_length=50, verbose_name='字段类型'),
),
migrations.AlterField(
model_name='wproduct',
name='act_state',
field=models.IntegerField(choices=[(6, '待复检'), (10, '生产中'), (20, '待检验'), (30, '已合格'), (40, '库存中'), (50, '不合格'), (60, '待成品检验')], default=0, verbose_name='进行状态'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-12-01 02:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wpm', '0024_auto_20211129_1456'),
]
operations = [
migrations.AlterField(
model_name='wmaterial',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='当前数量'),
),
]

View File

@ -0,0 +1,26 @@
# Generated by Django 3.2.9 on 2021-12-01 08:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mtm', '0040_material_piece_count'),
('em', '0009_auto_20210916_1108'),
('wpm', '0025_alter_wmaterial_count'),
]
operations = [
migrations.AlterField(
model_name='operationequip',
name='equip',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oe_equip', to='em.equipment', verbose_name='生产设备'),
),
migrations.AlterField(
model_name='operationrecord',
name='form',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='or_form', to='mtm.recordform', verbose_name='所用的生产记录表格'),
),
]

View File

@ -0,0 +1,54 @@
# Generated by Django 3.2.9 on 2021-12-02 01:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('inm', '0019_auto_20211201_1011'),
('pm', '0015_auto_20211122_1556'),
('mtm', '0040_material_piece_count'),
('wpm', '0026_auto_20211201_1608'),
]
operations = [
migrations.CreateModel(
name='Pick',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
('type', models.PositiveSmallIntegerField(choices=[(10, '仓库领取'), (20, '半成品领取')], default=10)),
('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='pick_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
('fifo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='inm.fifo', verbose_name='关联的出入库记录')),
('subproduction_plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pm.subproductionplan', verbose_name='关联子生产计划')),
('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='pick_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='PickWproduct',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
('number', models.CharField(blank=True, max_length=50, null=True, verbose_name='物品编号')),
('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='领取时的物料状态')),
('pick', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.pick', verbose_name='关联领料')),
('subproduction_plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pm.subproductionplan', verbose_name='领取时所属子生产计划')),
('wproduct', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pw_wproduct', to='wpm.wproduct', verbose_name='关联半成品')),
],
options={
'abstract': False,
},
),
]

View File

@ -1,8 +1,9 @@
import re
from django.db import models
from django.db.models.base import Model
import django.utils.timezone as timezone
from django.db.models.query import QuerySet
from apps.inm.models import WareHouse
from apps.inm.models import FIFO, WareHouse
from apps.pm.models import ProductionPlan, SubProductionPlan, SubProductionProgress
from apps.system.models import CommonADModel, CommonAModel, CommonBModel, Organization, User, Dict, File
from utils.model import SoftModel, BaseModel
@ -17,21 +18,27 @@ class WMaterial(BaseModel):
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联子计划', on_delete=models.CASCADE)
material = models.ForeignKey(Material, verbose_name='关联物料', on_delete=models.CASCADE)
batch = models.CharField('批次号', max_length=100, null=True, blank=True)
count = models.IntegerField('当前数量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('当前数量', default=0)
class WProduct(CommonAModel):
"""
动态半成品/成品表
"""
WPR_ACT_STATE_DOING = 1
WPR_ACT_STATE_TOTEST = 2
WPR_ACT_STATE_OK = 3
WPR_ACT_STATE_INM = 4
WPR_ACT_STATE_TORETEST = 6
WPR_ACT_STATE_DOING = 10
WPR_ACT_STATE_TOTEST = 20
WPR_ACT_STATE_OK = 30
WPR_ACT_STATE_INM = 40
WPR_ACT_STATE_NOTOK = 50
WPR_ACT_STATE_TOFINALTEST = 60
act_state_choices=(
(WPR_ACT_STATE_TORETEST, '待复检'),
(WPR_ACT_STATE_DOING, '生产中'),
(WPR_ACT_STATE_TOTEST, '待检测'),
(WPR_ACT_STATE_TOTEST, '待检'),
(WPR_ACT_STATE_OK, '已合格'),
(WPR_ACT_STATE_INM, '库存中'),
(WPR_ACT_STATE_NOTOK, '不合格'),
(WPR_ACT_STATE_TOFINALTEST, '待成品检验')
)
number = models.CharField('物品编号', unique=True, null=True, blank=True, max_length=50)
material = models.ForeignKey(Material, verbose_name='所属物料状态', on_delete=models.CASCADE)
@ -47,6 +54,31 @@ class WProduct(CommonAModel):
operation = models.ForeignKey('wpm.operation', verbose_name='关联操作',
on_delete=models.SET_NULL, null=True, blank=True, related_name='current_operation')
class Pick(CommonADModel):
"""
领料记录
"""
PICK_FROM_WAREHOUSE = 10
PICK_FROM_WPRODUCT = 20
type_choice = (
(PICK_FROM_WAREHOUSE, '仓库领取'),
(PICK_FROM_WPRODUCT, '半成品领取'),
)
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联子生产计划', on_delete=models.CASCADE)
type = models.PositiveSmallIntegerField(choices=type_choice, default=PICK_FROM_WAREHOUSE)
fifo = models.ForeignKey(FIFO, verbose_name='关联的出入库记录', on_delete=models.CASCADE, null=True, blank=True)
class PickWproduct(BaseModel):
"""
领取半成品时详情
"""
pick = models.ForeignKey(Pick, verbose_name='关联领料', on_delete=models.CASCADE)
wproduct = models.ForeignKey(WProduct, verbose_name='关联半成品', on_delete=models.CASCADE, related_name='pw_wproduct')
number = models.CharField('物品编号', null=True, blank=True, max_length=50)
material = models.ForeignKey(Material, verbose_name='领取时的物料状态', on_delete=models.CASCADE)
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='领取时所属子生产计划', on_delete=models.CASCADE)
class Operation(CommonADModel):
"""
生产操作
@ -75,7 +107,7 @@ class OperationMaterial(BaseModel):
operation = models.ForeignKey(Operation, verbose_name='关联的生产操作', on_delete=models.CASCADE)
material = models.ForeignKey(Material, verbose_name='可能产出的产品', on_delete=models.CASCADE, null=True, blank=True)
count = models.IntegerField('消耗或产出数量', validators=[MinValueValidator(0)])
count = models.IntegerField('消耗或产出数量', validators=[MinValueValidator(0)], null=True, blank=True)
wmaterial = models.ForeignKey(WMaterial, verbose_name='关联的车间物料', on_delete=models.CASCADE, null=True, blank=True)
subproduction_progress = models.ForeignKey(SubProductionProgress, verbose_name='关联的生产进度', on_delete=models.CASCADE, null=True, blank=True)
@ -87,7 +119,7 @@ class OperationRecord(BaseModel):
"""
记录表格
"""
form = models.ForeignKey(RecordForm, verbose_name='所用的生产记录表格', on_delete=models.CASCADE)
form = models.ForeignKey(RecordForm, verbose_name='所用的生产记录表格', on_delete=models.CASCADE, related_name='or_form')
operation = models.ForeignKey(Operation, verbose_name='关联的生产操作', on_delete=models.CASCADE, related_name='or_operation')
is_filled = models.BooleanField('是否填写', default=True)
@ -105,5 +137,5 @@ class OperationRecordItem(BaseModel):
class OperationEquip(BaseModel):
operation = models.ForeignKey(Operation, verbose_name='关联操作', on_delete=models.CASCADE, related_name='oe_operation')
equip = models.ForeignKey(Equipment, verbose_name='生产设备', on_delete=models.CASCADE)
equip = models.ForeignKey(Equipment, verbose_name='生产设备', on_delete=models.CASCADE, related_name='oe_equip')
remark = models.TextField('备注', null=True, blank=True)

View File

@ -1,5 +1,6 @@
from rest_framework import serializers, exceptions
from rest_framework.serializers import ModelSerializer
from apps.em.models import Equipment
from apps.em.serializers import EquipmentSimpleSerializer
from apps.inm.models import FIFO, FIFOItem, FIFOItemProduct, IProduct, MaterialBatch, WareHouse
from apps.inm.signals import update_inm
@ -12,13 +13,14 @@ from django.utils.translation import gettext_lazy as _
from apps.pm.serializers import SubproductionPlanSimpleSerializer
from apps.qm.models import TestRecord, TestRecordItem
from apps.system.serializers import UserSimpleSerializer
from apps.wpm.models import Operation, OperationEquip, OperationMaterial, OperationWproduct, WMaterial, WProduct, OperationRecord, OperationRecordItem
from apps.wpm.models import Operation, OperationEquip, OperationMaterial, OperationWproduct, Pick, WMaterial, WProduct, OperationRecord, OperationRecordItem
from django.db import transaction
class PickHalfSerializer(serializers.Serializer):
id = serializers.PrimaryKeyRelatedField(queryset=SubProductionProgress.objects.all(), label='子计划进度ID')
wproducts = serializers.ListField(child=serializers.PrimaryKeyRelatedField(queryset=WProduct.objects.all(), label='半成品ID'),
required=False) # 从半成品表里直接修改状态
class PickDetailSerializer(serializers.Serializer):
material = serializers.PrimaryKeyRelatedField(queryset=Material.objects.all(), label="物料ID")
batch = serializers.CharField(label='物料批次', allow_blank=True)
@ -30,23 +32,22 @@ class PickDetailSerializer(serializers.Serializer):
class PickSerializer(serializers.Serializer):
subproduction_plan=serializers.PrimaryKeyRelatedField(queryset=SubProductionPlan.objects.all(), label="子计划ID")
picks = PickDetailSerializer(many=True) # 从库存里拿
def create(self, validated_data):
picks = validated_data.pop('picks')
sp = validated_data.pop('subproduction_plan')
if sp.state not in [SubProductionPlan.SUBPLAN_STATE_ASSGINED, SubProductionPlan.SUBPLAN_STATE_ACCEPTED,
SubProductionPlan.SUBPLAN_STATE_WORKING]:
raise exceptions.ValidationError('该子计划状态错误')
raise exceptions.APIException('该子计划状态错误')
# if sp.is_picked:
# raise exceptions.ValidationError('该子计划已领料')
# raise exceptions.APIException('该子计划已领料')
# for i in picks:
# try:
# instance = MaterialBatch.objects.get(material=i['material'], batch=i['batch'])
# if instance.count < i['pick_count']:
# raise exceptions.ValidationError('物料不足')
# raise exceptions.APIException('物料不足')
# except:
# raise exceptions.ValidationError('物料不存在')
# raise exceptions.APIException('物料不存在')
# 创建出库记录
with transaction.atomic():
@ -92,20 +93,27 @@ class PickSerializer(serializers.Serializer):
spp = SubProductionProgress.objects.get(material=i['material'], subproduction_plan=sp, type=SubprodctionMaterial.SUB_MA_TYPE_IN)
spp.count_pick = spp.count_pick + i['count']
spp.save()
if spp.count_pick > spp.count:
raise exceptions.APIException('超过计划需求数')
# if spp.count_pick > spp.count:
# raise exceptions.APIException('超过计划需求数')
if isLowLevel:
# 更新半成品表
wids = IProduct.objects.filter(pk__in=[x.id for x in iproducts]).values_list('wproduct', flat=True)
wproducts = WProduct.objects.filter(pk__in=wids)
first_step = Step.objects.get(pk=sp.steps[0]['id'])
wproducts.update(step=first_step, is_executed=False,
act_state=WProduct.WPR_ACT_STATE_DOING, is_hidden=False, warehouse=None,
subproduction_plan=sp, production_plan=sp.production_plan)
act_state=WProduct.WPR_ACT_STATE_TORETEST, is_hidden=False, warehouse=None,
subproduction_plan=sp)
sp.is_picked=True
sp.state = SubProductionPlan.SUBPLAN_STATE_WORKING #生产中
sp.state_date_real = timezone.now() #实际开工日期
sp.save()
# 创建领料记录
pick = Pick()
pick.subproduction_plan = sp
pick.type = Pick.PICK_FROM_WAREHOUSE
pick.fifo = fifo
pick.create_by = self.context['request'].user
pick.save()
# 更新库存
fifo.is_audited = True
fifo.save()
@ -117,6 +125,7 @@ class WMaterialListSerializer(serializers.ModelSerializer):
车间物料
"""
material_ = MaterialSimpleSerializer(source='material', read_only=True)
subproduction_plan_ = SubproductionPlanSimpleSerializer(source='subproduction_plan', read_only=True)
class Meta:
model = WMaterial
fields = '__all__'
@ -141,21 +150,21 @@ class OperationDetailSerializer(serializers.ModelSerializer):
class OperationListSerializer(serializers.ModelSerializer):
create_by_ = UserSimpleSerializer(source='create_by', read_only=True)
step_ = StepSimpleSerializer(source='step', read_only=True)
wproduct_count = serializers.SerializerMethodField()
equip_count = serializers.SerializerMethodField()
record_count = serializers.SerializerMethodField()
wproduct_ = serializers.SerializerMethodField()
equip_ = serializers.SerializerMethodField()
record_ = serializers.SerializerMethodField()
class Meta:
model = Operation
fields = '__all__'
def get_wproduct_count(self, obj):
return obj.ow_operation.count()
def get_wproduct_(self, obj):
return WProduct.objects.filter(ow_wproduct__operation=obj).values('id', 'number')
def get_equip_count(self, obj):
return obj.oe_operation.count()
def get_equip_(self, obj):
return EquipmentSimpleSerializer(instance=Equipment.objects.filter(oe_equip__operation=obj), many=True).data
def get_record_count(self, obj):
return obj.or_operation.count()
def get_record_(self, obj):
return RecordFormSimpleSerializer(instance=RecordForm.objects.filter(or_form__operation=obj), many=True).data
class OperationCreateSerializer(serializers.Serializer):
"""
@ -172,21 +181,23 @@ class OperationCreateSerializer(serializers.Serializer):
# stepIds=[i['id'] for i in subproduction_plan.steps]
# if step.id not in stepIds:
# raise exceptions.ValidationError('请选择正确的子工序操作')
# raise exceptions.APIException('请选择正确的子工序操作')
if 'wproducts' in data and data['wproducts']:
if step.type == Step.STEP_TYPE_DIV:
raise exceptions.ValidationError(_('不可进行此操作'))
raise exceptions.APIException(_('不可进行此操作'))
for i in data['wproducts']:
if i.act_state != WProduct.WPR_ACT_STATE_DOING:
raise exceptions.APIException('半成品不在生产状态')
if i.is_executed:
raise exceptions.ValidationError('不可进行操作')
raise exceptions.APIException('不可进行操作')
# if i.subproduction_plan != subproduction_plan:
# raise exceptions.ValidationError('半成品所属子计划不一致')
# raise exceptions.APIException('半成品所属子计划不一致')
if i.step != step:
raise exceptions.ValidationError('半成品所属子工序不一致')
raise exceptions.APIException('半成品所属子工序不一致')
else:
if step.type != Step.STEP_TYPE_DIV:
raise exceptions.ValidationError(_('请选择半成品进行操作'))
raise exceptions.APIException(_('请选择半成品进行操作'))
return data
@ -207,21 +218,21 @@ class OperationInitSerializer(serializers.Serializer):
# stepIds=[i['id'] for i in subproduction_plan.steps]
# if step.id not in stepIds:
# raise exceptions.ValidationError('请选择正确的子工序操作')
# raise exceptions.APIException('请选择正确的子工序操作')
if 'wproducts' in data and data['wproducts']:
if step.type == Step.STEP_TYPE_DIV:
raise exceptions.ValidationError(_('不可进行此操作'))
raise exceptions.APIException(_('不可进行此操作'))
for i in data['wproducts']:
if i.is_executed:
raise exceptions.ValidationError('不可进行操作')
raise exceptions.APIException('不可进行操作')
# if i.subproduction_plan != subproduction_plan:
# raise exceptions.ValidationError('半成品所属子计划不一致')
# raise exceptions.APIException('半成品所属子计划不一致')
if i.step != step:
raise exceptions.ValidationError('半成品所属子工序不一致')
raise exceptions.APIException('半成品所属子工序不一致')
else:
if step.type != Step.STEP_TYPE_DIV:
raise exceptions.ValidationError(_('请选择半成品进行操作'))
raise exceptions.APIException(_('请选择半成品进行操作'))
return data

View File

@ -16,7 +16,7 @@ from apps.qm.models import TestRecordItem
from apps.system.mixins import CreateUpdateModelAMixin, OptimizationMixin
from rest_framework.decorators import action
from apps.wpm.filters import WMaterialFilterSet
from apps.wpm.models import OperationEquip, OperationWproduct, WMaterial, WProduct, Operation, OperationMaterial, OperationRecord, OperationRecordItem
from apps.wpm.models import OperationEquip, OperationWproduct, Pick, PickWproduct, WMaterial, WProduct, Operation, OperationMaterial, OperationRecord, OperationRecordItem
from apps.wpm.serializers import OperationEquipListSerializer, OperationEquipUpdateSerializer, OperationMaterialCreate1Serailizer, OperationMaterialCreate2Serailizer, OperationMaterialCreate3Serializer, OperationMaterialListSerializer, OperationRecordListSerializer, OperationRecordSubmitSerializer, OperationUpdateSerializer, OperationWproductListSerializer, OperationCreateSerializer, OperationDetailSerializer, OperationListSerializer, PickHalfSerializer, PickSerializer, OperationInitSerializer, OperationSubmitSerializer, WMaterialListSerializer, WProductListSerializer, WplanPutInSerializer, WpmTestRecordCreateSerializer, WproductPutInSerializer
from rest_framework.response import Response
@ -38,7 +38,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
serializer_class = SubProductionPlanListSerializer
filterset_fields = ['production_plan', 'process', 'state', 'main_product', 'workshop']
ordering_fields = []
ordering = ['-id']
ordering = ['-update_time']
@action(methods=['post', 'get'], detail=True, perms_map={'post':'*', 'get':'*'}, serializer_class=PickHalfSerializer)
@transaction.atomic
@ -59,17 +59,36 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
serializer.is_valid(raise_exception=True)
vdata = serializer.data
first_step = Step.objects.get(pk=sp.steps[0]['id'])
# 创建领料记录
pick = Pick()
pick.subproduction_plan = sp
pick.type = Pick.PICK_FROM_WPRODUCT
pick.create_by = request.user
pick.save()
for i in vdata:
if 'wproducts' in i and len(i['wproducts'])>0:
spp = SubProductionProgress.objects.get(pk=i['id'])
spp.count_pick = spp.count_pick + len(i['wproducts'])
if spp.count_pick > spp.count:
raise exceptions.APIException('超过计划数')
# if spp.count_pick > spp.count:
# raise exceptions.APIException('超过计划数')
spp.save()
wps = WProduct.objects.filter(pk__in=[x for x in i['wproducts']])
wps = WProduct.objects.filter(pk__in=[x for x in i['wproducts']], act_state=WProduct.WPR_ACT_STATE_OK)
wps.update(step=first_step, is_executed=False,
act_state=WProduct.WPR_ACT_STATE_DOING, is_hidden=False, warehouse=None,
act_state=WProduct.WPR_ACT_STATE_TORETEST, is_hidden=False, warehouse=None,
subproduction_plan=sp, update_by=request.user, update_time=timezone.now())
for i in wps:
pw = PickWproduct()
pw.pick =pick
pw.wproduct = i
pw.number = i.number
pw.material = i.material
pw.subproduction_plan = i.suproduction_plan
pw.save()
else:
raise exceptions.APIException('未选择任何玻璃')
sp.is_picked = True
sp.save()
return Response()
@ -137,7 +156,7 @@ class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
车间物料表
"""
perms_map={'*':'*'}
queryset = WMaterial.objects.select_related('material').all()
queryset = WMaterial.objects.select_related('material', 'subproduction_plan').filter(count__gt=0)
serializer_class = WMaterialListSerializer
filterset_class = WMaterialFilterSet
ordering_fields = ['material__number']
@ -176,12 +195,13 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
vdata = serializer.validated_data
record_data = vdata.pop('record_data')
wproduct = vdata['wproduct']
if wproduct.act_state != WProduct.WPR_ACT_STATE_TOTEST:
raise exceptions.APIException('半成品不可检测')
if wproduct.act_state not in [WProduct.WPR_ACT_STATE_TOTEST, WProduct.WPR_ACT_STATE_TORETEST]:
raise exceptions.APIException('产品当前状态不可检验')
if 'is_testok' not in vdata:
raise exceptions.APIException('未填写检测结论')
obj = serializer.save(create_by = self.request.user, material=wproduct.material)
obj = serializer.save(create_by = self.request.user,
material=wproduct.material, number=wproduct.number, subproduction_plan=wproduct.subproduction_plan)
tris = []
for m in record_data: # 保存记录详情
form_field = m['form_field']
@ -210,9 +230,52 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
instance.count_ok = instance.count_ok + 1 # 这个地方可能会有问题
instance.save()
else:# 如果不合格
pass
wproduct.act_state = WProduct.WPR_ACT_STATE_NOTOK
wproduct.save()
return Response()
@action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=WpmTestRecordCreateSerializer)
@transaction.atomic
def retest(self, request, pk=None):
"""
复检
"""
serializer = WpmTestRecordCreateSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
vdata = serializer.validated_data
record_data = vdata.pop('record_data')
wproduct = vdata['wproduct']
if wproduct.act_state != WProduct.WPR_ACT_STATE_TORETEST:
raise exceptions.APIException('该产品当前状态不可检验')
if 'is_testok' not in vdata:
raise exceptions.APIException('未填写检测结论')
obj = serializer.save(create_by = self.request.user,
material=wproduct.material, number=wproduct.number, subproduction_plan=wproduct.subproduction_plan)
tris = []
for m in record_data: # 保存记录详情
form_field = m['form_field']
m['field_name'] = form_field.field_name
m['field_key'] = form_field.field_key
m['field_type'] = form_field.field_type
m['field_value'] = m['field_value']
m['sort'] = form_field.sort
m['need_judge'] = form_field.need_judge
m['is_testok'] = m['is_testok'] if 'is_testok' in m else None
m['test_record'] = obj
tris.append(TestRecordItem(**m))
TestRecordItem.objects.bulk_create(tris)
# 如果检测合格, 变更动态产品进行状态
if obj.is_testok:
wproduct.act_state = WProduct.WPR_ACT_STATE_DOING
wproduct.save()
else:# 如果不合格
wproduct.act_state = WProduct.WPR_ACT_STATE_NOTOK
wproduct.save()
return Response()
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=WproductPutInSerializer)
@transaction.atomic
@ -313,6 +376,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
# 创建操作所用半成品关联记录
if 'wproducts' in vdata:
owps = []
WProduct.objects.filter(pk__in=[x.id for x in vdata['wproducts']]).update(operation=op)
splans = WpmServies.get_subplans_queryset_from_wproducts(vdata['wproducts'])
for wpd in vdata['wproducts']:
owp = {}
@ -415,8 +479,6 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
for x in range(i.count):
WProduct.objects.create(**wpr)
elif step.type == Step.STEP_TYPE_COMB:
# 隐藏原半成品
ows = OperationWproduct.objects.filter(operation=op)
if i.subproduction_progress.is_main:
newstep, hasNext = WpmServies.get_next_step(i.subproduction_plan, step)
wproduct = WProduct()
@ -435,7 +497,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
instance.count_real = instance.count_real + 1 # 这个地方可能会有问题,不够严谨
instance.save()
wproduct.save()
ows.update(is_hidden=True, child=wproduct)
# 隐藏原半成品
wps = WProduct.objects.filter(ow_wproduct__operation = op)
wps.update(is_hidden=True, child=wproduct)
op.is_submited = True
op.save()
return Response()