import request from '@/config/axios'

// 记录表 VO
export interface RecordTemplateVO {
  id: number // 组织id
  name: string // 名称
  organizationId: number // 组织id
  machineId: number // 对应机台id
  workTeamId: number // 班组id
  startTime: Date // 开始时间
  endTime: Date // 结束时间
  groupManagerApproveId1: number // 组长上午审批id
  groupManagerApproveId2: number // 组长下午审批id
  productionManagerApproveId1: number // 主管上午审批id
  productionManagerApproveId2: number // 主管下午审批id
  processInstanceId: string // 流程实例的编号
  status: number // 状态
  recordType: string // 记录类型（工序类型）
  remark: string // 备注
  isEnable: boolean // 是否启用
}

// 记录表 API
export const RecordTemplateApi = {
  // 查询记录表分页
  getRecordTemplatePage: async (params: any) => {
    return await request.get({ url: `/mes/record-template/page`, params })
  },

  // 查询记录表详情
  getRecordTemplate: async (id: number) => {
    return await request.get({ url: `/mes/record-template/get?id=` + id })
  },

  // 新增记录表
  createRecordTemplate: async (data: RecordTemplateVO) => {
    return await request.post({ url: `/mes/record-template/create`, data })
  },

  // 修改记录表
  updateRecordTemplate: async (data: RecordTemplateVO) => {
    return await request.put({ url: `/mes/record-template/update`, data })
  },

  // 删除记录表
  deleteRecordTemplate: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/delete?id=` + id })
  },

  // 导出记录表 Excel
  exportRecordTemplate: async (params) => {
    return await request.download({ url: `/mes/record-template/export-excel`, params })
  },

// ==================== 子表（成型记录） ====================

  // 获得成型记录分页
  getRecordChengxingPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-chengxing/page`, params })
  },
  // 新增成型记录
  createRecordChengxing: async (data) => {
    return await request.post({ url: `/mes/record-template/record-chengxing/create`, data })
  },

  // 修改成型记录
  updateRecordChengxing: async (data) => {
    return await request.put({ url: `/mes/record-template/record-chengxing/update`, data })
  },

  // 删除成型记录
  deleteRecordChengxing: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-chengxing/delete?id=` + id })
  },

  // 获得成型记录
  getRecordChengxing: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-chengxing/get?id=` + id })
  },
  // ==================== 子表（碎浆记录） ====================

  // 获得碎浆记录分页
  getRecordSuijiangPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-suijiang/page`, params })
  },
  // 新增碎浆记录
  createRecordSuijiang: async (data) => {
    return await request.post({ url: `/mes/record-template/record-suijiang/create`, data })
  },

  // 修改碎浆记录
  updateRecordSuijiang: async (data) => {
    return await request.put({ url: `/mes/record-template/record-suijiang/update`, data })
  },

  // 删除碎浆记录
  deleteRecordSuijiang: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-suijiang/delete?id=` + id })
  },

  // 获得碎浆记录
  getRecordSuijiang: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-suijiang/get?id=` + id })
  },

  // ==================== 子表（热压记录） ====================

  // 获得热压记录分页
  getRecordReyaPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-reya/page`, params })
  },
  // 新增热压记录
  createRecordReya: async (data) => {
    return await request.post({ url: `/mes/record-template/record-reya/create`, data })
  },

  // 修改热压记录
  updateRecordReya: async (data) => {
    return await request.put({ url: `/mes/record-template/record-reya/update`, data })
  },

  // 删除热压记录
  deleteRecordReya: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-reya/delete?id=` + id })
  },

  // 获得热压记录
  getRecordReya: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-reya/get?id=` + id })
  },

// ==================== 子表（切边记录） ====================

  // 获得切边记录分页
  getRecordQiebianPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-qiebian/page`, params })
  },
  // 新增切边记录
  createRecordQiebian: async (data) => {
    return await request.post({ url: `/mes/record-template/record-qiebian/create`, data })
  },

  // 修改切边记录
  updateRecordQiebian: async (data) => {
    return await request.put({ url: `/mes/record-template/record-qiebian/update`, data })
  },

  // 删除切边记录
  deleteRecordQiebian: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-qiebian/delete?id=` + id })
  },

  // 获得切边记录
  getRecordQiebian: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-qiebian/get?id=` + id })
  },
  // ==================== 子表（打包记录） ====================

  // 获得打包记录分页
  getRecordDabaoPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-dabao/page`, params })
  },
  // 新增打包记录
  createRecordDabao: async (data) => {
    return await request.post({ url: `/mes/record-template/record-dabao/create`, data })
  },

  // 修改打包记录
  updateRecordDabao: async (data) => {
    return await request.put({ url: `/mes/record-template/record-dabao/update`, data })
  },

  // 删除打包记录
  deleteRecordDabao: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-dabao/delete?id=` + id })
  },

  // 获得打包记录
  getRecordDabao: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-dabao/get?id=` + id })
  },
// ==================== 子表（打浆记录） ====================

  // 获得打浆记录分页
  getRecordDajiangPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-dajiang/page`, params })
  },
  // 新增打浆记录
  createRecordDajiang: async (data) => {
    return await request.post({ url: `/mes/record-template/record-dajiang/create`, data })
  },

  // 修改打浆记录
  updateRecordDajiang: async (data) => {
    return await request.put({ url: `/mes/record-template/record-dajiang/update`, data })
  },

  // 删除打浆记录
  deleteRecordDajiang: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-dajiang/delete?id=` + id })
  },

  // 获得打浆记录
  getRecordDajiang: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-dajiang/get?id=` + id })
  },
  // ==================== 子表（干燥记录） ====================

  // 获得干燥记录分页
  getRecordGanzaoPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-ganzao/page`, params })
  },
  // 新增干燥记录
  createRecordGanzao: async (data) => {
    return await request.post({ url: `/mes/record-template/record-ganzao/create`, data })
  },

  // 修改干燥记录
  updateRecordGanzao: async (data) => {
    return await request.put({ url: `/mes/record-template/record-ganzao/update`, data })
  },

  // 删除干燥记录
  deleteRecordGanzao: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-ganzao/delete?id=` + id })
  },

  // 获得干燥记录
  getRecordGanzao: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-ganzao/get?id=` + id })
  },
  // ==================== 子表（加湿记录） ====================

  // 获得加湿记录分页
  getRecordJiashiPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-jiashi/page`, params })
  },
  // 新增加湿记录
  createRecordJiashi: async (data) => {
    return await request.post({ url: `/mes/record-template/record-jiashi/create`, data })
  },

  // 修改加湿记录
  updateRecordJiashi: async (data) => {
    return await request.put({ url: `/mes/record-template/record-jiashi/update`, data })
  },

  // 删除加湿记录
  deleteRecordJiashi: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-jiashi/delete?id=` + id })
  },

  // 获得加湿记录
  getRecordJiashi: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-jiashi/get?id=` + id })
  },
  // ==================== 子表（检验记录） ====================

  // 获得检验记录分页
  getRecordPinjianPage: async (params) => {
    return await request.get({ url: `/mes/record-template/record-pinjian/page`, params })
  },
  // 新增检验记录
  createRecordPinjian: async (data) => {
    return await request.post({ url: `/mes/record-template/record-pinjian/create`, data })
  },

  // 修改检验记录
  updateRecordPinjian: async (data) => {
    return await request.put({ url: `/mes/record-template/record-pinjian/update`, data })
  },

  // 删除检验记录
  deleteRecordPinjian: async (id: number) => {
    return await request.delete({ url: `/mes/record-template/record-pinjian/delete?id=` + id })
  },

  // 获得检验记录
  getRecordPinjian: async (id: number) => {
    return await request.get({ url: `/mes/record-template/record-pinjian/get?id=` + id })
  },
  
}

