
import request from '@/config/axios'

export interface sopVO {
  id: number,
  sopCode: string,
  sopName: string,
  sopType: number,
  workstationId: number,
  machineryId: number,
  sopContent: string,
  sopStatus: number,
  sopIndex: number,
  remark: string
}

export interface PageParam {
  pageNo: number
  pageSize: number
  sopName?: string
  sopType?: string
  machineryId?: string
  workstationId: number,
}

export interface NotificationsVO{
  id: number,
  enableNotifications:number
}
export interface ExecutionPlanVO{
  id: number,
  enableExecutionPlan:number,
  deleteNotStartJob?:number
}
// 查询SOP列表
export const getSopPage = async (params: PageParam) => {
  return await request.get({ url: '/iscs/sop/getSopPage', params })
}

// 获取SOP详细信息
export const selectSopById = async (id: number) => {
  return await request.get({ url: '/iscs/sop/selectSopById', params: { id: id } })
}

// 新增SOP
export const insertSop = async (data: sopVO) => {
  return await request.post({ url: '/iscs/sop/insertSop', data })
}

// 修改SOP
export const updateSop = async (data: sopVO) => {
  return await request.put({ url: '/iscs/sop/updateSop', data })
}
// 更新SOP生效状态
export const updateSopStatus = async (data: sopVO) => {
  return await request.put({ url: '/iscs/sop/updateSopStatus', data })
}
// 更新启用通知
export const updateSopEnableNotification=async(data:NotificationsVO)=>{
return await request.put({ url: '/iscs/sop/updateSopEnableNotification', data })
}
// 更新执行计划
export const updateSopEnableExecutionPlan=async(data:ExecutionPlanVO)=>{
  return await request.put({ url: '/iscs/sop/updateSopEnableExecutionPlan', data })
}
// 删除SOP
export const deleteSopList = async (ids: number) => {
  return await request.delete({
    url: '/iscs/sop/deleteSopList?ids='+ids,
  })
}

