import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProdShiftChangeVO, ProdShiftChangeForm, ProdShiftChangeQuery } from '@/api/mes/prodShiftChange/types';

/**
 * 查询交接班信息列表
 * @param query
 * @returns {*}
 */

export const listProdShiftChange = (query?: ProdShiftChangeQuery): AxiosPromise<ProdShiftChangeVO[]> => {
  return request({
    url: '/mes/prodShiftChange/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询交接班信息详细
 * @param shiftChangeId
 */
export const getProdShiftChange = (shiftChangeId: string | number): AxiosPromise<ProdShiftChangeVO> => {
  return request({
    url: '/mes/prodShiftChange/' + shiftChangeId,
    method: 'get'
  });
};

/**
 * 新增交接班信息
 * @param data
 */
export const addProdShiftChange = (data: ProdShiftChangeForm) => {
  return request({
    url: '/mes/prodShiftChange',
    method: 'post',
    data: data
  });
};

/**
 * 修改交接班信息
 * @param data
 */
export const updateProdShiftChange = (data: ProdShiftChangeForm) => {
  return request({
    url: '/mes/prodShiftChange',
    method: 'put',
    data: data
  });
};

/**
 * 删除交接班信息
 * @param shiftChangeId
 */
export const delProdShiftChange = (shiftChangeId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/prodShiftChange/' + shiftChangeId,
    method: 'delete'
  });
};


/**
 * 下拉框查询交接班信息列表
 * @param query
 * @returns {*}
 */
export function getProdShiftChangeList (query) {
    return request({
        url: '/mes/prodShiftChange/getProdShiftChangeList',
        method: 'get',
        params: query
    });
};
