fix:车间物料可以批次&板段切换查询

This commit is contained in:
shijing 2025-09-11 14:08:26 +08:00
parent 5d4b61e893
commit a30e7e0dcc
2 changed files with 327 additions and 7 deletions

View File

@ -7,6 +7,15 @@
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</el-button>
</div>
<div class="right-panel">
<el-switch
v-model="showWprList"
size="small"
class="demo-type asyncColorSwitch"
inactive-text="批次"
active-text="板段"
style="--el-switch-on-color: #67c23a; --el-switch-off-color: #0052d9"
@change="showWprListChange"
></el-switch>
<el-select
v-model="query.state"
placeholder="物料状态"
@ -36,6 +45,7 @@
</el-header>
<el-main class="nopadding">
<scTable
v-if="!showWprList"
ref="table"
:apiObj="apiObj"
row-key="id"
@ -145,6 +155,73 @@
</template>
</el-table-column>
</scTable>
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="query"
v-if="showWprList"
@selection-change="selectionChange"
>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="状态" prop="state" width="80" >
<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="物料名称"
prop="material_name"
min-width="120"
>
<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="number"></el-table-column>
<el-table-column
label="批次号"
prop="wm_batch"
min-width="150"
></el-table-column>
<el-table-column
label="物料已到工序"
prop="material_name"
min-width="100"
>
<template #default="scope">
{{ scope.row.material_name.split('|').at(-1) }}
</template>
</el-table-column>
<el-table-column label="不合格标记" prop="wprdefect">
<template #default="scope">
<span v-for="item in scope.row.wprdefect" :key="item.id">
{{ item.defect_name }}
</span>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-link :underline="false" @click="printMaterial(scope.row,'wpr')" type="primary">物料标签</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
@ -273,7 +350,6 @@ export default {
params: {
tag : 'todo',
mgroupx: "",
belong_dept:''
},
wmtype:0,
query: {
@ -310,6 +386,7 @@ export default {
wmMaterial:'',
cate_type:'',
materialType: "wm",
showWprList: false,
limitedWatch:false,
materialsVisible:false,
visibleDrawer: false,
@ -332,6 +409,15 @@ export default {
that.apiObj = that.$API.wpm.wmaterial.list;
},
methods: {
showWprListChange(){
let that = this;
that.apiObj = null;
if(that.showWprList){
that.apiObj = that.$API.wpm.wpr.list;
}else{
that.apiObj = that.$API.wpm.wmaterial.list;
}
},
handleWatch(row) {
let that = this;
that.$API.wpm.batchlog.dag.req({batch:row.batch}).then((res) => {
@ -457,9 +543,10 @@ export default {
});
},
//
printMaterial(row){
printMaterial(row,type){
let that = this;
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
if(type=='wm'){
let params = {};
params.tid = row.id;
let materialname = row.material_.name + '|' + row.material_.process_name;
@ -517,6 +604,79 @@ export default {
});
})
}
}else if(type=='wpr'){
that.ofromBatch = row.wm_batch;
that.ofromName = row.wm_material_ofrom_name;
let params = {};
let name = row.material_name.split('|')[0];
if(that.route_code=='paiyicibang'||that.route_code=='kunbang'){
console.log('that.route_code',that.route_code);
console.log('that.ofromName',that.ofromName);
that.$API.mtm.route.list.req({material_out:row.material,page:0}).then((res) => {
let data = res[0].params_json;
data.number = row.number;
data.name=name;
data.ofrom_name=that.ofromName;
params.data = data;
if(that.route_code=='paiyicibang'){
params.label_template_name = '排一次棒单件打印模板';
}else{
params.label_template_name = '捆棒单件打印模板';
}
that.$API.cm.labeltemplate.commands.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
});
})
}else{
if(that.route_code=='paiban'||that.route_code=='zhuangmo'||that.route_code=='zlybcl'||that.route_code=='tuomoceliang'||
that.route_code=='reyatuihuo'||that.route_code=='banduangunyuan'||that.route_code=='banduangunyuanhoudama'||that.route_code=='banduangunyuantuihuo'
){
let oinfo = [];
for(let key in row.oinfo){
oinfo.push(row.oinfo[key])
}
let data = {sigao:'',duibian:'',moban:'',hengya:'',istest:'否',number:row.number,name:name,ofrom_name:that.ofromName,ofrom_batch:that.ofromBatch};
if(that.route_code=='zhuangmo'||that.route_code=='zlybcl'||that.route_code=='tuomoceliang'||that.route_code=='reyatuihuo'||that.route_code=='banduangunyuan'){
params.label_template_name = '脱膜测量单件标签模板';
}else{
params.label_template_name = '排扳单件打印模板';
}
if(oinfo.length>0){
oinfo.forEach((item)=>{
if(item.name=="丝高"){
data.sigao = item.val;
}else if(item.name=="横压"){
data.hengya = item.val;
}else if(item.name=="对边"){
data.duibian = item.val;
}else if(item.name=="模具号"){
data.moban = item.val;
}else if(item.name=="实验板段"){
data.istest = item.val?'是':'否';
}
})
}
params.data = data;
}else{
params.label_template_name = '单件打印模板';
params.data = {number:row.number,name:name};
}
that.$API.cm.labeltemplate.commands.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
});
}
}
}else{
that.$message.warning("请先设置打印机");
}

View File

@ -8,6 +8,15 @@
<el-button type="primary" @click="tomio('do_in')" v-auth="'mio.doin'">入库</el-button>
</div>
<div class="right-panel">
<el-switch
v-model="showWprList"
size="small"
class="demo-type asyncColorSwitch"
inactive-text="批次"
active-text="板段"
style="--el-switch-on-color: #67c23a; --el-switch-off-color: #0052d9"
@change="showWprListChange"
></el-switch>
<el-select
v-model="query.state"
placeholder="物料状态"
@ -51,6 +60,7 @@
</el-header>
<el-main class="nopadding">
<scTable
v-if="!showWprList"
ref="table"
:apiObj="apiObj"
row-key="id"
@ -59,7 +69,7 @@
@selection-change="selectionChange"
>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="状态" prop="state" width="100" >
<el-table-column label="状态" prop="state" width="80" >
<template #default="scope">
<el-tag :type="wmState[scope.row.state]?.type">
{{wmState[scope.row.state]?.text}}
@ -160,6 +170,73 @@
</template>
</el-table-column>
</scTable>
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="query"
v-if="showWprList"
@selection-change="selectionChange"
>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="状态" prop="state" width="80" >
<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="物料名称"
prop="material_name"
min-width="120"
>
<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="number"></el-table-column>
<el-table-column
label="批次号"
prop="wm_batch"
min-width="150"
></el-table-column>
<el-table-column
label="物料已到工序"
prop="material_name"
min-width="100"
>
<template #default="scope">
{{ scope.row.material_name.split('|').at(-1) }}
</template>
</el-table-column>
<el-table-column label="不合格标记" prop="wprdefect">
<template #default="scope">
<span v-for="item in scope.row.wprdefect" :key="item.id">
{{ item.defect_name }}
</span>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-link :underline="false" @click="printMaterial(scope.row,'wpr')" type="primary">物料标签</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
@ -287,7 +364,6 @@ export default {
params: {
tag : 'done',
mgroupx: "",
belong_dept:''
},
wmtype:0,
query: {
@ -326,6 +402,7 @@ export default {
wmMaterial:'',
cate_type:'',
materialType: "wm",
showWprList: false,
showBatch: false,
limitedWatch:false,
materialsVisible:false,
@ -357,6 +434,15 @@ export default {
that.defectOptions = res;
})
},
showWprListChange(){
let that = this;
that.apiObj = null;
if(that.showWprList){
that.apiObj = that.$API.wpm.wpr.list;
}else{
that.apiObj = that.$API.wpm.wmaterial.list;
}
},
handleWatch(row) {
let that = this;
that.$API.wpm.batchlog.dag.req({batch:row.batch}).then((res) => {
@ -492,6 +578,7 @@ export default {
printMaterial(row,type){
let that = this;
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
if(type=='wm'){
let params = {};
params.tid = row.id;
let materialname = row.material_.name + '|' + row.material_.process_name;
@ -563,6 +650,78 @@ export default {
});
})
}
}else if(type=='wpr'){
that.ofromBatch = row.wm_batch;
that.ofromName = row.wm_material_ofrom_name;
let params = {};
let name = row.material_name.split('|')[0];
if(that.route_code=='paiyicibang'||that.route_code=='kunbang'){
console.log('that.route_code',that.route_code);
console.log('that.ofromName',that.ofromName);
that.$API.mtm.route.list.req({material_out:row.material,page:0}).then((res) => {
let data = res[0].params_json;
data.number = row.number;
data.name=name;
data.ofrom_name=that.ofromName;
params.data = data;
if(that.route_code=='paiyicibang'){
params.label_template_name = '排一次棒单件打印模板';
}else{
params.label_template_name = '捆棒单件打印模板';
}
that.$API.cm.labeltemplate.commands.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
});
})
}else{
if(that.route_code=='paiban'||that.route_code=='zhuangmo'||that.route_code=='zlybcl'||that.route_code=='tuomoceliang'||
that.route_code=='reyatuihuo'||that.route_code=='banduangunyuan'||that.route_code=='banduangunyuanhoudama'||that.route_code=='banduangunyuantuihuo'
){
let oinfo = [];
for(let key in row.oinfo){
oinfo.push(row.oinfo[key])
}
let data = {sigao:'',duibian:'',moban:'',hengya:'',istest:'否',number:row.number,name:name,ofrom_name:that.ofromName,ofrom_batch:that.ofromBatch};
if(that.route_code=='zhuangmo'||that.route_code=='zlybcl'||that.route_code=='tuomoceliang'||that.route_code=='reyatuihuo'||that.route_code=='banduangunyuan'){
params.label_template_name = '脱膜测量单件标签模板';
}else{
params.label_template_name = '排扳单件打印模板';
}
if(oinfo.length>0){
oinfo.forEach((item)=>{
if(item.name=="丝高"){
data.sigao = item.val;
}else if(item.name=="横压"){
data.hengya = item.val;
}else if(item.name=="对边"){
data.duibian = item.val;
}else if(item.name=="模具号"){
data.moban = item.val;
}else if(item.name=="实验板段"){
data.istest = item.val?'是':'否';
}
})
}
params.data = data;
}else{
params.label_template_name = '单件打印模板';
params.data = {number:row.number,name:name};
}
that.$API.cm.labeltemplate.commands.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
});
}
}
}else{
that.$message.warning("请先设置打印机");
}
@ -579,4 +738,5 @@ export default {
},
};
</script>
<style scoped></style>
<style scoped>
</style>