import request from '@/config/axios'

// 生产入库分配明细 VO
export interface StockInDetailVO {
  id: number // id
  stockInId: number // 入库单id
  stockInNo: string // 入库单编号
  stockInItemId: number // 入库单项id
  planId: number // 计划id
  productId: number // 产品
  number: number // 数量
}

// 生产入库分配明细 API
export const StockInDetailApi = {
  // 查询生产入库分配明细分页
  getStockInDetailPage: async (params: any) => {
    return await request.get({ url: `/mes/stock-in-detail/page`, params })
  },

  // 查询生产入库分配明细详情
  getStockInDetail: async (id: number) => {
    return await request.get({ url: `/mes/stock-in-detail/get?id=` + id })
  },

  // 新增生产入库分配明细
  createStockInDetail: async (data: StockInDetailVO) => {
    return await request.post({ url: `/mes/stock-in-detail/create`, data })
  },

  // 修改生产入库分配明细
  updateStockInDetail: async (data: StockInDetailVO) => {
    return await request.put({ url: `/mes/stock-in-detail/update`, data })
  },

  // 删除生产入库分配明细
  deleteStockInDetail: async (id: number) => {
    return await request.delete({ url: `/mes/stock-in-detail/delete?id=` + id })
  },

  // 导出生产入库分配明细 Excel
  exportStockInDetail: async (params) => {
    return await request.download({ url: `/mes/stock-in-detail/export-excel`, params })
  },
  // 更新生产入库状态（审核、反审核）
  updateMesStockInStatus: async (id: number, status: number) => {
    return await request.put({
      url: `/mes/stock-in-detail/updateStockInStatus`,
      params: {
        id,
        status
      }
    })
  },
}
