Browse Source

2024-04-26 修改日计划和订单的页面增加计划终止、工单终止、页面优化

master_hella_20240701
zhousq 7 months ago
parent
commit
52823b1d2d
  1. 6
      src/api/mes/orderDay/index.ts
  2. 20
      src/api/mes/workScheduling/index.ts
  3. 6
      src/views/mes/orderDay/components/BasicFormV2.vue
  4. 42
      src/views/mes/orderDay/components/schedule.vue
  5. 52
      src/views/mes/orderDay/index.vue
  6. 21
      src/views/mes/orderDay/orderDay.data.ts
  7. 75
      src/views/mes/workScheduling/index.vue
  8. 36
      src/views/mes/workScheduling/workScheduling.data.ts

6
src/api/mes/orderDay/index.ts

@ -99,9 +99,9 @@ export const getPlanDevices = async (params) => {
///发布计划 ///发布计划
export const publishPlan = async (data: OrderDayVO) => { export const publishPlan = async (data: OrderDayVO) => {
return await request.post({ url: `/mes/orderday/publishPlan`,data }) return await request.postOriginal({ url: `/mes/orderday/publishPlan`,data })
} }
//终止计划 //终止计划
export const stopPlan = async (params) => { export const stopPlan = async (id) => {
return await request.post({ url: `/mes/orderday/stopPlan`,params }) return await request.post({ url: `/mes/orderday/stopPlan/`+id })
} }

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

@ -9,38 +9,42 @@ export const getWorkSchedulingPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
return await request.post({ url: '/mes/work-scheduling/senior', data }) return await request.post({ url: '/mes/workScheduling/senior', data })
} else { } else {
return await request.get({ url: `/mes/work-scheduling/page`, params }) return await request.get({ url: `/mes/workScheduling/page`, params })
} }
} }
// 查询生产任务排产详情 // 查询生产任务排产详情
export const getWorkScheduling = async (id: number) => { export const getWorkScheduling = async (id: number) => {
return await request.get({ url: `/mes/work-scheduling/get?id=` + id }) return await request.get({ url: `/mes/workScheduling/get?id=` + id })
} }
// 新增生产任务排产 // 新增生产任务排产
export const createWorkScheduling = async (data: WorkSchedulingVO) => { export const createWorkScheduling = async (data: WorkSchedulingVO) => {
return await request.post({ url: `/mes/work-scheduling/create`, data }) return await request.post({ url: `/mes/workScheduling/create`, data })
} }
// 修改生产任务排产 // 修改生产任务排产
export const updateWorkScheduling = async (data: WorkSchedulingVO) => { export const updateWorkScheduling = async (data: WorkSchedulingVO) => {
return await request.put({ url: `/mes/work-scheduling/update`, data }) return await request.put({ url: `/mes/workScheduling/update`, data })
}
// 更改生产任务状态
export const updateWorkSchedulingStatus = async (data: any) => {
return await request.put({ url: `/mes/workScheduling/updateStatus`, data })
} }
// 删除生产任务排产 // 删除生产任务排产
export const deleteWorkScheduling = async (id: number) => { export const deleteWorkScheduling = async (id: number) => {
return await request.delete({ url: `/mes/work-scheduling/delete?id=` + id }) return await request.delete({ url: `/mes/workScheduling/delete?id=` + id })
} }
// 导出生产任务排产 Excel // 导出生产任务排产 Excel
export const exportWorkScheduling = async (params) => { export const exportWorkScheduling = async (params) => {
return await request.download({ url: `/mes/work-scheduling/export-excel`, params }) return await request.download({ url: `/mes/workScheduling/export-excel`, params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/mes/work-scheduling/get-import-template' }) return request.download({ url: '/mes/workScheduling/get-import-template' })
} }

6
src/views/mes/orderDay/components/BasicFormV2.vue

@ -4,11 +4,11 @@
v-model="dialogVisible" v-model="dialogVisible"
:width="dialogWidth" :width="dialogWidth"
:close-on-click-modal="false" :close-on-click-modal="false"
:vLoading="formLoading"
> >
<div style="max-height: 60vh;overflow-y: auto;"> <div style="max-height: 60vh;overflow-y: auto;">
<Form <Form
ref="formRef" ref="formRef"
v-loading="formLoading"
:rules="rules" :rules="rules"
:schema="formSchema" :schema="formSchema"
:is-col="true" :is-col="true"
@ -304,7 +304,9 @@ if (props.isShowFooterButtton) {
const buttonBaseClick = (val) => { const buttonBaseClick = (val) => {
// //
if (val == 'save') { if (val == 'save') {
submitForm() submitForm()
} }
// //
else if (val == 'close') { else if (val == 'close') {

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

@ -4,6 +4,7 @@
v-model="dialogVisible" v-model="dialogVisible"
:width="dialogWidth" :width="dialogWidth"
:close-on-click-modal="false" :close-on-click-modal="false"
:vLoading="formLoading"
> >
<ContentWrap> <ContentWrap>
<Descriptions <Descriptions
@ -178,7 +179,7 @@
</el-dialog> </el-dialog>
</ContentWrap> </ContentWrap>
<template #footer> <template #footer>
<el-button @click="publishPlan">发布计划</el-button> <el-button @click="publishPlan" >发布计划</el-button>
</template> </template>
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess" /> <SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess" />
</Dialog> </Dialog>
@ -211,11 +212,11 @@ const graph = ref<Graph>()
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const activeName = ref('process') const activeName = ref('process')
const loading = ref(true) const formLoading = ref(false)
const dialogFormVisibleUser = ref(false) const dialogFormVisibleUser = ref(false)
const processData = ref([]) const processData = ref([])
const processCode = ref('') const processCode = ref('')
//const isPublish=ref(false)
const queryParams:orderDayconfigApi.OrderDayQueryParamVo=ref() const queryParams:orderDayconfigApi.OrderDayQueryParamVo=ref()
const props = defineProps({ const props = defineProps({
// //
@ -411,7 +412,26 @@ const opensearchTable = (
true true
) )
} }
const publishPlan= async ()=>{ const publishPlan=()=>{
message.confirm("确认发布当前计划?","question").then(async () => {
//isPublish.value=true
//loading.value = true,
try{formLoading.value=true
doPublishPlan() }finally{
formLoading.value=false;
}
// loading.value = false,
dialogVisible.value = false,
//isPublish.value=false,
emit('close')
}).catch(() => {
message.info("已取消发布")
})
}
const doPublishPlan= ()=>{
let data ={ let data ={
updateId: detailData.value.id, updateId: detailData.value.id,
status: detailData.value.status, status: detailData.value.status,
@ -432,8 +452,14 @@ const publishPlan= async ()=>{
endTime: detailData.value.endTime, endTime: detailData.value.endTime,
taskMode: detailData.value.taskMode taskMode: detailData.value.taskMode
} }
console.log("-------",data) //console.log("-------",data)
await OrderDayApi.publishPlan(data) let res = OrderDayApi.publishPlan(data)
if(res.code==0){
message.success("计划发布成功")
}else {
message.error(res.msg)
}
} }
// //
const searchTableSuccess = (formField, searchField, val, type, row) => { const searchTableSuccess = (formField, searchField, val, type, row) => {
@ -623,6 +649,10 @@ const getTeamList = async (params:any) => {
defineOptions({ name: 'SechledDetail' }) defineOptions({ name: 'SechledDetail' })
defineExpose({ open }) // open defineExpose({ open }) // open
//
const emit = defineEmits([
'close'
])
</script> </script>
<style lang="scss"> <style lang="scss">
.el-drawer__body { .el-drawer__body {

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

@ -57,11 +57,12 @@
:isBusiness="false" :isBusiness="false"
:isSearchFilterButtonHide="true" :isSearchFilterButtonHide="true"
@onChange="valueChange" @onChange="valueChange"
/> />
<!-- 详情 --> <!-- 详情 -->
<orderDetail ref="detailRef" :all-schemas="OrderDay.allSchemas" /> <orderDetail ref="detailRef" :all-schemas="OrderDay.allSchemas" />
<scheduleDetail ref="scheduleDetailRef" :all-schemas="OrderDay.allSchemas" :basicFormWidth="75"/> <scheduleDetail ref="scheduleDetailRef" :all-schemas="OrderDay.allSchemas" :basicFormWidth="75" @close="publishClosed" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm <ImportForm
ref="importFormRef" ref="importFormRef"
@ -81,8 +82,7 @@ import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import orderDetail from './components/orderDetail.vue' import orderDetail from './components/orderDetail.vue'
import scheduleDetail from './components/schedule.vue' import scheduleDetail from './components/schedule.vue'
import { Loading } from 'node_modules/element-plus/es/components/loading/src/service'
import { loadavg } from 'os'
defineOptions({ name: 'MesOrderDay' }) defineOptions({ name: 'MesOrderDay' })
const message = useMessage() // const message = useMessage() //
@ -195,6 +195,10 @@ const buttonBaseClick = (val, item) => {
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
const publishClosed=()=>{
//console.log('publishClosed')
getList()
}
// //
const isShowMainButton = (row,val) => { const isShowMainButton = (row,val) => {
//console.log('row',row) //console.log('row',row)
@ -206,6 +210,7 @@ const isShowMainButton = (row,val) => {
} }
// - // -
// - // -
//TERMINALE("4", ""),PROCESSING("3", ""),PUBLISHED("2", ""),WAITSECHUDLE("1", ""),CANCELED("-2", ""),WAITREADY("-1", "");
const butttondata = (row) => { const butttondata = (row) => {
//console.log('row2',row) //console.log('row2',row)
return [ return [
@ -227,11 +232,11 @@ const butttondata = (row) => {
// hasPermi: ''}), // // hasPermi: ''}), //
defaultButtons.mainListHandleBtn({label: '终止', defaultButtons.mainListHandleBtn({label: '终止',
name: 'stopPlan', name: 'stopPlan',
hide: isShowMainButton(row,['1','2','3']), hide: isShowMainButton(row,['-1','1','2','3']),
type: 'warning', type: 'warning',
icon: '', icon: '',
color: '', color: '',
hasPermi: ''}), // hasPermi: 'mes:orderDay:update'}), //
] ]
} }
@ -244,6 +249,8 @@ const buttonTableClick = async (val, row) => {
handleDelete(row.id) handleDelete(row.id)
} else if(val=='publish'){ // } else if(val=='publish'){ //
openScheduledDetail( '发布计划', row,row.planNoDay) openScheduledDetail( '发布计划', row,row.planNoDay)
}else if(val=='stopPlan'){ //
stopPlan(row.id)
} }
} }
@ -255,25 +262,23 @@ const openForm = (type: string, row?: any) => {
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType,data) => {
var isHave =OrderDay.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') { if (formType === 'create') {
await OrderDayApi.createOrderDay(data) let ret=await OrderDayApi.createOrderDay(data)
message.success(t('common.createSuccess')) if(ret===undefined || ret===null){
message.error(t('common.networkError'))
}else{
message.success(t('common.createSuccess'))
}
} else { } else {
await OrderDayApi.updateOrderDay(data) let ret=await OrderDayApi.updateOrderDay(data)
message.success(t('common.updateSuccess')) if(ret.code==0){
message.success(t('common.updateSuccess'))
}else{
message.error(t('common.networkError'))
}
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
@ -318,7 +323,10 @@ const handleExport = async () => {
exportLoading.value = false exportLoading.value = false
} }
} }
const stopPlan = async (id) => {
await OrderDayApi.stopPlan(id)
getList()
}
/** 导入 */ /** 导入 */
const importFormRef = ref() const importFormRef = ref()
const handleImport = () => { const handleImport = () => {

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

@ -263,7 +263,9 @@ export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([
field: 'planDate', field: 'planDate',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
isSearch: true, isSearch: false,
isForm:false,
isTable:false,
search: { search: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -286,11 +288,12 @@ export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([
formatter: dateFormatter, formatter: dateFormatter,
required: true, required: true,
form: { form: {
component: 'TimePicker', component: 'DatePicker',
componentProps: { componentProps: {
type: 'time', type: 'datetime',
dateFormat: 'HH:mm', dateFormat: 'YYYY-MM-DD',
//valueFormat: 'x', valueFormat: 'x',
timeFormat:"HH:mm"
} }
}, },
}, },
@ -301,10 +304,12 @@ export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([
formatter: dateFormatter, formatter: dateFormatter,
isReadonly:true, isReadonly:true,
form: { form: {
component: 'TimePicker', component: 'DatePicker',
componentProps: { componentProps: {
type: 'time', type: 'datetime',
dateFormat: 'HH:mm', dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
timeFormat:"HH:mm"
} }
}, },
}, },

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

@ -27,13 +27,13 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #planMaserCode="{row}"> <template #schedulingCode="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.planMaserCode)"> <el-button type="primary" link @click="openDetail(row, '工单详情', row.schedulingCode)">
<span>{{ row.planMaserCode }}</span> <span>{{ row.planMaserCode }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -81,6 +81,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from './components/Detail.vue' import Detail from './components/Detail.vue'
import { async } from '@antv/x6/lib/registry/marker/async'
defineOptions({ name: 'MesWorkScheduling' }) defineOptions({ name: 'MesWorkScheduling' })
@ -100,7 +101,15 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
//
const isShowMainButton = (row,val) => {
//console.log('row',row)
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
@ -115,9 +124,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:workScheduling:create'}), // //defaultButtons.defaultAddBtn({hasPermi:'mes:workScheduling:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:workScheduling:import'}), // defaultButtons.defaultImportBtn({hasPermi:'mes:workScheduling:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:workScheduling:export'}), // defaultButtons.defaultExportBtn({hasPermi:'mes:workScheduling:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -146,19 +155,36 @@ const buttonBaseClick = (val, item) => {
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
// ONERROR("-3", ""),
// TERMINALE("-2", ""),
// WAITBEGIN("-1", ""),
// READYTODO("0", ""),
// WORKING("1", ""),
// WAITMATERIAL("2", ""),
// PAUSE("3", ""),
// WAITREPORT("4", ""),
// WAITFCHECK("5", ""),
// FINISHED("9", "");
// - // -
const butttondata = [ const butttondata=(row) =>{ return [
defaultButtons.mainListEditBtn({hasPermi:'wms:workScheduling:update'}), // defaultButtons.mainListEditBtn({label:"调序",hasPermi:'mes:workScheduling:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:workScheduling:delete'}), // //defaultButtons.mainListDeleteBtn({hasPermi:'mes:workScheduling:delete'}), //
] 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'}), //
]}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'terminate') { //
handleDelete(row.id) changeBillStatus(row,"-2")
}else if (val == 'pause') { //
changeBillStatus(row,"3")
}else if (val == 'resume') { //
changeBillStatus(row,"0")
} }
} }
@ -197,18 +223,15 @@ const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicWorkScheduling') detailRef.value.openDetail(row, titleName, titleValue, 'basicWorkScheduling')
} }
//
/** 删除按钮操作 */ const changeBillStatus=async(row,status)=>{
const handleDelete = async (id: number) => { ///message.alertWarning("")
try { let data={
// id:row.id,
await message.delConfirm() status:status
// }
await WorkSchedulingApi.deleteWorkScheduling(id) WorkSchedulingApi.updateWorkSchedulingStatus(data);
message.success(t('common.delSuccess')) getList()
//
await getList()
} catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */

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

@ -41,17 +41,16 @@ export const WorkScheduling = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, },
isForm: false,
}, },
{ {
label: '计划编号', label: '计划编号',
field: 'planMaserCode', field: 'planMaserCode',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: false, isForm: true,
}, },
{ {
label: '任务编号', label: '工单编号',
field: 'schedulingCode', field: 'schedulingCode',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
@ -89,7 +88,7 @@ export const WorkScheduling = useCrudSchemas(reactive<CrudSchema[]>([
label: '计划数量', label: '计划数量',
field: 'planCount', field: 'planCount',
sort: 'custom', sort: 'custom',
isForm: false, isForm: true,
}, },
{ {
label: '完工数量', label: '完工数量',
@ -114,6 +113,12 @@ export const WorkScheduling = useCrudSchemas(reactive<CrudSchema[]>([
field: 'flagDo', field: 'flagDo',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm:false,
dictType: DICT_TYPE.MESDO_STATUS,
dictClass: 'string',
form: {
component: 'Select',
},
}, },
{ {
label: '当前工序', label: '当前工序',
@ -122,23 +127,30 @@ export const WorkScheduling = useCrudSchemas(reactive<CrudSchema[]>([
isForm: false, isForm: false,
}, },
{ {
label: '当前任务号', label: '加工序号',
field: 'workingTaskSort', field: 'workSort',
sort: 'custom', sort: 'custom',
isForm: false, isForm: false,
}, },
{ {
label: '工单模式', label: '当前任务号',
field: 'formType', field: 'workingTaskSort',
sort: 'custom', sort: 'custom',
isForm: false, isForm: true,
}, },
{ {
label: '生产序号', label: '工单模式',
field: 'workSort', field: 'formType',
sort: 'custom', sort: 'custom',
isForm: false, isForm: true,
dictType: DICT_TYPE.MES_WORKBILL_MODEL,
dictClass: 'string',
form: {
component: 'Select',
},
}, },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

Loading…
Cancel
Save