import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProdBaseMachineInfoVO, ProdBaseMachineInfoForm, ProdBaseMachineInfoQuery } from '@/api/mes/prodBaseMachineInfo/types';

/**
 * 查询机台信息列表
 * @param query
 * @returns {*}
 */

export const listProdBaseMachineInfo = (query?: ProdBaseMachineInfoQuery): AxiosPromise<ProdBaseMachineInfoVO[]> => {
  return request({
    url: '/mes/prodBaseMachineInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询机台信息详细
 * @param machineId
 */
export const getProdBaseMachineInfo = (machineId: string | number): AxiosPromise<ProdBaseMachineInfoVO> => {
  return request({
    url: '/mes/prodBaseMachineInfo/' + machineId,
    method: 'get'
  });
};

/**
 * 新增机台信息
 * @param data
 */
export const addProdBaseMachineInfo = (data: ProdBaseMachineInfoForm) => {
  return request({
    url: '/mes/prodBaseMachineInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改机台信息
 * @param data
 */
export const updateProdBaseMachineInfo = (data: ProdBaseMachineInfoForm) => {
  return request({
    url: '/mes/prodBaseMachineInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除机台信息
 * @param machineId
 */
export const delProdBaseMachineInfo = (machineId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/prodBaseMachineInfo/' + machineId,
    method: 'delete'
  });
};


/**
 * 下拉框查询机台信息列表
 * @param query
 * @returns {*}
 */
export function getProdBaseMachineInfoList (query) {
    return request({
        url: '/mes/prodBaseMachineInfo/getProdBaseMachineInfoList',
        method: 'get',
        params: query
    });
};
