import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseRouteProcessVO, BaseRouteProcessForm, BaseRouteProcessQuery } from '@/api/mes/baseRouteProcess/types';

/**
 * 查询工艺路线组成信息列表
 * @param query
 * @returns {*}
 */

export const listBaseRouteProcess = (query?: BaseRouteProcessQuery): AxiosPromise<BaseRouteProcessVO[]> => {
  return request({
    url: '/mes/baseRouteProcess/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工艺路线组成信息详细
 * @param routeProcessId
 */
export const getBaseRouteProcess = (routeProcessId: string | number): AxiosPromise<BaseRouteProcessVO> => {
  return request({
    url: '/mes/baseRouteProcess/' + routeProcessId,
    method: 'get'
  });
};

/**
 * 新增工艺路线组成信息
 * @param data
 */
export const addBaseRouteProcess = (data: BaseRouteProcessForm) => {
  return request({
    url: '/mes/baseRouteProcess',
    method: 'post',
    data: data
  });
};

/**
 * 修改工艺路线组成信息
 * @param data
 */
export const updateBaseRouteProcess = (data: BaseRouteProcessForm) => {
  return request({
    url: '/mes/baseRouteProcess',
    method: 'put',
    data: data
  });
};

/**
 * 删除工艺路线组成信息
 * @param routeProcessId
 */
export const delBaseRouteProcess = (routeProcessId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/baseRouteProcess/' + routeProcessId,
    method: 'delete'
  });
};


/**
 * 下拉框查询工艺路线组成信息列表
 * @param query
 * @returns {*}
 */
export function getBaseRouteProcessList (query) {
    return request({
        url: '/mes/baseRouteProcess/getBaseRouteProcessList',
        method: 'get',
        params: query
    });
};
