Browse Source

2024-05-07 修改排产bug,后端增加报工、完工界面

master_hella_20240701
zhousq 6 months ago
parent
commit
a190db2628
  1. 24
      src/api/mes/workScheduling/index.ts
  2. 2
      src/views/mes/orderDay/components/schedule.vue
  3. 4
      src/views/mes/orderDay/index.vue
  4. 8
      src/views/mes/orderDay/orderDay.data.ts
  5. 121
      src/views/mes/workScheduling/components/finish.vue
  6. 137
      src/views/mes/workScheduling/components/report.vue
  7. 37
      src/views/mes/workScheduling/index.vue
  8. 2
      src/views/mes/workScheduling/workScheduling.data.ts

24
src/api/mes/workScheduling/index.ts

@ -47,4 +47,26 @@ export const exportWorkScheduling = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/mes/workScheduling/get-import-template' })
}
}
// 完工
export const completeHandle = async (data) => {
return await request.post({ url: `/mes/workScheduling/completeHandle`, data })
}
//报工
export const reportWorkByProcess = async (data) => {
return await request.post({ url: `/mes/work-scheduling-detail/reportWorkByProcess`, data })
}
//检查当前节点是否可以完工
export const getNodePosition = async (params) => {
return await request.get({ url: `/mes/workScheduling/getNodePosition`, params })
}
//获取当前工序的员工列表
export const getCurrentWorkerList = async (params) => {
return await request.get({ url: `/mes/workScheduling/getCurrentWorkerList`, params })
}
//获取当前工单的工序列表
export const getProcessList = async (params) => {
return await request.get({ url: `/mes/workScheduling/getProcessList`, params })
}

2
src/views/mes/orderDay/components/schedule.vue

@ -202,7 +202,7 @@
</ContentWrap>
<template #footer>
<el-button @click="dialogVisible=false" >关闭</el-button>
<el-button @click="publishPlan" >发布计划</el-button>
<el-button type="primary" @click="publishPlan" >发布计划</el-button>
</template>
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess" />
</Dialog>

4
src/views/mes/orderDay/index.vue

@ -197,7 +197,7 @@ const buttonBaseClick = (val, item) => {
}
const publishClosed=()=>{
//console.log('publishClosed')
getList()
getList()
}
//
const isShowMainButton = (row,val) => {
@ -282,7 +282,7 @@ const formsSuccess = async (formType,data) => {
}
basicFormRef.value.dialogVisible = false
getList()
await getList()
}
/** 详情操作 */

8
src/views/mes/orderDay/orderDay.data.ts

@ -11,9 +11,9 @@ export const OrderDayRules = reactive({
// batchCode: [
// { required: false, message: '请输入一个日计划编号', trigger: 'blur' }
// ],
planNoMonth: [
{ required: true, message: '请输入一个月计划编号', trigger: 'blur' }
],
// planNoMonth: [
// { required: true, message: '请输入一个月计划编号', trigger: 'blur' }
// ],
productCode: [
{ required: true, message: '请选择一个产品', trigger: 'blur' }
],
@ -214,7 +214,7 @@ export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
value: 'FALSE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'

121
src/views/mes/workScheduling/components/finish.vue

@ -0,0 +1,121 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:close-on-click-modal="true"
:vLoading="formLoading"
>
<template #title>{{ dialogTitle }}</template>
<el-form>
<el-form-item label="当前工序">
<el-input v-model="currentProcess" disabled></el-input>
</el-form-item>
<el-form-item label="选择人员">
<el-select v-model="personSelected">
<el-option v-for="item in personData" :key="item.workerCode" :label="item.workerName" />
</el-select>
</el-form-item>
<el-form-item label="报工数量">
<el-input-number v-model="reportCount" @change="handleCount"></el-input-number>
</el-form-item>
<el-form-item label="工时">
<el-input-number v-model="workTerm"></el-input-number>
</el-form-item>
<el-form-item label="是否已质检">
<el-switch v-model="checkFlag" active-value="true"> </el-switch>
</el-form-item>
<el-form-item label="合格数量">
<el-input-number
v-model="qualified"
:disabled="!checkFlag"
@change="handleCount"
></el-input-number>
</el-form-item>
<el-form-item label="不合格数量">
<el-input-number disabled v-model="unqualified"></el-input-number>
</el-form-item>
</el-form>
<template #footer
><el-button @click="dialogVisible = false">关闭</el-button>
<el-button type="primary" @click="saveReport">保存</el-button></template
>
</Dialog>
</template>
<script lang="ts" setup>
import { Dialog } from '@/components/Dialog'
import * as workschedulingApi from '@/api/mes/workScheduling'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import dayjs from 'dayjs'
const message = useMessage() //
const { t } = useI18n() //
const { wsCache } = useCache()
const rowData = ref()
const dialogVisible = ref(false)
const dialogTitle = ref()
const formLoading = ref(false)
const personSelected = ref()
const currentProcess = ref()
const personData = ref([{ value: '', label: '' }])
const reportCount = ref()
const qualified = ref()
const checkFlag = ref(false)
const unqualified = ref(0)
const workTerm = ref()
const user = wsCache.get(CACHE_KEY.USER)
const handleCount = () => {
if (reportCount.value > rowData.value.planCount) {
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】')
reportCount.value =rowData.value.planCount
return
}
if (checkFlag) {
if (reportCount.value < qualified.value) {
message.alert('合格数不能超出报工数!')
return
}
if (qualified.value == undefined || qualified.value == 0) {
qualified.value = reportCount.value
}
unqualified.value = reportCount.value - qualified.value
}
}
const openDetail = (row: any, titleName: any) => {
//console.log('workscheduling-finishReport-60', user)
currentProcess.value = row.workingNode
rowData.value = row
dialogVisible.value = true
dialogTitle.value = titleName
getCurrentWorkerList(row)
}
const getCurrentWorkerList = async (row) => {
let params = {
planDayCode: row.planMasterCode,
processCode: row.workingNode
}
personData.value = await workschedulingApi.getCurrentWorkerList(params)
}
//
const saveReport = () => {
let data = {
reportDate: dayjs(new Date()).format('YYYY-MM-DD HH:mm:sss'),
schedulingCode: rowData.value.schedulingCode,
processCode: currentProcess.value,
list: [
{
reportCount: reportCount.value,
workTerm: workTerm.value,
reportPerson: personSelected.value,
qualified: qualified.value,
unqualified: unqualified.value
}
]
}
workschedulingApi.completeHandle(data)
}
//
const emit = defineEmits(['success', 'close'])
defineExpose({ openDetail }) // open
</script>

137
src/views/mes/workScheduling/components/report.vue

@ -0,0 +1,137 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:close-on-click-modal="true"
:vLoading="formLoading"
>
<template #title>{{ dialogTitle }}</template>
<el-form>
<el-form-item label="选择工序">
<el-select v-model="processCodeSelected" @change="processChange" value-key="processCode">
<el-option v-for="item in processOption" :key="item.processCode" :label="item.processName" :value="item.processCode" />
</el-select>
</el-form-item>
<el-form-item label="选择人员">
<el-select v-model="personSelected">
<el-option v-for="item in personOption" :key="item.workerCode" :label="item.workerName" :value="item.workerCode" />
</el-select>
</el-form-item>
<el-form-item label="报工数量">
<el-input-number v-model="reportCount" @change="handleCount"></el-input-number>
</el-form-item>
<el-form-item label="工时">
<el-input-number v-model="workTerm"></el-input-number>
</el-form-item>
<el-form-item label="是否已质检">
<el-switch v-model="checkFlag" active-value="true"> </el-switch>
</el-form-item>
<el-form-item label="合格数量">
<el-input-number
v-model="qualified"
:disabled="!checkFlag"
@change="handleCount"
></el-input-number>
</el-form-item>
<el-form-item label="不合格数量">
<el-input-number disabled v-model="unqualified"></el-input-number>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">关闭</el-button>
<el-button type="primary" @click="saveReport">保存</el-button>
</template> </Dialog
>+
</template>
<script lang="ts" setup>
import { Dialog } from '@/components/Dialog'
import * as workschedulingApi from '@/api/mes/workScheduling'
import dayjs from 'dayjs'
const message = useMessage() //
const { t } = useI18n() //
const rowData = ref()
const openDetail = async (row: any, titleName: any) => {
rowData.value = row
dialogVisible.value = true
dialogTitle.value = titleName
getProcessList(row)
}
const dialogVisible = ref(false)
const dialogTitle = ref()
const formLoading = ref(false)
const processOption = ref([])
const personOption=ref([])
const processCodeSelected = ref()
const personSelected = ref()
const checkFlag = ref(false)
const unqualified = ref()
const reportCount = ref()
const qualified = ref()
const workTerm = ref()
//
const getProcessList=async(row)=>{
let params={
planDayCode:row.planMasterCode,
schedulingCode:row.schedulingCode
}
processOption.value=await workschedulingApi.getProcessList(params)
}
const processChange=(val:any)=>{
console.log("processChange-81",val)
getCurrentWorkerList(val)
}
//
const getCurrentWorkerList = async (val) => {
console.log("personOption-91",val)
let params = {
planDayCode: rowData.value.planMasterCode,
processCode: val
}
personOption.value = await workschedulingApi.getCurrentWorkerList(params)
}
//
const handleCount = () => {
if (reportCount.value > rowData.value.planCount) {
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】')
reportCount.value =rowData.value.planCount
return
}
if (checkFlag) {
if (reportCount.value < qualified.value) {
message.alert('合格数不能超出报工数!')
return
}
if (qualified.value == undefined || qualified.value == 0) {
qualified.value = reportCount.value
}
unqualified.value = reportCount.value - qualified.value
}
}
//
const saveReport = () => {
let data = {
reportDate: dayjs(new Date()).format('YYYY-MM-DD HH:mm:sss'),
schedulingCode: rowData.value.schedulingCode,
processCode: processCodeSelected.value,
list: [
{
reportCount: reportCount.value,
workTerm: workTerm.value,
reportPerson: personSelected.value,
qualified: qualified.value,
unqualified: unqualified.value
}
]
}
//console.log("report-saveReport-82",data)
workschedulingApi.reportWorkByProcess(data)
}
//
const emit = defineEmits(['success', 'close'])
defineExpose({ openDetail }) // open
</script>

37
src/views/mes/workScheduling/index.vue

@ -67,7 +67,8 @@
@searchTableSuccessDetail="searchTableSuccessDetail"
:key="count"
/>
<Report ref="reportRef"></Report>
<Finish ref="reportFinishRef"></Finish>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/mes/work-scheduling/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
@ -81,7 +82,8 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from './components/Detail.vue'
import { async } from '@antv/x6/lib/registry/marker/async'
import Report from './components/report.vue'
import Finish from './components/finish.vue'
defineOptions({ name: 'MesWorkScheduling' })
@ -172,9 +174,13 @@ const butttondata=(row) =>{ return [
defaultButtons.mainListHandleBtn({label:"终止",name:'terminate',hide: isShowMainButton(row,['-1','0']),hasPermi:'mes:workScheduling:update'}), //
defaultButtons.mainListHandleBtn({label:"暂停",name:'pause',hide: isShowMainButton(row,['1']),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"恢复",name:'resume',hide: isShowMainButton(row,['3']),hasPermi:'mes:workScheduling:update'}),
//defaultButtons.mainListHandleBtn({label:"",name:'change', hasPermi:'mes:workScheduling:update'}), //
defaultButtons.mainListHandleBtn({label:"开工",name:'start',hide: isShowMainButton(row,['0']),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"报工",name:'report',hide: isShowMainButton(row,['1'] ),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"完工",name:'finish',hide: isShowMainButton(row,['1']),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"叫料",name:'callMaterial',hide: isShowMainButton(row,['1']),hasPermi:'mes:workScheduling:update'}),
]}
const reportRef=ref()
const reportFinishRef=ref()
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
@ -185,6 +191,14 @@ const buttonTableClick = async (val, row) => {
changeBillStatus(row,"3")
}else if (val == 'resume') { //
changeBillStatus(row,"1")
}else if(val=='start'){
changeBillStatus(row,"1")
}else if(val=='report'){
reportRef.value.openDetail(row,"报工")
}else if(val=='finish'){
finishReport(row)
} else if(val=='callMaterial'){
}
}
@ -193,7 +207,20 @@ const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
//
const finishReport=async(row)=>{
let params={
planDayCode:row.planMasterCode,
processCode:row.workingNode
}
//console.log("workscheduling-finishReport-213",row)
let res=await WorkSchedulingApi.getNodePosition(params)
if(res==='end'){
reportFinishRef.value.openDetail(row,"完工")
}else{
message.alert("当前工序不是完工工序,不能进行完工操作!")
}
}
// form
const formsSuccess = async (formType,data) => {
var isHave =WorkScheduling.allSchemas.formSchema.some(function (item) {

2
src/views/mes/workScheduling/workScheduling.data.ts

@ -164,7 +164,7 @@ export const WorkScheduling = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action',
isForm: false,
table: {
width: 150,
width: 'wrapContent',
fixed: 'right'
}
}

Loading…
Cancel
Save