import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TechnologyInfoVO, TechnologyInfoForm, TechnologyInfoQuery } from '@/api/mes/technologyInfo/types';

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

export const listTechnologyInfo = (query?: TechnologyInfoQuery): AxiosPromise<TechnologyInfoVO[]> => {
  return request({
    url: '/mes/technologyInfo/list',
    method: 'get',
    params: query
  });
};

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

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

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

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


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