factory_web/src/views/wpm_bx/mlog_detail.vue

1074 lines
30 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 日志详情 mlog信息以及mlogb -->
<template>
<el-drawer v-model="visible" :size="'95%'" :show-close="false">
<template #header>
<h4>日志详情</h4>
<el-button type="danger" @click="$emit('closed')">关闭</el-button>
</template>
<div>
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-descriptions>
<el-descriptions-item label="工艺路线" v-if="!mlogItem.is_fix" style="width: 100%;">
{{mlogItem.material_in_name}}->{{mlogItem.material_out_name}}
</el-descriptions-item>
<el-descriptions-item label="返工" v-if="mlogItem.is_fix">
<span v-if="mlogItem.material_in_name!==null">{{mlogItem.material_in_name}}</span>
<span v-if="mlogItem.material_out_name!==null">->{{mlogItem.material_out_name}}</span>
</el-descriptions-item>
</el-descriptions>
<el-descriptions>
<el-descriptions-item label="工段名称">{{
mlogItem.mgroup_name
}}</el-descriptions-item>
<el-descriptions-item label="生产设备" v-if="mlogItem.equipment_name!==null">{{
mlogItem.equipment_name
}}</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>
<template v-for="item in oinfo_json" :key="item">
<el-descriptions-item :label="item.key" >
{{item.value}}
</el-descriptions-item>
</template>
<el-descriptions-item label="创建时间">{{
mlogItem.create_time
}}</el-descriptions-item>
<el-descriptions-item label="操作日期">{{
mlogItem.handle_date
}}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{
mlogItem.work_start_time
}}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{
mlogItem.work_end_time
}}</el-descriptions-item>
<el-descriptions-item label="指导文件" v-if="route_file!==null">
<el-button @click="showFile">查看</el-button>
</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
v-if="processOptions.length>0"
style="width: 100%; margin: 1vh 0;position: relative"
header="子工序操作记录"
shadow="never"
>
<el-button
type="primary"
icon="el-icon-plus"
@click="table_muser_add"
style="position: absolute; left: 150px; top: 5px"
>新增</el-button>
<scTable
ref="tableMuser"
:apiObj="apiObjMuser"
row-key="id"
stripe
height="250px"
:params="paramsMuser"
hidePagination
>
<el-table-column type="index" width="50" />
<el-table-column label="工序" prop="process_name">
</el-table-column>
<el-table-column label="操作人" prop="handle_user_name">
</el-table-column>
<el-table-column label="操作日期" prop="handle_date">
</el-table-column>
<el-table-column label="班次" prop="shift_name">
</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-button
type="danger"
@click="table_muser_del(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<!-- 日志操作记录编辑 -->
<el-dialog v-model="saveMuserDialog" title="子工序操作记录">
<el-form
:model="muserForm"
:rules="rules"
label-width="100px"
ref="saveInForm"
>
<el-row>
<el-col :span="23">
<el-form-item label="操作日期" required>
<el-date-picker
v-model="muserForm.handle_date"
type="date"
placeholder="操作日期"
value-format="YYYY-MM-DD"
style="width: 100%"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item label="操作人" required>
<ehsSelect
v-model="muserForm.handle_user"
:showName="muserForm.handle_user_name"
:apiObj="this.$API.system.user.list"
:params="{ depts: dept }"
class="width-100"
></ehsSelect>
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item label="子工序" prop="process">
<el-select
v-model="muserForm.process"
placeholder="请选择"
class="width-100"
>
<el-option
v-for="item in processOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item label="关联班次" prop="shift">
<el-select
v-model="muserForm.shift"
placeholder="班次"
class="width-100"
>
<el-option
v-for="item in shiftOtions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button
type="primary"
:loading="isSaveing"
@click="saveMuserSubmit()"
>保 存</el-button>
</template>
</el-dialog>
<!-- 输入物料 -->
<el-card
style="width: 100%; margin: 1vh 0;position: relative"
header="输入物料"
shadow="never"
>
<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"
style="position: absolute; left: 100px; top: 5px"
>新增</el-button>
<span class="warningText" v-if="route_code=='ladansi'||route_code=='yicifusi'||route_code=='ercifusi'">注:请扫码录入单个棒!一个棒对应一个日志,方便于采集数据对应</span>
<span class="warningText" v-if="route_code=='paiyicibang'||route_code=='paiban'">注:请输入单个棒的料!一个棒的料对应一个日志,方便于自动排号</span>
<span class="warningText" v-if="route_code=='zlybcl'">请扫码录入单个板段,一个板段对应一个日志,方便于采集数据对应</span>
<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="create_time"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="160px"
>
<template #default="scope">
<el-button
type="primary"
@click="table_in_edit(scope.row)"
v-if="mlogItem.submit_time== null&&mlogItem.material_in_&&mlogItem.material_in_.tracking==10"
>编辑</el-button>
<el-button
type="warning"
v-if="mlogItem.material_in_&&mlogItem.material_in_.tracking==20"
@click="table_out_check_single(scope.row,'ins')"
>详情</el-button>
<el-button
:disabled="mlogItem.submit_time !== null"
type="danger"
style="margin-left: 10px;"
@click="table_in_del(scope.row)"
>删除</el-button>
</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>
</el-row>
</el-form>
<template #footer>
<el-button
type="primary"
:loading="isSaveing"
@click="saveInSubmit()"
>保 存</el-button
>
</template>
</el-dialog>
<!-- 输出物料 输出物料追踪类型为批次-->
<el-card v-if="mlogItem.material_out_&&mlogItem.material_out_.tracking==10" style="width: 100%;margin-bottom:1vh" header="输出物料" shadow="never">
<scTable
ref="tableOut"
:apiObj="apiObj"
row-key="id"
stripe
height="250px"
:params="paramsOut"
hidePagination
>
<el-table-column type="index" width="50" />
<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="160px"
>
<template #default="scope">
<el-button
type="primary"
v-if="mlogItem.submit_time == null&&(mlogItem.material_out_&&mlogItem.material_out_.tracking==10||scope.row.material_out_tracking==10)"
style="margin-right: 10px;"
@click="table_out_check(scope.row)"
>编辑</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<!-- 输出物料 输出物料追踪类型为单个-->
<el-card v-else style="width: 100%;margin-bottom:1vh" header="输出物料" shadow="never">
<check-table
v-if="checkTableShow"
ref="checkTable"
:mlogId="mlogId"
:qct="mlogItem.qct"
:wm = "wm"
:dept="deptId"
:mgroup="mgroup"
:material_in="mlogItem.material_in"
:material_out="mlogItem.material_out"
:mgroupName= "mlogItem.mgroup_name"
:isSubmit="isSubmit"
:batchNumber="batchNumber"
:handle_user="mlogItem.handle_user"
:handle_date="mlogItem.handle_date"
:processType="processType"
style="width: 100%;height: 500px;"
></check-table>
</el-card>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:mlog="mlogId"
:mgroup="mgroup"
:isfix = "mlogItem.is_fix"
:routeId ="routeId"
:tracking="tracking"
:material_in="materialIn"
:hasRoute = "hasRoute"
:process="process"
@success="handleSaveSuccess"
@closed="saveMlogbInClose"
>
</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"
:dept="deptId"
:mgroup="mgroup"
:material_in="material_in"
:material_out="material_out"
:mgroupName= "mlogItem.mgroup_name"
:isSubmit="isSubmit"
:batchNumber="batchNumber"
:handle_user="handle_user"
:handle_date="handle_date"
:processType="processType"
@success="handlesCheckSuccess"
@closed="scheckClose"
></scheck-dialog>
<edit-dialog
v-if="dialog.edit"
ref="editDialog"
:dept="dept"
:process="process"
: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>
<div v-if="fileVisible" class="file_show">
<div style="display: flex;justify-content: flex-end;padding: 10px 20px;">
<el-icon size="30" class="el-dialog__close" @click="fileVisible=false"><el-icon-close/></el-icon>
</div>
<iframe :src="route_file" style="width: 100%;height: 90%;">预览</iframe>
</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 checkTable from "./mlogbw_check_table.vue";
import print from "./../setting/print/A4.vue";
export default {
props: {
mlogId: {
type: String,
default: "",
},
process:{
type: String,
default: "",
},
dept:{
type: String,
default: "",
},
mgroup:{
type: String,
default: "",
},
processType:{
type: String,
default: "",
}
},
components: {
checkTable,
editDialog,
saveDialog,
checkDialog,
scheckDialog,
print
},
emits: ["success", "closed"],
data() {
return {
base_code: this.$TOOL.data.get('BASE_INFO').base.base_code,
loading: false,
//表单数据
form: {},
muserForm:{},
dialog: {
save: false,
edit: false,
check: false,
print_m:false,
check_single: false,
},
apiObj: null,
apiObjMuser:null,
paramsIn: {
page: 0,
mlog: "",
parent__isnull:true,
with_children:'yes',
material_in__isnull: 0,
},
paramsOut: {
page: 0,
mlog: "",
material_out__isnull: 0,
},
paramsMuser:{
mlog:""
},
tracking:10,
mlogb:"",
mlogItem: {},
saveInForm: {
count_use: 0,
count_pn_jgqbl: 0,
},
fileList:[],
options: [],
tableData:[],
tableData2:[],
oinfo_json:[],
mlogbwlist:[],
shiftOtions:[],
tableDataWm:[],
qct_defects:[],
defectOptions:[],
qct_testitems:[],
processOptions:[],
test_file:'',
deptId: "",
isSingle:true,
hideAdd: true,
visible: false,
isSaveing: false,
canMultiple:false,
printVisible:false,
saveInDialog: false,
checkTableShow:false,
saveMuserDialog:false,
setFiltersVisible: false,
rules: {
count_use: [{required: true,message: "请输入领取数量",trigger: "blur"}],
process:[{required: true,message: "请选择工序",trigger: "blur"}],
shift:[{required: true,message: "请选择班次",trigger: "blur"}],
},
route_file:null,
handle_date:'',
handle_user:'',
wm:'',
route_code:'',
materialOut:'',
material_in:'',
material_out:'',
batchContains:'',
apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name"),
addTemplate:{
defect: "",
count: 1,
mlogb: "",
isEdit: true,
},
qct:null,
defectlist:[],
batchNumber:'',
hasRoute:false,
isSubmit:false,
fileVisible:false,
};
},
mounted() {
let that = this;
this.route_code = this.$route.path.split("/")[2];
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();
that.getPreocess();
that.getShift();
},
methods: {
open() {
this.visible = true;
},
getMlogItem() {
let that = this;
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
that.mlogItem = res;
that.checkTableShow = true;
that.isSubmit = res.submit_time==null?false:true;
if(that.processType=='10'&&that.mlogItem.material_out_&&that.mlogItem.material_out_.tracking==20){
that.getMlogbw();
// if(that.mlogItem.qct!==null){
// that.getdefects(that.mlogItem.qct);
// }
}
if(res.route!==null){
that.hasRoute = true;
}
that.oinfo_json = [];
if(res.oinfo_json_&&res.oinfo_json_!==null){
for(let key in res.oinfo_json_){
let obj = {};
obj.key = key;
obj.value = res.oinfo_json_[key];
that.oinfo_json.push(obj);
}
}
that.routeId = res.route;
that.tracking = res.material_in_!==null?res.material_in_.tracking:null;
if(res.test_file!==null){
that.fileList = [{name:res.test_file,url:res.test_file}];
that.form.test_file = res.test_file;
}
that.materialIn = res.material_in;
that.deptId = res.belong_dept;
that.apiObjWm = that.$API.wpm.wmaterial.list;
that.$API.wpm.mlogb.list.req(that.paramsOut).then((res) => {
that.tableData2 = res;
})
that.$API.mtm.routepack.list.req({page:0,search:res.routepack_name}).then((res) => {
that.route_file = res[0].document_!==null?res[0].document_.path:null;
})
});
},
getPreocess(){
let that = this;
that.$API.mtm.process.list.req({page:0,parent:that.process}).then((res) => {
that.processOptions = res;
if(res.length>0){
that.paramsMuser.mlog = that.mlogId;
that.apiObjMuser = that.$API.wpm.mloguser.list;
}
})
},
getShift(){
let that = this;
that.$API.mtm.shift.list.req({ page: 0 }).then((res) => {
that.shiftOtions = res;
});
},
// getdefects(qct){
// let that = this;
// if(qct!==''&&qct!==null){//输出
// that.$API.qm.qct.item.req(qct).then((res) => {
// that.qct_defects = [];
// that.testdefectss(res);
// })
// }else{
// that.$API.qm.qct.getQct.req({ material: that.mlogItem.material_out,type:'out',tag:'process' }).then((res) => {
// that.testdefectss(res);
// }).catch(()=>{
// // that.getList();
// })
// }
// },
// testdefectss(res){
// let that = this;
// res.qct_defects.forEach((item) => {
// that.addTemplate[item.defect_name] = false;
// let obj = Object.assign({}, item);
// that.qct_defects.push(obj);
// })
// that.qct_defects_origin = that.qct_defects;
// that.qct_testitems = [];
// res.qct_testitems.forEach((item2) => {
// if(item2.testitem_type!=='20'){
// let obj2 = Object.assign({}, item2);
// obj2.value = '';
// obj2.addto_wpr = item2.addto_wpr;
// if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){
// obj2.value = null;
// that.addTemplate[item2.testitem_name] = null;
// }
// if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){
// let str = obj2.testitem_choices.replace(/'/g, '"');
// let arr = JSON.parse(str);
// obj2.testitem_choices = arr;
// that.addTemplate[item2.testitem_name] = null;
// }
// that.qct_testitems.push(obj2);
// }
// })
// that.qct_testitems_origin = that.qct_testitems;
// // that.getList();
// },
//获取生产工序的mlogbw
getMlogbw(){
let that = this;
let params = {};
that.mlogbwlist = [];
params.page = 0;
params.type = 'out';
params.mlogb__mlog = that.mlogId;
that.$API.wpm.mlogbw.list.req(params).then((res) => {
if(res.length>0){
res.forEach((item) => {
let obj = {};
obj = Object.assign({},item);
obj.isEdit = false;
if(item.ftest!=null){
if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){
item.ftest.ftestdefects.forEach((item1) => {
obj[item1.defect_name] = item1.has;
})
}
if(item.ftest.ftestitems!==undefined&&item.ftest.ftestitems!==''&&item.ftest.ftestitems!==null&&item.ftest.ftestitems.length>0){
item.ftest.ftestitems.forEach((item2) => {
obj[item2.testitem_name] = item2.test_val_json;
})
}
}else{
that.qct_defects.forEach((item1) => {
obj[item1.defect_name] = false;
})
that.qct_testitems.forEach((item2) => {
obj[item2.testitem_name] = null;
})
}
that.mlogbwlist.push(obj);
})
}
})
},
//输出编辑
formTableEdit(row) {
let that = this;
that.mlogbwlist.forEach((item, index) => {
if (item.id == row.id) {
that.mlogbwlist[index].isEdit = true;
let date = new Date();
if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){
that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss');
}
}
});
},
//输出保存
formTableSave(row) {
let that = this;
let obj = {};
obj.number = row.number;
obj.mlogb = row.mlogb;
obj.wpr = row.wpr;
obj.note = row.note;
//qct不为空有检验表
if(that.qct!==''&&that.qct!==null){
that.qct_defects_origin.forEach(item => {
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'row.\$1')
let judge = eval(str);
row[item.defect_name] = judge;
}
});
obj.ftest = {};
obj.ftest.ftestitems = [];
obj.ftest.ftestdefects = [];
obj.ftest.qct = that.qct;
obj.ftest.test_date = that.handle_date!=null?that.handle_date:that.currentDate;
obj.ftest.test_user = that.handle_user;
if(that.qct_defects.length>0){
that.qct_defects.forEach((item) => {
let itemObj = {};
itemObj.defect = item.defect;
itemObj.test_user = that.handle_user;
itemObj.has = row[item.defect_name]?row[item.defect_name]:false;
obj.ftest.ftestdefects.push(itemObj);
})
}
if(that.qct_testitems.length>0){
that.qct_testitems.forEach((item1) => {
let itemObj1 = {};
itemObj1.testitem = item1.testitem;
itemObj1.test_user = that.handle_user;
itemObj1.addto_wpr = item1.addto_wpr;
itemObj1.test_val_json = row[item1.testitem_name];
obj.ftest.ftestitems.push(itemObj1);
})
}
}else{
obj.ftest = null;
}
if(row.id!==''&&row.id!==undefined&&row.id!==null){
obj.id = row.id;
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
that.$message.success("保存成功");
that.getMlogbw();
return res;
}).catch((err) => {
return err;
});
}else{
that.$API.wpm.mlogbw.create.req(obj).then((res) => {
that.$message.success("添加成功");
that.getMlogbw();
return res;
}).catch((err) => {
return err;
});
}
},
//输出取消编辑
formTableCancel(row){
this.mlogbwlist.forEach((item, index) => {
if (item.id == row.id) {
this.mlogbwlist[index].isEdit = false;
}
});
},
formTableDelet(row){
this.mlogbwlist.pop();
},
//删除
formTableDel(id) {
let that = this;
that.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
that.$API.wpm.mlogbw.delete.req(id).then((res) => {
// that.getList();
that.$message.success("删除成功");
}).catch((err) => {
return err;
});
}).catch(() => {});
},
//表单注入数据
setData(data) {
Object.assign(this.form, data);
// this.getRoute(data.id);
},
showFile(){
this.fileVisible = true;
},
//编辑
mlogUpdate() {
this.dialog.edit = true;
this.$nextTick(() => {
this.$refs.editDialog.open("edit",'rework').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;
},
//提交自检
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();
if(that.mlogItem.material_out_&&that.mlogItem.material_out_.tracking==10){
that.$refs.tableOut.refresh();
}else{
that.$refs.checkTable.refreshfun();
}
//删除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){
let that = this;
that.mlogb = row.id;
that.wm = row.wm_in;
that.batchNumber = row.batch;
that.material_in = row.material_in;
that.material_out = row.material_out;
that.handle_date=that.mlogItem.handle_date;
that.handle_user = that.mlogItem.handle_user;
that.dialog.check_single = true;
that.qct = row.qct;
that.$nextTick(() => {
that.$refs.checkDialogSingle.open(type,that.qct);
});
},
//表单提交方法
mlogSubmit() {
let that = this;
that.isSaveing = true;
that.$API.wpm.mlog.submit.req(that.mlogItem.id).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
}).catch(() => {
that.isSaveing = false;
});
},
table_muser_add(){
let that = this;
let userInfo = that.$TOOL.data.get("USER_INFO");
that.muserForm.mlog = that.mlogItem.id;
that.muserForm.handle_user = userInfo.id;
that.muserForm.handle_user_name = userInfo.name;
that.muserForm.handle_date = this.$TOOL.dateFormat2(new Date());
that.saveMuserDialog = true;
},
saveMuserSubmit (){
let that = this;
that.isSaveing = true;
that.$API.wpm.mloguser.create.req(that.muserForm).then((res) => {
that.isSaveing = false;
that.saveMuserDialog = false;
that.$message.success("操作成功");
that.$refs.tableMuser.refresh();
}).catch(() => {
that.isSaveing = false;
})
},
table_muser_del(row){
let that = this;
that.$confirm("确定删除吗?").then(res=>{
that.$API.wpm.mloguser.delete.req(row.id).then((res) => {
that.$message.success("删除成功");
that.$refs.tableMuser.refresh();
})
})
},
handleSaveSuccess() {
this.$refs.tableIn.refresh();
if(this.mlogItem.material_out_&&this.mlogItem.material_out_.tracking==10){
this.$refs.tableOut.refresh();
}else{
this.$refs.checkTable.refreshfun();
}
},
handleCheckSuccess() {
this.$refs.tableOut.refresh();
},
handlesCheckSuccess(){
this.$refs.tableIn.refresh();
this.$refs.tableOut.refresh();
},
fileUPSuccess(res) {
let that = this;
console.log('res',res);
this.test_file = res.path;
},
saveMlogbInClose(){
this.dialog.save = false;
this.$refs.tableIn.refresh();
if(this.mlogItem.material_out_&&this.mlogItem.material_out_.tracking==10){
this.$refs.tableOut.refresh();
}else{
this.$refs.checkTable.refreshfun();
}
},
//编辑成功后的方法调用
handleEditSuccess() {
this.getMlogItem();
},
//设置过滤项
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
scheckClose(){
this.dialog.check_single = false;
this.$refs.tableIn.refresh();
if(this.mlogItem.material_out_&&this.mlogItem.material_out_.tracking==10){
this.$refs.tableOut.refresh();
}else{
this.$refs.checkTable.refreshfun();
}
},
checkDialogClose(){
this.dialog.check = false;
this.$refs.tableIn.refresh();
this.$refs.tableOut.refresh();
},
handlePrint(){
let that = this;
that.printVisible = true;
},
//打印物料标签
printMaterial(row){
let that = this;
that.apiObjPrint.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,
"WINTEXT 280,550,28,90,0,0,Simhei," +"数量:" + row.count,
"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 scoped>
.file_show{
position: absolute;
width: 100%;
height: 100%;
top: 0;
background: rgb(255,255,255);
z-index: 999;
}
.warningText{
position: absolute;
left: 200px;
top: 5px;
font-size: 16px;
line-height:35px;
color: red;
font-weight: 600;
}
</style>