import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  TechnologyStepInfoVO,
  TechnologyStepInfoForm,
  TechnologyStepInfoQuery
} from '@/api/mes/technologyStepInfo/types';

/**
 * 查询工艺步序信息列表
 * @param query
 * @returns {*}
 */

export const listTechnologyStepInfo = (query?: TechnologyStepInfoQuery): AxiosPromise<TechnologyStepInfoVO[]> => {
  return request({
    url: '/mes/technologyStepInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工艺步序信息详细
 * @param stepId
 */
export const getTechnologyStepInfo = (stepId: string | number): AxiosPromise<TechnologyStepInfoVO> => {
  return request({
    url: '/mes/technologyStepInfo/' + stepId,
    method: 'get'
  });
};

/**
 * 新增工艺步序信息
 * @param data
 */
export const addTechnologyStepInfo = (data: TechnologyStepInfoForm) => {
  return request({
    url: '/mes/technologyStepInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改工艺步序信息
 * @param data
 */
export const updateTechnologyStepInfo = (data: TechnologyStepInfoForm) => {
  return request({
    url: '/mes/technologyStepInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除工艺步序信息
 * @param stepId
 */
export const delTechnologyStepInfo = (stepId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/technologyStepInfo/' + stepId,
    method: 'delete'
  });
};


/**
 * 下拉框查询工艺步序信息列表
 * @param query
 * @returns {*}
 */
export function getProdTechnologyStepInfoList(query) {
  return request({
    url: '/mes/technologyStepInfo/getProdTechnologyStepInfoList',
    method: 'get',
    params: query
  });
};
