import request from '@/config/axios'

// PMS 物料领用明细 VO
export interface IotMaterialRequisitionDetailVO {
  id: number // 主键
  requisitionId: number // 物料领用单id
  factoryId: number     // 工厂id
  costCenterId: number  // 成本中心id
  materialId: number // 物料id
  materialCode: string // 物料编码
  materialName: string // 物料名称
  requisitionQuantity: number // 领用数量
  quantity: number  // 库存数量(不保存)
  unit: string // 基本单位
  unitPrice: number // 单价(元)
  totalPrice: number // 总金额(元)
  specification: string // 规格型号
  sort: number // 排序
  status: number // 状态 0启用  1停用
  remark: string // 备注
}

// PMS 物料领用明细 API
export const IotMaterialRequisitionDetailApi = {
  // 查询PMS 物料领用明细分页
  getIotMaterialRequisitionDetailPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-material-requisition-detail/page`, params })
  },

  // 查询PMS 物料领用明细列表
  getIotMaterialRequisitionDetailList: async (params: any) => {
    return await request.get({ url: `/pms/iot-material-requisition-detail/list`, params })
  },

  // 查询PMS 物料领用明细详情
  getIotMaterialRequisitionDetail: async (id: number) => {
    return await request.get({ url: `/pms/iot-material-requisition-detail/get?id=` + id })
  },

  // 新增PMS 物料领用明细
  createIotMaterialRequisitionDetail: async (data: IotMaterialRequisitionDetailVO) => {
    return await request.post({ url: `/pms/iot-material-requisition-detail/create`, data })
  },

  // 修改PMS 物料领用明细
  updateIotMaterialRequisitionDetail: async (data: IotMaterialRequisitionDetailVO) => {
    return await request.put({ url: `/pms/iot-material-requisition-detail/update`, data })
  },

  // 删除PMS 物料领用明细
  deleteIotMaterialRequisitionDetail: async (id: number) => {
    return await request.delete({ url: `/pms/iot-material-requisition-detail/delete?id=` + id })
  },

  // 导出PMS 物料领用明细 Excel
  exportIotMaterialRequisitionDetail: async (params) => {
    return await request.download({ url: `/pms/iot-material-requisition-detail/export-excel`, params })
  },
}
