import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProdBaseProcessProdLineVO, ProdBaseProcessProdLineForm, ProdBaseProcessProdLineQuery } from '@/api/mes/prodBaseProcessProdLine/types';

/**
 * 查询工序关联产线列表
 * @param query
 * @returns {*}
 */

export const listProdBaseProcessProdLine = (query?: ProdBaseProcessProdLineQuery): AxiosPromise<ProdBaseProcessProdLineVO[]> => {
  return request({
    url: '/mes/prodBaseProcessProdLine/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工序关联产线详细
 * @param processId
 */
export const getProdBaseProcessProdLine = (processId: string | number): AxiosPromise<ProdBaseProcessProdLineVO> => {
  return request({
    url: '/mes/prodBaseProcessProdLine/' + processId,
    method: 'get'
  });
};

/**
 * 新增工序关联产线
 * @param data
 */
export const addProdBaseProcessProdLine = (data: ProdBaseProcessProdLineForm) => {
  return request({
    url: '/mes/prodBaseProcessProdLine',
    method: 'post',
    data: data
  });
};

/**
 * 修改工序关联产线
 * @param data
 */
export const updateProdBaseProcessProdLine = (data: ProdBaseProcessProdLineForm) => {
  return request({
    url: '/mes/prodBaseProcessProdLine',
    method: 'put',
    data: data
  });
};

/**
 * 删除工序关联产线
 * @param processId
 */
export const delProdBaseProcessProdLine = (processId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/prodBaseProcessProdLine/' + processId,
    method: 'delete'
  });
};


/**
 * 下拉框查询工序关联产线列表
 * @param query
 * @returns {*}
 */
export function getProdBaseProcessProdLineList (query) {
    return request({
        url: '/mes/prodBaseProcessProdLine/getProdBaseProcessProdLineList',
        method: 'get',
        params: query
    });
};
