| | |
| | | * 报修状态 |
| | | */ |
| | | export enum REPAIR_REQ_STATUS { |
| | | JIEDAN = '0', // 待接单 |
| | | WEIXIU = '1', // 维修中 |
| | | WANCHENG = '2' // 已完成 |
| | | DAIJIEDAN = '0', // 待接单 |
| | | WANCHENG = '3', // 已完成 |
| | | WEIXIU = '2', // 维修中 |
| | | YIJIEDAN = '1' // 已接单 |
| | | } |
| | | |
| | | /** |
| | | * 维修工单状态 |
| | | */ |
| | | export enum REPAIR_RES_STATUS { |
| | | WANCHENG = '3', // 已完成 |
| | | WEIXIU = '2', // 维修中 |
| | | YIJIEDAN = '1' // 已接单 |
| | | } |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | |
| | | import { renderDict } from '#/utils/render'; |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: '处理时间', |
| | | field: 'handleTime', |
| | | width: 200 |
| | | }, |
| | | { |
| | | title: '操作用户', |
| | | field: 'operaUser', |
| | | width: 160, |
| | | field: 'operaUserName', |
| | | width: 160 |
| | | }, |
| | | { |
| | | title: '操作', |
| | | field: 'opera', |
| | | width: 100, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.opera) { |
| | | return ''; |
| | | } |
| | | return renderDict(row.opera, DictEnum.REPAIR_RECORD_HANDLE); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: '操作结果', |
| | | field: 'operaResult', |
| | | width: 160, |
| | | width: 160 |
| | | }, |
| | | { |
| | | title: '', |
| | | field: 'blank', |
| | | minWidth: 100, |
| | | minWidth: 100 |
| | | } |
| | | ]; |
| | |
| | | |
| | | // 使用 watch 监听 resId 的变化 |
| | | watch( |
| | | () => props.reqId, |
| | | (newVal, oldVal) => { |
| | | if (newVal !== oldVal && newVal) { |
| | | tableApi.query(); |
| | | } |
| | | }, |
| | | { immediate: false } |
| | | ); |
| | | |
| | | // 使用 watch 监听 resId 的变化 |
| | | watch( |
| | | () => props.resId, |
| | | (newVal, oldVal) => { |
| | | if (newVal !== oldVal && newVal) { |
| | |
| | | getPopupContainer, |
| | | options: getDictOptions(DictEnum.REPAIR_REQ_STATUS) |
| | | }, |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'status', |
| | | defaultValue: '0', |
| | | label: '处理状态' |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted } from 'vue'; |
| | | import { onMounted, ref } from 'vue'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | |
| | | import { columns, querySchema } from './data'; |
| | | import repairReqDrawer from './repair-req-drawer.vue'; |
| | | import sendWorkDrawer from './send-work-drawer.vue'; |
| | | import RepairRecord from '#/views/eims/repair-record/index.vue'; |
| | | |
| | | interface Props { |
| | | filterFlag?: boolean; |
| | |
| | | }, |
| | | id: 'eims-repair-req-index' |
| | | }; |
| | | |
| | | const reqId = ref<string>(); |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | reqId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | function openSendWork() { |
| | | const rows = tableApi.grid.getCheckboxRecords(); |
| | | const ids = rows.map((row: any) => row.id).join(','); |
| | | const filterData = rows.filter((item) => item.status === REPAIR_REQ_STATUS.WEIXIU || item.status === REPAIR_REQ_STATUS.WANCHENG); |
| | | // 不允许选择待接单以外状态的数据 |
| | | const filterData = rows.filter((item) => item.status !== REPAIR_REQ_STATUS.DAIJIEDAN); |
| | | if (rows.length === 0) { |
| | | message.warn('请选择报修单后派工!'); |
| | | return; |
| | |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="故障报修列表"> |
| | | <div class="flex h-full gap-[8px] flex-col"> |
| | | <BasicTable class="h-2/3" table-title="故障报修列表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:repairReq:send']" @click="openSendWork"> 派工 </a-button> |
| | |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <RepairRecord :req-id="reqId" class="h-1/3" table-title="维修记录" /> |
| | | </div> |
| | | <RepairReqDrawer @reload="tableApi.query()" /> |
| | | <SendWorkDrawer @reload="tableApi.query()" /> |
| | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import dayjs from 'dayjs'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { REPAIR_REQ_TYPE } from '#/constants/dict'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | import { renderDict } from '#/utils/render'; |
| | | |
| | | const curDateTime = dayjs().format('YYYY-MM-DD HH:mm:ss'); |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | |
| | | { |
| | | title: '报修单号', |
| | | field: 'reqCode', |
| | | minWidth: 160, |
| | | minWidth: 160 |
| | | }, |
| | | { |
| | | title: '维修部门', |
| | |
| | | fixed: 'right', |
| | | slots: { default: 'action' }, |
| | | title: '操作', |
| | | width: 130 |
| | | width: 200 |
| | | } |
| | | ]; |
| | | |
| | |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | label: '报修id' |
| | | label: '报修id', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | label: '报修人' |
| | | label: '报修人', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | label: '报修部门' |
| | | label: '报修部门', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'reqCode', |
| | | label: '报修单号' |
| | | label: '报修单号', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'resCode', |
| | | label: '维修单号' |
| | | label: '维修单号', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'resReason', |
| | | label: '原因分析' |
| | | label: '原因分析', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'resHandle', |
| | | label: '处理措施' |
| | | label: '处理措施', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'resPrevent', |
| | | label: '预防措施' |
| | | label: '预防措施', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | |
| | | options: getDictOptions(DictEnum.REPAIR_RES_STATUS) |
| | | }, |
| | | fieldName: 'status', |
| | | defaultValue: '0', |
| | | label: '维修状态' |
| | | defaultValue: '1', |
| | | label: '维修状态', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | getPopupContainer |
| | | }, |
| | | defaultValue: curDateTime, |
| | | fieldName: 'startTime', |
| | | label: '开始时间' |
| | | label: '开始时间', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | |
| | | defaultValue: undefined, |
| | | fieldName: 'resDept', |
| | | label: '维修部门', |
| | | help: `报修人员所属部门` |
| | | // rules: 'selectRequired', |
| | | help: `报修人员所属部门`, |
| | | rules: 'selectRequired' |
| | | }, |
| | | { |
| | | component: 'Select', |
| | |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'resUser', |
| | | label: '维修人' |
| | | label: '维修人', |
| | | rules: 'selectRequired' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'remark', |
| | | label: '备注' |
| | | }, |
| | | } |
| | | ]; |
| | | |
| | | |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted, ref } from 'vue'; |
| | | import { computed, onMounted, ref } from 'vue'; |
| | | |
| | | import { useAccess } from '@vben/access'; |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { useUserStore } from '@vben/stores'; |
| | |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delRepairRes, listRepairRes, repairResExport } from '#/api/eims/repair-res'; |
| | | import { delRepairRes, listRepairRes, repairResExport, updateRepairRes } from '#/api/eims/repair-res'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { REPAIR_RES_STATUS } from '#/constants/dict'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import RepairRecord from '../repair-record/index.vue'; |
| | |
| | | repairResDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEditStatus(record: Recordable<any>, status: string) { |
| | | repairResDrawerApi.setData({ id: record.id, action: status, status }); |
| | | repairResDrawerApi.open(); |
| | | } |
| | | |
| | | const { hasAccessByRoles } = useAccess(); |
| | | const isSuperAdmin = computed(() => hasAccessByRoles(['superadmin'])); |
| | | |
| | | function weixiu(row: any) { |
| | | return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.YIJIEDAN; |
| | | } |
| | | |
| | | function wancheng(row: any) { |
| | | return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.WEIXIU; |
| | | } |
| | | |
| | | async function handleRepairStatus(record: Recordable<any>, status: string) { |
| | | record.status = status; |
| | | handleConfirm(record); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delRepairRes(row.id); |
| | | await tableApi.query(); |
| | |
| | | commonDownloadExcel(repairResExport, '维修工单记录', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | async function handleConfirm(data: any) { |
| | | try { |
| | | await updateRepairRes(data); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | } |
| | | } |
| | | |
| | | onMounted(async () => { |
| | |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:repairRes:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:repairRes:add']" @click="handleAdd"> 接单</a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button |
| | | v-if="weixiu(row)" |
| | | class="btn-success" |
| | | v-access:code="['eims:repairRes:edit']" |
| | | @click.stop="handleEditStatus(row, REPAIR_RES_STATUS.WEIXIU)" |
| | | > |
| | | 维修 |
| | | </ghost-button> |
| | | |
| | | <ghost-button |
| | | v-if="wancheng(row)" |
| | | class="btn-success" |
| | | v-access:code="['eims:repairRes:edit']" |
| | | @click.stop="handleEditStatus(row, REPAIR_RES_STATUS.WANCHENG)" |
| | | > |
| | | 完成 |
| | | </ghost-button> |
| | | |
| | | <ghost-button v-access:code="['eims:repairRes:edit']" @click.stop="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addRepairRes, getRepairRes, updateRepairRes } from '#/api/eims/repair-res'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { REPAIR_RES_STATUS } from '#/constants/dict'; |
| | | import reqModal from '#/views/eims/components/repair-req-modal.vue'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | |
| | | |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | const { action } = drawerApi.getData() as { action?: string }; |
| | | const { resUser } = drawerApi.getData() as { resUser?: number | string }; |
| | | const { resDept } = drawerApi.getData() as { resDept?: number | string }; |
| | | isUpdate.value = !!id; |
| | |
| | | await setupUserOptions(record.resDept); |
| | | } |
| | | } |
| | | showAllColumns(); |
| | | // 根据action 显示隐藏列 |
| | | if (action && action === REPAIR_RES_STATUS.WEIXIU) { |
| | | await formApi.setValues({ 'status': REPAIR_RES_STATUS.WEIXIU }); |
| | | showWeixiuColumns(); |
| | | } else if (action && action === REPAIR_RES_STATUS.WANCHENG) { |
| | | await formApi.setValues({ 'status': REPAIR_RES_STATUS.WANCHENG }); |
| | | showWanchengColumns(); |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | function showAllColumns() { |
| | | const show = true; |
| | | formApi.updateSchema([ |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resReason' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resHandle' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resPrevent' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'status' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'endTime' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resDept' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resUser' |
| | | } |
| | | ]); |
| | | } |
| | | function showWeixiuColumns() { |
| | | const show = false; |
| | | formApi.updateSchema([ |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resReason' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resHandle' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resPrevent' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'status' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'endTime' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resDept' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resUser' |
| | | } |
| | | ]); |
| | | } |
| | | function showWanchengColumns() { |
| | | const show = false; |
| | | formApi.updateSchema([ |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'status' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | const [ReqModal, reqModalApi] = useVbenModal({ |
| | | connectedComponent: reqModal, |
| | | draggable: true, |
| | |
| | | FIXTURE_BORROW_RECORD_STATUS = 'fixture_borrow_record_status', // 工具(治具)借用记录状态 |
| | | FIXTURE_BORROW_STATUS = 'fixture_borrow_status', // 工具(治具)借用状态 |
| | | REPAIR_FAULT_TYPE = 'repair_fault_type', // 报修状态 |
| | | REPAIR_RECORD_HANDLE = 'repair_record_handle', // 维修记录操作 |
| | | REPAIR_REQ_STATUS = 'repair_req_status', // 报修状态 |
| | | REPAIR_RES_STATUS = 'repair_res_status', // 维修状态 |
| | | REPAIR_REQ_TYPE = 'repair_req_type', // 报修类型 |
| | | REPAIR_RES_STATUS = 'repair_res_status', // 维修状态 |
| | | REPAIR_URGENCY_LEVEL = 'repair_urgency_level', // 报修紧急程度 |
| | | SYS_COMMON_STATUS = 'sys_common_status', |
| | | SYS_DEVICE_TYPE = 'sys_device_type', // 设备类型 |
| | |
| | | String REPAIR_REQ_STATUS = "repair_req_status"; |
| | | interface REPAIR_REQ_STATUS_DETAIL { |
| | | /** |
| | | * 接单 |
| | | * 已接单 |
| | | */ |
| | | String JIEDAN = "0"; |
| | | String YIJIEDAN = "1"; |
| | | /** |
| | | * 维修 |
| | | */ |
| | | String WEIXIU = "1"; |
| | | String WEIXIU = "2"; |
| | | /** |
| | | * 完成 |
| | | */ |
| | | String WANCHENG = "2"; |
| | | String WANCHENG = "3"; |
| | | } |
| | | |
| | | /** |
| | |
| | | String REPAIR_RES_STATUS = "repair_res_status"; |
| | | interface REPAIR_RES_STATUS_DETAIL { |
| | | /** |
| | | * 接单 |
| | | */ |
| | | String YIJIEDAN = "1"; |
| | | |
| | | /** |
| | | * 维修 |
| | | */ |
| | | String WEIXIU = "0"; |
| | | String WEIXIU = "2"; |
| | | /** |
| | | * 完成 |
| | | */ |
| | | String WANCHENG = "1"; |
| | | String WANCHENG = "3"; |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 接单 |
| | | */ |
| | | String JIEDAN = "2"; |
| | | String YIJIEDAN = "2"; |
| | | |
| | | /** |
| | | * 维修 |
| | | */ |
| | | String WEIXIU = "3"; |
| | | |
| | | /** |
| | | * 完成 |
| | | */ |
| | | String WANCHENG = "3"; |
| | | String WANCHENG = "4"; |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 报修单id |
| | | */ |
| | | @NotNull(message = "报修单不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long reqId; |
| | | |
| | | private Long reqUser;//报修人 |
| | |
| | | /** |
| | | * 维修单号 |
| | | */ |
| | | @NotNull(message = "报修单编号不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private String resCode; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | @NotNull(message = "维修人不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long resUser; |
| | | |
| | | /** |
| | | * 维修人部门 |
| | | */ |
| | | @NotNull(message = "维修人部门不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long resDept; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 维修状态(字典) |
| | | */ |
| | | @NotBlank(message = "维修状态(字典)不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private String status; |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @NotNull(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Date startTime; |
| | | |
| | | /** |
| | |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.eims.domain.EimsRepairRecord; |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long id; |
| | |
| | | @ExcelProperty(value = "操作用户") |
| | | private Long operaUser; |
| | | |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "operaUser") |
| | | private Long operaUserName; |
| | | |
| | | |
| | | /** |
| | | * 操作(字典) |
| | | */ |
| | |
| | | //新增状态 |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.XINZENG); |
| | | record.setOperaUser(add.getCreateBy()); |
| | | record.setOperaResult("新增,生成报修单"); |
| | | record.setOperaResult("生成报修单"); |
| | | //新增时生成记录 |
| | | recordMapper.insert(record); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import lombok.SneakyThrows; |
| | | import org.dromara.common.core.constant.DictConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.service.RepairResService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.eims.domain.*; |
| | | import org.dromara.eims.domain.vo.EimsRepairReqVo; |
| | | import org.dromara.eims.mapper.EimsRepairRecordMapper; |
| | |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.vo.SysDeptVo; |
| | | import org.dromara.system.mapper.SysDeptMapper; |
| | | import org.redisson.misc.LogHelper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsRepairResBo; |
| | | import org.dromara.eims.domain.vo.EimsRepairResVo; |
| | |
| | | // 新增维修工单的时候更新报修单数据 |
| | | EimsRepairReqVo reqVo = reqMapper.selectVoById(bo.getReqId()); |
| | | reqVo.setRepairId(add.getId()); |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WEIXIU); |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.YIJIEDAN); |
| | | EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); |
| | | reqMapper.updateById(req); |
| | | |
| | |
| | | record.setResId(add.getId()); |
| | | record.setHandleTime(new Date()); |
| | | //接单状态 |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.JIEDAN); |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.YIJIEDAN); |
| | | record.setOperaUser(add.getCreateBy()); |
| | | record.setOperaResult("接单,生成维修工单"); |
| | | record.setOperaResult("生成维修工单"); |
| | | //新增时生成记录 |
| | | recordMapper.insert(record); |
| | | |
| | |
| | | insert.setResCode(reqVo.getCode().replace("BXD","WXD")); |
| | | insert.setResUser(bo.getResUser()); |
| | | insert.setResDept(bo.getResDept()); |
| | | insert.setStatus(DictConstants.REPAIR_RES_STATUS_DETAIL.WEIXIU); |
| | | insert.setStartTime(new Date()); |
| | | insert.setStatus(DictConstants.REPAIR_RES_STATUS_DETAIL.YIJIEDAN); |
| | | Boolean b = insertByBo(insert); |
| | | if(!b)throw new Exception(""); |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean updateByBo(EimsRepairResBo bo) { |
| | | LoginUser loginUser = LoginHelper.getLoginUser(); |
| | | EimsRepairRes update = MapstructUtils.convert(bo, EimsRepairRes.class); |
| | | |
| | | EimsRepairResVo resVo = baseMapper.selectVoById(bo.getId()); |
| | | String status = resVo.getStatus(); |
| | | //首次更新需要同步更新报修单状态 |
| | | //维修工单开始维修,同步更新报修单 以及 维修记录 |
| | | if (bo.getStatus().equals(DictConstants.REPAIR_RES_STATUS_DETAIL.WEIXIU) && |
| | | status.equals(DictConstants.REPAIR_RES_STATUS_DETAIL.YIJIEDAN)) { |
| | | //1.设置开始维修时间 |
| | | |
| | | //2.更新报修单为维修状态 |
| | | EimsRepairReqVo reqVo = reqMapper.selectVoById(bo.getReqId()); |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WEIXIU); |
| | | EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); |
| | | reqMapper.updateById(req); |
| | | |
| | | //3.生成维修记录 |
| | | EimsRepairRecord record = new EimsRepairRecord(); |
| | | record.setResId(bo.getId()); |
| | | record.setReqId(bo.getReqId()); |
| | | record.setHandleTime(new Date()); |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.WEIXIU); |
| | | assert loginUser != null; |
| | | record.setOperaUser(loginUser.getUserId()); |
| | | record.setOperaResult("开始维修"); |
| | | recordMapper.insert(record); |
| | | } |
| | | |
| | | |
| | | //维修工单完成,同步更新报修单 以及 维修记录 |
| | | if (bo.getStatus().equals(DictConstants.REPAIR_RES_STATUS_DETAIL.WANCHENG) && |
| | | status.equals(DictConstants.REPAIR_RES_STATUS_DETAIL.WEIXIU)) { |
| | | //1.设置结束维修时间 |
| | | |
| | | //2.更新报修单为完成状态 |
| | | EimsRepairReqVo reqVo = reqMapper.selectVoById(bo.getReqId()); |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WANCHENG); |
| | | EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); |
| | | reqMapper.updateById(req); |
| | | |
| | | //生成维修记录 |
| | | //3.生成维修记录 |
| | | EimsRepairRecord record = new EimsRepairRecord(); |
| | | record.setResId(bo.getId()); |
| | | record.setReqId(bo.getReqId()); |
| | | record.setHandleTime(new Date()); |
| | | //完成状态 |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.WANCHENG); |
| | | record.setOperaUser(bo.getUpdateBy()); |
| | | assert loginUser != null; |
| | | record.setOperaUser(loginUser.getUserId()); |
| | | record.setOperaResult("完成维修工单"); |
| | | recordMapper.insert(record); |
| | | |
| | | } |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | |
| | | userList.add(loginUser.getUserId()); |
| | | }else if (rolePermission.contains(Role.repair.name())) { |
| | | //TODO 维修工只能查询未接单状态的报修单(具体状态参考字典repair_req_status) |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.JIEDAN); |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.YIJIEDAN); |
| | | } |
| | | if(userList.size()>0){ |
| | | params.put("createBy", userList); |