fix:批次统计完善

This commit is contained in:
shijing 2025-04-03 09:28:32 +08:00
parent b7a310ed6b
commit 5dea6c314f
1 changed files with 372 additions and 0 deletions

View File

@ -0,0 +1,372 @@
<template>
<el-container>
<el-side>
<el-container>
<el-header style="height: 40px;">
<el-select
v-model="query.material_start__type"
placeholder="请选择"
style="width: 90px;"
>
<el-option label="成品" :value="10"></el-option>
<el-option label="半成品" :value="20"></el-option>
<el-option label="原料" :value="30"></el-option>
</el-select>
<el-input
v-model="query.batch"
placeholder="请输入批次号"
clearable
style="width: 150px;"
>
</el-input>
<el-button type="primary" @click="search">查询</el-button>
</el-header>
<el-main style="padding: 0 1px;">
<scTable
ref="tablets"
:apiObj="apiObj"
row-key="id"
:params="query"
:query="query"
stripe
@row-click="rowClick"
hideDo
:paginationLayout="'total, sizes, jumper'"
>
<el-table-column prop="batch" label="批次号"></el-table-column>
</scTable>
</el-main>
</el-container>
</el-side>
<el-main id="elMain">
<el-container>
<el-header style="height: 40%;flex-direction: column;align-items: start;overflow: scroll;">
<p style="position: fixed;">批次流转图</p>
<scDegra
style="margin-top: 50px;"
v-if="limitedWatch"
ref="degraDialogs"
:nodes="nodes"
:edges="edges"
:rankdir="'LR'"
@nodeClick ="nodeClick"
@closeDialog="limitedWatch = false"
>
</scDegra>
</el-header>
<el-main style="height: 60%;background: #fff;">
<el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
<el-tab-pane name="mlog" label="生产日志">
<scTable
ref="tableMlog"
:apiObj="apiObj_mlog"
row-key="id"
:params="params"
:query="params"
>
<el-table-column label="#" type="index" width="50" fixed></el-table-column>
<el-table-column label="工艺路线" prop="material_out_name" min-width="130" fixed>
<template #default="scope">
<span v-if="scope.row.material_out_name!==null">{{scope.row.material_out_name}}</span>
<span v-else>返工</span>
</template>
</el-table-column>
<el-table-column
label="生产设备"
prop="equipment_name"
min-width="150"
></el-table-column>
<el-table-column label="部门/工段">
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column
label="处理人"
prop="handle_user_name"
width="80"
></el-table-column>
<el-table-column label="保温剩余时间" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
<template #default="scope">
{{ getRemaTime(scope.row) }}
</template>
</el-table-column>
<el-table-column
label="开始时间"
prop="work_start_time"
></el-table-column>
<el-table-column
label="结束时间"
prop="work_end_time"
></el-table-column>
<el-table-column
label="提交时间"
prop="submit_time"
></el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane name="handover" label="交接记录">
<scTable
ref="tableHandover"
:apiObj="apiObj_handover"
row-key="id"
:query="params"
:params="params"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column type="expand">
<template #default="props">
<div style="padding-left: 50px">
<template v-for="item in props.row.handoverb" :key="item.id">
<el-descriptions :column="3">
<el-descriptions-item label="批次">
{{item.batch}}
</el-descriptions-item>
<el-descriptions-item label="数量">
{{item.count}}
</el-descriptions-item>
<el-descriptions-item label="不合格标记" v-if="item.defect_name!==null">
{{item.defect_name}}
</el-descriptions-item>
</el-descriptions>
</template>
</div>
</template>
</el-table-column>
<el-table-column
label="物料"
prop="material_name"
min-width="140"
></el-table-column>
<el-table-column label="批次" prop="batch" min-width="80">
<template #default="scope">
<el-text v-if="scope.row.handoverb.length>0" type="primary">{{scope.row.handoverb.length}}</el-text>
</template>
</el-table-column>
<el-table-column label="数量" prop="count" min-width="80"></el-table-column>
<el-table-column label="交接类型" prop="type" min-width="80">
<template #default="scope" v-if="mgroup_name=='size'||mgroup_name=='facade'">
<el-text v-if="scope.row.send_dept == deptId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_dept == deptId" type="success">接收</el-text>
</template>
<template #default="scope" v-else>
<el-text v-if="scope.row.send_mgroup == mgroupId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_mgroup == mgroupId" type="success">接收</el-text>
</template>
</el-table-column>
<el-table-column label="交接工段" min-width="80">
<template #default="scope">
<el-text v-if="scope.row.send_mgroup == mgroupId">{{scope.row.send_mgroup_name}}</el-text>
<el-text v-if="scope.row.recive_mgroup == mgroupId">{{scope.row.recive_mgroup_name}}</el-text>
</template>
</el-table-column>
<el-table-column label="交接类别" prop="type" width="80">
<template #default="scope">
<el-tag v-if="scope.row.type == 10" type="success"
>正常</el-tag
>
<el-tag v-if="scope.row.type == 20" type="warning"
>返工</el-tag
>
<el-tag v-if="scope.row.type == 30" type="primary"
>检验</el-tag
>
<el-tag v-if="scope.row.type == 40" type="danger"
>报废</el-tag
>
</template>
</el-table-column>
<el-table-column
label="交送人"
prop="send_user_name"
width="80"
></el-table-column>
<el-table-column
label="接收人"
prop="recive_user_name"
width="80"
></el-table-column>
<el-table-column
label="交接日期"
prop="send_date"
width="120"
></el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane name="winm" label="车间库存">
<scTable
ref="tableWinm"
:apiObj="apiObj_winm"
row-key="id"
:query="params"
:params="params"
>
<el-table-column type="selection"></el-table-column>
<el-table-column label="状态" prop="state">
<template #default="scope">
<el-tag :type="wmState[scope.row.state]?.type">
{{wmState[scope.row.state]?.text}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="物料名称" min-width="150">
<template #default="scope">
{{ scope.row.material_name }}
<span v-if="scope.row.material_origin != null">{{ scope.row.material_origin_name }}</span>
</template>
</el-table-column>
<el-table-column label="批次号" prop="batch" min-width="120"></el-table-column>
<el-table-column label="部门/工段">
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column label="数量" prop="count"></el-table-column>
<el-table-column label="生产中" prop="count_working"></el-table-column>
<el-table-column label="不合格标记" prop="defect_name"></el-table-column>
<el-table-column label="创建时间" prop="create_time" width="150"></el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane name="binm" label="仓库库存">
<scTable
ref="tableBinm"
:apiObj="apiObj_binm"
row-key="id"
stripe
:query="params_binm"
:params="params_binm"
>
<el-table-column type="index" width="50" />
<el-table-column label="批次" prop="batch">
</el-table-column>
<el-table-column label="物料名称" prop="material_name">
</el-table-column>
<el-table-column label="规格型号">
<template #default="scope">
<span v-if="scope.row.material_">
{{ scope.row.material_.specification }}
{{ scope.row.material_.model }}
</span>
</template>
</el-table-column>
<el-table-column label="已完成工序">
<template #default="scope">
<span v-if="scope.row.material_">
{{ scope.row.material_.process_name }}
</span>
</template>
</el-table-column>
<el-table-column label="仓库" prop="warehouse_name">
</el-table-column>
<el-table-column label="物料存量" prop="count">
</el-table-column>
<el-table-column label="有效期" prop="expiration_date">
</el-table-column>
<el-table-column label="更新时间" prop="update_time">
</el-table-column>
</scTable>
</el-tab-pane>
</el-tabs>
</el-main>
</el-container>
</el-main>
</el-container>
</template>
<script>
import { wmState } from "@/utils/enum.js";
export default {
name: "batch_statistics",
data() {
return {
wmState,
apiObj:this.$API.wpm.batchst,
apiObj_mlog:null,
apiObj_handover:null,
apiObj_winm:null,
apiObj_binm:null,
nodes: [],
edges: [],
params:{
batch:'',
},
query:{
batch:'',
material_start__type:20,
},
params_binm:{
search:''
},
batch:'',
activeName:'',
limitedWatch:false,
};
},
mounted() {
},
methods: {
getBatches(){
},
getBatchDag(){
},
rowClick(row){
console.log('row',row)
let that = this;
that.$API.wpm.batchlog.dag.req({batch:row.batch}).then((res) => {
that.nodes = res.nodes;
that.edges = res.edges;
that.limitedWatch = true;
that.$nextTick(() => {
that.$refs.degraDialogs.open();
});
})
},
nodeClick(data){
let that = this;
console.log('nodeClick',data)
that.params.batch = data;
that.params_binm.search = data;
that.activeName = 'mlog';
if( that.apiObj_mlog !==null){
that.$refs.tableMlog.queryData(that.params);
that.$refs.tableHandover.queryData(that.params);
that.$refs.tableWinm.queryData(that.params);
that.$refs.tableBinm.queryData(that.params_binm);
}else{
that.apiObj_mlog = that.$API.wpm.mlog.list;
that.apiObj_handover = that.$API.wpm.handover.list;
that.apiObj_winm = that.$API.wpm.wmaterial.list;
that.apiObj_binm = that.$API.inm.warehouse.batch;
}
},
search(){
this.$refs.tablets.queryData(this.query)
},
handleClick(){
// switch (this.activeName) {
// case 'mlog':
// this.$refs.tableMlog.refresh();
// break;
// case 'handover':
// this.$refs.tableHandover.refresh();
// break;
// case 'winm':
// this.$refs.tableWinm.refresh();
// break;
// case 'binm':
// this.$refs.tableBinm.refresh();
// break;
// }
}
},
};
</script>
<style scoped>
</style>