import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseProdLineInfoVO, BaseProdLineInfoForm, BaseProdLineInfoQuery } from '@/api/mes/baseProdLineInfo/types';

/**
 * 查询产线信息列表
 * @param query
 * @returns {*}
 */

export const listBaseProdLineInfo = (query?: BaseProdLineInfoQuery): AxiosPromise<BaseProdLineInfoVO[]> => {
  return request({
    url: '/mes/baseProdLineInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产线信息详细
 * @param prodLineId
 */
export const getBaseProdLineInfo = (prodLineId: string | number): AxiosPromise<BaseProdLineInfoVO> => {
  return request({
    url: '/mes/baseProdLineInfo/' + prodLineId,
    method: 'get'
  });
};

/**
 * 新增产线信息
 * @param data
 */
export const addBaseProdLineInfo = (data: BaseProdLineInfoForm) => {
  return request({
    url: '/mes/baseProdLineInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改产线信息
 * @param data
 */
export const updateBaseProdLineInfo = (data: BaseProdLineInfoForm) => {
  return request({
    url: '/mes/baseProdLineInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除产线信息
 * @param prodLineId
 */
export const delBaseProdLineInfo = (prodLineId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/baseProdLineInfo/' + prodLineId,
    method: 'delete'
  });
};


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