222 lines
6.2 KiB
Vue
222 lines
6.2 KiB
Vue
<template>
|
|
<!-- 各工序操作 -->
|
|
<view class="common-box">
|
|
<uni-card>
|
|
<u-text size="18" :text="`工序名称:` + processName"></u-text>
|
|
<ScanInput @scanConfirm="scanConfirm" placeholder="请扫标签"></ScanInput>
|
|
</uni-card>
|
|
|
|
<!-- 工单信息 -->
|
|
<uni-card v-if="formData.workorder">
|
|
<u-form labelPosition="left" ref="uForm" labelWidth="100">
|
|
<u-form-item label="工单号" borderBottom>
|
|
<u-text :text="formData.workorder" type="primary" bold size="18"></u-text>
|
|
</u-form-item>
|
|
<u-form-item label="主体型号" borderBottom>
|
|
<u-input readonly v-model="formData.productionCode" border="none"></u-input>
|
|
</u-form-item>
|
|
<u-form-item label="主体品名" borderBottom>
|
|
<u-input readonly v-model="formData.productionName" border="none"></u-input>
|
|
</u-form-item>
|
|
<u-form-item label="主体图号" borderBottom>
|
|
<u-input readonly v-model="formData.drawingCode" border="none">
|
|
<template slot="suffix">
|
|
<u-button type="primary" @click="uOverlay.show = true" size="mini">展示</u-button>
|
|
</template>
|
|
</u-input>
|
|
</u-form-item>
|
|
<u-form-item label="炉号" borderBottom>
|
|
<u-input readonly v-model="formData.stoveCode" border="none"></u-input>
|
|
</u-form-item>
|
|
<!-- <u-form-item label="前工序数量" borderBottom>
|
|
<u-input readonly v-model="formData.planNum" border="none"></u-input>
|
|
</u-form-item> -->
|
|
<u-form-item label="完成数量" :borderBottom="false">
|
|
<u--input class="input-border" v-model.number="formData.finishNum" type="number"></u--input>
|
|
</u-form-item>
|
|
<u-form-item label="不良数量" :borderBottom="false">
|
|
<u--input class="input-border" v-model.number="formData.badNum" type="number"></u--input>
|
|
</u-form-item>
|
|
<!-- <u-form-item label="完成人" :borderBottom="false">
|
|
<u--input class="input-border" v-model="formData.worker"></u--input>
|
|
</u-form-item> -->
|
|
</u-form>
|
|
</uni-card>
|
|
<!-- 底部按钮 -->
|
|
<view class="bottom-box" v-if="formData.workorder">
|
|
<u-button type="success" @click="submit">确认报工</u-button>
|
|
</view>
|
|
<!-- 图片展示 -->
|
|
<u-overlay :show="uOverlay.show" @click="uOverlay.show = false">
|
|
<view class="warp">
|
|
<img :src="uOverlay.imageUrl + formData.drawingCode" alt="图片" />
|
|
</view>
|
|
</u-overlay>
|
|
|
|
<!-- 消息提示 -->
|
|
<u-modal :show="uModal.show" :title="uModal.title" :content="uModal.content" @confirm="closeModal"></u-modal>
|
|
<!-- 消息确认 -->
|
|
<u-modal :show="uModal2.show" :title="uModal2.title" showCancelButton :content="uModal2.content" @cancel="uModal2.show = false" @confirm="modalConfirm"></u-modal>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import * as reportWorkOrderApi from '@/api/reportFlow/index.js';
|
|
export default {
|
|
onLoad: function (option) {
|
|
this.processId = option.processId;
|
|
this.processName = option.processName;
|
|
},
|
|
data() {
|
|
return {
|
|
processId: -1,
|
|
processName: '',
|
|
|
|
lineCode: '',
|
|
groupCode: '',
|
|
loading: false,
|
|
formData: {
|
|
id: null,
|
|
workorder: '',
|
|
// productionName: '产品名称',
|
|
// productionCode: '产品编码',
|
|
// unit: '单位',
|
|
planNum: 0,
|
|
finishNum: 0,
|
|
badNum: 0,
|
|
worker: '',
|
|
jobDate: ''
|
|
// sort: '排序',
|
|
// workorderDate: '工单日期',
|
|
// priority: '优先级',
|
|
// beat: '节拍',
|
|
// status: '状态',
|
|
// instructionDate: '指导日期',
|
|
// materialName: '材料名称',
|
|
// materialtextureCode: '材质编码',
|
|
// materialCode: '材料编码',
|
|
// drawingCode: '图纸编码',
|
|
// version: '版本',
|
|
// stoveCode: '炉子编码',
|
|
// workshopCode: '车间编码',
|
|
// routeCode: '路线编码',
|
|
// groupCode: '组编码',
|
|
},
|
|
uModal: {
|
|
show: false,
|
|
title: '提示',
|
|
content: ''
|
|
},
|
|
uModal2: {
|
|
show: false,
|
|
title: '提示',
|
|
content: ''
|
|
},
|
|
uOverlay: {
|
|
show: false,
|
|
imageUrl: ''
|
|
}
|
|
};
|
|
},
|
|
methods: {
|
|
// 扫工单码结果
|
|
async scanConfirm(val) {
|
|
const params = {
|
|
workorder: val,
|
|
processId: this.processId
|
|
};
|
|
|
|
const res1 = await reportWorkOrderApi.GetWorkOrderDetail(params);
|
|
if (res1.code === 200) {
|
|
if(!res1.data){
|
|
this.uModal.content = '工单号不存在!';
|
|
this.openModal();
|
|
this.clear();
|
|
return;
|
|
}
|
|
this.formData = res1.data;
|
|
}
|
|
const res2 = await reportWorkOrderApi.GetProcessReportWorkDetail(params);
|
|
if (res2.code === 200) {
|
|
if (!res2.data) {
|
|
this.formData.finishNum = 0;
|
|
this.formData.badNum = 0;
|
|
this.formData.worker = '';
|
|
} else {
|
|
this.formData.finishNum = res2.data.finishNum;
|
|
this.formData.badNum = res2.data.badNum;
|
|
this.formData.worker = res2.data.worker;
|
|
if (this.formData.finishNum > 0) {
|
|
this.uModal.title = '报工提醒';
|
|
this.uModal.content = '此工序该工单已报工过!';
|
|
this.openModal();
|
|
}
|
|
}
|
|
}
|
|
},
|
|
// 清空form
|
|
clear() {
|
|
this.formData = {
|
|
id: -1,
|
|
workorder: '',
|
|
planNum: 0,
|
|
finishNum: 0,
|
|
badNum: 0
|
|
};
|
|
},
|
|
openModal() {
|
|
this.uModal.show = true;
|
|
},
|
|
closeModal() {
|
|
this.uModal.show = false;
|
|
},
|
|
submit() {
|
|
// if (!this.check()) {
|
|
// return;
|
|
// }
|
|
this.uModal2.content = '是否确认报工';
|
|
this.uModal2.show = true;
|
|
},
|
|
check() {
|
|
try {
|
|
const _planNum = this.formData.planNum * 1;
|
|
const _finishNum = this.formData.finishNum * 1;
|
|
const _badNum = this.formData.badNum * 1;
|
|
if (_planNum !== _finishNum + _badNum) {
|
|
this.uModal.title = '报工填写异常';
|
|
this.uModal.content = '前工序数量不等于完成数量加不良数量,请检查!';
|
|
this.openModal();
|
|
return false;
|
|
}
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
},
|
|
modalConfirm() {
|
|
const params = {
|
|
workorder: this.formData.workorder,
|
|
processId: this.processId,
|
|
finish_num: this.formData.finishNum,
|
|
bad_num: this.formData.badNum,
|
|
worker: this.formData.worker
|
|
};
|
|
reportWorkOrderApi.ProcessReportWork(params).then((res) => {
|
|
if (res.code === 200) {
|
|
this.uModal2.show = false;
|
|
this.uModal.content = '报工成功!';
|
|
this.openModal();
|
|
this.clear();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.input-border {
|
|
border: 1px solid #eeeeee;
|
|
}
|
|
</style>
|