Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
801b41221e
|
@ -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,
|
||||
|
|
|
@ -153,6 +153,15 @@ export function createTicket(data) {
|
|||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//详情
|
||||
export function ticketread(id) {
|
||||
return request({
|
||||
url: `/wf/ticket/${id}/`,
|
||||
method: 'get',
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
//接单
|
||||
export function ticketAccpet(id,data) {
|
||||
|
|
|
@ -313,6 +313,14 @@ export function getRetrial(id) {
|
|||
method: 'GET',
|
||||
})
|
||||
}
|
||||
//玻璃审批工单
|
||||
|
||||
|
||||
|
||||
export function getwproductticketList(query) {
|
||||
return request({
|
||||
url: '/wpm/wproduct_ticket/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
|
@ -360,6 +360,14 @@ export const asyncRoutes = [
|
|||
hidden: true
|
||||
}
|
||||
,
|
||||
{
|
||||
path: 'wproduct/:id',
|
||||
name: 'wproduct',
|
||||
component: () => import('@/views/qm/wproduct'),
|
||||
meta: { title: '工序玻璃', perms: ['vendor_manage'] },
|
||||
hidden: true
|
||||
}
|
||||
,
|
||||
{
|
||||
path: 'taskrecordfrom/:id',
|
||||
name: 'taskrecordfrom',
|
||||
|
|
|
@ -1,91 +1,244 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card style="margin-top: 2px">
|
||||
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
||||
<el-tab-pane label="总览" name="1" >
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="productionplan.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="620"
|
||||
v-el-height-adaptive-table="{bottomOffset: 40}"
|
||||
>
|
||||
<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="合格率" >
|
||||
<el-table-column label="冷加工">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['01']">{{ scope.row.process_json['01'].rate }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="热弯">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['02']">{{ scope.row.process_json['02'].rate }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="化学钢化">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['03']">{{ scope.row.process_json['03'].rate }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="镀膜">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['04']">{{ scope.row.process_json['04'].rate }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="夹层">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['05']">{{ scope.row.process_json['05'].rate }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="包边">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['06']">{{ scope.row.process_json['06'].rate }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="装框">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['07']">{{ scope.row.process_json['07'].rate }}%</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="checkPermission(['material_update'])"
|
||||
type="primary"
|
||||
@click="handledetail(scope)"
|
||||
>详情</el-link
|
||||
>
|
||||
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane label="总览" name="1">
|
||||
<el-table
|
||||
:data="productionplan.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="620"
|
||||
v-el-height-adaptive-table="{ bottomOffset: 40 }"
|
||||
>
|
||||
<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="合格率">
|
||||
<el-table-column label="冷加工">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['01']"
|
||||
>{{ scope.row.process_json["01"].rate }}%</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="热弯">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['02']"
|
||||
>{{ scope.row.process_json["02"].rate }}%</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="化学钢化">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['03']"
|
||||
>{{ scope.row.process_json["03"].rate }}%</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="镀膜">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['04']"
|
||||
>{{ scope.row.process_json["04"].rate }}%</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="夹层">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['05']"
|
||||
>{{ scope.row.process_json["05"].rate }}%</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="包边">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['06']"
|
||||
>{{ scope.row.process_json["06"].rate }}%</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="装框">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['07']"
|
||||
>{{ scope.row.process_json["07"].rate }}%</template
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.create_time
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="checkPermission(['material_update'])"
|
||||
type="primary"
|
||||
@click="handledetail(scope)"
|
||||
>详情</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="productionplan.count > 0"
|
||||
:total="productionplan.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="不合格玻璃" name="2">
|
||||
<el-table
|
||||
:data="wproductticket.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="620"
|
||||
v-el-height-adaptive-table="{ bottomOffset: 40 }"
|
||||
>
|
||||
<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" v-if="scope.row.order_">{{
|
||||
scope.row.order_.number
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称">
|
||||
<template slot-scope="scope" v-if="scope.row.product_">{{
|
||||
scope.row.product_.name
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号">
|
||||
<template slot-scope="scope" v-if="scope.row.product_">{{
|
||||
scope.row.product_.specification
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="责任工序">
|
||||
<template slot-scope="scope" v-if="scope.row.resp_process_">{{
|
||||
scope.row.resp_process_.name
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理结果">
|
||||
<template slot-scope="scope">{{
|
||||
decision_[scope.row.decision]
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.create_time
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="checkPermission(['material_update'])"
|
||||
type="primary"
|
||||
@click="handledetailbhg(scope)"
|
||||
>查看</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="wproductticket.count > 0"
|
||||
:total="wproductticket.count"
|
||||
:page.sync="listQuery2.page"
|
||||
:limit.sync="listQuery2.page_size"
|
||||
@pagination="getList2"
|
||||
/>
|
||||
<!--不合格半成品重审-->
|
||||
<el-dialog title="不合格半成品重审" :close-on-click-modal="false" :visible.sync="limitedRetrial">
|
||||
<el-form label-width="130px" label-position="right">
|
||||
<el-form-item :label="item.field_name" v-for="item in customfieldList.ticket_data_" :key="item.id" v-show="!item.is_hidden">
|
||||
<template v-if="item.field_type=='string'">
|
||||
<el-input v-model="item.default_value" :placeholder="item.description" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="productionplan.count > 0"
|
||||
:total="productionplan.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="不合格物料" name="2">
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<template v-if="item.field_type==='int'">
|
||||
<el-input v-model="item.default_value" type="number" :placeholder="item.description" oninput="value=value.replace(/[^\d]/g,'')" />
|
||||
</template>
|
||||
<template v-if="item.field_type==='float'">
|
||||
<el-input v-model="item.default_value" type="number" :placeholder="item.description" />
|
||||
</template>
|
||||
<template v-if="item.field_type==='date'">
|
||||
<el-date-picker
|
||||
v-model="item.default_value"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
</template>
|
||||
<template v-if="item.field_type==='datetime'">
|
||||
<el-date-picker
|
||||
v-model="item.default_value"
|
||||
type="datetime"
|
||||
placeholder="选择日期"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
</template>
|
||||
<template v-if="item.field_type==='select'">
|
||||
<el-select style="width: 100%" v-model="item.default_value" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item1 in item.field_choice"
|
||||
:key="item1.id"
|
||||
:label="item1.name"
|
||||
:value="item1.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-if="item.field_type==='selects'">
|
||||
<el-select style="width: 100%" multiple v-model="item.default_value" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item1 in item.field_choice"
|
||||
:key="item1.id"
|
||||
:label="item1.name"
|
||||
:value="item1.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-if="item.field_type==='textarea'">
|
||||
<el-input type="textarea" :rows="3" v-model="item.default_value" placeholder="内容" />
|
||||
</template>
|
||||
<template v-if="item.field_type==='file'">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="upUrl"
|
||||
:on-preview="handlePreview"
|
||||
:on-success="handleUpSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:headers="upHeaders"
|
||||
:file-list="fileList"
|
||||
:limit="1"
|
||||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx"
|
||||
>
|
||||
<el-button size="small" type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="limitedRetrial = false">取 消</el-button>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getProductionplanList } from "@/api/pm";
|
||||
import { getwproductticketList } from "@/api/wpm";
|
||||
import { ticketread } from "@/api/workflow";
|
||||
|
||||
import checkPermission from "@/utils/permission";
|
||||
import { createTestrecord } from "@/api/inm";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
|
@ -94,50 +247,83 @@ export default {
|
|||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
|
||||
process_json_:{
|
||||
|
||||
"01":'冷加工',
|
||||
"02":'热弯',
|
||||
"03":'化学钢化',
|
||||
"04":'镀膜',
|
||||
"05":'夹层',
|
||||
"06":'包边',
|
||||
"07":'装框',
|
||||
|
||||
process_json_: {
|
||||
"01": "冷加工",
|
||||
"02": "热弯",
|
||||
"03": "化学钢化",
|
||||
"04": "镀膜",
|
||||
"05": "夹层",
|
||||
"06": "包边",
|
||||
"07": "装框",
|
||||
},
|
||||
productionplan:{
|
||||
decision_: {
|
||||
10: "返工",
|
||||
20: "返修",
|
||||
30: "报废",
|
||||
40: "让步接受",
|
||||
50: "偏离许可",
|
||||
60: "降级使用",
|
||||
70: "退回供方",
|
||||
80: "召回",
|
||||
},
|
||||
productionplan: {
|
||||
count: 0,
|
||||
},
|
||||
activeName:"1",
|
||||
listQuery: {
|
||||
wproductticket: {
|
||||
count: 0,
|
||||
},
|
||||
activeName: "1",
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
listQuery2: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
limitedRetrial:false,
|
||||
customfieldList: [],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getList(); //总览列表
|
||||
this.getList2(); //不合格玻璃审批工单列表
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
||||
//总览列表
|
||||
getList() {
|
||||
getProductionplanList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.productionplan = response.data;
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
handledetail(scope)
|
||||
handledetail(scope) {
|
||||
this.$router.push({ name: "taskdetails", params: { id: scope.row.id } });
|
||||
},
|
||||
|
||||
//不合格玻璃审批工单列表
|
||||
getList2() {
|
||||
getwproductticketList(this.listQuery2).then((response) => {
|
||||
if (response.data) {
|
||||
this.wproductticket = response.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
//不合格玻璃审理单查看
|
||||
handledetailbhg(scope)
|
||||
{
|
||||
this.$router.push({name: "taskdetails", params: { id: scope.row.id }, })
|
||||
this.limitedRetrial=true;
|
||||
ticketread(scope.row.ticket).then((response) => {
|
||||
if (response.data) {
|
||||
this.customfieldList = response.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card style="margin-top: 2px">
|
||||
<el-descriptions title="任务详情" :column="5" border>
|
||||
<el-descriptions title="任务详情" :column="5" border style="margin-bottom: 20px">
|
||||
<el-descriptions-item label="任务编号">{{productionplan.number}}</el-descriptions-item>
|
||||
<el-descriptions-item label="产品名称">{{productionplan.product_.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="规格型号">{{productionplan.product_.specification}}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产状态">生产状态没有</el-descriptions-item>
|
||||
<el-descriptions-item label="产品名称" v-if="productionplan.product_">{{productionplan.product_.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="规格型号" v-if="productionplan.product_">{{productionplan.product_.specification}}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产状态">{{state_[productionplan.state]}}</el-descriptions-item>
|
||||
<el-descriptions-item label="不合格品数量">不合格数没有</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
fit
|
||||
stripe
|
||||
style="width: 100%"
|
||||
height="300"
|
||||
height="500"
|
||||
>
|
||||
|
||||
<el-table-column type="index" width="50" />
|
||||
|
@ -58,6 +58,52 @@
|
|||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="工序" name="2" >
|
||||
<el-table
|
||||
:data="process_json"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
style="width: 100%"
|
||||
height="500"
|
||||
>
|
||||
|
||||
<el-table-column type="index" width="50" />
|
||||
|
||||
|
||||
<el-table-column label="工序名称" >
|
||||
<template slot-scope="scope" >{{ scope.row.process_name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="玻璃数量" >
|
||||
<template slot-scope="scope" >{{ scope.row.count_real }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="合格数量" >
|
||||
<template slot-scope="scope" >{{ scope.row.count_ok }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="不合格数量" >
|
||||
<template slot-scope="scope" >{{ scope.row.count_notok }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="过程记录"
|
||||
width="220px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="checkPermission(['material_delete'])"
|
||||
type="primary"
|
||||
@click="handleprocess(scope)"
|
||||
>查看</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
|
@ -69,7 +115,7 @@
|
|||
</template>
|
||||
<script>
|
||||
|
||||
import { getProductionplan } from "@/api/pm";
|
||||
import { getProductionplan,getsubproductionplanList } from "@/api/pm";
|
||||
import { getwproductList} from "@/api/wpm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
|
@ -80,9 +126,23 @@ export default {
|
|||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
productionplan:"",
|
||||
productionplan:{
|
||||
number:""
|
||||
},
|
||||
activeName:"1",
|
||||
wproduct:"",
|
||||
wproduct:[],
|
||||
subproductionplanList: "",
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
state_:{
|
||||
10:'制定中',
|
||||
20:'已下达',
|
||||
30:'已接受',
|
||||
40:'生产中',
|
||||
50:'已完成',
|
||||
60:'军检完成'},
|
||||
actstate_: {
|
||||
6: "待复检",
|
||||
10: "操作进行中",
|
||||
|
@ -95,6 +155,8 @@ export default {
|
|||
26: "待夹层检验",
|
||||
70: "报废",
|
||||
},
|
||||
process_json:null,
|
||||
productionplanID:null,
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
|
@ -102,7 +164,9 @@ export default {
|
|||
created() {
|
||||
this.id = this.$route.params.id;
|
||||
this.getList();
|
||||
this.getspList();
|
||||
this.getwproductList();
|
||||
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
@ -111,9 +175,30 @@ export default {
|
|||
getProductionplan(this.id).then((response) => {
|
||||
if (response.data) {
|
||||
this.productionplan = response.data;
|
||||
this.productionplanID=response.data.id;
|
||||
|
||||
let process_json = [];
|
||||
for(let item in response.data.process_json){
|
||||
let obj = new Object();
|
||||
obj = response.data.process_json[item];
|
||||
process_json.push(obj)
|
||||
}
|
||||
|
||||
|
||||
this.process_json= process_json;
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
getspList() {
|
||||
|
||||
getsubproductionplanList({page:0,production_plan:this.id}).then((response) => {
|
||||
if (response.data) {
|
||||
this.subproductionplanList = response.data;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
getwproductList()
|
||||
{
|
||||
|
@ -127,7 +212,13 @@ export default {
|
|||
//查看该玻璃检验记录表
|
||||
handleoption(scope){
|
||||
|
||||
this.$router.push({name: "taskrecordfrom", params: { id: scope.row.id }, })
|
||||
this.$router.push({name: "taskrecordfrom", params: { id: scope.row.id ,productionplanid:this.id ,number:scope.row.number,process:scope.row.step_.name}, })
|
||||
|
||||
},
|
||||
//查看工序对应的玻璃
|
||||
handleprocess (scope){
|
||||
|
||||
this.$router.push({name: "wproduct", params: { id: scope.row.process,productionplanid:this.id} })
|
||||
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,24 +1,34 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card style="margin-top: 2px">
|
||||
|
||||
|
||||
<el-descriptions title="任务详情" :column="5" border style="margin-bottom: 20px">
|
||||
<el-descriptions-item label="任务编号">{{productionplan.number}}</el-descriptions-item>
|
||||
<el-descriptions-item label="产品名称" v-if="productionplan.product_">{{productionplan.product_.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="规格型号" v-if="productionplan.product_">{{productionplan.product_.specification}}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产状态">{{state_[productionplan.state]}}</el-descriptions-item>
|
||||
<el-descriptions-item label="不合格品数量">不合格数没有</el-descriptions-item>
|
||||
<el-descriptions-item label="玻璃编号">{{wproductnumber}}</el-descriptions-item>
|
||||
<el-descriptions-item label="玻璃所在子工序">{{process}}</el-descriptions-item>
|
||||
|
||||
<el-table
|
||||
:data="recordList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
style="width: 100%"
|
||||
height="300"
|
||||
>
|
||||
|
||||
<el-table-column type="index" width="50"/>
|
||||
|
||||
</el-descriptions>
|
||||
|
||||
<el-table
|
||||
:data="recordList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
style="width: 100%"
|
||||
height="300"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="表单名称">
|
||||
<template slot-scope="scope">{{ scope.row.form_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检查类型">
|
||||
<template slot-scope="scope">{{ checkTypes[scope.row.type] }}</template>
|
||||
<template slot-scope="scope">{{
|
||||
checkTypes[scope.row.type]
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否提交">
|
||||
<template slot-scope="scope">
|
||||
|
@ -26,69 +36,155 @@
|
|||
<span v-else>未提交</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作">
|
||||
<el-table-column align="center" label="操作">
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
|
||||
@click="handleRecordDetail(scope)"
|
||||
>查看
|
||||
</el-link>
|
||||
|
||||
<el-link @click="handleRecordDetail(scope)">查看 </el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-table>
|
||||
|
||||
|
||||
<!--非检查表显示-->
|
||||
<el-dialog
|
||||
width="60%"
|
||||
:title="formName"
|
||||
:visible.sync="recordVisible"
|
||||
:close-on-click-modal="false"
|
||||
@close="recordCancel"
|
||||
>
|
||||
<customForm
|
||||
v-if="recordVisible"
|
||||
:results="fieldList"
|
||||
:hasPicture="hasPicture"
|
||||
:formID="recordform"
|
||||
:wproduct="wproduct"
|
||||
:recordId="recordId"
|
||||
:isDisabled="isDisabled"
|
||||
@recordSubmit="recordSubmit"
|
||||
@recordSave="recordSave"
|
||||
@recordCancel="recordCancel"
|
||||
/>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
import {getTestRecord} from "@/api/qm";
|
||||
import { getProductionplan,getsubproductionplanList } from "@/api/pm";
|
||||
import { getMaterialList, getrecordformList, getrffieldList } from "@/api/mtm";
|
||||
import customForm from "@/components/customForm/index";
|
||||
import { getTestRecord ,getTestRecordItem} from "@/api/qm";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
|
||||
export default {
|
||||
components: { Pagination },
|
||||
components: { Pagination, customForm },
|
||||
data() {
|
||||
return {
|
||||
recordList:"",
|
||||
checkTypes:{
|
||||
10:"子工序检验",
|
||||
20:"工序检验",
|
||||
30:"工序复检",
|
||||
36:"夹层检验",
|
||||
40:"成品检验",
|
||||
},
|
||||
|
||||
recordList: "",
|
||||
checkTypes: {
|
||||
10: "子工序检验",
|
||||
20: "工序检验",
|
||||
30: "工序复检",
|
||||
36: "夹层检验",
|
||||
40: "成品检验",
|
||||
},
|
||||
state_:{
|
||||
10:'制定中',
|
||||
20:'已下达',
|
||||
30:'已接受',
|
||||
40:'生产中',
|
||||
50:'已完成',
|
||||
60:'军检完成'},
|
||||
recordVisible: false,
|
||||
customfieldList: [],
|
||||
recordform: null,
|
||||
recordId: null,
|
||||
fifo_detail: "",
|
||||
formName: "项目检查表",
|
||||
hasPicture: false,
|
||||
fieldList: [],
|
||||
isDisabled: false,
|
||||
productionplan:{
|
||||
number:""
|
||||
},
|
||||
wproductnumber:null,
|
||||
process:null,
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.id = this.$route.params.id;
|
||||
this.getList();
|
||||
this.id = this.$route.params.id;
|
||||
this.productionplanid = this.$route.params.productionplanid;
|
||||
this.wproductnumber=this.$route.params.number;
|
||||
this.process=this.$route.params.process;
|
||||
|
||||
this.getListp();
|
||||
this.getList();
|
||||
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
||||
getList() {
|
||||
getTestRecord({wproduct: this.id}).then(res=>{
|
||||
if(res.code==200){
|
||||
|
||||
this.recordList = res.data;
|
||||
}else{
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
getListp() {
|
||||
|
||||
getProductionplan(this.productionplanid).then((response) => {
|
||||
if (response.data) {
|
||||
this.productionplan = response.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
getTestRecord({ wproduct: this.id }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.recordList = res.data;
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
//点击记录里的查看
|
||||
handleRecordDetail(scope) {
|
||||
let that = this;
|
||||
that.recordVisible = false;
|
||||
that.recordId = scope.row.id;
|
||||
that.recordform = scope.row.form;
|
||||
that.formName = scope.row.form_.name;
|
||||
getrffieldList({ form: this.recordform, page: 1, page_size: 100 }).then(
|
||||
(response) => {
|
||||
if (response.data) {
|
||||
that.hasPicture = false;
|
||||
let fieldList = response.data.results;
|
||||
that.fieldList = [...fieldList];
|
||||
let arr = fieldList.filter((item) => {
|
||||
return item.field_type === "draw";
|
||||
});
|
||||
if (arr.length > 0) {
|
||||
that.hasPicture = true;
|
||||
}
|
||||
getTestRecordItem(scope.row.id).then((res) => {
|
||||
let arr = [];
|
||||
let fieldList = res.data.record_data;
|
||||
for (let i = 0; i < that.fieldList.length; i++) {
|
||||
let obj = that.fieldList[i];
|
||||
obj.is_testok = null;
|
||||
for (let j = 0; j < fieldList.length; j++) {
|
||||
if (that.fieldList[i].field_key === fieldList[j].field_key) {
|
||||
obj.id = fieldList[j].id;
|
||||
obj.is_testok = fieldList[j].is_testok;
|
||||
obj.field_value = fieldList[j].field_value;
|
||||
}
|
||||
}
|
||||
arr.push(obj);
|
||||
}
|
||||
that.fieldList = arr;
|
||||
that.$nextTick(() => {
|
||||
that.isDisabled = true;
|
||||
that.recordVisible = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-card>
|
||||
<el-descriptions title="任务详情" :column="5" border style="margin-bottom: 20px">
|
||||
<el-descriptions-item label="任务编号">{{productionplans.number}}</el-descriptions-item>
|
||||
<el-descriptions-item label="产品名称" v-if="productionplans.product_">{{productionplans.product_.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="规格型号" v-if="productionplans.product_">{{productionplans.product_.specification}}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产状态">{{state_[productionplans.state]}}</el-descriptions-item>
|
||||
<el-descriptions-item label="不合格品数量">不合格数没有</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-table
|
||||
:data="wproduct"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
style="width: 100%"
|
||||
height="500"
|
||||
>
|
||||
|
||||
<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.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
|
||||
align="center"
|
||||
label="过程记录"
|
||||
width="220px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="checkPermission(['material_delete'])"
|
||||
type="primary"
|
||||
@click="handleoption(scope)"
|
||||
>查看</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
</el-table>
|
||||
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getwproductList} from "@/api/wpm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import { getProductionplan,getsubproductionplanList } from "@/api/pm";
|
||||
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
productionplans:{
|
||||
number:""
|
||||
},
|
||||
wproduct: "",
|
||||
state_:{
|
||||
10:'制定中',
|
||||
20:'已下达',
|
||||
30:'已接受',
|
||||
40:'生产中',
|
||||
50:'已完成',
|
||||
60:'军检完成'},
|
||||
actstate_: {
|
||||
6: "待复检",
|
||||
10: "操作进行中",
|
||||
20: "待检验",
|
||||
30: "已合格",
|
||||
40: "库存中",
|
||||
50: "不合格",
|
||||
60: "待成品检验",
|
||||
8: "操作准备中",
|
||||
26: "待夹层检验",
|
||||
70: "报废",
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
|
||||
this.id = this.$route.params.id;
|
||||
this.productionplan = this.$route.params.productionplanid;
|
||||
this.getList();
|
||||
this.getpList();
|
||||
console.log(this.productionplan);
|
||||
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getpList() {
|
||||
getProductionplan(this.productionplan).then((response) => {
|
||||
if (response.data) {
|
||||
this.productionplans = response.data;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
//半成品列表
|
||||
getList() {
|
||||
getwproductList({production_plan:this.productionplan,step__process:this.id,page:0}).then((response) => {
|
||||
if (response.data) {
|
||||
this.wproduct= response.data;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
//查看该玻璃检验记录表
|
||||
handleoption(scope){
|
||||
console.log(this.productionplan);
|
||||
this.$router.push({name: "taskrecordfrom", params: { id:scope.row.id,productionplanid:this.productionplan,number:scope.row.number,process:scope.row.step_.name} })
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -26,7 +26,8 @@
|
|||
{{ 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>
|
||||
|
@ -237,15 +238,19 @@
|
|||
<el-table-column label="所在子工序">
|
||||
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="不合格标记">
|
||||
<template slot-scope="scope">
|
||||
{{ ng_sign_[scope.row.ng_sign] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="220px">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-link
|
||||
<el-link
|
||||
type="danger"
|
||||
v-if="checkPermission(['warehouse_update'])"
|
||||
@click="handleScrap(scope)"
|
||||
>报废
|
||||
</el-link>!-->
|
||||
</el-link>
|
||||
<el-link type="primary"
|
||||
v-if="!scope.row.ticket"
|
||||
@click="handleRetrial(scope)"
|
||||
|
@ -653,13 +658,15 @@
|
|||
formLabelWidthL:'',
|
||||
actstate_: {
|
||||
6: "待复检",
|
||||
10: "生产中",
|
||||
20: "待检验",
|
||||
30: "已合格",
|
||||
40: "库存中",
|
||||
50: "不合格",
|
||||
60: "待成品检验",
|
||||
26:"待夹层检验",
|
||||
10: "操作进行中",
|
||||
20: "待检验",
|
||||
30: "已合格",
|
||||
40: "库存中",
|
||||
50: "不合格",
|
||||
60: "待成品检验",
|
||||
8: "操作准备中",
|
||||
26: "待夹层检验",
|
||||
70: "报废",
|
||||
},
|
||||
checkTypes:{
|
||||
10:"子工序检验",
|
||||
|
@ -668,6 +675,17 @@
|
|||
36:"夹层检验",
|
||||
40:"成品检验",
|
||||
},
|
||||
ng_sign_: {
|
||||
10: "返工",
|
||||
20: "返修",
|
||||
30: "报废",
|
||||
40: "让步接受",
|
||||
50: "偏离许可",
|
||||
60: "降级使用",
|
||||
70: "退回供方",
|
||||
80: "召回",
|
||||
|
||||
},
|
||||
choice: [
|
||||
{
|
||||
value: true,
|
||||
|
|
|
@ -180,7 +180,11 @@
|
|||
actstate_[scope.row.act_state]
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="不合格标记">
|
||||
<template slot-scope="scope">
|
||||
{{ ng_sign_[scope.row.ng_sign] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.update_time
|
||||
|
@ -455,7 +459,7 @@
|
|||
<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
|
||||
|
@ -765,6 +769,17 @@ export default {
|
|||
26: "待夹层检验",
|
||||
70: "报废",
|
||||
},
|
||||
ng_sign_: {
|
||||
10: "返工",
|
||||
20: "返修",
|
||||
30: "报废",
|
||||
40: "让步接受",
|
||||
50: "偏离许可",
|
||||
60: "降级使用",
|
||||
70: "退回供方",
|
||||
80: "召回",
|
||||
|
||||
},
|
||||
state_: {
|
||||
0: "制定中",
|
||||
1: "已下达",
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# Generated by Django 3.2.9 on 2021-12-31 03:30
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mtm', '0042_alter_recordformfield_field_type'),
|
||||
('wpm', '0042_wprouctticket_resp_process'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='operationmaterial',
|
||||
name='count_cut',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='切裁片数'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operationmaterial',
|
||||
name='count_hua',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='划伤甩片'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operationmaterial',
|
||||
name='count_ok',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='成品数量'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operationmaterial',
|
||||
name='count_other',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='其他甩片'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operationmaterial',
|
||||
name='count_podian',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='破点甩片'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operationmaterial',
|
||||
name='count_qipao',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='气泡甩片'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operationmaterial',
|
||||
name='count_real',
|
||||
field=models.PositiveIntegerField(default=0, verbose_name='生产片数'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='operationmaterial',
|
||||
unique_together={('operation', 'material', 'batch')},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='operationwproduct',
|
||||
unique_together={('operation', 'wproduct')},
|
||||
),
|
||||
]
|
|
@ -197,6 +197,10 @@ class OperationWproduct(BaseModel):
|
|||
material = models.ForeignKey(Material, verbose_name='操作时的物料状态', on_delete=models.CASCADE)
|
||||
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='当前子生产计划', on_delete=models.CASCADE, related_name='ow_subplan')
|
||||
|
||||
class Meta:
|
||||
unique_together = (
|
||||
('operation','wproduct')
|
||||
)
|
||||
|
||||
class OperationMaterial(BaseModel):
|
||||
"""
|
||||
|
@ -214,6 +218,19 @@ class OperationMaterial(BaseModel):
|
|||
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联的子计划', on_delete=models.CASCADE, null=True, blank=True)
|
||||
batch = models.CharField('批次号', max_length=100, null=True, blank=True)
|
||||
|
||||
#以下为冷加工下料清单所用字段
|
||||
count_cut = models.PositiveIntegerField('切裁片数', default=0)
|
||||
count_real = models.PositiveIntegerField('生产片数', default=0)
|
||||
count_ok = models.PositiveIntegerField('成品数量', default=0)
|
||||
count_qipao = models.PositiveIntegerField('气泡甩片', default=0)
|
||||
count_podian = models.PositiveIntegerField('破点甩片', default=0)
|
||||
count_hua = models.PositiveIntegerField('划伤甩片', default=0)
|
||||
count_other = models.PositiveIntegerField('其他甩片', default=0)
|
||||
class Meta:
|
||||
unique_together = (
|
||||
('operation','material', 'batch')
|
||||
)
|
||||
|
||||
class OperationRecord(BaseModel):
|
||||
"""
|
||||
记录表格
|
||||
|
|
|
@ -12,6 +12,8 @@ from django.utils import timezone
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
from apps.pm.serializers import SubproductionPlanSimpleSerializer
|
||||
from apps.qm.models import TestRecord, TestRecordItem
|
||||
from apps.sam.serializers import OrderSimpleSerializer
|
||||
from apps.system.models import User
|
||||
from apps.system.serializers import UserSimpleSerializer
|
||||
from apps.wpm.models import Operation, OperationEquip, OperationMaterial, OperationWproduct, Pick, WMaterial, WProduct, OperationRecord, OperationRecordItem, WprouctTicket
|
||||
from django.db import transaction
|
||||
|
@ -437,7 +439,17 @@ class WproductTicketListSerializer(serializers.ModelSerializer):
|
|||
step_ = StepSimpleSerializer(source='step', read_only=True)
|
||||
subproduction_plan_ = SubproductionPlanSimpleSerializer(source='subproduction_plan', read_only=True)
|
||||
resp_process_ = ProcessSimpleSerializer(source='resp_process', read_only=True)
|
||||
order_ = OrderSimpleSerializer(source='subproduction_plan.production_plan.order', read_only=True)
|
||||
product_ = MaterialSimpleSerializer(source='subproduction_plan.production_plan.product', read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = WprouctTicket
|
||||
fields = '__all__'
|
||||
|
||||
class CuttingListSerializer(serializers.ModelSerializer):
|
||||
subproduction_plan_ = SubproductionPlanSimpleSerializer(source='subproduction_plan', read_only=True)
|
||||
material_ = MaterialSimpleSerializer(source='material', read_only=True)
|
||||
create_by_ = UserSimpleSerializer(source='create_by', read_only=True)
|
||||
class Meta:
|
||||
model = OperationMaterial
|
||||
fields = '__all__'
|
|
@ -7,7 +7,7 @@ from apps.mtm.models import Material, Step, SubprodctionMaterial
|
|||
from apps.qm.models import TestRecord
|
||||
from apps.system.models import User
|
||||
from apps.wf.models import State, TicketFlow, Transition
|
||||
from apps.wpm.models import WProduct, WproductFlow, WprouctTicket
|
||||
from apps.wpm.models import Operation, OperationMaterial, WProduct, WproductFlow, WprouctTicket
|
||||
from utils.tools import ranstr
|
||||
class WpmServies(object):
|
||||
|
||||
|
@ -146,3 +146,38 @@ class WpmServies(object):
|
|||
setattr(ins, f.name, getattr(instance, f.name, None))
|
||||
ins.change_str = change_str
|
||||
ins.save()
|
||||
|
||||
@classmethod
|
||||
def update_cutting_list_with_operation(cls, op:Operation):
|
||||
"""
|
||||
根据车间操作更新下料清单
|
||||
"""
|
||||
inputs = OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_IN)
|
||||
outputs = OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT)
|
||||
for i in inputs:
|
||||
sp = i.subproduction_plan
|
||||
i.count_cut = outputs.filter(subproduction_plan=sp).first().count
|
||||
i.count_real = sp.count_real
|
||||
i.count_ok = sp.count_ok
|
||||
wpfs = WproductFlow.objects.filter(subproduction_plan=sp, is_lastlog=True)
|
||||
i.count_qipao = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_QIPAO).count()
|
||||
i.count_podian = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_PODIAN).count()
|
||||
i.count_hua = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_HUA).count()
|
||||
i.count_other = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_OTHER).count()
|
||||
i.is_cutting = True
|
||||
i.save()
|
||||
|
||||
@classmethod
|
||||
def update_cutting_list_with_sp(cls, sp:SubProductionPlan):
|
||||
"""
|
||||
根据子计划更新下料清单
|
||||
"""
|
||||
wpfs = WproductFlow.objects.filter(subproduction_plan=sp, is_lastlog=True)
|
||||
for i in OperationMaterial.objects.filter(subproduction_plan=sp, is_cutting=True):
|
||||
i.count_real = sp.count_real
|
||||
i.count_ok = sp.count_ok
|
||||
i.count_qipao = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_QIPAO).count()
|
||||
i.count_podian = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_PODIAN).count()
|
||||
i.count_hua = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_HUA).count()
|
||||
i.count_other = wpfs.filter(scrap_reason=WProduct.SCRAP_REASON_OTHER).count()
|
||||
i.save()
|
|
@ -3,7 +3,7 @@ from rest_framework import urlpatterns
|
|||
from django.urls import path, include
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from apps.wpm.views import DoFormInit, DoFormSubmit, OperationEquipViewSet, OperationMaterialInputViewSet, OperationMaterialOutputViewSet, OperationMaterialToolViewSet, OperationRecordViewSet, OperationViewSet, OperationWproductViewSet, WMaterialViewSet, WPlanViewSet, WProductViewSet, WproductTicketViewSet
|
||||
from apps.wpm.views import CuttingListViewSet, DoFormInit, DoFormSubmit, OperationEquipViewSet, OperationMaterialInputViewSet, OperationMaterialOutputViewSet, OperationMaterialToolViewSet, OperationRecordViewSet, OperationViewSet, OperationWproductViewSet, WMaterialViewSet, WPlanViewSet, WProductViewSet, WproductTicketViewSet
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register('wmaterial', WMaterialViewSet, basename='wmaterial')
|
||||
|
@ -17,6 +17,7 @@ router.register('operation_input', OperationMaterialInputViewSet, basename='oper
|
|||
router.register('operation_output', OperationMaterialOutputViewSet, basename='operation_output')
|
||||
router.register('operation_tool', OperationMaterialToolViewSet, basename='operation_tool')
|
||||
router.register('subplan', WPlanViewSet, basename='wplan')
|
||||
router.register('cutting_list', CuttingListViewSet, basename='cutting_list')
|
||||
urlpatterns = [
|
||||
path('do/init/', DoFormInit.as_view()),
|
||||
path('do/submit/', DoFormSubmit.as_view()),
|
||||
|
|
|
@ -22,7 +22,7 @@ from apps.wf.serializers import WorkflowSimpleSerializer
|
|||
from apps.wpm.filters import WMaterialFilterSet, WProductFilterSet
|
||||
from apps.wpm.models import OperationEquip, OperationWproduct, Pick, PickWproduct, WMaterial, WProduct, Operation, OperationMaterial, OperationRecord, OperationRecordItem, WprouctTicket
|
||||
|
||||
from apps.wpm.serializers import OperationEquipListSerializer, OperationEquipUpdateSerializer, OperationMaterialCreate1ListSerailizer, OperationMaterialCreate1Serailizer, OperationMaterialCreate2ListSerailizer, OperationMaterialCreate2Serailizer, OperationMaterialCreate3Serializer, OperationMaterialListSerializer, OperationRecordDetailSerializer, OperationRecordListSerializer, OperationRecordSubmitSerializer, OperationUpdateSerializer, OperationWproductListSerializer, OperationCreateSerializer, OperationDetailSerializer, OperationListSerializer, PickHalfSerializer, PickHalfsSerializer, PickSerializer, OperationInitSerializer, OperationSubmitSerializer, ScrapSerializer, WMaterialListSerializer, WProductListSerializer, WplanPutInSerializer, WpmTestFormInitSerializer, WpmTestRecordCreateSerializer, WproductPutInSerializer, WproductPutInsSerializer, WproductTicketListSerializer
|
||||
from apps.wpm.serializers import CuttingListSerializer, OperationEquipListSerializer, OperationEquipUpdateSerializer, OperationMaterialCreate1ListSerailizer, OperationMaterialCreate1Serailizer, OperationMaterialCreate2ListSerailizer, OperationMaterialCreate2Serailizer, OperationMaterialCreate3Serializer, OperationMaterialListSerializer, OperationRecordDetailSerializer, OperationRecordListSerializer, OperationRecordSubmitSerializer, OperationUpdateSerializer, OperationWproductListSerializer, OperationCreateSerializer, OperationDetailSerializer, OperationListSerializer, PickHalfSerializer, PickHalfsSerializer, PickSerializer, OperationInitSerializer, OperationSubmitSerializer, ScrapSerializer, WMaterialListSerializer, WProductListSerializer, WplanPutInSerializer, WpmTestFormInitSerializer, WpmTestRecordCreateSerializer, WproductPutInSerializer, WproductPutInsSerializer, WproductTicketListSerializer
|
||||
from rest_framework.response import Response
|
||||
from django.db import transaction
|
||||
from rest_framework import exceptions, serializers
|
||||
|
@ -385,6 +385,8 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
|||
obj.update_time = timezone.now()
|
||||
obj.save()
|
||||
WpmServies.add_wproduct_flow_log(obj, 'scrap')
|
||||
if obj.step.process.id == 1: #如果是冷加工
|
||||
WpmServies.update_cutting_list_with_sp(obj.subproduction_plan)
|
||||
return Response()
|
||||
|
||||
# @action(methods=['get'], detail=False, perms_map={'get':'*'})
|
||||
|
@ -429,7 +431,8 @@ class WproductTicketViewSet(ListModelMixin, GenericViewSet):
|
|||
玻璃审批工单
|
||||
"""
|
||||
perms_map={'*':'*'}
|
||||
queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan', 'resp_process')
|
||||
queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan',
|
||||
'resp_process', 'subproduction_plan__production_plan__order', 'subproduction_plan__production_plan')
|
||||
serializer_class = WproductTicketListSerializer
|
||||
filterset_fields = ['step', 'material', 'subproduction_plan', 'resp_process']
|
||||
ordering_fields = ['id']
|
||||
|
@ -579,9 +582,11 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
|||
spp.save()
|
||||
# 更新动态产品表
|
||||
if step.type == Step.STEP_TYPE_NOM:
|
||||
for i in OperationWproduct.objects.filter(operation=op):
|
||||
ows = OperationWproduct.objects.filter(operation=op)
|
||||
for i in ows:
|
||||
wp = i.wproduct
|
||||
wsp = i.subproduction_plan
|
||||
|
||||
# 获取下一步子工序
|
||||
newstep, hasNext = WpmServies.get_next_step(wsp, step)
|
||||
wp.step = newstep
|
||||
|
@ -591,17 +596,21 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
|||
else:
|
||||
wp.act_state = WProduct.WPR_ACT_STATE_TOTEST
|
||||
wp.material = wsp.product
|
||||
# 更新子计划生产进度
|
||||
# 如果产品有返工标记不做计算
|
||||
if wp.ng_sign not in [WProduct.NG_BACK_FIX, WProduct.NG_BACK_WORK]:
|
||||
WpmServies.update_subproduction_progress_main(sp=wsp)
|
||||
wp.operation = None
|
||||
wp.update_by = request.user
|
||||
wp.save()
|
||||
WpmServies.add_wproduct_flow_log(wp, 'operation_submit')
|
||||
|
||||
for i in ows.values('subproduction_plan').distinct():
|
||||
# 更新进度
|
||||
WpmServies.update_subproduction_progress_main(sp=wsp)
|
||||
|
||||
elif step.type == Step.STEP_TYPE_DIV:
|
||||
# 更新物料产出情况
|
||||
for i in OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT):
|
||||
outputs = OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT)
|
||||
if not outputs.exists():
|
||||
raise exceptions.APIException('请选择物料产出')
|
||||
for i in outputs:
|
||||
if i.subproduction_progress.is_main:
|
||||
newstep, _ = WpmServies.get_next_step(i.subproduction_plan, step)
|
||||
wpr = dict(material=i.material, step=newstep,
|
||||
|
@ -640,6 +649,10 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
|||
raise exceptions.APIException('产出物料未填写或填写错误')
|
||||
op.is_submited = True
|
||||
op.save()
|
||||
|
||||
# 如果是冷加工
|
||||
if step.process.id==1:
|
||||
WpmServies.update_cutting_list_with_operation(op=op)
|
||||
return Response()
|
||||
|
||||
|
||||
|
@ -774,6 +787,19 @@ class OperationMaterialInputViewSet(ListModelMixin, CreateModelMixin, DestroyMod
|
|||
instance.delete()
|
||||
return Response()
|
||||
|
||||
class CuttingListViewSet(ListModelMixin, GenericViewSet):
|
||||
"""
|
||||
下料清单
|
||||
"""
|
||||
perms_map={'*':'*'}
|
||||
queryset = OperationMaterial.objects.select_related('operation',
|
||||
'subproduction_plan', 'material', 'create_by').filter(operation__step__process__id=1)
|
||||
serializer_class = CuttingListSerializer
|
||||
filterset_fields = ['operation', 'subproduction_plan', 'material']
|
||||
ordering_fields = ['id']
|
||||
ordering = ['-id']
|
||||
|
||||
|
||||
class OperationMaterialOutputViewSet(ListModelMixin, CreateModelMixin, DestroyModelMixin, GenericViewSet):
|
||||
"""
|
||||
产出物料
|
||||
|
|
Loading…
Reference in New Issue