add:车间质量统计分析

This commit is contained in:
zhangzhiqiang
2023-10-10 16:41:52 +08:00
parent e33ca3fae9
commit 24ed153a81
10 changed files with 377 additions and 65 deletions

View File

@@ -47,12 +47,11 @@
</el-select>
</el-form-item>
<el-form-item label="统计类型">
<el-radio v-model="radioValue" :label="4">
指定
<el-select v-model="checkboxList" clearable placeholder="可多选" multiple style="width:100%">
<el-option v-for="item in 60" :key="item" :value="item-1">{{ item-1 }}</el-option>
</el-select>
</el-radio>
<el-radio-group v-model="query.analysis" size="small" @change="crud.toQuery">
<el-radio label="1"></el-radio>
<el-radio label="2"></el-radio>
<el-radio label="3"></el-radio>
</el-radio-group>
</el-form-item>
<rrOperation />
</el-form>
@@ -75,29 +74,44 @@
ref="table"
v-loading="crud.loading"
:data="crud.data"
:render-header="labelHead"
size="mini"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="index" width="80" label="序号"/>
<el-table-column prop="product_area" width="120" label="所属车间">
<template slot-scope="scope">
{{ dict.label.product_area[scope.row.product_area] }}
</template>
</el-table-column>
<el-table-column prop="device_code" label="设备编号" width="120" show-overflow-tooltip />
<el-table-column prop="device_name" label="设备名称" width="150" />
<el-table-column prop="workprocedure_name" label="工序名称" width="150" show-overflow-tooltip />
<el-table-column prop="plan_qty" label="计划生产数" width="120" />
<el-table-column prop="real_qty" label="实际生产数量" width="120" />
<el-table-column prop="hours" label="实际生产耗时(h)" width="120" :formatter="crud.formatNum0"/>
<el-table-column prop="theory" label="设计产能(ph)" width="120" />
<el-table-column prop="realty" label="实际产能(ph)" width="120" />
<el-table-column prop="realty" label="产能利用率(%)" width="120" >
<template slot-scope="scope" :formatter="crud.formatNum0">
<span>{{ Number(scope.row.realty/scope.row.theory).toFixed(3)}}</span>
</template>
<el-table-column prop="workprocedure_code" label="工序编号" width="120" show-overflow-tooltip />
<el-table-column prop="workprocedure_name" label="工序名称" width="150" />
<el-table-column prop="total_order_count" label="总工单数" width="100" />
<el-table-column prop="total_real_qty" label="生产数" width="150" />
<el-table-column prop="total_nok_qty" label="总废品数" width="150" />
<el-table-column :label="item" v-for="(item, index) in crud.data[0].header" :key="index" align="center">
<el-table-column label="工单数" width="60" >
<template slot-scope="scope">
<span>{{ scope.row.item[index].order_count }}</span>
</template>
</el-table-column>
<el-table-column label="生产数" width="120" >
<template slot-scope="scope">
<span>{{ scope.row.item[index].real_qty }}</span>
</template>
</el-table-column>
<el-table-column label="废品数" width="120" >
<template slot-scope="scope">
<span>{{ scope.row.item[index].nok_qty }}</span>
</template>
</el-table-column>
<el-table-column label="废品率%" width="120" >
<template slot-scope="scope">
<span>{{ scope.row.item[index].nok_rate}}</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="orders" label="工单列表" width="150" show-overflow-tooltip/>
</el-table>
<!--分页组件-->
<pagination />
@@ -108,7 +122,7 @@
</template>
<script>
import productCap from '@/views/wms/analysis_manage/productCapacity/productCap'
import qualityanilysis from '@/views/wms/analysis_manage/qlmanage/qualityanilysis'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
@@ -118,16 +132,8 @@ import crudDevice from '@/api/wms/pdm/device'
import echarts from 'echarts'
const defaultForm = {
product_area: null,
device_code: null,
device_name: null,
workprocedure_name: null,
theory: null,
real_qty: null,
plan_qty: null,
realty: null,
hours: null,
orders: null,
analysis: '1',
product_area : 'A1',
}
export default {
name: 'WorkGood',
@@ -138,9 +144,9 @@ export default {
return CRUD({
title: '废品统计',
optShow: { add: false, reset: true },
url: 'api/productCap',
url: 'api/qualityanalysis',
idField: 'id',
crudMethod: { ...productCap }
crudMethod: { ...qualityanilysis }
})
},
data() {
@@ -161,6 +167,8 @@ export default {
measure_unit: [],
sects: [],
workList: [],
headerData:[],
product_area: 'A1',
downloadLoading: false,
permission: {
add: ['admin', 'dept:add'],
@@ -172,9 +180,17 @@ export default {
},
created() {
this.getWorkprocedure()
this.query.product_area = 'A1'
this.query.analysis = '1'
},
methods: {
labelHead(h,{column,index}){ //动态表头渲染
//let l = column.label.length;
//let f = 12; //每个字大小,其实是每个字的比例值,大概会比字体大小打差不多大
//column.minWidth = f * l; //字大小乘个数即长度 ,注意不要加px像素这里minWidth只是一个比例值不是真正的长度
//然后将列标题放在一个div块中注意块的宽度一定要100%,否则表格显示不完全
return h('span',{class:'table-head',style:{width:'100%'}},[column.label])
},
sync() {
dailyStructivt.sync(Array.of('st_ivt_structivt_bcp', 'st_ivt_structivt_cp', 'st_ivt_structivt_yl')).then(result => {
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
@@ -186,39 +202,45 @@ export default {
})
},
[CRUD.HOOK.afterRefresh]() {
var pigdata =[]
var legendData =[]
var xAxisData =this.crud.data[0].header
var seriesData =[]
this.crud.data.forEach(a=>{
pigdata.push({"value":a.realty,"name":a.device_name})
legendData.push(a.workprocedure_name);
seriesData.push({"data":a.viewData,"name":a.workprocedure_name, "type": 'line',"stack": a.workprocedure_name})
}
)
var myChart = echarts.init(document.getElementById('main2'));
var option = {
title: {
text: '实际产能饼图',
left: 'center'
text: '工序废品率'
},
tooltip: {
trigger: 'item'
trigger: 'axis'
},
legend: {
orient: 'vertical',
left: 'left'
data: legendData
},
series: [
{
name: '实际产能',
type: 'pie',
radius: '70%',
data: pigdata,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
]
},
xAxis: {
type: 'category',
boundaryGap: false,
data: xAxisData
},
yAxis: {
type: 'value',
},
series: seriesData
};
myChart.setOption(option);
},

View File

@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/scrapRate',
url: 'api/qualityanalysis',
method: 'post',
data
})
@@ -10,7 +10,7 @@ export function add(data) {
export function del(ids) {
return request({
url: 'api/scrapRate',
url: 'api/qualityanalysis',
method: 'delete',
data: ids
})
@@ -19,7 +19,7 @@ export function del(ids) {
export function edit(data) {
return request({
url: 'api/scrapRate',
url: 'api/qualityanalysis',
method: 'put',
data
})