693 lines
18 KiB
Vue
693 lines
18 KiB
Vue
<!-- 日志详情 mlog信息以及mlogb -->
|
||
<template>
|
||
<el-drawer
|
||
title="日志详情"
|
||
v-model="visible"
|
||
:size="'90%'"
|
||
destroy-on-close
|
||
@closed="$emit('closed')"
|
||
>
|
||
<div>
|
||
<el-card style="width: 100%" header="基本信息" shadow="never">
|
||
<el-descriptions>
|
||
<el-descriptions-item label="工艺路线">{{
|
||
mlogItem.routepack_name
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="输入物料">{{
|
||
mlogItem.material_in_name
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="输出物料">{{
|
||
mlogItem.material_out_name
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="工段名称">{{
|
||
mlogItem.mgroup_name
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="生产设备">{{
|
||
mlogItem.equipment_name
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="预计工时">{{
|
||
mlogItem.hour_work
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="部门/车间">{{
|
||
mlogItem.belong_dept_name
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="处理人">{{
|
||
mlogItem.handle_user_name
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="开始时间">{{
|
||
mlogItem.work_start_time
|
||
}}</el-descriptions-item>
|
||
<el-descriptions-item label="创建时间">{{
|
||
mlogItem.create_time
|
||
}}</el-descriptions-item>
|
||
</el-descriptions>
|
||
<div style="padding: 5px 10px;display: flex;justify-content: end;">
|
||
<el-button
|
||
type="primary"
|
||
v-if="mlogItem.submit_time == null"
|
||
@click="mlogUpdate"
|
||
style="margin-right: 10px;"
|
||
v-auth="'mlog.update'"
|
||
>
|
||
编辑
|
||
</el-button>
|
||
<el-button
|
||
type="primary"
|
||
v-if="mlogItem.submit_time == null"
|
||
:loading="isSaveing"
|
||
@click="mlogSubmit"
|
||
>提交</el-button
|
||
>
|
||
</div>
|
||
</el-card>
|
||
<!-- 输入物料 -->
|
||
<el-card
|
||
style="width: 100%; margin: 1vh 0"
|
||
header="输入物料"
|
||
shadow="never"
|
||
>
|
||
<div>
|
||
<el-button
|
||
type="primary"
|
||
v-if="mlogItem.submit_time == null&&(mlogItem.ticket==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type==1))"
|
||
icon="el-icon-plus"
|
||
@click="table_add"
|
||
>新增</el-button
|
||
>
|
||
</div>
|
||
<div style="height: 4px"></div>
|
||
<scTable
|
||
ref="tableIn"
|
||
:apiObj="apiObj"
|
||
row-key="id"
|
||
stripe
|
||
:params="paramsIn"
|
||
hidePagination
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
<el-table-column
|
||
label="物料"
|
||
prop="material_in_name"
|
||
show-overflow-tooltip
|
||
></el-table-column>
|
||
<el-table-column label="批次号" prop="batch">
|
||
</el-table-column>
|
||
<el-table-column label="领用数量" prop="count_use">
|
||
</el-table-column>
|
||
<el-table-column label="主要批次" prop="is_main_batchin">
|
||
<template #default="scope">
|
||
<el-tag :type="scope.row.parent==null ? 'success': 'info'">
|
||
{{scope.row.parent==null ? '是' : '否'}}
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<!-- <el-table-column label="加工前不良" prop="count_pn_jgqbl">
|
||
</el-table-column> -->
|
||
<el-table-column
|
||
label="创建时间"
|
||
prop="create_time"
|
||
show-overflow-tooltip
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="操作"
|
||
fixed="right"
|
||
align="center"
|
||
width="100px"
|
||
>
|
||
<template #default="scope">
|
||
<el-link
|
||
:underline="false"
|
||
type="primary"
|
||
@click="table_in_edit(scope.row)"
|
||
v-if="mlogItem.submit_time== null&&mlogItem.material_in_&&mlogItem.material_in_.tracking==10"
|
||
>
|
||
编辑
|
||
</el-link>
|
||
<el-link
|
||
:underline="false"
|
||
type="primary"
|
||
v-if="mlogItem.submit_time == null&&mlogItem.material_in_&&mlogItem.material_in_.tracking==20"
|
||
@click="table_out_check_single(scope.row,'ins')"
|
||
>详情</el-link>
|
||
<el-link
|
||
:underline="false"
|
||
:disabled="mlogItem.submit_time !== null"
|
||
type="danger"
|
||
style="margin-left: 10px;"
|
||
@click="table_in_del(scope.row)"
|
||
>
|
||
删除
|
||
</el-link>
|
||
</template>
|
||
</el-table-column>
|
||
</scTable>
|
||
</el-card>
|
||
<!-- 输入物料编辑 -->
|
||
<el-dialog v-model="saveInDialog" title="编辑">
|
||
<el-form
|
||
:model="saveInForm"
|
||
:rules="rules"
|
||
label-width="100px"
|
||
ref="saveInForm"
|
||
>
|
||
<el-row>
|
||
<el-col :span="23">
|
||
<el-form-item label="领取数量" prop="count_use">
|
||
<el-input-number
|
||
v-model="saveInForm.count_use"
|
||
:min="1"
|
||
style="width: 100%"
|
||
controls-position="right"
|
||
/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="23" v-if="base_code!=='bxerp'">
|
||
<el-form-item label="加工前不良" prop="count_pn_jgqbl">
|
||
<el-input-number
|
||
v-model="saveInForm.count_pn_jgqbl"
|
||
:min="0"
|
||
style="width: 100%"
|
||
controls-position="right"
|
||
/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<!-- <sc-form-table
|
||
hideDelete
|
||
:tableHeight="300"
|
||
v-model="defectlist"
|
||
:addTemplate="addTemplate"
|
||
placeholder="暂无数据"
|
||
>
|
||
<el-table-column prop="number" label="不合格项">
|
||
<template #default="scope">
|
||
<el-select
|
||
v-model="scope.row.defect"
|
||
placeholder="不合格项"
|
||
clearable
|
||
style="width: 100%"
|
||
>
|
||
<el-option
|
||
v-for="item in defectOptions"
|
||
:key="item.defect"
|
||
:label="item.defect_name"
|
||
:value="item.defect"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="数量">
|
||
<template #default="scope">
|
||
<el-input-number
|
||
v-model="scope.row.count"
|
||
:min="0"
|
||
class="width-100"
|
||
controls-position="right"
|
||
>
|
||
</el-input-number>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="open" label="操作" width="60" align="center">
|
||
<template #default="scope">
|
||
<el-button
|
||
v-if="scope.row.id"
|
||
text
|
||
type="danger"
|
||
size="small"
|
||
@click="formTableDel(scope.row.id)"
|
||
>删除</el-button
|
||
>
|
||
<el-button
|
||
v-else
|
||
text
|
||
type="primary"
|
||
size="small"
|
||
@click="formTableSave(scope.row)"
|
||
>保存</el-button
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</sc-form-table> -->
|
||
</el-row>
|
||
</el-form>
|
||
<template #footer>
|
||
<el-button
|
||
type="primary"
|
||
:loading="isSaveing"
|
||
@click="saveInSubmit()"
|
||
>保 存</el-button
|
||
>
|
||
</template>
|
||
</el-dialog>
|
||
<!-- 输出物料 -->
|
||
<el-card style="width: 100%" header="输出物料" shadow="never">
|
||
<scTable
|
||
ref="tableOut"
|
||
:apiObj="apiObj"
|
||
row-key="id"
|
||
stripe
|
||
:params="paramsOut"
|
||
hidePagination
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
<!-- <el-table-column type="expand">
|
||
<template #default="props">
|
||
<div style="padding-left: 50px">
|
||
<el-descriptions :column="4">
|
||
<el-descriptions-item label="破损">
|
||
{{props.row.count_n_hs}}
|
||
</el-descriptions-item>
|
||
</el-descriptions>
|
||
</div>
|
||
</template>
|
||
</el-table-column> -->
|
||
<el-table-column
|
||
label="产出物料"
|
||
prop="material_out_name"
|
||
show-overflow-tooltip
|
||
></el-table-column>
|
||
<el-table-column label="批次号" prop="batch">
|
||
</el-table-column>
|
||
<el-table-column label="数量" prop="count_real">
|
||
</el-table-column>
|
||
<el-table-column label="合格数" prop="count_ok">
|
||
</el-table-column>
|
||
<el-table-column label="不合格数量" prop="count_notok">
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="创建时间"
|
||
prop="create_time"
|
||
show-overflow-tooltip
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="操作"
|
||
fixed="right"
|
||
align="center"
|
||
width="100px"
|
||
>
|
||
<template #default="scope">
|
||
<!-- 批次 -->
|
||
<el-link
|
||
:underline="false"
|
||
type="primary"
|
||
v-if="mlogItem.submit_time == null&&mlogItem.material_out_&&mlogItem.material_out_.tracking==10"
|
||
@click="table_out_check(scope.row)"
|
||
>详情</el-link>
|
||
<!-- 单个 -->
|
||
<el-link
|
||
:underline="false"
|
||
type="primary"
|
||
v-if="mlogItem.submit_time == null&&mlogItem.material_out_&&mlogItem.material_out_.tracking==20"
|
||
@click="table_out_check_single(scope.row,'outs')"
|
||
>详情</el-link>
|
||
</template>
|
||
</el-table-column>
|
||
</scTable>
|
||
</el-card>
|
||
<!-- 工段物料库存 -->
|
||
<el-card style="width: 100%" header="工段物料列表" shadow="never">
|
||
<scTable
|
||
ref="tableWm"
|
||
:apiObj="apiObjWm"
|
||
:params="paramsWm"
|
||
stripe
|
||
hidePagination
|
||
>
|
||
<el-table-column label="物料名称" prop="material_name" show-overflow-tooltip>
|
||
</el-table-column>
|
||
<el-table-column label="批次号" prop="batch">
|
||
</el-table-column>
|
||
<el-table-column label="数量" prop="count">
|
||
</el-table-column>
|
||
<el-table-column label="不合格标记" prop="notok_sign_name">
|
||
</el-table-column>
|
||
<el-table-column width="100">
|
||
<template #default="scope">
|
||
<el-link :underline="false" @click="printMaterial(scope.row)" type="primary">物料标签</el-link>
|
||
</template>
|
||
</el-table-column>
|
||
</scTable>
|
||
</el-card>
|
||
<save-dialog
|
||
v-if="dialog.save"
|
||
ref="saveDialog"
|
||
:mlog="mlogId"
|
||
:mgroup="mgroup"
|
||
:routeId ="routeId"
|
||
:tracking="tracking"
|
||
:materialIn="materialIn"
|
||
@success="handleSaveSuccess"
|
||
@closed="dialog.save = false"
|
||
>
|
||
</save-dialog>
|
||
<check-dialog
|
||
v-if="dialog.check"
|
||
ref="checkDialog"
|
||
:material="materialOut"
|
||
@success="handleCheckSuccess"
|
||
@closed="checkDialogClose"
|
||
>
|
||
</check-dialog>
|
||
<scheck-dialog
|
||
v-if="dialog.check_single"
|
||
ref="checkDialogSingle"
|
||
:mlogb="mlogb"
|
||
:wm = "wm"
|
||
:qct="qct"
|
||
:handle_user="handle_user"
|
||
:handle_date="handle_date"
|
||
@success="handlesCheckSuccess"
|
||
@closed="scheckClose"
|
||
>
|
||
</scheck-dialog>
|
||
<edit-dialog
|
||
v-if="dialog.edit"
|
||
ref="editDialog"
|
||
:dept="deptId"
|
||
:mgroupName= "mlogItem.mgroup_name"
|
||
@success="handleEditSuccess"
|
||
@closed="dialog.edit = false"
|
||
>
|
||
</edit-dialog>
|
||
<el-dialog v-model="printVisible" width="1200px">
|
||
<print :baseData="mlogItem" :tableData="tableData" :tableData2="tableData2" type="102" @closePrint="printVisible=false"/>
|
||
</el-dialog>
|
||
</div>
|
||
</el-drawer>
|
||
</template>
|
||
<script>
|
||
import editDialog from "./mlog_form.vue";
|
||
import saveDialog from "./mlogb_form.vue";
|
||
import checkDialog from "./mlogb_check.vue";
|
||
import scheckDialog from "./mlogbw_check.vue";
|
||
import print from "./../setting/print/A4.vue";
|
||
export default {
|
||
props: {
|
||
mlogId: {
|
||
type: String,
|
||
default: "",
|
||
},
|
||
},
|
||
components: {
|
||
editDialog,
|
||
saveDialog,
|
||
checkDialog,
|
||
scheckDialog,
|
||
print
|
||
},
|
||
emits: ["success", "closed"],
|
||
data() {
|
||
return {
|
||
base_code: this.$TOOL.data.get('BASE_INFO').base.base_code,
|
||
loading: false,
|
||
//表单数据
|
||
form: {},
|
||
dialog: {
|
||
save: false,
|
||
edit: false,
|
||
check: false,
|
||
print_m:false,
|
||
check_single: false,
|
||
},
|
||
apiObj: null,
|
||
apiObjWm:null,
|
||
paramsWm: {
|
||
page: 0,
|
||
search:'',
|
||
mgroup:''
|
||
},
|
||
paramsIn: {
|
||
page: 0,
|
||
mlog: "",
|
||
with_children:'yes',
|
||
material_in__isnull: 0,
|
||
},
|
||
paramsOut: {
|
||
page: 0,
|
||
mlog: "",
|
||
material_out__isnull: 0,
|
||
},
|
||
tracking:'10',
|
||
mlogb:"",
|
||
mgroup: "",
|
||
mlogItem: {},
|
||
saveInForm: {
|
||
count_use: 0,
|
||
count_pn_jgqbl: 0,
|
||
},
|
||
fileList:[],
|
||
tableDataWm:[],
|
||
test_file:'',
|
||
deptId: "",
|
||
visible: false,
|
||
isSaveing: false,
|
||
options: [],
|
||
tableData:[],
|
||
tableData2:[],
|
||
defectOptions:[],
|
||
isSingle:true,
|
||
saveInDialog: false,
|
||
printVisible:false,
|
||
setFiltersVisible: false,
|
||
rules: {
|
||
count_use: [
|
||
{
|
||
required: true,
|
||
message: "请输入领取数量",
|
||
trigger: "blur",
|
||
},
|
||
],
|
||
},
|
||
handle_date:'',
|
||
handle_user:'',
|
||
wm:'',
|
||
materialOut:'',
|
||
batchContains:'',
|
||
apiObjPrint:this.$API.cm.labelmat.fromWm,
|
||
printer_name:localStorage.getItem("printer_name"),
|
||
addTemplate:{
|
||
defect: "",
|
||
count: 1,
|
||
mlogb: "",
|
||
isEdit: true,
|
||
},
|
||
defectlist:[],
|
||
};
|
||
},
|
||
mounted() {
|
||
let that = this;
|
||
this.paramsIn.mlog = this.mlogId;
|
||
this.paramsOut.mlog = this.mlogId;
|
||
this.apiObj = this.$API.wpm.mlogb.list;
|
||
that.$API.wpm.mlogb.list.req(that.paramsIn).then((res) => {
|
||
that.tableData = res;
|
||
})
|
||
that.getMlogItem();
|
||
},
|
||
methods: {
|
||
open() {
|
||
this.visible = true;
|
||
},
|
||
getMlogItem() {
|
||
let that = this;
|
||
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
|
||
that.mlogItem = res;
|
||
console.log('that.mlogItem',that.mlogItem);
|
||
that.routeId = res.route;
|
||
that.tracking = res.material_in_.tracking;
|
||
if(res.test_file!==null){
|
||
that.fileList = [{name:res.test_file,url:res.test_file}];
|
||
that.form.test_file = res.test_file;
|
||
}
|
||
that.mgroup = res.mgroup;
|
||
that.paramsWm.mgroup = res.mgroup;
|
||
that.materialIn = res.material_in;
|
||
that.deptId = res.belong_dept;
|
||
that.$API.wpm.mlogb.list.req(that.paramsOut).then((res) => {
|
||
that.tableData2 = res;
|
||
if(res.length>0){
|
||
res.forEach((item) => {
|
||
that.batchContains+= item.batch + " ";
|
||
})
|
||
that.paramsWm.search = that.batchContains;
|
||
that.apiObjWm = that.$API.wpm.wmaterial.list;
|
||
}
|
||
})
|
||
});
|
||
},
|
||
|
||
//表单注入数据
|
||
setData(data) {
|
||
Object.assign(this.form, data);
|
||
this.getRoute(data.id);
|
||
},
|
||
//编辑
|
||
mlogUpdate() {
|
||
this.dialog.edit = true;
|
||
this.$nextTick(() => {
|
||
this.$refs.editDialog.open("edit").setData(this.mlogItem);
|
||
});
|
||
},
|
||
table_add() {
|
||
this.dialog.save = true;
|
||
this.$nextTick(() => {
|
||
this.$refs.saveDialog.open();
|
||
});
|
||
},
|
||
mlogbinSuccess(){
|
||
this.$refs.tableIn.refresh();
|
||
this.$refs.tableOut.refresh();
|
||
},
|
||
//自检
|
||
table_in_edit(row) {
|
||
this.saveInForm = row;
|
||
this.saveInDialog = true;
|
||
// this.getdefects(row.qct);
|
||
},
|
||
// getdefects(qct){
|
||
// let that = this;
|
||
// that.$API.qm.qct.item.req(qct).then((res) => {
|
||
// that.defectOptions = [];
|
||
// that.defectOptions = res.qct_defects;
|
||
// })
|
||
// },
|
||
// formTableSave(row){
|
||
// let that = this;
|
||
// let obj = new Object();
|
||
// obj.count = row.count;
|
||
// obj.defect = row.defect;
|
||
// obj.mlogb = that.saveInForm.id;
|
||
// that.$API.wpm.mlogbdefect.create.req(obj).then((res) => {
|
||
|
||
// })
|
||
// },
|
||
//提交自检
|
||
saveInSubmit() {
|
||
let that = this;
|
||
that.$refs.saveInForm.validate(async (valid) => {
|
||
if (valid) {
|
||
that.isSaveing = true;
|
||
let obj = {};
|
||
obj.count_use = that.saveInForm.count_use;
|
||
obj.count_pn_jgqbl = that.saveInForm.count_pn_jgqbl;
|
||
that.$API.wpm.mlogb.updateIn
|
||
.req(that.saveInForm.id, obj)
|
||
.then((res) => {
|
||
that.isSaveing = false;
|
||
that.$message.success("操作成功");
|
||
that.saveInDialog = false;
|
||
that.$refs.tableIn.refresh();
|
||
that.$refs.tableOut.refresh();
|
||
})
|
||
.catch(() => {
|
||
that.isSaveing = false;
|
||
});
|
||
}
|
||
});
|
||
},
|
||
table_in_del(row) {
|
||
let that = this;
|
||
that.$confirm("确定删除吗?").then(() => {
|
||
that.$API.wpm.mlogb.delIn.req(row.id).then((res) => {
|
||
that.$message.success("操作成功");
|
||
that.$refs.tableIn.refresh();
|
||
that.$refs.tableOut.refresh();
|
||
//删除in记录后,out也要删除相应的记录
|
||
});
|
||
});
|
||
},
|
||
table_out_check(row) {
|
||
this.dialog.check = true;
|
||
this.materialOut = row.material_out;
|
||
let obj = {};
|
||
Object.assign(obj, row);
|
||
obj.mgroup_name = this.mlogItem.mgroup_name;
|
||
this.$nextTick(() => {
|
||
this.$refs.checkDialog.open(obj);
|
||
});
|
||
},
|
||
table_out_check_single(row,type){
|
||
this.mlogb = row.id;
|
||
this.wm = row.wm_in;
|
||
this.qct = row.qct;
|
||
this.handle_date=this.mlogItem.handle_date;
|
||
this.handle_user = this.mlogItem.handle_user;
|
||
this.dialog.check_single = true;
|
||
this.$nextTick(() => {
|
||
this.$refs.checkDialogSingle.open(type);
|
||
});
|
||
},
|
||
//表单提交方法
|
||
mlogSubmit() {
|
||
let that = this;
|
||
that.$API.wpm.mlog.submit.req(that.mlogItem.id).then((res) => {
|
||
that.isSaveing = false;
|
||
that.visible = false;
|
||
that.$message.success("操作成功");
|
||
});
|
||
},
|
||
handleSaveSuccess() {
|
||
this.$refs.tableIn.refresh();
|
||
this.$refs.tableOut.refresh();
|
||
},
|
||
handleCheckSuccess() {
|
||
this.$refs.tableOut.refresh();
|
||
},
|
||
handlesCheckSuccess(){},
|
||
fileUPSuccess(res) {
|
||
let that = this;
|
||
console.log('res',res);
|
||
this.test_file = res.path;
|
||
},
|
||
//编辑成功后的方法调用
|
||
handleEditSuccess() {
|
||
this.getMlogItem();
|
||
},
|
||
//设置过滤项
|
||
setFilters(filters) {
|
||
this.selectionFilters = filters;
|
||
this.setFiltersVisible = true;
|
||
},
|
||
scheckClose(){
|
||
this.dialog.check_single = false;
|
||
this.$refs.tableOut.refresh();
|
||
},
|
||
checkDialogClose(){
|
||
this.dialog.check = false;
|
||
this.$refs.tableOut.refresh();
|
||
},
|
||
handlePrint(){
|
||
let that = this;
|
||
that.printVisible = true;
|
||
},
|
||
//打印物料标签
|
||
printMaterial(row){
|
||
let that = this;
|
||
that.apiObj.req({tid:row.id}).then((res) => {
|
||
let code = res.code_label;
|
||
let str = [
|
||
"SIZE 40 mm,70 mm",
|
||
"GAP 7 mm,7 mm",
|
||
"CLS",
|
||
"REFERENCE 0,0",
|
||
'QRCODE 30,400,H,5,A,0,"' +code +'"',
|
||
"WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
|
||
"WINTEXT 240,550,28,90,0,0,Simhei," + res.batch,
|
||
"PRINT 1",
|
||
];
|
||
let obj = {};
|
||
obj.printer_commands = str;
|
||
obj.printer_name = that.printer_name;
|
||
that.$API.wpm.prints.req(obj).then((response) => {
|
||
that.$message.success("打印成功");
|
||
});
|
||
})
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style></style>
|