fix report and plan

main
chenshuichuan 2 years ago
parent 4a3f0f04ad
commit 4f065b30a7

@ -24,13 +24,20 @@ export function getOtherPersonalUser(data) {
params:data params:data
}) })
} }
// 查询产品列表 // 查询正在开工的产品列表
export function getProductList() { export function getProductList() {
return request({ return request({
url: '/admin-api/mes/app/org-worker/getProductList', url: '/admin-api/mes/app/org-worker/getProductList',
method: 'get' method: 'get'
}) })
} }
// 查询正在开工的计划列表及其对应工序的未完工情况
export function getPlanProductList(orgType) {
return request({
url: '/admin-api/mes/app/org-worker/getPlanProductList?orgType='+orgType,
method: 'get'
})
}
// 创建生产报工单 // 创建生产报工单
export function createReport(data) { export function createReport(data) {
return request({ return request({

@ -55,6 +55,14 @@ export function getByStatus(status) {
method: 'get' method: 'get'
}) })
} }
// 获取计划进度
export function getPlanProgress(planId) {
return request({
url: '/admin-api/mes/work-report-plan-view/getPlanProgress?id='+planId,
method: 'get'
})
}

@ -63,3 +63,8 @@ export const groupTypes = [
{text: '白班', value: 1}, {text: '夜班', value: 2}, {text: '白班', value: 1}, {text: '夜班', value: 2},
{text: '长白班', value: 3} {text: '长白班', value: 3}
] ]
export function findTextByValue(enums,value){
const foundItem = enums.find(item => item.value === value);
return foundItem ? foundItem.text : null;
}

@ -0,0 +1,89 @@
<template>
<view class="container">
<uni-card :is-shadow="false" is-full>
<uni-row>
<uni-col :span="10">
<text class="uni-h6" >计划:
<el-text class="mx-1" type="primary">{{planDo.code}}</el-text>
</text>
</uni-col>
<uni-col :span="14">
<text class="uni-h6">产品:
<el-text class="mx-1" type="warning">{{planDo.productName}}</el-text>
</text>
</uni-col>
</uni-row>
</uni-card>
<ContentWrap>
<el-table :data="progressList" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="工序" align="center" prop="orgType" >
<template #default="scope">
<text> {{findTextByValue(scope.row.orgType)}}</text>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="totalQualityNumber" width="80px"/>
<el-table-column label="进度" align="center">
<template #default="scope">
<el-progress
:percentage="Number((scope.row.totalQualityNumber/planDo.planNumber)*100).toFixed(2)"
:stroke-width="15"
:color="finishColors"
:striped="true"
:striped-flow="true"
/>
</template>
</el-table-column>
<el-table-column label="废品" align="center" prop="totalWasteNumber" width="60px"/>
<el-table-column label="废品率" align="center" >
<template #default="scope">
<span class="percentage-value">{{Number((scope.row.totalWasteNumber/(scope.row.totalQualityNumber+scope.row.totalWasteNumber))*100 ).toFixed(2)}}%</span>
</template>
</el-table-column>
</el-table>
</ContentWrap>
</view>
</template>
<script>
import {processTypes,findTextByValue} from "@/api/system/dict/data";
import {getPlanProgress,getById} from "@/api/mes/plan"
import tab from "@/plugins/tab";
import modal from "@/plugins/modal";
export default {
components: {},
data() {
return {
planDo: undefined,
processTypes:processTypes,
progressList:[],
}
},
computed: {
},
onLoad() {
this.planDo = tab.getParams()
this.getProgressList()
},
onReady() {
},
methods: {
findTextByValue(value) {
return findTextByValue(this.processTypes, value)
},
getProgressList() {
modal.loading("正在加载...")
if(this.planDo)
getPlanProgress(this.planDo.id).then(response => {
this.progressList = response.data;
})
modal.closeLoading()
}
}
}
</script>
<style lang="scss">
</style>

@ -8,7 +8,7 @@
</uni-data-select> </uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="工序" required name="orgType"> <uni-forms-item label="工序" required name="orgType">
<uni-data-checkbox v-model="customFormData.orgType" :localdata="processTypes()" :disabled="disableEnable"/> <uni-data-checkbox v-model="customFormData.orgType" :localdata="processTypes()" :disabled="disableEnable" @change="handleOrgTypeChange"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="班别" required name="groupType"> <uni-forms-item label="班别" required name="groupType">
<uni-data-checkbox v-model="customFormData.groupType" :localdata="groupTypes()" :disabled="disableEnable"/> <uni-data-checkbox v-model="customFormData.groupType" :localdata="groupTypes()" :disabled="disableEnable"/>
@ -30,12 +30,12 @@
<template v-slot:title> <template v-slot:title>
<view class="uni-group-title"> <view class="uni-group-title">
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="20">
<uni-forms-item label="产品" required name="productId"> <uni-forms-item label="产品" required name="planId">
<uni-data-select v-model="customFormData.productList[index].productId" :localdata="planProductList"></uni-data-select> <uni-data-select v-model="customFormData.productList[index].planId" :localdata="planProductList" @change="handleProductChange"></uni-data-select>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12" align="center"> <uni-col :span="4" align="center">
<uni-icons type="trash" size="25" color="red" @click="del(item.id)"></uni-icons> <uni-icons type="trash" size="25" color="red" @click="del(item.id)"></uni-icons>
</uni-col> </uni-col>
</uni-row> </uni-row>
@ -92,9 +92,14 @@
<script> <script>
import useUserStore from "@/store/modules/user";
import {processTypes, groupTypes} from "@/api/system/dict/data"; import {processTypes, groupTypes} from "@/api/system/dict/data";
import { getProductList, createReport, getOtherPersonalUser,getOtherOrgList} from "@/api/mes/organization" import {
getProductList,
createReport,
getOtherPersonalUser,
getOtherOrgList,
getPlanProductList
} from "@/api/mes/organization"
import {getCurrentDate, timestampToTime} from "@/utils/dateUtil" import {getCurrentDate, timestampToTime} from "@/utils/dateUtil"
import {showConfirm} from "@/utils/common"; import {showConfirm} from "@/utils/common";
import tab from "@/plugins/tab"; import tab from "@/plugins/tab";
@ -153,7 +158,6 @@ export default {
computed: { computed: {
}, },
onLoad() { onLoad() {
this.getPlanProductList()
this.getUserList() this.getUserList()
this.updateId = tab.getParams() this.updateId = tab.getParams()
console.log(this.updateId) console.log(this.updateId)
@ -185,11 +189,12 @@ export default {
var ok = 1; var ok = 1;
if(this.customFormData.productList && this.customFormData.productList.length > 0) { if(this.customFormData.productList && this.customFormData.productList.length > 0) {
for (let i = 0; i < this.customFormData.productList.length; i++) { for (let i = 0; i < this.customFormData.productList.length; i++) {
if(!this.customFormData.productList[i].productId || this.customFormData.productList[i].productId==='' if(!this.customFormData.productList[i].planId || this.customFormData.productList[i].planId===''
|| !this.customFormData.productList[i].qualityNumber|| this.customFormData.productList[i].qualityNumber <= 0) { || !this.customFormData.productList[i].qualityNumber|| this.customFormData.productList[i].qualityNumber <= 0) {
ok = 0; ok = 0;
uni.showToast({ uni.showToast({
title: `产品信息不能为空!` title: `产品信息不能为空!`,
icon: 'error'
}) })
break; break;
} }
@ -237,7 +242,8 @@ export default {
this.orgIdList = response.data; this.orgIdList = response.data;
if(!this.orgIdList || this.orgIdList.length===0){ if(!this.orgIdList || this.orgIdList.length===0){
uni.showToast({ uni.showToast({
title: '日期:'+this.customFormData.reportDateString+`未查询到该工人的工位安排!请先安排工位!` title: '日期:'+this.customFormData.reportDateString+`未查询到该工人的工位安排!请先安排工位!`,
icon: 'error'
}) })
} }
else if(this.orgIdList.length===1){ else if(this.orgIdList.length===1){
@ -246,7 +252,8 @@ export default {
}) })
}, },
getPlanProductList() { getPlanProductList() {
getProductList().then(response => { if(this.customFormData.orgType)
getPlanProductList(this.customFormData.orgType).then(response => {
this.planProductList = response.data; this.planProductList = response.data;
if(!this.planProductList || this.orgIdList.planProductList===0){} if(!this.planProductList || this.orgIdList.planProductList===0){}
}) })
@ -257,16 +264,24 @@ export default {
}) })
}, },
add() { add() {
this.customFormData.productList.push({ if(this.customFormData.orgType){
id: Date.now(), this.customFormData.productList.push({
productId: undefined, id: Date.now(),
qualityNumber: 0, productId: undefined,
wasteNumber: 0, planId: undefined,
totalNumber: 0, qualityNumber: 0,
qualityRate:0, wasteNumber: 0,
packageNumber: 0, totalNumber: 0,
remark: '' qualityRate:0,
}) packageNumber: 0,
remark: ''
})
}else{
uni.showToast({
title: `请先选择工序!`,
icon: 'error'
})
}
}, },
del(id) { del(id) {
let index = this.customFormData.productList.findIndex(v => v.id === id) let index = this.customFormData.productList.findIndex(v => v.id === id)
@ -287,6 +302,12 @@ export default {
handleUserChange(e){ handleUserChange(e){
this.customFormData.userId = e this.customFormData.userId = e
this.getOrgIdList() this.getOrgIdList()
},
handleOrgTypeChange(e){
this.getPlanProductList()
},
handleProductChange(e){
console.log(e)
} }
} }
} }

@ -7,7 +7,7 @@
<!-- 自定义表单校验 --> <!-- 自定义表单校验 -->
<uni-forms ref="customForm" :rules="customRules" labelWidth="60px" :modelValue="customFormData"> <uni-forms ref="customForm" :rules="customRules" labelWidth="60px" :modelValue="customFormData">
<uni-forms-item label="工序" required name="orgType"> <uni-forms-item label="工序" required name="orgType">
<uni-data-checkbox v-model="customFormData.orgType" :localdata="processTypes()" /> <uni-data-checkbox v-model="customFormData.orgType" :localdata="processTypes()" @change="handleOrgTypeChange" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="班别" required name="groupType"> <uni-forms-item label="班别" required name="groupType">
<uni-data-checkbox v-model="customFormData.groupType" :localdata="groupTypes()" /> <uni-data-checkbox v-model="customFormData.groupType" :localdata="groupTypes()" />
@ -30,8 +30,8 @@
<view class="uni-group-title"> <view class="uni-group-title">
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="产品" required name="productId"> <uni-forms-item label="产品" required name="planId">
<uni-data-select v-model="customFormData.productList[index].productId" :localdata="planProductList"></uni-data-select> <uni-data-select v-model="customFormData.productList[index].planId" :localdata="planProductList"></uni-data-select>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12" align="center"> <uni-col :span="12" align="center">
@ -94,7 +94,7 @@
import useUserStore from "@/store/modules/user"; import useUserStore from "@/store/modules/user";
import {processTypes, groupTypes} from "@/api/system/dict/data"; import {processTypes, groupTypes} from "@/api/system/dict/data";
import {getOrgList, getProductList,createReport} from "@/api/mes/organization" import {getOrgList, getProductList, createReport, getPlanProductList} from "@/api/mes/organization"
import {getCurrentDate} from "@/utils/dateUtil" import {getCurrentDate} from "@/utils/dateUtil"
import {showConfirm} from "@/utils/common"; import {showConfirm} from "@/utils/common";
import tab from "@/plugins/tab"; import tab from "@/plugins/tab";
@ -133,8 +133,6 @@ export default {
productList: {rules: [ productList: {rules: [
{format: 'array', errorMessage: '产品列表格式错误'}, {format: 'array', errorMessage: '产品列表格式错误'},
{validateFunction: function(rule, value, data, callback) { {validateFunction: function(rule, value, data, callback) {
console.log('value:'+value)
console.log('data:'+data)
if (value.length < 2) { if (value.length < 2) {
callback('产品信息不能为空') callback('产品信息不能为空')
} }
@ -151,7 +149,7 @@ export default {
}, },
onLoad() { onLoad() {
this.getOrgIdList() this.getOrgIdList()
this.getPlanProductList() // this.getPlanProductList()
}, },
onReady() { onReady() {
// //
@ -172,21 +170,22 @@ export default {
var ok = 1; var ok = 1;
if(this.customFormData.productList && this.customFormData.productList.length > 0) { if(this.customFormData.productList && this.customFormData.productList.length > 0) {
for (let i = 0; i < this.customFormData.productList.length; i++) { for (let i = 0; i < this.customFormData.productList.length; i++) {
if(!this.customFormData.productList[i].productId || this.customFormData.productList[i].productId==='' if(!this.customFormData.productList[i].planId || this.customFormData.productList[i].planId===''
|| !this.customFormData.productList[i].qualityNumber|| this.customFormData.productList[i].qualityNumber <= 0) { || !this.customFormData.productList[i].qualityNumber|| this.customFormData.productList[i].qualityNumber <= 0) {
ok = 0; ok = 0;
uni.showToast({ uni.showToast({
title: `产品信息不能为空!` title: `产品信息不能为空!`,
icon: 'error'
}) })
break; break;
} }
} }
} }
if(ok===1){ if(ok===1){
showConfirm("提交后将不能修改,确认提交生产报工单吗?").then(res => { showConfirm("确认保存生产报工单吗?").then(res => {
if (res.confirm) { if (res.confirm) {
createReport(this.customFormData).then(response => { createReport(this.customFormData).then(response => {
modal.msgSuccess("提交成功") modal.msgSuccess("保存成功")
tab.switchTab('/pages/report') tab.switchTab('/pages/report')
}) })
} }
@ -210,7 +209,8 @@ export default {
this.orgIdList = response.data; this.orgIdList = response.data;
if(!this.orgIdList || this.orgIdList.length===0){ if(!this.orgIdList || this.orgIdList.length===0){
uni.showToast({ uni.showToast({
title: '日期:'+this.customFormData.reportDateString+`未查询到工位安排!` title: '日期:'+this.customFormData.reportDateString+`未查询到工位安排!`,
icon: 'error'
}) })
} }
else if(this.orgIdList.length===1){ else if(this.orgIdList.length===1){
@ -219,22 +219,31 @@ export default {
}) })
}, },
getPlanProductList() { getPlanProductList() {
getProductList().then(response => { if(this.customFormData.orgType)
getPlanProductList(this.customFormData.orgType).then(response => {
this.planProductList = response.data; this.planProductList = response.data;
if(!this.planProductList || this.orgIdList.planProductList===0){} if(!this.planProductList || this.orgIdList.planProductList===0){}
}) })
}, },
add() { add() {
this.customFormData.productList.push({ if(this.customFormData.orgType){
id: Date.now(), this.customFormData.productList.push({
productId: undefined, id: Date.now(),
qualityNumber: 0, productId: undefined,
wasteNumber: 0, planId: undefined,
totalNumber: 0, qualityNumber: 0,
qualityRate:0, wasteNumber: 0,
packageNumber: 0, totalNumber: 0,
remark: '' qualityRate:0,
}) packageNumber: 0,
remark: ''
})
}else{
uni.showToast({
title: `请先选择工序!`,
icon: 'error'
})
}
}, },
del(id) { del(id) {
let index = this.customFormData.productList.findIndex(v => v.id === id) let index = this.customFormData.productList.findIndex(v => v.id === id)
@ -251,6 +260,10 @@ export default {
Number(this.customFormData.productList[index].qualityNumber) + Number(this.customFormData.productList[index].wasteNumber); Number(this.customFormData.productList[index].qualityNumber) + Number(this.customFormData.productList[index].wasteNumber);
this.customFormData.productList[index].qualityRate = this.customFormData.productList[index].qualityRate =
(Number(this.customFormData.productList[index].qualityNumber)*100/Number(this.customFormData.productList[index].totalNumber)).toFixed(2); (Number(this.customFormData.productList[index].qualityNumber)*100/Number(this.customFormData.productList[index].totalNumber)).toFixed(2);
},
handleOrgTypeChange(e){
console.log(e)
this.getPlanProductList()
} }
} }
} }

@ -77,6 +77,13 @@
"navigationBarTitleText": "代报工" "navigationBarTitleText": "代报工"
} }
} }
,
{
"path": "planProgress",
"style": {
"navigationBarTitleText": "计划进度"
}
}
] ]
}, },
{ {

@ -33,6 +33,14 @@
<el-button type="warning" plain @click="updatePlan(item.id,item.code,'pause')"></el-button> <el-button type="warning" plain @click="updatePlan(item.id,item.code,'pause')"></el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="20">
<el-text>备注:{{ item.remark }}</el-text>
</el-col>
<el-col :span="4">
<el-button type="info" plain @click="planProgress(item)"></el-button>
</el-col>
</el-row>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
@ -61,6 +69,7 @@
<el-text type="warning">计划结束:{{ timestampToTime(item.planEndTime) }}</el-text> <el-text type="warning">计划结束:{{ timestampToTime(item.planEndTime) }}</el-text>
</el-col> </el-col>
</el-row> </el-row>
<el-text>备注:{{ item.remark }}</el-text>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
<!-- 计划中--> <!-- 计划中-->
@ -88,6 +97,7 @@
<el-text type="warning">计划结束:{{ timestampToTime(item.planEndTime) }}</el-text> <el-text type="warning">计划结束:{{ timestampToTime(item.planEndTime) }}</el-text>
</el-col> </el-col>
</el-row> </el-row>
<el-text>备注:{{ item.remark }}</el-text>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
<!-- 暂停中 --> <!-- 暂停中 -->
@ -121,6 +131,7 @@
<el-button type="info" plain @click="updatePlan(item.id, item.code,'start')">开工</el-button> <el-button type="info" plain @click="updatePlan(item.id, item.code,'start')">开工</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-text>备注:{{ item.remark }}</el-text>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
@ -137,6 +148,7 @@ import {getPage, getById, paigong, updateStatus, getByStatus} from "@/api/mes/pl
import {timestampToTime} from "@/utils/dateUtil"; import {timestampToTime} from "@/utils/dateUtil";
import {Tickets} from "@element-plus/icons-vue"; import {Tickets} from "@element-plus/icons-vue";
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
import tab from "@/plugins/tab";
import {showConfirm} from "@/utils/common"; import {showConfirm} from "@/utils/common";
import auth from "@/plugins/auth"; import auth from "@/plugins/auth";
const userStore = useUserStore() const userStore = useUserStore()
@ -203,6 +215,10 @@ function updatePlan(id, planCode, type){
} }
}) })
} }
//
function planProgress(plan){
tab.navigateTo('/page_report/planProgress',plan)
}
</script> </script>
<style scoped> <style scoped>

@ -31,9 +31,6 @@
<el-tab-pane label="代报工" name="second" v-if="auth.hasPermi('mes:produce-report-detail:replace')"> <el-tab-pane label="代报工" name="second" v-if="auth.hasPermi('mes:produce-report-detail:replace')">
<uni-fab :pattern="pattern" ref="fabReplace" @fabClick="addReplaceReport" /> <uni-fab :pattern="pattern" ref="fabReplace" @fabClick="addReplaceReport" />
<uni-forms ref="valiReplaceForm" :model="valiFormData"> <uni-forms ref="valiReplaceForm" :model="valiFormData">
<uni-forms-item label="工序" name="orgType">
<uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleReplaceReportChange()"/>
</uni-forms-item>
<uni-row> <uni-row>
<uni-col :xs="14" :sm="12" :md="6" :lg="3" :xl="1"> <uni-col :xs="14" :sm="12" :md="6" :lg="3" :xl="1">
<uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString"> <uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString">
@ -47,6 +44,9 @@
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-forms-item label="工序" name="orgType">
<uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleReplaceReportChange()"/>
</uni-forms-item>
</uni-forms> </uni-forms>
<uni-list :border="true"> <uni-list :border="true">
<uni-list-item v-for="(item, index) in replaceReportList"> <uni-list-item v-for="(item, index) in replaceReportList">
@ -66,7 +66,8 @@
<!-- 自定义 footer--> <!-- 自定义 footer-->
<template v-slot:footer> <template v-slot:footer>
<el-button v-if="item.reportStatus === 0" type="primary" size="small" :icon="Edit" circle @click="addReplaceReport(item.id)"/> <el-button v-if="item.reportStatus === 0" type="primary" size="small" :icon="Edit" circle @click="addReplaceReport(item.id)"/>
<el-button v-if="item.reportStatus === 0" type="success" size="small" :icon="Promotion" circle @click="updateReport(item.id,1)"/> <el-button v-if="item.reportStatus === 0" type="success" size="small" :icon="Promotion" circle @click="updateReport(item.id,1,'提交')"/>
<el-button v-if="item.reportStatus === 1" type="success" size="small" :icon="Check" circle @click="updateReport(item.id,2,'通过')"/>
<el-button v-if="item.reportStatus < 2" type="danger" size="small" :icon="Delete" circle @click="deleteReport(item.id)"/> <el-button v-if="item.reportStatus < 2" type="danger" size="small" :icon="Delete" circle @click="deleteReport(item.id)"/>
</template> </template>
</uni-list-item> </uni-list-item>
@ -74,9 +75,6 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="个人报工审核" name="third" v-if="auth.hasPermi('mes:produce-report-detail:replace')"> <el-tab-pane label="个人报工审核" name="third" v-if="auth.hasPermi('mes:produce-report-detail:replace')">
<uni-forms ref="valiForm" :model="valiFormData"> <uni-forms ref="valiForm" :model="valiFormData">
<uni-forms-item label="工序" name="orgType">
<uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleOtherReportChange()"/>
</uni-forms-item>
<uni-row> <uni-row>
<uni-col :xs="14" :sm="12" :md="6" :lg="3" :xl="1"> <uni-col :xs="14" :sm="12" :md="6" :lg="3" :xl="1">
<uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString"> <uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString">
@ -90,6 +88,9 @@
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-forms-item label="工序" name="orgType">
<uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleOtherReportChange()"/>
</uni-forms-item>
</uni-forms> </uni-forms>
<uni-list :border="true"> <uni-list :border="true">

Loading…
Cancel
Save