// src/api/mes/material/manualException/index.ts
import request from '@/config/axios'

export interface ManualExceptionQuery {
  current: number
  size: number
  exceptionCategory?: string
  exceptionDescription?: string
  exceptionLevel?: string
  exceptionLevelName?: string
  exceptionType?: string
  exceptionTypeName?: string
  raiseTime?: string
  raiser?: string
  raiserName?: string
  sourceId?: string
  sourceName?: string
  startHandleTime?: string
  endHandleTime?: string
  startRaiseTime?: string
  endRaiseTime?: string
  status?: string
}

export interface ManualExceptionVO {
  exceptionId?: number
  exceptionCategory: string
  exceptionDescription?: string
  exceptionLevel: string
  exceptionLevelName?: string
  exceptionType: string
  exceptionTypeName?: string
  raiseTime?: string
  raiser?: string
  raiserName?: string
  sourceId?: string
  sourceName?: string
  handleTime?: string
  status: string
  createTime?: Date
}

// 查询人工传入异常列表
export const listManualException = async (params: ManualExceptionQuery) => {
  return await request.get({ url: '/iscs/exception/getExceptionPage', params })
}

// 查询人工传入异常详情
export const getExceptionInfo = async (id: number) => {
  return await request.get({ url: '/iscs/exception/selectExceptionById', params: { id: id } })
}

// 新增人工传入异常
export const addException = async (data: ManualExceptionVO) => {
  return await request.post({ url: '/iscs/exception/insertIsException', data })
}

// 修改人工传入异常
export const updateException = async (data: ManualExceptionVO) => {
  return await request.post({ url: '/iscs/exception/updateIsException', data })
}

// 删除人工传入异常
export const deleteException = async (id: number) => {
  return await request.post({
    url: '/iscs/exception/deleteIsExceptionByExceptionIds',
    params: { exceptionIds: id }
  })
}
