init project
This commit is contained in:
344
pages/mes/jobReport/defect.vue
Normal file
344
pages/mes/jobReport/defect.vue
Normal file
@@ -0,0 +1,344 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
|
||||
<uni-easyinput disabled type="text" v-model="formData.machineId" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
|
||||
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
|
||||
<uni-easyinput type="number" v-model="formData.timeTake" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
|
||||
<uni-easyinput disabled type="text" v-model="formData.type" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
|
||||
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum"
|
||||
v-model="formData.reportNumber" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="不良原因" :labelWidth='80' name="reason">
|
||||
<uni-data-select v-model="formData.reason" :localdata="reasonOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
|
||||
v-model="formData.createByCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
|
||||
<uni-easyinput disabled type="text" v-model="formData.createByName" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="是否录入件号" :labelWidth='120'>
|
||||
<uni-data-checkbox v-model="radio" :localdata="pieceIn"></uni-data-checkbox>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<view v-show="radio==1">
|
||||
<uni-forms-item label="件号" :labelWidth='80' name="pieceNo">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPieceNo" type="text"
|
||||
v-model="formData.pieceNo" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="开工时间" :labelWidth='90'>
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addReportEnterPiece
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
// 获取当前时间
|
||||
var currentDate = new Date();
|
||||
// 格式化为字符串(YYYY-MM-DD HH:mm:ss)
|
||||
var year = currentDate.getFullYear();
|
||||
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
|
||||
var day = ("0" + currentDate.getDate()).slice(-2);
|
||||
var hours = ("0" + currentDate.getHours()).slice(-2);
|
||||
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
|
||||
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
|
||||
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
|
||||
// 将当前时间赋值给 formData.endTime
|
||||
this.formData.endTime = formattedDate;
|
||||
this.formData.way = '人工报工';
|
||||
this.formData.type = '不良品';
|
||||
if (option) {
|
||||
this.formData = JSON.parse(decodeURIComponent(option.formData));
|
||||
this.isPwoRoute = true;
|
||||
}
|
||||
getDicts("mes_job_report_defect").then(res => {
|
||||
this.reasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictValue,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
// this.formData.createByName = this.$store.state.user.name;
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isPwoRoute: false,
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
pwoCode: null,
|
||||
ptNoTar: null,
|
||||
ptTitleTar: null,
|
||||
machineId: null,
|
||||
batchNo: null,
|
||||
createByName: null,
|
||||
createByCode: null,
|
||||
pieceNo: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
reportableNum: 0,
|
||||
radio: 0,
|
||||
pieceIn: [{
|
||||
text: '是',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
value: 0
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}]
|
||||
},
|
||||
createByCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产员工编码!'
|
||||
}]
|
||||
},
|
||||
reportNumber: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入报工数量!'
|
||||
}]
|
||||
},
|
||||
reason: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入不良原因!'
|
||||
}]
|
||||
},
|
||||
endTime: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入完工时间!'
|
||||
}]
|
||||
},
|
||||
// machineId: {
|
||||
// rules: [
|
||||
// { required: true, errorMessage:'请输入设备编码!' }
|
||||
// ]
|
||||
// },
|
||||
},
|
||||
reasonOptions: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
//判断是否选择录入件号
|
||||
if (this.radio == 1) {
|
||||
//判断是否输入件号
|
||||
if (this.formData.pieceNo && this.formData.pieceNo != "") {
|
||||
this.$modal.loading('提交中')
|
||||
addReportEnterPiece(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入件号!");
|
||||
}
|
||||
} else {
|
||||
this.$modal.loading('提交中')
|
||||
addReport(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.pwoJobCode) {
|
||||
listPwoJob({
|
||||
code: this.formData.pwoJobCode
|
||||
}).then(async res => {
|
||||
let jobs = res.rows;
|
||||
if (jobs.length == 0) {
|
||||
this.$modal.msg("未检索到该作业编码相关的信息!");
|
||||
} else {
|
||||
let job = jobs[0];
|
||||
this.formData.pwoCode = job.pwoCode;
|
||||
this.formData.ptNoTar = job.ptNoTar;
|
||||
this.formData.ptTitleTar = job.ptTitleTar;
|
||||
this.formData.opCode = job.opCode;
|
||||
this.formData.opTitle = job.opTitle;
|
||||
this.reportableNum = job.targetNum - job.finishQty;
|
||||
if (job.eqpId) {
|
||||
await getEquipment(job.eqpId).then(res => {
|
||||
this.formData.machineId = res.data.equipmentCode;
|
||||
})
|
||||
//调取最后一条转入记录的操作人
|
||||
let code = {
|
||||
powJobCode: this.formData.pwoJobCode
|
||||
}
|
||||
listConversion(code).then(async res => {
|
||||
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
|
||||
this.formData.createByName = res.rows[0].operateBy;
|
||||
let arry = {
|
||||
name: this.formData.createByName
|
||||
}
|
||||
listEmployee(arry).then(async res => {
|
||||
|
||||
this.formData.createByCode = res.rows[0]
|
||||
.empCode;
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
this.formData.batchNo = job.batchNo;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
scanBarCreateBy() {
|
||||
if (this.formData.createByCode) {
|
||||
let obj = {
|
||||
empCode: this.formData.createByCode
|
||||
}
|
||||
listEmployee(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.createByName = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员信息!");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoJobCode = res.result;
|
||||
_this.scanBarCode(_this.formData.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.createByCode = res.result;
|
||||
_this.scanBarCreateBy();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarPieceNo() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pieceNo = res.result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
81
pages/mes/jobReport/index.vue
Normal file
81
pages/mes/jobReport/index.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<view class="uni-padding-wrap uni-common-mt" >
|
||||
|
||||
<view class="grid-body">
|
||||
<uni-grid :column="3" :showBorder="false" @change="changeGrid1">
|
||||
<uni-grid-item :index="1" style="line-height: 100px;margin-top:100px;margin-left:37.5%;width: 100%;">
|
||||
<view class="grid-item-box">
|
||||
<uni-icons custom-prefix="iconfont" type="icon-tongguo" size="30"></uni-icons>
|
||||
<text class="text">合格品报工</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
<uni-grid-item :index="2" style="line-height: 100px;margin-left:37.5%;width: 100%;">
|
||||
<view class="grid-item-box">
|
||||
<uni-icons custom-prefix="iconfont" type="icon-shenhebutongguo" size="30"></uni-icons>
|
||||
<text class="text">不良品报工</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
<uni-grid-item :index="3" style="line-height: 100px;margin-left:37.5%;width: 100%;">
|
||||
<view class="grid-item-box">
|
||||
<uni-icons custom-prefix="iconfont" type="icon-tubiaozhizuomoban-134" size="30"></uni-icons>
|
||||
<text class="text">报废品报工</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
</uni-grid>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <u-button type="primary" @click="$tab.navigateTo('/pages/mes/jobReport/pass')">合格品报工</u-button>
|
||||
|
||||
<u-button style="margin-top:100px; background-color:#ffff00;" @click="$tab.navigateTo('/pages/mes/jobReport/defect')">不良品报工</u-button>
|
||||
|
||||
<u-button style="margin-top:100px;;" type="warn" @click="$tab.navigateTo('/pages/mes/jobReport/scrap')">报废品报工</u-button>
|
||||
</view> -->
|
||||
<!-- </view> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onLoad: function() {
|
||||
},
|
||||
methods: {
|
||||
changeGrid1(e) {
|
||||
console.log(e.detail.index);
|
||||
if (e.detail.index == 1) {
|
||||
this.$tab.navigateTo('/pages/mes/jobReport/pass');
|
||||
} else if (e.detail.index == 2) {
|
||||
this.$tab.navigateTo('/pages/mes/jobReport/defect');
|
||||
} else if (e.detail.index == 3) {
|
||||
this.$tab.navigateTo('/pages/mes/jobReport/scrap');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 200rpx;
|
||||
width: 200rpx;
|
||||
margin-top: 200rpx;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.text-area {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
color: #8f8f94;
|
||||
}
|
||||
</style>
|
||||
324
pages/mes/jobReport/loss.vue
Normal file
324
pages/mes/jobReport/loss.vue
Normal file
@@ -0,0 +1,324 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
|
||||
<uni-easyinput disabled type="text" v-model="formData.machineId" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
|
||||
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
|
||||
<uni-easyinput disabled disabled type="text" v-model="formData.opTitle" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
|
||||
<uni-easyinput type="number" v-model="formData.timeTake" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
|
||||
<uni-easyinput disabled disabled type="text" v-model="formData.type" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
|
||||
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum"
|
||||
v-model="formData.reportNumber" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="损耗原因" :labelWidth='80' name="reason">
|
||||
<uni-data-select v-model="formData.reason" :localdata="reasonOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
|
||||
v-model="formData.createByCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
|
||||
<uni-easyinput disabled type="text" v-model="formData.createByName" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="开工时间" :labelWidth='90'>
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addReportEnterPiece
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
// 获取当前时间
|
||||
var currentDate = new Date();
|
||||
// 格式化为字符串(YYYY-MM-DD HH:mm:ss)
|
||||
var year = currentDate.getFullYear();
|
||||
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
|
||||
var day = ("0" + currentDate.getDate()).slice(-2);
|
||||
var hours = ("0" + currentDate.getHours()).slice(-2);
|
||||
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
|
||||
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
|
||||
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
// 将当前时间赋值给 formData.endTime
|
||||
this.formData.endTime = formattedDate;
|
||||
this.formData.way = '人工报工';
|
||||
this.formData.type = '损耗';
|
||||
if (option) {
|
||||
this.formData = JSON.parse(decodeURIComponent(option.formData));
|
||||
this.isPwoRoute = true;
|
||||
}
|
||||
getDicts("mes_job_report_loss").then(res => {
|
||||
this.reasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictValue,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
// this.formData.createByName = this.$store.state.user.name;
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isPwoRoute: false,
|
||||
reasonOptions: [],
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
pwoCode: null,
|
||||
ptNoTar: null,
|
||||
ptTitleTar: null,
|
||||
machineId: null,
|
||||
batchNo: null,
|
||||
createByName: null,
|
||||
createByCode: null,
|
||||
pieceNo: null,
|
||||
},
|
||||
radio: 0,
|
||||
reportableNum: 0,
|
||||
pieceIn: [{
|
||||
text: '是',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
value: 0
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}]
|
||||
},
|
||||
createByCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产员工编码!'
|
||||
}]
|
||||
},
|
||||
reportNumber: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入报工数量!'
|
||||
}]
|
||||
},
|
||||
reason: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入不良原因!'
|
||||
}]
|
||||
},
|
||||
endTime: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入完工时间!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
//判断是否选择录入件号
|
||||
if (this.radio == 1) {
|
||||
//判断是否输入件号
|
||||
if (this.formData.pieceNo && this.formData.pieceNo != "") {
|
||||
this.$modal.loading('提交中')
|
||||
addReportEnterPiece(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入件号!");
|
||||
}
|
||||
} else {
|
||||
this.$modal.loading('提交中')
|
||||
addReport(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.pwoJobCode) {
|
||||
let obj = {
|
||||
code: this.formData.pwoJobCode
|
||||
}
|
||||
listPwoJob(obj).then(async res => {
|
||||
let jobs = res.rows;
|
||||
if (jobs.length == 0) {
|
||||
this.$modal.msg("未检索到该作业编码相关的信息!");
|
||||
} else {
|
||||
let job = jobs[0];
|
||||
this.formData.pwoCode = job.pwoCode;
|
||||
this.formData.ptNoTar = job.ptNoTar;
|
||||
this.formData.ptTitleTar = job.ptTitleTar;
|
||||
this.formData.opCode = job.opCode;
|
||||
this.formData.opTitle = job.opTitle;
|
||||
this.reportableNum = job.targetNum - job.finishQty;
|
||||
if (job.eqpId) {
|
||||
await getEquipment(job.eqpId).then(res => {
|
||||
this.formData.machineId = res.data.equipmentCode;
|
||||
})
|
||||
|
||||
//调取最后一条转入记录的操作人
|
||||
let code = {
|
||||
powJobCode: this.formData.pwoJobCode
|
||||
}
|
||||
listConversion(code).then(async res => {
|
||||
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
|
||||
this.formData.createByName = res.rows[0].operateBy;
|
||||
let arry = {
|
||||
name: this.formData.createByName
|
||||
}
|
||||
listEmployee(arry).then(async res => {
|
||||
this.formData.createByCode = res.rows[0]
|
||||
.empCode;
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.formData.batchNo = job.batchNo;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
scanBarCreateBy() {
|
||||
if (this.formData.createByCode) {
|
||||
let obj = {
|
||||
empCode: this.formData.createByCode
|
||||
}
|
||||
listEmployee(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.createByName = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员信息!");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoJobCode = res.result;
|
||||
_this.scanBarCode(_this.formData.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.createByCode = res.result;
|
||||
_this.scanBarCreateBy();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarPieceNo() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pieceNo = res.result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
400
pages/mes/jobReport/onceReport.vue
Normal file
400
pages/mes/jobReport/onceReport.vue
Normal file
@@ -0,0 +1,400 @@
|
||||
<template>
|
||||
<view style="background-color: #fff;">
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
|
||||
<uni-easyinput disabled type="text" v-model="formData.machineId" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
|
||||
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
|
||||
<uni-easyinput type="number" v-model="formData.timeTake" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
|
||||
v-model="formData.createByCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
|
||||
<uni-easyinput disabled type="text" v-model="formData.createByName" />
|
||||
</uni-forms-item>
|
||||
<u-divider :text="'可报工数量:'+reportableNum"></u-divider>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="合格数量" :labelWidth='70' name="pass">
|
||||
<u-number-box button-size="36" inputWidth="120"
|
||||
v-model="formData.mesJobReportOnceRequestDTO.pass.reportNumber" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="不良数量" :labelWidth='70' name="defect">
|
||||
<u-number-box button-size="36" inputWidth="120"
|
||||
v-model="formData.mesJobReportOnceRequestDTO.defect.reportNumber" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="不良原因" :labelWidth='70' name="defectReason">
|
||||
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['defect'].reason"
|
||||
:localdata="defectReasonOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报废数量" :labelWidth='70' name="scrap">
|
||||
<u-number-box button-size="36" inputWidth="120"
|
||||
v-model="formData.mesJobReportOnceRequestDTO.scrap.reportNumber" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报废原因" :labelWidth='70' name="scrapReason">
|
||||
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['scrap'].reason"
|
||||
:localdata="scrapReasonOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="损耗数量" :labelWidth='70' name="loss">
|
||||
<u-number-box button-size="36" inputWidth="120"
|
||||
v-model="formData.mesJobReportOnceRequestDTO.loss.reportNumber" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="损耗原因" :labelWidth='70' name="lossReason">
|
||||
<uni-data-select v-model="formData.mesJobReportOnceRequestDTO['loss'].reason"
|
||||
:localdata="lossReasonOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="开工时间" :labelWidth='90'>
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
<!-- <u-button type="primary" @click="end">关闭</u-button> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addReportOnce
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
// const serialPort = uni.requireNativePlugin('Fvv-UniSerialPort')
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
if (option.code) {
|
||||
this.isSearchRoute = true;
|
||||
this.formData.pwoJobCode = option.code;
|
||||
this.scanBarCode();
|
||||
}
|
||||
// 获取当前时间
|
||||
var currentDate = new Date();
|
||||
// 格式化为字符串(YYYY-MM-DD HH:mm:ss)
|
||||
var year = currentDate.getFullYear();
|
||||
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
|
||||
var day = ("0" + currentDate.getDate()).slice(-2);
|
||||
var hours = ("0" + currentDate.getHours()).slice(-2);
|
||||
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
|
||||
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
|
||||
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
// 将当前时间赋值给 formData.endTime
|
||||
this.formData.endTime = formattedDate;
|
||||
this.formData.way = '人工报工';
|
||||
this.getOptions();
|
||||
// this.formData.type = '报废品';
|
||||
// this.formData.createByName = this.$store.state.user.name;
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//判断是否从工单状态页面查询过来
|
||||
isSearchRoute: false,
|
||||
lossReasonOptions: [],
|
||||
scrapReasonOptions: [],
|
||||
defectReasonOptions: [],
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
pwoCode: null,
|
||||
ptNoTar: null,
|
||||
ptTitleTar: null,
|
||||
machineId: null,
|
||||
batchNo: null,
|
||||
createByName: null,
|
||||
createByCode: null,
|
||||
mesJobReportOnceRequestDTO: {
|
||||
pass: {
|
||||
reportNumber: 0,
|
||||
reason: null
|
||||
},
|
||||
defect: {
|
||||
reportNumber: 0,
|
||||
reason: null
|
||||
},
|
||||
scrap: {
|
||||
reportNumber: 0,
|
||||
reason: null
|
||||
},
|
||||
loss: {
|
||||
reportNumber: 0,
|
||||
reason: null
|
||||
}
|
||||
},
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
reportableNum: 0,
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}]
|
||||
},
|
||||
createByCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产员工编码!'
|
||||
}]
|
||||
},
|
||||
endTime: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入完工时间!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
created: function(option) {
|
||||
// const self = this
|
||||
// serialPort.getAllDeviceList(res => {
|
||||
// console.log('//设备列表', res)
|
||||
// })
|
||||
// serialPort.getAllDevicePath(res => {
|
||||
// console.log('//路径列表', res)
|
||||
// }),
|
||||
// setTimeout(() => {
|
||||
// serialPort.setPath('/dev/ttyUSB0')
|
||||
// serialPort.setBaudRate(9600)
|
||||
// serialPort.open(res => {
|
||||
// if (!res.status) {
|
||||
// uni.showToast({
|
||||
// title: res.msg,
|
||||
// duration: 2000,
|
||||
// icon: "none"
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
// serialPort.onMessage(rec => {
|
||||
// this.onMessage(rec);
|
||||
// }, send => {
|
||||
// console.log(send)
|
||||
// })
|
||||
// })
|
||||
// }, 10000)
|
||||
},
|
||||
methods: {
|
||||
test() {
|
||||
serialPort.sendHex("A00102A3")
|
||||
},
|
||||
end() {
|
||||
serialPort.sendHex("A00100A1")
|
||||
},
|
||||
getOptions() {
|
||||
getDicts("mes_job_report_defect").then(res => {
|
||||
this.defectReasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictValue,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
getDicts("mes_job_report_scrap").then(res => {
|
||||
this.scrapReasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictValue,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
getDicts("mes_job_report_loss").then(res => {
|
||||
this.lossReasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictValue,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
this.formData.mesJobReportOnceRequestDTO.pass.reportNumber = Number(this.formData
|
||||
.mesJobReportOnceRequestDTO.pass.reportNumber);
|
||||
this.formData.mesJobReportOnceRequestDTO.defect.reportNumber = Number(this.formData
|
||||
.mesJobReportOnceRequestDTO.defect.reportNumber);
|
||||
this.formData.mesJobReportOnceRequestDTO.scrap.reportNumber = Number(this.formData
|
||||
.mesJobReportOnceRequestDTO.scrap.reportNumber);
|
||||
console.log(this.formData);
|
||||
this.$modal.loading('提交中')
|
||||
addReportOnce(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
if (this.isSearchRoute = true) {
|
||||
setTimeout(() => {
|
||||
this.$tab.navigateBack();
|
||||
}, 500);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.pwoJobCode) {
|
||||
let obj = {
|
||||
code: this.formData.pwoJobCode
|
||||
}
|
||||
listPwoJob(obj).then(async res => {
|
||||
let jobs = res.rows;
|
||||
if (jobs.length == 0) {
|
||||
this.$modal.msg("未检索到该作业编码相关的信息!");
|
||||
} else {
|
||||
let job = jobs[0];
|
||||
console.log(job);
|
||||
this.formData.pwoCode = job.pwoCode;
|
||||
this.formData.ptNoTar = job.ptNoTar;
|
||||
this.formData.ptTitleTar = job.ptTitleTar;
|
||||
this.formData.opCode = job.opCode;
|
||||
this.formData.opTitle = job.opTitle;
|
||||
this.reportableNum = job.targetNum - job.finishQty;
|
||||
if (job.eqpId) {
|
||||
await getEquipment(job.eqpId).then(res => {
|
||||
console.log(res);
|
||||
this.formData.machineId = res.data.equipmentCode;
|
||||
})
|
||||
|
||||
//调取最后一条转入记录的操作人
|
||||
let code = {
|
||||
powJobCode: this.formData.pwoJobCode
|
||||
}
|
||||
listConversion(code).then(async res => {
|
||||
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
|
||||
this.formData.createByName = res.rows[0].operateBy;
|
||||
let arry = {
|
||||
name: this.formData.createByName
|
||||
}
|
||||
listEmployee(arry).then(async res => {
|
||||
this.formData.createByCode = res.rows[0]
|
||||
.empCode;
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.formData.batchNo = job.batchNo;
|
||||
console.log(this.formData);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
scanBarCreateBy() {
|
||||
if (this.formData.createByCode) {
|
||||
let obj = {
|
||||
empCode: this.formData.createByCode
|
||||
}
|
||||
listEmployee(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.createByName = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员信息!");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoJobCode = res.result;
|
||||
_this.scanBarCode(_this.formData.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.createByCode = res.result;
|
||||
_this.scanBarCreateBy();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
315
pages/mes/jobReport/pass.vue
Normal file
315
pages/mes/jobReport/pass.vue
Normal file
@@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
|
||||
<uni-easyinput disabled type="text" v-model="formData.machineId" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
|
||||
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opTitle" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
|
||||
<uni-easyinput type="number" v-model="formData.timeTake" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
|
||||
<uni-easyinput disabled type="text" v-model="formData.type" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
|
||||
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum"
|
||||
v-model="formData.reportNumber" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
|
||||
v-model="formData.createByCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
|
||||
<uni-easyinput disabled type="text" v-model="formData.createByName" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="是否录入件号" :labelWidth='120'>
|
||||
<uni-data-checkbox v-model="radio" :localdata="pieceIn"></uni-data-checkbox>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<view v-show="radio==1">
|
||||
<uni-forms-item label="件号" :labelWidth='80' name="pieceNo">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPieceNo" type="text"
|
||||
v-model="formData.pieceNo" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="开工时间" :labelWidth='90'>
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addReportEnterPiece
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion
|
||||
} from "@/api/mes/jobIn.js";
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
|
||||
// 获取当前时间
|
||||
var currentDate = new Date();
|
||||
// 格式化为字符串(YYYY-MM-DD HH:mm:ss)
|
||||
var year = currentDate.getFullYear();
|
||||
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
|
||||
var day = ("0" + currentDate.getDate()).slice(-2);
|
||||
var hours = ("0" + currentDate.getHours()).slice(-2);
|
||||
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
|
||||
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
|
||||
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
// 将当前时间赋值给 formData.endTime
|
||||
this.formData.endTime = formattedDate;
|
||||
this.formData.way = '人工报工';
|
||||
this.formData.type = '合格品';
|
||||
if (option) {
|
||||
this.formData = JSON.parse(decodeURIComponent(option.formData));
|
||||
this.isPwoRoute = true;
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isPwoRoute: false,
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
pwoCode: null,
|
||||
ptNoTar: null,
|
||||
ptTitleTar: null,
|
||||
machineId: null,
|
||||
batchNo: null,
|
||||
createByName: null,
|
||||
createByCode: null,
|
||||
pieceNo: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
reportableNum: 0,
|
||||
radio: 0,
|
||||
pieceIn: [{
|
||||
text: '是',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
value: 0
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}]
|
||||
},
|
||||
createByCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产员工编码!'
|
||||
}]
|
||||
},
|
||||
reportNumber: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入报工数量!'
|
||||
}]
|
||||
},
|
||||
endTime: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入完工时间!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
//判断是否选择录入件号
|
||||
if (this.radio == 1) {
|
||||
//判断是否输入件号
|
||||
if (this.formData.pieceNo && this.formData.pieceNo != "") {
|
||||
this.$modal.loading('提交中')
|
||||
addReportEnterPiece(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入件号!");
|
||||
}
|
||||
} else {
|
||||
this.$modal.loading('提交中')
|
||||
addReport(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.pwoJobCode) {
|
||||
let obj = {
|
||||
code: this.formData.pwoJobCode
|
||||
}
|
||||
listPwoJob(obj).then(async res => {
|
||||
let jobs = res.rows;
|
||||
if (jobs.length == 0) {
|
||||
this.$modal.msg("未检索到该作业编码相关的信息!");
|
||||
} else {
|
||||
let job = jobs[0];
|
||||
this.formData.pwoCode = job.pwoCode;
|
||||
this.formData.ptNoTar = job.ptNoTar;
|
||||
this.formData.ptTitleTar = job.ptTitleTar;
|
||||
this.formData.opCode = job.opCode;
|
||||
this.formData.opTitle = job.opTitle;
|
||||
this.reportableNum = job.targetNum - job.finishQty;
|
||||
if (job.eqpId) {
|
||||
await getEquipment(job.eqpId).then(res => {
|
||||
console.log(res);
|
||||
this.formData.machineId = res.data.equipmentCode;
|
||||
})
|
||||
//调取最后一条转入记录的操作人
|
||||
let code = {
|
||||
powJobCode: this.formData.pwoJobCode
|
||||
}
|
||||
listConversion(code).then(async res => {
|
||||
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
|
||||
this.formData.createByName = res.rows[0].operateBy;
|
||||
let arry = {
|
||||
name: this.formData.createByName
|
||||
}
|
||||
listEmployee(arry).then(async res => {
|
||||
this.formData.createByCode = res.rows[0]
|
||||
.empCode;
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.formData.batchNo = job.batchNo;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
scanBarCreateBy() {
|
||||
if (this.formData.createByCode) {
|
||||
let obj = {
|
||||
empCode: this.formData.createByCode
|
||||
}
|
||||
listEmployee(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.createByName = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员信息!");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoJobCode = res.result;
|
||||
_this.scanBarCode(_this.formData.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.createByCode = res.result;
|
||||
_this.scanBarCreateBy();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarPieceNo() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pieceNo = res.result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
232
pages/mes/jobReport/pipelineReport.vue
Normal file
232
pages/mes/jobReport/pipelineReport.vue
Normal file
@@ -0,0 +1,232 @@
|
||||
<template>
|
||||
<view style="background-color: #fff;">
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="开始作业编码" :labelWidth='80' name="startPwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text"
|
||||
v-model="formData.startPwoJobCode" @confirm="scanBarStartCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="结束作业编码" :labelWidth='80' name="endPwoJobCode">
|
||||
<uni-combox-re labelKey="code" valueKey="id" :candidates="endPwoJobOptions" emptyTips="无"
|
||||
@input="scanBarEndCode" v-model="formData.endPwoJobCode"></uni-combox-re>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="合格数量" :labelWidth='80' name="passNum">
|
||||
<u-number-box button-size="36" v-model="formData.passNum" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="缺陷数量" :labelWidth='80' name="defectNum">
|
||||
<u-number-box button-size="36" v-model="formData.defectNum" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="报废数量" :labelWidth='80' name="scrapNum">
|
||||
<u-number-box button-size="36" v-model="formData.scrapNum" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
|
||||
v-model="formData.createByCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
|
||||
<uni-easyinput disabled type="text" v-model="formData.createByName" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<uni-card :is-shadow="false" is-full v-for="item in jobList" :key="item.id">
|
||||
<div><strong>工单</strong>:{{item.pwoCode}}</div>
|
||||
<div><strong>作业编码</strong>:{{item.code}}</div>
|
||||
<div><strong>目标产品编码</strong>:{{item.ptNoTar}}</div>
|
||||
<div><strong>目标产品名称</strong>:{{item.ptTitleTar}}</div>
|
||||
<div><strong>制程名称</strong>:{{item.opTitle}}</div>
|
||||
<div><strong>目标数量</strong>:{{item.planNum}}</div>
|
||||
<div><strong>完成数量</strong>:{{item.finishQty}}</div>
|
||||
<div><strong>开工状态</strong>:
|
||||
<uni-tag :text="jobtag(item.status)" type="success"></uni-tag>
|
||||
</div>
|
||||
</uni-card>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addPipelineReport
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
import uniComboxRe from "../../../uni_modules/uni-combox/components/uni-combox/uni-combox-re.vue"
|
||||
export default {
|
||||
components: {
|
||||
uniComboxRe
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
startPwoJobCode: null,
|
||||
endPwoJobCode: null,
|
||||
startPwoJobId: null,
|
||||
endPwoJobId: null,
|
||||
passNum: 0,
|
||||
defectNum: 0,
|
||||
scrapNum: 0,
|
||||
createByName: null,
|
||||
createByCode: null
|
||||
},
|
||||
endPwoJobOptions: [],
|
||||
pwojobList: [],
|
||||
jobList: [],
|
||||
rules: {
|
||||
startPwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入开始作业编码!'
|
||||
}]
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
listPwoJob().then((response) => {
|
||||
this.pwojobList = response.rows;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
scanBarCreateBy() {
|
||||
if (this.formData.createByCode) {
|
||||
let obj = {
|
||||
empCode: this.formData.createByCode
|
||||
}
|
||||
listEmployee(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.createByName = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员信息!");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.createByCode = res.result;
|
||||
_this.scanBarCreateBy();
|
||||
}
|
||||
});
|
||||
},
|
||||
jobtag(status) {
|
||||
switch (Number(status)) {
|
||||
case 1:
|
||||
return '计划中';
|
||||
break;
|
||||
case 2:
|
||||
return '材料转入';
|
||||
break;
|
||||
case 3:
|
||||
return '作业开工';
|
||||
break;
|
||||
case 4:
|
||||
return '作业暂停';
|
||||
break;
|
||||
case 5:
|
||||
return '作业完工';
|
||||
break;
|
||||
case 6:
|
||||
return '完成品转出';
|
||||
break;
|
||||
case 7:
|
||||
return '取消';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
if (this.jobList.length == 0) {
|
||||
this.$modal.mesError("没有选择作业!");
|
||||
} else {
|
||||
this.$modal.loading('提交中')
|
||||
addPipelineReport(this.formData).then((resp) => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
scanBarStartCode() {
|
||||
this.endPwoJobOptions = [];
|
||||
this.jobList = [];
|
||||
|
||||
listPwoJob({
|
||||
code: this.formData.startPwoJobCode
|
||||
}).then((response) => {
|
||||
if (response.total > 0) {
|
||||
//开始作业的工单id
|
||||
var pwoId = response.rows[0].pwoId;
|
||||
//开始作业id
|
||||
let id = this.formData.startPwoJobId = response.rows[0].id;
|
||||
for (let item of this.pwojobList) {
|
||||
if (pwoId == item.pwoId && id > item.id) {
|
||||
this.endPwoJobOptions.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
//选择结束作业后表单自动填充作业信息
|
||||
scanBarEndCode(e) {
|
||||
var startJobId = this.formData.startPwoJobId;
|
||||
this.formData.endPwoJobId = e;
|
||||
this.jobList = [];
|
||||
if (startJobId == null || e == null || e == "") {
|
||||
this.jobList = [];
|
||||
return;
|
||||
}
|
||||
for (let item of this.pwojobList) {
|
||||
if (item.id <= startJobId && item.id >= e) {
|
||||
this.jobList.push(item);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.startPwoJobCode = res.result;
|
||||
_this.scanBarStartCode(_this.formData.startPwoJobCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
240
pages/mes/jobReport/pwoReport.vue
Normal file
240
pages/mes/jobReport/pwoReport.vue
Normal file
@@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pwoCode"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="开始作业" :labelWidth='80' name="startPwoJobCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.startPwoJobCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="结束作业" :labelWidth='80' name="endPwoJobCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.endPwoJobCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="操作员" :labelWidth='80' name="operator">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarOperator" type="text"
|
||||
v-model="formData.operator" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-collapse-item title="工单报工列表" :open="true">
|
||||
<!-- <u-button type="primary" @click="addDetail">新增</u-button>
|
||||
<u-button type="primary" @click="submit">确认</u-button> -->
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :key="index" v-for="(item, index) in jobList"
|
||||
@click="(data) => clickDetail(index,data)" @change="swipChange">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="作业编码" :labelWidth='90' :name="'jobList.'+ index +'.code'">
|
||||
<uni-easyinput type="text" v-model="item.code"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标产品编码" :labelWidth='90' :name="'jobList.'+ index +'.ptNoTar'">
|
||||
<uni-easyinput type="text" v-model="item.ptNoTar"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标产品名称" :labelWidth='90'
|
||||
:name="'jobList.'+ index +'.ptTitleTar'">
|
||||
<uni-easyinput type="text" v-model="item.ptTitleTar"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="制程名称" :labelWidth='90' :name="'jobList.'+ index +'.opTitle'">
|
||||
<uni-easyinput type="text" v-model="item.opTitle"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标数量" :labelWidth='90' :name="'jobList.'+ index +'.planNum'">
|
||||
<uni-easyinput type="text" v-model="item.planNum"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="完成数量" :labelWidth='90' :name="'jobList.'+ index +'.finishQty'">
|
||||
<uni-easyinput type="text" v-model="item.finishQty"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="合格数量" :labelWidth='80' name="passNum">
|
||||
<u-number-box inputWidth="120" button-size="36" v-model="formData.passNum"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="不良数量" :labelWidth='80' name="defectNum">
|
||||
<u-number-box inputWidth="120" button-size="36" v-model="formData.defectNum"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报废数量" :labelWidth='80' name="scrapNum">
|
||||
<u-number-box inputWidth="120" button-size="36" v-model="formData.scrapNum"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<!-- <uni-table ref="table" border stripe emptyText="暂无更多数据">
|
||||
<uni-tr>
|
||||
<uni-th width="100" align="center">作业编码</uni-th>
|
||||
<uni-th width="150" align="center">产品编码</uni-th>
|
||||
<uni-th width="50" align="center">数量</uni-th>
|
||||
</uni-tr>
|
||||
<uni-tr v-for="(item, index) in jobList" :key="index">
|
||||
<uni-td align="center">{{ item.code }}</uni-td>
|
||||
<uni-td align="center">{{ item.ptNoTar }}</uni-td>
|
||||
<uni-td align="center">{{ item.planNum }}</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table> -->
|
||||
|
||||
</uni-collapse>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addReportOnce,
|
||||
pwoReport
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion
|
||||
} from "@/api/mes/jobIn.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
pwoCode: null,
|
||||
startPwoJobId: null,
|
||||
startPwoJobCode: null,
|
||||
endPwoJobId: null,
|
||||
endPwoJobCode: null,
|
||||
operator: null,
|
||||
passNum: 0,
|
||||
defectNum: 0,
|
||||
scrapNum: 0,
|
||||
},
|
||||
jobList: [],
|
||||
rules: {
|
||||
pwoCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入工单!'
|
||||
}]
|
||||
},
|
||||
operator: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入操作员工编码!'
|
||||
}]
|
||||
},
|
||||
passNum: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入合格数量!'
|
||||
}]
|
||||
},
|
||||
defectNum: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入不良数量!'
|
||||
}]
|
||||
},
|
||||
scrapNum: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入报废数量!'
|
||||
}]
|
||||
}
|
||||
// machineId: {
|
||||
// rules: [
|
||||
// { required: true, errorMessage:'请输入设备编码!' }
|
||||
// ]
|
||||
// },
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
if (this.jobList.length == 0) {
|
||||
this.$modal.mesError("没有作业可报工!");
|
||||
} else {
|
||||
//员工
|
||||
let emp = {
|
||||
empCode: this.formData.operator
|
||||
}
|
||||
listEmployee(emp).then(res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.operator = res.rows[0].id;
|
||||
}
|
||||
this.$modal.loading('提交中')
|
||||
pwoReport(this.formData).then(resp => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.pwoCode) {
|
||||
var queryParams = {
|
||||
pwoCode: this.formData.pwoCode,
|
||||
};
|
||||
listPwoJob(queryParams).then(response => {
|
||||
// this.pwoJobOptionsDraft = response.rows;
|
||||
console.log(response);
|
||||
let total = response.total;
|
||||
if (total != 0) {
|
||||
this.jobList = response.rows;
|
||||
//编码用于前端显示
|
||||
this.formData.startPwoJobCode = this.jobList[0].code;
|
||||
this.formData.endPwoJobCode = this.jobList[total - 1].code;
|
||||
//id用于提交时传回给后端
|
||||
this.formData.startPwoJobId = this.jobList[0].id;
|
||||
this.formData.endPwoJobId = this.jobList[total - 1].id;
|
||||
console.log(this.formData);
|
||||
} else {
|
||||
this.jobList = response.rows;
|
||||
//编码用于前端显示
|
||||
this.formData.startPwoJobCode = "";
|
||||
this.formData.endPwoJobCode = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoCode = res.result;
|
||||
_this.scanBarCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarOperator() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.operator = res.result;
|
||||
_
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
347
pages/mes/jobReport/scrap.vue
Normal file
347
pages/mes/jobReport/scrap.vue
Normal file
@@ -0,0 +1,347 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="作业编码" :labelWidth='80' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" v-model="formData.pwoJobCode"
|
||||
@confirm="scanBarCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="工单" :labelWidth='80' name="pwoCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.pwoCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品编码" :labelWidth='80' name="ptNoTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptNoTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="产品名称" :labelWidth='80' name="ptTitleTar">
|
||||
<uni-easyinput disabled type="text" v-model="formData.ptTitleTar" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="设备编号" :labelWidth='80' name="machineId">
|
||||
<uni-easyinput disabled type="text" v-model="formData.machineId" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="批号" :labelWidth='80' name="batchNo">
|
||||
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程编码" :labelWidth='80' name="opCode">
|
||||
<uni-easyinput disabled type="text" v-model="formData.opCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="制程名称" :labelWidth='80' name="opTitle">
|
||||
<uni-easyinput disabled disabled type="text" v-model="formData.opTitle" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="用时(s)" :labelWidth='80' name="timeTake">
|
||||
<uni-easyinput type="number" v-model="formData.timeTake" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-forms-item label="报工类型" :labelWidth='80' name="type">
|
||||
<uni-easyinput disabled disabled type="text" v-model="formData.type" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报工数量" :labelWidth='80' name="reportNumber">
|
||||
<uni-easyinput type="number" :placeholder="'可报工数量:'+reportableNum"
|
||||
v-model="formData.reportNumber" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="报废原因" :labelWidth='80' name="reason">
|
||||
<uni-data-select v-model="formData.reason" :localdata="reasonOptions"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工编码" :labelWidth='80' name="createByCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCreateBy"
|
||||
v-model="formData.createByCode" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="生产员工" :labelWidth='80' name="createByName">
|
||||
<uni-easyinput disabled type="text" v-model="formData.createByName" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="是否录入件号" :labelWidth='120'>
|
||||
<uni-data-checkbox v-model="radio" :localdata="pieceIn"></uni-data-checkbox>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<view v-show="radio==1">
|
||||
<uni-forms-item label="件号" :labelWidth='80' name="pieceNo">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPieceNo" type="text"
|
||||
v-model="formData.pieceNo" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="开工时间" :labelWidth='90'>
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.startTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="完工时间" :labelWidth='90' name="endTime">
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.endTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit" v-if="!isPwoRoute">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPwoJob,
|
||||
addReport,
|
||||
getEquipment,
|
||||
addReportEnterPiece
|
||||
} from "@/api/mes/jobReport.js";
|
||||
import {
|
||||
listEmpEqpHistory,
|
||||
listEmployee,
|
||||
listConversion
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/dictData.js";
|
||||
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
// 获取当前时间
|
||||
var currentDate = new Date();
|
||||
// 格式化为字符串(YYYY-MM-DD HH:mm:ss)
|
||||
var year = currentDate.getFullYear();
|
||||
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
|
||||
var day = ("0" + currentDate.getDate()).slice(-2);
|
||||
var hours = ("0" + currentDate.getHours()).slice(-2);
|
||||
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
|
||||
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
|
||||
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
// 将当前时间赋值给 formData.endTime
|
||||
this.formData.endTime = formattedDate;
|
||||
this.formData.way = '人工报工';
|
||||
this.formData.type = '报废品';
|
||||
if (option) {
|
||||
this.formData = JSON.parse(decodeURIComponent(option.formData));
|
||||
this.isPwoRoute = true;
|
||||
}
|
||||
getDicts("mes_job_report_scrap").then(res => {
|
||||
this.reasonOptions = res.data.map(dict => {
|
||||
return {
|
||||
text: dict.dictLabel,
|
||||
value: dict.dictValue,
|
||||
diasble: false
|
||||
}
|
||||
});
|
||||
})
|
||||
// this.formData.createByName = this.$store.state.user.name;
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isPwoRoute: false,
|
||||
reasonOptions: [],
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
pwoCode: null,
|
||||
ptNoTar: null,
|
||||
ptTitleTar: null,
|
||||
machineId: null,
|
||||
batchNo: null,
|
||||
createByName: null,
|
||||
createByCode: null,
|
||||
pieceNo: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
reportableNum: 0,
|
||||
radio: 0,
|
||||
pieceIn: [{
|
||||
text: '是',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
value: 0
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}]
|
||||
},
|
||||
createByCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入生产员工编码!'
|
||||
}]
|
||||
},
|
||||
reportNumber: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入报工数量!'
|
||||
}]
|
||||
},
|
||||
reason: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入不良原因!'
|
||||
}]
|
||||
},
|
||||
endTime: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入完工时间!'
|
||||
}]
|
||||
},
|
||||
// machineId: {
|
||||
// rules: [
|
||||
// { required: true, errorMessage:'请输入设备编码!' }
|
||||
// ]
|
||||
// },
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
//判断是否选择录入件号
|
||||
if (this.radio == 1) {
|
||||
//判断是否输入件号
|
||||
if (this.formData.pieceNo && this.formData.pieceNo != "") {
|
||||
this.$modal.loading('提交中')
|
||||
addReportEnterPiece(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入件号!");
|
||||
}
|
||||
} else {
|
||||
this.$modal.loading('提交中')
|
||||
addReport(this.formData).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("报工成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarCode() {
|
||||
if (this.formData.pwoJobCode) {
|
||||
let obj = {
|
||||
code: this.formData.pwoJobCode
|
||||
}
|
||||
listPwoJob(obj).then(async res => {
|
||||
let jobs = res.rows;
|
||||
if (jobs.length == 0) {
|
||||
this.$modal.msg("未检索到该作业编码相关的信息!");
|
||||
} else {
|
||||
let job = jobs[0];
|
||||
console.log(job);
|
||||
this.formData.pwoCode = job.pwoCode;
|
||||
this.formData.ptNoTar = job.ptNoTar;
|
||||
this.formData.ptTitleTar = job.ptTitleTar;
|
||||
this.formData.opCode = job.opCode;
|
||||
this.formData.opTitle = job.opTitle;
|
||||
this.reportableNum = job.targetNum - job.finishQty;
|
||||
if (job.eqpId) {
|
||||
await getEquipment(job.eqpId).then(res => {
|
||||
console.log(res);
|
||||
this.formData.machineId = res.data.equipmentCode;
|
||||
})
|
||||
|
||||
//调取最后一条转入记录的操作人
|
||||
let code = {
|
||||
powJobCode: this.formData.pwoJobCode
|
||||
}
|
||||
listConversion(code).then(async res => {
|
||||
if (res.rows[0].operateBy && res.rows[0].operateBy != "") {
|
||||
this.formData.createByName = res.rows[0].operateBy;
|
||||
let arry = {
|
||||
name: this.formData.createByName
|
||||
}
|
||||
listEmployee(arry).then(async res => {
|
||||
this.formData.createByCode = res.rows[0]
|
||||
.empCode;
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.formData.batchNo = job.batchNo;
|
||||
console.log(this.formData);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
scanBarCreateBy() {
|
||||
if (this.formData.createByCode) {
|
||||
let obj = {
|
||||
empCode: this.formData.createByCode
|
||||
}
|
||||
listEmployee(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData.createByName = res.rows[0].name;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该人员信息!");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoJobCode = res.result;
|
||||
_this.scanBarCode(_this.formData.pwoJobCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.createByCode = res.result;
|
||||
_this.scanBarCreateBy();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarPieceNo() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pieceNo = res.result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user